* [PATCH] extcon-usb-gpio: add enable pin support
@ 2015-12-10 23:07 Sergei Shtylyov
2015-12-11 3:53 ` Rob Herring
2015-12-11 4:05 ` Chanwoo Choi
0 siblings, 2 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-12-10 23:07 UTC (permalink / raw)
To: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak,
myungjoo.ham, cw00.choi, devicetree
Cc: linux-kernel, linux-sh, linux-usb
Sometimes there's a real OTG chip behind the USB ID signal mapped to a GPIO
pin: in my case it's Maxim Integrated MAX3355E which integrates Vbus charge
pump and comparators and passes thru the ID signal from an OTG connector.
This chip also has the SHDN# pin which should be driven high for the normal
operation and low to save power; it is connected to a GPIO pin as well on,
hence we'll have to teach the driver to parse the new optional device tree
property, "enable-gpio"...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
The patch is against the 'extcon-next' branch of the 'extcon.git' repo.
Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++
drivers/extcon/extcon-usb-gpio.c | 5 +++++
2 files changed, 8 insertions(+)
Index: extcon/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
=================================--- extcon.orig/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
+++ extcon/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
@@ -7,6 +7,9 @@ Required properties:
- compatible: Should be "linux,extcon-usb-gpio"
- id-gpio: gpio for USB ID pin. See gpio binding.
+Optional properties:
+- enable-gpio: gpio for the enable pin. See gpio binding.
+
Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below:
extcon_usb1 {
compatible = "linux,extcon-usb-gpio";
Index: extcon/drivers/extcon/extcon-usb-gpio.c
=================================--- extcon.orig/drivers/extcon/extcon-usb-gpio.c
+++ extcon/drivers/extcon/extcon-usb-gpio.c
@@ -33,6 +33,7 @@ struct usb_extcon_info {
struct device *dev;
struct extcon_dev *edev;
+ struct gpio_desc *enable_gpiod;
struct gpio_desc *id_gpiod;
int id_irq;
@@ -99,6 +100,8 @@ static int usb_extcon_probe(struct platf
return -ENOMEM;
info->dev = dev;
+ info->enable_gpiod = devm_gpiod_get_optional(&pdev->dev, "enable",
+ GPIOD_OUT_HIGH);
info->id_gpiod = devm_gpiod_get(&pdev->dev, "id", GPIOD_IN);
if (IS_ERR(info->id_gpiod)) {
dev_err(dev, "failed to get ID GPIO\n");
@@ -155,6 +158,8 @@ static int usb_extcon_remove(struct plat
cancel_delayed_work_sync(&info->wq_detcable);
+ gpiod_set_value_cansleep(info->enable_gpiod, 0);
+
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] extcon-usb-gpio: add enable pin support
2015-12-10 23:07 [PATCH] extcon-usb-gpio: add enable pin support Sergei Shtylyov
@ 2015-12-11 3:53 ` Rob Herring
2015-12-11 18:33 ` Sergei Shtylyov
2015-12-11 4:05 ` Chanwoo Choi
1 sibling, 1 reply; 5+ messages in thread
From: Rob Herring @ 2015-12-11 3:53 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: pawel.moll, mark.rutland, ijc+devicetree, galak, myungjoo.ham,
cw00.choi, devicetree, linux-kernel, linux-sh, linux-usb
On Fri, Dec 11, 2015 at 02:07:05AM +0300, Sergei Shtylyov wrote:
> Sometimes there's a real OTG chip behind the USB ID signal mapped to a GPIO
> pin: in my case it's Maxim Integrated MAX3355E which integrates Vbus charge
> pump and comparators and passes thru the ID signal from an OTG connector.
> This chip also has the SHDN# pin which should be driven high for the normal
> operation and low to save power; it is connected to a GPIO pin as well on,
> hence we'll have to teach the driver to parse the new optional device tree
> property, "enable-gpio"...
Some wierd spacing going on here.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> ---
> The patch is against the 'extcon-next' branch of the 'extcon.git' repo.
>
> Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++
> drivers/extcon/extcon-usb-gpio.c | 5 +++++
> 2 files changed, 8 insertions(+)
>
> Index: extcon/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> =================================> --- extcon.orig/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> +++ extcon/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> @@ -7,6 +7,9 @@ Required properties:
> - compatible: Should be "linux,extcon-usb-gpio"
> - id-gpio: gpio for USB ID pin. See gpio binding.
>
> +Optional properties:
> +- enable-gpio: gpio for the enable pin. See gpio binding.
Use -gpios as -gpio is deprecated.
> +
> Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below:
> extcon_usb1 {
> compatible = "linux,extcon-usb-gpio";
> Index: extcon/drivers/extcon/extcon-usb-gpio.c
> =================================> --- extcon.orig/drivers/extcon/extcon-usb-gpio.c
> +++ extcon/drivers/extcon/extcon-usb-gpio.c
> @@ -33,6 +33,7 @@ struct usb_extcon_info {
> struct device *dev;
> struct extcon_dev *edev;
>
> + struct gpio_desc *enable_gpiod;
> struct gpio_desc *id_gpiod;
> int id_irq;
>
> @@ -99,6 +100,8 @@ static int usb_extcon_probe(struct platf
> return -ENOMEM;
>
> info->dev = dev;
> + info->enable_gpiod = devm_gpiod_get_optional(&pdev->dev, "enable",
> + GPIOD_OUT_HIGH);
> info->id_gpiod = devm_gpiod_get(&pdev->dev, "id", GPIOD_IN);
> if (IS_ERR(info->id_gpiod)) {
> dev_err(dev, "failed to get ID GPIO\n");
> @@ -155,6 +158,8 @@ static int usb_extcon_remove(struct plat
>
> cancel_delayed_work_sync(&info->wq_detcable);
>
> + gpiod_set_value_cansleep(info->enable_gpiod, 0);
Shouldn't you support either polarity?
Rob
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] extcon-usb-gpio: add enable pin support
2015-12-11 3:53 ` Rob Herring
@ 2015-12-11 18:33 ` Sergei Shtylyov
0 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-12-11 18:33 UTC (permalink / raw)
To: Rob Herring
Cc: pawel.moll, mark.rutland, ijc+devicetree, galak, myungjoo.ham,
cw00.choi, devicetree, linux-kernel, linux-sh, linux-usb
Hello.
On 12/11/2015 06:53 AM, Rob Herring wrote:
>> Sometimes there's a real OTG chip behind the USB ID signal mapped to a GPIO
>> pin: in my case it's Maxim Integrated MAX3355E which integrates Vbus charge
>> pump and comparators and passes thru the ID signal from an OTG connector.
>> This chip also has the SHDN# pin which should be driven high for the normal
>> operation and low to save power; it is connected to a GPIO pin as well on,
>> hence we'll have to teach the driver to parse the new optional device tree
>> property, "enable-gpio"...
>
> Some wierd spacing going on here.
I like my text properly filling up the given columns. What's the problem? :-)
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>
>> ---
>> The patch is against the 'extcon-next' branch of the 'extcon.git' repo.
>>
>> Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++
>> drivers/extcon/extcon-usb-gpio.c | 5 +++++
>> 2 files changed, 8 insertions(+)
>>
>> Index: extcon/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
>> =================================>> --- extcon.orig/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
>> +++ extcon/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
>> @@ -7,6 +7,9 @@ Required properties:
>> - compatible: Should be "linux,extcon-usb-gpio"
>> - id-gpio: gpio for USB ID pin. See gpio binding.
>>
>> +Optional properties:
>> +- enable-gpio: gpio for the enable pin. See gpio binding.
>
> Use -gpios as -gpio is deprecated.
Didn't know, thanks.
[...]
>> Index: extcon/drivers/extcon/extcon-usb-gpio.c
>> =================================>> --- extcon.orig/drivers/extcon/extcon-usb-gpio.c
>> +++ extcon/drivers/extcon/extcon-usb-gpio.c
[...]
>> @@ -99,6 +100,8 @@ static int usb_extcon_probe(struct platf
>> return -ENOMEM;
>>
>> info->dev = dev;
>> + info->enable_gpiod = devm_gpiod_get_optional(&pdev->dev, "enable",
>> + GPIOD_OUT_HIGH);
>> info->id_gpiod = devm_gpiod_get(&pdev->dev, "id", GPIOD_IN);
>> if (IS_ERR(info->id_gpiod)) {
>> dev_err(dev, "failed to get ID GPIO\n");
>> @@ -155,6 +158,8 @@ static int usb_extcon_remove(struct plat
>>
>> cancel_delayed_work_sync(&info->wq_detcable);
>>
>> + gpiod_set_value_cansleep(info->enable_gpiod, 0);
> Shouldn't you support either polarity?
The gpiolib does that for me -- devm_gpiod_get_optional() should read the
polarity from DT.
> Rob
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] extcon-usb-gpio: add enable pin support
2015-12-10 23:07 [PATCH] extcon-usb-gpio: add enable pin support Sergei Shtylyov
2015-12-11 3:53 ` Rob Herring
@ 2015-12-11 4:05 ` Chanwoo Choi
2015-12-11 14:44 ` Sergei Shtylyov
1 sibling, 1 reply; 5+ messages in thread
From: Chanwoo Choi @ 2015-12-11 4:05 UTC (permalink / raw)
To: Sergei Shtylyov, robh+dt, pawel.moll, mark.rutland,
ijc+devicetree, galak, myungjoo.ham, devicetree
Cc: linux-kernel, linux-sh, linux-usb
Hi Sergei,
On 2015년 12월 11일 08:07, Sergei Shtylyov wrote:
> Sometimes there's a real OTG chip behind the USB ID signal mapped to a GPIO
> pin: in my case it's Maxim Integrated MAX3355E which integrates Vbus charge
> pump and comparators and passes thru the ID signal from an OTG connector.
s/thru/through ?
> This chip also has the SHDN# pin which should be driven high for the normal
> operation and low to save power; it is connected to a GPIO pin as well on,
> hence we'll have to teach the driver to parse the new optional device tree
> property, "enable-gpio"...
This patch description includes the double space between words. Also, I think
you need to write the patch description again for formal style.
This patch adds the specific 'enable-gpio' pin to express the SHDN#pin for MAX3355E.
I think it is not regular and standard case because maybe USB specification
don't include the SHDN#pin information. I think it not appropriate way.
Instead, you better to make the MAX3355 extcon driver to support this case.
Thanks,
Chanwoo
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> ---
> The patch is against the 'extcon-next' branch of the 'extcon.git' repo.
>
> Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++
> drivers/extcon/extcon-usb-gpio.c | 5 +++++
> 2 files changed, 8 insertions(+)
>
> Index: extcon/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> =================================> --- extcon.orig/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> +++ extcon/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> @@ -7,6 +7,9 @@ Required properties:
> - compatible: Should be "linux,extcon-usb-gpio"
> - id-gpio: gpio for USB ID pin. See gpio binding.
>
> +Optional properties:
> +- enable-gpio: gpio for the enable pin. See gpio binding.
> +
> Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below:
> extcon_usb1 {
> compatible = "linux,extcon-usb-gpio";
> Index: extcon/drivers/extcon/extcon-usb-gpio.c
> =================================> --- extcon.orig/drivers/extcon/extcon-usb-gpio.c
> +++ extcon/drivers/extcon/extcon-usb-gpio.c
> @@ -33,6 +33,7 @@ struct usb_extcon_info {
> struct device *dev;
> struct extcon_dev *edev;
>
> + struct gpio_desc *enable_gpiod;
> struct gpio_desc *id_gpiod;
> int id_irq;
>
> @@ -99,6 +100,8 @@ static int usb_extcon_probe(struct platf
> return -ENOMEM;
>
> info->dev = dev;
> + info->enable_gpiod = devm_gpiod_get_optional(&pdev->dev, "enable",
> + GPIOD_OUT_HIGH);
> info->id_gpiod = devm_gpiod_get(&pdev->dev, "id", GPIOD_IN);
> if (IS_ERR(info->id_gpiod)) {
> dev_err(dev, "failed to get ID GPIO\n");
> @@ -155,6 +158,8 @@ static int usb_extcon_remove(struct plat
>
> cancel_delayed_work_sync(&info->wq_detcable);
>
> + gpiod_set_value_cansleep(info->enable_gpiod, 0);
> +
> return 0;
> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] extcon-usb-gpio: add enable pin support
2015-12-11 4:05 ` Chanwoo Choi
@ 2015-12-11 14:44 ` Sergei Shtylyov
0 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-12-11 14:44 UTC (permalink / raw)
To: Chanwoo Choi, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
galak, myungjoo.ham, devicetree
Cc: linux-kernel, linux-sh, linux-usb
Hello.
On 12/11/2015 07:05 AM, Chanwoo Choi wrote:
>> Sometimes there's a real OTG chip behind the USB ID signal mapped to a GPIO
>> pin: in my case it's Maxim Integrated MAX3355E which integrates Vbus charge
>> pump and comparators and passes thru the ID signal from an OTG connector.
>
> s/thru/through ?
"Thru" is valid English.
>> This chip also has the SHDN# pin which should be driven high for the normal
>> operation and low to save power; it is connected to a GPIO pin as well on,
>> hence we'll have to teach the driver to parse the new optional device tree
>> property, "enable-gpio"...
> This patch description includes the double space between words. Also, I think
So what?
> you need to write the patch description again for formal style.
Not sure I understand you.
> This patch adds the specific 'enable-gpio' pin to express the SHDN#pin for MAX3355E.
> I think it is not regular and standard case because maybe USB specification
> don't include the SHDN#pin information.
Certainly, it's not a USB pin.
> I think it not appropriate way.
> Instead, you better to make the MAX3355 extcon driver to support this case.
OK, just didn't want to duplicate most of this driver there...
> Thanks,
> Chanwoo
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-11 18:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10 23:07 [PATCH] extcon-usb-gpio: add enable pin support Sergei Shtylyov
2015-12-11 3:53 ` Rob Herring
2015-12-11 18:33 ` Sergei Shtylyov
2015-12-11 4:05 ` Chanwoo Choi
2015-12-11 14:44 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).