[PATCH v3 1/7] mei: mei-me: resume device in prepare

Alan Previn alan.previn.teres.alexis at intel.com
Wed Dec 21 23:06:22 UTC 2022


From: Alexander Usyskin <alexander.usyskin at intel.com>

Async runtime resume is not possible while system is suspending.
The power management subsystem resumes device only in the
suspend phase, not in the prepare phase.
Force resume device in prepare to allow drivers on mei bus
to communicate in prepare callbacks.

Signed-off-by: Alexander Usyskin <alexander.usyskin at intel.com>
---
 drivers/misc/mei/pci-me.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 704cd0caa172..713c1acb931f 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -340,6 +340,12 @@ static void mei_me_remove(struct pci_dev *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
+static int mei_me_pci_prepare(struct device *device)
+{
+	pm_runtime_resume(device);
+	return 0;
+}
+
 static int mei_me_pci_suspend(struct device *device)
 {
 	struct pci_dev *pdev = to_pci_dev(device);
@@ -396,6 +402,11 @@ static int mei_me_pci_resume(struct device *device)
 
 	return 0;
 }
+
+static void mei_me_pci_complete(struct device *device)
+{
+	pm_runtime_suspend(device);
+}
 #endif /* CONFIG_PM_SLEEP */
 
 #ifdef CONFIG_PM
@@ -499,6 +510,8 @@ static inline void mei_me_unset_pm_domain(struct mei_device *dev)
 }
 
 static const struct dev_pm_ops mei_me_pm_ops = {
+	.prepare = mei_me_pci_prepare,
+	.complete = mei_me_pci_complete,
 	SET_SYSTEM_SLEEP_PM_OPS(mei_me_pci_suspend,
 				mei_me_pci_resume)
 	SET_RUNTIME_PM_OPS(
-- 
2.34.1



More information about the dri-devel mailing list