From 2b778431da872c0af68073454e3d7da234d5d50a Mon Sep 17 00:00:00 2001 From: Todd Broch Date: Wed, 5 Sep 2012 14:59:49 -0700 Subject: [PATCH] CHROMIUM: mwifiex: disconnect the device before entering suspend state 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 Signed-off-by: Bing Zhao Signed-off-by: Todd Broch Reviewed-on: https://gerrit.chromium.org/gerrit/32294 Reviewed-by: Gary Morain --- drivers/net/wireless/mwifiex/sta_ioctl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 7dabd5ad8920..252d8fa4ff60 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c @@ -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"); -- 2.20.1