rtlwifi: btcoex: 21a 1ant: avoid LPS/IPS mismatch for pnp notify
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Mon, 10 Apr 2017 16:23:10 +0000 (11:23 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 13 Apr 2017 14:11:04 +0000 (17:11 +0300)
When driver is going to sleep, it does not leave LPS/IPS, thus the
BTCoex may have mismatch when driver wakes up. To avoid that, BTCoex
needs to clear the IPS/LPS state when it receives a pnp notify, then
it can properly set up the hw when driver wakes up.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c

index 0509ffa..5e9f3b0 100644 (file)
@@ -2905,11 +2905,18 @@ void ex_btc8821a1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
        if (BTC_WIFI_PNP_SLEEP == pnp_state) {
                RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
                         "[BTCoex], Pnp notify to SLEEP\n");
+               /* BT should clear UnderIPS/UnderLPS state to avoid mismatch
+                * state after wakeup.
+                */
+               coex_sta->under_ips = false;
+               coex_sta->under_lps = false;
                btcoexist->stop_coex_dm = true;
-               btc8821a1ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
                btc8821a1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
                                              0x0, 0x0);
-               btc8821a1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 9);
+               btc8821a1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 0);
+               btc8821a1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2);
+               btc8821a1ant_set_ant_path(btcoexist, BTC_ANT_PATH_BT, false,
+                                         true);
        } else if (BTC_WIFI_PNP_WAKE_UP == pnp_state) {
                RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
                         "[BTCoex], Pnp notify to WAKE UP\n");