* [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2)
@ 2025-02-04 18:35 Bitterblue Smith
2025-02-04 18:36 ` [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU Bitterblue Smith
` (8 more replies)
0 siblings, 9 replies; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:35 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
A few small changes for RTL8814AU. Mostly it's about supporting more
than 2 RF paths and spatial streams.
Part 2 will have 8 more patches to prepare things.
Part 3 will be mostly the new files for RTL8814AU.
Part 4 will improve performance.
Bitterblue Smith (9):
wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU
wifi: rtw88: Fix download_firmware_validate() for RTL8814AU
wifi: rtw88: Extend struct rtw_pwr_track_tbl for RTL8814AU
wifi: rtw88: Extend rf_base_addr and rf_sipi_addr for RTL8814AU
wifi: rtw88: Extend rtw_fw_send_ra_info() for RTL8814AU
wifi: rtw88: Constify some more structs and arrays
wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM
wifi: rtw88: Extend TX power stuff for 3-4 spatial streams
wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
drivers/net/wireless/realtek/rtw88/fw.c | 15 ++
drivers/net/wireless/realtek/rtw88/fw.h | 1 +
drivers/net/wireless/realtek/rtw88/mac.c | 6 +-
drivers/net/wireless/realtek/rtw88/main.c | 18 +-
drivers/net/wireless/realtek/rtw88/main.h | 36 +++-
drivers/net/wireless/realtek/rtw88/pci.c | 4 +-
drivers/net/wireless/realtek/rtw88/phy.c | 191 ++++++++++++------
drivers/net/wireless/realtek/rtw88/phy.h | 20 +-
drivers/net/wireless/realtek/rtw88/reg.h | 3 +-
drivers/net/wireless/realtek/rtw88/rtw8821c.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw88xxa.c | 2 +-
drivers/net/wireless/realtek/rtw88/sar.c | 2 +-
drivers/net/wireless/realtek/rtw88/sdio.c | 2 +-
drivers/net/wireless/realtek/rtw88/usb.c | 2 +-
16 files changed, 205 insertions(+), 103 deletions(-)
--
2.48.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
@ 2025-02-04 18:36 ` Bitterblue Smith
2025-02-10 1:23 ` Ping-Ke Shih
2025-02-10 3:44 ` Ping-Ke Shih
2025-02-04 18:37 ` [PATCH v2 2/9] wifi: rtw88: Fix download_firmware_validate() " Bitterblue Smith
` (7 subsequent siblings)
8 siblings, 2 replies; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:36 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
Don't call ltecoex_read_reg() and ltecoex_reg_write() when the
ltecoex_addr member of struct rtw_chip_info is NULL. The RTL8814AU
doesn't have this feature.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- No change.
---
drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index cae9cca6dca3..63edf6461de8 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -784,7 +784,8 @@ static int __rtw_download_firmware(struct rtw_dev *rtwdev,
if (!check_firmware_size(data, size))
return -EINVAL;
- if (!ltecoex_read_reg(rtwdev, 0x38, <ecoex_bckp))
+ if (rtwdev->chip->ltecoex_addr &&
+ !ltecoex_read_reg(rtwdev, 0x38, <ecoex_bckp))
return -EBUSY;
wlan_cpu_enable(rtwdev, false);
@@ -802,7 +803,8 @@ static int __rtw_download_firmware(struct rtw_dev *rtwdev,
wlan_cpu_enable(rtwdev, true);
- if (!ltecoex_reg_write(rtwdev, 0x38, ltecoex_bckp)) {
+ if (rtwdev->chip->ltecoex_addr &&
+ !ltecoex_reg_write(rtwdev, 0x38, ltecoex_bckp)) {
ret = -EBUSY;
goto dlfw_fail;
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 2/9] wifi: rtw88: Fix download_firmware_validate() for RTL8814AU
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
2025-02-04 18:36 ` [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU Bitterblue Smith
@ 2025-02-04 18:37 ` Bitterblue Smith
2025-02-10 1:24 ` Ping-Ke Shih
2025-02-04 18:38 ` [PATCH v2 3/9] wifi: rtw88: Extend struct rtw_pwr_track_tbl " Bitterblue Smith
` (6 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:37 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
After the firmware is uploaded, download_firmware_validate() checks some
bits in REG_MCUFW_CTRL to see if everything went okay. The
RTL8814AU power on sequence sets bits 13 and 12 to 2, which this
function does not expect, so it thinks the firmware upload failed.
Make download_firmware_validate() ignore bits 13 and 12.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- No change.
---
drivers/net/wireless/realtek/rtw88/reg.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw88/reg.h b/drivers/net/wireless/realtek/rtw88/reg.h
index e438405fba56..209b6fc08a73 100644
--- a/drivers/net/wireless/realtek/rtw88/reg.h
+++ b/drivers/net/wireless/realtek/rtw88/reg.h
@@ -130,6 +130,7 @@
#define BIT_SHIFT_ROM_PGE 16
#define BIT_FW_INIT_RDY BIT(15)
#define BIT_FW_DW_RDY BIT(14)
+#define BIT_CPU_CLK_SEL (BIT(12) | BIT(13))
#define BIT_RPWM_TOGGLE BIT(7)
#define BIT_RAM_DL_SEL BIT(7) /* legacy only */
#define BIT_DMEM_CHKSUM_OK BIT(6)
@@ -147,7 +148,7 @@
BIT_CHECK_SUM_OK)
#define FW_READY_LEGACY (BIT_MCUFWDL_RDY | BIT_FWDL_CHK_RPT | \
BIT_WINTINI_RDY | BIT_RAM_DL_SEL)
-#define FW_READY_MASK 0xffff
+#define FW_READY_MASK (0xffff & ~BIT_CPU_CLK_SEL)
#define REG_MCU_TST_CFG 0x84
#define VAL_FW_TRIGGER 0x1
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 3/9] wifi: rtw88: Extend struct rtw_pwr_track_tbl for RTL8814AU
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
2025-02-04 18:36 ` [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU Bitterblue Smith
2025-02-04 18:37 ` [PATCH v2 2/9] wifi: rtw88: Fix download_firmware_validate() " Bitterblue Smith
@ 2025-02-04 18:38 ` Bitterblue Smith
2025-02-10 1:25 ` Ping-Ke Shih
2025-02-04 18:38 ` [PATCH v2 4/9] wifi: rtw88: Extend rf_base_addr and rf_sipi_addr " Bitterblue Smith
` (5 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:38 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
Currently this struct has the members required for chips with 2 RF
paths. Add more members to support chips with 4 RF paths, like the
RTL8814AU.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- No change.
---
drivers/net/wireless/realtek/rtw88/main.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 62cd4c526301..e40e62302984 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -1130,14 +1130,26 @@ struct rtw_rfe_def {
* For 2G there are cck rate and ofdm rate with different settings.
*/
struct rtw_pwr_track_tbl {
+ const u8 *pwrtrk_5gd_n[RTW_PWR_TRK_5G_NUM];
+ const u8 *pwrtrk_5gd_p[RTW_PWR_TRK_5G_NUM];
+ const u8 *pwrtrk_5gc_n[RTW_PWR_TRK_5G_NUM];
+ const u8 *pwrtrk_5gc_p[RTW_PWR_TRK_5G_NUM];
const u8 *pwrtrk_5gb_n[RTW_PWR_TRK_5G_NUM];
const u8 *pwrtrk_5gb_p[RTW_PWR_TRK_5G_NUM];
const u8 *pwrtrk_5ga_n[RTW_PWR_TRK_5G_NUM];
const u8 *pwrtrk_5ga_p[RTW_PWR_TRK_5G_NUM];
+ const u8 *pwrtrk_2gd_n;
+ const u8 *pwrtrk_2gd_p;
+ const u8 *pwrtrk_2gc_n;
+ const u8 *pwrtrk_2gc_p;
const u8 *pwrtrk_2gb_n;
const u8 *pwrtrk_2gb_p;
const u8 *pwrtrk_2ga_n;
const u8 *pwrtrk_2ga_p;
+ const u8 *pwrtrk_2g_cckd_n;
+ const u8 *pwrtrk_2g_cckd_p;
+ const u8 *pwrtrk_2g_cckc_n;
+ const u8 *pwrtrk_2g_cckc_p;
const u8 *pwrtrk_2g_cckb_n;
const u8 *pwrtrk_2g_cckb_p;
const u8 *pwrtrk_2g_ccka_n;
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 4/9] wifi: rtw88: Extend rf_base_addr and rf_sipi_addr for RTL8814AU
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
` (2 preceding siblings ...)
2025-02-04 18:38 ` [PATCH v2 3/9] wifi: rtw88: Extend struct rtw_pwr_track_tbl " Bitterblue Smith
@ 2025-02-04 18:38 ` Bitterblue Smith
2025-02-10 1:28 ` Ping-Ke Shih
2025-02-04 18:39 ` [PATCH v2 5/9] wifi: rtw88: Extend rtw_fw_send_ra_info() " Bitterblue Smith
` (4 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:38 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
These members of struct rtw_chip_info each have a size of 2. Increase
their size to 4, which is the number of RF paths the RTL8814AU has.
This is required to read and write the RF registers of the RTL8814AU.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- No change.
---
drivers/net/wireless/realtek/rtw88/main.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index e40e62302984..ba64d269521a 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -1239,8 +1239,8 @@ struct rtw_chip_info {
const struct rtw_hw_reg *dig;
const struct rtw_hw_reg *dig_cck;
- u32 rf_base_addr[2];
- u32 rf_sipi_addr[2];
+ u32 rf_base_addr[RTW_RF_PATH_MAX];
+ u32 rf_sipi_addr[RTW_RF_PATH_MAX];
const struct rtw_rf_sipi_addr *rf_sipi_read_addr;
u8 fix_rf_phy_num;
const struct rtw_ltecoex_addr *ltecoex_addr;
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 5/9] wifi: rtw88: Extend rtw_fw_send_ra_info() for RTL8814AU
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
` (3 preceding siblings ...)
2025-02-04 18:38 ` [PATCH v2 4/9] wifi: rtw88: Extend rf_base_addr and rf_sipi_addr " Bitterblue Smith
@ 2025-02-04 18:39 ` Bitterblue Smith
2025-02-10 1:33 ` Ping-Ke Shih
2025-02-04 18:40 ` [PATCH v2 6/9] wifi: rtw88: Constify some more structs and arrays Bitterblue Smith
` (3 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:39 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
The existing code is suitable for chips with up to 2 spatial streams.
Inform the firmware about the rates it's allowed to use when
transmitting 3 spatial streams.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- Add RTW_CHIP_TYPE_8814A enum.
- Check the chip type instead of the presence of RF path C.
- Reduce indentation.
---
drivers/net/wireless/realtek/rtw88/fw.c | 15 +++++++++++++++
drivers/net/wireless/realtek/rtw88/fw.h | 1 +
drivers/net/wireless/realtek/rtw88/main.h | 1 +
3 files changed, 17 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index 02389b7c6876..6b563ac489a7 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -735,6 +735,7 @@ void rtw_fw_send_ra_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
{
u8 h2c_pkt[H2C_PKT_SIZE] = {0};
bool disable_pt = true;
+ u32 mask_hi;
SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_RA_INFO);
@@ -755,6 +756,20 @@ void rtw_fw_send_ra_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
si->init_ra_lv = 0;
rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
+
+ if (rtwdev->chip->id != RTW_CHIP_TYPE_8814A)
+ return;
+
+ SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_RA_INFO_HI);
+
+ mask_hi = si->ra_mask >> 32;
+
+ SET_RA_INFO_RA_MASK0(h2c_pkt, (mask_hi & 0xff));
+ SET_RA_INFO_RA_MASK1(h2c_pkt, (mask_hi & 0xff00) >> 8);
+ SET_RA_INFO_RA_MASK2(h2c_pkt, (mask_hi & 0xff0000) >> 16);
+ SET_RA_INFO_RA_MASK3(h2c_pkt, (mask_hi & 0xff000000) >> 24);
+
+ rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
}
void rtw_fw_media_status_report(struct rtw_dev *rtwdev, u8 mac_id, bool connect)
diff --git a/drivers/net/wireless/realtek/rtw88/fw.h b/drivers/net/wireless/realtek/rtw88/fw.h
index 404de1b0c407..48ad9ceab6ea 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.h
+++ b/drivers/net/wireless/realtek/rtw88/fw.h
@@ -557,6 +557,7 @@ static inline void rtw_h2c_pkt_set_header(u8 *h2c_pkt, u8 sub_id)
#define H2C_CMD_DEFAULT_PORT 0x2c
#define H2C_CMD_RA_INFO 0x40
#define H2C_CMD_RSSI_MONITOR 0x42
+#define H2C_CMD_RA_INFO_HI 0x46
#define H2C_CMD_BCN_FILTER_OFFLOAD_P0 0x56
#define H2C_CMD_BCN_FILTER_OFFLOAD_P1 0x57
#define H2C_CMD_WL_PHY_INFO 0x58
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index ba64d269521a..993c381e734b 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -191,6 +191,7 @@ enum rtw_chip_type {
RTW_CHIP_TYPE_8703B,
RTW_CHIP_TYPE_8821A,
RTW_CHIP_TYPE_8812A,
+ RTW_CHIP_TYPE_8814A,
};
enum rtw_tx_queue_type {
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 6/9] wifi: rtw88: Constify some more structs and arrays
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
` (4 preceding siblings ...)
2025-02-04 18:39 ` [PATCH v2 5/9] wifi: rtw88: Extend rtw_fw_send_ra_info() " Bitterblue Smith
@ 2025-02-04 18:40 ` Bitterblue Smith
2025-02-10 1:35 ` Ping-Ke Shih
2025-02-04 18:40 ` [PATCH v2 7/9] wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM Bitterblue Smith
` (2 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:40 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
These structs and arrays are never modified, so make them const:
rtw_band_2ghz
rtw_band_5ghz
rtw_pci_tx_queue_idx_addr
rtw_pci_ops
rtw_cck_rates
rtw_ofdm_rates
rtw_ht_1s_rates
rtw_ht_2s_rates
rtw_vht_1s_rates
rtw_vht_2s_rates
rtw_rate_section
rtw_rate_size
rtw_sdio_ops
rtw_usb_ops
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- Patch is new in v2.
---
drivers/net/wireless/realtek/rtw88/main.c | 4 ++--
drivers/net/wireless/realtek/rtw88/main.h | 2 +-
drivers/net/wireless/realtek/rtw88/pci.c | 4 ++--
drivers/net/wireless/realtek/rtw88/phy.c | 26 ++++++++++++++---------
drivers/net/wireless/realtek/rtw88/phy.h | 16 +++++++-------
drivers/net/wireless/realtek/rtw88/sdio.c | 2 +-
drivers/net/wireless/realtek/rtw88/usb.c | 2 +-
7 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 0cee0fd8c0ef..8d22df293e78 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -136,7 +136,7 @@ u16 rtw_desc_to_bitrate(u8 desc_rate)
return rate.bitrate;
}
-static struct ieee80211_supported_band rtw_band_2ghz = {
+static const struct ieee80211_supported_band rtw_band_2ghz = {
.band = NL80211_BAND_2GHZ,
.channels = rtw_channeltable_2g,
@@ -149,7 +149,7 @@ static struct ieee80211_supported_band rtw_band_2ghz = {
.vht_cap = {0},
};
-static struct ieee80211_supported_band rtw_band_5ghz = {
+static const struct ieee80211_supported_band rtw_band_5ghz = {
.band = NL80211_BAND_5GHZ,
.channels = rtw_channeltable_5g,
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 993c381e734b..c982d9d3c5d7 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -61,7 +61,7 @@ enum rtw_hci_type {
};
struct rtw_hci {
- struct rtw_hci_ops *ops;
+ const struct rtw_hci_ops *ops;
enum rtw_hci_type type;
u32 rpwm_addr;
diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 0ecaefc4c83d..bb4c4ccb31d4 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -20,7 +20,7 @@ module_param_named(disable_aspm, rtw_pci_disable_aspm, bool, 0644);
MODULE_PARM_DESC(disable_msi, "Set Y to disable MSI interrupt support");
MODULE_PARM_DESC(disable_aspm, "Set Y to disable PCI ASPM support");
-static u32 rtw_pci_tx_queue_idx_addr[] = {
+static const u32 rtw_pci_tx_queue_idx_addr[] = {
[RTW_TX_QUEUE_BK] = RTK_PCI_TXBD_IDX_BKQ,
[RTW_TX_QUEUE_BE] = RTK_PCI_TXBD_IDX_BEQ,
[RTW_TX_QUEUE_VI] = RTK_PCI_TXBD_IDX_VIQ,
@@ -1591,7 +1591,7 @@ static void rtw_pci_destroy(struct rtw_dev *rtwdev, struct pci_dev *pdev)
rtw_pci_io_unmapping(rtwdev, pdev);
}
-static struct rtw_hci_ops rtw_pci_ops = {
+static const struct rtw_hci_ops rtw_pci_ops = {
.tx_write = rtw_pci_tx_write,
.tx_kick_off = rtw_pci_tx_kick_off,
.flush_queues = rtw_pci_flush_queues,
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index 8ed20c89d216..f6528016973d 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -52,44 +52,50 @@ static const u32 db_invert_table[12][8] = {
1995262315, 2511886432U, 3162277660U, 3981071706U}
};
-u8 rtw_cck_rates[] = { DESC_RATE1M, DESC_RATE2M, DESC_RATE5_5M, DESC_RATE11M };
-u8 rtw_ofdm_rates[] = {
+const u8 rtw_cck_rates[] = { DESC_RATE1M, DESC_RATE2M, DESC_RATE5_5M, DESC_RATE11M };
+
+const u8 rtw_ofdm_rates[] = {
DESC_RATE6M, DESC_RATE9M, DESC_RATE12M,
DESC_RATE18M, DESC_RATE24M, DESC_RATE36M,
DESC_RATE48M, DESC_RATE54M
};
-u8 rtw_ht_1s_rates[] = {
+
+const u8 rtw_ht_1s_rates[] = {
DESC_RATEMCS0, DESC_RATEMCS1, DESC_RATEMCS2,
DESC_RATEMCS3, DESC_RATEMCS4, DESC_RATEMCS5,
DESC_RATEMCS6, DESC_RATEMCS7
};
-u8 rtw_ht_2s_rates[] = {
+
+const u8 rtw_ht_2s_rates[] = {
DESC_RATEMCS8, DESC_RATEMCS9, DESC_RATEMCS10,
DESC_RATEMCS11, DESC_RATEMCS12, DESC_RATEMCS13,
DESC_RATEMCS14, DESC_RATEMCS15
};
-u8 rtw_vht_1s_rates[] = {
+
+const u8 rtw_vht_1s_rates[] = {
DESC_RATEVHT1SS_MCS0, DESC_RATEVHT1SS_MCS1,
DESC_RATEVHT1SS_MCS2, DESC_RATEVHT1SS_MCS3,
DESC_RATEVHT1SS_MCS4, DESC_RATEVHT1SS_MCS5,
DESC_RATEVHT1SS_MCS6, DESC_RATEVHT1SS_MCS7,
DESC_RATEVHT1SS_MCS8, DESC_RATEVHT1SS_MCS9
};
-u8 rtw_vht_2s_rates[] = {
+
+const u8 rtw_vht_2s_rates[] = {
DESC_RATEVHT2SS_MCS0, DESC_RATEVHT2SS_MCS1,
DESC_RATEVHT2SS_MCS2, DESC_RATEVHT2SS_MCS3,
DESC_RATEVHT2SS_MCS4, DESC_RATEVHT2SS_MCS5,
DESC_RATEVHT2SS_MCS6, DESC_RATEVHT2SS_MCS7,
DESC_RATEVHT2SS_MCS8, DESC_RATEVHT2SS_MCS9
};
-u8 *rtw_rate_section[RTW_RATE_SECTION_MAX] = {
+
+const u8 * const rtw_rate_section[RTW_RATE_SECTION_MAX] = {
rtw_cck_rates, rtw_ofdm_rates,
rtw_ht_1s_rates, rtw_ht_2s_rates,
rtw_vht_1s_rates, rtw_vht_2s_rates
};
EXPORT_SYMBOL(rtw_rate_section);
-u8 rtw_rate_size[RTW_RATE_SECTION_MAX] = {
+const u8 rtw_rate_size[RTW_RATE_SECTION_MAX] = {
ARRAY_SIZE(rtw_cck_rates),
ARRAY_SIZE(rtw_ofdm_rates),
ARRAY_SIZE(rtw_ht_1s_rates),
@@ -2214,7 +2220,7 @@ static void rtw_phy_set_tx_power_index_by_rs(struct rtw_dev *rtwdev,
{
struct rtw_hal *hal = &rtwdev->hal;
u8 regd = rtw_regd_get(rtwdev);
- u8 *rates;
+ const u8 *rates;
u8 size;
u8 rate;
u8 pwr_idx;
@@ -2274,7 +2280,7 @@ EXPORT_SYMBOL(rtw_phy_set_tx_power_level);
static void
rtw_phy_tx_power_by_rate_config_by_path(struct rtw_hal *hal, u8 path,
- u8 rs, u8 size, u8 *rates)
+ u8 rs, u8 size, const u8 *rates)
{
u8 rate;
u8 base_idx, rate_idx;
diff --git a/drivers/net/wireless/realtek/rtw88/phy.h b/drivers/net/wireless/realtek/rtw88/phy.h
index ccfcbd3ced03..ce6ee16a77dc 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.h
+++ b/drivers/net/wireless/realtek/rtw88/phy.h
@@ -7,14 +7,14 @@
#include "debug.h"
-extern u8 rtw_cck_rates[];
-extern u8 rtw_ofdm_rates[];
-extern u8 rtw_ht_1s_rates[];
-extern u8 rtw_ht_2s_rates[];
-extern u8 rtw_vht_1s_rates[];
-extern u8 rtw_vht_2s_rates[];
-extern u8 *rtw_rate_section[];
-extern u8 rtw_rate_size[];
+extern const u8 rtw_cck_rates[];
+extern const u8 rtw_ofdm_rates[];
+extern const u8 rtw_ht_1s_rates[];
+extern const u8 rtw_ht_2s_rates[];
+extern const u8 rtw_vht_1s_rates[];
+extern const u8 rtw_vht_2s_rates[];
+extern const u8 * const rtw_rate_section[];
+extern const u8 rtw_rate_size[];
void rtw_phy_init(struct rtw_dev *rtwdev);
void rtw_phy_dynamic_mechanism(struct rtw_dev *rtwdev);
diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
index e024061bdbf7..6209a49312f1 100644
--- a/drivers/net/wireless/realtek/rtw88/sdio.c
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c
@@ -1147,7 +1147,7 @@ static void rtw_sdio_declaim(struct rtw_dev *rtwdev,
sdio_release_host(sdio_func);
}
-static struct rtw_hci_ops rtw_sdio_ops = {
+static const struct rtw_hci_ops rtw_sdio_ops = {
.tx_write = rtw_sdio_tx_write,
.tx_kick_off = rtw_sdio_tx_kick_off,
.setup = rtw_sdio_setup,
diff --git a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
index c4908db4ff0e..c8092fa0d9f1 100644
--- a/drivers/net/wireless/realtek/rtw88/usb.c
+++ b/drivers/net/wireless/realtek/rtw88/usb.c
@@ -881,7 +881,7 @@ static void rtw_usb_dynamic_rx_agg(struct rtw_dev *rtwdev, bool enable)
}
}
-static struct rtw_hci_ops rtw_usb_ops = {
+static const struct rtw_hci_ops rtw_usb_ops = {
.tx_write = rtw_usb_tx_write,
.tx_kick_off = rtw_usb_tx_kick_off,
.setup = rtw_usb_setup,
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 7/9] wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
` (5 preceding siblings ...)
2025-02-04 18:40 ` [PATCH v2 6/9] wifi: rtw88: Constify some more structs and arrays Bitterblue Smith
@ 2025-02-04 18:40 ` Bitterblue Smith
2025-02-10 1:37 ` Ping-Ke Shih
2025-02-04 18:41 ` [PATCH v2 8/9] wifi: rtw88: Extend TX power stuff for 3-4 spatial streams Bitterblue Smith
2025-02-04 18:42 ` [PATCH v2 9/9] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU Bitterblue Smith
8 siblings, 1 reply; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:40 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
It fits the meaning of the enum better.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- Patch is new in v2.
---
drivers/net/wireless/realtek/rtw88/main.h | 12 +++++-----
drivers/net/wireless/realtek/rtw88/phy.c | 24 +++++++++----------
drivers/net/wireless/realtek/rtw88/rtw8821c.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw88xxa.c | 2 +-
drivers/net/wireless/realtek/rtw88/sar.c | 2 +-
7 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index c982d9d3c5d7..057141e196e6 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -168,7 +168,7 @@ enum rtw_rate_section {
RTW_RATE_SECTION_VHT_2S,
/* keep last */
- RTW_RATE_SECTION_MAX,
+ RTW_RATE_SECTION_NUM,
};
enum rtw_wireless_set {
@@ -1937,7 +1937,7 @@ union rtw_sar_cfg {
struct rtw_sar {
enum rtw_sar_sources src;
- union rtw_sar_cfg cfg[RTW_RF_PATH_MAX][RTW_RATE_SECTION_MAX];
+ union rtw_sar_cfg cfg[RTW_RF_PATH_MAX][RTW_RATE_SECTION_NUM];
};
struct rtw_hal {
@@ -1981,16 +1981,16 @@ struct rtw_hal {
s8 tx_pwr_by_rate_offset_5g[RTW_RF_PATH_MAX]
[DESC_RATE_MAX];
s8 tx_pwr_by_rate_base_2g[RTW_RF_PATH_MAX]
- [RTW_RATE_SECTION_MAX];
+ [RTW_RATE_SECTION_NUM];
s8 tx_pwr_by_rate_base_5g[RTW_RF_PATH_MAX]
- [RTW_RATE_SECTION_MAX];
+ [RTW_RATE_SECTION_NUM];
s8 tx_pwr_limit_2g[RTW_REGD_MAX]
[RTW_CHANNEL_WIDTH_MAX]
- [RTW_RATE_SECTION_MAX]
+ [RTW_RATE_SECTION_NUM]
[RTW_MAX_CHANNEL_NUM_2G];
s8 tx_pwr_limit_5g[RTW_REGD_MAX]
[RTW_CHANNEL_WIDTH_MAX]
- [RTW_RATE_SECTION_MAX]
+ [RTW_RATE_SECTION_NUM]
[RTW_MAX_CHANNEL_NUM_5G];
s8 tx_pwr_tbl[RTW_RF_PATH_MAX]
[DESC_RATE_MAX];
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index f6528016973d..e3a5f8e1e30a 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -88,14 +88,14 @@ const u8 rtw_vht_2s_rates[] = {
DESC_RATEVHT2SS_MCS8, DESC_RATEVHT2SS_MCS9
};
-const u8 * const rtw_rate_section[RTW_RATE_SECTION_MAX] = {
+const u8 * const rtw_rate_section[RTW_RATE_SECTION_NUM] = {
rtw_cck_rates, rtw_ofdm_rates,
rtw_ht_1s_rates, rtw_ht_2s_rates,
rtw_vht_1s_rates, rtw_vht_2s_rates
};
EXPORT_SYMBOL(rtw_rate_section);
-const u8 rtw_rate_size[RTW_RATE_SECTION_MAX] = {
+const u8 rtw_rate_size[RTW_RATE_SECTION_NUM] = {
ARRAY_SIZE(rtw_cck_rates),
ARRAY_SIZE(rtw_ofdm_rates),
ARRAY_SIZE(rtw_ht_1s_rates),
@@ -1596,7 +1596,7 @@ static void rtw_phy_set_tx_power_limit(struct rtw_dev *rtwdev, u8 regd, u8 band,
ch_idx = rtw_channel_to_idx(band, ch);
if (regd >= RTW_REGD_MAX || bw >= RTW_CHANNEL_WIDTH_MAX ||
- rs >= RTW_RATE_SECTION_MAX || ch_idx < 0) {
+ rs >= RTW_RATE_SECTION_NUM || ch_idx < 0) {
WARN(1,
"wrong txpwr_lmt regd=%u, band=%u bw=%u, rs=%u, ch_idx=%u, pwr_limit=%d\n",
regd, band, bw, rs, ch_idx, pwr_limit);
@@ -1701,7 +1701,7 @@ rtw_cfg_txpwr_lmt_by_alt(struct rtw_dev *rtwdev, u8 regd, u8 regd_alt)
u8 bw, rs;
for (bw = 0; bw < RTW_CHANNEL_WIDTH_MAX; bw++)
- for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++)
+ for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++)
__cfg_txpwr_lmt_by_alt(&rtwdev->hal, regd, regd_alt,
bw, rs);
}
@@ -2060,7 +2060,7 @@ static u8 rtw_phy_get_5g_tx_power_index(struct rtw_dev *rtwdev,
return tx_power;
}
-/* return RTW_RATE_SECTION_MAX to indicate rate is invalid */
+/* return RTW_RATE_SECTION_NUM to indicate rate is invalid */
static u8 rtw_phy_rate_to_rate_section(u8 rate)
{
if (rate >= DESC_RATE1M && rate <= DESC_RATE11M)
@@ -2076,7 +2076,7 @@ static u8 rtw_phy_rate_to_rate_section(u8 rate)
else if (rate >= DESC_RATEVHT2SS_MCS0 && rate <= DESC_RATEVHT2SS_MCS9)
return RTW_RATE_SECTION_VHT_2S;
else
- return RTW_RATE_SECTION_MAX;
+ return RTW_RATE_SECTION_NUM;
}
static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
@@ -2094,7 +2094,7 @@ static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
if (regd > RTW_REGD_WW)
return power_limit;
- if (rs == RTW_RATE_SECTION_MAX)
+ if (rs == RTW_RATE_SECTION_NUM)
goto err;
/* only 20M BW with cck and ofdm */
@@ -2138,7 +2138,7 @@ static s8 rtw_phy_get_tx_power_sar(struct rtw_dev *rtwdev, u8 sar_band,
.rs = rs,
};
- if (rs == RTW_RATE_SECTION_MAX)
+ if (rs == RTW_RATE_SECTION_NUM)
goto err;
return rtw_query_sar(rtwdev, &arg);
@@ -2227,7 +2227,7 @@ static void rtw_phy_set_tx_power_index_by_rs(struct rtw_dev *rtwdev,
u8 bw;
int i;
- if (rs >= RTW_RATE_SECTION_MAX)
+ if (rs >= RTW_RATE_SECTION_NUM)
return;
rates = rtw_rate_section[rs];
@@ -2258,7 +2258,7 @@ static void rtw_phy_set_tx_power_level_by_path(struct rtw_dev *rtwdev,
else
rs = RTW_RATE_SECTION_OFDM;
- for (; rs < RTW_RATE_SECTION_MAX; rs++)
+ for (; rs < RTW_RATE_SECTION_NUM; rs++)
rtw_phy_set_tx_power_index_by_rs(rtwdev, ch, path, rs);
}
@@ -2353,7 +2353,7 @@ void rtw_phy_tx_power_limit_config(struct rtw_hal *hal)
for (regd = 0; regd < RTW_REGD_MAX; regd++)
for (bw = 0; bw < RTW_CHANNEL_WIDTH_MAX; bw++)
- for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++)
+ for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++)
__rtw_phy_tx_power_limit_config(hal, regd, bw, rs);
}
@@ -2389,7 +2389,7 @@ void rtw_phy_init_tx_power(struct rtw_dev *rtwdev)
/* init tx power limit */
for (regd = 0; regd < RTW_REGD_MAX; regd++)
for (bw = 0; bw < RTW_CHANNEL_WIDTH_MAX; bw++)
- for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++)
+ for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++)
rtw_phy_init_tx_power_limit(rtwdev, regd, bw,
rs);
}
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index cc152248407c..6abb21067aed 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -709,7 +709,7 @@ static void rtw8821c_set_tx_power_index(struct rtw_dev *rtwdev)
int rs, path;
for (path = 0; path < hal->rf_path_num; path++) {
- for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) {
+ for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++) {
if (rs == RTW_RATE_SECTION_HT_2S ||
rs == RTW_RATE_SECTION_VHT_2S)
continue;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
index 23a29019752d..742a2a05632e 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
@@ -964,7 +964,7 @@ static void rtw8822b_set_tx_power_index(struct rtw_dev *rtwdev)
int rs, path;
for (path = 0; path < hal->rf_path_num; path++) {
- for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++)
+ for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++)
rtw8822b_set_tx_power_index_by_rate(rtwdev, path, rs,
&phy_pwr_idx);
}
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index ec362a817f5f..2314d160292a 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -2746,7 +2746,7 @@ static void rtw8822c_set_tx_power_index(struct rtw_dev *rtwdev)
s8 diff_idx[4];
rtw8822c_set_write_tx_power_ref(rtwdev, pwr_ref_cck, pwr_ref_ofdm);
- for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) {
+ for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++) {
for (j = 0; j < rtw_rate_size[rs]; j++) {
rate = rtw_rate_section[rs][j];
pwr_a = hal->tx_pwr_tbl[RF_PATH_A][rate];
diff --git a/drivers/net/wireless/realtek/rtw88/rtw88xxa.c b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
index 71e61b9c0bec..109ff42eda82 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
@@ -1637,7 +1637,7 @@ void rtw88xxa_set_tx_power_index(struct rtw_dev *rtwdev)
int rs, path;
for (path = 0; path < hal->rf_path_num; path++) {
- for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) {
+ for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++) {
if (hal->rf_path_num == 1 &&
(rs == RTW_RATE_SECTION_HT_2S ||
rs == RTW_RATE_SECTION_VHT_2S))
diff --git a/drivers/net/wireless/realtek/rtw88/sar.c b/drivers/net/wireless/realtek/rtw88/sar.c
index c472f1502b82..50b9c2412bb1 100644
--- a/drivers/net/wireless/realtek/rtw88/sar.c
+++ b/drivers/net/wireless/realtek/rtw88/sar.c
@@ -97,7 +97,7 @@ int rtw_set_sar_specs(struct rtw_dev *rtwdev,
power, BIT(RTW_COMMON_SAR_FCT));
for (j = 0; j < RTW_RF_PATH_MAX; j++) {
- for (k = 0; k < RTW_RATE_SECTION_MAX; k++) {
+ for (k = 0; k < RTW_RATE_SECTION_NUM; k++) {
arg = (struct rtw_sar_arg){
.sar_band = idx,
.path = j,
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 8/9] wifi: rtw88: Extend TX power stuff for 3-4 spatial streams
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
` (6 preceding siblings ...)
2025-02-04 18:40 ` [PATCH v2 7/9] wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM Bitterblue Smith
@ 2025-02-04 18:41 ` Bitterblue Smith
2025-02-10 1:50 ` Ping-Ke Shih
2025-02-04 18:42 ` [PATCH v2 9/9] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU Bitterblue Smith
8 siblings, 1 reply; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:41 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
Although the RTL8814AU only has 3 spatial streams, maybe some other chip
has 4.
Correct the TX power index and TX power limit calculations for 3SS and
4SS HT/VHT rates.
With this the RTL8814AU can set the TX power correctly.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- Constify the new arrays rtw_ht_3s_rates, rtw_ht_4s_rates,
rtw_vht_3s_rates, rtw_vht_4s_rates.
- Make rs_cmp static const.
- Introduce __RTW_RATE_SECTION_2SS_MAX instead of using
RTW_RATE_SECTION_HT_3S in for loops.
---
drivers/net/wireless/realtek/rtw88/main.h | 5 +
drivers/net/wireless/realtek/rtw88/phy.c | 145 ++++++++++++------
drivers/net/wireless/realtek/rtw88/phy.h | 4 +
drivers/net/wireless/realtek/rtw88/rtw8821c.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw88xxa.c | 2 +-
7 files changed, 111 insertions(+), 51 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 057141e196e6..24ac749271cc 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -166,6 +166,11 @@ enum rtw_rate_section {
RTW_RATE_SECTION_HT_2S,
RTW_RATE_SECTION_VHT_1S,
RTW_RATE_SECTION_VHT_2S,
+ __RTW_RATE_SECTION_2SS_MAX = RTW_RATE_SECTION_VHT_2S,
+ RTW_RATE_SECTION_HT_3S,
+ RTW_RATE_SECTION_HT_4S,
+ RTW_RATE_SECTION_VHT_3S,
+ RTW_RATE_SECTION_VHT_4S,
/* keep last */
RTW_RATE_SECTION_NUM,
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index e3a5f8e1e30a..b487457d2215 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -88,10 +88,40 @@ const u8 rtw_vht_2s_rates[] = {
DESC_RATEVHT2SS_MCS8, DESC_RATEVHT2SS_MCS9
};
+const u8 rtw_ht_3s_rates[] = {
+ DESC_RATEMCS16, DESC_RATEMCS17, DESC_RATEMCS18,
+ DESC_RATEMCS19, DESC_RATEMCS20, DESC_RATEMCS21,
+ DESC_RATEMCS22, DESC_RATEMCS23
+};
+
+const u8 rtw_ht_4s_rates[] = {
+ DESC_RATEMCS24, DESC_RATEMCS25, DESC_RATEMCS26,
+ DESC_RATEMCS27, DESC_RATEMCS28, DESC_RATEMCS29,
+ DESC_RATEMCS30, DESC_RATEMCS31
+};
+
+const u8 rtw_vht_3s_rates[] = {
+ DESC_RATEVHT3SS_MCS0, DESC_RATEVHT3SS_MCS1,
+ DESC_RATEVHT3SS_MCS2, DESC_RATEVHT3SS_MCS3,
+ DESC_RATEVHT3SS_MCS4, DESC_RATEVHT3SS_MCS5,
+ DESC_RATEVHT3SS_MCS6, DESC_RATEVHT3SS_MCS7,
+ DESC_RATEVHT3SS_MCS8, DESC_RATEVHT3SS_MCS9
+};
+
+const u8 rtw_vht_4s_rates[] = {
+ DESC_RATEVHT4SS_MCS0, DESC_RATEVHT4SS_MCS1,
+ DESC_RATEVHT4SS_MCS2, DESC_RATEVHT4SS_MCS3,
+ DESC_RATEVHT4SS_MCS4, DESC_RATEVHT4SS_MCS5,
+ DESC_RATEVHT4SS_MCS6, DESC_RATEVHT4SS_MCS7,
+ DESC_RATEVHT4SS_MCS8, DESC_RATEVHT4SS_MCS9
+};
+
const u8 * const rtw_rate_section[RTW_RATE_SECTION_NUM] = {
rtw_cck_rates, rtw_ofdm_rates,
rtw_ht_1s_rates, rtw_ht_2s_rates,
- rtw_vht_1s_rates, rtw_vht_2s_rates
+ rtw_vht_1s_rates, rtw_vht_2s_rates,
+ rtw_ht_3s_rates, rtw_ht_4s_rates,
+ rtw_vht_3s_rates, rtw_vht_4s_rates
};
EXPORT_SYMBOL(rtw_rate_section);
@@ -101,17 +131,14 @@ const u8 rtw_rate_size[RTW_RATE_SECTION_NUM] = {
ARRAY_SIZE(rtw_ht_1s_rates),
ARRAY_SIZE(rtw_ht_2s_rates),
ARRAY_SIZE(rtw_vht_1s_rates),
- ARRAY_SIZE(rtw_vht_2s_rates)
+ ARRAY_SIZE(rtw_vht_2s_rates),
+ ARRAY_SIZE(rtw_ht_3s_rates),
+ ARRAY_SIZE(rtw_ht_4s_rates),
+ ARRAY_SIZE(rtw_vht_3s_rates),
+ ARRAY_SIZE(rtw_vht_4s_rates)
};
EXPORT_SYMBOL(rtw_rate_size);
-static const u8 rtw_cck_size = ARRAY_SIZE(rtw_cck_rates);
-static const u8 rtw_ofdm_size = ARRAY_SIZE(rtw_ofdm_rates);
-static const u8 rtw_ht_1s_size = ARRAY_SIZE(rtw_ht_1s_rates);
-static const u8 rtw_ht_2s_size = ARRAY_SIZE(rtw_ht_2s_rates);
-static const u8 rtw_vht_1s_size = ARRAY_SIZE(rtw_vht_1s_rates);
-static const u8 rtw_vht_2s_size = ARRAY_SIZE(rtw_vht_2s_rates);
-
enum rtw_phy_band_type {
PHY_BAND_2G = 0,
PHY_BAND_5G = 1,
@@ -1640,11 +1667,15 @@ rtw_xref_5g_txpwr_lmt(struct rtw_dev *rtwdev, u8 regd,
static void
rtw_xref_txpwr_lmt_by_rs(struct rtw_dev *rtwdev, u8 regd, u8 bw, u8 ch_idx)
{
+ static const u8 rs_cmp[4][2] = {
+ {RTW_RATE_SECTION_HT_1S, RTW_RATE_SECTION_VHT_1S},
+ {RTW_RATE_SECTION_HT_2S, RTW_RATE_SECTION_VHT_2S},
+ {RTW_RATE_SECTION_HT_3S, RTW_RATE_SECTION_VHT_3S},
+ {RTW_RATE_SECTION_HT_4S, RTW_RATE_SECTION_VHT_4S}
+ };
u8 rs_idx, rs_ht, rs_vht;
- u8 rs_cmp[2][2] = {{RTW_RATE_SECTION_HT_1S, RTW_RATE_SECTION_VHT_1S},
- {RTW_RATE_SECTION_HT_2S, RTW_RATE_SECTION_VHT_2S} };
- for (rs_idx = 0; rs_idx < 2; rs_idx++) {
+ for (rs_idx = 0; rs_idx < 4; rs_idx++) {
rs_ht = rs_cmp[rs_idx][0];
rs_vht = rs_cmp[rs_idx][1];
@@ -1965,10 +1996,10 @@ static u8 rtw_phy_get_2g_tx_power_index(struct rtw_dev *rtwdev,
u8 rate, u8 group)
{
const struct rtw_chip_info *chip = rtwdev->chip;
- u8 tx_power;
- bool mcs_rate;
- bool above_2ss;
+ bool above_2ss, above_3ss, above_4ss;
u8 factor = chip->txgi_factor;
+ bool mcs_rate;
+ u8 tx_power;
if (rate <= DESC_RATE11M)
tx_power = pwr_idx_2g->cck_base[group];
@@ -1978,11 +2009,15 @@ static u8 rtw_phy_get_2g_tx_power_index(struct rtw_dev *rtwdev,
if (rate >= DESC_RATE6M && rate <= DESC_RATE54M)
tx_power += pwr_idx_2g->ht_1s_diff.ofdm * factor;
- mcs_rate = (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS15) ||
+ mcs_rate = (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS31) ||
(rate >= DESC_RATEVHT1SS_MCS0 &&
- rate <= DESC_RATEVHT2SS_MCS9);
- above_2ss = (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS15) ||
+ rate <= DESC_RATEVHT4SS_MCS9);
+ above_2ss = (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS31) ||
(rate >= DESC_RATEVHT2SS_MCS0);
+ above_3ss = (rate >= DESC_RATEMCS16 && rate <= DESC_RATEMCS31) ||
+ (rate >= DESC_RATEVHT3SS_MCS0);
+ above_4ss = (rate >= DESC_RATEMCS24 && rate <= DESC_RATEMCS31) ||
+ (rate >= DESC_RATEVHT4SS_MCS0);
if (!mcs_rate)
return tx_power;
@@ -1995,11 +2030,19 @@ static u8 rtw_phy_get_2g_tx_power_index(struct rtw_dev *rtwdev,
tx_power += pwr_idx_2g->ht_1s_diff.bw20 * factor;
if (above_2ss)
tx_power += pwr_idx_2g->ht_2s_diff.bw20 * factor;
+ if (above_3ss)
+ tx_power += pwr_idx_2g->ht_3s_diff.bw20 * factor;
+ if (above_4ss)
+ tx_power += pwr_idx_2g->ht_4s_diff.bw20 * factor;
break;
case RTW_CHANNEL_WIDTH_40:
/* bw40 is the base power */
if (above_2ss)
tx_power += pwr_idx_2g->ht_2s_diff.bw40 * factor;
+ if (above_3ss)
+ tx_power += pwr_idx_2g->ht_3s_diff.bw40 * factor;
+ if (above_4ss)
+ tx_power += pwr_idx_2g->ht_4s_diff.bw40 * factor;
break;
}
@@ -2012,19 +2055,23 @@ static u8 rtw_phy_get_5g_tx_power_index(struct rtw_dev *rtwdev,
u8 rate, u8 group)
{
const struct rtw_chip_info *chip = rtwdev->chip;
- u8 tx_power;
+ bool above_2ss, above_3ss, above_4ss;
+ u8 factor = chip->txgi_factor;
u8 upper, lower;
bool mcs_rate;
- bool above_2ss;
- u8 factor = chip->txgi_factor;
+ u8 tx_power;
tx_power = pwr_idx_5g->bw40_base[group];
- mcs_rate = (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS15) ||
+ mcs_rate = (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS31) ||
(rate >= DESC_RATEVHT1SS_MCS0 &&
- rate <= DESC_RATEVHT2SS_MCS9);
- above_2ss = (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS15) ||
+ rate <= DESC_RATEVHT4SS_MCS9);
+ above_2ss = (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS31) ||
(rate >= DESC_RATEVHT2SS_MCS0);
+ above_3ss = (rate >= DESC_RATEMCS16 && rate <= DESC_RATEMCS31) ||
+ (rate >= DESC_RATEVHT3SS_MCS0);
+ above_4ss = (rate >= DESC_RATEMCS24 && rate <= DESC_RATEMCS31) ||
+ (rate >= DESC_RATEVHT4SS_MCS0);
if (!mcs_rate) {
tx_power += pwr_idx_5g->ht_1s_diff.ofdm * factor;
@@ -2039,11 +2086,19 @@ static u8 rtw_phy_get_5g_tx_power_index(struct rtw_dev *rtwdev,
tx_power += pwr_idx_5g->ht_1s_diff.bw20 * factor;
if (above_2ss)
tx_power += pwr_idx_5g->ht_2s_diff.bw20 * factor;
+ if (above_3ss)
+ tx_power += pwr_idx_5g->ht_3s_diff.bw20 * factor;
+ if (above_4ss)
+ tx_power += pwr_idx_5g->ht_4s_diff.bw20 * factor;
break;
case RTW_CHANNEL_WIDTH_40:
/* bw40 is the base power */
if (above_2ss)
tx_power += pwr_idx_5g->ht_2s_diff.bw40 * factor;
+ if (above_3ss)
+ tx_power += pwr_idx_5g->ht_3s_diff.bw40 * factor;
+ if (above_4ss)
+ tx_power += pwr_idx_5g->ht_4s_diff.bw40 * factor;
break;
case RTW_CHANNEL_WIDTH_80:
/* the base idx of bw80 is the average of bw40+/bw40- */
@@ -2054,6 +2109,10 @@ static u8 rtw_phy_get_5g_tx_power_index(struct rtw_dev *rtwdev,
tx_power += pwr_idx_5g->vht_1s_diff.bw80 * factor;
if (above_2ss)
tx_power += pwr_idx_5g->vht_2s_diff.bw80 * factor;
+ if (above_3ss)
+ tx_power += pwr_idx_5g->vht_3s_diff.bw80 * factor;
+ if (above_4ss)
+ tx_power += pwr_idx_5g->vht_4s_diff.bw80 * factor;
break;
}
@@ -2071,10 +2130,18 @@ static u8 rtw_phy_rate_to_rate_section(u8 rate)
return RTW_RATE_SECTION_HT_1S;
else if (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS15)
return RTW_RATE_SECTION_HT_2S;
+ else if (rate >= DESC_RATEMCS16 && rate <= DESC_RATEMCS23)
+ return RTW_RATE_SECTION_HT_3S;
+ else if (rate >= DESC_RATEMCS24 && rate <= DESC_RATEMCS31)
+ return RTW_RATE_SECTION_HT_4S;
else if (rate >= DESC_RATEVHT1SS_MCS0 && rate <= DESC_RATEVHT1SS_MCS9)
return RTW_RATE_SECTION_VHT_1S;
else if (rate >= DESC_RATEVHT2SS_MCS0 && rate <= DESC_RATEVHT2SS_MCS9)
return RTW_RATE_SECTION_VHT_2S;
+ else if (rate >= DESC_RATEVHT3SS_MCS0 && rate <= DESC_RATEVHT3SS_MCS9)
+ return RTW_RATE_SECTION_VHT_3S;
+ else if (rate >= DESC_RATEVHT4SS_MCS0 && rate <= DESC_RATEVHT4SS_MCS9)
+ return RTW_RATE_SECTION_VHT_4S;
else
return RTW_RATE_SECTION_NUM;
}
@@ -2102,7 +2169,7 @@ static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
bw = RTW_CHANNEL_WIDTH_20;
/* only 20/40M BW with ht */
- if (rs == RTW_RATE_SECTION_HT_1S || rs == RTW_RATE_SECTION_HT_2S)
+ if (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS31)
bw = min_t(u8, bw, RTW_CHANNEL_WIDTH_40);
/* select min power limit among [20M BW ~ current BW] */
@@ -2286,7 +2353,7 @@ rtw_phy_tx_power_by_rate_config_by_path(struct rtw_hal *hal, u8 path,
u8 base_idx, rate_idx;
s8 base_2g, base_5g;
- if (rs >= RTW_RATE_SECTION_VHT_1S)
+ if (size == 10) /* VHT rates */
base_idx = rates[size - 3];
else
base_idx = rates[size - 1];
@@ -2303,28 +2370,12 @@ rtw_phy_tx_power_by_rate_config_by_path(struct rtw_hal *hal, u8 path,
void rtw_phy_tx_power_by_rate_config(struct rtw_hal *hal)
{
- u8 path;
+ u8 path, rs;
- for (path = 0; path < RTW_RF_PATH_MAX; path++) {
- rtw_phy_tx_power_by_rate_config_by_path(hal, path,
- RTW_RATE_SECTION_CCK,
- rtw_cck_size, rtw_cck_rates);
- rtw_phy_tx_power_by_rate_config_by_path(hal, path,
- RTW_RATE_SECTION_OFDM,
- rtw_ofdm_size, rtw_ofdm_rates);
- rtw_phy_tx_power_by_rate_config_by_path(hal, path,
- RTW_RATE_SECTION_HT_1S,
- rtw_ht_1s_size, rtw_ht_1s_rates);
- rtw_phy_tx_power_by_rate_config_by_path(hal, path,
- RTW_RATE_SECTION_HT_2S,
- rtw_ht_2s_size, rtw_ht_2s_rates);
- rtw_phy_tx_power_by_rate_config_by_path(hal, path,
- RTW_RATE_SECTION_VHT_1S,
- rtw_vht_1s_size, rtw_vht_1s_rates);
- rtw_phy_tx_power_by_rate_config_by_path(hal, path,
- RTW_RATE_SECTION_VHT_2S,
- rtw_vht_2s_size, rtw_vht_2s_rates);
- }
+ for (path = 0; path < RTW_RF_PATH_MAX; path++)
+ for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++)
+ rtw_phy_tx_power_by_rate_config_by_path(hal, path, rs,
+ rtw_rate_size[rs], rtw_rate_section[rs]);
}
static void
diff --git a/drivers/net/wireless/realtek/rtw88/phy.h b/drivers/net/wireless/realtek/rtw88/phy.h
index ce6ee16a77dc..c9e6b869661d 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.h
+++ b/drivers/net/wireless/realtek/rtw88/phy.h
@@ -13,6 +13,10 @@ extern const u8 rtw_ht_1s_rates[];
extern const u8 rtw_ht_2s_rates[];
extern const u8 rtw_vht_1s_rates[];
extern const u8 rtw_vht_2s_rates[];
+extern const u8 rtw_ht_3s_rates[];
+extern const u8 rtw_ht_4s_rates[];
+extern const u8 rtw_vht_3s_rates[];
+extern const u8 rtw_vht_4s_rates[];
extern const u8 * const rtw_rate_section[];
extern const u8 rtw_rate_size[];
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index 6abb21067aed..0ade7f11cbd2 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -709,7 +709,7 @@ static void rtw8821c_set_tx_power_index(struct rtw_dev *rtwdev)
int rs, path;
for (path = 0; path < hal->rf_path_num; path++) {
- for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++) {
+ for (rs = 0; rs <= __RTW_RATE_SECTION_2SS_MAX; rs++) {
if (rs == RTW_RATE_SECTION_HT_2S ||
rs == RTW_RATE_SECTION_VHT_2S)
continue;
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
index 742a2a05632e..b4934da88e33 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
@@ -964,7 +964,7 @@ static void rtw8822b_set_tx_power_index(struct rtw_dev *rtwdev)
int rs, path;
for (path = 0; path < hal->rf_path_num; path++) {
- for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++)
+ for (rs = 0; rs <= __RTW_RATE_SECTION_2SS_MAX; rs++)
rtw8822b_set_tx_power_index_by_rate(rtwdev, path, rs,
&phy_pwr_idx);
}
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 2314d160292a..5e53e0db177e 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -2746,7 +2746,7 @@ static void rtw8822c_set_tx_power_index(struct rtw_dev *rtwdev)
s8 diff_idx[4];
rtw8822c_set_write_tx_power_ref(rtwdev, pwr_ref_cck, pwr_ref_ofdm);
- for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++) {
+ for (rs = 0; rs <= __RTW_RATE_SECTION_2SS_MAX; rs++) {
for (j = 0; j < rtw_rate_size[rs]; j++) {
rate = rtw_rate_section[rs][j];
pwr_a = hal->tx_pwr_tbl[RF_PATH_A][rate];
diff --git a/drivers/net/wireless/realtek/rtw88/rtw88xxa.c b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
index 109ff42eda82..0fa943271fb6 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c
@@ -1637,7 +1637,7 @@ void rtw88xxa_set_tx_power_index(struct rtw_dev *rtwdev)
int rs, path;
for (path = 0; path < hal->rf_path_num; path++) {
- for (rs = 0; rs < RTW_RATE_SECTION_NUM; rs++) {
+ for (rs = 0; rs <= __RTW_RATE_SECTION_2SS_MAX; rs++) {
if (hal->rf_path_num == 1 &&
(rs == RTW_RATE_SECTION_HT_2S ||
rs == RTW_RATE_SECTION_VHT_2S))
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 9/9] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
` (7 preceding siblings ...)
2025-02-04 18:41 ` [PATCH v2 8/9] wifi: rtw88: Extend TX power stuff for 3-4 spatial streams Bitterblue Smith
@ 2025-02-04 18:42 ` Bitterblue Smith
2025-02-10 1:50 ` Ping-Ke Shih
8 siblings, 1 reply; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-04 18:42 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
This function tells the firmware what rates it can use.
Put the 3SS and 4SS HT rates supported by the other station into the
rate mask.
Remove the 3SS and 4SS rates from the rate mask if the hardware only has
2 spatial streams.
And finally, select the right rate ID (a parameter for the firmware)
when the hardware has 3 spatial streams.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
v2:
- No change.
---
drivers/net/wireless/realtek/rtw88/main.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 8d22df293e78..e4f9b744f24d 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1234,7 +1234,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)
ldpc_en = VHT_LDPC_EN;
} else if (sta->deflink.ht_cap.ht_supported) {
- ra_mask |= (sta->deflink.ht_cap.mcs.rx_mask[1] << 20) |
+ ra_mask |= ((u64)sta->deflink.ht_cap.mcs.rx_mask[3] << 36) |
+ ((u64)sta->deflink.ht_cap.mcs.rx_mask[2] << 28) |
+ (sta->deflink.ht_cap.mcs.rx_mask[1] << 20) |
(sta->deflink.ht_cap.mcs.rx_mask[0] << 12);
if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
stbc_en = HT_STBC_EN;
@@ -1244,6 +1246,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
if (efuse->hw_cap.nss == 1 || rtwdev->hal.txrx_1ss)
ra_mask &= RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
+ else if (efuse->hw_cap.nss == 2)
+ ra_mask &= RA_MASK_VHT_RATES_2SS | RA_MASK_HT_RATES_2SS |
+ RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
if (hal->current_band_type == RTW_BAND_5G) {
ra_mask |= (u64)sta->deflink.supp_rates[NL80211_BAND_5GHZ] << 4;
@@ -1302,10 +1307,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
break;
}
- if (sta->deflink.vht_cap.vht_supported && ra_mask & 0xffc00000)
- tx_num = 2;
- else if (sta->deflink.ht_cap.ht_supported && ra_mask & 0xfff00000)
- tx_num = 2;
+ if (sta->deflink.vht_cap.vht_supported ||
+ sta->deflink.ht_cap.ht_supported)
+ tx_num = efuse->hw_cap.nss;
rate_id = get_rate_id(wireless_set, bw_mode, tx_num);
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* RE: [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU
2025-02-04 18:36 ` [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU Bitterblue Smith
@ 2025-02-10 1:23 ` Ping-Ke Shih
2025-02-10 13:30 ` Bitterblue Smith
2025-02-10 3:44 ` Ping-Ke Shih
1 sibling, 1 reply; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:23 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> Don't call ltecoex_read_reg() and ltecoex_reg_write() when the
> ltecoex_addr member of struct rtw_chip_info is NULL. The RTL8814AU
> doesn't have this feature.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> ---
> v2:
> - No change.
Next time please take my Acked-by in v1. That will help me to save time in v2.
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 2/9] wifi: rtw88: Fix download_firmware_validate() for RTL8814AU
2025-02-04 18:37 ` [PATCH v2 2/9] wifi: rtw88: Fix download_firmware_validate() " Bitterblue Smith
@ 2025-02-10 1:24 ` Ping-Ke Shih
0 siblings, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:24 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> After the firmware is uploaded, download_firmware_validate() checks some
> bits in REG_MCUFW_CTRL to see if everything went okay. The
> RTL8814AU power on sequence sets bits 13 and 12 to 2, which this
> function does not expect, so it thinks the firmware upload failed.
>
> Make download_firmware_validate() ignore bits 13 and 12.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 3/9] wifi: rtw88: Extend struct rtw_pwr_track_tbl for RTL8814AU
2025-02-04 18:38 ` [PATCH v2 3/9] wifi: rtw88: Extend struct rtw_pwr_track_tbl " Bitterblue Smith
@ 2025-02-10 1:25 ` Ping-Ke Shih
0 siblings, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:25 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> Currently this struct has the members required for chips with 2 RF
> paths. Add more members to support chips with 4 RF paths, like the
> RTL8814AU.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 4/9] wifi: rtw88: Extend rf_base_addr and rf_sipi_addr for RTL8814AU
2025-02-04 18:38 ` [PATCH v2 4/9] wifi: rtw88: Extend rf_base_addr and rf_sipi_addr " Bitterblue Smith
@ 2025-02-10 1:28 ` Ping-Ke Shih
0 siblings, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:28 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> These members of struct rtw_chip_info each have a size of 2. Increase
> their size to 4, which is the number of RF paths the RTL8814AU has.
>
> This is required to read and write the RF registers of the RTL8814AU.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 5/9] wifi: rtw88: Extend rtw_fw_send_ra_info() for RTL8814AU
2025-02-04 18:39 ` [PATCH v2 5/9] wifi: rtw88: Extend rtw_fw_send_ra_info() " Bitterblue Smith
@ 2025-02-10 1:33 ` Ping-Ke Shih
0 siblings, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:33 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> The existing code is suitable for chips with up to 2 spatial streams.
> Inform the firmware about the rates it's allowed to use when
> transmitting 3 spatial streams.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 6/9] wifi: rtw88: Constify some more structs and arrays
2025-02-04 18:40 ` [PATCH v2 6/9] wifi: rtw88: Constify some more structs and arrays Bitterblue Smith
@ 2025-02-10 1:35 ` Ping-Ke Shih
0 siblings, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:35 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> These structs and arrays are never modified, so make them const:
>
> rtw_band_2ghz
> rtw_band_5ghz
> rtw_pci_tx_queue_idx_addr
> rtw_pci_ops
> rtw_cck_rates
> rtw_ofdm_rates
> rtw_ht_1s_rates
> rtw_ht_2s_rates
> rtw_vht_1s_rates
> rtw_vht_2s_rates
> rtw_rate_section
> rtw_rate_size
> rtw_sdio_ops
> rtw_usb_ops
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 7/9] wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM
2025-02-04 18:40 ` [PATCH v2 7/9] wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM Bitterblue Smith
@ 2025-02-10 1:37 ` Ping-Ke Shih
0 siblings, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:37 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> It fits the meaning of the enum better.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 8/9] wifi: rtw88: Extend TX power stuff for 3-4 spatial streams
2025-02-04 18:41 ` [PATCH v2 8/9] wifi: rtw88: Extend TX power stuff for 3-4 spatial streams Bitterblue Smith
@ 2025-02-10 1:50 ` Ping-Ke Shih
0 siblings, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:50 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> Although the RTL8814AU only has 3 spatial streams, maybe some other chip
> has 4.
>
> Correct the TX power index and TX power limit calculations for 3SS and
> 4SS HT/VHT rates.
>
> With this the RTL8814AU can set the TX power correctly.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v2 9/9] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
2025-02-04 18:42 ` [PATCH v2 9/9] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU Bitterblue Smith
@ 2025-02-10 1:50 ` Ping-Ke Shih
0 siblings, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 1:50 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> This function tells the firmware what rates it can use.
>
> Put the 3SS and 4SS HT rates supported by the other station into the
> rate mask.
>
> Remove the 3SS and 4SS rates from the rate mask if the hardware only has
> 2 spatial streams.
>
> And finally, select the right rate ID (a parameter for the firmware)
> when the hardware has 3 spatial streams.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU
2025-02-04 18:36 ` [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU Bitterblue Smith
2025-02-10 1:23 ` Ping-Ke Shih
@ 2025-02-10 3:44 ` Ping-Ke Shih
1 sibling, 0 replies; 21+ messages in thread
From: Ping-Ke Shih @ 2025-02-10 3:44 UTC (permalink / raw)
To: Bitterblue Smith, linux-wireless@vger.kernel.org; +Cc: Ping-Ke Shih
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> Don't call ltecoex_read_reg() and ltecoex_reg_write() when the
> ltecoex_addr member of struct rtw_chip_info is NULL. The RTL8814AU
> doesn't have this feature.
>
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
9 patch(es) applied to rtw-next branch of rtw.git, thanks.
8425f5c8f04d wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU
9e8243025cc0 wifi: rtw88: Fix download_firmware_validate() for RTL8814AU
62f726848da4 wifi: rtw88: Extend struct rtw_pwr_track_tbl for RTL8814AU
d80e7d9b6ba3 wifi: rtw88: Extend rf_base_addr and rf_sipi_addr for RTL8814AU
8f0076726b66 wifi: rtw88: Extend rtw_fw_send_ra_info() for RTL8814AU
e66f3b5c7535 wifi: rtw88: Constify some more structs and arrays
ad815f392003 wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM
0f98a5959657 wifi: rtw88: Extend TX power stuff for 3-4 spatial streams
9f00e2218e15 wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
---
https://github.com/pkshih/rtw.git
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU
2025-02-10 1:23 ` Ping-Ke Shih
@ 2025-02-10 13:30 ` Bitterblue Smith
0 siblings, 0 replies; 21+ messages in thread
From: Bitterblue Smith @ 2025-02-10 13:30 UTC (permalink / raw)
To: Ping-Ke Shih, linux-wireless@vger.kernel.org
On 10/02/2025 03:23, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> Don't call ltecoex_read_reg() and ltecoex_reg_write() when the
>> ltecoex_addr member of struct rtw_chip_info is NULL. The RTL8814AU
>> doesn't have this feature.
>>
>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
>
>> ---
>> v2:
>> - No change.
>
> Next time please take my Acked-by in v1. That will help me to save time in v2.
>
Okay, I will do that.
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2025-02-10 13:30 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04 18:35 [PATCH v2 0/9] wifi: rtw88: Prepare to support RTL8814AU (part 1/2) Bitterblue Smith
2025-02-04 18:36 ` [PATCH v2 1/9] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU Bitterblue Smith
2025-02-10 1:23 ` Ping-Ke Shih
2025-02-10 13:30 ` Bitterblue Smith
2025-02-10 3:44 ` Ping-Ke Shih
2025-02-04 18:37 ` [PATCH v2 2/9] wifi: rtw88: Fix download_firmware_validate() " Bitterblue Smith
2025-02-10 1:24 ` Ping-Ke Shih
2025-02-04 18:38 ` [PATCH v2 3/9] wifi: rtw88: Extend struct rtw_pwr_track_tbl " Bitterblue Smith
2025-02-10 1:25 ` Ping-Ke Shih
2025-02-04 18:38 ` [PATCH v2 4/9] wifi: rtw88: Extend rf_base_addr and rf_sipi_addr " Bitterblue Smith
2025-02-10 1:28 ` Ping-Ke Shih
2025-02-04 18:39 ` [PATCH v2 5/9] wifi: rtw88: Extend rtw_fw_send_ra_info() " Bitterblue Smith
2025-02-10 1:33 ` Ping-Ke Shih
2025-02-04 18:40 ` [PATCH v2 6/9] wifi: rtw88: Constify some more structs and arrays Bitterblue Smith
2025-02-10 1:35 ` Ping-Ke Shih
2025-02-04 18:40 ` [PATCH v2 7/9] wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM Bitterblue Smith
2025-02-10 1:37 ` Ping-Ke Shih
2025-02-04 18:41 ` [PATCH v2 8/9] wifi: rtw88: Extend TX power stuff for 3-4 spatial streams Bitterblue Smith
2025-02-10 1:50 ` Ping-Ke Shih
2025-02-04 18:42 ` [PATCH v2 9/9] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU Bitterblue Smith
2025-02-10 1:50 ` Ping-Ke Shih
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).