提交 37b5801e 编写于 作者: P Parirajan Muthalagu 提交者: Greg Kroah-Hartman

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

Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Acked-by: NLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: NPraveena Nadahally <praveen.nadahally@stericsson.com>
Signed-off-by: NParirajan Muthalagu <parirajan.muthalagu@stericsson.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 90593899
...@@ -1074,6 +1074,12 @@ static int composite_bind(struct usb_gadget *gadget) ...@@ -1074,6 +1074,12 @@ static int composite_bind(struct usb_gadget *gadget)
cdev->bufsiz = USB_BUFSIZ; cdev->bufsiz = USB_BUFSIZ;
cdev->driver = composite; 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); usb_gadget_set_selfpowered(gadget);
/* interface and string IDs start at zero via kzalloc. /* interface and string IDs start at zero via kzalloc.
......
...@@ -808,4 +808,14 @@ enum usb_device_state { ...@@ -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 */ #endif /* __LINUX_USB_CH9_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册