linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] rtlwifi: Fixes for antenna selection in rtl8723be
@ 2017-09-04 17:51 Larry Finger
  2017-09-04 17:51 ` [PATCH 1/2] rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be Larry Finger
  2017-09-04 17:51 ` [PATCH 2/2] rtlwifi: btcoexist: Fix antenna selection code Larry Finger
  0 siblings, 2 replies; 4+ messages in thread
From: Larry Finger @ 2017-09-04 17:51 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Larry Finger, Ping-Ke Shih, Yan-Hsuan Chuang,
	Birming Chiu, Shaofu, Steven Ting

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

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
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(-)

-- 
2.12.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be
  2017-09-04 17:51 [PATCH 0/2] rtlwifi: Fixes for antenna selection in rtl8723be Larry Finger
@ 2017-09-04 17:51 ` Larry Finger
  2017-09-07 12:56   ` [1/2] " Kalle Valo
  2017-09-04 17:51 ` [PATCH 2/2] rtlwifi: btcoexist: Fix antenna selection code Larry Finger
  1 sibling, 1 reply; 4+ messages in thread
From: Larry Finger @ 2017-09-04 17:51 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Larry Finger, Ping-Ke Shih, Yan-Hsuan Chuang,
	Birming Chiu, Shaofu, Steven Ting, Stable

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.

Fixes: bcd37f4a0831 ("rtlwifi: btcoex: 23b 2ant: let bt transmit when hw initialisation done")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Cc: Stable <stable@vger.kernel.org> # 4.12+
---

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(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 31965f0ef69d..e8f07573aed9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -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:
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] rtlwifi: btcoexist: Fix antenna selection code
  2017-09-04 17:51 [PATCH 0/2] rtlwifi: Fixes for antenna selection in rtl8723be Larry Finger
  2017-09-04 17:51 ` [PATCH 1/2] rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be Larry Finger
@ 2017-09-04 17:51 ` Larry Finger
  1 sibling, 0 replies; 4+ messages in thread
From: Larry Finger @ 2017-09-04 17:51 UTC (permalink / raw)
  To: kvalo
  Cc: linux-wireless, Larry Finger, Ping-Ke Shih, Yan-Hsuan Chuang,
	Birming Chiu, Shaofu, Steven Ting, Stable

In 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.

Fixes: 87d8a9f35202 ("rtlwifi: btcoex: call bind to setup btcoex")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Cc: Stable <stable@vger.kernel.org> # 4.13+
---

Kalle,

This patch is intended for kernel 4.14.

Thanks,

Larry
---
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c       | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index c1eacd8352a2..b5e9877d935c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -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)
-- 
2.12.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [1/2] rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be
  2017-09-04 17:51 ` [PATCH 1/2] rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be Larry Finger
@ 2017-09-07 12:56   ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2017-09-07 12:56 UTC (permalink / raw)
  To: Larry Finger
  Cc: linux-wireless, Larry Finger, Ping-Ke Shih, Yan-Hsuan Chuang,
	Birming Chiu, Shaofu, Steven Ting, Stable

Larry Finger <Larry.Finger@lwfinger.net> wrote:

> 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.
> 
> Fixes: bcd37f4a0831 ("rtlwifi: btcoex: 23b 2ant: let bt transmit when hw initialisation done")
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Ping-Ke Shih <pkshih@realtek.com>
> Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
> Cc: Birming Chiu <birming@realtek.com>
> Cc: Shaofu <shaofu@realtek.com>
> Cc: Steven Ting <steventing@realtek.com>
> Cc: Stable <stable@vger.kernel.org> # 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

-- 
https://patchwork.kernel.org/patch/9937493/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-07 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-04 17:51 [PATCH 0/2] rtlwifi: Fixes for antenna selection in rtl8723be Larry Finger
2017-09-04 17:51 ` [PATCH 1/2] rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be Larry Finger
2017-09-07 12:56   ` [1/2] " Kalle Valo
2017-09-04 17:51 ` [PATCH 2/2] rtlwifi: btcoexist: Fix antenna selection code Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).