Skip to content

Commit

Permalink
mt76: mt7915: fix txpower init for TSSI off chips
Browse files Browse the repository at this point in the history
Fix incorrect txpower init value for TSSI off chips which causes
too small txpower.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
  • Loading branch information
csyuanc authored and nbd168 committed Apr 1, 2021
1 parent be1ab3b commit 4e22f0d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions mt7915/eeprom.c
Expand Up @@ -124,7 +124,7 @@ int mt7915_eeprom_get_target_power(struct mt7915_dev *dev,
struct ieee80211_channel *chan,
u8 chain_idx)
{
int index;
int index, target_power;
bool tssi_on;

if (chain_idx > 3)
Expand All @@ -133,15 +133,22 @@ int mt7915_eeprom_get_target_power(struct mt7915_dev *dev,
tssi_on = mt7915_tssi_enabled(dev, chan->band);

if (chan->band == NL80211_BAND_2GHZ) {
index = MT_EE_TX0_POWER_2G + chain_idx * 3 + !tssi_on;
index = MT_EE_TX0_POWER_2G + chain_idx * 3;
target_power = mt7915_eeprom_read(dev, index);

if (!tssi_on)
target_power += mt7915_eeprom_read(dev, index + 1);
} else {
int group = tssi_on ?
mt7915_get_channel_group(chan->hw_value) : 8;
int group = mt7915_get_channel_group(chan->hw_value);

index = MT_EE_TX0_POWER_5G + chain_idx * 12;
target_power = mt7915_eeprom_read(dev, index + group);

index = MT_EE_TX0_POWER_5G + chain_idx * 12 + group;
if (!tssi_on)
target_power += mt7915_eeprom_read(dev, index + 8);
}

return mt7915_eeprom_read(dev, index);
return target_power;
}

s8 mt7915_eeprom_get_power_delta(struct mt7915_dev *dev, int band)
Expand Down

0 comments on commit 4e22f0d

Please sign in to comment.