rtlwifi: btcoex: 23b 2ant: fix PTA unstable problem when hw init
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Tue, 4 Apr 2017 16:49:58 +0000 (11:49 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 13 Apr 2017 14:08:36 +0000 (17:08 +0300)
In the hardware initialisation stage, the PTA circuits may be unstable,
so we reset it after 6 secs to fix the problem.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
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
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h

index dadcddb53557e84eea9e75b260d83cb02f538a78..e0b6dfa938fa17fd0218b9e607c5d788aabce400 100644 (file)
@@ -3282,12 +3282,14 @@ void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist)
        /* Antenna config */
        btc8723b2ant_set_ant_path(btcoexist, BTC_ANT_WIFI_AT_MAIN,
                                  true, false);
+       coex_sta->dis_ver_info_cnt = 0;
+
        /* PTA parameter */
        btc8723b2ant_coex_table_with_type(btcoexist, FORCE_EXEC, 0);
 
        /* Enable counter statistics */
        /* 0x76e[3] = 1, WLAN_ACT controlled by PTA */
-       btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc);
+       btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4);
        btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3);
        btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
 }
@@ -3827,36 +3829,21 @@ void ex_btc8723b2ant_halt_notify(struct btc_coexist *btcoexist)
 void ex_btc8723b2ant_periodical(struct btc_coexist *btcoexist)
 {
        struct rtl_priv *rtlpriv = btcoexist->adapter;
-       struct btc_board_info *board_info = &btcoexist->board_info;
-       struct btc_stack_info *stack_info = &btcoexist->stack_info;
-       static u8 dis_ver_info_cnt;
-       u32 fw_ver = 0, bt_patch_ver = 0;
 
        RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
                 "[BTCoex], ==========================Periodical===========================\n");
 
-       if (dis_ver_info_cnt <= 5) {
-               dis_ver_info_cnt += 1;
-               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-                        "[BTCoex], ****************************************************************\n");
-               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-                        "[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n",
-                             board_info->pg_ant_num,
-                             board_info->btdm_ant_num,
-                             board_info->btdm_ant_pos);
-               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-                        "[BTCoex], BT stack/ hci ext ver = %s / %d\n",
-                             stack_info->profile_notified ? "Yes" : "No",
-                             stack_info->hci_version);
-               btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER,
-                                  &bt_patch_ver);
-               btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-                        "[BTCoex], CoexVer/ fw_ver/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n",
-                             glcoex_ver_date_8723b_2ant, glcoex_ver_8723b_2ant,
-                             fw_ver, bt_patch_ver, bt_patch_ver);
-               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-                        "[BTCoex], ****************************************************************\n");
+       if (coex_sta->dis_ver_info_cnt <= 5) {
+               coex_sta->dis_ver_info_cnt += 1;
+               if (coex_sta->dis_ver_info_cnt == 3) {
+                       /* Antenna config to set 0x765 = 0x0 (GNT_BT control by
+                        * PTA) after initial
+                        */
+                       RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+                                "[BTCoex], Set GNT_BT control by PTA\n");
+                       btc8723b2ant_set_ant_path(
+                               btcoexist, BTC_ANT_WIFI_AT_MAIN, false, false);
+               }
        }
 
 #if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
index 9f41206b20ed89ff5472314102c902ca9cae0b44..57eac223bcbdba11e2527284078d96ab5319fb68 100644 (file)
@@ -167,6 +167,8 @@ struct coex_sta_8723b_2ant {
        u32 crc_err_11n_agg;
        bool force_lps_on;
 
+       u8 dis_ver_info_cnt;
+
        u8 a2dp_bit_pool;
 };