Search Linux Wireless

[PATCH v2 2/5] wifi: mt76: mt7921: fix returned txpower

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This bug was noticed by me and confirmed by many more people using this
chipset with openwrt: https://github.com/openwrt/mt76/issues/783

It seems that for this particular chipset the mt76_phy->txpower_cur is
never set, like in the case of other chipsets like mt7603, mt7615, etc.

The driver is correctly calculating the TX power adjustment based on the
number of antennas. However, the base TX power (phy->txpower_cur) is not
being properly initialized or set to a meaningful value. It's starting
at 0, so the final result is just the antenna gain compensation divided
by 2.

Signed-off-by: Razvan Grigore <razvan.grigore@xxxxxxxxxxxxxx>
---
 drivers/net/wireless/mediatek/mt76/mt7921/main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 13e58c328aff..9e8961533fd1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -1251,6 +1251,8 @@ int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
 			  const struct cfg80211_sar_specs *sar)
 {
 	struct mt76_phy *mphy = hw->priv;
+	int tx_power;
+	struct mt76_power_limits limits_array;
 
 	if (sar) {
 		int err = mt76_init_sar_power(hw, sar);
@@ -1260,6 +1262,11 @@ int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
 	}
 	mt792x_init_acpi_sar_power(mt792x_hw_phy(hw), !sar);
 
+	tx_power = mt76_get_power_bound(mphy, hw->conf.power_level);
+	tx_power = mt76_get_rate_power_limits(mphy, mphy->chandef.chan,
+					      &limits_array, tx_power);
+	mphy->txpower_cur = tx_power;
+
 	return mt76_connac_mcu_set_rate_txpower(mphy);
 }
 
-- 
2.34.1





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux