Skip to contentSkip to conversation

wifi: mt76: mt7925: do not report resume failure after reset recovery

PATCH New Yi Cong 1 participant 1 message Oct 22

Subsystems (2)
lore
Share & tools
lore

Yi Cong

author
#0 lore raw

PATCH 1/1 wifi: mt76: mt7925: do not report resume failure after reset recovery

From: Yi Cong <[email protected]>

When the firmware loses its state over suspend-to-RAM, e.g. on platforms that cut PCIe auxiliary power, the HIF resume handshake on the resume path always times out. The mt792x_reset() fallback already recovers the device with a full reinitialization, just like the hibernate restore path:

commit d54424fbc53b4 ("wifi: mt76: mt7925: add pci restore for hibernate")

Yet the callback still returns -ETIMEDOUT, so the PM core reports a resume failure for an already recovered device on every resume:

mt7925e 0000:12:00.0: PM: dpm_run_callback(): pci_pm_resume returns -110 mt7925e 0000:12:00.0: PM: failed to resume async: error -110

Report success instead once the reset fallback is scheduled, and skip the follow-up commands that the reloaded firmware cannot answer. Platforms whose firmware survives suspend are unaffected.

---
 drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/pci.c +5 -2
index 0d477dc1086c..82ee58eca78c 100644
@@ -886,6 +886,7 @@ static int _mt7925_pci_resume(struct device *device, bool restore)
 	struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
 	struct mt76_connac_pm *pm = &dev->pm;
 	int i, err, ret;
+	bool hif_timeout = false;
 
 	dev->hif_idle = false;
 	err = mt792x_mcu_drv_pmctrl(dev);
@@ -927,7 +928,9 @@ static int _mt7925_pci_resume(struct device *device, bool restore)
 	ret = wait_event_timeout(dev->wait,
 				 dev->hif_resumed, 3 * HZ);
 	if (!ret) {
-		err = -ETIMEDOUT;
+		hif_timeout = true;
+		dev_info(mdev->dev,
+			 "HIF resume handshake timed out, recovering through reset\n");
 		goto failed;
 	}
 
@@ -939,7 +942,7 @@ static int _mt7925_pci_resume(struct device *device, bool restore)
 failed:
 	pm->suspended = false;
 
-	if (err < 0 || restore)
+	if (err < 0 || restore || hif_timeout)
 		mt792x_reset(&dev->mt76);
 
 	return err;
Signature · 1 line
2.25.1