devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Rob Herring <robh@kernel.org>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Lukas Wunner <lukas@wunner.de>
Subject: Re: [PATCH v2 16/29] dt-bindings:iio:dac:ti,dac082s085 yaml conversion
Date: Sun, 14 Mar 2021 19:07:54 +0000	[thread overview]
Message-ID: <20210314190754.2dd43dbf@archlinux> (raw)
In-Reply-To: <20201108163451.7946b776@archlinux>

On Sun, 8 Nov 2020 16:34:51 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Mon, 2 Nov 2020 20:21:08 -0600
> Rob Herring <robh@kernel.org> wrote:
> 
> > On Sat, Oct 31, 2020 at 01:40:57PM +0000, Jonathan Cameron wrote:  
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > 
> > > Fairly simple conversion with the exception of the XOR between
> > > spi-cpha and spi-cpol.
> > > 
> > > Is there a better way to specify that?
> > > 
> > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > Cc: Lukas Wunner <lukas@wunner.de>
> > > ---
> > > v2:
> > > * Family typo
> > > * Put back the reference regulator in example.
> > > * Added checking of XOR of spi-cpha and spi-cpol
> > >   (dropped Rob Herrings Reviewed-by due to this change)
> > >   
> > >  .../bindings/iio/dac/ti,dac082s085.yaml       | 79 +++++++++++++++++++
> > >  .../bindings/iio/dac/ti-dac082s085.txt        | 34 --------
> > >  2 files changed, 79 insertions(+), 34 deletions(-)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml
> > > new file mode 100644
> > > index 000000000000..192b314c99d1
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml
> > > @@ -0,0 +1,79 @@
> > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/iio/dac/ti,dac082s085.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Texas Instruments DAC082s085 and similar DACs
> > > +
> > > +description:
> > > +  A family of Texas Instruments 8/10/12-bit 2/4-channel DACs
> > > +
> > > +maintainers:
> > > +  - Lukas Wunner <lukas@wunner.de>
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - ti,dac082s085
> > > +      - ti,dac102s085
> > > +      - ti,dac122s085
> > > +      - ti,dac084s085
> > > +      - ti,dac104s085
> > > +      - ti,dac124s085
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  spi-cpha: true
> > > +  spi-cpol:
> > > +    description:
> > > +      Should be either spi-cpha, or spi-cpol but not both.
> > > +
> > > +  vref-supply:
> > > +    description: Needed to provide output scaling.
> > > +
> > > +  spi-max-frequency: true
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - vref-supply
> > > +
> > > +additionalProperties: false
> > > +
> > > +allOf:
> > > +  - $ref: '#/definitions/cpolXORcpha'
> > > +
> > > +definitions:
> > > +  cpolXORcpha:    
> > 
> > No need for a definition. Just put the below in the allOf entry.  
> 
> I can't figure out the syntax to do that.
> If I put it directly there I get, 
> 
> ... iio/dac/ti,dac082s085.yaml: allOf:0: 'not' is not one of ['$ref', 'if', 'then', 'else']
> 
> The use of $ref was the only way I could find to get around this.
> What other option is there?  My Yaml is still largely cut and paste
> based so not sure I fully understand the restrictions that are applied.

Hi Rob,

I've had another go at playing with the syntax but still can't find a way around the above
issue if I try to get rid of the definitions block as you suggest.

Any pointers on the syntax very much appreciated!

Thanks

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> 
> 
> >   
> > > +    not:
> > > +      required: [spi-cpha, spi-cpol]
> > > +    oneOf:
> > > +      - required:
> > > +          - spi-cpha
> > > +      - required:
> > > +          - spi-cpol
> > > +
> > > +examples:
> > > +  - |
> > > +    vref_2v5_reg: regulator-vref {
> > > +        compatible = "regulator-fixed";
> > > +        regulator-name = "2v5";
> > > +        regulator-min-microvolt = <2500000>;
> > > +        regulator-max-microvolt = <2500000>;
> > > +        regulator-always-on;
> > > +    };
> > > +    spi {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <0>;
> > > +
> > > +        dac@0 {
> > > +            compatible = "ti,dac082s085";
> > > +            reg = <0>;
> > > +            spi-max-frequency = <40000000>;
> > > +            spi-cpol;
> > > +            vref-supply = <&vref_2v5_reg>;
> > > +        };
> > > +    };
> > > +...
> > > diff --git a/Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt b/Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt
> > > deleted file mode 100644
> > > index 9cb0e10df704..000000000000
> > > --- a/Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt
> > > +++ /dev/null
> > > @@ -1,34 +0,0 @@
> > > -Texas Instruments 8/10/12-bit 2/4-channel DAC driver
> > > -
> > > -Required properties:
> > > - - compatible:		Must be one of:
> > > -			"ti,dac082s085"
> > > -			"ti,dac102s085"
> > > -			"ti,dac122s085"
> > > -			"ti,dac084s085"
> > > -			"ti,dac104s085"
> > > -			"ti,dac124s085"
> > > - - reg: 		Chip select number.
> > > - - spi-cpha, spi-cpol:	SPI mode (0,1) or (1,0) must be used, so specify
> > > -			either spi-cpha or spi-cpol (but not both).
> > > - - vref-supply: 	Phandle to the external reference voltage supply.
> > > -
> > > -For other required and optional properties of SPI slave nodes please refer to
> > > -../../spi/spi-bus.txt.
> > > -
> > > -Example:
> > > -	vref_2v5_reg: regulator-vref {
> > > -		compatible = "regulator-fixed";
> > > -		regulator-name = "2v5";
> > > -		regulator-min-microvolt = <2500000>;
> > > -		regulator-max-microvolt = <2500000>;
> > > -		regulator-always-on;
> > > -	};
> > > -
> > > -	dac@0 {
> > > -		compatible = "ti,dac082s085";
> > > -		reg = <0>;
> > > -		spi-max-frequency = <40000000>;
> > > -		spi-cpol;
> > > -		vref-supply = <&vref_2v5_reg>;
> > > -	};
> > > -- 
> > > 2.28.0
> > >     
> 


  reply	other threads:[~2021-03-14 19:08 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31 13:40 [PATCH v2 00/29] dt-bindings:iio: Another set of yaml conversions Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 01/29] dt-bindings:iio:humidity:hdc100x Drop separate doc + add to trivial-devices Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 02/29] dt-bindings:iio:humidity:htu21 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 03/29] dt-bindings:iio:humidity:st,hts221 yaml conversion Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 04/29] dt-bindings:iio:humidity:dht11 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 05/29] dt-bindings:iio:pressure:ms5637 Drop separate doc + add to trivial-devices Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 06/29] dt-bindings:iio:pressure:murata,zpa2326 yaml conversion Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 07/29] dt-bindings:iio:pressure:meas,ms5611 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 08/29] dt-bindings:iio:pressure:hoperf,hp03 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 09/29] dt-bindings:iio:proximity:semtech,sx9500 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 10/29] dt-bindings:iio:proximity:st,vl53l0x " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 11/29] dt-bindings:iio:proximity:ams,as3935 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 12/29] dt-bindings:iio:dac:ti,dac5571 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 13/29] dt-bindings:iio:dac:ti,dac7311 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 14/29] dt-bindings:iio:dac:ti,dac7512 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 15/29] dt-bindings:iio:dac:ti,dac7612 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 16/29] dt-bindings:iio:dac:ti,dac082s085 " Jonathan Cameron
2020-10-31 16:58   ` Lukas Wunner
2020-10-31 18:11     ` Jonathan Cameron
2020-11-03  2:21   ` Rob Herring
2020-11-08 16:34     ` Jonathan Cameron
2021-03-14 19:07       ` Jonathan Cameron [this message]
2021-03-14 19:23         ` Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 17/29] dt-bindings:iio:dac:adi,ad7303 " Jonathan Cameron
2020-10-31 13:40 ` [PATCH v2 18/29] dt-bindings:iio:dac:maxim,ds4424 " Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 19/29] dt-bindings:iio:dac:fsl,vf610-dac " Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 20/29] dt-bindings:iio:dac:microchip,mcp4725 " Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 21/29] dt-bindings:iio:dac:maxim,max5821 " Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 22/29] dt-bindings:iio:dac:nxp,lpc1850-dac " Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 23/29] dt-bindings:iio:dac:adi,ad5758 " Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 24/29] dt-bindings:iio:temperature:melexis,mlx90614 " Jonathan Cameron
2020-11-02  9:12   ` Crt Mori
2020-11-02 17:39     ` Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 25/29] dt-bindings:iio:temperature:melexis,mlx90632 conversion to yaml Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 26/29] dt-bindings:iio:temperature:meas,tsys01 move to trivial-devices.yaml Jonathan Cameron
2020-11-01 15:25   ` Manivannan Sadhasivam
2020-10-31 13:41 ` [PATCH v2 27/29] dt-bindings:iio:temperature:maxim,max31856 yaml conversion Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 28/29] dt-bindings:iio:temperature:maxim_thermocouple.txt to maxim,max31855k.yaml Jonathan Cameron
2020-10-31 13:41 ` [PATCH v2 29/29] dt-bindings:iio:temperature:ti,tmp07 yaml conversion Jonathan Cameron
2020-11-16 20:17 ` [PATCH v2 00/29] dt-bindings:iio: Another set of yaml conversions Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210314190754.2dd43dbf@archlinux \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).