From: Jonathan Cameron <jic23@kernel.org>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
Marcelo Schmitt <marcelo.schmitt@analog.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
lars@metafoo.de, Michael.Hennerich@analog.com,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
linus.walleij@linaro.org, brgl@bgdev.pl
Subject: Re: [PATCH v3 01/10] dt-bindings: iio: adc: Add AD4170
Date: Sun, 25 May 2025 11:05:15 +0100 [thread overview]
Message-ID: <20250525110515.6e8cdfb2@jic23-huawei> (raw)
In-Reply-To: <aC89ve8FgIK4gej4@debian-BULLSEYE-live-builder-AMD64>
On Thu, 22 May 2025 12:07:41 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:
> ...
> >
> > > + sensor-node:
> > > + type: object
> > > + $ref: '#/$defs/ad4170-channel'
> >
> > I do not understand this binding. channel@ node is a channel and sensors
> > like rtd@ is also channel but also sensor. What is the point of channel@
> > which is not a sensor?
> >
> The sensor node is meant to describe a channel that has extra setup
> configuration. For example, a common ADC channel could look like this
>
> -------- +VREF ------ +-------------------+
> ´ ` ´ ` / |
> / \ / \ / --- < IN+ |
> `-´ `-´ | |
> -------- -VREF ------ | |
> | ADC |
> -------- +VREF ------ | |
> ´ ` ´ ` | |
> \ / \ / \ --- < IN- |
> `-´ `-´ \ +VREF -VREF |
> -------- -VREF ------ +-------------------+
> ^ ^
> | +---- External -VREF
> External +VREF
>
> The the channel@ node for that would look like
> adc@0 {
> ...
> channel@0 {
> reg = <0>;
> bipolar;
> diff-channels = <0 1>;
> };
> };
>
> Though, some sigma-delta ADCs (including AD4170) are fancy and have features
> that relate to what is connected to the ADC inputs. For example, an RTD would
> be connected like
>
> External +VREF
> |
> +----------------------------------|-------+---- External -VREF
> | +----------------------+ |
> +---Rref----+ +-----v-------v----+
> | | / REFIN+ REFIN- |
> +---+-----------|------------> < IN+ |
> | | | |
> 3-wire RTD | | ADC |
> | | | |
> +--------------------+-------> < IN- |
> | | | \ GPIO2 GPIO3 |
> v | | +-------v-----v----+
> GND | +-------------------+ |
> | <--- IOUT1 |
> +------------------------------+
> <--- IOUT0
>
> A better drawing can be found in AD4170 datasheet Figure 115. 3-Wire RTD Application.
> https://www.analog.com/media/en/technical-documentation/data-sheets/ad4170-4.pdf#unique_151_Connect_42_ID10430
>
> Since the RTD sensor requires additional hardware connections, the proposed
> dt-binding describes those differently, e.g.
>
> adc@0 {
> ...
> rtd@0 {
> reg = <0>;
> bipolar;
> diff-channels = <0 1>;
> adi,sensor-type = /bits/ 8 <1>;
> adi,reference-select = <0>;
> adi,excitation-pins = <19 20>;
> adi,excitation-current-microamp = <500>;
> };
>
> That allows the ADC chip to be configured to provide the excitation signals to
> properly handle the RTD sensor. Because the hardware connections and
> operation requirements vary among those external sensor types (RTDs,
> thermocouples, load cell weigh scales), some properties are only applicable to
> specific sensor types. Also, because those are extra connections, the related
> properties are not meaningful to typical ADC channels.
>
> Though, the supported features are not different from those described in
> Documentation/devicetree/bindings/iio/adc/adi,ad4130.yaml.
> In that binding, the properties related to external sensor support are set
> on the device node (not related to any channel). The binding proposed on AD4170
> RFC patch was more similar to adi,ad4130.yaml and somehow avoiding to introduce
> custom/new properties, but that lead to a lot of duplication.
>
> The currently proposed dt-binding for ad4170 avoids repetition and, to some
> degree, tries to provide better description of connected bridge sensors and
> their related properties as that seemed to be one of Jonathan's suggestions
> to the RFC version.
> https://lore.kernel.org/linux-iio/20241219140353.787ffccc@jic23-huawei/
I don't always make good suggestions :( DT maintainers have more experience
in making coherent and predictable bindings than I do.
One of the big problems is that we are fishing in the dark when trying to
make up 'generic' bindings. Sometimes they just end up not extending well
at all.
>
> Even though I'm naturally biased in favor of my own code, I see this is fairly
> different from bindings describing the exact same features and that can lead
> to confusion. I'll use the same types for properties that describe the same
> things/features. Would it also be preferred to drop the defs and just have
> channel nodes?
If we did do channel nodes only. We have various options.
1) constraints against adi,sensor-types (which I think should probably be an enum)
That should look similar to the node name constraints.
2) constrain only via documentation. (I don't like this at all)
3) have no constraints at all and rely on documenting what makes sense.
I'm not entirely clear on whether we can ignore the sensor type etc and
provide properties to control more directly everything to do with it? So the
excitation types etc
Jonathan
>
> Thanks,
> Marcelo
>
next prev parent reply other threads:[~2025-05-25 10:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-13 12:32 [PATCH v3 00/10] Add support for AD4170 series of ADCs Marcelo Schmitt
2025-05-13 12:33 ` [PATCH v3 01/10] dt-bindings: iio: adc: Add AD4170 Marcelo Schmitt
2025-05-13 15:47 ` David Lechner
2025-05-16 15:45 ` Marcelo Schmitt
2025-05-16 16:06 ` David Lechner
2025-05-21 8:33 ` Krzysztof Kozlowski
2025-05-21 8:41 ` Krzysztof Kozlowski
2025-05-22 15:07 ` Marcelo Schmitt
2025-05-25 10:05 ` Jonathan Cameron [this message]
2025-05-25 10:11 ` Jonathan Cameron
2025-05-26 21:59 ` Marcelo Schmitt
2025-05-31 15:50 ` Jonathan Cameron
2025-05-13 12:34 ` [PATCH v3 02/10] iio: adc: Add basic support for AD4170 Marcelo Schmitt
2025-05-25 10:36 ` Jonathan Cameron
2025-05-26 10:21 ` Nuno Sá
2025-05-13 12:34 ` [PATCH v3 03/10] iio: adc: ad4170: Add support for calibration gain Marcelo Schmitt
2025-05-26 10:24 ` Nuno Sá
2025-05-13 12:34 ` [PATCH v3 04/10] iio: adc: ad4170: Add support for calibration bias Marcelo Schmitt
2025-05-26 10:27 ` Nuno Sá
2025-05-13 12:35 ` [PATCH v3 05/10] iio: adc: ad4170: Add digital filter and sample frequency config support Marcelo Schmitt
2025-05-25 10:41 ` Jonathan Cameron
2025-05-13 12:35 ` [PATCH v3 06/10] iio: adc: ad4170: Add support for buffered data capture Marcelo Schmitt
2025-05-25 10:46 ` Jonathan Cameron
2025-05-13 12:35 ` [PATCH v3 07/10] iio: adc: ad4170: Add clock provider support Marcelo Schmitt
2025-05-13 16:59 ` David Lechner
2025-05-13 12:36 ` [PATCH v3 08/10] iio: adc: ad4170: Add GPIO controller support Marcelo Schmitt
2025-05-20 17:06 ` Bartosz Golaszewski
2025-05-13 12:36 ` [PATCH v3 09/10] iio: adc: ad4170: Add support for internal temperature sensor Marcelo Schmitt
2025-05-13 12:36 ` [PATCH v3 10/10] iio: adc: ad4170: Add support for weigh scale and RTD sensors Marcelo Schmitt
2025-05-25 10:57 ` Jonathan Cameron
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=20250525110515.6e8cdfb2@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=marcelo.schmitt@analog.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.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