public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: mt76: connac: fix txpower_cur not being updated
@ 2026-01-25 22:22 Lucid Duck
  2026-01-27  1:59 ` Nick
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Lucid Duck @ 2026-01-25 22:22 UTC (permalink / raw)
  To: linux-wireless; +Cc: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Lucid Duck

The mt76_connac_mcu_set_rate_txpower() function sends TX power settings
to the firmware but never updates phy->txpower_cur. This causes
mt76_get_txpower() to return stale or incorrect values (typically
showing 3 dBm regardless of actual transmit power) when userspace
queries TX power via nl80211.

This affects MT7921 and other connac-based devices. Users observe:
  $ iw dev wlan0 info
  ...
  txpower 3.00 dBm

The firmware receives and applies the correct power level, but the
reported value is wrong because txpower_cur is never set.

Fix by updating phy->txpower_cur after successfully configuring TX
power, matching the behavior of other mt76 drivers like mt7915.

Signed-off-by: Lucid Duck <lucid_duck@justthetip.ca>
---
 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index 045771228..7cd357419 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -2251,7 +2251,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
 
 int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy)
 {
-	int err;
+	int err, tx_power;
 
 	if (phy->cap.has_2ghz) {
 		err = mt76_connac_mcu_rate_txpower_band(phy,
@@ -2272,6 +2272,12 @@ int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy)
 			return err;
 	}
 
+	/* Update txpower_cur for accurate reporting via nl80211 */
+	tx_power = 2 * phy->hw->conf.power_level;
+	if (!tx_power)
+		tx_power = 127;
+	phy->txpower_cur = tx_power;
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_rate_txpower);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-03-21  8:58 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-25 22:22 [PATCH] wifi: mt76: connac: fix txpower_cur not being updated Lucid Duck
2026-01-27  1:59 ` Nick
2026-01-27 12:21 ` Felix Fietkau
2026-01-27 16:17   ` Bitterblue Smith
2026-01-27 17:00     ` Felix Fietkau
2026-01-30 21:54 ` [PATCH v2] wifi: mt76: mt7921: fix txpower reporting Lucid Duck
2026-02-10  3:02   ` Nick
2026-02-12  2:46     ` Lucid Duck
2026-03-09 21:50   ` Lucid Duck
2026-03-12  6:38     ` Sean Wang
2026-03-17 17:30       ` [PATCH v3 0/1] wifi: mt76: mt7921: fix txpower reporting from rate power configuration Lucid Duck
2026-03-17 17:30         ` [PATCH v3 1/1] " Lucid Duck
2026-03-17 21:51           ` Lucid Duck
2026-03-19  6:00           ` Sean Wang
2026-03-19 20:38             ` [PATCH v4] " Lucid Duck
2026-03-20  1:17               ` Lucid Duck
2026-03-20  6:34                 ` Greg KH
2026-03-21  8:58               ` Sean Wang
2026-01-30 21:58 ` [PATCH v2] wifi: mt76: mt7921: fix txpower reporting Lucid Duck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox