From: "Niels Lüttge" <niels@luettge.info>
To: <nbd@nbd.name>, <lorenzo@kernel.org>, <sean.wang@mediatek.com>
Cc: <linux-wireless@vger.kernel.org>, <linux-mediatek@lists.infradead.org>
Subject: [PATCH] wifi: mt76: mt7921: handle BSS_CHANGED_TXPOWER and update txpower_cur
Date: Thu, 19 Nov 2026 20:57:33 +0100 [thread overview]
Message-ID: <006901dd7860$37a75690$a6f603b0$@luettge.info> (raw)
[-- Attachment #1: Type: text/plain, Size: 1810 bytes --]
Hi!
Currently, mt7921 ignores BSS_CHANGED_TXPOWER in mt7921_bss_info_changed(),
so runtime TX power limits configured via nl80211/iw (e.g. "iw dev <if>
set txpower limit <mbm>") have no effect in AP or STA mode.
On hardware like MT7922, running at the full regulatory limit (e.g. 23 dBm)
pushes tmac values above the EEPROM calibration limits visible in
txpower_sku. This causes PA overdrive/saturation, severe throughput
degradation, and thermal overheatingwhich eventually wedges the firmware
and driver (MCU timeouts) so badly that only a hard reboot / power cycle
can recover the device, with no way for users or hostapd to reduce TX
power at runtime.
Furthermore, mt76_connac_mcu_rate_txpower_band() never updates
phy->txpower_cur, causing mt76_get_txpower() ("iw dev <if> info") to
always report a static 3.00 dBm regardless of the actual configured
TX power.
Fix both issues by:
1. Handling BSS_CHANGED_TXPOWER in mt7921_bss_info_changed(), refreshing
the CLC country power table via mt7921_mcu_set_clc() before calling
mt76_connac_mcu_set_rate_txpower() so both downward and upward runtime
TX power adjustments take effect immediately on MT7921/MT7922 firmware.
2. Updating phy->txpower_cur in mt76_connac_mcu_rate_txpower_band().
Tested on:
- Hardware: Compulab fitlet2 with MediaTek MT7922 (RZ616, PCIe 14c3:0616)
- Mode: 5 GHz 80 MHz AP mode (hostapd, regdom DE)
- Kernel: Linux 7.0.0 (also verified on 6.8.0)
- Firmware: WM Firmware Build 20250523103234 (and 20231120)
- OS: Linux Mint 22.3
Analyzed and fixed with AI support.
Tested on MT7922 (PCIe) in 5 GHz 80 MHz AP mode.
Best regards,
Niels
---------------------------------------------
Niels Luettge
mailto:niels@luettge.info
---------------------------------------------
[-- Attachment #2: mt7921-txpower-fix-upstream.patch --]
[-- Type: application/octet-stream, Size: 878 bytes --]
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -719,6 +719,12 @@
if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED))
mt7921_mcu_set_tx(dev, vif);
+ if (changed & BSS_CHANGED_TXPOWER) {
+ hw->conf.power_level = info->txpower > 0 ? info->txpower : 0;
+ mt7921_mcu_set_clc(dev, dev->mt76.alpha2, dev->country_ie_env);
+ mt76_connac_mcu_set_rate_txpower(&dev->mphy);
+ }
+
if (changed & BSS_CHANGED_PS)
mt7921_mcu_uni_bss_ps(dev, vif);
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -2179,6 +2179,7 @@
tx_power = 2 * phy->hw->conf.power_level;
if (!tx_power)
tx_power = 127;
+ phy->txpower_cur = tx_power;
if (band == NL80211_BAND_2GHZ) {
n_chan = ARRAY_SIZE(chan_list_2ghz);
reply other threads:[~2026-11-19 19:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='006901dd7860$37a75690$a6f603b0$@luettge.info' \
--to=niels@luettge.info \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=sean.wang@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