Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1289822

Re: [PATCH] extcon-usb-gpio: add enable pin support

From Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Newsgroups linux.kernel
Subject Re: [PATCH] extcon-usb-gpio: add enable pin support
Date 2015-12-11 19:40 +0100
Message-ID <qEALM-8a5-5@gated-at.bofh.it> (permalink)
References <qEivw-4mq-21@gated-at.bofh.it> <qEn2a-7bp-9@gated-at.bofh.it>
Organization Cogent Embedded

Show all headers | View raw


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

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] extcon-usb-gpio: add enable pin support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-12-11 00:10 +0100
  Re: [PATCH] extcon-usb-gpio: add enable pin support Rob Herring <robh@kernel.org> - 2015-12-11 05:00 +0100
    Re: [PATCH] extcon-usb-gpio: add enable pin support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-12-11 19:40 +0100
  Re: [PATCH] extcon-usb-gpio: add enable pin support Chanwoo Choi <cw00.choi@samsung.com> - 2015-12-11 05:10 +0100
    Re: [PATCH] extcon-usb-gpio: add enable pin support Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-12-11 15:50 +0100

csiph-web