75fff03ed49d4b5e11b23531fb7e95b3fb936c60
[openwrt/openwrt.git] /
1 From c374281f828545b3698cf936b584249c2f9e40c5 Mon Sep 17 00:00:00 2001
2 From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
3 Date: Tue, 18 Feb 2025 01:32:49 +0200
4 Subject: [PATCH] wifi: rtw88: Extend rtw_debugfs_get_tx_pwr_tbl() for
5 RTL8814AU
6
7 Make it print the TX power details for all RF paths, not just A and B,
8 and for all the rates supported by the chip, not just 1SS and 2SS
9 rates.
10
11 Also skip the RF paths and rates not supported by the chip.
12
13 Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
14 Acked-by: Ping-Ke Shih <pkshih@realtek.com>
15 Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
16 Link: https://patch.msgid.link/ea65a978-a735-4c97-af82-d7fe26f95da1@gmail.com
17 ---
18 drivers/net/wireless/realtek/rtw88/debug.c | 20 +++++++++++++-------
19 1 file changed, 13 insertions(+), 7 deletions(-)
20
21 --- a/drivers/net/wireless/realtek/rtw88/debug.c
22 +++ b/drivers/net/wireless/realtek/rtw88/debug.c
23 @@ -692,9 +692,11 @@ static int rtw_debugfs_get_tx_pwr_tbl(st
24 {
25 struct rtw_debugfs_priv *debugfs_priv = m->private;
26 struct rtw_dev *rtwdev = debugfs_priv->rtwdev;
27 + struct rtw_power_params pwr_param = {0};
28 struct rtw_hal *hal = &rtwdev->hal;
29 + u8 nss = rtwdev->efuse.hw_cap.nss;
30 u8 path, rate, bw, ch, regd;
31 - struct rtw_power_params pwr_param = {0};
32 + u8 max_ht_rate, max_rate;
33
34 mutex_lock(&rtwdev->mutex);
35 bw = hal->current_band_width;
36 @@ -707,19 +709,23 @@ static int rtw_debugfs_get_tx_pwr_tbl(st
37 seq_printf(m, "%-4s %-10s %-9s %-9s (%-4s %-4s %-4s) %-4s\n",
38 "path", "rate", "pwr", "base", "byr", "lmt", "sar", "rem");
39
40 + max_ht_rate = DESC_RATEMCS0 + nss * 8 - 1;
41 +
42 + if (rtwdev->chip->vht_supported)
43 + max_rate = DESC_RATEVHT1SS_MCS0 + nss * 10 - 1;
44 + else
45 + max_rate = max_ht_rate;
46 +
47 mutex_lock(&hal->tx_power_mutex);
48 - for (path = RF_PATH_A; path <= RF_PATH_B; path++) {
49 + for (path = RF_PATH_A; path < hal->rf_path_num; path++) {
50 /* there is no CCK rates used in 5G */
51 if (hal->current_band_type == RTW_BAND_5G)
52 rate = DESC_RATE6M;
53 else
54 rate = DESC_RATE1M;
55
56 - /* now, not support vht 3ss and vht 4ss*/
57 - for (; rate <= DESC_RATEVHT2SS_MCS9; rate++) {
58 - /* now, not support ht 3ss and ht 4ss*/
59 - if (rate > DESC_RATEMCS15 &&
60 - rate < DESC_RATEVHT1SS_MCS0)
61 + for (; rate <= max_rate; rate++) {
62 + if (rate > max_ht_rate && rate <= DESC_RATEMCS31)
63 continue;
64
65 rtw_get_tx_power_params(rtwdev, path, rate, bw,