Re: [PATCH v2 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation

Jonathan Cameron
2024-07-08T15:57:23Z

On Mon, 8 Jul 2024 14:23:44 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hi Krzysztof,
>
> krzk@kernel.org wrote on Mon, 8 Jul 2024 09:33:04 +0200:
>
> > On 08/07/2024 08:30, Miquel Raynal wrote:
> > > Hi Conor,
> > >
> > >>>>> +properties:
> > >>>>> + compatible:
> > >>>>> + oneOf:
> > >>>>> + - items:
> > >>>>> + - enum:
> > >>>>> + - sophgo,cv1800b-saradc
> > >>>>> + - const: sophgo,cv18xx-saradc
> > >>>>
> > >>>> I don't think the fallback here makes sense. If there's other devices
> > >>>> with a compatible programming model added later, we can fall back to the
> > >>>> cv1800b.
> > >
> > > I'm sorry but isn't this slightly disagreeing with the "writing
> > > bindings" doc pointed in v1? It says,
> > >
> > > * DO use fallback compatibles when devices are the same as or a subset
> > > of prior implementations.
> > >
> > > I believe we fall in the "devices are the same" category, so I would
> > > have myself wrote a similar binding here with a compatible matching
> > > them all, plus a hardware-implementation-specific compatible as well;
> > > just in case.
> >
> > Fallback from one model to another. There is no "another" model here,
> > but wildcard. There is no such device as cv18xx, right?
>
> No there is not. But I don't think there is a "base" model either.
> Just multiple SoCs named cv18<something> with apparently the same ADC.
>
> So actually I guess the discussion here is about the wildcard
> compatible. It feels strange to me to have no generic compatible either
> with a wildcard or with a "base" implementation (because there is
> probably none). So I guess the solution here is to just list a single
> specific compatible in the end.

It comes from long experience of silicon vendors not being consistent
with part naming. Far too often we've had a nice generic wild card
entry and along comes the vendor with a new part in the middle
of that range that is completely incompatible. Then we end up with
people assuming the wildcard means it will work and a bunch of bug
reports. Hence no wild cards, just define first supported part as your
'base' and go from there.

It's even more fun when a vendor driver papers over the differences
and so it 'works', but the upstream one doesn't. In extreme case
because a different driver entirely is required.

So basically we don't trust silicon vendors :)
Speaking as someone who works for one - I think that's entirely
reasonable!!

Jonathan

>
> Thanks,
> Miquèl
>
>