[PATCH 06/18] wifi: mt76: mt7925: add MT7927 power management, DBDC, and CNM fixes
Javier Tia
floss at jetm.me
Fri Mar 6 16:33:25 PST 2026
Three MT7927-specific fixes for WiFi functionality:
1. Disable runtime PM: Every CLR_OWN triggers the ROM to reinitialize
WFDMA, destroying DMA ring configuration. Disable PM until the wake
path properly handles MT7927.
2. Enable DBDC (dual-band): MT7927 firmware defaults to single-band
(2.4GHz only). MT7925 firmware handles DBDC automatically, but
MT7927 requires an explicit MCU_UNI_CMD(SET_DBDC_PARMS) with
mbmc_en=1. Without this, 5GHz scan requests are silently discarded.
3. Force CNM capability: MT7927 firmware lacks the connac2 feature
trailer, causing mt792x_get_mac80211_ops() to replace channel
context operations with emulated stubs. This prevents ROC (remain
on channel) before authentication, causing auth frames to be
silently dropped. Force the CNM flag and restore mt7925_ops.
Tested-by: Marcin FM <marcin at lgic.pl>
Tested-by: Cristian-Florin Radoi <radoi.chris at gmail.com>
Tested-by: George Salukvadze <giosal90 at gmail.com>
Tested-by: Evgeny Kapusta <3193631 at gmail.com>
Tested-by: Samu Toljamo <samu.toljamo at gmail.com>
Tested-by: Ariel Rosenfeld <ariel.rosenfeld.750 at gmail.com>
Tested-by: Chapuis Dario <chapuisdario4 at gmail.com>
Tested-by: Thibaut François <tibo at humeurlibre.fr>
Tested-by: 张旭涵 <Loong.0x00 at gmail.com>
Signed-off-by: Javier Tia <floss at jetm.me>
---
drivers/net/wireless/mediatek/mt76/mt7925/init.c | 17 ++++++++++++++++-
drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 10 ++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/init.c b/drivers/net/wireless/mediatek/mt76/mt7925/init.c
index 3ce5d6fcc69d..1e9eadca3988 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/init.c
@@ -115,6 +115,18 @@ static int __mt7925_init_hardware(struct mt792x_dev *dev)
if (ret)
goto out;
+ /* MT7927: Enable DBDC (dual-band) mode. Without this, firmware
+ * defaults to 2.4GHz only and ignores 5GHz scan requests.
+ * MT7925 firmware handles DBDC automatically. */
+ if (is_mt7927(&dev->mt76)) {
+ ret = mt7925_mcu_set_dbdc(&dev->mphy, true);
+ if (ret) {
+ dev_warn(dev->mt76.dev,
+ "MT7927 DBDC enable failed: %d\n", ret);
+ ret = 0;
+ }
+ }
+
out:
return ret;
}
@@ -230,7 +242,10 @@ int mt7925_register_device(struct mt792x_dev *dev)
dev->pm.idle_timeout = MT792x_PM_TIMEOUT;
dev->pm.stats.last_wake_event = jiffies;
dev->pm.stats.last_doze_event = jiffies;
- if (!mt76_is_usb(&dev->mt76)) {
+ /* MT7927: disable power management. Every CLR_OWN triggers the
+ * ROM to reinitialize WFDMA, destroying DMA ring configuration.
+ * Keep the device awake until the PM wake path handles MT7927. */
+ if (!mt76_is_usb(&dev->mt76) && !is_mt7927(&dev->mt76)) {
dev->pm.enable_user = true;
dev->pm.enable = true;
dev->pm.ds_enable_user = true;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
index ca9ccfe9975c..dce9f30b68d7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
@@ -527,6 +527,16 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
goto err_free_pci_vec;
}
+ /* MT7927 firmware lacks the connac2 feature trailer, so
+ * mt792x_get_mac80211_ops() can't detect CNM support and
+ * replaces chanctx/ROC/mgd_prepare_tx ops with stubs.
+ * Force CNM and restore the original mt7925 ops. */
+ if ((pdev->device == 0x6639 || pdev->device == 0x7927) &&
+ !(features & MT792x_FW_CAP_CNM)) {
+ features |= MT792x_FW_CAP_CNM;
+ memcpy(ops, &mt7925_ops, sizeof(*ops));
+ }
+
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), ops, &drv_ops);
if (!mdev) {
ret = -ENOMEM;
--
2.53.0
More information about the Linux-mediatek
mailing list