diff mbox series

[v5,3/6] dt-bindings: iio: dac: Generalize DAC common properties

Message ID 20240702030025.57078-4-kimseer.paller@analog.com (mailing list archive)
State New
Headers show
Series Add driver for LTC2664 and LTC2672 | expand

Commit Message

Paller, Kim Seer July 2, 2024, 3 a.m. UTC
Introduce a generalized DAC binding that can be used by DACs that have
similar properties adding output-range-microamp and output-range-microvolt.

Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
---
 .../devicetree/bindings/iio/dac/dac.yaml      | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/dac.yaml

Comments

Conor Dooley July 2, 2024, 3:29 p.m. UTC | #1
On Tue, Jul 02, 2024 at 11:00:22AM +0800, Kim Seer Paller wrote:
> Introduce a generalized DAC binding that can be used by DACs that have
> similar properties adding output-range-microamp and output-range-microvolt.
> 
> Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
> ---
>  .../devicetree/bindings/iio/dac/dac.yaml      | 50 +++++++++++++++++++
>  1 file changed, 50 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/dac/dac.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/dac/dac.yaml b/Documentation/devicetree/bindings/iio/dac/dac.yaml
> new file mode 100644
> index 000000000000..579f52ea6eb1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/dac/dac.yaml
> @@ -0,0 +1,50 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/dac/dac.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: IIO Common Properties for DAC Channels
> +
> +maintainers:
> +  - Jonathan Cameron <jic23@kernel.org>
> +
> +description:
> +  A few properties are defined in a common way DAC channels.

"for DAC channels"

> +anyOf:
> +  - oneOf:
> +      - required:
> +          - reg
> +          - output-range-microamp
> +      - required:
> +          - reg
> +          - output-range-microvolt
> +  - required:
> +      - reg

Can't this be more simply written as

oneOf:
  - required:
      - output-range-microamp
  - required:
      - output-range-microvolt

required:
 - reg

 ?

 Cheers,
 Conor.
Paller, Kim Seer July 3, 2024, 5:11 a.m. UTC | #2
> -----Original Message-----
> From: Conor Dooley <conor@kernel.org>
> Sent: Tuesday, July 2, 2024 11:30 PM
> To: Paller, Kim Seer <KimSeer.Paller@analog.com>
> Cc: linux-kernel@vger.kernel.org; linux-iio@vger.kernel.org;
> devicetree@vger.kernel.org; Jonathan Cameron <jic23@kernel.org>; David
> Lechner <dlechner@baylibre.com>; Lars-Peter Clausen <lars@metafoo.de>;
> Liam Girdwood <lgirdwood@gmail.com>; Mark Brown <broonie@kernel.org>;
> Dimitri Fedrau <dima.fedrau@gmail.com>; Krzysztof Kozlowski
> <krzk+dt@kernel.org>; Rob Herring <robh@kernel.org>; Conor Dooley
> <conor+dt@kernel.org>; Hennerich, Michael
> <Michael.Hennerich@analog.com>; Nuno Sá <noname.nuno@gmail.com>
> Subject: Re: [PATCH v5 3/6] dt-bindings: iio: dac: Generalize DAC common
> properties
> 
> [External]
> 
> On Tue, Jul 02, 2024 at 11:00:22AM +0800, Kim Seer Paller wrote:
> > Introduce a generalized DAC binding that can be used by DACs that have
> > similar properties adding output-range-microamp and output-range-
> microvolt.
> >
> > Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
> > ---
> >  .../devicetree/bindings/iio/dac/dac.yaml      | 50 +++++++++++++++++++
> >  1 file changed, 50 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/dac/dac.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/iio/dac/dac.yaml
> > b/Documentation/devicetree/bindings/iio/dac/dac.yaml
> > new file mode 100644
> > index 000000000000..579f52ea6eb1
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/dac/dac.yaml
> > @@ -0,0 +1,50 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/dac/dac.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: IIO Common Properties for DAC Channels
> > +
> > +maintainers:
> > +  - Jonathan Cameron <jic23@kernel.org>
> > +
> > +description:
> > +  A few properties are defined in a common way DAC channels.
> 
> "for DAC channels"
> 
> > +anyOf:
> > +  - oneOf:
> > +      - required:
> > +          - reg
> > +          - output-range-microamp
> > +      - required:
> > +          - reg
> > +          - output-range-microvolt
> > +  - required:
> > +      - reg
> 
> Can't this be more simply written as
> 
> oneOf:
>   - required:
>       - output-range-microamp
>   - required:
>       - output-range-microvolt
> 
> required:
>  - reg
> 
>  ?

I was following the structure used in adc.yaml.
Yes, I think we can simplify it with that.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/dac/dac.yaml b/Documentation/devicetree/bindings/iio/dac/dac.yaml
new file mode 100644
index 000000000000..579f52ea6eb1
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/dac.yaml
@@ -0,0 +1,50 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/dac/dac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: IIO Common Properties for DAC Channels
+
+maintainers:
+  - Jonathan Cameron <jic23@kernel.org>
+
+description:
+  A few properties are defined in a common way DAC channels.
+
+properties:
+  $nodename:
+    pattern: "^channel(@[0-9a-f]+)?$"
+    description:
+      A channel index should match reg.
+
+  reg:
+    maxItems: 1
+
+  label:
+    description: Unique name to identify which channel this is.
+
+  output-range-microamp:
+    maxItems: 2
+    minItems: 2
+    description:
+      Specify the channel output full scale range in microamperes.
+
+  output-range-microvolt:
+    maxItems: 2
+    minItems: 2
+    description:
+      Specify the channel output full scale range in microvolts.
+
+anyOf:
+  - oneOf:
+      - required:
+          - reg
+          - output-range-microamp
+      - required:
+          - reg
+          - output-range-microvolt
+  - required:
+      - reg
+
+additionalProperties: true