Skip to contentSkip to conversation

rtw88: 8821c: the rest patches to support 8821c

PATCH In review [email protected] 5 participants 14 messages Jun 3, 2020 – Jul 15, 2020 Realtek wireless driver (rtw88)

lore
Share & tools
lore
#0 lore raw

v2 cover rtw88: 8821c: the rest patches to support 8821c

From: Yan-Hsuan Chuang <[email protected]>

[Note] this set is based on another set:

    [v3,0/7] rtw88: 8821c: add basic function routines
    https://patchwork.kernel.org/cover/11585415/

After this set, the RTL8821CE device is supported by rtw88. The CCK PD settings allows the device to adjust to the environment. The power tracking mechanism can detect the thermal value of the device and modify the power index.

As RTL8821CE is an 802.11ac 1x1 device, the STBC the no supported.

v1 -> v2
* rebase
* add definition for some register

Tzu-En Huang (5):
rtw88: 8821c: add cck pd settings
rtw88: 8821c: add power tracking
rtw88: 8821c: add beamformee support
rtw88: single rf path chips don't support TX STBC
rtw88: 8821c: Add 8821CE to Kconfig and Makefile

 drivers/net/wireless/realtek/rtw88/Kconfig    |  14 +
 drivers/net/wireless/realtek/rtw88/Makefile   |   6 +
 drivers/net/wireless/realtek/rtw88/bf.c       |   5 +-
 drivers/net/wireless/realtek/rtw88/main.c     |   4 +-
 drivers/net/wireless/realtek/rtw88/main.h     |   2 +
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 361 ++++++++++++++++++
 drivers/net/wireless/realtek/rtw88/rtw8821c.h |   4 +
 7 files changed, 392 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/5 rtw88: 8821c: add cck pd settings

From: Tzu-En Huang <[email protected]>

CCK PD can reduce the number of false alarm of the CCK rates. It dynamically adjusts the power threshold and CS ratio. The values are compared to the values of the previous level, if the level is changed, set new values of power threshold and CS ratio.

Implement rtw_chip_ops::cck_pd_set() for 8821c.

---
 drivers/net/wireless/realtek/rtw88/main.h     |  1 +
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 25 +++++++++++++++++++
 drivers/net/wireless/realtek/rtw88/rtw8821c.h |  3 +++
 3 files changed, 29 insertions(+)
drivers/net/wireless/realtek/rtw88/main.h +1 -0
index 82b6accf4744..605a70e311fc 100644
@@ -1483,6 +1483,7 @@ struct rtw_dm_info {
 	/* [bandwidth 0:20M/1:40M][number of path] */
 	u8 cck_pd_lv[2][RTW_RF_PATH_MAX];
 	u32 cck_fa_avg;
+	u8 cck_pd_default;
 
 	/* save the last rx phy status for debug */
 	s8 rx_snr[RTW_RF_PATH_MAX];
drivers/net/wireless/realtek/rtw88/rtw8821c.c +25 -0
index 4bd4164d23ef..904eb494ccad 100644
@@ -102,6 +102,7 @@ static void rtw8821c_phy_set_param(struct rtw_dev *rtwdev)
 	rtwdev->chip->ch_param[2] = rtw_read32_mask(rtwdev, REG_TXFILTER, MASKDWORD);
 
 	rtw_phy_init(rtwdev);
+	rtwdev->dm_info.cck_pd_default = rtw_read8(rtwdev, REG_CSRATIO) & 0x1f;
 }
 
 static int rtw8821c_mac_init(struct rtw_dev *rtwdev)
@@ -596,6 +597,29 @@ static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev)
 	rtw8821c_do_iqk(rtwdev);
 }
 
