diff mbox series

[2/2] bindings: iio: adc: Add documentation for ADS131E0x ADC driver

Message ID 20201127194240.15060-3-tomislav.denis@avl.com (mailing list archive)
State New, archived
Headers show
Series Add support for ADS131E0x ADC family | expand

Commit Message

Denis, Tomislav AVL DiTEST Nov. 27, 2020, 7:42 p.m. UTC
From: Tomislav Denis <tomislav.denis@avl.com>

Add a device tree binding documentation for Texas Instruments
ADS131E0x ADC family driver.

Signed-off-by: Tomislav Denis <tomislav.denis@avl.com>
---
 .../devicetree/bindings/iio/adc/ti,ads131e08.yaml  | 145 +++++++++++++++++++++
 MAINTAINERS                                        |   1 +
 2 files changed, 146 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml

Comments

Rob Herring Nov. 30, 2020, 5:36 p.m. UTC | #1
On Fri, 27 Nov 2020 20:42:40 +0100, tomislav.denis@avl.com wrote:
> From: Tomislav Denis <tomislav.denis@avl.com>
> 
> Add a device tree binding documentation for Texas Instruments
> ADS131E0x ADC family driver.
> 
> Signed-off-by: Tomislav Denis <tomislav.denis@avl.com>
> ---
>  .../devicetree/bindings/iio/adc/ti,ads131e08.yaml  | 145 +++++++++++++++++++++
>  MAINTAINERS                                        |   1 +
>  2 files changed, 146 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml
> 


My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml: 'additionalProperties' is a required property
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml: ignoring, error in schema: 
warning: no schema found in file: ./Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml
Documentation/devicetree/bindings/iio/adc/ti,ads131e08.example.dts:23.11-21: Warning (reg_format): /example-0/spidev@0:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Documentation/devicetree/bindings/iio/adc/ti,ads131e08.example.dt.yaml: Warning (pci_device_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/adc/ti,ads131e08.example.dt.yaml: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/adc/ti,ads131e08.example.dt.yaml: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/adc/ti,ads131e08.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/adc/ti,ads131e08.example.dt.yaml: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.example.dt.yaml: example-0: spidev@0:reg:0: [0] is too short
	From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml


See https://patchwork.ozlabs.org/patch/1407724

The base for the patch is generally the last rc1. Any dependencies
should be noted.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml
new file mode 100644
index 0000000..92da193
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml
@@ -0,0 +1,145 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,ads131e08.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments ADS131E0x 4-, 6-, and 8-Channel ADCs
+
+maintainers:
+  - Tomislav Denis <tomislav.denis@avl.com>
+
+description: |
+  The ADS131E0x are a family of multichannel, simultaneous sampling,
+  24-bit, delta-sigma, analog-to-digital converters (ADCs) with a
+  built-in programmable gain amplifier (PGA), internal reference
+  and an onboard oscillator.
+  The communication with ADC chip is via the SPI bus (mode 1).
+
+  https://www.ti.com/lit/ds/symlink/ads131e08.pdf
+
+properties:
+  compatible:
+    enum:
+      - ti,ads131e04
+      - ti,ads131e08
+
+  reg:
+    description: |
+      SPI chip select number
+    maxItems: 1
+
+  spi-cpha: true
+
+  clocks:
+    description: |
+      Device tree identifier to the clock source (2.048 MHz)
+      Note: clock source is selected using CLKSEL pin
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: adc-clk
+
+  interrupts:
+    description: |
+      IRQ line for the ADC data ready
+    maxItems: 1
+
+  vref-supply:
+    description: |
+      Optional external voltage reference. Has to be supplied, if
+      ti,vref-sel equals 2
+
+  ti,vref-sel:
+    description: |
+      Select the voltage reference source
+      Valid values are:
+      0: Internal reference 2.4V
+      1: Internal reference 4V
+      2: External reference source (vref-supply is required)
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1, 2]
+    default: 0
+
+  ti,datarate:
+    description: |
+      ADC data rate in kSPS
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8, 16, 32, 64]
+    default: 1
+
+  ti,gain:
+    description: |
+      The gain value for the PGA function
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8, 12]
+    default: 1
+
+  ti,adc-channels:
+    description: |
+      List of single-ended channels muxed for this ADC
+      - 4 channels, numbered from 0 to 3 for ti,ads131e04
+      - 8 channels, numbered from 0 to 7 for ti,ads131e08
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+required:
+  - compatible
+  - reg
+  - spi-cpha
+  - clocks
+  - clock-names
+  - interrupts
+  - ti,adc-channels
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,ads131e04
+
+  - then:
+      properties:
+        ti,adc-channels:
+          minItems: 1
+          maxItems: 4
+          items:
+            minimum: 0
+            maximum: 3
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: ti,ads131e08
+
+  - then:
+      properties:
+        ti,adc-channels:
+          minItems: 1
+          maxItems: 8
+          items:
+            minimum: 0
+            maximum: 7
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    spidev@0 {
+      compatible = "ti,ads131e08";
+      reg = <0>;
+      spi-max-frequency = <1000000>;
+      spi-cpha;
+      clocks = <&clk2048k>;
+      clock-names = "adc-clk";
+      interrupt-parent = <&gpio5>;
+      interrupts = <28 IRQ_TYPE_EDGE_FALLING>;
+      vref-supply = <&vref_reg>;
+      ti,vref-sel = <2>;
+      ti,datarate = <1>;
+      ti,gain = <1>;
+      ti,adc-channels = <0 1 2 3 4 5 6 7>;
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 28bc5f9..0c351c7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17224,6 +17224,7 @@  TI ADS131E0X ADC SERIES DRIVER
 M:	Tomislav Denis <tomislav.denis@avl.com>
 L:	linux-iio@vger.kernel.org
 S:	Maintained
+F:	Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml
 F:	drivers/iio/adc/ti-ads131e08.c
 
 TI AM437X VPFE DRIVER