mirror of https://gitee.com/openkylin/linux.git
mt76x0: phy: use tssi reported value to configure tx power if available
Use tssi calibrated value to configure tx power gain if tssi is enabled in eeprom data Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
3548a9dd2d
commit
07e5485212
|
@ -135,9 +135,6 @@ static s8 mt76x0_get_delta(struct mt76x02_dev *dev)
|
|||
struct cfg80211_chan_def *chandef = &dev->mt76.chandef;
|
||||
u8 val;
|
||||
|
||||
if (mt76x0_tssi_enabled(dev))
|
||||
return 0;
|
||||
|
||||
if (chandef->width == NL80211_CHAN_WIDTH_80) {
|
||||
val = mt76x02_eeprom_get(dev, MT_EE_5G_TARGET_POWER) >> 8;
|
||||
} else if (chandef->width == NL80211_CHAN_WIDTH_40) {
|
||||
|
@ -160,8 +157,8 @@ void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev)
|
|||
struct ieee80211_channel *chan = dev->mt76.chandef.chan;
|
||||
bool is_2ghz = chan->band == NL80211_BAND_2GHZ;
|
||||
struct mt76_rate_power *t = &dev->mt76.rate_power;
|
||||
s8 delta = mt76x0_get_delta(dev);
|
||||
u16 val, addr;
|
||||
s8 delta;
|
||||
|
||||
memset(t, 0, sizeof(*t));
|
||||
|
||||
|
@ -211,6 +208,7 @@ void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev)
|
|||
t->vht[7] = s6_to_s8(val);
|
||||
t->vht[8] = s6_to_s8(val >> 8);
|
||||
|
||||
delta = mt76x0_tssi_enabled(dev) ? 0 : mt76x0_get_delta(dev);
|
||||
mt76x02_add_rate_power_offset(t, delta);
|
||||
}
|
||||
|
||||
|
@ -233,6 +231,20 @@ void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info)
|
|||
u16 data;
|
||||
int i;
|
||||
|
||||
if (mt76x0_tssi_enabled(dev)) {
|
||||
s8 target_power;
|
||||
|
||||
if (chan->band == NL80211_BAND_5GHZ)
|
||||
data = mt76x02_eeprom_get(dev, MT_EE_5G_TARGET_POWER);
|
||||
else
|
||||
data = mt76x02_eeprom_get(dev, MT_EE_2G_TARGET_POWER);
|
||||
target_power = (data & 0xff) - dev->mt76.rate_power.ofdm[7];
|
||||
info[0] = target_power + mt76x0_get_delta(dev);
|
||||
info[1] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(chan_map); i++) {
|
||||
if (chan_map[i].chan <= chan->hw_value) {
|
||||
offset = chan_map[i].offset;
|
||||
|
|
|
@ -847,8 +847,8 @@ void mt76x0_phy_set_txpower(struct mt76x02_dev *dev)
|
|||
struct mt76_rate_power *t = &dev->mt76.rate_power;
|
||||
u8 info[2];
|
||||
|
||||
mt76x0_get_power_info(dev, info);
|
||||
mt76x0_get_tx_power_per_rate(dev);
|
||||
mt76x0_get_power_info(dev, info);
|
||||
|
||||
mt76x02_add_rate_power_offset(t, info[0]);
|
||||
mt76x02_limit_rate_power(t, dev->mt76.txpower_conf);
|
||||
|
|
Loading…
Reference in New Issue