+static void rtw8821c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl)
+{
+	struct rtw_dm_info *dm_info = &rtwdev->dm_info;
+	u8 pd[CCK_PD_LV_MAX] = {3, 7, 13, 13, 13};
+
+	if (dm_info->min_rssi > 60) {
+		new_lvl = 4;
+		pd[4] = 0x1d;
+		goto set_cck_pd;
+	}
+
+	if (dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] == new_lvl)
+		return;
+
+	dm_info->cck_fa_avg = CCK_FA_AVG_RESET;
+
+set_cck_pd:
+	dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] = new_lvl;
+	rtw_write32_mask(rtwdev, REG_PWRTH, 0x3f0000, pd[new_lvl]);
+	rtw_write32_mask(rtwdev, REG_PWRTH2, 0x1f0000,
+			 dm_info->cck_pd_default + new_lvl * 2);
+}
+
 static struct rtw_pwr_seq_cmd trans_carddis_to_cardemu_8821c[] = {
 	{0x0086,
 	 RTW_PWR_CUT_ALL_MSK,
@@ -1035,6 +1059,7 @@ static struct rtw_chip_ops rtw8821c_ops = {
 	.cfg_ldo25		= rtw8821c_cfg_ldo25,
 	.false_alarm_statistics	= rtw8821c_false_alarm_statistics,
 	.phy_calibration	= rtw8821c_phy_calibration,
+	.cck_pd_set		= rtw8821c_phy_cck_pd_set,
 };
 
 struct rtw_chip_info rtw8821c_hw_spec = {
drivers/net/wireless/realtek/rtw88/rtw8821c.h +3 -0
index 3b7d12bf7728..bc66b91cd961 100644
@@ -186,11 +186,14 @@ _rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data)
 #define REG_FAS		0x9a4
 #define REG_RXSB	0xa00
 #define REG_ADCINI	0xa04
+#define REG_PWRTH	0xa08
 #define REG_TXSF2	0xa24
 #define REG_TXSF6	0xa28
 #define REG_FA_CCK	0xa5c
 #define REG_RXDESC	0xa2c
 #define REG_ENTXCCK	0xa80
+#define REG_PWRTH2	0xaa8
+#define REG_CSRATIO	0xaaa
 #define REG_TXFILTER	0xaac
 #define REG_CNTRST	0xb58
 #define REG_AGCTR_A	0xc08
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v2 1/5] rtw88: 8821c: add cck pd settings

drivers/net/wireless/realtek/rtw88/rtw8821c.c static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev) · line 607

Quoted 12 lines · On 2020-06-03 17:42:14 [+0800], [email protected] wrote:
drivers/net/wireless/realtek/rtw88/rtw8821c.c +8 -0
@@ -596,6 +597,29 @@ static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev)
 	rtw8821c_do_iqk(rtwdev);
 }
 
+static void rtw8821c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl)
+{
+	struct rtw_dm_info *dm_info = &rtwdev->dm_info;
+	u8 pd[CCK_PD_LV_MAX] = {3, 7, 13, 13, 13};
+
+	if (dm_info->min_rssi > 60) {
+		new_lvl = 4;
+		pd[4] = 0x1d;

replace 4 with CCK_PD_LV4 ?

Review static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev) · line 609

Quoted 2 lines
(quoted diff) +2 -0
+		goto set_cck_pd;
+	}

Sebastian

#3 lore raw

Re: [PATCH v2 1/5] rtw88: 8821c: add cck pd settings

In reply to [email protected]
Quoted 12 lines · <[email protected]> writes:

From: Tzu-En Huang <[email protected]>

CCK PD can reduce the number of false alarm of the CCK rates. It dynamically adjusts the power threshold and CS ratio. The values are compared to the values of the previous level, if the level is changed, set new values of power threshold and CS ratio.

Implement rtw_chip_ops::cck_pd_set() for 8821c.

[...]

Quoted 26 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +13 -0
@@ -102,6 +102,7 @@ static void rtw8821c_phy_set_param(struct rtw_dev *rtwdev)
 	rtwdev->chip->ch_param[2] = rtw_read32_mask(rtwdev, REG_TXFILTER, MASKDWORD);
 
 	rtw_phy_init(rtwdev);
+	rtwdev->dm_info.cck_pd_default = rtw_read8(rtwdev, REG_CSRATIO) & 0x1f;
 }
 
 static int rtw8821c_mac_init(struct rtw_dev *rtwdev)
