summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorParirajan Muthalagu <parirajan.muthalagu@stericsson.com>2010-08-25 16:33:26 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 10:21:20 -0700
commit37b5801e16d2e192fe2b20f4af33aa8c6e8786f3 (patch)
treef38d8549d967faac894c6f1b7e861a7482a9a8c0 /drivers/usb/gadget/composite.c
parent90593899de83a6e6fdea563d058acd2f4334e3f9 (diff)
USB Gadget: Verify VBUS current before setting the device self-powered bit
Acked-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Praveena Nadahally <praveen.nadahally@stericsson.com> Signed-off-by: Parirajan Muthalagu <parirajan.muthalagu@stericsson.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 1160c55de7f2..eaa9a599df63 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1074,7 +1074,13 @@ static int composite_bind(struct usb_gadget *gadget)
cdev->bufsiz = USB_BUFSIZ;
cdev->driver = composite;
- usb_gadget_set_selfpowered(gadget);
+ /*
+ * As per USB compliance update, a device that is actively drawing
+ * more than 100mA from USB must report itself as bus-powered in
+ * the GetStatus(DEVICE) call.
+ */
+ if (CONFIG_USB_GADGET_VBUS_DRAW <= USB_SELF_POWER_VBUS_MAX_DRAW)
+ usb_gadget_set_selfpowered(gadget);
/* interface and string IDs start at zero via kzalloc.
* we force endpoints to start unassigned; few controller