wifi: mt76: mt7921: add pci restore for hibernate
Subsystems (3)
PATCH 1/1 wifi: mt76: mt7921: add pci restore for hibernate
Hibernation powers the device off and on. On resume the generic restore path runs the normal resume sequence and can time out waiting for the hif-suspend MCU handshake:
mt7921e 0000:03:00.0: Message 00020007 (seq 12) timeout mt7921e 0000:03:00.0: PM: dpm_run_callback(): pci_pm_restore returns -110
Add a dedicated .restore callback, mirroring mt7925, which skips the handshake, resets the device and returns it to its pre-hibernate state.
Tested on MEDIATEK MT7922 (14c3:7922) on kernel 6.12.113.
Signed-off-by Hedi Ben Hamida <[email protected]>
--- .../net/wireless/mediatek/mt76/mt7921/pci.c | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +23 -3
@@ -549,7 +549,7 @@ static int mt7921_pci_suspend(struct device *device)return err; } -static int mt7921_pci_resume (struct device *device) +static int _mt7921_pci_resume (struct device *device,bool restore) {struct pci_dev *pdev =to_pci_dev (device);struct mt76_dev *mdev =pci_get_drvdata (pdev);
@@ -589,6 +589,9 @@ static int mt7921_pci_resume(struct device *device)napi_schedule (&mdev->tx_napi);local_bh_enable (); +if (restore) + goto failed; +/* restore previous ds setting */ if (!pm->ds_enable)mt76_connac_mcu_set_deep_sleep (&dev->mt76, false);
@@ -602,7 +605,7 @@ static int mt7921_pci_resume(struct device *device) failed: pm->suspended = false; -if (err <0 ) +if (err <0 || restore)mt792x_reset (&dev->mt76);return err;
@@ -715,7 +718,24 @@ static void mt7921_pci_shutdown(struct pci_dev *pdev)mt7921_pci_remove (pdev); } -static DEFINE_SIMPLE_DEV_PM_OPS(mt7921_pm_ops, mt7921_pci_suspend, mt7921_pci_resume); +static int mt7921_pci_resume (struct device *device) +{ +return _mt7921_pci_resume (device, false); +} + +static int mt7921_pci_restore (struct device *device) +{ +return _mt7921_pci_resume (device, true); +} + +static const struct dev_pm_ops mt7921_pm_ops = { + .suspend =pm_sleep_ptr (mt7921_pci_suspend), + .resume =pm_sleep_ptr (mt7921_pci_resume), + .freeze =pm_sleep_ptr (mt7921_pci_suspend), + .thaw =pm_sleep_ptr (mt7921_pci_resume), + .poweroff =pm_sleep_ptr (mt7921_pci_suspend), + .restore =pm_sleep_ptr (mt7921_pci_restore), +};static struct pci_driver mt7921_pci_driver = { .name =KBUILD_MODNAME ,
Signature · 1 line
2.47.3