aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Yrj?l? <juha.yrjola@nokia.com>2005-10-16 18:47:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 19:47:45 -0400
commit4e67185a7ac3ecb1710e636e2f7e318e99298c7a (patch)
tree035fa1745baa6490425d44dc126c72ddc366497f
parentf37be9b9be3ebc02d2d075d7f53f7802f3e005db (diff)
[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>
-rw-r--r--drivers/usb/gadget/omap_udc.c4
-rw-r--r--include/linux/usb_otg.h13
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index de8a89ae4bc3..b42799bc747a 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -1788,8 +1788,12 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
1788 udc->driver->suspend(&udc->gadget); 1788 udc->driver->suspend(&udc->gadget);
1789 spin_lock(&udc->lock); 1789 spin_lock(&udc->lock);
1790 } 1790 }
1791 if (udc->transceiver)
1792 otg_set_suspend(udc->transceiver, 1);
1791 } else { 1793 } else {
1792 VDBG("resume\n"); 1794 VDBG("resume\n");
1795 if (udc->transceiver)
1796 otg_set_suspend(udc->transceiver, 0);
1793 if (udc->gadget.speed == USB_SPEED_FULL 1797 if (udc->gadget.speed == USB_SPEED_FULL
1794 && udc->driver->resume) { 1798 && udc->driver->resume) {
1795 spin_unlock(&udc->lock); 1799 spin_unlock(&udc->lock);
diff --git a/include/linux/usb_otg.h b/include/linux/usb_otg.h
index c6683146e9b0..f827f6e203c2 100644
--- a/include/linux/usb_otg.h
+++ b/include/linux/usb_otg.h
@@ -63,6 +63,10 @@ struct otg_transceiver {
63 int (*set_power)(struct otg_transceiver *otg, 63 int (*set_power)(struct otg_transceiver *otg,
64 unsigned mA); 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 /* for B devices only: start session with A-Host */ 70 /* for B devices only: start session with A-Host */
67 int (*start_srp)(struct otg_transceiver *otg); 71 int (*start_srp)(struct otg_transceiver *otg);
68 72
@@ -108,6 +112,15 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
108} 112}
109 113
110static inline int 114static inline int
115otg_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;
121}
122
123static inline int
111otg_start_srp(struct otg_transceiver *otg) 124otg_start_srp(struct otg_transceiver *otg)
112{ 125{
113 return otg->start_srp(otg); 126 return otg->start_srp(otg);