diff mbox series

[02/20] wifi: rtw88: Dump the HW features only for some chips

Message ID 32cce43e-8495-4f82-8ab4-527e1606fee3@gmail.com
State New
Headers show
Series wifi: rtw88: Add support for RTL8821AU and RTL8812AU | expand

Commit Message

Bitterblue Smith Aug. 11, 2024, 8:54 p.m. UTC
RTL8821AU and RTL8812AU don't support this. They hit the "failed to read
hw feature report" error.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/main.c     | 4 ++++
 drivers/net/wireless/realtek/rtw88/main.h     | 1 +
 drivers/net/wireless/realtek/rtw88/rtw8703b.c | 1 +
 drivers/net/wireless/realtek/rtw88/rtw8723d.c | 1 +
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 1 +
 drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 +
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 1 +
 7 files changed, 10 insertions(+)

Comments

Ping-Ke Shih Aug. 15, 2024, 6:10 a.m. UTC | #1
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> RTL8821AU and RTL8812AU don't support this. They hit the "failed to read
> hw feature report" error.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> ---
>  drivers/net/wireless/realtek/rtw88/main.c     | 4 ++++
>  drivers/net/wireless/realtek/rtw88/main.h     | 1 +
>  drivers/net/wireless/realtek/rtw88/rtw8703b.c | 1 +
>  drivers/net/wireless/realtek/rtw88/rtw8723d.c | 1 +
>  drivers/net/wireless/realtek/rtw88/rtw8821c.c | 1 +
>  drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 +
>  drivers/net/wireless/realtek/rtw88/rtw8822c.c | 1 +
>  7 files changed, 10 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
> index ff045dfdca4a..aeb21ac25e2e 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -1923,6 +1923,9 @@ static int rtw_dump_hw_feature(struct rtw_dev *rtwdev)
>         u8 bw;
>         int i;
> 
> +       if (!rtwdev->chip->hw_feature_report)
> +               goto print_hw_cap;

Since chips don't support of hw_feature_report, printing hw capabilities seems
useless. Just 'return'?

