[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241014085816.1401364-3-guanyulin@google.com>
Date: Mon, 14 Oct 2024 08:50:26 +0000
From: Guan-Yu Lin <guanyulin@...gle.com>
To: Thinh.Nguyen@...opsys.com, gregkh@...uxfoundation.org,
mathias.nyman@...el.com, stern@...land.harvard.edu, yajun.deng@...ux.dev,
sumit.garg@...aro.org, kekrby@...il.com, oneukum@...e.com,
dianders@...omium.org, perex@...ex.cz, tiwai@...e.com, niko.mauno@...sala.com,
andreyknvl@...il.com, christophe.jaillet@...adoo.fr, tj@...nel.org,
stanley_chang@...ltek.com, quic_jjohnson@...cinc.com, ricardo@...liere.net
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-sound@...r.kernel.org, badhri@...gle.com, albertccwang@...gle.com,
quic_wcheng@...cinc.com, pumahsu@...gle.com,
Guan-Yu Lin <guanyulin@...gle.com>
Subject: [PATCH v5 2/5] usb: xhci-plat: separate dev_pm_ops for each pm_event
Separate dev_pm_ops for different power events such as suspend, thaw,
and hibernation. This is crucial when xhci-plat driver needs to adapt
its behavior based on different power state changes.
Signed-off-by: Guan-Yu Lin <guanyulin@...gle.com>
---
drivers/usb/host/xhci-plat.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 8dc23812b204..6e49ef1908eb 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -450,7 +450,7 @@ void xhci_plat_remove(struct platform_device *dev)
}
EXPORT_SYMBOL_GPL(xhci_plat_remove);
-static int xhci_plat_suspend(struct device *dev)
+static int xhci_plat_suspend_common(struct device *dev, struct pm_message pmsg)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
@@ -478,6 +478,21 @@ static int xhci_plat_suspend(struct device *dev)
return 0;
}
+static int xhci_plat_suspend(struct device *dev)
+{
+ return xhci_plat_suspend_common(dev, PMSG_SUSPEND);
+}
+
+static int xhci_plat_freeze(struct device *dev)
+{
+ return xhci_plat_suspend_common(dev, PMSG_FREEZE);
+}
+
+static int xhci_plat_poweroff(struct device *dev)
+{
+ return xhci_plat_suspend_common(dev, PMSG_HIBERNATE);
+}
+
static int xhci_plat_resume_common(struct device *dev, struct pm_message pmsg)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
@@ -524,6 +539,11 @@ static int xhci_plat_resume(struct device *dev)
return xhci_plat_resume_common(dev, PMSG_RESUME);
}
+static int xhci_plat_thaw(struct device *dev)
+{
+ return xhci_plat_resume_common(dev, PMSG_THAW);
+}
+
static int xhci_plat_restore(struct device *dev)
{
return xhci_plat_resume_common(dev, PMSG_RESTORE);
@@ -553,9 +573,9 @@ static int __maybe_unused xhci_plat_runtime_resume(struct device *dev)
const struct dev_pm_ops xhci_plat_pm_ops = {
.suspend = pm_sleep_ptr(xhci_plat_suspend),
.resume = pm_sleep_ptr(xhci_plat_resume),
- .freeze = pm_sleep_ptr(xhci_plat_suspend),
- .thaw = pm_sleep_ptr(xhci_plat_resume),
- .poweroff = pm_sleep_ptr(xhci_plat_suspend),
+ .freeze = pm_sleep_ptr(xhci_plat_freeze),
+ .thaw = pm_sleep_ptr(xhci_plat_thaw),
+ .poweroff = pm_sleep_ptr(xhci_plat_poweroff),
.restore = pm_sleep_ptr(xhci_plat_restore),
SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend,
--
2.47.0.rc1.288.g06298d1525-goog
Powered by blists - more mailing lists