Re: [PATCH v4 7/8] dt-bindings: iio: adc: add docs for AD7606C-{16,18} parts

From: Alexandru Ardelean
Date: Sat Sep 07 2024 - 13:58:10 EST


On Sat, Sep 7, 2024 at 5:09 PM David Lechner <dlechner@xxxxxxxxxxxx> wrote:
>
> On 9/6/24 11:59 PM, Alexandru Ardelean wrote:
> > On Fri, Sep 6, 2024 at 12:54 AM David Lechner <dlechner@xxxxxxxxxxxx> wrote:
> >>
> >> On 9/5/24 3:24 AM, Alexandru Ardelean wrote:
>
> ...
>
> >>> +patternProperties:
> >>> + "^channel@[1-8]$":
> >>> + type: object
> >>> + $ref: adc.yaml
> >>> + unevaluatedProperties: false
> >>> +
> >>> + properties:
> >>> + reg:
> >>> + description:
> >>> + The channel number, as specified in the datasheet (from 1 to 8).
> >>> + minimum: 1
> >>> + maximum: 8
> >>> +
> >>> + diff-channels:
> >>> + description:
> >>> + Each channel can be configured as a differential bipolar channel.
> >>> + The ADC uses the same positive and negative inputs for this.
> >>> + This property must be specified as 'reg' (or the channel number) for
> >>> + both positive and negative inputs (i.e. diff-channels = <reg reg>).
> >>> + items:
> >>> + minimum: 1
> >>> + maximum: 8
> >>> +
> >>> + bipolar:
> >>> + description:
> >>> + Each channel can be configured as a unipolar or bipolar single-ended.
> >>> + When this property is not specified, it's unipolar, so the ADC will
> >>> + have only the positive input wired.
> >>> + For this ADC the 'diff-channels' & 'bipolar' properties are mutually
> >>> + exclusive.
> >>> +
> >>> + required:
> >>> + - reg
> >>> +
> >>> + oneOf:
> >>> + - required:
> >>> + - diff-channels
> >>> + - required:
> >>> + - bipolar
> >>
> >> The datasheet (ad7606c-18.pdf) lists the following combinations:
> >>
> >> * Bipolar single-ended
> >> * Unipolar single-ended
> >> * Bipolar differential
> >>
> >> The logic in the oneOf: doesn't match this.
> >>
> >> This I think this would be sufficient:
> >>
> >> - if:
> >> required: [diff-channels]
> >> then:
> >> required: [bipolar]
> >
> > So here, I am a bit vague.
> > This makes 'bipolar' mandatory if 'diff-channels' is mandatory, right?
> > But then 'bipolar' (on its own) becomes optional?
> > The way I understood the oneOf case is that:
> > 1. if it's 'diff-channels' then it's specified 'bipolar differential'.
>
> diff-channels does not imply bipolar in DT, so we need both properties
> set to specify "bipolar differential".
>

ack
will update then

> > 2. if it's 'bipolar' then it's specified as 'bipolar single-ended'
> > 3. otherwise it's unipolar
> > 4. oneOf enforces that at least 'diff-channels' or 'bipolar' is
> > specified if there is a channel node
> >
> >