@@ -596,6 +597,29 @@ static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev)
 	rtw8821c_do_iqk(rtwdev);
 }
 
+static void rtw8821c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl)
+{
+	struct rtw_dm_info *dm_info = &rtwdev->dm_info;
+	u8 pd[CCK_PD_LV_MAX] = {3, 7, 13, 13, 13};
+
+	if (dm_info->min_rssi > 60) {
+		new_lvl = 4;
+		pd[4] = 0x1d;
+		goto set_cck_pd;
+	}
+
+	if (dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] == new_lvl)

drivers/net/wireless/realtek/rtw88/rtw8821c.c static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev) · line 621

Quoted 10 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +10 -0
+		return;
+
+	dm_info->cck_fa_avg = CCK_FA_AVG_RESET;
+
+set_cck_pd:
+	dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] = new_lvl;
+	rtw_write32_mask(rtwdev, REG_PWRTH, 0x3f0000, pd[new_lvl]);
+	rtw_write32_mask(rtwdev, REG_PWRTH2, 0x1f0000,
+			 dm_info->cck_pd_default + new_lvl * 2);
+}

I'm starting to see the trend of using magic values in rtw88 on the rise again. Please be careful with this, the source code should not be full of undocument values. In some special cases (eg calibration data etc) using undocumented values is ok, but most of cases should have proper defines for documenting what's happening.

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw

RE: [PATCH v2 1/5] rtw88: 8821c: add cck pd settings

Quoted 48 lines
Quoted 12 lines · <[email protected]> writes:

From: Tzu-En Huang <[email protected]>

CCK PD can reduce the number of false alarm of the CCK rates. It dynamically adjusts the power threshold and CS ratio. The values are compared to the values of the previous level, if the level is changed, set new values of power threshold and CS ratio.

Implement rtw_chip_ops::cck_pd_set() for 8821c.

[...]

drivers/net/wireless/realtek/rtw88/rtw8821c.c static void rtw8821c_phy_set_param(struct rtw_dev

Quoted 3 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +0 -0
@@ -102,6 +102,7 @@ static void rtw8821c_phy_set_param(struct rtw_dev

*rtwdev)

drivers/net/wireless/realtek/rtw88/rtw8821c.c static void rtw8821c_phy_set_param(struct rtw_dev · line 102

Quoted 1 line
drivers/net/wireless/realtek/rtw88/rtw8821c.c +0 -0
 	rtwdev->chip->ch_param[2] = rtw_read32_mask(rtwdev, REG_TXFILTER,

MASKDWORD);

drivers/net/wireless/realtek/rtw88/rtw8821c.c static void rtw8821c_phy_set_param(struct rtw_dev · line 104

Quoted 3 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +1 -0
 	rtw_phy_init(rtwdev);
+	rtwdev->dm_info.cck_pd_default = rtw_read8(rtwdev, REG_CSRATIO) &

0x1f;

drivers/net/wireless/realtek/rtw88/rtw8821c.c static void rtw8821c_phy_calibration(struct

Quoted 4 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +0 -0
 }
 
 static int rtw8821c_mac_init(struct rtw_dev *rtwdev)
@@ -596,6 +597,29 @@ static void rtw8821c_phy_calibration(struct

rtw_dev *rtwdev)

Quoted 5 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +2 -0
 	rtw8821c_do_iqk(rtwdev);
 }
 
+static void rtw8821c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl)
+{

drivers/net/wireless/realtek/rtw88/rtw8821c.c static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev)

Quoted 10 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +10 -0
+	struct rtw_dm_info *dm_info = &rtwdev->dm_info;
+	u8 pd[CCK_PD_LV_MAX] = {3, 7, 13, 13, 13};
+
+	if (dm_info->min_rssi > 60) {
+		new_lvl = 4;
+		pd[4] = 0x1d;
+		goto set_cck_pd;
+	}
+
+	if (dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] ==

new_lvl)

Quoted 17 lines

drivers/net/wireless/realtek/rtw88/rtw8821c.c static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev) · line 621

