ANDROID: GKI: USB: Fix ABI diff for struct usb_bus

Adds new member skip_resume to struct usb_bus to resolve ABI diff.
This patch also adds the capability to skip device resume during
system resume. It allows xHC to remain in low power mode and not
resume the bus when system wide resume happens.
Instead, the controller comes out of low power mode only
when usb device issues a remote wakeup or if there is
host initiated bus resume.

Test: build
Bug: 153445212
Change-Id: I96cdcb9e3642906b4afa08d9bde07e123d9b3977
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit 567a7ba0cc)
[hridya: partial cherry-pick]
Signed-off-by: Hridya Valsaraju <hridya@google.com>
This commit is contained in:
Hemant Kumar 2016-11-15 19:10:42 -08:00 committed by Hridya Valsaraju
parent 632093eced
commit 5b6a5354d0
2 changed files with 21 additions and 0 deletions

View file

@ -1458,6 +1458,9 @@ int usb_suspend(struct device *dev, pm_message_t msg)
struct usb_device *udev = to_usb_device(dev);
int r;
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
@ -1494,6 +1497,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

@ -466,6 +466,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.
*/
};
struct usb_dev_state;