Re: [PATCH v5 2/5] dt-bindings: iio: adc: ad7192: Add aincom supply
From: David Lechner
Date: Sat Apr 13 2024 - 14:05:24 EST
On Sat, Apr 13, 2024 at 10:12 AM Alisa-Dariana Roman
<alisadariana@xxxxxxxxx> wrote:
>
> AINCOM should actually be a supply. If present and it has a non-zero
> voltage, the pseudo-differential channels are configured as single-ended
> with an offset. Otherwise, they are configured as differential channels
> between AINx and AINCOM pins.
>
> Signed-off-by: Alisa-Dariana Roman <alisa.roman@xxxxxxxxxx>
> ---
> .../devicetree/bindings/iio/adc/adi,ad7192.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml
> index 16def2985ab4..ba506af3b73e 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml
> @@ -41,6 +41,14 @@ properties:
> interrupts:
> maxItems: 1
>
> + aincom-supply:
> + description: |
> + Optional AINCOM voltage supply. If present and it has a non-zero voltage,
> + the pseudo-differential channels are configured as single-ended channels
> + with the AINCOM voltage as offset. Otherwise, the pseudo-differential
> + channels are configured as differential channels: voltageX-voltage0, with
> + AINCOM as the negative input.
This description doesn't sound quite right to me. The datasheet has no
mention of single-ended inputs. And how each AINx input is used is
independent of whether this property is present or not. And
voltageX-voltage0 is a driver implementation detail that doesn't
really belong in the bindings.
Also, just FYI, in a similar case, Jonathan recently mentioned that he
would prefer that these sorts of supplies would be required rather
than optional [1]. But in this case, I think it needs to be optional
for backwards compatibility since we are modifying existing DT
bindings. But the point still stands that this property being present
or not doesn't mean anything special (other than we might assume the
AINCOM pin is connected to GND if the property is omitted).
[1]: https://lore.kernel.org/linux-iio/20240413181025.39d1a62e@jic23-huawei/
In any case, a better description would be one more like what the
datasheet says for the AINCOM pin:
"Analog inputs AIN1 to AIN4 are referenced to this input when
configured for pseudodifferential operation."
> +
> dvdd-supply:
> description: DVdd voltage supply
>
> @@ -117,6 +125,7 @@ examples:
> clock-names = "mclk";
> interrupts = <25 0x2>;
> interrupt-parent = <&gpio>;
> + aincom-supply = <&aincom>;
> dvdd-supply = <&dvdd>;
> avdd-supply = <&avdd>;
> vref-supply = <&vref>;
> --
> 2.34.1
>