dt-bindings:iio:adc:brcm,iproc-static-adc: txt to yaml conversion
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 31 Oct 2020 18:48:40 +0000 (18:48 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 25 Nov 2020 14:35:53 +0000 (14:35 +0000)
A few questions came up in this one.
1) Why does the txt file document io-channel-ranges as a required property.
   That property is for iio-channel consumers, and this is a provider.
   I have dropped it.
2) The example had an @180a6000 for the ADC but given it uses syscon for
   all access, it doesn't have its own reg etc.  I've dropped that from
   the binding example.

Note this example was lifted directly from bcm-cygnus.dtsi so both
issues are present there as well.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Link: https://lore.kernel.org/r/20201031184854.745828-33-jic23@kernel.org
Documentation/devicetree/bindings/iio/adc/brcm,iproc-static-adc.txt [deleted file]
Documentation/devicetree/bindings/iio/adc/brcm,iproc-static-adc.yaml [new file with mode: 0644]

diff --git a/Documentation/devicetree/bindings/iio/adc/brcm,iproc-static-adc.txt b/Documentation/devicetree/bindings/iio/adc/brcm,iproc-static-adc.txt
deleted file mode 100644 (file)
index 7b1b1e4..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-* Broadcom's IPROC Static ADC controller
-
-Broadcom iProc ADC controller has 8 channels 10bit ADC.
-Allows user to convert analog input voltage values to digital.
-
-Required properties:
-
-- compatible: Must be "brcm,iproc-static-adc"
-
-- adc-syscon: Handler of syscon node defining physical base address of the
-  controller and length of memory mapped region.
-
-- #io-channel-cells = <1>; As ADC has multiple outputs
-  refer to Documentation/devicetree/bindings/iio/iio-bindings.txt for details.
-
-- io-channel-ranges:
-  refer to Documentation/devicetree/bindings/iio/iio-bindings.txt for details.
-
-- clocks: Clock used for this block.
-
-- clock-names: Clock name should be given as tsc_clk.
-
-- interrupts: interrupt line number.
-
-For example:
-
-       ts_adc_syscon: ts_adc_syscon@180a6000 {
-               compatible = "brcm,iproc-ts-adc-syscon","syscon";
-               reg = <0x180a6000 0xc30>;
-       };
-
-       adc: adc@180a6000 {
-               compatible = "brcm,iproc-static-adc";
-               adc-syscon = <&ts_adc_syscon>;
-               #io-channel-cells = <1>;
-               io-channel-ranges;
-               clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>;
-               clock-names = "tsc_clk";
-               interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
-       };
diff --git a/Documentation/devicetree/bindings/iio/adc/brcm,iproc-static-adc.yaml b/Documentation/devicetree/bindings/iio/adc/brcm,iproc-static-adc.yaml
new file mode 100644 (file)
index 0000000..c562d25
--- /dev/null
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/brcm,iproc-static-adc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom's IPROC Static ADC controller
+
+maintainers:
+  - Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
+
+description: |
+  Broadcom iProc ADC controller has 8 10bit channels
+
+properties:
+  compatible:
+    const: brcm,iproc-static-adc
+
+  adc-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      syscon node defining physical base address of the controller and length
+      of memory mapped region.
+
+  "#io-channel-cells":
+    const: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: tsc_clk
+
+  interrupts:
+    maxItems: 1
+
+additionalProperties: false
+
+required:
+  - compatible
+  - adc-syscon
+  - "#io-channel-cells"
+  - clocks
+  - clock-names
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/clock/bcm-cygnus.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    soc {
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        ts_adc_syscon: ts_adc_syscon@180a6000 {
+            compatible = "brcm,iproc-ts-adc-syscon","syscon";
+            reg = <0x180a6000 0xc30>;
+        };
+
+        adc {
+            compatible = "brcm,iproc-static-adc";
+            adc-syscon = <&ts_adc_syscon>;
+            #io-channel-cells = <1>;
+            clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>;
+            clock-names = "tsc_clk";
+            interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
+        };
+    };
+...