diff mbox series

[1/2] dt-binding: iio: dac8771: Add TI DAC8771 binding

Message ID 20191217140731.30504-2-dmurphy@ti.com (mailing list archive)
State New, archived
Headers show
Series Texas Instruments DAC8771 | expand

Commit Message

Dan Murphy Dec. 17, 2019, 2:07 p.m. UTC
Add the TI DAC8771 DT binding.

Datasheet:
http://www.ti.com/lit/ds/symlink/dac8771.pdf

Signed-off-by: Dan Murphy <dmurphy@ti.com>
CC: Rob Herring <robh+dt@kernel.org>
---
 .../bindings/iio/dac/ti,dac8771.yaml          | 89 +++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml

Comments

Jonathan Cameron Dec. 23, 2019, 2:44 p.m. UTC | #1
On Tue, 17 Dec 2019 08:07:30 -0600
Dan Murphy <dmurphy@ti.com> wrote:

> Add the TI DAC8771 DT binding.
> 
> Datasheet:
> http://www.ti.com/lit/ds/symlink/dac8771.pdf
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> CC: Rob Herring <robh+dt@kernel.org>
> ---
>  .../bindings/iio/dac/ti,dac8771.yaml          | 89 +++++++++++++++++++
>  1 file changed, 89 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml b/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml
> new file mode 100644
> index 000000000000..6aba6789d36c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml
> @@ -0,0 +1,89 @@
> +# SPDX-License-Identifier: GPL-2.0
If possible, it is preferred for new bindings to be dual licensed as 

(GPL-2.0-only OR BSD-2-Clause)


> +# Copyright (C) 2019 Texas Instruments Incorporated
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/bindings/iio/dac/ti,dac8771.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: Texas Instruments DAC8771
> +
> +maintainers:
> +  - Dan Murphy <dmurphy@ti.com>
> +
> +description: |
> +  The DAC8771 is a single channel, precision, fully integrated 16-bit digital
> +  to analog converter (DAC) with adaptive power management, and is designed to
> +  meet the requirements of industrial control applications.
> +
> +  Specifications can be found at:
> +    http://www.ti.com/lit/ds/symlink/dac8771.pdf
> +
> +properties:
> +  compatible:
> +    enum:
> +      - ti,dac8771
> +
> +  reg:
> +    maxItems: 1
> +
> +  reset-gpios:
> +    description: |
> +       GPIO used for hardware reset.
> +
> +  loaddacs-gpios:
> +    description: |
> +       GPIO used to shift the data from the SPI FIFO to the processing engine.
> +
> +  spi-max-frequency:
> +    maximum: 25000000
> +
> +  vref-supply:
> +    description: Phandle to the external reference voltage supply.
> +
> +  ti,output-range:
> +    description: Output range of the DAC
> +       0 - Voltage output 0 to +5 V (default)
Hmm. I'm never keen on opaque bindings, but sometimes things
are just too complex to break out as individual fields.

So I guess this is the best we can do.

> +       1 - Voltage output 0 to +10 V
> +       2 - Voltage output ±5 V
> +       3 - Voltage output ±10 V
> +       4 - Current output 3.5 mA to 23.5 mA
> +       5 - Current output 0 to 20 mA
> +       6 - Current output 0 to 24 mA
> +       7 - Current output ±24 mA
> +       8 - Voltage output 0 to +6 V
> +       9 - Voltage output 0 to +12 V
> +       10 - Voltage output ±6 V
> +       11 - Voltage output ±12 V
> +       12 - Current output 4 mA to 20 mA
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint8
> +      - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
> +
> +  interrupts:
> +    description: IRQ line for the DAC
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - vref-supply
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    spi {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +  
> +      dac@0 {
> +        compatible = "ti,dac8771";
> +        reg = <0>;
> +        spi-max-frequency = <25000000>;
> +        vref-supply = <&ldo3_reg>;
> +        ti,output-range = <2>;
> +        interrupts = <16>;
> +        interrupt-parent = <&gpio1>;
> +        loaddacs-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
> +        reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
> +      };
> +    };
Dan Murphy Jan. 3, 2020, 1:22 p.m. UTC | #2
Jonathan

Thanks for the review.  I was on holiday

