EHCI: HSIC: Abort system suspend if controller is outside LPM
98089c0d commit (USB: Prevent system suspend when HSIC device
is active) ensures that USB devices are auto suspended before
system suspend begins. Apply the same policy to HSIC controller
platform device. This will cover the corner case where controller
and root hub are resumed after root hub system suspend routine
returns success.
CRs-Fixed: 482498
Change-Id: I604b24775e1c2f52020161c236c44c20d579d5e0
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
diff --git a/drivers/usb/host/ehci-msm-hsic.c b/drivers/usb/host/ehci-msm-hsic.c
index 6cb663d..eaf3e8b 100644
--- a/drivers/usb/host/ehci-msm-hsic.c
+++ b/drivers/usb/host/ehci-msm-hsic.c
@@ -1874,7 +1874,6 @@
#ifdef CONFIG_PM_SLEEP
static int msm_hsic_pm_suspend(struct device *dev)
{
- int ret;
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct msm_hsic_hcd *mehci = hcd_to_hsic(hcd);
@@ -1882,15 +1881,16 @@
dbg_log_event(NULL, "PM Suspend", 0);
+ if (!atomic_read(&mehci->in_lpm)) {
+ dev_info(dev, "abort suspend\n");
+ dbg_log_event(NULL, "PM Suspend abort", 0);
+ return -EBUSY;
+ }
+
if (device_may_wakeup(dev))
enable_irq_wake(hcd->irq);
- ret = msm_hsic_suspend(mehci);
-
- if (ret && device_may_wakeup(dev))
- disable_irq_wake(hcd->irq);
-
- return ret;
+ return 0;
}
static int msm_hsic_pm_suspend_noirq(struct device *dev)