lkml.org 
[lkml]   [2021]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v9 1/5] usb: host: xhci: plat: Add suspend quirk for dwc3 controller
Date
During suspend check if any wakeup capable devices are connected to the
controller (directly or through hubs), and set the wakeup capable property
for xhci plat device.

Signed-off-by: Sandeep Maheswaram <quic_c_sanm@quicinc.com>
---
drivers/usb/host/xhci-plat.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c1edcc9..7ab272b 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -431,6 +431,14 @@ static int xhci_plat_remove(struct platform_device *dev)
return 0;
}

+static void xhci_dwc3_suspend_quirk(struct usb_hcd *hcd, struct device *dev)
+{
+ if (usb_wakeup_enabled_descendants(hcd->self.root_hub))
+ device_set_wakeup_capable(dev, true);
+ else
+ device_set_wakeup_capable(dev, false);
+}
+
static int __maybe_unused xhci_plat_suspend(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
@@ -440,6 +448,10 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)
ret = xhci_priv_suspend_quirk(hcd);
if (ret)
return ret;
+
+ if (of_device_is_compatible(dev->parent->of_node, "snps,dwc3"))
+ xhci_dwc3_suspend_quirk(hcd, dev);
+
/*
* xhci_suspend() needs `do_wakeup` to know whether host is allowed
* to do wakeup during suspend.
--
2.7.4
\
 
 \ /
  Last update: 2021-11-01 08:54    [W:0.124 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site