diff mbox series

[v3,1/2] dt-bindings: iio: dac: add docs for ad8460

Message ID 20240904023040.23352-2-Mariel.Tinaco@analog.com (mailing list archive)
State Changes Requested
Headers show
Series Add support to AD8460 Waveform Generator DAC | expand

Commit Message

Mariel Tinaco Sept. 4, 2024, 2:30 a.m. UTC
This adds the bindings documentation for the 14-bit
High Voltage, High Current, Waveform Generator
Digital-to-Analog converter.

Signed-off-by: Mariel Tinaco <Mariel.Tinaco@analog.com>
---
 .../bindings/iio/dac/adi,ad8460.yaml          | 154 ++++++++++++++++++
 MAINTAINERS                                   |   7 +
 2 files changed, 161 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml

Comments

Krzysztof Kozlowski Sept. 4, 2024, 6:20 a.m. UTC | #1
On Wed, Sep 04, 2024 at 10:30:39AM +0800, Mariel Tinaco wrote:
> This adds the bindings documentation for the 14-bit

Please do not use "This commit/patch/change", but imperative mood. See
longer explanation here:
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95

> High Voltage, High Current, Waveform Generator
> Digital-to-Analog converter.
> 
> Signed-off-by: Mariel Tinaco <Mariel.Tinaco@analog.com>
> ---
>  .../bindings/iio/dac/adi,ad8460.yaml          | 154 ++++++++++++++++++
>  MAINTAINERS                                   |   7 +
>  2 files changed, 161 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml

> +  adi,range-microvolt:
> +    description: Voltage output range specified as <minimum, maximum>
> +    oneOf:

This oneOf does not make sense. There is only one condition. Drop.

> +      - items:
> +          - enum: [0, -10000000, -20000000, -30000000, -40000000, -55000000]
> +          - enum: [10000000, 20000000, 30000000, 40000000, 55000000]

What's the default? It's not a required property.

> +
> +  adi,range-microamp:
> +    description: Current output range specified as <minimum, maximum>
> +    oneOf:
> +      - items:
> +          - enum: [-50000, -100000, -300000, -500000, -1000000]

I don't understand why 0 is not listed here.

> +          - enum: [50000, 100000, 300000, 500000, 1000000]
> +      - items:
> +          - const: 0
> +          - enum: [50000, 100000, 300000, 500000, 1000000]
> +

What's the default? It's not a required property.

> +  adi,max-millicelsius:
> +    description: Overtemperature threshold
> +    default: 50000
> +    minimum: 20000
> +    maximum: 150000
> +
> +  shutdown-reset-gpios:
> +    description: Corresponds to SDN_RESET pin. To exit shutdown
> +      or sleep mode, pulse SDN_RESET HIGH, then leave LOW.
> +    maxItems: 1
> +
> +  reset-gpios:
> +    description: Manual Power On Reset (POR). Pull this GPIO pin
> +      LOW and then HIGH to reset all digital registers to default
> +    maxItems: 1
> +
> +  shutdown-gpios:
> +    description: Corresponds to SDN_IO pin. Shutdown may be
> +      initiated by the user, by pulsing SDN_IO high. To exit shutdown,
> +      pulse SDN_IO low, then float.
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks

Some supplies are for sure required. Devices rarely can operate without
power provided.

> +
> +allOf:
> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> +
> +additionalProperties: false

unevaluatedProperties instead.

Best regards,
Krzysztof
Jonathan Cameron Sept. 7, 2024, 5:01 p.m. UTC | #2
On Wed, 4 Sep 2024 08:20:53 +0200
Krzysztof Kozlowski <krzk@kernel.org> wrote:

> On Wed, Sep 04, 2024 at 10:30:39AM +0800, Mariel Tinaco wrote:
> > This adds the bindings documentation for the 14-bit  
> 
> Please do not use "This commit/patch/change", but imperative mood. See
> longer explanation here:
> https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95
> 
> > High Voltage, High Current, Waveform Generator
> > Digital-to-Analog converter.
> > 
> > Signed-off-by: Mariel Tinaco <Mariel.Tinaco@analog.com>
> > ---
> >  .../bindings/iio/dac/adi,ad8460.yaml          | 154 ++++++++++++++++++
> >  MAINTAINERS                                   |   7 +
> >  2 files changed, 161 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml  
> 
> > +  adi,range-microvolt:
> > +    description: Voltage output range specified as <minimum, maximum>
> > +    oneOf:  
> 
> This oneOf does not make sense. There is only one condition. Drop.
> 
> > +      - items:
> > +          - enum: [0, -10000000, -20000000, -30000000, -40000000, -55000000]
> > +          - enum: [10000000, 20000000, 30000000, 40000000, 55000000]  
> 
> What's the default? It's not a required property.
> 
> > +
> > +  adi,range-microamp:
> > +    description: Current output range specified as <minimum, maximum>
> > +    oneOf:
> > +      - items:
> > +          - enum: [-50000, -100000, -300000, -500000, -1000000]  
> 
> I don't understand why 0 is not listed here.

I'm not sure why it is a list at all. Seems like the hardware
allows a continuous value so this should just specify max and min.

> 
> > +          - enum: [50000, 100000, 300000, 500000, 1000000]
> > +      - items:
> > +          - const: 0
> > +          - enum: [50000, 100000, 300000, 500000, 1000000]
> > +  
> 
> What's the default? It's not a required property.
> 
> > +  adi,max-millicelsius:
> > +    description: Overtemperature threshold
> > +    default: 50000
> > +    minimum: 20000
> > +    maximum: 150000
> > +
> > +  shutdown-reset-gpios:
> > +    description: Corresponds to SDN_RESET pin. To exit shutdown
> > +      or sleep mode, pulse SDN_RESET HIGH, then leave LOW.
> > +    maxItems: 1
> > +
> > +  reset-gpios:
> > +    description: Manual Power On Reset (POR). Pull this GPIO pin
> > +      LOW and then HIGH to reset all digital registers to default
> > +    maxItems: 1
> > +
> > +  shutdown-gpios:
> > +    description: Corresponds to SDN_IO pin. Shutdown may be
> > +      initiated by the user, by pulsing SDN_IO high. To exit shutdown,
> > +      pulse SDN_IO low, then float.
> > +    maxItems: 1
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - clocks  
> 
> Some supplies are for sure required. Devices rarely can operate without
> power provided.
> 
> > +
> > +allOf:
> > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> > +
> > +additionalProperties: false  
> 
> unevaluatedProperties instead.
> 
> Best regards,
> Krzysztof
>
Mariel Tinaco Sept. 9, 2024, 6:22 a.m. UTC | #3
> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Sunday, September 8, 2024 1:02 AM
> To: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Tinaco, Mariel <Mariel.Tinaco@analog.com>; linux-iio@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; Lars-Peter Clausen
> <lars@metafoo.de>; Rob Herring <robh@kernel.org>; Krzysztof Kozlowski
> <krzk+dt@kernel.org>; Hennerich, Michael <Michael.Hennerich@analog.com>;
> Conor Dooley <conor+dt@kernel.org>; Marcelo Schmitt
> <marcelo.schmitt1@gmail.com>; Dimitri Fedrau <dima.fedrau@gmail.com>;
> David Lechner <dlechner@baylibre.com>; Nuno Sá
> <noname.nuno@gmail.com>
> Subject: Re: [PATCH v3 1/2] dt-bindings: iio: dac: add docs for ad8460
> 
> [External]
> 
> On Wed, 4 Sep 2024 08:20:53 +0200
> Krzysztof Kozlowski <krzk@kernel.org> wrote:
> 
> > On Wed, Sep 04, 2024 at 10:30:39AM +0800, Mariel Tinaco wrote:
> > > This adds the bindings documentation for the 14-bit
> >
> > Please do not use "This commit/patch/change", but imperative mood. See
> > longer explanation here:
> > https://urldefense.com/v3/__https://elixir.bootlin.com/linux/v5.17.1/s
> > ource/Documentation/process/submitting-
> patches.rst*L95__;Iw!!A3Ni8CS0y
> > 2Y!7lj0hq-U2ClkGNYfHqjR3-k-
> ea6TFUFsgEYQokkU95K6TXPHIPU33VxQcl_iH_etJ4k
> > pbPEV39dP1oAd$
> >
> > > High Voltage, High Current, Waveform Generator Digital-to-Analog
> > > converter.
> > >
> > > Signed-off-by: Mariel Tinaco <Mariel.Tinaco@analog.com>
> > > ---
> > >  .../bindings/iio/dac/adi,ad8460.yaml          | 154 ++++++++++++++++++
> > >  MAINTAINERS                                   |   7 +
> > >  2 files changed, 161 insertions(+)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml
> >
> > > +  adi,range-microvolt:
> > > +    description: Voltage output range specified as <minimum, maximum>
> > > +    oneOf:
> >
> > This oneOf does not make sense. There is only one condition. Drop.
> >
> > > +      - items:
> > > +          - enum: [0, -10000000, -20000000, -30000000, -40000000, -
> 55000000]
> > > +          - enum: [10000000, 20000000, 30000000, 40000000,
> > > + 55000000]
> >
> > What's the default? It's not a required property.
> >
> > > +
> > > +  adi,range-microamp:
> > > +    description: Current output range specified as <minimum, maximum>
> > > +    oneOf:
> > > +      - items:
> > > +          - enum: [-50000, -100000, -300000, -500000, -1000000]
> >
> > I don't understand why 0 is not listed here.
> 
> I'm not sure why it is a list at all. Seems like the hardware allows a continuous
> value so this should just specify max and min.
> 

