USB: Allow skipping device resume during system resume.

Some buses would like to keep their devices in suspend state during system
resume.  For example HSIC controller driver prevent system suspend when
HSIC device is active.  If this device is resumed, during system resume
HSIC controller acquire wake lock and prevent the subsequent suspend till
HSIC device is auto suspended.

CRs-Fixed: 403975
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
(cherry picked from commit 6f199aa800253a69e5679d1057823039f1bd65c9)

Change-Id: Ic8ab631ec1f15685cc35823aa7c57d699738d5fc
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
This commit is contained in:
Pavankumar Kondeti
2012-09-18 17:52:51 +05:30
committed by Stephen Boyd
parent f49d4d7f53
commit fd126d6851
3 changed files with 32 additions and 0 deletions

View File

@@ -1357,6 +1357,9 @@ int usb_suspend(struct device *dev, pm_message_t msg)
{
struct usb_device *udev = to_usb_device(dev);
if (udev->bus->skip_resume && udev->state == USB_STATE_SUSPENDED)
return 0;
unbind_no_pm_drivers_interfaces(udev);
/* From now on we are sure all drivers support suspend/resume
@@ -1386,6 +1389,15 @@ int usb_resume(struct device *dev, pm_message_t msg)
struct usb_device *udev = to_usb_device(dev);
int status;
/*
* Some buses would like to keep their devices in suspend
* state after system resume. Their resume happen when
* a remote wakeup is detected or interface driver start
* I/O.
*/
if (udev->bus->skip_resume)
return 0;
/* For all calls, take the device back to full power and
* tell the PM core in case it was autosuspended previously.
* Unbind the interfaces that will need rebinding later,

View File

@@ -1506,6 +1506,8 @@ static int __devinit ehci_hsic_msm_probe(struct platform_device *pdev)
return -ENOMEM;
}
hcd_to_bus(hcd)->skip_resume = true;
hcd->irq = platform_get_irq(pdev, 0);
if (hcd->irq < 0) {
dev_err(&pdev->dev, "Unable to get IRQ resource\n");
@@ -1759,6 +1761,15 @@ static int msm_hsic_pm_resume(struct device *dev)
if (device_may_wakeup(dev))
disable_irq_wake(hcd->irq);
/*
* Keep HSIC in Low Power Mode if system is resumed
* by any other wakeup source. HSIC is resumed later
* when remote wakeup is received or interface driver
* start I/O.
*/
if (!atomic_read(&mehci->pm_usage_cnt))
return 0;
ret = msm_hsic_resume(mehci);
if (ret)
return ret;

View File

@@ -368,6 +368,15 @@ struct usb_bus {
struct mon_bus *mon_bus; /* non-null when associated */
int monitored; /* non-zero when monitored */
#endif
unsigned skip_resume:1; /* All USB devices are brought into full
* power state after system resume. It
* is desirable for some buses to keep
* their devices in suspend state even
* after system resume. The devices
* are resumed later when a remote
* wakeup is detected or an interface
* driver starts I/O.
*/
};
/* ----------------------------------------------------------------------- */