summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1251_ps.c
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2009-11-17 18:48:37 +0200
committerJohn W. Linville <linville@tuxdriver.com>2009-11-18 17:09:20 -0500
commitd5da79ac1f5050cccaa68d814ccce292371f25fa (patch)
tree2774979009bbc0a4efd5ea3d3a4bb5c03287c6c6 /drivers/net/wireless/wl12xx/wl1251_ps.c
parent6b21a2cd315e2e56a1748bd3ef9d910fe4f2e711 (diff)
wl1251: Implement delayed entry into ELP mode
Implement (slightly) delayed entry into ELP. This will cure several problems: - It works around a firmware race condition if ELP is entered too fast after commands (resulting in ELP timeout -traces) - It will reduce the number of sleep-wake cycles between already scheduled events such as interrupts and tx, hence improving performance (less delay in switching between RX and TX) Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com> Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1251_ps.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_ps.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_ps.c b/drivers/net/wireless/wl12xx/wl1251_ps.c
index c3e348a1232..9931b197ff7 100644
--- a/drivers/net/wireless/wl12xx/wl1251_ps.c
+++ b/drivers/net/wireless/wl12xx/wl1251_ps.c
@@ -28,17 +28,41 @@
#define WL1251_WAKEUP_TIMEOUT 2000
-/* Routines to toggle sleep mode while in ELP */
-void wl1251_ps_elp_sleep(struct wl1251 *wl)
+void wl1251_elp_work(struct work_struct *work)
{
+ struct delayed_work *dwork;
+ struct wl1251 *wl;
+
+ dwork = container_of(work, struct delayed_work, work);
+ wl = container_of(dwork, struct wl1251, elp_work);
+
+ wl1251_debug(DEBUG_PSM, "elp work");
+
+ mutex_lock(&wl->mutex);
+
if (wl->elp || !wl->psm)
- return;
+ goto out;
wl1251_debug(DEBUG_PSM, "chip to elp");
-
wl1251_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP);
-
wl->elp = true;
+
+out:
+ mutex_unlock(&wl->mutex);
+}
+
+#define ELP_ENTRY_DELAY 5
+
+/* Routines to toggle sleep mode while in ELP */
+void wl1251_ps_elp_sleep(struct wl1251 *wl)
+{
+ unsigned long delay;
+
+ if (wl->psm) {
+ cancel_delayed_work(&wl->elp_work);
+ delay = msecs_to_jiffies(ELP_ENTRY_DELAY);
+ ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, delay);
+ }
}
int wl1251_ps_elp_wakeup(struct wl1251 *wl)