OSDN Git Service

rtlwifi: btcoex: 23b 2ant: set coex table when wifi is idle
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Thu, 6 Apr 2017 20:19:48 +0000 (15:19 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 13 Apr 2017 14:09:35 +0000 (17:09 +0300)
When wifi is idle, the bt should have more resource to transmit.

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/halbtc8723b2ant.c

index c9f0445..327609e 100644 (file)
@@ -1613,6 +1613,47 @@ static void btc8723b2ant_action_wifi_link_process(struct btc_coexist
                 u32tmp, u8tmpa, u8tmpb);
 }
 
+static bool btc8723b2ant_action_wifi_idle_process(struct btc_coexist *btcoexist)
+{
+       struct rtl_priv *rtlpriv = btcoexist->adapter;
+       u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state;
+       u8 ap_num = 0;
+       u8 tmp = BT_8723B_2ANT_WIFI_RSSI_COEXSWITCH_THRES -
+                coex_dm->switch_thres_offset - coex_dm->switch_thres_offset;
+
+       wifi_rssi_state = btc8723b2ant_wifi_rssi_state(btcoexist, 0, 2, 15, 0);
+       wifi_rssi_state1 = btc8723b2ant_wifi_rssi_state(btcoexist, 1, 2,
+                                                       tmp, 0);
+       tmp = BT_8723B_2ANT_BT_RSSI_COEXSWITCH_THRES -
+             coex_dm->switch_thres_offset - coex_dm->switch_thres_offset;
+       bt_rssi_state = btc8723b2ant_bt_rssi_state(btcoexist, 2, tmp, 0);
+
+       btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, &ap_num);
+
+       /* office environment */
+       if (BTC_RSSI_HIGH(wifi_rssi_state1) && (coex_sta->hid_exist) &&
+           (coex_sta->a2dp_exist)) {
+               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+                        "[BTCoex], Wifi  idle process for BT HID+A2DP exist!!\n");
+
+               btc8723b2ant_dac_swing(btcoexist, NORMAL_EXEC, true, 0x6);
+               btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
+
+               /* sw all off */
+               btc8723b2ant_sw_mechanism(btcoexist, false, false, false,
+                                         false);
+               btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
+               btc8723b2ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+                                             0x0, 0x0);
+               btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
+
+               return true;
+       }
+
+       btc8723b2ant_dac_swing(btcoexist, NORMAL_EXEC, true, 0x18);
+       return false;
+}
+
 static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
 {
        struct rtl_priv *rtlpriv = btcoexist->adapter;
@@ -1710,26 +1751,12 @@ static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
                                         "[BTCoex], Wifi Connected-Busy + BT Busy!!\n");
                                common = false;
                        } else {
-                               if (bt_hs_on)
-                                       return false;
-
                                RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
                                         "[BTCoex], Wifi Connected-Idle + BT Busy!!\n");
 
-                               btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A,
-                                                         0x1, 0xfffff, 0x0);
-                               btc8723b2ant_coex_table_with_type(btcoexist,
-                                                                 NORMAL_EXEC,
-                                                                 7);
-                               btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-                                                    true, 21);
-                               btc8723b2ant_fw_dac_swing_lvl(btcoexist,
-                                                             NORMAL_EXEC,
-                                                             0xb);
-                               btc8723b2ant_sw_mechanism(btcoexist, false,
-                                                         false, false,
-                                                         false);
-                               common = true;
+                               common =
+                                   btc8723b2ant_action_wifi_idle_process(
+                                               btcoexist);
                        }
                }
        }