[PATCH 4/4] wifi: mt76: mt7615: restart mac_work when runtime PM is disabled

From: Ryan Brue

Date: Mon Nov 30 2026 - 12:34:42 EST


With runtime PM enabled, mt76_connac_power_save_sched() cancels the
pending mac_work on every activity while the chip is awake, and only
mt7615_pm_wake_work() queues it again. Disabling runtime PM through
debugfs while the chip is awake leaves it cancelled: mt76_connac_pm_wake()
has nothing to wake, so nothing queues mac_work, and the channel survey,
MIB counters, SCS and the tx status timeout stay stopped until the next
channel change, start or resume.

Queue mac_work when runtime PM is turned off.

On an mt7663s, counting mt7615_mac_work in a function trace of an idle
link - 26 runs in 3 s with runtime PM off, none in 5 s with it on, and
none after switching it off again until a reconnect changed the channel.
With this change, 26-27 runs in 3 s right after switching it off
(immediately after enabling it, and after 5 s of it).

Fixes: b1bd7bb8121d ("mt76: connac: unschedule mac_work before going to sleep")
Signed-off-by: Ryan Brue <ryanbrue.dev@xxxxxxxxx>
---
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
index 83cffa94bc0e..630f29069aa0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
@@ -127,6 +127,13 @@ mt7615_pm_set(void *data, u64 val)

pm->enable = val;
mt76_connac_power_save_sched(&dev->mphy, pm);
+
+ /* With runtime PM on, mac_work is cancelled on activity and queued
+ * again only on wakeup: restart it when runtime PM goes off.
+ */
+ if (!val && test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
+ ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
+ mt7615_get_macwork_timeout(dev));
out:
mutex_unlock(&dev->mt76.mutex);


--
2.56.1