2022-06-30 11:56:34

by tangmeng

[permalink] [raw]
Subject: [PATCH 5.15 1/2] rtw88: 8821c: support RFE type4 wifi NIC

From: Guo-Feng Fan <[email protected]>

commit b789e3fe7047296be0ccdbb7ceb0b58856053572 upstream.

RFE type4 is a new NIC which has one RF antenna shares with BT.
RFE type4 HW is the same as RFE type2 but attaching antenna to
aux antenna connector.

RFE type2 attach antenna to main antenna connector.
Load the same parameter as RFE type2 when initializing NIC.

Signed-off-by: Guo-Feng Fan <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Meng Tang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/rtw8821c.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index f405f42d1c1b..746f6f8967d8 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -304,7 +304,8 @@ static void rtw8821c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
if (channel <= 14) {
if (rtwdev->efuse.rfe_option == 0)
rtw8821c_switch_rf_set(rtwdev, SWITCH_TO_WLG);
- else if (rtwdev->efuse.rfe_option == 2)
+ else if (rtwdev->efuse.rfe_option == 2 ||
+ rtwdev->efuse.rfe_option == 4)
rtw8821c_switch_rf_set(rtwdev, SWITCH_TO_BTG);
rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTDBG, BIT(6), 0x1);
rtw_write_rf(rtwdev, RF_PATH_A, 0x64, 0xf, 0xf);
@@ -777,6 +778,15 @@ static void rtw8821c_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type,
if (switch_status == coex_dm->cur_switch_status)
return;

+ if (coex_rfe->wlg_at_btg) {
+ ctrl_type = COEX_SWITCH_CTRL_BY_BBSW;
+
+ if (coex_rfe->ant_switch_polarity)
+ pos_type = COEX_SWITCH_TO_WLA;
+ else
+ pos_type = COEX_SWITCH_TO_WLG_BT;
+ }
+
coex_dm->cur_switch_status = switch_status;

if (coex_rfe->ant_switch_diversity &&
@@ -1502,6 +1512,7 @@ static const struct rtw_intf_phy_para_table phy_para_table_8821c = {
static const struct rtw_rfe_def rtw8821c_rfe_defs[] = {
[0] = RTW_DEF_RFE(8821c, 0, 0),
[2] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2),
+ [4] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2),
};

static struct rtw_hw_reg rtw8821c_dig[] = {
--
2.20.1




2022-06-30 12:09:10

by tangmeng

[permalink] [raw]
Subject: [PATCH 5.15 2/2] rtw88: rtw8821c: enable rfe 6 devices

commit e109e3617e5d563b431a52e6e2f07f0fc65a93ae upstream.

Ping-Ke Shih answered[1] a question for a user about an rtl8821ce device that
reported RFE 6, which the driver did not support. Ping-Ke suggested a possible
fix, but the user never reported back.

A second user discovered the above thread and tested the proposed fix.
Accordingly, I am pushing this change, even though I am not the author.

[1] https://lore.kernel.org/linux-wireless/[email protected]/

Signed-off-by: Ping-Ke Shih <[email protected]>
Reported-and-tested-by: masterzorag <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Meng Tang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/rtw8821c.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index 746f6f8967d8..897da3ed2f02 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -1513,6 +1513,7 @@ static const struct rtw_rfe_def rtw8821c_rfe_defs[] = {
[0] = RTW_DEF_RFE(8821c, 0, 0),
[2] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2),
[4] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2),
+ [6] = RTW_DEF_RFE(8821c, 0, 0),
};

static struct rtw_hw_reg rtw8821c_dig[] = {
--
2.20.1



2022-06-30 12:23:55

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5.15 2/2] rtw88: rtw8821c: enable rfe 6 devices

On Thu, Jun 30, 2022 at 07:46:21PM +0800, Meng Tang wrote:
> commit e109e3617e5d563b431a52e6e2f07f0fc65a93ae upstream.
>
> Ping-Ke Shih answered[1] a question for a user about an rtl8821ce device that
> reported RFE 6, which the driver did not support. Ping-Ke suggested a possible
> fix, but the user never reported back.
>
> A second user discovered the above thread and tested the proposed fix.
> Accordingly, I am pushing this change, even though I am not the author.
>
> [1] https://lore.kernel.org/linux-wireless/[email protected]/
>
> Signed-off-by: Ping-Ke Shih <[email protected]>
> Reported-and-tested-by: masterzorag <[email protected]>
> Signed-off-by: Larry Finger <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>
> Link: https://lore.kernel.org/r/[email protected]
> Signed-off-by: Meng Tang <[email protected]>
> ---
> drivers/net/wireless/realtek/rtw88/rtw8821c.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> index 746f6f8967d8..897da3ed2f02 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> @@ -1513,6 +1513,7 @@ static const struct rtw_rfe_def rtw8821c_rfe_defs[] = {
> [0] = RTW_DEF_RFE(8821c, 0, 0),
> [2] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2),
> [4] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2),
> + [6] = RTW_DEF_RFE(8821c, 0, 0),
> };
>
> static struct rtw_hw_reg rtw8821c_dig[] = {
> --
> 2.20.1
>
>
>

Both now queued up, thanks.

greg k-h