Navigation Menu

Skip to content

Commit

Permalink
USB: Allow skipping device resume during system resume
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 6f199aa800253a69e5679d1057823039f1bd65c9)

Change-Id: Id9b15a20345423c6f33fd7d8cd2a55372a1e6b4b
CRs-Fixed: 403975
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
  • Loading branch information
Pavankumar Kondeti authored and franciscofranco committed Dec 29, 2012
1 parent d30ab89 commit fa6f554
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/usb/core/driver.c
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions drivers/usb/host/ehci-msm-hsic.c
Expand Up @@ -1504,6 +1504,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");
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions include/linux/usb.h
Expand Up @@ -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.
*/
};

/* ----------------------------------------------------------------------- */
Expand Down

0 comments on commit fa6f554

Please sign in to comment.