[PATCH 9/21] usb: langwell_udc: set vbus_active flag according to state

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

 



From: Hao Wu <hao.wu@xxxxxxxxx>

This patch adds active bit setting in order to avoid issues
with composite gadget on pullup functions which query on this
bit.

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

diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index 1466501..7359dd0 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -3502,8 +3502,10 @@ static struct pci_driver langwell_pci_driver = {
 #ifdef	OTG_TRANSCEIVER
 static int intel_mid_start_peripheral(struct intel_mid_otg_xceiv *iotg)
 {
-	struct pci_dev	*pdev;
-	int		retval;
+	struct langwell_udc	*dev = the_controller;
+	struct pci_dev		*pdev;
+	unsigned long		flags;
+	int			retval;
 
 	if (iotg == NULL)
 		return -EINVAL;
@@ -3514,13 +3516,21 @@ static int intel_mid_start_peripheral(struct intel_mid_otg_xceiv *iotg)
 	if (retval)
 		dev_dbg(&pdev->dev, "Failed to start peripheral driver\n");
 
+	if (dev) {
+		spin_lock_irqsave(&dev->lock, flags);
+		dev->vbus_active = 1;
+		spin_unlock_irqrestore(&dev->lock, flags);
+	}
+
 	return retval;
 }
 
 static int intel_mid_stop_peripheral(struct intel_mid_otg_xceiv *iotg)
 {
-	struct pci_dev	*pdev;
-	int		retval;
+	struct langwell_udc	*dev = the_controller;
+	struct pci_dev		*pdev;
+	unsigned long		flags;
+	int			retval;
 
 	if (iotg == NULL)
 		return -EINVAL;
@@ -3531,6 +3541,12 @@ static int intel_mid_stop_peripheral(struct intel_mid_otg_xceiv *iotg)
 	if (retval)
 		dev_dbg(&pdev->dev, "Failed to stop peripheral driver\n");
 
+	if (dev) {
+		spin_lock_irqsave(&dev->lock, flags);
+		dev->vbus_active = 0;
+		spin_unlock_irqrestore(&dev->lock, flags);
+	}
+
 	return retval;
 }
 
-- 
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