All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] rtw88: 8821c: support RFE type4 wifi NIC
@ 2021-09-22  2:36 Ping-Ke Shih
  2021-09-22  2:36 ` [PATCH 2/2] rtw88: 8821c: correct 2.4G tx power for type 2/4 NIC Ping-Ke Shih
  2021-09-24 11:22 ` [PATCH 1/2] rtw88: 8821c: support RFE type4 wifi NIC Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2021-09-22  2:36 UTC (permalink / raw)
  To: tony0620emma, kvalo; +Cc: linux-wireless, vincent_fann

From: Guo-Feng Fan <vincent_fann@realtek.com>

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 <vincent_fann@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 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 349eef1a0ff2..3effdf902f22 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -305,7 +305,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);
@@ -774,6 +775,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 &&
@@ -1499,6 +1509,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.25.1


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

* [PATCH 2/2] rtw88: 8821c: correct 2.4G tx power for type 2/4 NIC
  2021-09-22  2:36 [PATCH 1/2] rtw88: 8821c: support RFE type4 wifi NIC Ping-Ke Shih
@ 2021-09-22  2:36 ` Ping-Ke Shih
  2021-09-24 11:22 ` [PATCH 1/2] rtw88: 8821c: support RFE type4 wifi NIC Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2021-09-22  2:36 UTC (permalink / raw)
  To: tony0620emma, kvalo; +Cc: linux-wireless, vincent_fann

From: Guo-Feng Fan <vincent_fann@realtek.com>

NIC card saves calibrated TX power index in the efuse(ROM).
Driver loads TX power idex when interface is up.

The problem is type2/4 NICs loads 2.4G TX power index
from wrong position. This patch corrects the offsets.
So, driver loads real 2.4G TX power index for type 2/4 NICs.

2.4G performance increased when using correct TX power index.

Signed-off-by: Guo-Feng Fan <vincent_fann@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index 3effdf902f22..80a6f4da6acd 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -61,6 +61,9 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
 	for (i = 0; i < 4; i++)
 		efuse->txpwr_idx_table[i] = map->txpwr_idx_table[i];
 
+	if (rtwdev->efuse.rfe_option == 2 || rtwdev->efuse.rfe_option == 4)
+		efuse->txpwr_idx_table[0].pwr_idx_2g = map->txpwr_idx_table[1].pwr_idx_2g;
+
 	switch (rtw_hci_type(rtwdev)) {
 	case RTW_HCI_TYPE_PCIE:
 		rtw8821ce_efuse_parsing(efuse, map);
-- 
2.25.1


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

* Re: [PATCH 1/2] rtw88: 8821c: support RFE type4 wifi NIC
  2021-09-22  2:36 [PATCH 1/2] rtw88: 8821c: support RFE type4 wifi NIC Ping-Ke Shih
  2021-09-22  2:36 ` [PATCH 2/2] rtw88: 8821c: correct 2.4G tx power for type 2/4 NIC Ping-Ke Shih
@ 2021-09-24 11:22 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-09-24 11:22 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: tony0620emma, linux-wireless, vincent_fann

Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Guo-Feng Fan <vincent_fann@realtek.com>
> 
> 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 <vincent_fann@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

2 patches applied to wireless-drivers-next.git, thanks.

b789e3fe7047 rtw88: 8821c: support RFE type4 wifi NIC
5db4943a9d6f rtw88: 8821c: correct 2.4G tx power for type 2/4 NIC

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210922023637.9357-1-pkshih@realtek.com/

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


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

end of thread, other threads:[~2021-09-24 11:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22  2:36 [PATCH 1/2] rtw88: 8821c: support RFE type4 wifi NIC Ping-Ke Shih
2021-09-22  2:36 ` [PATCH 2/2] rtw88: 8821c: correct 2.4G tx power for type 2/4 NIC Ping-Ke Shih
2021-09-24 11:22 ` [PATCH 1/2] rtw88: 8821c: support RFE type4 wifi NIC Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.