rtlwifi: btcoex: 23b 1ant: check more cases when bt is queing
authorPing-Ke Shih <pkshih@realtek.com>
Sat, 20 May 2017 15:49:00 +0000 (10:49 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 24 May 2017 13:50:35 +0000 (16:50 +0300)
If bt is queing, we need to set the packet priority properly.
Originally we only consider if wifi was connected or not, but now we
also consider if bt is under abnormal scan or wifi is scanning, roaming
or linking, and set the coex table.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@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/halbtc8723b1ant.c
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.h

index 1850462..e92ede8 100644 (file)
@@ -1732,35 +1732,56 @@ static void halbtc8723b1ant_action_bt_inquiry(struct btc_coexist *btcoexist)
 {
        struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
        bool wifi_connected = false, ap_enable = false;
+       bool wifi_busy = false, bt_busy = false;
 
        btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE,
                           &ap_enable);
        btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED,
                           &wifi_connected);
+       btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
+       btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy);
 
-       if (!wifi_connected) {
-               halbtc8723b1ant_power_save_state(btcoexist,
-                                                BTC_PS_WIFI_NATIVE, 0x0, 0x0);
+       if (coex_sta->bt_abnormal_scan) {
+               halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 33);
+               halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
+       } else if (!wifi_connected && !coex_sta->wifi_is_high_pri_task) {
+               halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+                                                0x0, 0x0);
                halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 8);
-               halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 2);
-       } else if (bt_link_info->sco_exist || bt_link_info->hid_only) {
-               /* SCO/HID-only busy */
+               halbtc8723b1ant_set_ant_path(btcoexist, BTC_ANT_PATH_PTA,
+                                            NORMAL_EXEC, false, false);
+               halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
+       } else if (bt_link_info->sco_exist || bt_link_info->hid_exist ||
+                  bt_link_info->a2dp_exist) {
+               /* SCO/HID/A2DP busy */
                halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
                                                 0x0, 0x0);
-               halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 32);
-               halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1);
-       } else {
-               if (ap_enable)
-                       halbtc8723b1ant_power_save_state(btcoexist,
-                                                        BTC_PS_WIFI_NATIVE,
-                                                        0x0, 0x0);
+               if (coex_sta->c2h_bt_remote_name_req)
+                       halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true,
+                                               33);
                else
-                       halbtc8723b1ant_power_save_state(btcoexist,
-                                                        BTC_PS_LPS_ON,
-                                                        0x50, 0x4);
+                       halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true,
+                                               32);
 
-               halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 30);
-               halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1);
+               halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 4);
+       } else if (bt_link_info->pan_exist || wifi_busy) {
+               halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+                                                0x0, 0x0);
+               if (coex_sta->c2h_bt_remote_name_req)
+                       halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true,
+                                               33);
+               else
+                       halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true,
+                                               32);
+
+               halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 4);
+       } else {
+               halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+                                                0x0, 0x0);
+               halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 8);
+               halbtc8723b1ant_set_ant_path(btcoexist, BTC_ANT_PATH_PTA,
+                                            NORMAL_EXEC, false, false);
+               halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
        }
 }
 
index b71d4b4..dc88d8e 100644 (file)
@@ -148,6 +148,7 @@ struct coex_sta_8723b_1ant {
        bool pan_exist;
        bool bt_hi_pri_link_exist;
        u8 num_of_profile;
+       bool bt_abnormal_scan;
 
        bool under_lps;
        bool under_ips;