diff options
author | Felix Fietkau <nbd@nbd.name> | 2020-04-29 14:34:23 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2020-05-12 19:52:33 +0200 |
commit | 89f8bc6a344b2b786210a4045256346b3f8f6c4c (patch) | |
tree | 44458458555bb2db2d1f430b9d15fe5da2974226 /drivers/net/wireless/mediatek/mt76/mt7615/init.c | |
parent | 801f809aeeb127736a1f871dc21c800382afc4d2 (diff) | |
download | lwn-89f8bc6a344b2b786210a4045256346b3f8f6c4c.tar.gz lwn-89f8bc6a344b2b786210a4045256346b3f8f6c4c.zip |
mt76: mt7615: fix getting maximum tx power from eeprom
On top of the EEPROM target power, each rate can also has a power offset.
On many devices, this power offset is used to boost the tx power of lower
rates. Take this into account when parsing rate power.
The assumption here is, that the first rate (OFDM 6M or CCK 1M) has the
highest tx power
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7615/init.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/init.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index 9880643888ba..7e201525305b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -198,6 +198,17 @@ void mt7615_init_txpower(struct mt7615_dev *dev, u8 *eep = (u8 *)dev->mt76.eeprom.data; enum nl80211_band band = sband->band; int delta = mt76_tx_power_nss_delta(n_chains); + u8 rate_val; + + /* assume the first rate has the highest power offset */ + if (band == NL80211_BAND_2GHZ) + rate_val = eep[MT_EE_2G_RATE_POWER]; + else + rate_val = eep[MT_EE_5G_RATE_POWER]; + + if ((rate_val & ~MT_EE_RATE_POWER_MASK) == + (MT_EE_RATE_POWER_EN | MT_EE_RATE_POWER_SIGN)) + delta += rate_val & MT_EE_RATE_POWER_MASK; target_chains = mt7615_ext_pa_enabled(dev, band) ? 1 : n_chains; for (i = 0; i < sband->n_channels; i++) { |