[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? <[EMAIL PROTECTED]>
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
commit 4e67185a7ac3ecb1710e636e2f7e318e99298c7a
tree 035fa1745baa6490425d44dc126c72ddc366497f
parent f37be9b9be3ebc02d2d075d7f53f7802f3e005db
author Juha Yrj?l? <[EMAIL PROTECTED]> Sun, 16 Oct 2005 15:47:04 -0700
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Fri, 28 Oct 2005 16:47:45 -0700

 drivers/usb/gadget/omap_udc.c |    4 ++++
 include/linux/usb_otg.h       |   13 +++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index de8a89a..b42799b 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->driver->suspend(&udc->gadget);
                                        spin_lock(&udc->lock);
                                }
+                               if (udc->transceiver)
+                                       otg_set_suspend(udc->transceiver, 1);
                        } else {
                                VDBG("resume\n");
+                               if (udc->transceiver)
+                                       otg_set_suspend(udc->transceiver, 0);
                                if (udc->gadget.speed == USB_SPEED_FULL
                                                && udc->driver->resume) {
                                        spin_unlock(&udc->lock);
diff --git a/include/linux/usb_otg.h b/include/linux/usb_otg.h
index c668314..f827f6e 100644
--- a/include/linux/usb_otg.h
+++ b/include/linux/usb_otg.h
@@ -63,6 +63,10 @@ struct otg_transceiver {
        int     (*set_power)(struct otg_transceiver *otg,
                                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 */
        int     (*start_srp)(struct otg_transceiver *otg);
 
@@ -108,6 +112,15 @@ otg_set_power(struct otg_transceiver *ot
 }
 
 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
 otg_start_srp(struct otg_transceiver *otg)
 {
        return otg->start_srp(otg);



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to