From: Jonathan Cameron <jic23@kernel.org>
To: Julien Stephan <jstephan@baylibre.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"David Lechner" <dlechner@baylibre.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH RFC 1/4] dt-bindings: iio: adc: ad7380: add adaq4370-4 and adaq4380-4 compatible parts
Date: Sun, 20 Oct 2024 14:20:58 +0100 [thread overview]
Message-ID: <20241020142058.6ce576f8@jic23-huawei> (raw)
In-Reply-To: <20241015-ad7380-add-adaq4380-4-support-v1-1-d2e1a95fb248@baylibre.com>
On Tue, 15 Oct 2024 11:09:06 +0200
Julien Stephan <jstephan@baylibre.com> wrote:
> adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
> acquisition signal chain μModule solutions compatible with the ad738x
> family, with the following differences:
>
> - configurable gain in front of each 4 adc
As per quick review I gave for the driver code, I'm not seeing why
a configurable gain is a DT thing on an ADC vs something that belongs
in userspace control. I may be missing something though.
It exists for the ad4000 because the control isn't via registers
but via pin straps so we can't control it sensibly from userspace.
Jonathan
> - internal reference is 3V derived from refin-supply (5V)
> - additional supplies
>
> To configure the gain a new patternProperties is added to describe each
> channel. It is restricted to adaq devices.
>
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> ---
> .../devicetree/bindings/iio/adc/adi,ad7380.yaml | 117 +++++++++++++++++++++
> 1 file changed, 117 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> index 74d82721637c..3007d8e39684 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> @@ -25,6 +25,8 @@ description: |
> * https://www.analog.com/en/products/ad7386-4.html
> * https://www.analog.com/en/products/ad7387-4.html
> * https://www.analog.com/en/products/ad7388-4.html
> + * https://www.analog.com/en/products/adaq4370-4.html
> + * https://www.analog.com/en/products/adaq4380-4.html
>
>
> $ref: /schemas/spi/spi-peripheral-props.yaml#
> @@ -46,6 +48,8 @@ properties:
> - adi,ad7386-4
> - adi,ad7387-4
> - adi,ad7388-4
> + - adi,adaq4370-4
> + - adi,adaq4380-4
>
> reg:
> maxItems: 1
> @@ -59,6 +63,9 @@ properties:
> vlogic-supply: true
> refio-supply: true
> refin-supply: true
> + vs-p-supply: true
> + vs-n-supply: true
> + ldo-supply: true
>
> aina-supply:
> description:
> @@ -86,12 +93,43 @@ properties:
> specify the ALERT interrupt.
> maxItems: 1
>
> + '#address-cells':
> + const: 1
> +
> + '#size-cells':
> + const: 0
> +
> required:
> - compatible
> - reg
> - vcc-supply
> - vlogic-supply
>
> +patternProperties:
> + "^channel@([0-3])$":
> + $ref: adc.yaml
> + type: object
> +
> + properties:
> + reg:
> + description:
> + The channel number. From 0 to 3 corresponding to channels A,B,C,D
> + items:
> + minimum: 0
> + maximum: 3
> +
> + adi,gain-milli:
> + description:
> + The hardware gain applied to the ADC input (in milli units).
> + If not present, default to 1000 (no actual gain applied).
> + $ref: /schemas/types.yaml#/definitions/uint32
> + default: 1000
> +
> + required:
> + - reg
> +
> + additionalProperties: false
> +
> unevaluatedProperties: false
>
> allOf:
> @@ -128,7 +166,21 @@ allOf:
> ainc-supply: false
> aind-supply: false
>
> + # Using channel to declare gain property only applies to adaq devices
> + - if:
> + properties:
> + compatible:
> + not:
> + contains:
> + enum:
> + - adi,adaq4370-4
> + - adi,adaq4380-4
> + then:
> + patternProperties:
> + "^channel@([0-3])$": false
> +
> # ad7380-4 uses refin-supply as external reference.
> + # adaq devices use internal reference only, derived from refin-supply
> # All other chips from ad738x family use refio as optional external reference.
> # When refio-supply is omitted, internal reference is used.
> - if:
> @@ -136,6 +188,8 @@ allOf:
> compatible:
> enum:
> - adi,ad7380-4
> + - adi,adaq4370-4
> + - adi,adaq4380-4
> then:
> properties:
> refio-supply: false
> @@ -145,6 +199,24 @@ allOf:
> properties:
> refin-supply: false
>
> + # adaq devices need more supplies
> + - if:
> + properties:
> + compatible:
> + enum:
> + - adi,adaq4370-4
> + - adi,adaq4380-4
> + then:
> + required:
> + - vs-p-supply
> + - vs-n-supply
> + - ldo-supply
> + else:
> + properties:
> + vs-p-supply: false
> + vs-n-supply: false
> + ldo-supply: false
> +
> examples:
> - |
> #include <dt-bindings/interrupt-controller/irq.h>
> @@ -169,3 +241,48 @@ examples:
> refio-supply = <&supply_2_5V>;
> };
> };
> +
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> +
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + adc@0 {
> + compatible = "adi,adaq4380-4";
> + reg = <0>;
> +
> + spi-cpol;
> + spi-cpha;
> + spi-max-frequency = <80000000>;
> +
> + interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
> + interrupt-parent = <&gpio0>;
> +
> + vcc-supply = <&supply_3_3V>;
> + vlogic-supply = <&supply_3_3V>;
> + refin-supply = <&supply_5V>;
> + vs-p-supply = <&supply_5V>;
> + vs-n-supply = <&supply_0V>;
> + ldo-supply = <&supply_5V>;
> +
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + channel@0 {
> + reg = <0>;
> + adi,gain-milli = <300>;
> + };
> +
> + channel@2 {
> + reg = <2>;
> + adi,gain-milli = <600>;
> + };
> +
> + channel@3 {
> + reg = <3>;
> + adi,gain-milli = <1000>;
> + };
> + };
> + };
>
next prev parent reply other threads:[~2024-10-20 13:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 9:09 [PATCH RFC 0/4] ad7380: add adaq4370-4 and adaq4380-4 support Julien Stephan
2024-10-15 9:09 ` [PATCH RFC 1/4] dt-bindings: iio: adc: ad7380: add adaq4370-4 and adaq4380-4 compatible parts Julien Stephan
2024-10-15 20:49 ` Rob Herring
2024-10-17 18:05 ` Jonathan Cameron
2024-10-18 7:36 ` Julien Stephan
2024-10-18 18:09 ` Jonathan Cameron
2024-10-20 13:20 ` Jonathan Cameron [this message]
2024-10-21 13:25 ` Julien Stephan
2024-10-21 18:17 ` Jonathan Cameron
2024-10-15 9:09 ` [PATCH RFC 2/4] iio: adc: ad7380: fix oversampling formula Julien Stephan
2024-10-15 9:09 ` [PATCH RFC 3/4] iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4 Julien Stephan
2024-10-20 13:18 ` Jonathan Cameron
2024-10-15 9:09 ` [PATCH RFC 4/4] docs: iio: ad7380: add " Julien Stephan
2024-10-15 16:43 ` [PATCH RFC 0/4] ad7380: add adaq4370-4 and adaq4380-4 support Conor Dooley
2024-10-16 7:25 ` Julien Stephan
2024-10-18 18:11 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241020142058.6ce576f8@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jstephan@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).