| From 61d5b51b6425b09da807e2ce31232e8c56f172c9 Mon Sep 17 00:00:00 2001 |
| From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> |
| Date: Wed, 19 Apr 2017 16:55:46 +0300 |
| Subject: [PATCH 201/286] 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 <yoshihiro.shimoda.uh@renesas.com> |
| Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| (cherry picked from commit 835e4241e714fbd659838618466766b132823da3) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/usb/host/xhci-plat.c | 11 ++++++++++- |
| 1 file changed, 10 insertions(+), 1 deletion(-) |
| |
| --- a/drivers/usb/host/xhci-plat.c |
| +++ b/drivers/usb/host/xhci-plat.c |
| @@ -328,6 +328,7 @@ static int xhci_plat_suspend(struct devi |
| { |
| struct usb_hcd *hcd = dev_get_drvdata(dev); |
| struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| + int ret; |
| |
| /* |
| * xhci_suspend() needs `do_wakeup` to know whether host is allowed |
| @@ -337,7 +338,12 @@ static int xhci_plat_suspend(struct devi |
| * reconsider this when xhci_plat_suspend enlarges its scope, e.g., |
| * also applies to runtime suspend. |
| */ |
| - return xhci_suspend(xhci, device_may_wakeup(dev)); |
| + ret = xhci_suspend(xhci, device_may_wakeup(dev)); |
| + |
| + if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk)) |
| + clk_disable_unprepare(xhci->clk); |
| + |
| + return ret; |
| } |
| |
| static int xhci_plat_resume(struct device *dev) |
| @@ -345,6 +351,9 @@ static int xhci_plat_resume(struct devic |
| struct usb_hcd *hcd = dev_get_drvdata(dev); |
| struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
| |
| + if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk)) |
| + clk_prepare_enable(xhci->clk); |
| + |
| return xhci_resume(xhci, 0); |
| } |
| #endif /* CONFIG_PM_SLEEP */ |