[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dbbeb52c-18f4-415a-b2d4-520dd0184dda@baylibre.com>
Date: Sun, 16 Feb 2025 11:50:55 -0600
From: David Lechner <dlechner@...libre.com>
To: Jonathan Cameron <jic23@...nel.org>,
Matti Vaittinen <mazziesaccount@...il.com>
Cc: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Lars-Peter Clausen <lars@...afoo.de>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Nuno Sa <nuno.sa@...log.com>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/5] iio: adc: add helpers for parsing ADC nodes
On 2/11/25 1:07 PM, Jonathan Cameron wrote:
> On Tue, 11 Feb 2025 10:52:51 +0200
> Matti Vaittinen <mazziesaccount@...il.com> wrote:
>
>> Hi Jonathan,
>>
>> Thanks for the review and all the comments!
>>
>> Just a note that I am currently spending some quality time with
>> rebuilding the floor of my house. Leaking floor drain can cause a bit of
>> a work... :rolleyes: So, my time with upstream work is a bit limited -
>> although writing an occasional bug or two can help one to keep the
>> balance ;)
>>
>> Anyways, my replies and new versions may be slower than usual..
>>
>> On 08/02/2025 18:41, Jonathan Cameron wrote:
>>> On Wed, 5 Feb 2025 15:34:51 +0200
>>> Matti Vaittinen <mazziesaccount@...il.com> wrote:
>>>
>>>> There are ADC ICs which may have some of the AIN pins usable for other
>>>> functions. These ICs may have some of the AIN pins wired so that they
>>>> should not be used for ADC.
>>>>
>>>> (Preferred?) way for marking pins which can be used as ADC inputs is to
>>>> add corresponding channels@N nodes in the device tree as described in
>>>> the ADC binding yaml.
>>>>
>>>> Add couple of helper functions which can be used to retrieve the channel
>>>> information from the device node.
>>>>
>>>> Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
>>>>
>>>> ---
>>>> Revision history:
>>>> RFC v1 => v2:
>>>> - New patch
>>>>
>>>> I think it might be nice to have helpers for fetching also the other
>>>> generic (non vendor specific) ADC properties (as listed in the
>>>> Documentation/devicetree/bindings/iio/adc/adc.yaml) - but as I don't
>>>> have use for those in BD79124 driver (at least not for now), I don't
>>>> imnplement them yet. Anyways, this commit creates a place for such
>>>> helpers.
>>>
>>> There is often a mix of vendor specific and not in channel nodes.
>>> Hence I'm not sure how widely this will be and it is driver
>>> specific which of the standard things make sense.
>>
>> I definitely agree. Still, in my experience, no written standard
>> standardizes use as well as written helpers ;) More we support parsing
>> the generic helpers by the (add subsystem here)-core, more the driver
>> writes will use the generic properties (instead of brewing vendor
>> specific ones).
>>
>>> So before I'd consider a helper like this I'd want to see it alongside
>>> a bunch of users including some of the complex ones so that we know
>>> it generalizes well enough. It doesn't make sense to introduce
>>> it otherwise - just keep the code in the specific drivers instead.
>>>
>>> It's an interesting idea, but not a trivial one :)
>>
>> I agree it's not trivial. But I believe adding helpers one-by-one to
>> cover 'normal' use-cases guide the use of the properties. Those who need
>> something more exotic can always implement their custom handlers - and
>> then a reviewer of such handler can ask "why" ;)
> I'd be fine with a series taking on the task of converting handling of
> all the documented properties in adc.yaml
>
> If we do less than that it may never get wide adoption and we end
> up with a bit of generic looking infrastructure that isn't generic.
>
Having reviewed quite a few patches recently that make use of these
generic channel properties (and writing one driver myself), I don't
really see how we could make generic functions for these that would
be any simpler than calling the fwnode_property functions directly
other than maybe saving a few arguments. The "normal" operation for
these properties usually involves poking some registers on the chip
(could be immediately or deferred) to configure it. So the only thing
we could generalize is reading the property value, but not doing
anything with that information.
Powered by blists - more mailing lists