Devicetree
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: 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
Subject: Re: [PATCH v1 1/4] dt-bindings: iio: adc: Add ltc2378
Date: Mon, 18 May 2026 18:06:16 +0100	[thread overview]
Message-ID: <20260518-trapped-gauze-ada279af89fc@spud> (raw)
In-Reply-To: <cf404216011b6972519436c63fcc7c4e2c883c54.1779117444.git.marcelo.schmitt1@gmail.com>

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

On Mon, May 18, 2026 at 12:21:01PM -0300, Marcelo Schmitt wrote:
> From: Marcelo Schmitt <marcelo.schmitt@analog.com>
> 
> Document how to describe LTC2378-20 and similar ADCs in device tree.
> 
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> ---
>  .../bindings/iio/adc/adi,ltc2378.yaml         | 131 ++++++++++++++++++
>  MAINTAINERS                                   |   7 +
>  2 files changed, 138 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..56e59bcd7306
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
> @@ -0,0 +1,131 @@
> +# 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:
> +      - enum:
> +          - adi,ltc2338-18
> +          - adi,ltc2369-18
> +          - adi,ltc2370-16
> +          - adi,ltc2379-18
> +          - adi,ltc2380-16
> +      - items:
> +          - enum:
> +              - adi,ltc2364-18
> +              - adi,ltc2364-16 # fallback compatible
> +      - items:
> +          - enum:
> +              - adi,ltc2367-18
> +              - adi,ltc2367-16 # fallback compatible
> +      - items:
> +          - enum:
> +              - adi,ltc2368-18
> +              - adi,ltc2368-16 # fallback compatible
> +      - items:
> +          - enum:
> +              - adi,ltc2376-18
> +              - adi,ltc2376-20
> +              - adi,ltc2376-16 # fallback compatible
> +      - items:
> +          - enum:
> +              - adi,ltc2377-18
> +              - adi,ltc2377-20
> +              - adi,ltc2377-16 # fallback compatible
> +      - items:
> +          - enum:
> +              - adi,ltc2378-18
> +              - adi,ltc2378-20
> +              - adi,ltc2378-16 # fallback compatible

All of these are wrong.

Firstly, your "fallback" setups don't work, because they only permit a
single compatible. Secondly, if they did work, you still need to define
the fallback compatible in isolation for it to be permitted for use when
it isn't a fallback.
And thirdly, your driver appears to show that these devices aren't
actually compatible at all, given there's unique match data for each
one.
+static const struct of_device_id ltc2378_of_match[] = {
+	{ .compatible = "adi,ltc2338-18", .data = &ltc2378_chip_info[ID_LTC2338_18] },
+	{ .compatible = "adi,ltc2364-16", .data = &ltc2378_chip_info[ID_LTC2364_16] },
+	{ .compatible = "adi,ltc2364-18", .data = &ltc2378_chip_info[ID_LTC2364_18] },
+	{ .compatible = "adi,ltc2367-16", .data = &ltc2378_chip_info[ID_LTC2367_16] },
+	{ .compatible = "adi,ltc2367-18", .data = &ltc2378_chip_info[ID_LTC2367_18] },
+	{ .compatible = "adi,ltc2368-16", .data = &ltc2378_chip_info[ID_LTC2368_16] },
+	{ .compatible = "adi,ltc2368-18", .data = &ltc2378_chip_info[ID_LTC2368_18] },
+	{ .compatible = "adi,ltc2369-18", .data = &ltc2378_chip_info[ID_LTC2369_18] },
+	{ .compatible = "adi,ltc2370-16", .data = &ltc2378_chip_info[ID_LTC2370_16] },
+	{ .compatible = "adi,ltc2376-16", .data = &ltc2378_chip_info[ID_LTC2376_16] },
+	{ .compatible = "adi,ltc2376-18", .data = &ltc2378_chip_info[ID_LTC2376_18] },
+	{ .compatible = "adi,ltc2376-20", .data = &ltc2378_chip_info[ID_LTC2376_20] },
+	{ .compatible = "adi,ltc2377-16", .data = &ltc2378_chip_info[ID_LTC2377_16] },
+	{ .compatible = "adi,ltc2377-18", .data = &ltc2378_chip_info[ID_LTC2377_18] },
+	{ .compatible = "adi,ltc2377-20", .data = &ltc2378_chip_info[ID_LTC2377_20] },
+	{ .compatible = "adi,ltc2378-16", .data = &ltc2378_chip_info[ID_LTC2378_16] },
+	{ .compatible = "adi,ltc2378-18", .data = &ltc2378_chip_info[ID_LTC2378_18] },
+	{ .compatible = "adi,ltc2378-20", .data = &ltc2378_chip_info[ID_LTC2378_20] },
+	{ .compatible = "adi,ltc2379-18", .data = &ltc2378_chip_info[ID_LTC2379_18] },
+	{ .compatible = "adi,ltc2380-16", .data = &ltc2378_chip_info[ID_LTC2380_16] },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, ltc2378_of_match);