On 12/23/19 8:44 AM, Jonathan Cameron wrote:
> On Tue, 17 Dec 2019 08:07:30 -0600
> Dan Murphy <dmurphy@ti.com> wrote:
>
>> Add the TI DAC8771 DT binding.
>>
>> Datasheet:
>> http://www.ti.com/lit/ds/symlink/dac8771.pdf
>>
>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>> CC: Rob Herring <robh+dt@kernel.org>
>> ---
>>   .../bindings/iio/dac/ti,dac8771.yaml          | 89 +++++++++++++++++++
>>   1 file changed, 89 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml b/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml
>> new file mode 100644
>> index 000000000000..6aba6789d36c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml
>> @@ -0,0 +1,89 @@
>> +# SPDX-License-Identifier: GPL-2.0
> If possible, it is preferred for new bindings to be dual licensed as
>
> (GPL-2.0-only OR BSD-2-Clause)
>
Ack


>> +# Copyright (C) 2019 Texas Instruments Incorporated
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/bindings/iio/dac/ti,dac8771.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> +
>> +title: Texas Instruments DAC8771
>> +
>> +maintainers:
>> +  - Dan Murphy <dmurphy@ti.com>
>> +
>> +description: |
>> +  The DAC8771 is a single channel, precision, fully integrated 16-bit digital
>> +  to analog converter (DAC) with adaptive power management, and is designed to
>> +  meet the requirements of industrial control applications.
>> +
>> +  Specifications can be found at:
>> +    http://www.ti.com/lit/ds/symlink/dac8771.pdf
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - ti,dac8771
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  reset-gpios:
>> +    description: |
>> +       GPIO used for hardware reset.
>> +
>> +  loaddacs-gpios:
>> +    description: |
>> +       GPIO used to shift the data from the SPI FIFO to the processing engine.
>> +
>> +  spi-max-frequency:
>> +    maximum: 25000000
>> +
>> +  vref-supply:
>> +    description: Phandle to the external reference voltage supply.
>> +
>> +  ti,output-range:
>> +    description: Output range of the DAC
>> +       0 - Voltage output 0 to +5 V (default)
> Hmm. I'm never keen on opaque bindings, but sometimes things
> are just too complex to break out as individual fields.
>
> So I guess this is the best we can do.

Yes that is true.  These values are the same as the ones in the data sheet.

It would have been a simpler binding if the current values were not 
nested with the voltage values.

Dan
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml b/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml
new file mode 100644
index 000000000000..6aba6789d36c
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/ti,dac8771.yaml
@@ -0,0 +1,89 @@ 
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2019 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/bindings/iio/dac/ti,dac8771.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Texas Instruments DAC8771
+
+maintainers:
+  - Dan Murphy <dmurphy@ti.com>
+
+description: |
+  The DAC8771 is a single channel, precision, fully integrated 16-bit digital
+  to analog converter (DAC) with adaptive power management, and is designed to
+  meet the requirements of industrial control applications.
+
+  Specifications can be found at:
+    http://www.ti.com/lit/ds/symlink/dac8771.pdf
+
+properties:
+  compatible:
+    enum:
+      - ti,dac8771
+
+  reg:
+    maxItems: 1
+
+  reset-gpios:
+    description: |
+       GPIO used for hardware reset.
+
+  loaddacs-gpios:
+    description: |
+       GPIO used to shift the data from the SPI FIFO to the processing engine.
+
+  spi-max-frequency:
+    maximum: 25000000
+
+  vref-supply:
+    description: Phandle to the external reference voltage supply.
+
+  ti,output-range:
+    description: Output range of the DAC
+       0 - Voltage output 0 to +5 V (default)
+       1 - Voltage output 0 to +10 V
+       2 - Voltage output ±5 V
+       3 - Voltage output ±10 V
+       4 - Current output 3.5 mA to 23.5 mA
+       5 - Current output 0 to 20 mA
+       6 - Current output 0 to 24 mA
+       7 - Current output ±24 mA
+       8 - Voltage output 0 to +6 V
+       9 - Voltage output 0 to +12 V
+       10 - Voltage output ±6 V
+       11 - Voltage output ±12 V
+       12 - Current output 4 mA to 20 mA
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint8
+      - enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
+
+  interrupts:
+    description: IRQ line for the DAC
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - vref-supply
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+  
+      dac@0 {
+        compatible = "ti,dac8771";
+        reg = <0>;
+        spi-max-frequency = <25000000>;
+        vref-supply = <&ldo3_reg>;
+        ti,output-range = <2>;
+        interrupts = <16>;
+        interrupt-parent = <&gpio1>;
+        loaddacs-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
+        reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
+      };
+    };