devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
	Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	Roman Byshko <rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [linux-sunxi] Re: [PATCH v4 1/2] phy-sun4i-usb: Add full support for usb0 phy / OTG
Date: Thu, 11 Jun 2015 11:38:53 +0200	[thread overview]
Message-ID: <5579572D.4070006@redhat.com> (raw)
In-Reply-To: <557955D4.4030908-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Hi,

On 11-06-15 11:33, Chanwoo Choi wrote:
> Hi,
>
> On 06/11/2015 05:59 PM, Hans de Goede wrote:
>> Hi,
>>
>> On 11-06-15 10:29, Chanwoo Choi wrote:
>>> Hi Hans,
>>>
>>> On 06/11/2015 05:21 PM, Hans de Goede wrote:
>>>> Hi Chanwoo,
>>>>
>>>> Thanks for the quick review.
>>>>
>>>> On 11-06-15 10:07, Chanwoo Choi wrote:
>>>>> Hi Hans,
>>>>>
>>>>> I add the comment about extcon-related code.
>>>>>
>>>>> Firstly,
>>>>> I'd like you to implment the extcon driver for phy-sun4i-usb device
>>>>> in drivers/extcon/ directoryby using MFD
>>>>
>>>> No, just no, this is not what the MFD framework is for, the usb-phy
>>>> in question here is not a multifunction device. The MFD framework
>>>> is intended for true multi-function devices like i2c attached
>>>> PMICs which have regulators, gpios, pwm, input (power button),
>>>> chargers, power-supply, etc. That is NOT the case here.
>>>>
>>>> Also moving this to the MFD framework would very likely requiring
>>>> the devicetree binding for the usb-phy to change which we cannot
>>>> do as that would break the devicetree ABI.
>>>>
>>>>> because there are both extcon
>>>>> provider driver and extcon client driver. I think that all extcon
>>>>> provider driver better to be included in drivers/extcon/ directory.
>>>>> extcon_set_cable_state() function should be handled in extcon provider
>>>>> driver which is incluced in drivers/extcon/ directory.
>>>>
>>>> I do not find this a compelling reason, there are plenty of subsystems
>>>> where not all implementations of the subsystem class live in the subsystem
>>>> directory, e.g. input and hwmon devices are often also found outside of
>>>> the input and hwmon driver directories.
>>>
>>> There are difference on between input/hwmon and extcon.
>>>
>>> Because input and hwmon driver implement the only one type driver as provider driver.
>>> But, extcon implement the two type driver of both extcon provider and extcon client driver.
>>> The extcon is similiar with regulator and clock framework as resource.
>>>
>>> extcon provider driver to provider the event when the state of external connector is changed.
>>> - devm_extcon_dev_register()
>>> - e.g., almost extcon provider driver are included in 'drivers/extcon/' directory.
>>
>> I understand, but that does not change my first argument, that the usb-phy is not
>> a MFD device. And although it may be desirable to keep extcon provider drivers
>> in the drivers/extcon, there are no technical reasons to do so.
>>
>> The whole reason why Kishon asked me to start using the extcon framework is to avoid
>> adding a private API to the phy-sun4i-usb code for notifying the musb-sunxi code
>> about otg-id-pin status changes. Adding a separate driver for just the extcon bits
>> means re-adding a private api to the phy-sun4i-usb code but this time for the
>> extcon code, at which point we might just as well skip extcon and have the
>> musb-sunxi glue code call directly into the phy-sun4i-usb code...
>>
>> Needing a private API for a separate extcn driver actually is a good argument to
>> NOT have a separate extcon driver and keep the extcon code in the phy-sun4i-usb code,
>> where as I see no technical arguments in favor of a separate extcon driver.
>
> There is one technical issue.
>
> The extcon_set_cable_state() should be handled by extcon provider driver.

That is something which can be done regardless of where the extcon provider
driver code is located in the kernel tree...

> because extcon_set_cable_state() inform the extcon client driver of the event
> when detecting the change of h/w line (gpio line) or register of peripheral device.
>
> But, extcon client driver can now get the instance of extcon_dev structure
> by extcon_get_edev_by_phandle() and then can change the cable state by using the extcon_set_cable_state().
>
> I think that these issue have to be protected by framework level.

Protecting this at the framework level would mean protecting it with code
in drivers/extcon/extcon.c, that code will be used (and thus can protect
things) regardless of where the extcon provider code lives.

I really still see no technical reasons why all extcon provider code
MUST be under drivers/extcon.

As for the whole provider <-> client relation as argument, the same goes
for irq-chips and any code with irq handlers, yet we have irc-chip drivers
(irq providers) all over the place.

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" 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:[~2015-06-11  9:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-31 16:10 [PATCH v4 0/2] Remaining sunxi musb patches Hans de Goede
     [not found] ` <1433088626-8858-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-31 16:10   ` [PATCH v4 1/2] phy-sun4i-usb: Add full support for usb0 phy / OTG Hans de Goede
     [not found]     ` <1433088626-8858-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-01  9:22       ` Maxime Ripard
2015-06-01  9:28         ` Hans de Goede
     [not found]           ` <556C25B7.80708-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-02 15:22             ` Maxime Ripard
2015-06-11  5:48       ` Kishon Vijay Abraham I
     [not found]         ` <55792122.20607-l0cyMroinI0@public.gmane.org>
2015-06-11  7:56           ` [linux-sunxi] " Hans de Goede
     [not found]             ` <55793F41.7000304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-11  8:28               ` Hans de Goede
2015-06-11  8:07           ` Chanwoo Choi
     [not found]             ` <557941A6.5000306-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-11  8:21               ` [linux-sunxi] " Hans de Goede
     [not found]                 ` <557944EE.1020303-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-11  8:29                   ` Chanwoo Choi
     [not found]                     ` <557946EC.3060607-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-11  8:59                       ` [linux-sunxi] " Hans de Goede
     [not found]                         ` <55794DEA.1050604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-11  9:33                           ` Chanwoo Choi
     [not found]                             ` <557955D4.4030908-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-11  9:37                               ` [linux-sunxi] " Chanwoo Choi
2015-06-11  9:38                               ` Hans de Goede [this message]
     [not found]                                 ` <5579572D.4070006-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-11 10:30                                   ` Chanwoo Choi
2015-06-11  9:42       ` Kishon Vijay Abraham I
     [not found]         ` <55795800.4070405-l0cyMroinI0@public.gmane.org>
2015-06-11  9:53           ` Hans de Goede
     [not found]             ` <55795A98.8090303-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-11 11:16               ` Kishon Vijay Abraham I
     [not found]                 ` <55796E23.90509-l0cyMroinI0@public.gmane.org>
2015-06-11 12:35                   ` [linux-sunxi] " Hans de Goede
     [not found]                     ` <5579808C.2080208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-11 12:59                       ` Kishon Vijay Abraham I
2015-07-15 10:55       ` Kishon Vijay Abraham I
     [not found]         ` <55A63C1B.1010503-l0cyMroinI0@public.gmane.org>
2015-07-15 10:58           ` Kishon Vijay Abraham I
2015-05-31 16:10   ` [PATCH v4 2/2] musb: Add support for the Allwinner sunxi musb controller Hans de Goede
     [not found]     ` <1433088626-8858-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-02 15:02       ` Felipe Balbi
2015-06-01 18:30   ` [PATCH v4 0/2] Remaining sunxi musb patches Hans de Goede
     [not found]     ` <79fc4306-a621-43b8-b347-e42a27beb134-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-06-01 18:34       ` Felipe Balbi
     [not found]         ` <20150601183447.GF26081-HgARHv6XitJaoMGHk7MhZQC/G2K4zDHf@public.gmane.org>
2015-06-02  7:14           ` Hans de Goede
     [not found]             ` <556D57BD.90502-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-02 14:45               ` Felipe Balbi

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=5579572D.4070006@redhat.com \
    --to=hdegoede-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@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).