Commit 37b5801e authored by Parirajan Muthalagu's avatar Parirajan Muthalagu Committed by Greg Kroah-Hartman

USB Gadget: Verify VBUS current before setting the device self-powered bit

Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Acked-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarPraveena Nadahally <praveen.nadahally@stericsson.com>
Signed-off-by: default avatarParirajan Muthalagu <parirajan.muthalagu@stericsson.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 90593899
......@@ -1074,6 +1074,12 @@ static int composite_bind(struct usb_gadget *gadget)
cdev->bufsiz = USB_BUFSIZ;
cdev->driver = composite;
/*
* 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.
......
......@@ -808,4 +808,14 @@ enum usb_device_state {
*/
};
/*-------------------------------------------------------------------------*/
/*
* 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.
* http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
*/
#define USB_SELF_POWER_VBUS_MAX_DRAW 100
#endif /* __LINUX_USB_CH9_H */
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