Quoted 10 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +10 -0
+		return;
+
+	dm_info->cck_fa_avg = CCK_FA_AVG_RESET;
+
+set_cck_pd:
+	dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] = new_lvl;
+	rtw_write32_mask(rtwdev, REG_PWRTH, 0x3f0000, pd[new_lvl]);
+	rtw_write32_mask(rtwdev, REG_PWRTH2, 0x1f0000,
+			 dm_info->cck_pd_default + new_lvl * 2);
+}

I'm starting to see the trend of using magic values in rtw88 on the rise again. Please be careful with this, the source code should not be full of undocument values. In some special cases (eg calibration data etc) using undocumented values is ok, but most of cases should have proper defines for documenting what's happening.

I'll take care of that, many thanks.

Yen-Hsuan

#5 lore raw

Re: [PATCH v2 1/5] rtw88: 8821c: add cck pd settings

In reply to [email protected]
Quoted 8 lines · <[email protected]> wrote:

From: Tzu-En Huang <[email protected]>

CCK PD can reduce the number of false alarm of the CCK rates. It dynamically adjusts the power threshold and CS ratio. The values are compared to the values of the previous level, if the level is changed, set new values of power threshold and CS ratio.

Quoted 4 lines

Implement rtw_chip_ops::cck_pd_set() for 8821c.

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

11fcb119a758 rtw88: 8821c: add cck pd settings 3a4312828ce1 rtw88: 8821c: add power tracking 5f4eab883c6a rtw88: 8821c: add beamformee support d47e7371b23a rtw88: single rf path chips don't support TX STBC f745eb9ca5bf rtw88: 8821c: Add 8821CE to Kconfig and Makefile

Signature · 3 lines
https://patchwork.kernel.org/patch/11585435/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#6 lore raw

PATCH v2 2/5 rtw88: 8821c: add power tracking

In reply to [email protected]

From: Tzu-En Huang <[email protected]>

The TX power requires to be adjusted based on the thermal value. The actual power will decrease if the thermal value raised, and will increase if the thermal value lowered. Driver comapres the thermal value, as moving averages. If it changes over a limit, driver will modify the TX power index to compensate.

Implement rtw_chip_ops::pwr_track() for 8821c.

---
 drivers/net/wireless/realtek/rtw88/main.h     |   1 +
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 291 ++++++++++++++++++
 drivers/net/wireless/realtek/rtw88/rtw8821c.h |   1 +
 3 files changed, 293 insertions(+)
drivers/net/wireless/realtek/rtw88/main.h +1 -0
index 605a70e311fc..776ec0590aba 100644
@@ -1466,6 +1466,7 @@ struct rtw_dm_info {
 	u8 thermal_avg[RTW_RF_PATH_MAX];
 	u8 thermal_meter_k;
 	s8 delta_power_index[RTW_RF_PATH_MAX];
+	s8 delta_power_index_last[RTW_RF_PATH_MAX];
 	u8 default_ofdm_index;
 	bool pwr_trk_triggered;
 	bool pwr_trk_init_trigger;
drivers/net/wireless/realtek/rtw88/rtw8821c.c +291 -0

327 lines not on this page · raw message

drivers/net/wireless/realtek/rtw88/rtw8821c.h +1 -0
index bc66b91cd961..166bd0e9294e 100644
@@ -200,6 +200,7 @@ _rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data)
 #define REG_TXSCALE_A	0xc1c
 #define REG_TXDFIR	0xc20
 #define REG_RXIGI_A	0xc50
+#define REG_TXAGCIDX	0xc94
 #define REG_TRSW	0xca0
 #define REG_RFESEL0	0xcb0
 #define REG_RFESEL8	0xcb4
Signature · 1 line
2.17.1
#7 lore raw

Re: [PATCH v2 2/5] rtw88: 8821c: add power tracking

Quoted 19 lines · On 2020-06-03 17:42:15 [+0800], [email protected] wrote:
drivers/net/wireless/realtek/rtw88/rtw8821c.c +11 -0
index 904eb494ccad..aa2457046ad1 100644
@@ -61,6 +61,46 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map)
 	return 0;
 }
 
