blob: a9a5f48ac8769b6dd776177b38ce722b59c8d94d [file] [log] [blame]
developera20cdc22024-05-31 18:57:31 +08001From 47f124ba1718259555245eb9c3ad3fb2b4fd0a67 Mon Sep 17 00:00:00 2001
developerc8796032023-08-09 10:28:15 +08002From: Evelyn Tsai <evelyn.tsai@mediatek.com>
3Date: Sat, 29 Jul 2023 04:53:47 +0800
developera20cdc22024-05-31 18:57:31 +08004Subject: [PATCH 04/21] wifi: mt76: mt7915: fix txpower issues
developerc8796032023-08-09 10:28:15 +08005
6---
developer1a173672023-12-21 14:49:33 +08007 eeprom.c | 2 +-
developerc8796032023-08-09 10:28:15 +08008 mt7915/debugfs.c | 48 ++++++++++++++++++++++++++----------------------
developerf0fd7052023-08-14 20:23:42 +08009 mt7915/main.c | 1 +
developer1a173672023-12-21 14:49:33 +080010 3 files changed, 28 insertions(+), 23 deletions(-)
developerc8796032023-08-09 10:28:15 +080011
12diff --git a/eeprom.c b/eeprom.c
developerdc9eeae2024-04-08 14:36:46 +080013index 0bc66cc..ecd09c0 100644
developerc8796032023-08-09 10:28:15 +080014--- a/eeprom.c
15+++ b/eeprom.c
developer1a173672023-12-21 14:49:33 +080016@@ -343,7 +343,7 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
developerc8796032023-08-09 10:28:15 +080017 u32 ru_rates = ARRAY_SIZE(dest->ru[0]);
18 char band;
19 size_t len;
20- s8 max_power = 0;
21+ s8 max_power = -127;
22 s8 txs_delta;
23
24 if (!mcs_rates)
developerc8796032023-08-09 10:28:15 +080025diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
developerdc9eeae2024-04-08 14:36:46 +080026index 5780138..894e2cd 100644
developerc8796032023-08-09 10:28:15 +080027--- a/mt7915/debugfs.c
28+++ b/mt7915/debugfs.c
developerdc9eeae2024-04-08 14:36:46 +080029@@ -951,9 +951,9 @@ mt7915_xmit_queues_show(struct seq_file *file, void *data)
developerc8796032023-08-09 10:28:15 +080030
31 DEFINE_SHOW_ATTRIBUTE(mt7915_xmit_queues);
32
33-#define mt7915_txpower_puts(rate) \
34+#define mt7915_txpower_puts(rate, _len) \
35 ({ \
36- len += scnprintf(buf + len, sz - len, "%-16s:", #rate " (TMAC)"); \
37+ len += scnprintf(buf + len, sz - len, "%-*s:", _len, #rate " (TMAC)"); \
38 for (i = 0; i < mt7915_sku_group_len[SKU_##rate]; i++, offs++) \
39 len += scnprintf(buf + len, sz - len, " %6d", txpwr[offs]); \
40 len += scnprintf(buf + len, sz - len, "\n"); \
developerdc9eeae2024-04-08 14:36:46 +080041@@ -995,43 +995,47 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf,
developerc8796032023-08-09 10:28:15 +080042 len += scnprintf(buf + len, sz - len,
43 "\nPhy%d Tx power table (channel %d)\n",
44 phy != &dev->phy, phy->mt76->chandef.chan->hw_value);
45- len += scnprintf(buf + len, sz - len, "%-16s %6s %6s %6s %6s\n",
46+ len += scnprintf(buf + len, sz - len, "%-23s %6s %6s %6s %6s\n",
47 " ", "1m", "2m", "5m", "11m");
48- mt7915_txpower_puts(CCK);
49+ mt7915_txpower_puts(CCK, 23);
50
51 len += scnprintf(buf + len, sz - len,
52- "%-16s %6s %6s %6s %6s %6s %6s %6s %6s\n",
53+ "%-23s %6s %6s %6s %6s %6s %6s %6s %6s\n",
54 " ", "6m", "9m", "12m", "18m", "24m", "36m", "48m",
55 "54m");
56- mt7915_txpower_puts(OFDM);
57+ mt7915_txpower_puts(OFDM, 23);
58
59 len += scnprintf(buf + len, sz - len,
60- "%-16s %6s %6s %6s %6s %6s %6s %6s %6s\n",
61+ "%-23s %6s %6s %6s %6s %6s %6s %6s %6s\n",
62 " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4",
63 "mcs5", "mcs6", "mcs7");
64- mt7915_txpower_puts(HT_BW20);
65+ mt7915_txpower_puts(HT_BW20, 23);
66
67 len += scnprintf(buf + len, sz - len,
68- "%-16s %6s %6s %6s %6s %6s %6s %6s %6s %6s\n",
69+ "%-23s %6s %6s %6s %6s %6s %6s %6s %6s %6s\n",
70 " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4", "mcs5",
71 "mcs6", "mcs7", "mcs32");
72- mt7915_txpower_puts(HT_BW40);
73+ mt7915_txpower_puts(HT_BW40, 23);
74
75 len += scnprintf(buf + len, sz - len,
76- "%-16s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s\n",
77+ "%-23s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s\n",
78 " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4", "mcs5",
79 "mcs6", "mcs7", "mcs8", "mcs9", "mcs10", "mcs11");
80- mt7915_txpower_puts(VHT_BW20);
81- mt7915_txpower_puts(VHT_BW40);
82- mt7915_txpower_puts(VHT_BW80);
83- mt7915_txpower_puts(VHT_BW160);
84- mt7915_txpower_puts(HE_RU26);
85- mt7915_txpower_puts(HE_RU52);
86- mt7915_txpower_puts(HE_RU106);
87- mt7915_txpower_puts(HE_RU242);
88- mt7915_txpower_puts(HE_RU484);
89- mt7915_txpower_puts(HE_RU996);
90- mt7915_txpower_puts(HE_RU2x996);
91+ mt7915_txpower_puts(VHT_BW20, 23);
92+ mt7915_txpower_puts(VHT_BW40, 23);
93+ mt7915_txpower_puts(VHT_BW80, 23);
94+ mt7915_txpower_puts(VHT_BW160, 23);
95+ mt7915_txpower_puts(HE_RU26, 23);
96+ mt7915_txpower_puts(HE_RU52, 23);
97+ mt7915_txpower_puts(HE_RU106, 23);
98+ len += scnprintf(buf + len, sz - len, "BW20/");
99+ mt7915_txpower_puts(HE_RU242, 18);
100+ len += scnprintf(buf + len, sz - len, "BW40/");
101+ mt7915_txpower_puts(HE_RU484, 18);
102+ len += scnprintf(buf + len, sz - len, "BW80/");
103+ mt7915_txpower_puts(HE_RU996, 18);
104+ len += scnprintf(buf + len, sz - len, "BW160/");
105+ mt7915_txpower_puts(HE_RU2x996, 17);
106
107 reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_TPC_CTRL_STAT(band) :
108 MT_WF_PHY_TPC_CTRL_STAT_MT7916(band);
developerc8796032023-08-09 10:28:15 +0800109diff --git a/mt7915/main.c b/mt7915/main.c
developerdc9eeae2024-04-08 14:36:46 +0800110index e61041d..1903db4 100644
developerc8796032023-08-09 10:28:15 +0800111--- a/mt7915/main.c
112+++ b/mt7915/main.c
developera46f6132024-03-26 14:09:54 +0800113@@ -1080,6 +1080,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
developerc8796032023-08-09 10:28:15 +0800114 mt76_set_stream_caps(phy->mt76, true);
115 mt7915_set_stream_vht_txbf_caps(phy);
116 mt7915_set_stream_he_caps(phy);
117+ mt7915_mcu_set_txpower_sku(phy);
118
119 mutex_unlock(&dev->mt76.mutex);
120
developerc8796032023-08-09 10:28:15 +0800121--
developerbd9fa1e2023-10-16 11:04:00 +08001222.18.0
developerc8796032023-08-09 10:28:15 +0800123