[PATCH v2 14/25] usb: langwell_udc: add HighSpeed/FullSpeed events notification

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

 



It adds notification to intel penwell otg transceiver driver for
HighSpeed/FullSpeed. This change mainly to support battery charging
current negotiation for Charging Downstream Port(CDP) case. USB OTG
Transceiver driver will notify battery driver about charging current
limitation change according to different Speed Mode (HS/FS).

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

diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index 47e6335..df2b82b 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -2606,8 +2606,9 @@ done:
 /* port change detect interrupt handler */
 static void handle_port_change(struct langwell_udc *dev)
 {
-	u32	portsc1, devlc;
-	u32	speed;
+	enum usb_otg_events	event;
+	u32			portsc1, devlc;
+	u32			speed;
 
 	dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
@@ -2626,12 +2627,15 @@ static void handle_port_change(struct langwell_udc *dev)
 		switch (speed) {
 		case LPM_SPEED_HIGH:
 			dev->gadget.speed = USB_SPEED_HIGH;
+			event = USB_OTG_DEV_HS;
 			break;
 		case LPM_SPEED_FULL:
 			dev->gadget.speed = USB_SPEED_FULL;
+			event = USB_OTG_DEV_FS;
 			break;
 		case LPM_SPEED_LOW:
 			dev->gadget.speed = USB_SPEED_LOW;
+			event = USB_OTG_DEV_FS;
 			break;
 		default:
 			dev->gadget.speed = USB_SPEED_UNKNOWN;
@@ -2640,6 +2644,8 @@ static void handle_port_change(struct langwell_udc *dev)
 		dev_vdbg(&dev->pdev->dev,
 				"speed = %d, dev->gadget.speed = %d\n",
 				speed, dev->gadget.speed);
+
+		otg_notify_event(event);
 	}
 
 	/* LPM L0 to L1 */
@@ -2743,6 +2749,8 @@ static void handle_usb_reset(struct langwell_udc *dev)
 		dev->usb_state = USB_STATE_ATTACHED;
 	}
 
+	otg_notify_event(USB_OTG_DEV_FS);
+
 	dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
 }
 
-- 
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