+static const u32 rtw8821c_txscale_tbl[] = {
+	0x081, 0x088, 0x090, 0x099, 0x0a2, 0x0ac, 0x0b6, 0x0c0, 0x0cc, 0x0d8,
+	0x0e5, 0x0f2, 0x101, 0x110, 0x120, 0x131, 0x143, 0x156, 0x16a, 0x180,
+	0x197, 0x1af, 0x1c8, 0x1e3, 0x200, 0x21e, 0x23e, 0x261, 0x285, 0x2ab,
+	0x2d3, 0x2fe, 0x32b, 0x35c, 0x38e, 0x3c4, 0x3fe
+};
+
+static const u8 rtw8821c_get_swing_index(struct rtw_dev *rtwdev)
+{
+	u8 i = 0;
+	u32 swing, table_value;

drivers/net/wireless/realtek/rtw88/rtw8821c.c static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) · line 84

Quoted 10 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +10 -0
+
+	swing = rtw_read32_mask(rtwdev, REG_TXSCALE_A, 0xffe00000);
+	for (i = 0; i < ARRAY_SIZE(rtw8821c_txscale_tbl); i++) {
+		table_value = rtw8821c_txscale_tbl[i];
+		if (swing == table_value)
+			break;
+	}
+
+	return i;
+}

This matches rtw8822b_get_swing_index() and rtw8822b_txscale_tbl. How often are the lookups performed and how likely is it that the value is not found?
With something like this:

static int rtw8821c_get_swing_index(unsigned int swing)

 {
         unsigned short val;
         int start, end;
         int candidate;
 
         start = 0;
         end = ARRAY_SIZE(rtw8821c_txscale_tbl);
         while (start < end) {
 
                 candidate = start + (end - start) / 2;
                 val = rtw8821c_txscale_tbl[candidate];
                 if (swing == val)
                         return candidate;
                 if (swing < val)
                         end = candidate;
                 else
                         start = candidate + 1;
         }
         return -EINVAL;

}

you would end up with more less constant lookup time with ~6 lookups in worst case. I guess it is not a hot path but still…
Can the table become u16?

…

