[PATCH 03/13] usb: gadget: composite: add .connect API for its usb_gadget_driver

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

 



It is used for udc to pullup dp when necessary

Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>
---
 drivers/usb/gadget/composite.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 6935a82..c4ce977 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -2066,6 +2066,17 @@ composite_resume(struct usb_gadget *gadget)
 	cdev->suspended = 0;
 }
 
+/*
+ * UDC driver calls this when it wants to pull up dp.
+ */
+static int composite_connect(struct usb_gadget *gadget, bool connect)
+{
+	if (connect)
+		return usb_gadget_connect(gadget);
+	else
+		return usb_gadget_disconnect(gadget);
+}
+
 /*-------------------------------------------------------------------------*/
 
 static const struct usb_gadget_driver composite_driver_template = {
@@ -2078,6 +2089,8 @@ static const struct usb_gadget_driver composite_driver_template = {
 	.suspend	= composite_suspend,
 	.resume		= composite_resume,
 
+	.connect	= composite_connect,
+
 	.driver	= {
 		.owner		= THIS_MODULE,
 	},
-- 
1.7.9.5

--
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