Devicetree
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, jic23@kernel.org,
	nuno.sa@analog.com, Michael.Hennerich@analog.com,
	dlechner@baylibre.com, andy@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	pop.ioan-daniel@analog.com
Subject: Re: [PATCH v3 1/5] dt-bindings: iio: adc: Add ltc2378
Date: Wed, 17 Jun 2026 22:16:56 +0100	[thread overview]
Message-ID: <20260617-oat-handclasp-ddd3135c5b84@spud> (raw)
In-Reply-To: <ajLV-O60lCdlIbXR@debian-BULLSEYE-live-builder-AMD64>

[-- Attachment #1: Type: text/plain, Size: 8059 bytes --]

On Wed, Jun 17, 2026 at 02:14:32PM -0300, Marcelo Schmitt wrote:
> On 06/17, Conor Dooley wrote:
> > On Tue, Jun 16, 2026 at 11:03:11PM -0300, Marcelo Schmitt wrote:
> > > Document how to describe LTC2378-20 and similar ADCs in device tree.
> > > 
> > > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> > > ---
> > > Change log v2 -> v3:
> > > - Re-added device tree fallback compatibles for LTC2378 chips, now with options
> > >   to provide a single compatible string or a pair of single compatible string
> > >   plus a fallback string to a slower sample rate spec in case a driver for the
> > >   specific part is not found.
> > > 
> > >  .../bindings/iio/adc/adi,ltc2378.yaml         | 160 ++++++++++++++++++
> > >  MAINTAINERS                                   |   7 +
> > >  2 files changed, 167 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
> > > 
> > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
> > > new file mode 100644
> > > index 000000000000..7d30a2cade8f
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
> > > @@ -0,0 +1,160 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/iio/adc/adi,ltc2378.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Analog Devices LTC2378 and similar Analog to Digital Converters
> > > +
> > > +maintainers:
> > > +  - Marcelo Schmitt <marcelo.schmitt@analog.com>
> > > +
> > > +description: |
> > > +  Analog Devices LTC2378 series of ADCs.
> > > +  Specifications can be found at:
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/233818fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/236416fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/236418f.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/236716fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/236718f.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/236816f.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/236818f.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/236918fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237016fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237616fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237618fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237620fb.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237716fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237718fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237720fb.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237816fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237818fa.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237820fb.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/237918fb.pdf
> > > +    https://www.analog.com/media/en/technical-documentation/data-sheets/238016fb.pdf
> > > +
> > > +$ref: /schemas/spi/spi-peripheral-props.yaml#
> > > +
> > > +properties:
> > > +  compatible:
> > > +    oneOf:
> > > +      # Single compatible string match.
> > > +      - enum:
> > > +          - adi,ltc2338-18
> > > +          - adi,ltc2364-16
> > > +          - adi,ltc2364-18
> > > +          - adi,ltc2367-16
> > > +          - adi,ltc2367-18
> > > +          - adi,ltc2368-16
> > > +          - adi,ltc2368-18
> > > +          - adi,ltc2369-18
> > > +          - adi,ltc2370-16
> > > +          - adi,ltc2376-16
> > > +          - adi,ltc2376-18
> > > +          - adi,ltc2376-20
> > > +          - adi,ltc2377-16
> > > +          - adi,ltc2377-18
> > > +          - adi,ltc2377-20
> > > +          - adi,ltc2378-16
> > > +          - adi,ltc2378-18
> > > +          - adi,ltc2378-20
> > > +          - adi,ltc2379-18
> > > +          - adi,ltc2380-16
> > > +
> > > +      # Low sample rate fallback for 16-bit unipolar sensors.
> > > +      - items:
> > > +          - enum:
> > > +              - adi,ltc2370-16 # 2 MSPS
> > > +              - adi,ltc2368-16 # 1 MSPS
> > > +              - adi,ltc2367-16 # 500 kSPS
> > > +          - const: adi,ltc2364-16 # fallback (250 kSPS)
> > 
> > Your driver still matches on ltc2370-16, which makes me question the
> > value of these fallbacks. That said, the chip info struct contains no
> > information about sampling rate.
> The info about sample rate is added in patch 4.

Ah, I missed that.

> > What actually is the impact of the sample rate on the programming model?
> If the user tries to set a sample rate beyond the maximum supported, software
> can throw an error to indicate that.

I think you have misunderstood this. I was asking how the driver
interacts with the hardware. Do all devices come out of reset with the
minimum sampling rate? Or a per-device default rate? Do the faster
devices support all slower rates? If they do, do the registers have the
same meaning and the same value sets 2370-16 device to 1 MSPS as
2368-16.

> > Is there actually a benefit to matching on ltc2370-16, or can you just
> > match on the fallback?
> The benefit is telling software that it is safe to go up to 2 MSPS. It is also
> okay to match on the fallback, but software may restrain operation to a slower
> sample rate.

My whole review here is shit cos I didn't see patch 4, so the use of
fallbacks seems appropriate (provided your answers to my programming
model questions are sane!).

> 
> With the code being proposed in this patch set, there is no benefit in matching
> the ltc2364-16 fallback if there is a faster ltc2370-16 device connected because
> device driver supports that. Though, other operating systems and/or platforms
> might not support all device variants and so the fallback might be useful.
> 
> > +static const struct ltc2378_chip_info ltc2370_16_chip_info = {
> > +	.name = "ltc2370-16",
> > +	.resolution = 16,
> In a later patch ...
> +	.max_sample_rate_hz = 2 * HZ_PER_MHZ,
> +	.tconv_ns = 322,
> > +	.bipolar = false,
> > +};
> > 
> > +static const struct ltc2378_chip_info ltc2368_16_chip_info = {
> > +	.name = "ltc2368-16",
> > +	.resolution = 16,
> +	.max_sample_rate_hz = HZ_PER_MHZ,
> +	.tconv_ns = 527
> > +	.bipolar = false,
> > +};
> > 
> > +static const struct ltc2378_chip_info ltc2367_16_chip_info = {
> > +	.name = "ltc2367-16",
> > +	.resolution = 16,
> +	.max_sample_rate_hz = 500 * HZ_PER_KHZ,
> +	.tconv_ns = 1500,
> > +	.bipolar = false,
> > +};
> > 
> > +static const struct ltc2378_chip_info ltc2364_16_chip_info = {
> > +	.name = "ltc2364-16",
> > +	.resolution = 16,
> +	.max_sample_rate_hz = 250 * HZ_PER_KHZ,
> +	.tconv_ns = 3000,
> > +	.bipolar = false,
> > +};
> > 
> ...
> > > +      # Low sample rate fallback for 20-bit bipolar sensors.
> > > +      - items:
> > > +          - enum:
> > > +              - adi,ltc2378-20 # 1 MSPS
> > > +              - adi,ltc2377-20 # 500 kSPS
> > > +          - const: adi,ltc2376-20 # fallback (250 kSPS)
> > 
> > I didn't check these, but I assume they are the same.
> 
> Yes, except for small variations on input (unipolar/bipolar) and precision bits,
> these devices are pretty much equal.

What I meant here was that 2378-20, 2377-20 and 2376-20 would follow the
same pattern of having identical match data (pre patch 4).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-06-17 21:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17  2:02 [PATCH v3 0/5] iio: adc: Add support for LTC2378 and similar ADCs Marcelo Schmitt
2026-06-17  2:03 ` [PATCH v3 1/5] dt-bindings: iio: adc: Add ltc2378 Marcelo Schmitt
2026-06-17 16:05   ` Conor Dooley
2026-06-17 17:14     ` Marcelo Schmitt
2026-06-17 21:16       ` Conor Dooley [this message]
2026-06-17 22:04   ` David Lechner
2026-06-17  2:03 ` [PATCH v3 2/5] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs Marcelo Schmitt
2026-06-17  2:16   ` sashiko-bot
2026-06-17 22:18   ` David Lechner
2026-06-17  2:03 ` [RFC PATCH v3 3/5] iio: buffer: Extend DMAengine buffer interfaces to take extra sysfs attributes Marcelo Schmitt
2026-06-17  2:13   ` sashiko-bot
2026-06-17 21:43   ` David Lechner
2026-06-17  2:04 ` [PATCH v3 4/5] iio: adc: ltc2378: Enable high-speed data capture Marcelo Schmitt
2026-06-17  2:17   ` sashiko-bot
2026-06-17 16:26   ` Julian Braha
2026-06-17 22:33   ` David Lechner
2026-06-17  2:04 ` [PATCH v3 5/5] iio: adc: ltc2378: Enable triggered buffer " Marcelo Schmitt
2026-06-17  2:18   ` sashiko-bot
2026-06-17 22:39   ` David Lechner
2026-06-17 22:46 ` [PATCH v3 0/5] iio: adc: Add support for LTC2378 and similar ADCs David Lechner

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=20260617-oat-handclasp-ddd3135c5b84@spud \
    --to=conor@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@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=pop.ioan-daniel@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