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 185046227d154eaba2e36b297cf3432638627200..e92ede844e3b7c66b4f86ef605e7f8adc9a153d6 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 b71d4b40ab6cc57ec2324c1f2e1b2a4c51e9cfb3..dc88d8ec3e545c7b16dab16204ff38cff6d26fa2 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;