Commit 4e67185a7ac3ecb1710e636e2f7e318e99298c7a

Authored by Juha Yrj?l?
Committed by Greg Kroah-Hartman
1 parent f37be9b9be

[PATCH] add usb transceiver set_suspend() method

When a USB device is put into suspend mode, the current drawn from VBUS
has to be less than 500 uA. Some transceivers need to be put into a
special power-saving mode to accomplish this, and won't have a separate
OTG driver handling that.

This adds a suspend method to the "otg_transceiver" struct -- misnamed,
it's not only for OTG -- and calls it from the OMAP UDC driver.

Signed-off-by: Juha Yrj?l? <juha.yrjola@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 2 changed files with 17 additions and 0 deletions Side-by-side Diff

drivers/usb/gadget/omap_udc.c
... ... @@ -1788,8 +1788,12 @@
1788 1788 udc->driver->suspend(&udc->gadget);
1789 1789 spin_lock(&udc->lock);
1790 1790 }
  1791 + if (udc->transceiver)
  1792 + otg_set_suspend(udc->transceiver, 1);
1791 1793 } else {
1792 1794 VDBG("resume\n");
  1795 + if (udc->transceiver)
  1796 + otg_set_suspend(udc->transceiver, 0);
1793 1797 if (udc->gadget.speed == USB_SPEED_FULL
1794 1798 && udc->driver->resume) {
1795 1799 spin_unlock(&udc->lock);
include/linux/usb_otg.h
... ... @@ -63,6 +63,10 @@
63 63 int (*set_power)(struct otg_transceiver *otg,
64 64 unsigned mA);
65 65  
  66 + /* for non-OTG B devices: set transceiver into suspend mode */
  67 + int (*set_suspend)(struct otg_transceiver *otg,
  68 + int suspend);
  69 +
66 70 /* for B devices only: start session with A-Host */
67 71 int (*start_srp)(struct otg_transceiver *otg);
68 72  
... ... @@ -105,6 +109,15 @@
105 109 otg_set_power(struct otg_transceiver *otg, unsigned mA)
106 110 {
107 111 return otg->set_power(otg, mA);
  112 +}
  113 +
  114 +static inline int
  115 +otg_set_suspend(struct otg_transceiver *otg, int suspend)
  116 +{
  117 + if (otg->set_suspend != NULL)
  118 + return otg->set_suspend(otg, suspend);
  119 + else
  120 + return 0;
108 121 }
109 122  
110 123 static inline int