drivers/net/wireless/realtek/rtw88/rtw8821c.c static struct rtw_chip_ops rtw8821c_ops = { · line 1334

Quoted 4 lines
drivers/net/wireless/realtek/rtw88/rtw8821c.c +4 -0
+const struct rtw_pwr_track_tbl rtw8821c_rtw_pwr_track_tbl = {
+	.pwrtrk_5gb_n[0] = rtw8821c_pwrtrk_5gb_n[0],
+	.pwrtrk_5gb_n[1] = rtw8821c_pwrtrk_5gb_n[1],
+	.pwrtrk_5gb_n[2] = rtw8821c_pwrtrk_5gb_n[2],

so the other driver use RTW_PWR_TRK_5G_1…3. Using constants here isn't better because a line like

	.pwrtrk_5gb_n[2] = rtw8821c_pwrtrk_5gb_n[22],

will not trigger a warning. This is just an observation.

Sebastian

#8 lore raw

PATCH v2 3/5 rtw88: 8821c: add beamformee support

In reply to [email protected]

From: Tzu-En Huang <[email protected]>

Beamforming is used for directional signal transmission/reception. Beamformee plays the role for signal reception, and makes the RX performance better in middle distance range.

Implement beamformee related callbacks for 8821c.

Since 8821c only support 1ss rate, nc_index in beamformee setting needs to be adjusted based on the capability.

---
 drivers/net/wireless/realtek/rtw88/bf.c       |  5 ++-
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 45 +++++++++++++++++++
 2 files changed, 48 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/bf.c +3 -2
index 8a070d5d9174..aff70e4ae028 100644
@@ -183,7 +183,7 @@ void rtw_bf_del_sounding(struct rtw_dev *rtwdev)
 void rtw_bf_enable_bfee_su(struct rtw_dev *rtwdev, struct rtw_vif *vif,
 			   struct rtw_bfee *bfee)
 {
-	u8 nc_index = 1;
+	u8 nc_index = hweight8(rtwdev->hal.antenna_rx) - 1;
 	u8 nr_index = bfee->sound_dim;
 	u8 grouping = 0, codebookinfo = 1, coefficientsize = 3;
 	u32 addr_bfer_info, addr_csi_rpt, csi_param;
@@ -231,7 +231,8 @@ void rtw_bf_enable_bfee_mu(struct rtw_dev *rtwdev, struct rtw_vif *vif,
 {
 	struct rtw_bf_info *bf_info = &rtwdev->bf_info;
 	struct mu_bfer_init_para param;
-	u8 nc_index = 1, nr_index = 1;
+	u8 nc_index = hweight8(rtwdev->hal.antenna_rx) - 1;
+	u8 nr_index = 1;
 	u8 grouping = 0, codebookinfo = 1, coefficientsize = 0;
 	u32 csi_param;
 
drivers/net/wireless/realtek/rtw88/rtw8821c.c +45 -0

75 lines not on this page · raw message

Signature · 1 line
2.17.1
#9 lore raw

PATCH v2 4/5 rtw88: single rf path chips don't support TX STBC

In reply to [email protected]

From: Tzu-En Huang <[email protected]>

Since single rf path chips don't support TX SPBC, tell mac80211 to not advertise it.

---
 drivers/net/wireless/realtek/rtw88/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +2 -2
index d5677f94170f..9992f56ff624 100644
@@ -989,12 +989,12 @@ static void rtw_init_vht_cap(struct rtw_dev *rtwdev,
 	vht_cap->vht_supported = true;
 	vht_cap->cap = IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
 		       IEEE80211_VHT_CAP_SHORT_GI_80 |
-		       IEEE80211_VHT_CAP_TXSTBC |
 		       IEEE80211_VHT_CAP_RXSTBC_1 |
 		       IEEE80211_VHT_CAP_HTC_VHT |
 		       IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
 		       0;
-
+	if (rtwdev->hal.rf_path_num > 1)
+		vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC;
 	vht_cap->cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
 			IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE;
 	vht_cap->cap |= (rtwdev->hal.bfee_sts_cap <<
Signature · 1 line
2.17.1
#10 lore raw

PATCH v2 5/5 rtw88: 8821c: Add 8821CE to Kconfig and Makefile

In reply to [email protected]

From: Tzu-En Huang <[email protected]>

Since 8821C code is ready, we can build it.

---
 drivers/net/wireless/realtek/rtw88/Kconfig  | 14 ++++++++++++++
 drivers/net/wireless/realtek/rtw88/Makefile |  6 ++++++
 2 files changed, 20 insertions(+)
drivers/net/wireless/realtek/rtw88/Kconfig +14 -0
index ca894c4f96ac..e3d7cb6c1290 100644
@@ -25,6 +25,9 @@ config RTW88_8822C
 config RTW88_8723D
 	tristate
 
+config RTW88_8821C
+	tristate
+
 config RTW88_8822BE
 	tristate "Realtek 8822BE PCI wireless network adapter"
 	depends on PCI
@@ -58,6 +61,17 @@ config RTW88_8723DE
 
 	  802.11n PCIe wireless network adapter
 
+config RTW88_8821CE
+	tristate "Realtek 8821CE PCI wireless network adapter"
+	depends on PCI
+	select RTW88_CORE
+	select RTW88_PCI
+	select RTW88_8821C
+	help
+	  Select this option will enable support for 8821CE chipset
+
+	  802.11ac PCIe wireless network adapter
+
 config RTW88_DEBUG
 	bool "Realtek rtw88 debug support"
 	depends on RTW88_CORE
drivers/net/wireless/realtek/rtw88/Makefile +6 -0
index f31e78a6f146..c0e4b111c8b4 100644
@@ -37,5 +37,11 @@ rtw88_8723d-objs		:= rtw8723d.o rtw8723d_table.o
 obj-$(CONFIG_RTW88_8723DE)	+= rtw88_8723de.o
 rtw88_8723de-objs		:= rtw8723de.o
 
+obj-$(CONFIG_RTW88_8821C)	+= rtw88_8821c.o
+rtw88_8821c-objs		:= rtw8821c.o rtw8821c_table.o
+
+obj-$(CONFIG_RTW88_8821CE)	+= rtw88_8821ce.o
+rtw88_8821ce-objs		:= rtw8821ce.o
+
 obj-$(CONFIG_RTW88_PCI)		+= rtw88_pci.o
 rtw88_pci-objs			:= pci.o
Signature · 1 line
2.17.1
#11 lore raw

Re: [PATCH v2 5/5] rtw88: 8821c: Add 8821CE to Kconfig and Makefile

Quoted 6 lines · On 6/3/20 4:42 AM, [email protected] wrote:

From: Tzu-En Huang <[email protected]>

Since 8821C code is ready, we can build it.

I added this code to the rtw88 GitHub repository that I maintain. I do not have an 8821CE card and have no way to test it; however, there is at least one user.

That user has built the driver and gets the firmware loaded, but runs into the following:

[   12.378158] rtw_8821ce 0000:02:00.0: Firmware version 24.5.0, H2C version 12
[   12.404834] rtw_8821ce 0000:02:00.0: rfe 2 isn't supported
[   12.404937] rtw_8821ce 0000:02:00.0: failed to setup chip efuse info
[   12.404939] rtw_8821ce 0000:02:00.0: failed to setup chip information

Any help would be appreciated.

Thanks,

Larry

#12 lore raw

RE: [PATCH v2 5/5] rtw88: 8821c: Add 8821CE to Kconfig and Makefile

Quoted 11 lines · On 6/3/20 4:42 AM, [email protected] wrote:
Quoted 6 lines

From: Tzu-En Huang <[email protected]>

Since 8821C code is ready, we can build it.

I added this code to the rtw88 GitHub repository that I maintain. I do not have an 8821CE card and have no way to test it; however, there is at least one user.

Quoted 9 lines

That user has built the driver and gets the firmware loaded, but runs into the following:

[   12.378158] rtw_8821ce 0000:02:00.0: Firmware version 24.5.0, H2C
version 12
[   12.404834] rtw_8821ce 0000:02:00.0: rfe 2 isn't supported
[   12.404937] rtw_8821ce 0000:02:00.0: failed to setup chip efuse info
[   12.404939] rtw_8821ce 0000:02:00.0: failed to setup chip information

I need to check the devices with RFE type 2. I am not sure if they are supported. But you can try to add RFE 2 in rtw8821c.c, that can probably work.

Yen-Hsuan

#13 lore raw

Re: [PATCH v2 5/5] rtw88: 8821c: Add 8821CE to Kconfig and Makefile

Quoted 25 lines · Tony Chuang
Quoted 12 lines · On 6/3/20 4:42 AM, [email protected] wrote:
Quoted 6 lines

From: Tzu-En Huang <[email protected]>

Since 8821C code is ready, we can build it.

I added this code to the rtw88 GitHub repository that I maintain. I do not have an 8821CE card and have no way to test it; however, there is at least one user.

Quoted 9 lines

That user has built the driver and gets the firmware loaded, but runs into the following:

[   12.378158] rtw_8821ce 0000:02:00.0: Firmware version 24.5.0, H2C
version 12
[   12.404834] rtw_8821ce 0000:02:00.0: rfe 2 isn't supported
[   12.404937] rtw_8821ce 0000:02:00.0: failed to setup chip efuse info
[   12.404939] rtw_8821ce 0000:02:00.0: failed to setup chip information
Quoted 2 lines

I need to check the devices with RFE type 2. I am not sure if they are supported. But you can try to add RFE 2 in rtw8821c.c, that can probably work.

I added RFE2 to the rfe_defs table:

drivers/net/wireless/realtek/rtw88/rtw8821c.c +1 -0
index c41c61ee2fb6..73f3b9f1ae31 100644
@@ -1219,6 +1219,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(8821c, 0, 0),
 };
 
 static struct rtw_hw_reg rtw8821c_dig[] = {

However, the driver triggers a NULL pointer dereference, because there are many rfe ops are missing for 8821c.

Kai-Heng

Quoted 2 lines

Yen-Hsuan