Commit 4e67185a authored by Juha Yrj?l?'s avatar Juha Yrj?l? Committed by Greg Kroah-Hartman

[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: default avatarJuha Yrj?l? <juha.yrjola@nokia.com>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f37be9b9
...@@ -1788,8 +1788,12 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src) ...@@ -1788,8 +1788,12 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
udc->driver->suspend(&udc->gadget); udc->driver->suspend(&udc->gadget);
spin_lock(&udc->lock); spin_lock(&udc->lock);
} }
if (udc->transceiver)
otg_set_suspend(udc->transceiver, 1);
} else { } else {
VDBG("resume\n"); VDBG("resume\n");
if (udc->transceiver)
otg_set_suspend(udc->transceiver, 0);
if (udc->gadget.speed == USB_SPEED_FULL if (udc->gadget.speed == USB_SPEED_FULL
&& udc->driver->resume) { && udc->driver->resume) {
spin_unlock(&udc->lock); spin_unlock(&udc->lock);
......
...@@ -63,6 +63,10 @@ struct otg_transceiver { ...@@ -63,6 +63,10 @@ struct otg_transceiver {
int (*set_power)(struct otg_transceiver *otg, int (*set_power)(struct otg_transceiver *otg,
unsigned mA); unsigned mA);
/* for non-OTG B devices: set transceiver into suspend mode */
int (*set_suspend)(struct otg_transceiver *otg,
int suspend);
/* for B devices only: start session with A-Host */ /* for B devices only: start session with A-Host */
int (*start_srp)(struct otg_transceiver *otg); int (*start_srp)(struct otg_transceiver *otg);
...@@ -107,6 +111,15 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA) ...@@ -107,6 +111,15 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
return otg->set_power(otg, mA); return otg->set_power(otg, mA);
} }
static inline int
otg_set_suspend(struct otg_transceiver *otg, int suspend)
{
if (otg->set_suspend != NULL)
return otg->set_suspend(otg, suspend);
else
return 0;
}
static inline int static inline int
otg_start_srp(struct otg_transceiver *otg) otg_start_srp(struct otg_transceiver *otg)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment