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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/07/2024 09:49, Petar Stoykov wrote:
> 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

Almost.

    oneOf:
      - items:
          - const: sensirion,sdp510
          - const: sensirion,sdp500
      - 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?

Yes

> 
> From what I've seen it is rare to have two strings in "compatible" so I didn't

Rare? It's everywhere in SoC and in many places for standalone
devices/hardware.

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



Best regards,
Krzysztof





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux