mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yi Cong <cong.yi@linux.dev>
To: nbd@nbd.name, lorenzo@kernel.org, ryder.lee@mediatek.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, shayne.chen@mediatek.com,
	sean.wang@mediatek.com, mingyen.hsieh@mediatek.com,
	emery.hsin@mediatek.com, Yi Cong <yicong@kylinos.cn>
Subject: [PATCH] wifi: mt76: mt7925: do not report resume failure after reset recovery
Date: Thu, 22 Oct 2026 16:51:00 +0800	[thread overview]
Message-ID: <20261022085100.132368-1-cong.yi@linux.dev> (raw)

From: Yi Cong <yicong@kylinos.cn>

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.

Signed-off-by: Yi Cong <yicong@kylinos.cn>
---
 drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
index 0d477dc1086c..82ee58eca78c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
@@ -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;
-- 
2.25.1


                 reply	other threads:[~2026-10-22  8:51 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=20261022085100.132368-1-cong.yi@linux.dev \
    --to=cong.yi@linux.dev \
    --cc=emery.hsin@mediatek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=mingyen.hsieh@mediatek.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=yicong@kylinos.cn \
    /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

all inboxes | Powered by JetHome®