Re: [PATCH v3 2/3] iio: pressure: Add driver for Sensirion SDP500

From: Petar Stoykov
Date: Thu Jul 04 2024 - 03:50:11 EST


On Tue, Jul 2, 2024 at 5:17 PM Krzysztof Kozlowski
<krzysztof.kozlowski@xxxxxxxxxx> wrote:
>
> On 02/07/2024 16:59, Petar Stoykov via B4 Relay wrote:
> > From: Petar Stoykov <pd.pstoykov@xxxxxxxxx>
> >
> > Sensirion SDP500 is a digital differential pressure sensor. The sensor is
> > accessed over I2C.
> >
>
> ...
>
> > +
> > +static const struct of_device_id sdp500_of_match[] = {
> > + { .compatible = "sensirion,sdp500" },
> > + { .compatible = "sensirion,sdp510" },
>
> Devices look compatible, so express it in the bindings with fallback to
> sdp500 (oneOf, see example-schema).

Hi Krzysztof,
I tried to understand the explanation in the example-schema. I must say it is
a bit confusing, but I can't offer improvement because I'm not sure I
understand it fully yet.
Can you verify if this is what you expect the bindings file to read?
properties:
compatible:
oneOf:
- items:
- const: sensirion,sdp510
- const: sensirion,sdp500
- items:
- const: sensirion,sdp500

So the device tree should have either this
compatible = "sensirion,sdp510", "sensirion,sdp500"
Or
compatible = "sensirion,sdp500"
The first would mean that 510 falls back to 500, right?

>From what I've seen it is rare to have two strings in "compatible" so I didn't
know of this mechanism of "fallback" in the dts. I expected to just write the
name of my device (let's say "sensirion,sdp510") and the driver would handle it.
But I'm learning. Expectations change.

Regards,
Petar

>
> Best regards,
> Krzysztof
>