mwifiex: disable auto deep sleep before unloading the driver
authorAmitkumar Karwar <akarwar@marvell.com>
Thu, 14 Jul 2011 03:51:59 +0000 (20:51 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 21 Jul 2011 18:52:04 +0000 (14:52 -0400)
Since the auto deep sleep mode has been enabled at driver init time
we should disable it at driver unloading to shutdown the function
gracefully.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/ioctl.h
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sdio.c
drivers/net/wireless/mwifiex/sta_ioctl.c

index 7c1c5ee40eb9fe855895e390faba2042ed6530ef..f6bcc868562f2bc1dbdfb99463104710bd2adeae 100644 (file)
@@ -249,6 +249,7 @@ struct mwifiex_ds_hs_cfg {
 };
 
 #define DEEP_SLEEP_ON  1
+#define DEEP_SLEEP_OFF 0
 #define DEEP_SLEEP_IDLE_TIME   100
 #define PS_MODE_AUTO           1
 
index 03691c02a6e8b6e922ae60d6665f4070fd00f8f7..2215c3c973544c68426ef1e5b7fb49f599d5e417 100644 (file)
@@ -929,6 +929,7 @@ int mwifiex_set_hs_params(struct mwifiex_private *priv,
                              struct mwifiex_ds_hs_cfg *hscfg);
 int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type);
 int mwifiex_enable_hs(struct mwifiex_adapter *adapter);
+int mwifiex_disable_auto_ds(struct mwifiex_private *priv);
 int mwifiex_get_signal_info(struct mwifiex_private *priv,
                            struct mwifiex_ds_get_signal *signal);
 int mwifiex_drv_get_data_rate(struct mwifiex_private *priv,
index f7105a97e8473d1ffbbfcadf8084d9be32eabdf0..82098ac483b87097aece2ea67b62dad38afc4c46 100644 (file)
@@ -133,6 +133,9 @@ mwifiex_sdio_remove(struct sdio_func *func)
                                        adapter->priv[i]->media_connected)
                                mwifiex_deauthenticate(adapter->priv[i], NULL);
 
+               mwifiex_disable_auto_ds(mwifiex_get_priv(adapter,
+                                                        MWIFIEX_BSS_ROLE_ANY));
+
                mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter,
                                                MWIFIEX_BSS_ROLE_ANY),
                                         MWIFIEX_FUNC_SHUTDOWN);
index d05907d050395f1176f7f4c492b1c243dcda6014..c34ff8c4f4f82adb471524df463b5d8c5e24fb5a 100644 (file)
@@ -486,6 +486,20 @@ int mwifiex_set_radio_band_cfg(struct mwifiex_private *priv,
        return 0;
 }
 
+/*
+ * The function disables auto deep sleep mode.
+ */
+int mwifiex_disable_auto_ds(struct mwifiex_private *priv)
+{
+       struct mwifiex_ds_auto_ds auto_ds;
+
+       auto_ds.auto_ds = DEEP_SLEEP_OFF;
+
+       return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_PS_MODE_ENH,
+                                    DIS_AUTO_PS, BITMAP_AUTO_DS, &auto_ds);
+}
+EXPORT_SYMBOL_GPL(mwifiex_disable_auto_ds);
+
 /*
  * IOCTL request handler to set/get active channel.
  *