blob: 17d289a312e6cc5e67e66f748eddd72ca1736ad4 [file] [log] [blame]
developerbd9fa1e2023-10-16 11:04:00 +08001From f793f54b26302abc942574b2e6f19f609b3a1c0e Mon Sep 17 00:00:00 2001
developera16be1f2022-12-14 13:09:20 +08002From: Shayne Chen <shayne.chen@mediatek.com>
3Date: Mon, 5 Dec 2022 18:21:51 +0800
developerbd9fa1e2023-10-16 11:04:00 +08004Subject: [PATCH 1025/1040] wifi: mt76: mt7915: add bf backoff limit table
developerda18a742023-04-06 13:44:00 +08005 support
developera16be1f2022-12-14 13:09:20 +08006
7Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
8---
developerf9b00212023-07-31 12:27:06 +08009 debugfs.c | 2 +-
developerc8796032023-08-09 10:28:15 +080010 eeprom.c | 34 +++++++++++-
developera16be1f2022-12-14 13:09:20 +080011 mt76.h | 8 +++
developerc8796032023-08-09 10:28:15 +080012 mt7915/debugfs.c | 73 ++++++++++++++++++++++++--
developer327aa322023-07-10 13:49:56 +080013 mt7915/mcu.c | 132 ++++++++++++++++++++++++++++++++++++-----------
developerc8796032023-08-09 10:28:15 +080014 mt7915/mcu.h | 6 +++
developera16be1f2022-12-14 13:09:20 +080015 mt7915/mt7915.h | 4 +-
developerc8796032023-08-09 10:28:15 +080016 7 files changed, 220 insertions(+), 39 deletions(-)
developera16be1f2022-12-14 13:09:20 +080017
developerf9b00212023-07-31 12:27:06 +080018diff --git a/debugfs.c b/debugfs.c
developerbd9fa1e2023-10-16 11:04:00 +080019index 1c8328d..19a835c 100644
developerf9b00212023-07-31 12:27:06 +080020--- a/debugfs.c
21+++ b/debugfs.c
22@@ -95,7 +95,7 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
23 {
24 int i;
25
26- seq_printf(file, "%10s:", str);
27+ seq_printf(file, "%16s:", str);
28 for (i = 0; i < len; i++)
29 seq_printf(file, " %2d", val[i]);
30 seq_puts(file, "\n");
developera16be1f2022-12-14 13:09:20 +080031diff --git a/eeprom.c b/eeprom.c
developerbd9fa1e2023-10-16 11:04:00 +080032index eb532c7..4189525 100644
developera16be1f2022-12-14 13:09:20 +080033--- a/eeprom.c
34+++ b/eeprom.c
developerc8796032023-08-09 10:28:15 +080035@@ -367,12 +367,16 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
developer327aa322023-07-10 13:49:56 +080036 char band;
37 size_t len;
developerc8796032023-08-09 10:28:15 +080038 s8 max_power = -127;
developer327aa322023-07-10 13:49:56 +080039+ s8 max_power_backoff = -127;
40 s8 txs_delta;
developerf9b00212023-07-31 12:27:06 +080041+ int n_chains = hweight16(phy->chainmask);
developer327aa322023-07-10 13:49:56 +080042+ s8 target_power_combine = target_power + mt76_tx_power_nss_delta(n_chains);
43
developera16be1f2022-12-14 13:09:20 +080044 if (!mcs_rates)
45 mcs_rates = 10;
46
47- memset(dest, target_power, sizeof(*dest));
48+ memset(dest, target_power, sizeof(*dest) - sizeof(dest->path));
49+ memset(&dest->path, 0, sizeof(dest->path));
50
51 if (!IS_ENABLED(CONFIG_OF))
52 return target_power;
developerc8796032023-08-09 10:28:15 +080053@@ -425,7 +429,33 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
developera16be1f2022-12-14 13:09:20 +080054 ARRAY_SIZE(dest->ru), val, len,
55 target_power, txs_delta, &max_power);
56
developer327aa322023-07-10 13:49:56 +080057- return max_power;
58+ max_power_backoff = max_power;
developera16be1f2022-12-14 13:09:20 +080059+ val = mt76_get_of_array(np, "paths-cck", &len, ARRAY_SIZE(dest->path.cck));
60+ mt76_apply_array_limit(dest->path.cck, ARRAY_SIZE(dest->path.cck), val,
developer327aa322023-07-10 13:49:56 +080061+ target_power_combine, txs_delta, &max_power_backoff);
developera16be1f2022-12-14 13:09:20 +080062+
63+ val = mt76_get_of_array(np, "paths-ofdm", &len, ARRAY_SIZE(dest->path.ofdm));
64+ mt76_apply_array_limit(dest->path.ofdm, ARRAY_SIZE(dest->path.ofdm), val,
developer327aa322023-07-10 13:49:56 +080065+ target_power_combine, txs_delta, &max_power_backoff);
developera16be1f2022-12-14 13:09:20 +080066+
67+ val = mt76_get_of_array(np, "paths-ofdm-bf", &len, ARRAY_SIZE(dest->path.ofdm_bf));
68+ mt76_apply_array_limit(dest->path.ofdm_bf, ARRAY_SIZE(dest->path.ofdm_bf), val,
developer327aa322023-07-10 13:49:56 +080069+ target_power_combine, txs_delta, &max_power_backoff);
developera16be1f2022-12-14 13:09:20 +080070+
71+ val = mt76_get_of_array(np, "paths-ru", &len, ARRAY_SIZE(dest->path.ru[0]) + 1);
72+ mt76_apply_multi_array_limit(dest->path.ru[0], ARRAY_SIZE(dest->path.ru[0]),
73+ ARRAY_SIZE(dest->path.ru), val, len,
developer327aa322023-07-10 13:49:56 +080074+ target_power_combine, txs_delta, &max_power_backoff);
developera16be1f2022-12-14 13:09:20 +080075+
76+ val = mt76_get_of_array(np, "paths-ru-bf", &len, ARRAY_SIZE(dest->path.ru_bf[0]) + 1);
77+ mt76_apply_multi_array_limit(dest->path.ru_bf[0], ARRAY_SIZE(dest->path.ru_bf[0]),
78+ ARRAY_SIZE(dest->path.ru_bf), val, len,
developer327aa322023-07-10 13:49:56 +080079+ target_power_combine, txs_delta, &max_power_backoff);
developera16be1f2022-12-14 13:09:20 +080080+
developer327aa322023-07-10 13:49:56 +080081+ if (max_power_backoff == target_power_combine)
82+ return max_power;
83+
84+ return max_power_backoff;
developera16be1f2022-12-14 13:09:20 +080085 }
86 EXPORT_SYMBOL_GPL(mt76_get_rate_power_limits);
developer327aa322023-07-10 13:49:56 +080087
developera16be1f2022-12-14 13:09:20 +080088diff --git a/mt76.h b/mt76.h
developerbd9fa1e2023-10-16 11:04:00 +080089index 13796ad..05c1874 100644
developera16be1f2022-12-14 13:09:20 +080090--- a/mt76.h
91+++ b/mt76.h
developerbd9fa1e2023-10-16 11:04:00 +080092@@ -1047,6 +1047,14 @@ struct mt76_power_limits {
developera16be1f2022-12-14 13:09:20 +080093 s8 mcs[4][10];
94 s8 ru[7][12];
developerbd9fa1e2023-10-16 11:04:00 +080095 s8 eht[16][16];
developera16be1f2022-12-14 13:09:20 +080096+
97+ struct {
98+ s8 cck[4];
99+ s8 ofdm[4];
100+ s8 ofdm_bf[4];
101+ s8 ru[7][10];
102+ s8 ru_bf[7][10];
103+ } path;
104 };
105
106 struct mt76_ethtool_worker_info {
107diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
developerbd9fa1e2023-10-16 11:04:00 +0800108index f181377..19a37b5 100644
developera16be1f2022-12-14 13:09:20 +0800109--- a/mt7915/debugfs.c
110+++ b/mt7915/debugfs.c
developer47efbdb2023-06-29 20:33:22 +0800111@@ -1019,7 +1019,7 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf,
developera16be1f2022-12-14 13:09:20 +0800112 if (!buf)
113 return -ENOMEM;
114
115- ret = mt7915_mcu_get_txpower_sku(phy, txpwr, sizeof(txpwr));
116+ ret = mt7915_mcu_get_txpower_sku(phy, txpwr, sizeof(txpwr), TX_POWER_INFO_RATE);
117 if (ret)
118 goto out;
119
developerc8796032023-08-09 10:28:15 +0800120@@ -1133,7 +1133,7 @@ mt7915_rate_txpower_set(struct file *file, const char __user *user_buf,
developera16be1f2022-12-14 13:09:20 +0800121
122 mutex_lock(&dev->mt76.mutex);
123 ret = mt7915_mcu_get_txpower_sku(phy, req.txpower_sku,
124- sizeof(req.txpower_sku));
125+ sizeof(req.txpower_sku), TX_POWER_INFO_RATE);
126 if (ret)
127 goto out;
128
developerc8796032023-08-09 10:28:15 +0800129@@ -1175,7 +1175,7 @@ out:
developera16be1f2022-12-14 13:09:20 +0800130 return ret ? ret : count;
131 }
132
133-static const struct file_operations mt7915_rate_txpower_fops = {
134+static const struct file_operations mt7915_txpower_fops = {
135 .write = mt7915_rate_txpower_set,
136 .read = mt7915_rate_txpower_get,
137 .open = simple_open,
developerc8796032023-08-09 10:28:15 +0800138@@ -1183,6 +1183,69 @@ static const struct file_operations mt7915_rate_txpower_fops = {
developera16be1f2022-12-14 13:09:20 +0800139 .llseek = default_llseek,
140 };
141
142+static int
143+mt7915_path_txpower_show(struct seq_file *file)
144+{
145+ struct mt7915_phy *phy = file->private;
146+ s8 txpower[MT7915_SKU_PATH_NUM], *buf = txpower;
147+ int ret;
148+
149+#define PATH_POWER_SHOW(_name, _len, _skip) do { \
150+ if (_skip) { \
151+ buf -= 1; \
152+ *buf = 0; \
153+ } \
154+ mt76_seq_puts_array(file, _name, buf, _len); \
155+ buf += _len; \
156+ } while(0)
157+
developerf9b00212023-07-31 12:27:06 +0800158+ seq_printf(file, "\n%*c", 17, ' ');
developera16be1f2022-12-14 13:09:20 +0800159+ seq_printf(file, "1T1S/2T1S/3T1S/4T1S/2T2S/3T2S/4T2S/3T3S/4T3S/4T4S\n");
160+ ret = mt7915_mcu_get_txpower_sku(phy, txpower, sizeof(txpower),
161+ TX_POWER_INFO_PATH);
162+ if (ret)
163+ return ret;
164+
165+ PATH_POWER_SHOW("CCK", 4, 0);
166+ PATH_POWER_SHOW("OFDM", 4, 0);
167+ PATH_POWER_SHOW("BF-OFDM", 4, 1);
168+
developerf9b00212023-07-31 12:27:06 +0800169+ PATH_POWER_SHOW("HT/VHT20", 10, 0);
170+ PATH_POWER_SHOW("BF-HT/VHT20", 10, 1);
171+ PATH_POWER_SHOW("HT/VHT40", 10, 0);
172+ PATH_POWER_SHOW("BF-HT/VHT40", 10, 1);
developera16be1f2022-12-14 13:09:20 +0800173+
developerf9b00212023-07-31 12:27:06 +0800174+ PATH_POWER_SHOW("BW20/RU242", 10, 0);
175+ PATH_POWER_SHOW("BF-BW20/RU242", 10, 1);
176+ PATH_POWER_SHOW("BW40/RU484", 10, 0);
177+ PATH_POWER_SHOW("BF-BW40/RU484", 10, 1);
178+ PATH_POWER_SHOW("BW80/RU996", 10, 0);
179+ PATH_POWER_SHOW("BF-BW80/RU996", 10, 1);
180+ PATH_POWER_SHOW("BW160/RU2x996", 10, 0);
181+ PATH_POWER_SHOW("BF-BW160/RU2x996", 10, 1);
developera16be1f2022-12-14 13:09:20 +0800182+ PATH_POWER_SHOW("RU26", 10, 0);
183+ PATH_POWER_SHOW("BF-RU26", 10, 0);
184+ PATH_POWER_SHOW("RU52", 10, 0);
185+ PATH_POWER_SHOW("BF-RU52", 10, 0);
186+ PATH_POWER_SHOW("RU106", 10, 0);
187+ PATH_POWER_SHOW("BF-RU106", 10, 0);
188+#undef PATH_POWER_SHOW
189+
190+ return 0;
191+}
192+
193+static int
194+mt7915_txpower_path_show(struct seq_file *file, void *data)
195+{
196+ struct mt7915_phy *phy = file->private;
197+
198+ seq_printf(file, "\nBand %d\n", phy != &phy->dev->phy);
199+
200+ return mt7915_path_txpower_show(file);
201+}
202+
203+DEFINE_SHOW_ATTRIBUTE(mt7915_txpower_path);
204+
205 static int
206 mt7915_twt_stats(struct seq_file *s, void *data)
207 {
developerc8796032023-08-09 10:28:15 +0800208@@ -1269,7 +1332,9 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
developera16be1f2022-12-14 13:09:20 +0800209 debugfs_create_file("implicit_txbf", 0600, dir, dev,
210 &fops_implicit_txbf);
211 debugfs_create_file("txpower_sku", 0400, dir, phy,
212- &mt7915_rate_txpower_fops);
213+ &mt7915_txpower_fops);
214+ debugfs_create_file("txpower_path", 0400, dir, phy,
215+ &mt7915_txpower_path_fops);
216 debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir,
217 mt7915_twt_stats);
218 debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval);
219diff --git a/mt7915/mcu.c b/mt7915/mcu.c
developerbd9fa1e2023-10-16 11:04:00 +0800220index 7e33386..f65f0ec 100644
developera16be1f2022-12-14 13:09:20 +0800221--- a/mt7915/mcu.c
222+++ b/mt7915/mcu.c
developerbd9fa1e2023-10-16 11:04:00 +0800223@@ -3311,7 +3311,8 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
developera16be1f2022-12-14 13:09:20 +0800224 int ret;
225 s8 txpower_sku[MT7915_SKU_RATE_NUM];
226
227- ret = mt7915_mcu_get_txpower_sku(phy, txpower_sku, sizeof(txpower_sku));
228+ ret = mt7915_mcu_get_txpower_sku(phy, txpower_sku, sizeof(txpower_sku),
229+ TX_POWER_INFO_RATE);
230 if (ret)
231 return ret;
232
developerbd9fa1e2023-10-16 11:04:00 +0800233@@ -3353,51 +3354,106 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
developera16be1f2022-12-14 13:09:20 +0800234
235 int mt7915_mcu_set_txpower_sku(struct mt7915_phy *phy)
236 {
237+#define TX_POWER_LIMIT_TABLE_RATE 0
238+#define TX_POWER_LIMIT_TABLE_PATH 1
239 struct mt7915_dev *dev = phy->dev;
240 struct mt76_phy *mphy = phy->mt76;
241 struct ieee80211_hw *hw = mphy->hw;
242- struct mt7915_mcu_txpower_sku req = {
243+ struct mt7915_sku_val {
244+ u8 format_id;
245+ u8 limit_type;
246+ u8 band_idx;
247+ } __packed hdr = {
248 .format_id = TX_POWER_LIMIT_TABLE,
249+ .limit_type = TX_POWER_LIMIT_TABLE_RATE,
250 .band_idx = phy->mt76->band_idx,
251 };
252- struct mt76_power_limits limits_array;
253- s8 *la = (s8 *)&limits_array;
254- int i, idx;
255- int tx_power;
256+ int i, ret, tx_power;
257+ const u8 *len = mt7915_sku_group_len;
258+ struct mt76_power_limits la = {};
259+ struct sk_buff *skb;
260
261 tx_power = mt7915_get_power_bound(phy, hw->conf.power_level);
262 tx_power = mt76_get_rate_power_limits(mphy, mphy->chandef.chan,
263- &limits_array, tx_power);
264+ &la, tx_power);
265 mphy->txpower_cur = tx_power;
266
267- for (i = 0, idx = 0; i < ARRAY_SIZE(mt7915_sku_group_len); i++) {
268- u8 mcs_num, len = mt7915_sku_group_len[i];
269- int j;
270+ skb = mt76_mcu_msg_alloc(&dev->mt76, NULL,
271+ sizeof(hdr) + MT7915_SKU_RATE_NUM);
272+ if (!skb)
273+ return -ENOMEM;
274
275- if (i >= SKU_HT_BW20 && i <= SKU_VHT_BW160) {
276- mcs_num = 10;
277+ skb_put_data(skb, &hdr, sizeof(hdr));
278+ skb_put_data(skb, &la.cck, len[SKU_CCK] + len[SKU_OFDM]);
279+ skb_put_data(skb, &la.mcs[0], len[SKU_HT_BW20]);
280+ skb_put_data(skb, &la.mcs[1], len[SKU_HT_BW40]);
281
282- if (i == SKU_HT_BW20 || i == SKU_VHT_BW20)
283- la = (s8 *)&limits_array + 12;
284- } else {
285- mcs_num = len;
286- }
287+ /* vht */
288+ for (i = 0; i < 4; i++) {
289+ skb_put_data(skb, &la.mcs[i], sizeof(la.mcs[i]));
290+ skb_put_zero(skb, 2); /* padding */
291+ }
developer327aa322023-07-10 13:49:56 +0800292+
developera16be1f2022-12-14 13:09:20 +0800293+ /* he */
294+ skb_put_data(skb, &la.ru[0], sizeof(la.ru));
developerc5ce7502022-12-19 11:33:22 +0800295
developer327aa322023-07-10 13:49:56 +0800296- for (j = 0; j < min_t(u8, mcs_num, len); j++)
297- req.txpower_sku[idx + j] = la[j];
developera16be1f2022-12-14 13:09:20 +0800298+ ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
299+ MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), true);
300+ if (ret)
301+ return ret;
302+
303+ /* only set per-path power table when it's configured */
304+ if (!la.path.ofdm[0])
305+ return 0;
developer327aa322023-07-10 13:49:56 +0800306
307- la += mcs_num;
308- idx += len;
developera16be1f2022-12-14 13:09:20 +0800309+ skb = mt76_mcu_msg_alloc(&dev->mt76, NULL,
310+ sizeof(hdr) + MT7915_SKU_PATH_NUM);
311+ if (!skb)
312+ return -ENOMEM;
developerc5ce7502022-12-19 11:33:22 +0800313+
developera16be1f2022-12-14 13:09:20 +0800314+ hdr.limit_type = TX_POWER_LIMIT_TABLE_PATH;
315+ skb_put_data(skb, &hdr, sizeof(hdr));
316+ skb_put_data(skb, &la.path.cck, sizeof(la.path.cck));
317+ skb_put_data(skb, &la.path.ofdm, sizeof(la.path.ofdm));
318+ skb_put_data(skb, &la.path.ofdm_bf[1], sizeof(la.path.ofdm_bf) - 1);
319+
320+ /* HT20 and HT40 */
developer327aa322023-07-10 13:49:56 +0800321+ skb_put_data(skb, &la.path.ru[3], sizeof(la.path.ru[3]));
322+ skb_put_data(skb, &la.path.ru_bf[3][1], sizeof(la.path.ru_bf[3]) - 1);
323+ skb_put_data(skb, &la.path.ru[4], sizeof(la.path.ru[4]));
324+ skb_put_data(skb, &la.path.ru_bf[4][1], sizeof(la.path.ru_bf[4]) - 1);
developera16be1f2022-12-14 13:09:20 +0800325+
326+ /* start from non-bf and bf fields of
327+ * BW20/RU242, BW40/RU484, BW80/RU996, BW160/RU2x996,
328+ * RU26, RU52, and RU106
329+ */
developera16be1f2022-12-14 13:09:20 +0800330+
developer327aa322023-07-10 13:49:56 +0800331+ for (i = 0; i < 8; i++) {
332+ bool bf = i % 2;
333+ u8 idx = (i + 6) / 2;
334+ s8 *buf = bf ? la.path.ru_bf[idx] : la.path.ru[idx];
developera16be1f2022-12-14 13:09:20 +0800335+ /* The non-bf fields of RU26 to RU106 are special cases */
developer327aa322023-07-10 13:49:56 +0800336+ if (bf)
developera16be1f2022-12-14 13:09:20 +0800337+ skb_put_data(skb, buf + 1, 9);
338+ else
339+ skb_put_data(skb, buf, 10);
340 }
341
342- return mt76_mcu_send_msg(&dev->mt76,
343- MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), &req,
344- sizeof(req), true);
developer327aa322023-07-10 13:49:56 +0800345+ for (i = 0; i < 6; i++) {
346+ bool bf = i % 2;
347+ u8 idx = i / 2;
348+ s8 *buf = bf ? la.path.ru_bf[idx] : la.path.ru[idx];
349+
350+ skb_put_data(skb, buf, 10);
351+ }
352+
developera16be1f2022-12-14 13:09:20 +0800353+ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
developerc5ce7502022-12-19 11:33:22 +0800354+ MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), true);
developera16be1f2022-12-14 13:09:20 +0800355 }
356
357-int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len)
358+int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len,
359+ u8 category)
360 {
361-#define RATE_POWER_INFO 2
362 struct mt7915_dev *dev = phy->dev;
363 struct {
364 u8 format_id;
developerbd9fa1e2023-10-16 11:04:00 +0800365@@ -3406,10 +3462,9 @@ int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len)
developera16be1f2022-12-14 13:09:20 +0800366 u8 _rsv;
367 } __packed req = {
368 .format_id = TX_POWER_LIMIT_INFO,
369- .category = RATE_POWER_INFO,
370+ .category = category,
371 .band_idx = phy->mt76->band_idx,
372 };
373- s8 txpower_sku[MT7915_SKU_RATE_NUM][2];
374 struct sk_buff *skb;
375 int ret, i;
376
developerbd9fa1e2023-10-16 11:04:00 +0800377@@ -3419,9 +3474,15 @@ int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len)
developera16be1f2022-12-14 13:09:20 +0800378 if (ret)
379 return ret;
380
381- memcpy(txpower_sku, skb->data + 4, sizeof(txpower_sku));
382- for (i = 0; i < len; i++)
383- txpower[i] = txpower_sku[i][req.band_idx];
384+ if (category == TX_POWER_INFO_RATE) {
385+ s8 res[MT7915_SKU_RATE_NUM][2];
386+
387+ memcpy(res, skb->data + 4, sizeof(res));
388+ for (i = 0; i < len; i++)
389+ txpower[i] = res[i][req.band_idx];
390+ } else if (category == TX_POWER_INFO_PATH) {
391+ memcpy(txpower, skb->data + 4, len);
392+ }
393
394 dev_kfree_skb(skb);
395
developerbd9fa1e2023-10-16 11:04:00 +0800396@@ -3463,9 +3524,18 @@ int mt7915_mcu_set_sku_en(struct mt7915_phy *phy, bool enable)
developera16be1f2022-12-14 13:09:20 +0800397 .band_idx = phy->mt76->band_idx,
398 .sku_enable = enable,
399 };
400+ int ret;
401+
402+ ret = mt76_mcu_send_msg(&dev->mt76,
403+ MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), &req,
404+ sizeof(req), true);
405+ if (ret)
406+ return ret;
407
408 pr_info("%s: enable = %d\n", __func__, enable);
409
410+ req.format_id = TX_POWER_LIMIT_PATH_ENABLE;
developerc5ce7502022-12-19 11:33:22 +0800411+
developera16be1f2022-12-14 13:09:20 +0800412 return mt76_mcu_send_msg(&dev->mt76,
413 MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), &req,
414 sizeof(req), true);
415diff --git a/mt7915/mcu.h b/mt7915/mcu.h
developerbd9fa1e2023-10-16 11:04:00 +0800416index 5fc4e2e..142bfc1 100644
developera16be1f2022-12-14 13:09:20 +0800417--- a/mt7915/mcu.h
418+++ b/mt7915/mcu.h
developer7af0f762023-05-22 15:16:16 +0800419@@ -502,12 +502,18 @@ enum {
developera16be1f2022-12-14 13:09:20 +0800420
421 enum {
422 TX_POWER_LIMIT_ENABLE,
423+ TX_POWER_LIMIT_PATH_ENABLE = 0x3,
424 TX_POWER_LIMIT_TABLE = 0x4,
425 TX_POWER_LIMIT_INFO = 0x7,
426 TX_POWER_LIMIT_FRAME = 0x11,
427 TX_POWER_LIMIT_FRAME_MIN = 0x12,
428 };
429
430+enum {
431+ TX_POWER_INFO_PATH = 1,
432+ TX_POWER_INFO_RATE,
433+};
434+
435 enum {
436 SPR_ENABLE = 0x1,
437 SPR_ENABLE_SD = 0x3,
438diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
developerbd9fa1e2023-10-16 11:04:00 +0800439index a3d7b4b..4dc3825 100644
developera16be1f2022-12-14 13:09:20 +0800440--- a/mt7915/mt7915.h
441+++ b/mt7915/mt7915.h
developer7af0f762023-05-22 15:16:16 +0800442@@ -72,6 +72,7 @@
developera16be1f2022-12-14 13:09:20 +0800443 #define MT7915_CDEV_THROTTLE_MAX 99
444
445 #define MT7915_SKU_RATE_NUM 161
446+#define MT7915_SKU_PATH_NUM 185
447
448 #define MT7915_MAX_TWT_AGRT 16
449 #define MT7915_MAX_STA_TWT_AGRT 8
developerbd9fa1e2023-10-16 11:04:00 +0800450@@ -572,7 +573,8 @@ int mt7915_mcu_set_test_param(struct mt7915_dev *dev, u8 param, bool test_mode,
developera16be1f2022-12-14 13:09:20 +0800451 int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band);
452 int mt7915_mcu_set_sku_en(struct mt7915_phy *phy, bool enable);
453 int mt7915_mcu_set_txpower_sku(struct mt7915_phy *phy);
454-int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len);
455+int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len,
456+ u8 category);
457 int mt7915_mcu_set_txpower_frame_min(struct mt7915_phy *phy, s8 txpower);
458 int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
459 struct ieee80211_vif *vif,
460--
developerbd9fa1e2023-10-16 11:04:00 +08004612.18.0
developera16be1f2022-12-14 13:09:20 +0800462