Re: [PATCH v2 1/7] dt-bindings: iio: adc: Add AD4170

Marcelo Schmitt
2025-05-11T15:25:50Z

...
> > +
> > + adi,reference-select:
> > + description: |
> > + Select the reference source to use when converting on the specific
> > + channel. Valid values are:
> > + 0: Differential reference voltage REFIN+ - REFIN−.
> > + 1: Differential reference voltage REFIN2+ - REFIN2−.
> > + 2: Internal 2.5V referece (REFOUT) relative to AVSS.
> > + 3: Analog supply voltage (AVDD) relative AVSS.
> > + If this field is left empty, the internal reference is selected.
> > + $ref: /schemas/types.yaml#/definitions/uint8
>
> You already defined the type in the $defs, so no need to do it again.

The ADC channel node doesn't include/reference the sensor-node.
Wouldn't adi,reference-select default to uint32 if the type is dropped?

The issue here is that adi,reference-select is a property that is meaningful
both for conventional ADC channels and for channels connecting to external
sensors. Thus, the unfortunate repetition of the property. Another possibility
would to be add another type for the ad4170 channels. Something like

$defs:
ad4170-channel:
$ref: /schemas/iio/adc/adc.yaml#

adi,reference-select:
....

sensor-node:
type: object
$ref: '#/$defs/ad4170-channel'
...

patternProperties:
"^channel@[0-9a-f]$":
$ref: '#/$defs/ad4170-channel'
...

"^weighscale@":
$ref: '#/$defs/sensor-node'
...

"^rtd@":
$ref: '#/$defs/sensor-node'
...

would that be a better way of having those?

Thanks,
Marcelo