Re: [PATCH v1 1/4] dt-bindings: iio: adc: Add ltc2378

From: Marcelo Schmitt

Date: Mon May 18 2026 - 14:44:52 EST


Hi Conor,

On 05/18, Conor Dooley wrote:
> On Mon, May 18, 2026 at 12:21:01PM -0300, Marcelo Schmitt wrote:
> > From: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx>
> >
> > Document how to describe LTC2378-20 and similar ADCs in device tree.
> >
> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx>
> > ---
...
> > +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.
...
>
> 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.
>
Some devices can be grouped by main number (e.g. ltc2378-16, -18, -20) and
those vary only on the amount of precision bits. I initially thought we could
fallback to reading only 16 or 18 bits if a driver compatible with ltc2378-20 is
not found. Though, I now realize that won't work because the less significant
bits would be missing which would compromise scaling the data to milli volts.
Will make this a unique match list (no separate items lists, no fallbacks).

...
> > +
> > +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).

Ack, switching to 'unevaluatedProperties: false'.

Thanks,
Marcelo