Skip to content

Commit bcb0f68

Browse files
LorenzoBianconiKalle Valo
authored andcommitted
mt76x2: fix tx_alc_enabled check
Fix mt76x2_temp_tx_alc_enabled routine since in order to enable tx_alc temperature compensation it necessary to take into account BIT(15) of MT_EE_TX_POWER_EXT_PA_5G eeprom info Fixes: 7bc0421 ("mt76: add driver code for MT76x2e") Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent cf7b411 commit bcb0f68

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -609,17 +609,13 @@ int mt76x2_get_temp_comp(struct mt76x2_dev *dev, struct mt76x2_temp_comp *t)
609609

610610
memset(t, 0, sizeof(*t));
611611

612-
val = mt76x2_eeprom_get(dev, MT_EE_NIC_CONF_1);
613-
if (!(val & MT_EE_NIC_CONF_1_TEMP_TX_ALC))
612+
if (!mt76x2_temp_tx_alc_enabled(dev))
614613
return -EINVAL;
615614

616615
if (!mt76x2_ext_pa_enabled(dev, band))
617616
return -EINVAL;
618617

619618
val = mt76x2_eeprom_get(dev, MT_EE_TX_POWER_EXT_PA_5G) >> 8;
620-
if (!(val & BIT(7)))
621-
return -EINVAL;
622-
623619
t->temp_25_ref = val & 0x7f;
624620
if (band == NL80211_BAND_5GHZ) {
625621
slope = mt76x2_eeprom_get(dev, MT_EE_RF_TEMP_COMP_SLOPE_5G);

drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ void mt76x2_read_rx_gain(struct mt76x2_dev *dev);
159159
static inline bool
160160
mt76x2_temp_tx_alc_enabled(struct mt76x2_dev *dev)
161161
{
162+
u16 val;
163+
164+
val = mt76x2_eeprom_get(dev, MT_EE_TX_POWER_EXT_PA_5G);
165+
if (!(val & BIT(15)))
166+
return false;
167+
162168
return mt76x2_eeprom_get(dev, MT_EE_NIC_CONF_1) &
163169
MT_EE_NIC_CONF_1_TEMP_TX_ALC;
164170
}

0 commit comments

Comments
 (0)