CHROMIUM: mwifiex: disconnect the device before entering suspend state
authorTodd Broch <tbroch@chromium.org>
Wed, 5 Sep 2012 21:59:49 +0000 (14:59 -0700)
committerGerrit <chrome-bot@google.com>
Fri, 21 Sep 2012 17:02:36 +0000 (10:02 -0700)
By default, device is disconnected before entering suspend state.
User can keep the connection alive by using module parameter
"disconnect_on_suspend=0".

BUG=chrome-os-partner:12164
TEST=manual,
  1. Boot device on battery and associated to AP
  2. Suspend
  3. Measure current to WLAN <=1mA ( deep-sleep state )
  4. Resume and device re-connects to AP successfully
  5. echo 0 > /sys/module/mwifiex/parameters/disconnect_on_suspend
  6. Measure current to WLAN <=10mA ( IEEE PS state )
  7. Resume and device re-connect to AP successfully

Change-Id: Iaf633d41e1a0cf2fab2dad9ff16dc39d04e87abf
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32294
Reviewed-by: Gary Morain <gmorain@chromium.org>
drivers/net/wireless/mwifiex/sta_ioctl.c

index 7dabd5a..252d8fa 100644 (file)
@@ -26,6 +26,9 @@
 #include "11n.h"
 #include "cfg80211.h"
 
+static int disconnect_on_suspend = 1;
+module_param(disconnect_on_suspend, int, 0644);
+
 /*
  * Copies the multicast address list from device to driver.
  *
@@ -448,6 +451,16 @@ EXPORT_SYMBOL_GPL(mwifiex_cancel_hs);
 int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 {
        struct mwifiex_ds_hs_cfg hscfg;
+       struct mwifiex_private *priv;
+       int i;
+
+       if (disconnect_on_suspend) {
+               for (i = 0; i < adapter->priv_num; i++) {
+                       priv = adapter->priv[i];
+                       if (priv && priv->media_connected)
+                               mwifiex_deauthenticate(priv, NULL);
+               }
+       }
 
        if (adapter->hs_activated) {
                dev_dbg(adapter->dev, "cmd: HS Already actived\n");