patch "USB Gadget: Verify VBUS current before setting the device self-powered bit" added to gregkh-2.6 tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to my gregkh-2.6 tree which can be found in directory form at:
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
 and in git form at:
    git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/patches.git

The filename of this patch is:
    usb-gadget-verify-vbus-current-before-setting-the-device-self-powered-bit.patch

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

If this patch meets the merge guidelines for a bugfix, it should be
merged into Linus's tree before the next major kernel release.
If not, it will be merged into Linus's tree during the next merge window.

Either way, you will probably be copied on the patch when it gets sent
to Linus for merging so that others can see what is happening in kernel
development.

If you have any questions about this process, please let me know.


>From linux-usb-owner@xxxxxxxxxxxxxxx  Wed Sep  1 12:48:46 2010
From: Praveena Nadahally <praveen.nadahally@xxxxxxxxxxxxxx>
To: <linux-usb@xxxxxxxxxxxxxxx>
Cc: <STEricsson_nomadik_linux@xxxxxxxxxxx>,
	<linus.walleij@xxxxxxxxxxxxxx>, <dbrownell@xxxxxxxxxxxxxxxxxxxxx>,
	Parirajan Muthalagu <parirajan.muthalagu@xxxxxxxxxxxxxx>,
	Praveena Nadahally <praveen.nadahally@xxxxxxxxxxxxxx>
Subject: USB Gadget: Verify VBUS current before setting the device self-powered bit
Date: Wed, 25 Aug 2010 16:33:26 +0530
Message-ID: <1282734206-29760-1-git-send-email-praveen.nadahally@xxxxxxxxxxxxxx>

From: Parirajan Muthalagu <parirajan.muthalagu@xxxxxxxxxxxxxx>


Acked-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>
Signed-off-by: Praveena Nadahally <praveen.nadahally@xxxxxxxxxxxxxx>
Signed-off-by: Parirajan Muthalagu <parirajan.muthalagu@xxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
 drivers/usb/gadget/composite.c |    8 +++++++-
 include/linux/usb/ch9.h        |   10 ++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1074,7 +1074,13 @@ static int composite_bind(struct usb_gad
 	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
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -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 */

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux