rtlwifi: Fixes for antenna selection in rtl8723be
Subsystems (2)
cover rtlwifi: Fixes for antenna selection in rtl8723be
There are some HP laptops that contain only a single antenna, which would not be a problem except these boxes have a mistake in their EFUSE coding. The ant_sel module option has been provided to correct for this problem; however, the current antenna selection code has bugs. The first of these two patches fix a problem in kernel 4.12, and the second fixes an additional problem in kernel 4.13.
These patches are intended for kernel 4.14.
Thanks,
Larry
Larry Finger (2):
rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be
rtlwifi: btcoexist: Fix antenna selection code
.../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c | 5 ++++- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 23 +++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-)
Signature · 1 line
2.12.3
PATCH 1/2 rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be
In commit bcd37f4a0831 ("rtlwifi: btcoex: 23b 2ant: let bt transmit when hw initialisation done"), there is an additional error when the module parameter ant_sel is used to select the auxilary antenna. The error is that the antenna selection is not checked when writing the antenna selection register.
---
Kalle,
This material is intended for kernel 4.14.
--- drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c +4 -1
@@ -1183,7 +1183,10 @@ static void btc8723b2ant_set_ant_path(struct btc_coexist *btcoexist, }/* fixed internal switch S1->WiFi, S0->BT */ - btcoexist->btc_write_4byte (btcoexist,0x948 ,0x0 ); +if (board_info->btdm_ant_pos ==BTC_ANTENNA_AT_MAIN_PORT ) + btcoexist->btc_write_2byte (btcoexist,0x948 ,0x0 ); +else + btcoexist->btc_write_2byte (btcoexist,0x948 ,0x280 );switch (antpos_type) {case BTC_ANT_WIFI_AT_MAIN :
Signature · 1 line
2.12.3
Re: [1/2] rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be
Quoted 6 lines · Larry Finger
In commit
bcd37f4a0831("rtlwifi: btcoex: 23b 2ant: let bt transmit when hw initialisation done"), there is an additional error when the module parameterant_selis used to select the auxilary antenna. The error is that the antenna selection is not checked when writing the antenna selection register.
Quoted 8 lines
Fixes bcd37f4a0831 ("rtlwifi: btcoex: 23b 2ant: let bt transmit when hw initialisation done")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.12+
2 patches applied to wireless-drivers.git, thanks.
a33fcba6ec01 rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be 6d6226928369 rtlwifi: btcoexist: Fix antenna selection code
Signature · 3 lines
https://patchwork.kernel.org/patch/9937493/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 2/2 rtlwifi: btcoexist: Fix antenna selection code
In reply to Larry FingerIn commit 87d8a9f35202 ("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.
---
Kalle,
This patch is intended for kernel 4.14.
Thanks,
Larry
--- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +16 -7
@@ -173,6 +173,16 @@ static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist)u8 rtl_get_hwpg_single_ant_path (struct rtl_priv *rtlpriv) { +struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params; + +/* override ant_num / ant_path */ +if (mod_params->ant_sel) { + rtlpriv->btcoexist.btc_info.ant_num = + (mod_params->ant_sel ==1 ?ANT_X2 :ANT_X1 ); + + rtlpriv->btcoexist.btc_info.single_ant_path = + (mod_params->ant_sel ==1 ?0 :1 ); + }return rtlpriv->btcoexist.btc_info.single_ant_path; }
@@ -183,6 +193,7 @@ u8 rtl_get_hwpg_bt_type(struct rtl_priv *rtlpriv)u8 rtl_get_hwpg_ant_num (struct rtl_priv *rtlpriv) { +struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;u8 num;if (rtlpriv->btcoexist.btc_info.ant_num ==ANT_X2 )
@@ -190,6 +201,10 @@ u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)else num =1 ; +/* override ant_num / ant_path */ +if (mod_params->ant_sel) + num = (mod_params->ant_sel ==1 ?ANT_X2 :ANT_X1 ) +1 ; +return num; }
@@ -876,7 +891,7 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter) {struct btc_coexist *btcoexist = &gl_bt_coexist;struct rtl_priv *rtlpriv = adapter; -u8 ant_num =2 , chip_type, single_ant_path =0 ; +u8 ant_num =2 , chip_type;if (btcoexist->binded)return false;
@@ -911,12 +926,6 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter) ant_num =rtl_get_hwpg_ant_num (rtlpriv);exhalbtc_set_ant_num (rtlpriv,BT_COEX_ANT_TYPE_PG , ant_num); -/* set default antenna position to main port */ - btcoexist->board_info.btdm_ant_pos =BTC_ANTENNA_AT_MAIN_PORT ; - - single_ant_path =rtl_get_hwpg_single_ant_path (rtlpriv); -exhalbtc_set_single_ant_path (single_ant_path); -if (rtl_get_hwpg_package_type (rtlpriv) ==0 ) btcoexist->board_info.tfbga_package = false;else if (rtl_get_hwpg_package_type (rtlpriv) ==1 )
Signature · 1 line
2.12.3