rtlwifi: btcoex: Remove 23b 2ant configuration parameter
authorLarry Finger <Larry.Finger@lwfinger.net>
Thu, 4 May 2017 18:47:00 +0000 (13:47 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 18 May 2017 14:06:43 +0000 (17:06 +0300)
In file halbtc8723b2ant.c, there are directives that depend on an
undocumented configuration parameter BT_AUTO_REPORT_ONLY_8723B_2ANT
that cannot be set from Kconfig. This parameter is replaced by a
boolean in the main structure used by all routines. It still cannot
be changed dynamically, but it is easier to document.

Routines halbtc8723b2ant_set_bt_auto_report(), and
btc8723b2ant_bt_auto_report() are restored.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: 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 2f3946be4ce29bdb581753b515faa78bf7750be8..31965f0ef69de64f6f5189c7e1833af3e0f25d74 100644 (file)
@@ -707,6 +707,36 @@ static void btc8723b2ant_dec_bt_pwr(struct btc_coexist *btcoexist,
        coex_dm->pre_dec_bt_pwr_lvl = coex_dm->cur_dec_bt_pwr_lvl;
 }
 
+static
+void halbtc8723b2ant_set_bt_auto_report(struct btc_coexist *btcoexist,
+                                       bool enable_auto_report)
+{
+       u8 h2c_parameter[1] = {0};
+
+       h2c_parameter[0] = 0;
+
+       if (enable_auto_report)
+               h2c_parameter[0] |= BIT(0);
+
+       btcoexist->btc_fill_h2c(btcoexist, 0x68, 1, h2c_parameter);
+}
+
+static
+void btc8723b2ant_bt_auto_report(struct btc_coexist *btcoexist,
+                                bool force_exec, bool enable_auto_report)
+{
+       coex_dm->cur_bt_auto_report = enable_auto_report;
+
+       if (!force_exec) {
+               if (coex_dm->pre_bt_auto_report == coex_dm->cur_bt_auto_report)
+                       return;
+       }
+       halbtc8723b2ant_set_bt_auto_report(btcoexist,
+                                          coex_dm->cur_bt_auto_report);
+
+       coex_dm->pre_bt_auto_report = coex_dm->cur_bt_auto_report;
+}
+
 static void btc8723b2ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist,
                                          bool force_exec, u8 fw_dac_swing_lvl)
 {
@@ -3666,6 +3696,7 @@ void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist)
        btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4);
        btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3);
        btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
+       btcoexist->auto_report_2ant = true;
 }
 
 void ex_btc8723b2ant_power_on_setting(struct btc_coexist *btcoexist)
@@ -3966,9 +3997,8 @@ void ex_btc8723b2ant_display_coex_info(struct btc_coexist *btcoexist)
        RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d",
                 "0x774(low-pri rx/tx)", coex_sta->low_priority_rx,
                 coex_sta->low_priority_tx);
-#if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 1)
-       btc8723b2ant_monitor_bt_ctr(btcoexist);
-#endif
+       if (btcoexist->auto_report_2ant)
+               btc8723b2ant_monitor_bt_ctr(btcoexist);
        btcoexist->btc_disp_dbg_msg(btcoexist,
        BTC_DBG_DISP_COEX_STATISTICS);
 }
@@ -4190,14 +4220,11 @@ void ex_btc8723b2ant_bt_info_notify(struct btc_coexist *btcoexist,
                } else {
                        /* BT already NOT ignore Wlan active, do nothing here.*/
                }
-#if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
-               if ((coex_sta->bt_info_ext & BIT4)) {
-                       /* BT auto report already enabled, do nothing*/
-               } else {
-                       btc8723b2ant_bt_auto_report(btcoexist, FORCE_EXEC,
-                                                   true);
+               if (!btcoexist->auto_report_2ant) {
+                       if (!(coex_sta->bt_info_ext & BIT4))
+                               btc8723b2ant_bt_auto_report(btcoexist,
+                                                           FORCE_EXEC, true);
                }
-#endif
        }
 
        /* check BIT2 first ==> check if bt is under inquiry or page scan */
@@ -4347,21 +4374,22 @@ void ex_btc8723b2ant_periodical(struct btc_coexist *btcoexist)
                }
        }
 
-#if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
-       btc8723b2ant_query_bt_info(btcoexist);
-#else
-       btc8723b2ant_monitor_bt_ctr(btcoexist);
-       btc8723b2ant_monitor_wifi_ctr(btcoexist);
+       if (!btcoexist->auto_report_2ant) {
+               btc8723b2ant_query_bt_info(btcoexist);
+       } else {
+               btc8723b2ant_monitor_bt_ctr(btcoexist);
+               btc8723b2ant_monitor_wifi_ctr(btcoexist);
 
-       /* for some BT speakers that High-Priority pkts appear before
-        * playing, this will cause HID exist
-        */
-       if ((coex_sta->high_priority_tx + coex_sta->high_priority_rx < 50) &&
-           (bt_link_info->hid_exist))
-               bt_link_info->hid_exist = false;
-
-       if (btc8723b2ant_is_wifi_status_changed(btcoexist) ||
-           coex_dm->auto_tdma_adjust)
-               btc8723b2ant_run_coexist_mechanism(btcoexist);
-#endif
+               /* for some BT speakers that High-Priority pkts appear before
+                * playing, this will cause HID exist
+                */
+               if ((coex_sta->high_priority_tx +
+                   coex_sta->high_priority_rx < 50) &&
+                   (bt_link_info->hid_exist))
+                       bt_link_info->hid_exist = false;
+
+               if (btc8723b2ant_is_wifi_status_changed(btcoexist) ||
+                   coex_dm->auto_tdma_adjust)
+                       btc8723b2ant_run_coexist_mechanism(btcoexist);
+       }
 }
index 18a35c7faba92a1e8a0d0f858960329fc4a30462..50726beaeead2fba66dcc7e6c70600b24b70838b 100644 (file)
@@ -28,8 +28,6 @@
 /************************************************************************
  * The following is for 8723B 2Ant BT Co-exist definition
  ************************************************************************/
-#define        BT_AUTO_REPORT_ONLY_8723B_2ANT                  1
-
 #define        BT_INFO_8723B_2ANT_B_FTP                        BIT7
 #define        BT_INFO_8723B_2ANT_B_A2DP                       BIT6
 #define        BT_INFO_8723B_2ANT_B_HID                        BIT5