rsi: add hci detach for hibernation and poweroff
authorSiva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Mon, 4 Feb 2019 06:33:26 +0000 (12:03 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 8 Feb 2019 15:29:35 +0000 (17:29 +0200)
As we missed to detach HCI, while entering power off or hibernation,
an extra hci interface gets created whenever system is woken up, to
avoid this we added hci_detach() in rsi_disconnect(), rsi_freeze(),
and rsi_shutdown() functions which are invoked for these tests.
This patch fixes the issue

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_sdio.c
drivers/net/wireless/rsi/rsi_91x_usb.c

index b412b65eb1f48765704a80f8d48c5fde4a362ba3..9a3bb0da32023e5653fbcd912c3f9cfd86d1abf7 100644 (file)
@@ -1132,6 +1132,12 @@ static void rsi_disconnect(struct sdio_func *pfunction)
        rsi_mac80211_detach(adapter);
        mdelay(10);
 
+       if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 &&
+           adapter->priv->bt_adapter) {
+               rsi_bt_ops.detach(adapter->priv->bt_adapter);
+               adapter->priv->bt_adapter = NULL;
+       }
+
        /* Reset Chip */
        rsi_reset_chip(adapter);
 
@@ -1308,6 +1314,12 @@ static int rsi_freeze(struct device *dev)
                rsi_dbg(ERR_ZONE,
                        "##### Device can not wake up through WLAN\n");
 
+       if (IS_ENABLED(CONFIG_RSI_COEX) && common->coex_mode > 1 &&
+           common->bt_adapter) {
+               rsi_bt_ops.detach(common->bt_adapter);
+               common->bt_adapter = NULL;
+       }
+
        ret = rsi_sdio_disable_interrupts(pfunction);
 
        if (sdev->write_fail)
@@ -1355,6 +1367,12 @@ static void rsi_shutdown(struct device *dev)
        if (rsi_config_wowlan(adapter, wowlan))
                rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");
 
+       if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 &&
+           adapter->priv->bt_adapter) {
+               rsi_bt_ops.detach(adapter->priv->bt_adapter);
+               adapter->priv->bt_adapter = NULL;
+       }
+
        rsi_sdio_disable_interrupts(sdev->pfunction);
 
        if (sdev->write_fail)
index f360690396dd02a536ac7664a2c477028b3c2524..d31f9cd1ae90f7dcd10ff3268b986323f2a6747a 100644 (file)
@@ -816,6 +816,13 @@ static void rsi_disconnect(struct usb_interface *pfunction)
                return;
 
        rsi_mac80211_detach(adapter);
+
+       if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 &&
+           adapter->priv->bt_adapter) {
+               rsi_bt_ops.detach(adapter->priv->bt_adapter);
+               adapter->priv->bt_adapter = NULL;
+       }
+
        rsi_reset_card(adapter);
        rsi_deinit_usb_interface(adapter);
        rsi_91x_deinit(adapter);