Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

wlcore: android: add wake_locks (INTERNAL)

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information...
commit 2ffc1a8b24e1d46400ffe63d4dd558f8fa2253be 1 parent 4349d32
@elp elp authored ariknem committed
View
21 drivers/net/wireless/ti/wlcore/main.c
@@ -645,6 +645,11 @@ static irqreturn_t wlcore_irq(int irq, void *cookie)
if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags) &&
wl1271_tx_total_queue_count(wl) > 0)
ieee80211_queue_work(wl->hw, &wl->tx_work);
+
+#ifdef CONFIG_HAS_WAKELOCK
+ if (test_and_clear_bit(WL1271_FLAG_WAKE_LOCK, &wl->flags))
+ wake_unlock(&wl->wake_lock);
+#endif
spin_unlock_irqrestore(&wl->wl_lock, flags);
mutex_unlock(&wl->mutex);
@@ -5417,6 +5422,10 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size)
wl->tx_frames[i] = NULL;
spin_lock_init(&wl->wl_lock);
+#ifdef CONFIG_HAS_WAKELOCK
+ wake_lock_init(&wl->wake_lock, WAKE_LOCK_SUSPEND, "wl1271_wake");
+ wake_lock_init(&wl->rx_wake, WAKE_LOCK_SUSPEND, "rx_wake");
+#endif
wl->state = WL1271_STATE_OFF;
wl->fw_type = WL12XX_FW_TYPE_NONE;
@@ -5478,6 +5487,10 @@ EXPORT_SYMBOL_GPL(wlcore_alloc_hw);
int wlcore_free_hw(struct wl1271 *wl)
{
+#ifdef CONFIG_HAS_WAKELOCK
+ wake_lock_destroy(&wl->wake_lock);
+ wake_lock_destroy(&wl->rx_wake);
+#endif
/* Unblock any fwlog readers */
mutex_lock(&wl->mutex);
wl->fwlog_size = -1;
@@ -5534,9 +5547,17 @@ static irqreturn_t wl12xx_hardirq(int irq, void *cookie)
wl1271_debug(DEBUG_IRQ, "should not enqueue work");
disable_irq_nosync(wl->irq);
pm_wakeup_event(wl->dev, 0);
+#ifdef CONFIG_HAS_WAKELOCK
+ if (!test_and_set_bit(WL1271_FLAG_WAKE_LOCK, &wl->flags))
+ wake_lock(&wl->wake_lock);
+#endif
spin_unlock_irqrestore(&wl->wl_lock, flags);
return IRQ_HANDLED;
}
+#ifdef CONFIG_HAS_WAKELOCK
+ if (!test_and_set_bit(WL1271_FLAG_WAKE_LOCK, &wl->flags))
+ wake_lock(&wl->wake_lock);
+#endif
spin_unlock_irqrestore(&wl->wl_lock, flags);
return IRQ_WAKE_THREAD;
View
5 drivers/net/wireless/ti/wlcore/rx.c
@@ -197,6 +197,11 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
skb_queue_tail(&wl->deferred_rx_queue, skb);
queue_work(wl->freezable_wq, &wl->netstack_work);
+#ifdef CONFIG_HAS_WAKELOCK
+ /* let the frame some time to propagate to user-space */
+ wake_lock_timeout(&wl->rx_wake, HZ);
+#endif
+
return is_data;
}
View
4 drivers/net/wireless/ti/wlcore/wlcore.h
@@ -285,6 +285,10 @@ struct wl1271 {
/* in dBm */
int power_level;
+#ifdef CONFIG_HAS_WAKELOCK
+ struct wake_lock wake_lock;
+ struct wake_lock rx_wake;
+#endif
struct wl1271_stats stats;
__le32 buffer_32;
View
4 drivers/net/wireless/ti/wlcore/wlcore_i.h
@@ -31,6 +31,9 @@
#include <linux/list.h>
#include <linux/bitops.h>
#include <net/mac80211.h>
+#ifdef CONFIG_HAS_WAKELOCK
+#include <linux/wakelock.h>
+#endif
#include "conf.h"
#include "ini.h"
@@ -232,6 +235,7 @@ enum wl12xx_flags {
WL1271_FLAG_TX_PENDING,
WL1271_FLAG_IN_ELP,
WL1271_FLAG_ELP_REQUESTED,
+ WL1271_FLAG_WAKE_LOCK,
WL1271_FLAG_IRQ_RUNNING,
WL1271_FLAG_FW_TX_BUSY,
WL1271_FLAG_DUMMY_PACKET_PENDING,
Please sign in to comment.
Something went wrong with that request. Please try again.