aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/composite.c8
-rw-r--r--include/linux/usb/ch9.h10
2 files changed, 17 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)
1074 cdev->bufsiz = USB_BUFSIZ; 1074 cdev->bufsiz = USB_BUFSIZ;
1075 cdev->driver = composite; 1075 cdev->driver = composite;
1076 1076
1077 usb_gadget_set_selfpowered(gadget); 1077 /*
1078 * As per USB compliance update, a device that is actively drawing
1079 * more than 100mA from USB must report itself as bus-powered in
1080 * the GetStatus(DEVICE) call.
1081 */
1082 if (CONFIG_USB_GADGET_VBUS_DRAW <= USB_SELF_POWER_VBUS_MAX_DRAW)
1083 usb_gadget_set_selfpowered(gadget);
1078 1084
1079 /* interface and string IDs start at zero via kzalloc. 1085 /* interface and string IDs start at zero via kzalloc.
1080 * we force endpoints to start unassigned; few controller 1086 * we force endpoints to start unassigned; few controller
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index da2ed77d3e8d..b0f7e9f57176 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -808,4 +808,14 @@ enum usb_device_state {
808 */ 808 */
809}; 809};
810 810
811/*-------------------------------------------------------------------------*/
812
813/*
814 * As per USB compliance update, a device that is actively drawing
815 * more than 100mA from USB must report itself as bus-powered in
816 * the GetStatus(DEVICE) call.
817 * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
818 */
819#define USB_SELF_POWER_VBUS_MAX_DRAW 100
820
811#endif /* __LINUX_USB_CH9_H */ 821#endif /* __LINUX_USB_CH9_H */