[v15 2/6] usb: host: xhci-plat: Enable wakeup based on children wakeup status

From: Krishna Kurapati
Date: Thu May 05 2022 - 04:56:56 EST


device_wakeup_path() tells if any of the children devices needs
wakeup. Use this hint to enable/disable wakeup of our device. This
helps the parent device of xhci-plat (like sysdev) to retrieve
the wakeup setting via device_wakeup_path().

Signed-off-by: Krishna Kurapati <quic_kriskura@xxxxxxxxxxx>
---
drivers/usb/host/xhci-plat.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 649ffd8..ad585fa 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -415,6 +415,14 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)
if (pm_runtime_suspended(dev))
pm_runtime_resume(dev);

+ if (device_wakeup_path(dev)) {
+ if (!device_may_wakeup(dev))
+ device_wakeup_enable(dev);
+ } else {
+ if (device_may_wakeup(dev))
+ device_wakeup_disable(dev);
+ }
+
ret = xhci_priv_suspend_quirk(hcd);
if (ret)
return ret;
--
2.7.4