That's right, the values can be flexible but only at a certain range. 
The first element of the array should only be in the negative range, while
The second element of the array should only be in the positive range.

Is there a way to do this with the max and min attribute?

Items:
	Item 1
		min: -10000
		max: 0
	item 2
		min: 0
		max: 10000 

> >
> > > +          - enum: [50000, 100000, 300000, 500000, 1000000]
> > > +      - items:
> > > +          - const: 0
> > > +          - enum: [50000, 100000, 300000, 500000, 1000000]
> > > +
> >
> > What's the default? It's not a required property.
> >
> > > +  adi,max-millicelsius:
> > > +    description: Overtemperature threshold
> > > +    default: 50000
> > > +    minimum: 20000
> > > +    maximum: 150000
> > > +
> > > +  shutdown-reset-gpios:
> > > +    description: Corresponds to SDN_RESET pin. To exit shutdown
> > > +      or sleep mode, pulse SDN_RESET HIGH, then leave LOW.
> > > +    maxItems: 1
> > > +
> > > +  reset-gpios:
> > > +    description: Manual Power On Reset (POR). Pull this GPIO pin
> > > +      LOW and then HIGH to reset all digital registers to default
> > > +    maxItems: 1
> > > +
> > > +  shutdown-gpios:
> > > +    description: Corresponds to SDN_IO pin. Shutdown may be
> > > +      initiated by the user, by pulsing SDN_IO high. To exit shutdown,
> > > +      pulse SDN_IO low, then float.
> > > +    maxItems: 1
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - clocks
> >
> > Some supplies are for sure required. Devices rarely can operate
> > without power provided.
> >
> > > +
> > > +allOf:
> > > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> > > +
> > > +additionalProperties: false
> >
> > unevaluatedProperties instead.
> >
> > Best regards,
> > Krzysztof
> >
Krzysztof Kozlowski Sept. 9, 2024, 6:41 a.m. UTC | #4
On 09/09/2024 08:22, Tinaco, Mariel wrote:
> 
> 
>> -----Original Message-----
>> From: Jonathan Cameron <jic23@kernel.org>
>> Sent: Sunday, September 8, 2024 1:02 AM
>> To: Krzysztof Kozlowski <krzk@kernel.org>
>> Cc: Tinaco, Mariel <Mariel.Tinaco@analog.com>; linux-iio@vger.kernel.org;
>> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; Lars-Peter Clausen
>> <lars@metafoo.de>; Rob Herring <robh@kernel.org>; Krzysztof Kozlowski
>> <krzk+dt@kernel.org>; Hennerich, Michael <Michael.Hennerich@analog.com>;
>> Conor Dooley <conor+dt@kernel.org>; Marcelo Schmitt
>> <marcelo.schmitt1@gmail.com>; Dimitri Fedrau <dima.fedrau@gmail.com>;
>> David Lechner <dlechner@baylibre.com>; Nuno Sá
>> <noname.nuno@gmail.com>
>> Subject: Re: [PATCH v3 1/2] dt-bindings: iio: dac: add docs for ad8460
>>
>> [External]
>>
>> On Wed, 4 Sep 2024 08:20:53 +0200
>> Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>
>>> On Wed, Sep 04, 2024 at 10:30:39AM +0800, Mariel Tinaco wrote:
>>>> This adds the bindings documentation for the 14-bit
>>>
>>> Please do not use "This commit/patch/change", but imperative mood. See
>>> longer explanation here:
>>> https://urldefense.com/v3/__https://elixir.bootlin.com/linux/v5.17.1/s
>>> ource/Documentation/process/submitting-
>> patches.rst*L95__;Iw!!A3Ni8CS0y
>>> 2Y!7lj0hq-U2ClkGNYfHqjR3-k-
>> ea6TFUFsgEYQokkU95K6TXPHIPU33VxQcl_iH_etJ4k
>>> pbPEV39dP1oAd$
>>>
>>>> High Voltage, High Current, Waveform Generator Digital-to-Analog
>>>> converter.
>>>>
>>>> Signed-off-by: Mariel Tinaco <Mariel.Tinaco@analog.com>
>>>> ---
>>>>  .../bindings/iio/dac/adi,ad8460.yaml          | 154 ++++++++++++++++++
>>>>  MAINTAINERS                                   |   7 +
>>>>  2 files changed, 161 insertions(+)
>>>>  create mode 100644
>>>> Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml
>>>
>>>> +  adi,range-microvolt:
>>>> +    description: Voltage output range specified as <minimum, maximum>
>>>> +    oneOf:
>>>
>>> This oneOf does not make sense. There is only one condition. Drop.
>>>
>>>> +      - items:
>>>> +          - enum: [0, -10000000, -20000000, -30000000, -40000000, -
>> 55000000]
>>>> +          - enum: [10000000, 20000000, 30000000, 40000000,
>>>> + 55000000]
>>>
>>> What's the default? It's not a required property.
>>>
>>>> +
>>>> +  adi,range-microamp:
>>>> +    description: Current output range specified as <minimum, maximum>
>>>> +    oneOf:
>>>> +      - items:
>>>> +          - enum: [-50000, -100000, -300000, -500000, -1000000]
>>>
>>> I don't understand why 0 is not listed here.
>>
>> I'm not sure why it is a list at all. Seems like the hardware allows a continuous
>> value so this should just specify max and min.
>>
> 
> That's right, the values can be flexible but only at a certain range. 
> The first element of the array should only be in the negative range, while
> The second element of the array should only be in the positive range.
> 
> Is there a way to do this with the max and min attribute?
> 
> Items:
> 	Item 1
> 		min: -10000
> 		max: 0
> 	item 2
> 		min: 0
> 		max: 10000 

