Skip to content

Commit 835e424

Browse files
shimodaygregkh
authored andcommitted
usb: host: xhci-plat: enable clk in resume timing
This patch enables the clk in resume timing when device_may_wakeup() is false. Otherwise, kernel panic happens when R-Car resumes the system from Suspend-to-RAM because the clk is disabled. Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b0c69b4 commit 835e424

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/usb/host/xhci-plat.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ static int xhci_plat_suspend(struct device *dev)
347347
{
348348
struct usb_hcd *hcd = dev_get_drvdata(dev);
349349
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
350+
int ret;
350351

351352
/*
352353
* xhci_suspend() needs `do_wakeup` to know whether host is allowed
@@ -356,14 +357,22 @@ static int xhci_plat_suspend(struct device *dev)
356357
* reconsider this when xhci_plat_suspend enlarges its scope, e.g.,
357358
* also applies to runtime suspend.
358359
*/
359-
return xhci_suspend(xhci, device_may_wakeup(dev));
360+
ret = xhci_suspend(xhci, device_may_wakeup(dev));
361+
362+
if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk))
363+
clk_disable_unprepare(xhci->clk);
364+
365+
return ret;
360366
}
361367

362368
static int xhci_plat_resume(struct device *dev)
363369
{
364370
struct usb_hcd *hcd = dev_get_drvdata(dev);
365371
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
366372

373+
if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk))
374+
clk_prepare_enable(xhci->clk);
375+
367376
return xhci_resume(xhci, 0);
368377
}
369378
#endif /* CONFIG_PM_SLEEP */

0 commit comments

Comments
 (0)