> +
>         id = rtw_read8(rtwdev, REG_C2HEVT);
>         if (id != C2H_HW_FEATURE_REPORT) {
>                 rtw_err(rtwdev, "failed to read hw feature report\n");
> @@ -1947,6 +1950,7 @@ static int rtw_dump_hw_feature(struct rtw_dev *rtwdev)
>             efuse->hw_cap.nss > rtwdev->hal.rf_path_num)
>                 efuse->hw_cap.nss = rtwdev->hal.rf_path_num;
> 
> +print_hw_cap:
>         rtw_dbg(rtwdev, RTW_DBG_EFUSE,
>                 "hw cap: hci=0x%02x, bw=0x%02x, ptcl=0x%02x, ant_num=%d, nss=%d\n",
>                 efuse->hw_cap.hci, efuse->hw_cap.bw, efuse->hw_cap.ptcl,

[...]
Bitterblue Smith Aug. 19, 2024, 5:51 p.m. UTC | #2
On 15/08/2024 09:10, Ping-Ke Shih wrote:
> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>> RTL8821AU and RTL8812AU don't support this. They hit the "failed to read
>> hw feature report" error.
>>
>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
>> ---
>>  drivers/net/wireless/realtek/rtw88/main.c     | 4 ++++
>>  drivers/net/wireless/realtek/rtw88/main.h     | 1 +
>>  drivers/net/wireless/realtek/rtw88/rtw8703b.c | 1 +
>>  drivers/net/wireless/realtek/rtw88/rtw8723d.c | 1 +
>>  drivers/net/wireless/realtek/rtw88/rtw8821c.c | 1 +
>>  drivers/net/wireless/realtek/rtw88/rtw8822b.c | 1 +
>>  drivers/net/wireless/realtek/rtw88/rtw8822c.c | 1 +
>>  7 files changed, 10 insertions(+)
>>
>> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
>> index ff045dfdca4a..aeb21ac25e2e 100644
>> --- a/drivers/net/wireless/realtek/rtw88/main.c
>> +++ b/drivers/net/wireless/realtek/rtw88/main.c
>> @@ -1923,6 +1923,9 @@ static int rtw_dump_hw_feature(struct rtw_dev *rtwdev)
>>         u8 bw;
>>         int i;
>>
>> +       if (!rtwdev->chip->hw_feature_report)
>> +               goto print_hw_cap;
> 
> Since chips don't support of hw_feature_report, printing hw capabilities seems
> useless. Just 'return'?
> 

efuse->hw_cap is filled earlier in rtw8812a_read_usb_type(),
so printing here is not entirely useless. But maybe it is
cleaner to return here and print these things in
rtw8812a_read_usb_type().

>> +
>>         id = rtw_read8(rtwdev, REG_C2HEVT);
>>         if (id != C2H_HW_FEATURE_REPORT) {
>>                 rtw_err(rtwdev, "failed to read hw feature report\n");
>> @@ -1947,6 +1950,7 @@ static int rtw_dump_hw_feature(struct rtw_dev *rtwdev)
>>             efuse->hw_cap.nss > rtwdev->hal.rf_path_num)
>>                 efuse->hw_cap.nss = rtwdev->hal.rf_path_num;
>>
>> +print_hw_cap:
>>         rtw_dbg(rtwdev, RTW_DBG_EFUSE,
>>                 "hw cap: hci=0x%02x, bw=0x%02x, ptcl=0x%02x, ant_num=%d, nss=%d\n",
>>                 efuse->hw_cap.hci, efuse->hw_cap.bw, efuse->hw_cap.ptcl,
> 
> [...]
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index ff045dfdca4a..aeb21ac25e2e 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1923,6 +1923,9 @@  static int rtw_dump_hw_feature(struct rtw_dev *rtwdev)
 	u8 bw;
 	int i;
 
+	if (!rtwdev->chip->hw_feature_report)
+		goto print_hw_cap;
+
 	id = rtw_read8(rtwdev, REG_C2HEVT);
 	if (id != C2H_HW_FEATURE_REPORT) {
 		rtw_err(rtwdev, "failed to read hw feature report\n");
@@ -1947,6 +1950,7 @@  static int rtw_dump_hw_feature(struct rtw_dev *rtwdev)
 	    efuse->hw_cap.nss > rtwdev->hal.rf_path_num)
 		efuse->hw_cap.nss = rtwdev->hal.rf_path_num;
 
+print_hw_cap:
 	rtw_dbg(rtwdev, RTW_DBG_EFUSE,
 		"hw cap: hci=0x%02x, bw=0x%02x, ptcl=0x%02x, ant_num=%d, nss=%d\n",
 		efuse->hw_cap.hci, efuse->hw_cap.bw, efuse->hw_cap.ptcl,
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 7e4618095eca..16619432f450 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -1202,6 +1202,7 @@  struct rtw_chip_info {
 	const struct rtw_fwcd_segs *fwcd_segs;
 
 	u8 usb_tx_agg_desc_num;
+	bool hw_feature_report;
 
 	u8 default_1ss_tx_path;
 
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8703b.c b/drivers/net/wireless/realtek/rtw88/rtw8703b.c
index 222608de33cd..c9bb779812b6 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8703b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8703b.c
@@ -2014,6 +2014,7 @@  const struct rtw_chip_info rtw8703b_hw_spec = {
 	.max_power_index = 0x3f,
 	.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
 	.usb_tx_agg_desc_num = 1, /* Not sure if this chip has USB interface */
+	.hw_feature_report = true,
 
 	.path_div_supported = false,
 	.ht_supported = true,
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8723d.c b/drivers/net/wireless/realtek/rtw88/rtw8723d.c
index 3fba4054d45f..fea327e5a474 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8723d.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8723d.c
@@ -2172,6 +2172,7 @@  const struct rtw_chip_info rtw8723d_hw_spec = {
 	.page_size = TX_PAGE_SIZE,
 	.dig_min = 0x20,
 	.usb_tx_agg_desc_num = 1,
+	.hw_feature_report = true,
 	.ht_supported = true,
 	.vht_supported = false,
 	.lps_deep_mode_supported = 0,
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
index 526e8de77b3e..a95bca79ce02 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
@@ -2009,6 +2009,7 @@  const struct rtw_chip_info rtw8821c_hw_spec = {
 	.page_size = TX_PAGE_SIZE,
 	.dig_min = 0x1c,
 	.usb_tx_agg_desc_num = 3,
+	.hw_feature_report = true,
 	.ht_supported = true,
 	.vht_supported = true,
 	.lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK),
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
index 6edb17aea90e..42f055eec16b 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
@@ -2550,6 +2550,7 @@  const struct rtw_chip_info rtw8822b_hw_spec = {
 	.page_size = TX_PAGE_SIZE,
 	.dig_min = 0x1c,
 	.usb_tx_agg_desc_num = 3,
+	.hw_feature_report = true,
 	.ht_supported = true,
 	.vht_supported = true,
 	.lps_deep_mode_supported = BIT(LPS_DEEP_MODE_LCLK),
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 1dbe1cdbc3fd..c646bd4ec5e2 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -5371,6 +5371,7 @@  const struct rtw_chip_info rtw8822c_hw_spec = {
 	.page_size = TX_PAGE_SIZE,
 	.dig_min = 0x20,
 	.usb_tx_agg_desc_num = 3,
+	.hw_feature_report = true,
 	.default_1ss_tx_path = BB_PATH_A,
 	.path_div_supported = true,
 	.ht_supported = true,