public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucid Duck <lucid_duck@justthetip.ca>
To: linux-wireless@vger.kernel.org
Cc: Felix Fietkau <nbd@nbd.name>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Lucid Duck <lucid_duck@justthetip.ca>
Subject: [PATCH] wifi: mt76: connac: fix txpower_cur not being updated
Date: Sun, 25 Jan 2026 14:22:35 -0800	[thread overview]
Message-ID: <20260125222235.36565-1-lucid_duck@justthetip.ca> (raw)

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


             reply	other threads:[~2026-01-25 22:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-25 22:22 Lucid Duck [this message]
2026-01-27  1:59 ` [PATCH] wifi: mt76: connac: fix txpower_cur not being updated 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260125222235.36565-1-lucid_duck@justthetip.ca \
    --to=lucid_duck@justthetip.ca \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox