devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chanwoo Choi <cwchoi00-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Venkat Reddy Talla
	<vreddytalla-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	MyungJoo Ham
	<myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Laxman Dewangan
	<ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v4] extcon: gpio: Add the support for Device tree bindings
Date: Tue, 31 May 2016 23:34:48 +0900	[thread overview]
Message-ID: <CAGTfZH1ZAD_R1q8COUE2hdrq24BS1muJ=7-_1VeHriBqH+aAZQ@mail.gmail.com> (raw)
In-Reply-To: <CAL_JsqLpWMX3X77xyVH=5+AtEaRiY9ShkEo0TdHOphqE654OXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi Rob,

On Tue, May 31, 2016 at 10:35 PM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Tue, May 31, 2016 at 2:35 AM, Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
>> Hi Rob,
>>
>> On 2016년 05월 31일 15:44, Chanwoo Choi wrote:
>>> On 2016년 05월 28일 00:29, Rob Herring wrote:
>>>> On Thu, May 26, 2016 at 05:17:45PM +0530, Venkat Reddy Talla wrote:
>>>>> Add the support for Device tree bindings of extcon-gpio driver.
>>>>> The extcon-gpio device tree node must include the both 'extcon-id' and
>>>>> 'gpios' property.
>>>>
>>>> I think extcon bindings are a mess in general...
>>>>
>>>>> For example:
>>>>>     usb_cable: extcon-gpio-0 {
>>>>>             compatible = "extcon-gpio";
>>>>>             extcon-id = <EXTCON_USB>;
>>>>>             gpios = <&gpio6 1 GPIO_ACTIVE_HIGH>;
>>>>>     }
>>>>>     ta_cable: extcon-gpio-1 {
>>>>>             compatible = "extcon-gpio";
>>>>>             extcon-id = <EXTCON_CHG_USB_DCP>;
>>>>>             gpios = <&gpio3 2 GPIO_ACTIVE_LOW>;
>>>>>             debounce-ms = <50>;     /* 50 millisecond */
>>>>>             wakeup-source;
>>>>>     }
>>>>
>>>> This is all 1 logical connector, the USB connector. Why are you
>>>> describing cables? Those are not part of the h/w and are dynamic.
>>>> Describe this as a connector which is one thing (i.e. node). Use a
>>>> compatible string that reflects the type of connector
>>>> (usb-microab-connector), not the driver you want to use. Then define
>>>> GPIO lines needed to provide state information like VBus, ID, charger
>>>> modes and control lines like soft connect (D+ pullup enable), VBus
>>>> enable, etc.
>>>
>>> You're right. The extcon-gpio driver will not use the "extcon-gpio" raw compatible.
>>> As you commented[1], the each connector will have the unique name to use the extcon-gpio.c driver.
>>> [1] https://lkml.org/lkml/2015/10/21/906
>>>
>>>
>>> For example,
>>> The extcon-gpio.c driver may have the different name including the h/w information
>>> according to the kind of external connector.
>>>
>>> static const struct of_device_id gpio_extcon_of_match[] = {
>>>       {
>>>               .compatible = "extcon-chg-sdp", /* SDP charger connector */
>>>               .data = EXTCON_CHG_SDP_DATA,
>>>       }, {
>>>               .compatible = "extcon-chg-dcp", /* DCP charger connector */
>>>               .data = EXTCON_CHG_DCP_DATA,
>>>       }, {
>>>               .compatible = "extcon-jack-microphone", /* Microphone jack connector */
>>>               .data = EXTCON_JACK_MICROPHONE_DATA,
>>>       }, {
>>>               .compatible = "extcon-disp-hdmi", /* HDMI connector*/
>>>               .data = EXTCON_DISP_HDMI_DATA,
>>>       },
>>>       ......
>>> };
>>
>> I reply it again.
>>
>> The extcon-gpio.c is very similar with existing gpio_keys.c driver[1]
>> [1] drivers/input/keyboard/gpio_keys.c
>
> There is a big difference in that each gpio-key is independent. The
> only state is pressed or not. A USB connector has multiple pieces of
> state information. You may be treating them independently, but I don't
> think they should be.

I think that is it not different because the EXTCON can only notify the whether
external connector is attached or detached such as gpio-key (pressed or not).

EXTCON don't handle the any additional state except for attached or detached.

>
>> The gpio_keys.c driver use the following style to support the device-tree.
>> It use the "gpio-keys" compatible and this dt node include the specific
>> 'key code' such as 'extcon-id = <EXTCON_CHG_USB_DCP>;'
>
> This is state information about what is currently attached. The
> analogy with gpio-keys would be multiple key codes on one gpio which
> would be broken...

I compared between 'gpis-keys'  and ' extcon-gpio' driver as following:

name      | gpio-keys                         | extcon-gpio
---------------------------------------------------------------------------------------------
gpio        | gpios = <>                        | extcon-gpio = <>
---------------------------------------------------------------------------------------------
type        | linux,code = <>                 | extcon-id = <>
---------------------------------------------------------------------------------------------
key &      | KEY_POWER                  | EXTCON_USB
extcon id | KEY_VOLUME_UP         | EXTCON_CHG_USB_SDP
               | KEY_VOLUME_DOWN   | EXTCON_JACK_MICROPHONE
               | etc                                    | etc
---------------------------------------------------------------------------------------------
state       | pressed or not                  | attached or detached
---------------------------------------------------------------------------------------------

>
>>
>>         gpio_keys {
>>                 compatible = "gpio-keys";
>>
>>                 power_key {
>>                         gpios = <&gpx2 7 GPIO_ACTIVE_LOW>;
>>                         linux,code = <KEY_POWER>;
>>                         label = "power key";
>>                         debounce-interval = <10>;
>>                         wakeup-source;
>>                 };
>>         };
>>
>> If the extcon-gpio.c driver should have the separate compatible according to
>> the kind of external connector, the list of compatible name of extcon-gpio.c driver
>> will be increased when new external connector is attached.
>
> So? Different h/w needs different compatible strings.
>
> But again, you are mixing describing the connector (only what is
> soldered on a board) and state information (what is attached). Do not
> put state information into DT (describe the gpio signals or chip that
> provides the state information).
>
>> The extcon-gpio.c driver can separate the kind of external connector
>> by using the 'extcon-id' property.
>
> This use of DT is just broken. Come up with another way.
>
> Rob

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-05-31 14:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 11:47 [PATCH v4] extcon: gpio: Add the support for Device tree bindings Venkat Reddy Talla
2016-05-26 13:21 ` Chanwoo Choi
2016-05-27  5:13   ` Venkat Reddy Talla
2016-05-31  7:13     ` Chanwoo Choi
2016-05-27 15:29 ` Rob Herring
2016-05-31  6:44   ` Chanwoo Choi
2016-05-31  7:35     ` Chanwoo Choi
2016-05-31 13:35       ` Rob Herring
2016-05-31 13:44         ` Laxman Dewangan
2016-05-31 15:48           ` Rob Herring
2016-06-01 14:49             ` Laxman Dewangan
2016-06-01 16:00               ` Rob Herring
     [not found]         ` <CAL_JsqLpWMX3X77xyVH=5+AtEaRiY9ShkEo0TdHOphqE654OXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-31 14:34           ` Chanwoo Choi [this message]
2016-06-02  0:06             ` Chanwoo Choi
2016-06-07  1:52             ` Chanwoo Choi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGTfZH1ZAD_R1q8COUE2hdrq24BS1muJ=7-_1VeHriBqH+aAZQ@mail.gmail.com' \
    --to=cwchoi00-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vreddytalla-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).