mt76: mt7663: fix target power parsing
Fix target parsing from eeprom/efuse partition for 7663 chipsets Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
9582d5bdef
commit
e0ec633d76
@ -156,12 +156,37 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
|
||||
dev->phy.chainmask = dev->chainmask;
|
||||
}
|
||||
|
||||
int mt7615_eeprom_get_power_index(struct mt7615_dev *dev,
|
||||
struct ieee80211_channel *chan,
|
||||
u8 chain_idx)
|
||||
static int mt7663_eeprom_get_target_power_index(struct mt7615_dev *dev,
|
||||
struct ieee80211_channel *chan,
|
||||
u8 chain_idx)
|
||||
{
|
||||
int index, group;
|
||||
|
||||
if (chain_idx > 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (chan->band == NL80211_BAND_2GHZ)
|
||||
return MT7663_EE_TX0_2G_TARGET_POWER + (chain_idx << 4);
|
||||
|
||||
group = mt7615_get_channel_group(chan->hw_value);
|
||||
if (chain_idx == 1)
|
||||
index = MT7663_EE_TX1_5G_G0_TARGET_POWER;
|
||||
else
|
||||
index = MT7663_EE_TX0_5G_G0_TARGET_POWER;
|
||||
|
||||
return index + group * 3;
|
||||
}
|
||||
|
||||
int mt7615_eeprom_get_target_power_index(struct mt7615_dev *dev,
|
||||
struct ieee80211_channel *chan,
|
||||
u8 chain_idx)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (is_mt7663(&dev->mt76))
|
||||
return mt7663_eeprom_get_target_power_index(dev, chan,
|
||||
chain_idx);
|
||||
|
||||
if (chain_idx > 3)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -34,12 +34,14 @@ enum mt7615_eeprom_field {
|
||||
MT_EE_TX1_5G_G0_TARGET_POWER = 0x098,
|
||||
MT_EE_2G_RATE_POWER = 0x0be,
|
||||
MT_EE_5G_RATE_POWER = 0x0d5,
|
||||
MT7663_EE_TX0_2G_TARGET_POWER = 0x0e3,
|
||||
MT_EE_EXT_PA_2G_TARGET_POWER = 0x0f2,
|
||||
MT_EE_EXT_PA_5G_TARGET_POWER = 0x0f3,
|
||||
MT7663_EE_TX0_2G_TARGET_POWER = 0x123,
|
||||
MT_EE_TX2_5G_G0_TARGET_POWER = 0x142,
|
||||
MT_EE_TX3_5G_G0_TARGET_POWER = 0x16a,
|
||||
MT7663_EE_HW_CONF1 = 0x1b0,
|
||||
MT7663_EE_TX0_5G_G0_TARGET_POWER = 0x245,
|
||||
MT7663_EE_TX1_5G_G0_TARGET_POWER = 0x2b5,
|
||||
|
||||
MT7615_EE_MAX = 0x3bf,
|
||||
MT7622_EE_MAX = 0x3db,
|
||||
|
@ -237,7 +237,11 @@ void mt7615_init_txpower(struct mt7615_dev *dev,
|
||||
(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;
|
||||
if (!is_mt7663(&dev->mt76) && mt7615_ext_pa_enabled(dev, band))
|
||||
target_chains = 1;
|
||||
else
|
||||
target_chains = n_chains;
|
||||
|
||||
for (i = 0; i < sband->n_channels; i++) {
|
||||
struct ieee80211_channel *chan = &sband->channels[i];
|
||||
u8 target_power = 0;
|
||||
@ -246,7 +250,7 @@ void mt7615_init_txpower(struct mt7615_dev *dev,
|
||||
for (j = 0; j < target_chains; j++) {
|
||||
int index;
|
||||
|
||||
index = mt7615_eeprom_get_power_index(dev, chan, j);
|
||||
index = mt7615_eeprom_get_target_power_index(dev, chan, j);
|
||||
if (index < 0)
|
||||
continue;
|
||||
|
||||
|
@ -377,9 +377,9 @@ void mt7615_unregister_device(struct mt7615_dev *dev);
|
||||
int mt7615_register_ext_phy(struct mt7615_dev *dev);
|
||||
void mt7615_unregister_ext_phy(struct mt7615_dev *dev);
|
||||
int mt7615_eeprom_init(struct mt7615_dev *dev, u32 addr);
|
||||
int mt7615_eeprom_get_power_index(struct mt7615_dev *dev,
|
||||
struct ieee80211_channel *chan,
|
||||
u8 chain_idx);
|
||||
int mt7615_eeprom_get_target_power_index(struct mt7615_dev *dev,
|
||||
struct ieee80211_channel *chan,
|
||||
u8 chain_idx);
|
||||
int mt7615_wait_pdma_busy(struct mt7615_dev *dev);
|
||||
int mt7615_dma_init(struct mt7615_dev *dev);
|
||||
void mt7615_dma_cleanup(struct mt7615_dev *dev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user