diff mbox series

[1/3] dt-bindings:iio:adc: convert adc.txt to yaml

Message ID 20201031182423.742798-2-jic23@kernel.org
State New
Headers show
Series dt-bindings:iio:adc: Convert generic ADC channel binding to yaml | expand

Commit Message

Jonathan Cameron Oct. 31, 2020, 6:24 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Each driver that uses this will need to use a $ref
We can't always enable it like most of the generic bindings due to
channel@X matching far more widely than IIO.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 .../devicetree/bindings/iio/adc/adc.txt       | 23 -----------
 .../devicetree/bindings/iio/adc/adc.yaml      | 38 +++++++++++++++++++
 2 files changed, 38 insertions(+), 23 deletions(-)

Comments

Jonathan Cameron Nov. 28, 2020, 4:38 p.m. UTC | #1
On Sat, 31 Oct 2020 18:24:21 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> 

> Each driver that uses this will need to use a $ref

> We can't always enable it like most of the generic bindings due to

> channel@X matching far more widely than IIO.


This patch crossed with the introduction of a label attribute
to the txt file.  As that was trivial I've just moved that
over to the yaml file and applied to the togreg branch of iio.git
and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

> 

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---

>  .../devicetree/bindings/iio/adc/adc.txt       | 23 -----------

>  .../devicetree/bindings/iio/adc/adc.yaml      | 38 +++++++++++++++++++

>  2 files changed, 38 insertions(+), 23 deletions(-)

> 

> diff --git a/Documentation/devicetree/bindings/iio/adc/adc.txt b/Documentation/devicetree/bindings/iio/adc/adc.txt

> deleted file mode 100644

> index 5bbaa330a250..000000000000

> --- a/Documentation/devicetree/bindings/iio/adc/adc.txt

> +++ /dev/null

> @@ -1,23 +0,0 @@

> -Common ADCs properties

> -

> -Optional properties for child nodes:

> -- bipolar : Boolean, if set the channel is used in bipolar mode.

> -- diff-channels : Differential channels muxed for this ADC. The first value

> -		specifies the positive input pin, the second value the negative

> -		input pin.

> -

> -Example:

> -	adc@0 {

> -		compatible = "some,adc";

> -		...

> -		channel@0 {

> -			bipolar;

> -			diff-channels = <0 1>;

> -			...

> -		};

> -

> -		channel@1 {

> -			diff-channels = <2 3>;

> -			...

> -		};

> -	};

> diff --git a/Documentation/devicetree/bindings/iio/adc/adc.yaml b/Documentation/devicetree/bindings/iio/adc/adc.yaml

> new file mode 100644

> index 000000000000..328a4318feee

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/iio/adc/adc.yaml

> @@ -0,0 +1,38 @@

> +# SPDX-License-Identifier: GPL-2.0

> +%YAML 1.2

> +---

> +$id: http://devicetree.org/schemas/iio/adc/adc.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> +

> +title: Generic IIO bindings for ADC channels

> +

> +maintainers:

> +  - Jonathan Cameron <jic23@kernel.org>

> +

> +description:

> +  A few properties are defined in a common way ADC channels.

> +

> +properties:

> +  $nodename:

> +    pattern: "^channel(@[0-9a-f]+)?$"

> +    description:

> +      A channel index should match reg.

> +

> +  reg:

> +    maxItems: 1

> +

> +  bipolar:

> +    $ref: /schemas/types.yaml#/definitions/flag

> +    description: If provided, the channel is to be used in bipolar mode.

> +

> +  diff-channels:

> +    $ref: /schemas/types.yaml#/definitions/uint32-array

> +    maxItems: 2

> +    minItems: 2

> +    description:

> +      Many ADCs have dual Muxes to allow different input pins to be routed

> +      to both the positive and negative inputs of a differential ADC.

> +      The first value specifies the positive input pin, the second

> +      specifies the negative input pin.

> +

> +additionalProperties: true
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/adc.txt b/Documentation/devicetree/bindings/iio/adc/adc.txt
deleted file mode 100644
index 5bbaa330a250..000000000000
--- a/Documentation/devicetree/bindings/iio/adc/adc.txt
+++ /dev/null
@@ -1,23 +0,0 @@ 
-Common ADCs properties
-
-Optional properties for child nodes:
-- bipolar : Boolean, if set the channel is used in bipolar mode.
-- diff-channels : Differential channels muxed for this ADC. The first value
-		specifies the positive input pin, the second value the negative
-		input pin.
-
-Example:
-	adc@0 {
-		compatible = "some,adc";
-		...
-		channel@0 {
-			bipolar;
-			diff-channels = <0 1>;
-			...
-		};
-
-		channel@1 {
-			diff-channels = <2 3>;
-			...
-		};
-	};
diff --git a/Documentation/devicetree/bindings/iio/adc/adc.yaml b/Documentation/devicetree/bindings/iio/adc/adc.yaml
new file mode 100644
index 000000000000..328a4318feee
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/adc.yaml
@@ -0,0 +1,38 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/adc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic IIO bindings for ADC channels
+
+maintainers:
+  - Jonathan Cameron <jic23@kernel.org>
+
+description:
+  A few properties are defined in a common way ADC channels.
+
+properties:
+  $nodename:
+    pattern: "^channel(@[0-9a-f]+)?$"
+    description:
+      A channel index should match reg.
+
+  reg:
+    maxItems: 1
+
+  bipolar:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description: If provided, the channel is to be used in bipolar mode.
+
+  diff-channels:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    maxItems: 2
+    minItems: 2
+    description:
+      Many ADCs have dual Muxes to allow different input pins to be routed
+      to both the positive and negative inputs of a differential ADC.
+      The first value specifies the positive input pin, the second
+      specifies the negative input pin.
+
+additionalProperties: true