Skip to content

Commit 6d62269

Browse files
lwfingerKalle Valo
authored andcommitted
rtlwifi: btcoexist: Fix antenna selection code
In commit 87d8a9f ("rtlwifi: btcoex: call bind to setup btcoex"), the code turns on a call to exhalbtc_bind_bt_coex_withadapter(). This routine contains a bug that causes incorrect antenna selection for those HP laptops with only one antenna and an incorrectly programmed EFUSE. These boxes are the ones that need the ant_sel module parameter. Fixes: 87d8a9f ("rtlwifi: btcoex: call bind to setup btcoex") Signed-off-by: Larry Finger <[email protected]> Cc: Ping-Ke Shih <[email protected]> Cc: Yan-Hsuan Chuang <[email protected]> Cc: Birming Chiu <[email protected]> Cc: Shaofu <[email protected]> Cc: Steven Ting <[email protected]> Cc: Stable <[email protected]> # 4.13+ Signed-off-by: Kalle Valo <[email protected]>
1 parent a33fcba commit 6d62269

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist)
173173

174174
u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)
175175
{
176+
struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
177+
178+
/* override ant_num / ant_path */
179+
if (mod_params->ant_sel) {
180+
rtlpriv->btcoexist.btc_info.ant_num =
181+
(mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1);
182+
183+
rtlpriv->btcoexist.btc_info.single_ant_path =
184+
(mod_params->ant_sel == 1 ? 0 : 1);
185+
}
176186
return rtlpriv->btcoexist.btc_info.single_ant_path;
177187
}
178188

@@ -183,13 +193,18 @@ u8 rtl_get_hwpg_bt_type(struct rtl_priv *rtlpriv)
183193

184194
u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)
185195
{
196+
struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
186197
u8 num;
187198

188199
if (rtlpriv->btcoexist.btc_info.ant_num == ANT_X2)
189200
num = 2;
190201
else
191202
num = 1;
192203

204+
/* override ant_num / ant_path */
205+
if (mod_params->ant_sel)
206+
num = (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1) + 1;
207+
193208
return num;
194209
}
195210

@@ -876,7 +891,7 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter)
876891
{
877892
struct btc_coexist *btcoexist = &gl_bt_coexist;
878893
struct rtl_priv *rtlpriv = adapter;
879-
u8 ant_num = 2, chip_type, single_ant_path = 0;
894+
u8 ant_num = 2, chip_type;
880895

881896
if (btcoexist->binded)
882897
return false;
@@ -911,12 +926,6 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter)
911926
ant_num = rtl_get_hwpg_ant_num(rtlpriv);
912927
exhalbtc_set_ant_num(rtlpriv, BT_COEX_ANT_TYPE_PG, ant_num);
913928

914-
/* set default antenna position to main port */
915-
btcoexist->board_info.btdm_ant_pos = BTC_ANTENNA_AT_MAIN_PORT;
916-
917-
single_ant_path = rtl_get_hwpg_single_ant_path(rtlpriv);
918-
exhalbtc_set_single_ant_path(single_ant_path);
919-
920929
if (rtl_get_hwpg_package_type(rtlpriv) == 0)
921930
btcoexist->board_info.tfbga_package = false;
922931
else if (rtl_get_hwpg_package_type(rtlpriv) == 1)

0 commit comments

Comments
 (0)