rtlwifi: btcoex: 23b 1ant: Add rf status notification
authorPing-Ke Shih <pkshih@realtek.com>
Fri, 19 May 2017 15:59:35 +0000 (10:59 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 24 May 2017 13:49:20 +0000 (16:49 +0300)
If driver announce wifi RF status is off, btc can switch antenna to BT.

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
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h

index 4279678502d93290106ba3b44cff5b0b22916229..5b44e32bf5b333ee412d29f8d2fa70c36898474d 100644 (file)
@@ -3116,6 +3116,43 @@ void ex_halbtc8723b1ant_bt_info_notify(struct btc_coexist *btcoexist,
        halbtc8723b1ant_run_coexist_mechanism(btcoexist);
 }
 
+void ex_halbtc8723b1ant_rf_status_notify(struct btc_coexist *btcoexist, u8 type)
+{
+       struct rtl_priv *rtlpriv = btcoexist->adapter;
+       u32 u32tmp;
+       u8 u8tmpa, u8tmpb, u8tmpc;
+
+       RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+                "[BTCoex], RF Status notify\n");
+
+       if (type == BTC_RF_ON) {
+               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+                        "[BTCoex], RF is turned ON!!\n");
+               btcoexist->stop_coex_dm = false;
+       } else if (type == BTC_RF_OFF) {
+               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+                        "[BTCoex], RF is turned OFF!!\n");
+
+               halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE,
+                                                0x0, 0x0);
+               halbtc8723b1ant_ps_tdma(btcoexist, FORCE_EXEC, false, 0);
+               halbtc8723b1ant_set_ant_path(btcoexist, BTC_ANT_PATH_BT,
+                                            FORCE_EXEC, false, true);
+
+               halbtc8723b1ant_ignore_wlan_act(btcoexist, FORCE_EXEC, true);
+               btcoexist->stop_coex_dm = true;
+
+               u32tmp = btcoexist->btc_read_4byte(btcoexist, 0x948);
+               u8tmpa = btcoexist->btc_read_1byte(btcoexist, 0x765);
+               u8tmpb = btcoexist->btc_read_1byte(btcoexist, 0x67);
+               u8tmpc = btcoexist->btc_read_1byte(btcoexist, 0x76e);
+
+               RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+                        "############# [BTCoex], 0x948=0x%x, 0x765=0x%x, 0x67=0x%x, 0x76e=0x%x\n",
+                        u32tmp, u8tmpa, u8tmpb, u8tmpc);
+       }
+}
+
 void ex_halbtc8723b1ant_halt_notify(struct btc_coexist *btcoexist)
 {
        struct rtl_priv *rtlpriv = btcoexist->adapter;
index 47b7091591466e11d3903f11c422be3e064d9f97..592a289c993c6ae04babf0d382c1c6010423e6b1 100644 (file)
@@ -208,6 +208,8 @@ void ex_halbtc8723b1ant_special_packet_notify(struct btc_coexist *btcoexist,
                                              u8 type);
 void ex_halbtc8723b1ant_bt_info_notify(struct btc_coexist *btcoexist,
                                       u8 *tmpbuf, u8 length);
+void ex_halbtc8723b1ant_rf_status_notify(struct btc_coexist *btcoexist,
+                                        u8 type);
 void ex_halbtc8723b1ant_halt_notify(struct btc_coexist *btcoexist);
 void ex_halbtc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
 void ex_halbtc8723b1ant_coex_dm_reset(struct btc_coexist *btcoexist);
index 6ce2fcadc14460711f67724e99c285b4690c80d8..e221adc0c048d28c2bfd2ef0d86160658962485c 100644 (file)
@@ -30,6 +30,9 @@
 #define                NORMAL_EXEC                             false
 #define                FORCE_EXEC                              true
 
+#define                BTC_RF_OFF                              0x0
+#define                BTC_RF_ON                               0x1
+
 #define                BTC_RF_A                                RF90_PATH_A
 #define                BTC_RF_B                                RF90_PATH_B
 #define                BTC_RF_C                                RF90_PATH_C