Skip to contentSkip to conversation

dt-bindings: iio: adc: add AD7816/AD7817/AD7818 binding

PATCH Superseded Hungyu Lin 2 participants 2 messages May 8

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Hungyu Lin

author
#0 lore raw

PATCH 1/1 dt-bindings: iio: adc: add AD7816/AD7817/AD7818 binding

Add Device Tree binding documentation for the Analog Devices AD7816, AD7817 and AD7818 SPI ADC devices.

The AD7816 provides temperature monitoring only, while the AD7817 and AD7818 provide analog input channels with an on-chip temperature sensor. The devices may use control GPIOs for RD/WR and CONVST, and optionally BUSY depending on the device variant.

---
 .../bindings/iio/adc/adi,ad7816.yaml          | 94 +++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad7816.yaml
Documentation/devicetree/bindings/iio/adc/adi,ad7816.yaml new file +94 -0
new file mode 100644
index 000000000000..490e5338d7b2
@@ -0,0 +1,94 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/adi,ad7816.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices AD7816/AD7817/AD7818 ADC
+
+maintainers:
+  - Hungyu Lin <[email protected]>
+
+description: |
+  Binding for Analog Devices AD7816, AD7817 and AD7818 SPI ADCs
+  with on-chip temperature sensor.
+
+  The AD7816 provides temperature monitoring only.
+  The AD7817 provides up to 4 analog input channels.
+  The AD7818 provides a single analog input channel.
+
+properties:
+  compatible:
+    enum:
+      - adi,ad7816
+      - adi,ad7817
+      - adi,ad7818
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+    description:
+      Optional interrupt line used by the device.
+
+  rdwr-gpios:
+    maxItems: 1
+    description:
+      GPIO connected to the RD/WR pin used to control read/write cycles.
+
+  convert-gpios:
+    maxItems: 1
+    description:
+      GPIO connected to the CONVST pin used to trigger conversions.
+
+  busy-gpios:
+    maxItems: 1
+    description:
+      GPIO connected to the BUSY pin indicating conversion status.
+
+required:
+  - compatible
+  - reg
+  - rdwr-gpios
+  - convert-gpios
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - adi,ad7816
+              - adi,ad7817
+    then:
+      required:
+        - busy-gpios
+    else:
+      properties:
+        busy-gpios: false
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    gpio0: gpio {
+      gpio-controller;
+      #gpio-cells = <2>;
+    };
+
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      adc@0 {
+        compatible = "adi,ad7816";
+        reg = <0>;
+        spi-max-frequency = <5000000>;
+        rdwr-gpios = <&gpio0 1 0>;
+        convert-gpios = <&gpio0 2 0>;
+        busy-gpios = <&gpio0 3 0>;
+      };
+    };
Signature · 1 line
2.34.1
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] GPIO properties described as optional are enforced as strictly required in the schema. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] GPIO properties described as optional are enforced as strictly required in the schema. --

commit 5e87ac2e842cf4989944934ecd916083ea3da1f7
Author: Hungyu Lin <[email protected]>

dt-bindings: iio: adc: add AD7816/AD7817/AD7818 binding

Add Device Tree binding documentation for the Analog Devices AD7816, AD7817 and AD7818 SPI ADC devices.

Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/adi,ad7816.yaml new file +0 -0
new file mode 100644
index 0000000000000..490e5338d7b2e

[ ... ]

Documentation/devicetree/bindings/iio/adc/adi,ad7816.yaml line 54

Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/adi,ad7816.yaml new file +5 -0
+required:
+  - compatible
+  - reg
+  - rdwr-gpios
+  - convert-gpios

The commit message states that the devices "may use control GPIOs for RD/WR and CONVST", which implies they are optional.

Are rdwr-gpios and convert-gpios strictly required for operation? If they can be left unconnected or hardwired depending on the board's hardware design, enforcing them in the global required block will cause valid device trees to fail validation.

Quoted 4 lines
Documentation/devicetree/bindings/iio/adc/adi,ad7816.yaml new file +4 -0
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+

Documentation/devicetree/bindings/iio/adc/adi,ad7816.yaml line 68

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/adi,ad7816.yaml new file +10 -0
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - adi,ad7816
+              - adi,ad7817
+    then:
+      required:
+        - busy-gpios

Does the same apply to busy-gpios? The commit message mentions BUSY is optional depending on the device variant, but this block enforces it as mandatory for the AD7816 and AD7817 variants.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1