Re: [PATCH v9 7/8] dt-bindings: iio: adc: add ad4851
From: David Lechner
Date: Wed Jan 08 2025 - 11:48:37 EST
On 12/23/24 5:40 AM, Jonathan Cameron wrote:
> On Fri, 20 Dec 2024 14:01:33 +0200
> Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx> wrote:
>
>> Add devicetree bindings for ad485x family.
>>
>> Reviewed-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
>> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx>
> Mixed single end and differential channel devices that have per channel
> child nodes need a more complex description to avoid reg have different
> and possibly clashing meanings for the two types of channel.
>
> See inline.
>
...
>> +patternProperties:
>> + "^channel(@[0-7])?$":
>> + $ref: adc.yaml
>> + type: object
>> + description: Represents the channels which are connected to the ADC.
>> +
>> + properties:
>> + reg:
>> + description: The channel number in single-ended mode.
>
> And what is it in differential mode? (usually just an index).
> Which is a problem if you have a mix. That's why we added
> single-channel.
This chip isn't a mix-and match like many chips with muxes that use this binding
so I think it should just be diff-channels = <0 0>; similar to adi,ad7606. The
pins on the chip are labeled IN0+ and IN0- so it makes sense that both the
positive and negative inputs to be 0.
So, this should be fine with or without a single-channel property since reg
should always have the same number as diff-channels and single-channel.
>
> So for devices where reg isn't enough, you can use:
> reg: index of channel, not real meaning just makes them unique.
> single-channel: The channel number for single ended.
> diff-channels: The channel numbers for differential channels.
>
>> + minimum: 0
>> + maximum: 7
>> +
>> + diff-channels: true
>
> Should be constraints / information on the values possible.
> I've no idea what the 8 is in your example for instance.
>