rtlwifi: btcoex: 23b 2ant: power on settings for coex
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Thu, 6 Apr 2017 20:19:53 +0000 (15:19 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 13 Apr 2017 14:09:37 +0000 (17:09 +0300)
When power on, the wifi could be initiating, force the antenna to
transmit bt packets to avoid bt unstable problems

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

index 70f21059ddc307f68ae24cbefb4958c79dbbc6fa..0f3d04529ff2d6db519d3dd07c2be3b0fc8b46da 100644 (file)
@@ -3669,6 +3669,37 @@ void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist)
        btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
 }
 
+void ex_btc8723b2ant_power_on_setting(struct btc_coexist *btcoexist)
+{
+       struct btc_board_info *board_info = &btcoexist->board_info;
+       u16 u16tmp = 0x0;
+       u32 value = 0;
+
+       btcoexist->btc_write_1byte(btcoexist, 0x67, 0x20);
+
+       /* enable BB, REG_SYS_FUNC_EN such that we can write 0x948 correctly */
+       u16tmp = btcoexist->btc_read_2byte(btcoexist, 0x2);
+       btcoexist->btc_write_2byte(btcoexist, 0x2, u16tmp | BIT0 | BIT1);
+
+       btcoexist->btc_write_4byte(btcoexist, 0x948, 0x0);
+
+       if (btcoexist->chip_interface == BTC_INTF_USB) {
+               /* fixed at S0 for USB interface */
+               board_info->btdm_ant_pos = BTC_ANTENNA_AT_AUX_PORT;
+       } else {
+               /* for PCIE and SDIO interface, we check efuse 0xc3[6] */
+               if (board_info->single_ant_path == 0) {
+                       /* set to S1 */
+                       board_info->btdm_ant_pos = BTC_ANTENNA_AT_MAIN_PORT;
+               } else if (board_info->single_ant_path == 1) {
+                       /* set to S0 */
+                       board_info->btdm_ant_pos = BTC_ANTENNA_AT_AUX_PORT;
+               }
+               btcoexist->btc_set(btcoexist, BTC_SET_ACT_ANTPOSREGRISTRY_CTRL,
+                                  &value);
+       }
+}
+
 void ex_btc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist)
 {
        struct rtl_priv *rtlpriv = btcoexist->adapter;
index 0b90e7f0b722ce772156aa968fbebf4752ca2690..5a34cd895e444105fb06158f22752029bf8ff9c6 100644 (file)
@@ -139,6 +139,7 @@ struct btc_board_info {
        u8 pg_ant_num;  /* pg ant number */
        u8 btdm_ant_num;        /* ant number for btdm */
        u8 btdm_ant_pos;
+       u8 single_ant_path; /* current used for 8723b only, 1=>s0,  0=>s1 */
        bool bt_exist;
 };