]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: vt6655: Correct listen interval TBTT wake up
authorMalcolm Priestley <tvboxspy@gmail.com>
Sun, 21 Jun 2015 10:05:55 +0000 (11:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jul 2015 02:26:35 +0000 (19:26 -0700)
PSbIsNextTBTTWakeUp is called at beacon intervals.

The should listen to next beacon on count down of wake_up_count == 1.

This restores this back to vendors code but modified for mac80211.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6655/device.h
drivers/staging/vt6655/power.c

index 5cf1b337cba7e6beb5de410a99c9c658a2166ab8..6aebb495fa8dc6c10b9c8ceb4f0594cb5d9c7b9b 100644 (file)
@@ -403,6 +403,7 @@ struct vnt_private {
        unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */
 
        unsigned short wBeaconInterval;
+       u16 wake_up_count;
 
        struct work_struct interrupt_work;
 
index be3c4e949b6a315dc7ac80880654eb413c089224..06e6b9d871c44a7f4806331fed92b611cc86f3ed 100644 (file)
@@ -157,10 +157,18 @@ PSbIsNextTBTTWakeUp(
        struct ieee80211_conf *conf = &hw->conf;
        bool bWakeUp = false;
 
-       if (conf->listen_interval == 1) {
-               /* Turn on wake up to listen next beacon */
-               MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
-               bWakeUp = true;
+       if (conf->listen_interval > 1) {
+               if (!pDevice->wake_up_count)
+                       pDevice->wake_up_count = conf->listen_interval;
+
+               --pDevice->wake_up_count;
+
+               if (pDevice->wake_up_count == 1) {
+                       /* Turn on wake up to listen next beacon */
+                       MACvRegBitsOn(pDevice->PortOffset,
+                                     MAC_REG_PSCTL, PSCTL_LNBCN);
+                       bWakeUp = true;
+               }
        }
 
        return bWakeUp;