Commit 18e71468 authored by Chris Chiu's avatar Chris Chiu Committed by Kalle Valo

rtl8xxxu: Fix wifi low signal strength issue of RTL8723BU

The WiFi tx power of RTL8723BU is extremely low after booting. So
the WiFi scan gives very limited AP list and it always fails to
connect to the selected AP. This module only supports 1x1 antenna
and the antenna is switched to bluetooth due to some incorrect
register settings.

Compare with the vendor driver https://github.com/lwfinger/rtl8723bu,
we realized that the 8723bu's enable_rf() does the same thing as
rtw_btcoex_HAL_Initialize() in vendor driver. And it by default
sets the antenna path to BTC_ANT_PATH_BT which we verified it's
the cause of the wifi weak tx power. The vendor driver will set
the antenna path to BTC_ANT_PATH_PTA in the consequent btcoexist
mechanism, by the function halbtc8723b1ant_PsTdma.

This commit hand over the antenna control to PTA(Packet Traffic
Arbitration), which compares the weight of bluetooth/wifi traffic
then determine whether to continue current wifi traffic or not.
After PTA take control, The wifi signal will be back to normal and
the bluetooth scan can also work at the same time. However, the
btcoexist still needs to be handled under different circumstances.
If there's a BT connection established, the wifi still fails to
connect until BT disconnected.
Signed-off-by: default avatarChris Chiu <chiu@endlessm.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 1dc24406
...@@ -1525,7 +1525,7 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv) ...@@ -1525,7 +1525,7 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv)
/* /*
* WLAN action by PTA * WLAN action by PTA
*/ */
rtl8xxxu_write8(priv, REG_WLAN_ACT_CONTROL_8723B, 0x04); rtl8xxxu_write8(priv, REG_WLAN_ACT_CONTROL_8723B, 0x0c);
/* /*
* BT select S0/S1 controlled by WiFi * BT select S0/S1 controlled by WiFi
...@@ -1568,9 +1568,14 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv) ...@@ -1568,9 +1568,14 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv)
rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.ant_sel_rsv)); rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.ant_sel_rsv));
/* /*
* 0x280, 0x00, 0x200, 0x80 - not clear * Different settings per different antenna position.
* Antenna Position: | Normal Inverse
* --------------------------------------------------
* Antenna switch to BT: | 0x280, 0x00
* Antenna switch to WiFi: | 0x0, 0x280
* Antenna switch to PTA: | 0x200, 0x80
*/ */
rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x00); rtl8xxxu_write32(priv, REG_S0S1_PATH_SWITCH, 0x80);
/* /*
* Software control, antenna at WiFi side * Software control, antenna at WiFi side
......
...@@ -3891,12 +3891,13 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) ...@@ -3891,12 +3891,13 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
/* Check if MAC is already powered on */ /* Check if MAC is already powered on */
val8 = rtl8xxxu_read8(priv, REG_CR); val8 = rtl8xxxu_read8(priv, REG_CR);
val16 = rtl8xxxu_read16(priv, REG_SYS_CLKR);
/* /*
* Fix 92DU-VC S3 hang with the reason is that secondary mac is not * Fix 92DU-VC S3 hang with the reason is that secondary mac is not
* initialized. First MAC returns 0xea, second MAC returns 0x00 * initialized. First MAC returns 0xea, second MAC returns 0x00
*/ */
if (val8 == 0xea) if (val8 == 0xea || !(val16 & SYS_CLK_MAC_CLK_ENABLE))
macpower = false; macpower = false;
else else
macpower = true; macpower = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment