All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml
@ 2020-10-31 18:24 Jonathan Cameron
  2020-10-31 18:24 ` [PATCH 1/3] dt-bindings:iio:adc: convert adc.txt " Jonathan Cameron
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:24 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron

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

This channel binding is not yet that heavily used, though that will slowly
change now we have a standard binding.  There are more properties coming
for this binding in the near future.

This series converts the channel binding itself then leverages it to
reduce repitition and improve consistency in a couple of drivers.

One thing to note is that we have similar defintion for DACs but so
far there are no generic properties.

Jonathan Cameron (3):
  dt-bindings:iio:adc: convert adc.txt to yaml
  dt-bindings:iio:adc:adi,ad7124: Use the new adc.yaml channel binding
  dt-bindings:iio:adc:adi,ad7292: Use new adc.yaml binding for channels.

 .../devicetree/bindings/iio/adc/adc.txt       | 23 -----------
 .../devicetree/bindings/iio/adc/adc.yaml      | 38 +++++++++++++++++++
 .../bindings/iio/adc/adi,ad7124.yaml          | 14 +++----
 .../bindings/iio/adc/adi,ad7292.yaml          |  8 ++--
 4 files changed, 47 insertions(+), 36 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/iio/adc/adc.txt
 create mode 100644 Documentation/devicetree/bindings/iio/adc/adc.yaml

-- 
2.28.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] dt-bindings:iio:adc: convert adc.txt to yaml
  2020-10-31 18:24 [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Jonathan Cameron
@ 2020-10-31 18:24 ` Jonathan Cameron
  2020-11-28 16:38   ` Jonathan Cameron
  2020-10-31 18:24 ` [PATCH 2/3] dt-bindings:iio:adc:adi,ad7124: Use the new adc.yaml channel binding Jonathan Cameron
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:24 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron

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(-)

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
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] dt-bindings:iio:adc:adi,ad7124: Use the new adc.yaml channel binding
  2020-10-31 18:24 [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Jonathan Cameron
  2020-10-31 18:24 ` [PATCH 1/3] dt-bindings:iio:adc: convert adc.txt " Jonathan Cameron
@ 2020-10-31 18:24 ` Jonathan Cameron
  2020-10-31 18:24 ` [PATCH 3/3] dt-bindings:iio:adc:adi,ad7292: Use new adc.yaml binding for channels Jonathan Cameron
  2020-11-03  2:31 ` [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Rob Herring
  3 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:24 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Michael Hennerich

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

This both ensures this binding is compliant with the generic properties
and reduces the amount we need to specify in this separate binding.

Whilst here mark the child node as additionalProperties: false

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
---
 .../devicetree/bindings/iio/adc/adi,ad7124.yaml    | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml
index f1c574c896cb..fb3d0dae9bae 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml
@@ -63,10 +63,10 @@ required:
 
 patternProperties:
   "^channel@([0-9]|1[0-5])$":
+    $ref: "adc.yaml"
     type: object
     description: |
       Represents the external channels which are connected to the ADC.
-      See Documentation/devicetree/bindings/iio/adc/adc.txt.
 
     properties:
       reg:
@@ -88,15 +88,9 @@ patternProperties:
         $ref: /schemas/types.yaml#/definitions/uint32
         enum: [0, 1, 3]
 
-      diff-channels:
-        description: see Documentation/devicetree/bindings/iio/adc/adc.txt
-        items:
-          minimum: 0
-          maximum: 15
+      diff-channels: true
 
-      bipolar:
-        description: see Documentation/devicetree/bindings/iio/adc/adc.txt
-        type: boolean
+      bipolar: true
 
       adi,buffered-positive:
         description: Enable buffered mode for positive input.
@@ -110,6 +104,8 @@ patternProperties:
       - reg
       - diff-channels
 
+    additionalProperties: false
+
 additionalProperties: false
 
 examples:
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] dt-bindings:iio:adc:adi,ad7292: Use new adc.yaml binding for channels.
  2020-10-31 18:24 [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Jonathan Cameron
  2020-10-31 18:24 ` [PATCH 1/3] dt-bindings:iio:adc: convert adc.txt " Jonathan Cameron
  2020-10-31 18:24 ` [PATCH 2/3] dt-bindings:iio:adc:adi,ad7124: Use the new adc.yaml channel binding Jonathan Cameron
@ 2020-10-31 18:24 ` Jonathan Cameron
  2020-11-03  2:31 ` [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Rob Herring
  3 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:24 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Marcelo Schmitt

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

Also add additionalProperties: false for the child nodes.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
---
 Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml
index 108d202b288f..a3e39a40c9b3 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml
@@ -45,10 +45,10 @@ required:
 
 patternProperties:
   "^channel@[0-7]$":
+    $ref: "adc.yaml"
     type: object
     description: |
       Represents the external channels which are connected to the ADC.
-      See Documentation/devicetree/bindings/iio/adc/adc.txt.
 
     properties:
       reg:
@@ -58,13 +58,13 @@ patternProperties:
           - minimum: 0
             maximum: 7
 
-      diff-channels:
-        description: see Documentation/devicetree/bindings/iio/adc/adc.txt
-        maxItems: 1
+      diff-channels: true
 
     required:
       - reg
 
+    additionalProperties: true
+
 additionalProperties: false
 
 examples:
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml
  2020-10-31 18:24 [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Jonathan Cameron
                   ` (2 preceding siblings ...)
  2020-10-31 18:24 ` [PATCH 3/3] dt-bindings:iio:adc:adi,ad7292: Use new adc.yaml binding for channels Jonathan Cameron
@ 2020-11-03  2:31 ` Rob Herring
  2020-11-28 16:39   ` Jonathan Cameron
  3 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2020-11-03  2:31 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, devicetree, Jonathan Cameron

On Sat, Oct 31, 2020 at 06:24:20PM +0000, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> This channel binding is not yet that heavily used, though that will slowly
> change now we have a standard binding.  There are more properties coming
> for this binding in the near future.
> 
> This series converts the channel binding itself then leverages it to
> reduce repitition and improve consistency in a couple of drivers.
> 
> One thing to note is that we have similar defintion for DACs but so
> far there are no generic properties.
> 
> Jonathan Cameron (3):
>   dt-bindings:iio:adc: convert adc.txt to yaml
>   dt-bindings:iio:adc:adi,ad7124: Use the new adc.yaml channel binding
>   dt-bindings:iio:adc:adi,ad7292: Use new adc.yaml binding for channels.

For the series:

Reviewed-by: Rob Herring <robh@kernel.org>

> 
>  .../devicetree/bindings/iio/adc/adc.txt       | 23 -----------
>  .../devicetree/bindings/iio/adc/adc.yaml      | 38 +++++++++++++++++++
>  .../bindings/iio/adc/adi,ad7124.yaml          | 14 +++----
>  .../bindings/iio/adc/adi,ad7292.yaml          |  8 ++--
>  4 files changed, 47 insertions(+), 36 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/iio/adc/adc.txt
>  create mode 100644 Documentation/devicetree/bindings/iio/adc/adc.yaml
> 
> -- 
> 2.28.0
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] dt-bindings:iio:adc: convert adc.txt to yaml
  2020-10-31 18:24 ` [PATCH 1/3] dt-bindings:iio:adc: convert adc.txt " Jonathan Cameron
@ 2020-11-28 16:38   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-11-28 16:38 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml
  2020-11-03  2:31 ` [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Rob Herring
@ 2020-11-28 16:39   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-11-28 16:39 UTC (permalink / raw)
  To: Rob Herring; +Cc: linux-iio, devicetree, Jonathan Cameron

On Mon, 2 Nov 2020 20:31:46 -0600
Rob Herring <robh@kernel.org> wrote:

> On Sat, Oct 31, 2020 at 06:24:20PM +0000, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > This channel binding is not yet that heavily used, though that will slowly
> > change now we have a standard binding.  There are more properties coming
> > for this binding in the near future.
> > 
> > This series converts the channel binding itself then leverages it to
> > reduce repitition and improve consistency in a couple of drivers.
> > 
> > One thing to note is that we have similar defintion for DACs but so
> > far there are no generic properties.
> > 
> > Jonathan Cameron (3):
> >   dt-bindings:iio:adc: convert adc.txt to yaml
> >   dt-bindings:iio:adc:adi,ad7124: Use the new adc.yaml channel binding
> >   dt-bindings:iio:adc:adi,ad7292: Use new adc.yaml binding for channels.  
> 
> For the series:
> 
> Reviewed-by: Rob Herring <robh@kernel.org>
Series applied with just that small addition to patch 1.

Thanks,

Jonathan

> 
> > 
> >  .../devicetree/bindings/iio/adc/adc.txt       | 23 -----------
> >  .../devicetree/bindings/iio/adc/adc.yaml      | 38 +++++++++++++++++++
> >  .../bindings/iio/adc/adi,ad7124.yaml          | 14 +++----
> >  .../bindings/iio/adc/adi,ad7292.yaml          |  8 ++--
> >  4 files changed, 47 insertions(+), 36 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/iio/adc/adc.txt
> >  create mode 100644 Documentation/devicetree/bindings/iio/adc/adc.yaml
> > 
> > -- 
> > 2.28.0
> >   


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-11-28 22:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31 18:24 [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Jonathan Cameron
2020-10-31 18:24 ` [PATCH 1/3] dt-bindings:iio:adc: convert adc.txt " Jonathan Cameron
2020-11-28 16:38   ` Jonathan Cameron
2020-10-31 18:24 ` [PATCH 2/3] dt-bindings:iio:adc:adi,ad7124: Use the new adc.yaml channel binding Jonathan Cameron
2020-10-31 18:24 ` [PATCH 3/3] dt-bindings:iio:adc:adi,ad7292: Use new adc.yaml binding for channels Jonathan Cameron
2020-11-03  2:31 ` [PATCH 0/3] dt-bindings:iio:adc: Convert generic ADC channel binding to yaml Rob Herring
2020-11-28 16:39   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.