From 8061ad7239f3f97b477984660e95134ca684578c Mon Sep 17 00:00:00 2001 From: Kishon Vijay Abraham I Date: Mon, 8 Jul 2013 09:54:43 +0900 Subject: usb: dwc3: use extcon fwrk to receive connect/disconnect Modified dwc3-omap to receive connect and disconnect notification using extcon framework. Also did the necessary cleanups required after adapting to extcon framework. Signed-off-by: Kishon Vijay Abraham I Acked-by: Felipe Balbi Signed-off-by: Chanwoo Choi --- Documentation/devicetree/bindings/usb/omap-usb.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt index 57e71f6817d..9088ab09e20 100644 --- a/Documentation/devicetree/bindings/usb/omap-usb.txt +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt @@ -53,6 +53,11 @@ OMAP DWC3 GLUE It should be set to "1" for HW mode and "2" for SW mode. - ranges: the child address space are mapped 1:1 onto the parent address space +Optional Properties: + - extcon : phandle for the extcon device omap dwc3 uses to detect + connect/disconnect events. + - vbus-supply : phandle to the regulator device tree node if needed. + Sub-nodes: The dwc3 core should be added as subnode to omap dwc3 glue. - dwc3 : -- cgit v1.2.3-70-g09d2 From 80d644b297dc26c5126858555044edef76f4ffe8 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Fri, 5 Jul 2013 22:59:51 +0900 Subject: extcon: palmas: rename device tree binding matching with file name The driver name is extcon/extcon-palmas.c and hence renaming the device tree binding document to extcon-palmas.txt. Signed-off-by: Laxman Dewangan Signed-off-by: Chanwoo Choi Signed-off-by: Myungjoo Ham --- .../devicetree/bindings/extcon/extcon-palmas.txt | 15 +++++++++++++++ Documentation/devicetree/bindings/extcon/extcon-twl.txt | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-palmas.txt delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-twl.txt (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt new file mode 100644 index 00000000000..58f531ab4df --- /dev/null +++ b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt @@ -0,0 +1,15 @@ +EXTCON FOR TWL CHIPS + +PALMAS USB COMPARATOR +Required Properties: + - compatible : Should be "ti,palmas-usb" or "ti,twl6035-usb" + - vbus-supply : phandle to the regulator device tree node. + +Optional Properties: + - ti,wakeup : To enable the wakeup comparator in probe + +palmas-usb { + compatible = "ti,twl6035-usb", "ti,palmas-usb"; + vbus-supply = <&smps10_reg>; + ti,wakeup; +}; diff --git a/Documentation/devicetree/bindings/extcon/extcon-twl.txt b/Documentation/devicetree/bindings/extcon/extcon-twl.txt deleted file mode 100644 index 58f531ab4df..00000000000 --- a/Documentation/devicetree/bindings/extcon/extcon-twl.txt +++ /dev/null @@ -1,15 +0,0 @@ -EXTCON FOR TWL CHIPS - -PALMAS USB COMPARATOR -Required Properties: - - compatible : Should be "ti,palmas-usb" or "ti,twl6035-usb" - - vbus-supply : phandle to the regulator device tree node. - -Optional Properties: - - ti,wakeup : To enable the wakeup comparator in probe - -palmas-usb { - compatible = "ti,twl6035-usb", "ti,palmas-usb"; - vbus-supply = <&smps10_reg>; - ti,wakeup; -}; -- cgit v1.2.3-70-g09d2 From 26ece4f0b7d2264282d9077d1843ff1e98189b6c Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Fri, 5 Jul 2013 22:59:52 +0900 Subject: extcon: palmas: devicetree: remove non-require property details Extcon for palma driver does not need vbus supply and hence removing this from devicetree document/bindings. Signed-off-by: Laxman Dewangan Signed-off-by: Chanwoo Choi Signed-off-by: Myungjoo Ham --- Documentation/devicetree/bindings/extcon/extcon-palmas.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt index 58f531ab4df..f110e75fd0a 100644 --- a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt +++ b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt @@ -1,15 +1,13 @@ -EXTCON FOR TWL CHIPS +EXTCON FOR PALMAS/TWL CHIPS PALMAS USB COMPARATOR Required Properties: - compatible : Should be "ti,palmas-usb" or "ti,twl6035-usb" - - vbus-supply : phandle to the regulator device tree node. Optional Properties: - ti,wakeup : To enable the wakeup comparator in probe palmas-usb { compatible = "ti,twl6035-usb", "ti,palmas-usb"; - vbus-supply = <&smps10_reg>; ti,wakeup; }; -- cgit v1.2.3-70-g09d2 From 7281e05aabee7484624d448da208932690ed62b3 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Wed, 10 Jul 2013 14:59:06 +0530 Subject: extcon: palmas: Option to disable ID/VBUS detection based on platform Based on system design, platform needs to detect the VBUS or ID or both. Provide option to select this through platform data to disable part of cable detection through palmas-usb. Signed-off-by: Laxman Dewangan Acked-by: Graeme Gregory Signed-off-by: Chanwoo Choi Signed-off-by: Myungjoo Ham --- .../devicetree/bindings/extcon/extcon-palmas.txt | 2 + drivers/extcon/extcon-palmas.c | 87 +++++++++++++--------- include/linux/mfd/palmas.h | 3 + 3 files changed, 57 insertions(+), 35 deletions(-) (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt index f110e75fd0a..7dab6a8f4a0 100644 --- a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt +++ b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt @@ -6,6 +6,8 @@ Required Properties: Optional Properties: - ti,wakeup : To enable the wakeup comparator in probe + - ti,enable-id-detection: Perform ID detection. + - ti,enable-vbus-detection: Perform VBUS detection. palmas-usb { compatible = "ti,twl6035-usb", "ti,palmas-usb"; diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c index d0ce0f16de7..89fdd05c5fd 100644 --- a/drivers/extcon/extcon-palmas.c +++ b/drivers/extcon/extcon-palmas.c @@ -122,11 +122,14 @@ static void palmas_enable_irq(struct palmas_usb *palmas_usb) PALMAS_USB_ID_INT_EN_HI_SET_ID_GND | PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT); - palmas_vbus_irq_handler(palmas_usb->vbus_irq, palmas_usb); + if (palmas_usb->enable_vbus_detection) + palmas_vbus_irq_handler(palmas_usb->vbus_irq, palmas_usb); /* cold plug for host mode needs this delay */ - msleep(30); - palmas_id_irq_handler(palmas_usb->id_irq, palmas_usb); + if (palmas_usb->enable_id_detection) { + msleep(30); + palmas_id_irq_handler(palmas_usb->id_irq, palmas_usb); + } } static int palmas_usb_probe(struct platform_device *pdev) @@ -137,21 +140,25 @@ static int palmas_usb_probe(struct platform_device *pdev) struct palmas_usb *palmas_usb; int status; - if (node && !pdata) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - - if (!pdata) - return -ENOMEM; - - pdata->wakeup = of_property_read_bool(node, "ti,wakeup"); - } else if (!pdata) { - return -EINVAL; - } - palmas_usb = devm_kzalloc(&pdev->dev, sizeof(*palmas_usb), GFP_KERNEL); if (!palmas_usb) return -ENOMEM; + if (node && !pdata) { + palmas_usb->wakeup = of_property_read_bool(node, "ti,wakeup"); + palmas_usb->enable_id_detection = of_property_read_bool(node, + "ti,enable-id-detection"); + palmas_usb->enable_vbus_detection = of_property_read_bool(node, + "ti,enable-vbus-detection"); + } else { + palmas_usb->wakeup = true; + palmas_usb->enable_id_detection = true; + palmas_usb->enable_vbus_detection = true; + + if (pdata) + palmas_usb->wakeup = pdata->wakeup; + } + palmas->usb = palmas_usb; palmas_usb->palmas = palmas; @@ -166,7 +173,7 @@ static int palmas_usb_probe(struct platform_device *pdev) palmas_usb->vbus_irq = regmap_irq_get_virq(palmas->irq_data, PALMAS_VBUS_IRQ); - palmas_usb_wakeup(palmas, pdata->wakeup); + palmas_usb_wakeup(palmas, palmas_usb->wakeup); platform_set_drvdata(pdev, palmas_usb); @@ -179,26 +186,32 @@ static int palmas_usb_probe(struct platform_device *pdev) return status; } - status = devm_request_threaded_irq(palmas_usb->dev, palmas_usb->id_irq, - NULL, palmas_id_irq_handler, - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | - IRQF_ONESHOT | IRQF_EARLY_RESUME, - "palmas_usb_id", palmas_usb); - if (status < 0) { - dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", + if (palmas_usb->enable_id_detection) { + status = devm_request_threaded_irq(palmas_usb->dev, + palmas_usb->id_irq, + NULL, palmas_id_irq_handler, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | + IRQF_ONESHOT | IRQF_EARLY_RESUME, + "palmas_usb_id", palmas_usb); + if (status < 0) { + dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", palmas_usb->id_irq, status); - goto fail_extcon; + goto fail_extcon; + } } - status = devm_request_threaded_irq(palmas_usb->dev, - palmas_usb->vbus_irq, NULL, palmas_vbus_irq_handler, - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | - IRQF_ONESHOT | IRQF_EARLY_RESUME, - "palmas_usb_vbus", palmas_usb); - if (status < 0) { - dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", + if (palmas_usb->enable_vbus_detection) { + status = devm_request_threaded_irq(palmas_usb->dev, + palmas_usb->vbus_irq, NULL, + palmas_vbus_irq_handler, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | + IRQF_ONESHOT | IRQF_EARLY_RESUME, + "palmas_usb_vbus", palmas_usb); + if (status < 0) { + dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", palmas_usb->vbus_irq, status); - goto fail_extcon; + goto fail_extcon; + } } palmas_enable_irq(palmas_usb); @@ -226,8 +239,10 @@ static int palmas_usb_suspend(struct device *dev) struct palmas_usb *palmas_usb = dev_get_drvdata(dev); if (device_may_wakeup(dev)) { - enable_irq_wake(palmas_usb->vbus_irq); - enable_irq_wake(palmas_usb->id_irq); + if (palmas_usb->enable_vbus_detection) + enable_irq_wake(palmas_usb->vbus_irq); + if (palmas_usb->enable_id_detection) + enable_irq_wake(palmas_usb->id_irq); } return 0; } @@ -237,8 +252,10 @@ static int palmas_usb_resume(struct device *dev) struct palmas_usb *palmas_usb = dev_get_drvdata(dev); if (device_may_wakeup(dev)) { - disable_irq_wake(palmas_usb->vbus_irq); - disable_irq_wake(palmas_usb->id_irq); + if (palmas_usb->enable_vbus_detection) + disable_irq_wake(palmas_usb->vbus_irq); + if (palmas_usb->enable_id_detection) + disable_irq_wake(palmas_usb->id_irq); } return 0; }; diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 03c22ca5544..cfc678ceb57 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h @@ -377,6 +377,9 @@ struct palmas_usb { int vbus_irq; enum palmas_usb_state linkstat; + int wakeup; + bool enable_vbus_detection; + bool enable_id_detection; }; #define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) -- cgit v1.2.3-70-g09d2