developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame^] | 1 | From 723c1353c7d50c962285c22579770b6aeb37b3ca Mon Sep 17 00:00:00 2001 |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 2 | From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| 3 | Date: Sat, 29 Jul 2023 04:53:47 +0800 |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 04/14] wifi: mt76: mt7915: fix txpower issues |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 5 | |
| 6 | --- |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 7 | eeprom.c | 2 +- |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 8 | mt7915/debugfs.c | 48 ++++++++++++++++++++++++++---------------------- |
developer | f0fd705 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 9 | mt7915/main.c | 1 + |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 10 | 3 files changed, 28 insertions(+), 23 deletions(-) |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 11 | |
| 12 | diff --git a/eeprom.c b/eeprom.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame^] | 13 | index 0bc66cc1..ecd09c03 100644 |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 14 | --- a/eeprom.c |
| 15 | +++ b/eeprom.c |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 16 | @@ -343,7 +343,7 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy, |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 17 | 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) |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 25 | diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame^] | 26 | index 6c3696c8..93e549c3 100644 |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 27 | --- a/mt7915/debugfs.c |
| 28 | +++ b/mt7915/debugfs.c |
| 29 | @@ -950,9 +950,9 @@ mt7915_xmit_queues_show(struct seq_file *file, void *data) |
| 30 | |
| 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"); \ |
| 41 | @@ -994,43 +994,47 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf, |
| 42 | 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); |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 109 | diff --git a/mt7915/main.c b/mt7915/main.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame^] | 110 | index e61041d0..1903db4f 100644 |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 111 | --- a/mt7915/main.c |
| 112 | +++ b/mt7915/main.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame^] | 113 | @@ -1080,6 +1080,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 114 | 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 | |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 121 | -- |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 122 | 2.18.0 |
developer | c879603 | 2023-08-09 10:28:15 +0800 | [diff] [blame] | 123 | |