Why do you have fallbacks here? Is it because a limited set of channels
could be used in the fallback case? At the very least, the rationale for
fallbacks should be explained.

pw-bot: changes-requested

> +
> +  reg:
> +    maxItems: 1
> +
> +  spi-max-frequency:
> +    maximum: 100000000
> +
> +  vdd-supply:
> +    description: A 2.5V supply that powers the chip (VDD).
> +
> +  ovdd-supply:
> +    description:
> +      A 1.71V to 5.25V supply that sets the logic level for digital interface.
> +
> +  ref-supply:
> +    description:
> +      A 2.5V to 5.1V supply for the reference input (REF).
> +
> +  cnv-gpios:
> +    description:
> +      When provided, this property indicates the GPIO that is connected to the
> +      CNV pin.
> +    maxItems: 1
> +
> +  interrupts:
> +    description:
> +      Interrupt for signaling the completion of conversion results. The active
> +      low signal provided on the BUSY pin asserts when ADC conversions finish.
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - vdd-supply
> +  - ovdd-supply
> +  - ref-supply
> +
> +additionalProperties: false

As sashiko pointed out, this is not correct if you want to permit spi
properties other than spi-max-frequency (although I could definitely see
how this would be correct).

Cheers,
Conor.

> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        adc@0 {
> +            compatible = "adi,ltc2378-20";
> +            reg = <0>;
> +            spi-max-frequency = <71000000>;
> +            vdd-supply = <&supply_2_5V>;
> +            ovdd-supply = <&supply_3_3V>;
> +            ref-supply = <&supply_5V>;
> +            cnv-gpios = <&gpio0 88 GPIO_ACTIVE_HIGH>;
> +            interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
> +            interrupt-parent = <&gpio>;
> +        };
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 0de74503df08..768f56eea476 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15195,6 +15195,13 @@ S:	Maintained
>  F:	Documentation/devicetree/bindings/iio/dac/lltc,ltc1660.yaml
>  F:	drivers/iio/dac/ltc1660.c
>  
> +LTC2378 IIO ADC DRIVER
> +M:	Marcelo Schmitt <marcelo.schmitt@analog.com>
> +L:	linux-iio@vger.kernel.org
> +S:	Supported
> +W:	https://ez.analog.com/linux-software-drivers
> +F:	Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
> +
>  LTC2664 IIO DAC DRIVER
>  M:	Michael Hennerich <michael.hennerich@analog.com>
>  M:	Kim Seer Paller <kimseer.paller@analog.com>
> -- 
> 2.53.0
> 

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

  parent reply	other threads:[~2026-05-18 17:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18 15:20 [PATCH v1 0/4] iio: adc: Add support for LTC2378 and similar ADCs Marcelo Schmitt
2026-05-18 15:21 ` [PATCH v1 1/4] dt-bindings: iio: adc: Add ltc2378 Marcelo Schmitt
2026-05-18 15:29   ` sashiko-bot
2026-05-18 17:06   ` Conor Dooley [this message]
2026-05-18 18:42     ` Marcelo Schmitt
2026-05-18 15:21 ` [PATCH v1 2/4] iio: adc: Add support for LTC2378-20 and similar ADCs Marcelo Schmitt
2026-05-18 15:51   ` sashiko-bot
2026-05-18 15:22 ` [PATCH v1 3/4] iio: adc: ltc2378: Enable high-speed data capture Marcelo Schmitt
2026-05-18 16:19   ` sashiko-bot
2026-05-18 15:22 ` [PATCH v1 4/4] iio: adc: ltc2378: Enable triggered buffer " Marcelo Schmitt

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=20260518-trapped-gauze-ada279af89fc@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=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