items:
  - minimum: -10000
    maximum: 0
  - minimum: 0
    maximum: 10000

should work, try.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml
new file mode 100644
index 000000000000..da53bae4efed
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml
@@ -0,0 +1,154 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2024 Analog Devices Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/dac/adi,ad8460.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices AD8460 DAC
+
+maintainers:
+  - Mariel Tinaco <mariel.tinaco@analog.com>
+
+description: |
+  Analog Devices AD8460 110 V High Voltage, 1 A High Current,
+  Arbitrary Waveform Generator with Integrated 14-Bit High Speed DAC
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ad8460.pdf
+
+properties:
+  compatible:
+    enum:
+      - adi,ad8460
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  dmas:
+    maxItems: 1
+
+  dma-names:
+    items:
+      - const: tx
+
+  spi-max-frequency:
+    maximum: 20000000
+
+  hvcc-supply:
+    description: Positive high voltage power supply line
+
+  hvee-supply:
+    description: Negative high voltage power supply line
+
+  vcc-5v-supply:
+    description: Low voltage power supply
+
+  vref-5v-supply:
+    description: Reference voltage for analog low voltage
+
+  dvdd-3p3v-supply:
+    description: Digital supply bypass
+
+  avdd-3p3v-supply:
+    description: Analog supply bypass
+
+  refio-1p2v-supply:
+    description: Drive voltage in the range of 1.2V maximum to as low as
+      low as 0.12V through the REF_IO pin to adjust full scale output span
+
+  adi,external-resistor-ohms:
+    description: Specify value of external resistor connected to FS_ADJ pin
+      to establish internal HVDAC's reference current I_REF
+    default: 2000
+    minimum: 2000
+    maximum: 20000
+
+  adi,range-microvolt:
+    description: Voltage output range specified as <minimum, maximum>
+    oneOf:
+      - items:
+          - enum: [0, -10000000, -20000000, -30000000, -40000000, -55000000]
+          - enum: [10000000, 20000000, 30000000, 40000000, 55000000]
+
+  adi,range-microamp:
+    description: Current output range specified as <minimum, maximum>
+    oneOf:
+      - items:
+          - enum: [-50000, -100000, -300000, -500000, -1000000]
+          - enum: [50000, 100000, 300000, 500000, 1000000]
+      - items:
+          - const: 0
+          - enum: [50000, 100000, 300000, 500000, 1000000]
+
+  adi,max-millicelsius:
+    description: Overtemperature threshold
+    default: 50000
+    minimum: 20000
+    maximum: 150000
+
+  shutdown-reset-gpios:
+    description: Corresponds to SDN_RESET pin. To exit shutdown
+      or sleep mode, pulse SDN_RESET HIGH, then leave LOW.
+    maxItems: 1
+
+  reset-gpios:
+    description: Manual Power On Reset (POR). Pull this GPIO pin
+      LOW and then HIGH to reset all digital registers to default
+    maxItems: 1
+
+  shutdown-gpios:
+    description: Corresponds to SDN_IO pin. Shutdown may be
+      initiated by the user, by pulsing SDN_IO high. To exit shutdown,
+      pulse SDN_IO low, then float.
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        dac@0 {
+            compatible = "adi,ad8460";
+            reg = <0>;
+            spi-max-frequency = <8000000>;
+
+            dmas = <&tx_dma 0>;
+            dma-names = "tx";
+
+            shutdown-reset-gpios = <&gpio 86 GPIO_ACTIVE_HIGH>;
+            reset-gpios = <&gpio 91 GPIO_ACTIVE_LOW>;
+            shutdown-gpios = <&gpio 88 GPIO_ACTIVE_HIGH>;
+
+            clocks = <&sync_ext_clk>;
+
+            hvcc-supply = <&hvcc>;
+            hvee-supply = <&hvee>;
+            vcc-5v-supply = <&vcc_5>;
+            vref-5v-supply = <&vref_5>;
+            dvdd-3p3v-supply = <&dvdd_3_3>;
+            avdd-3p3v-supply = <&avdd_3_3>;
+            refio-1p2v-supply = <&refio_1_2>;
+
+            adi,external-resistor-ohms = <2000>;
+            adi,range-microvolt = <(-40000000) 40000000>;
+            adi,range-microamp = <0 50000>;
+            adi,max-millicelsius = <50000>;
+        };
+    };
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 417c6751c0dc..e0509c9f5545 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1320,6 +1320,13 @@  F:	Documentation/ABI/testing/debugfs-iio-ad9467
 F:	Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml
 F:	drivers/iio/adc/ad9467.c
 
+ANALOG DEVICES INC AD8460 DRIVER
+M:	Mariel Tinaco <Mariel.Tinaco@analog.com>
+L:	linux-iio@vger.kernel.org
+S:	Supported
+W:	https://ez.analog.com/linux-software-drivers
+F:	Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml
+
 ANALOG DEVICES INC AD9739a DRIVER
 M:	Nuno Sa <nuno.sa@analog.com>
 M:	Dragos Bogdan <dragos.bogdan@analog.com>