[PATCH v2 23/25] usb: langwell_udc: add support for HNP polling.

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

 



This patch adds get_status support for HNP polling in langwell_udc.

Signed-off-by: Hao Wu <hao.wu@xxxxxxxxx>
---
 drivers/usb/gadget/langwell_udc.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index 0a14292..5eb92a5 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -2131,14 +2131,25 @@ static void get_status(struct langwell_udc *dev, u8 request_type, u16 value,
 	struct langwell_ep	*ep;
 	u16	status_data = 0;	/* 16 bits cpu view status data */
 	int	status = 0;
+	int	flag = 0;
 
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
 	ep = &dev->ep[0];
 
 	if ((request_type & USB_RECIP_MASK) == USB_RECIP_DEVICE) {
-		/* get device status */
-		status_data = dev->dev_status;
+#ifdef OTG_TRANSCEIVER
+		/* HNP polling for host_request_flag, its index is 0xF000 */
+		if (index == 0xF000) {
+			status_data = dev->gadget.host_request_flag;
+			flag = 1;
+
+			dev_vdbg(&dev->pdev->dev,
+				"request_flag 0x%x\n", status_data);
+
+		} else
+#endif
+			status_data = dev->dev_status;
 	} else if ((request_type & USB_RECIP_MASK) == USB_RECIP_INTERFACE) {
 		/* get interface status */
 		status_data = 0;
@@ -2163,7 +2174,7 @@ static void get_status(struct langwell_udc *dev, u8 request_type, u16 value,
 	/* fill in the reqest structure */
 	*((u16 *) req->req.buf) = cpu_to_le16(status_data);
 	req->ep = ep;
-	req->req.length = 2;
+	req->req.length = flag ? 1 : 2;
 	req->req.status = -EINPROGRESS;
 	req->req.actual = 0;
 	req->req.complete = NULL;
-- 
1.6.0.6

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