wl1271: Go to ELP in idle
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>
Fri, 9 Apr 2010 08:07:29 +0000 (11:07 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 9 Apr 2010 17:43:10 +0000 (13:43 -0400)
Allow the wl1271 go to ELP mode also in idle. This will reduce current
consumption remarkably in idle mode (~12mA -> ~0.2mA)

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/wl12xx/wl1271.h
drivers/net/wireless/wl12xx/wl1271_main.c
drivers/net/wireless/wl12xx/wl1271_ps.c

index a29969efc861404e5317257d53ff1d0c483d3379..789460074670d6fdff8ca7823014299d19565f8a 100644 (file)
@@ -374,6 +374,7 @@ struct wl1271 {
 #define WL1271_FLAG_PSM_REQUESTED      (8)
 #define WL1271_FLAG_IRQ_PENDING        (9)
 #define WL1271_FLAG_IRQ_RUNNING       (10)
+#define WL1271_FLAG_IDLE              (11)
        unsigned long flags;
 
        struct wl1271_partition_set part;
index 4adc5162e7e55924f884205200afe2bb370ad6a9..551714164ff50738a96aa19d7dd7895485f1d909 100644 (file)
@@ -1272,7 +1272,9 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
                        wl1271_acx_keep_alive_config(
                                wl, CMD_TEMPL_KLV_IDX_NULL_DATA,
                                ACX_KEEP_ALIVE_TPL_INVALID);
-               }
+                       set_bit(WL1271_FLAG_IDLE, &wl->flags);
+               } else
+                       clear_bit(WL1271_FLAG_IDLE, &wl->flags);
        }
 
        if (conf->flags & IEEE80211_CONF_PS &&
index 5a04482b93531d201ca994f58f2994b5a883554e..a5e60e0403e5ad90f2b35f6900dbfa71aafe52ea 100644 (file)
@@ -40,7 +40,8 @@ void wl1271_elp_work(struct work_struct *work)
        mutex_lock(&wl->mutex);
 
        if (test_bit(WL1271_FLAG_IN_ELP, &wl->flags) ||
-           !test_bit(WL1271_FLAG_PSM, &wl->flags))
+           (!test_bit(WL1271_FLAG_PSM, &wl->flags) &&
+            !test_bit(WL1271_FLAG_IDLE, &wl->flags)))
                goto out;
 
        wl1271_debug(DEBUG_PSM, "chip to elp");
@@ -56,7 +57,8 @@ out:
 /* Routines to toggle sleep mode while in ELP */
 void wl1271_ps_elp_sleep(struct wl1271 *wl)
 {
-       if (test_bit(WL1271_FLAG_PSM, &wl->flags)) {
+       if (test_bit(WL1271_FLAG_PSM, &wl->flags) ||
+           test_bit(WL1271_FLAG_IDLE, &wl->flags)) {
                cancel_delayed_work(&wl->elp_work);
                ieee80211_queue_delayed_work(wl->hw, &wl->elp_work,
                                        msecs_to_jiffies(ELP_ENTRY_DELAY));