* [PATCH 0/2] dt-bindings:iio:consumer yaml bindings @ 2020-10-11 16:30 Jonathan Cameron 2020-10-11 16:30 ` [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers Jonathan Cameron 2020-10-11 16:30 ` [PATCH 2/2] dt-bindings:iio:dac:dpot-dac: yaml conversion Jonathan Cameron 0 siblings, 2 replies; 5+ messages in thread From: Jonathan Cameron @ 2020-10-11 16:30 UTC (permalink / raw) To: linux-iio, Rob Herring; +Cc: Jonathan Cameron From: Jonathan Cameron <Jonathan.Cameron@huawei.com> Hi Rob / All, I've done this as a small independent series as it's something new to me and I'm far from sure I did it correctly. This includes both pulling out the iio consumer binding to a separate yaml file and an example of using it. Thanks, Jonathan Jonathan Cameron (2): dt-bindings:iio:iio-consumer add yaml binding for IIO consumers dt-bindings:iio:dac:dpot-dac: yaml conversion. .../devicetree/bindings/iio/dac/dpot-dac.txt | 41 ------------ .../devicetree/bindings/iio/dac/dpot-dac.yaml | 67 +++++++++++++++++++ .../devicetree/bindings/iio/iio-bindings.txt | 53 --------------- .../devicetree/bindings/iio/iio-consumer.yaml | 59 ++++++++++++++++ 4 files changed, 126 insertions(+), 94 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/dac/dpot-dac.txt create mode 100644 Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml create mode 100644 Documentation/devicetree/bindings/iio/iio-consumer.yaml -- 2.28.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers 2020-10-11 16:30 [PATCH 0/2] dt-bindings:iio:consumer yaml bindings Jonathan Cameron @ 2020-10-11 16:30 ` Jonathan Cameron 2020-10-12 13:30 ` Rob Herring 2020-10-11 16:30 ` [PATCH 2/2] dt-bindings:iio:dac:dpot-dac: yaml conversion Jonathan Cameron 1 sibling, 1 reply; 5+ messages in thread From: Jonathan Cameron @ 2020-10-11 16:30 UTC (permalink / raw) To: linux-iio, Rob Herring; +Cc: Jonathan Cameron From: Jonathan Cameron <Jonathan.Cameron@huawei.com> This can be used via $ref by bindings that are consumers of the channels provided by IIO devices. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> --- .../devicetree/bindings/iio/iio-bindings.txt | 53 ----------------- .../devicetree/bindings/iio/iio-consumer.yaml | 59 +++++++++++++++++++ 2 files changed, 59 insertions(+), 53 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/iio-bindings.txt b/Documentation/devicetree/bindings/iio/iio-bindings.txt index aa63cac7323e..cfaed2b54fa9 100644 --- a/Documentation/devicetree/bindings/iio/iio-bindings.txt +++ b/Documentation/devicetree/bindings/iio/iio-bindings.txt @@ -47,56 +47,3 @@ Example for a configuration with trigger: }; }; -==IIO consumers== - -Required properties: -io-channels: List of phandle and IIO specifier pairs, one pair - for each IIO input to the device. Note: if the - IIO provider specifies '0' for #io-channel-cells, - then only the phandle portion of the pair will appear. - -Optional properties: -io-channel-names: - List of IIO input name strings sorted in the same - order as the io-channels property. Consumers drivers - will use io-channel-names to match IIO input names - with IIO specifiers. -io-channel-ranges: - Empty property indicating that child nodes can inherit named - IIO channels from this node. Useful for bus nodes to provide - and IIO channel to their children. - -For example: - - device { - io-channels = <&adc 1>, <&ref 0>; - io-channel-names = "vcc", "vdd"; - }; - -This represents a device with two IIO inputs, named "vcc" and "vdd". -The vcc channel is connected to output 1 of the &adc device, and the -vdd channel is connected to output 0 of the &ref device. - -==Example== - - adc: max1139@35 { - compatible = "maxim,max1139"; - reg = <0x35>; - #io-channel-cells = <1>; - }; - - ... - - iio-hwmon { - compatible = "iio-hwmon"; - io-channels = <&adc 0>, <&adc 1>, <&adc 2>, - <&adc 3>, <&adc 4>, <&adc 5>, - <&adc 6>, <&adc 7>, <&adc 8>, - <&adc 9>; - }; - - some_consumer { - compatible = "some-consumer"; - io-channels = <&adc 10>, <&adc 11>; - io-channel-names = "adc1", "adc2"; - }; diff --git a/Documentation/devicetree/bindings/iio/iio-consumer.yaml b/Documentation/devicetree/bindings/iio/iio-consumer.yaml new file mode 100644 index 000000000000..5f28cc29edce --- /dev/null +++ b/Documentation/devicetree/bindings/iio/iio-consumer.yaml @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/iio-consumer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic IIO consumer-bindings + +maintainers: + - Jonathan Cameron <jic23@kernel.org> + +description: + This binding describes generic properties a consumer of the channels + provided by an IIO device may use. + + As well, direct readings of channels on an IIO Device, an IIO device + can provide services to consumer devices. Thes are in the form of + channel readings and properties. For example, an ADC might provide + 3 channels to an analog accelerometer so that an accelerometer + driver can use them to read the voltages that correspond to the + accelerations on the 3 axis and apply appropriate calibration to + provide useful outputs. + +properties: + io-channels: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: > + List of phandle and IIO specifier pairs, one pair + for each IIO input to the device. Note: if the + IIO provider specifies '0' for #io-channel-cells, + then only the phandle portion of the pair will appear. + + io-channel-names: + $ref: /schemas/types.yaml#/definitions/string-array + description: > + List of names associated with a given IIO channel by the consumer + device. An example for an analog accelerometer would be "accel_x". + Consumers drivers will use io-channel-names to locate the correct + phandle based reference in io-channels. + + io-channel-ranges: + type: boolean + description: > + Empty property indicating that child nodes can inherit named + IIO channels from this node. Useful for bus nodes to provide + and IIO channel to their children. + +additionalProperties: true + +examples: + - | + iio-hwmon { + compatible = "iio-hwmon"; + io-channels = <&adc 0>, <&adc 1>, <&adc 2>, + <&adc 3>, <&adc 4>, <&adc 5>, + <&adc 6>, <&adc 7>, <&adc 8>, + <&adc 9>; + }; +... \ No newline at end of file -- 2.28.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers 2020-10-11 16:30 ` [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers Jonathan Cameron @ 2020-10-12 13:30 ` Rob Herring 0 siblings, 0 replies; 5+ messages in thread From: Rob Herring @ 2020-10-12 13:30 UTC (permalink / raw) To: Jonathan Cameron; +Cc: open list:IIO SUBSYSTEM AND DRIVERS, Jonathan Cameron On Sun, Oct 11, 2020 at 11:33 AM Jonathan Cameron <jic23@kernel.org> wrote: > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > This can be used via $ref by bindings that are consumers of the > channels provided by IIO devices. For consumers like this, I'd suggest instead doing 'select: true' and no $ref. The reason being is we always need additional constraints in the user bindings, and the 'select' means the properties are always at least type checked. I'd also prefer if we move this to the dtschema repo. Otherwise, looks fine. > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > .../devicetree/bindings/iio/iio-bindings.txt | 53 ----------------- > .../devicetree/bindings/iio/iio-consumer.yaml | 59 +++++++++++++++++++ > 2 files changed, 59 insertions(+), 53 deletions(-) > > diff --git a/Documentation/devicetree/bindings/iio/iio-bindings.txt b/Documentation/devicetree/bindings/iio/iio-bindings.txt > index aa63cac7323e..cfaed2b54fa9 100644 > --- a/Documentation/devicetree/bindings/iio/iio-bindings.txt > +++ b/Documentation/devicetree/bindings/iio/iio-bindings.txt > @@ -47,56 +47,3 @@ Example for a configuration with trigger: > }; > }; > > -==IIO consumers== > - > -Required properties: > -io-channels: List of phandle and IIO specifier pairs, one pair > - for each IIO input to the device. Note: if the > - IIO provider specifies '0' for #io-channel-cells, > - then only the phandle portion of the pair will appear. > - > -Optional properties: > -io-channel-names: > - List of IIO input name strings sorted in the same > - order as the io-channels property. Consumers drivers > - will use io-channel-names to match IIO input names > - with IIO specifiers. > -io-channel-ranges: > - Empty property indicating that child nodes can inherit named > - IIO channels from this node. Useful for bus nodes to provide > - and IIO channel to their children. > - > -For example: > - > - device { > - io-channels = <&adc 1>, <&ref 0>; > - io-channel-names = "vcc", "vdd"; > - }; > - > -This represents a device with two IIO inputs, named "vcc" and "vdd". > -The vcc channel is connected to output 1 of the &adc device, and the > -vdd channel is connected to output 0 of the &ref device. > - > -==Example== > - > - adc: max1139@35 { > - compatible = "maxim,max1139"; > - reg = <0x35>; > - #io-channel-cells = <1>; > - }; > - > - ... > - > - iio-hwmon { > - compatible = "iio-hwmon"; > - io-channels = <&adc 0>, <&adc 1>, <&adc 2>, > - <&adc 3>, <&adc 4>, <&adc 5>, > - <&adc 6>, <&adc 7>, <&adc 8>, > - <&adc 9>; > - }; > - > - some_consumer { > - compatible = "some-consumer"; > - io-channels = <&adc 10>, <&adc 11>; > - io-channel-names = "adc1", "adc2"; > - }; > diff --git a/Documentation/devicetree/bindings/iio/iio-consumer.yaml b/Documentation/devicetree/bindings/iio/iio-consumer.yaml > new file mode 100644 > index 000000000000..5f28cc29edce > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/iio-consumer.yaml > @@ -0,0 +1,59 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/iio-consumer.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Generic IIO consumer-bindings > + > +maintainers: > + - Jonathan Cameron <jic23@kernel.org> > + > +description: > + This binding describes generic properties a consumer of the channels > + provided by an IIO device may use. > + > + As well, direct readings of channels on an IIO Device, an IIO device > + can provide services to consumer devices. Thes are in the form of > + channel readings and properties. For example, an ADC might provide > + 3 channels to an analog accelerometer so that an accelerometer > + driver can use them to read the voltages that correspond to the > + accelerations on the 3 axis and apply appropriate calibration to > + provide useful outputs. > + > +properties: > + io-channels: > + $ref: /schemas/types.yaml#/definitions/phandle-array > + description: > > + List of phandle and IIO specifier pairs, one pair > + for each IIO input to the device. Note: if the > + IIO provider specifies '0' for #io-channel-cells, > + then only the phandle portion of the pair will appear. > + > + io-channel-names: > + $ref: /schemas/types.yaml#/definitions/string-array > + description: > > + List of names associated with a given IIO channel by the consumer > + device. An example for an analog accelerometer would be "accel_x". > + Consumers drivers will use io-channel-names to locate the correct > + phandle based reference in io-channels. > + > + io-channel-ranges: > + type: boolean > + description: > > + Empty property indicating that child nodes can inherit named > + IIO channels from this node. Useful for bus nodes to provide > + and IIO channel to their children. > + > +additionalProperties: true > + > +examples: > + - | > + iio-hwmon { > + compatible = "iio-hwmon"; > + io-channels = <&adc 0>, <&adc 1>, <&adc 2>, > + <&adc 3>, <&adc 4>, <&adc 5>, > + <&adc 6>, <&adc 7>, <&adc 8>, > + <&adc 9>; > + }; > +... > \ No newline at end of file > -- > 2.28.0 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] dt-bindings:iio:dac:dpot-dac: yaml conversion. 2020-10-11 16:30 [PATCH 0/2] dt-bindings:iio:consumer yaml bindings Jonathan Cameron 2020-10-11 16:30 ` [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers Jonathan Cameron @ 2020-10-11 16:30 ` Jonathan Cameron 2020-10-11 20:35 ` Peter Rosin 1 sibling, 1 reply; 5+ messages in thread From: Jonathan Cameron @ 2020-10-11 16:30 UTC (permalink / raw) To: linux-iio, Rob Herring; +Cc: Jonathan Cameron, Peter Rosin From: Jonathan Cameron <Jonathan.Cameron@huawei.com> Txt to yaml format conversion. I dropped the example section describind the measurement ADC, as that isn't strictly part of this binding. Uses a reference to the new iio-consumers.yaml binding. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Peter Rosin <peda@axentia.se> --- .../devicetree/bindings/iio/dac/dpot-dac.txt | 41 ------------ .../devicetree/bindings/iio/dac/dpot-dac.yaml | 67 +++++++++++++++++++ 2 files changed, 67 insertions(+), 41 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt b/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt deleted file mode 100644 index fdf47a01bfef..000000000000 --- a/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt +++ /dev/null @@ -1,41 +0,0 @@ -Bindings for DAC emulation using a digital potentiometer - -It is assumed that the dpot is used as a voltage divider between the -current dpot wiper setting and the maximum resistance of the dpot. The -divided voltage is provided by a vref regulator. - - .------. - .-----------. | | - | vref |--' .---. - | regulator |--. | | - '-----------' | | d | - | | p | - | | o | wiper - | | t |<---------+ - | | | - | '---' dac output voltage - | | - '------+------------+ - -Required properties: -- compatible: Should be "dpot-dac" -- vref-supply: The regulator supplying the voltage divider. -- io-channels: Channel node of the dpot to be used for the voltage division. -- io-channel-names: Should be "dpot". - -Example: - - &i2c { - dpot: mcp4651-503@28 { - compatible = "microchip,mcp4651-503"; - reg = <0x28>; - #io-channel-cells = <1>; - }; - }; - - dac { - compatible = "dpot-dac"; - vref-supply = <®_3v3>; - io-channels = <&dpot 0>; - io-channel-names = "dpot"; - }; diff --git a/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml b/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml new file mode 100644 index 000000000000..b4a8073a3a3c --- /dev/null +++ b/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/dac/dpot-dac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: DAC emulation using a digital potentiometer + +maintainers: + - Peter Rosin <peda@axentia.se> + +description: | + It is assumed that the dpot is used as a voltage divider between the + current dpot wiper setting and the maximum resistance of the dpot. The + divided voltage is provided by a vref regulator. + + .------. + .-----------. | | + | vref |--' .---. + | regulator |--. | | + '-----------' | | d | + | | p | + | | o | wiper + | | t |<---------+ + | | | + | '---' dac output voltage + | | + '------+------------+ + +allOf: + - $ref: "../iio-consumer.yaml#" + +properties: + compatible: + const: dpot-dac + + reg: + maxItems: 1 + + vref-supply: + description: Regulator supplying the voltage divider. + + io-channels: + maxItems: 1 + description: | + Channel node of the dpot to be used for the voltage division. + + io-channel-names: + const: dpot + +required: + - compatible + - vref-supply + - io-channels + - io-channel-names + +additionalProperties: false + +examples: + - | + dac { + compatible = "dpot-dac"; + vref-supply = <®_3v3>; + io-channels = <&dpot 0>; + io-channel-names = "dpot"; + }; +... -- 2.28.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] dt-bindings:iio:dac:dpot-dac: yaml conversion. 2020-10-11 16:30 ` [PATCH 2/2] dt-bindings:iio:dac:dpot-dac: yaml conversion Jonathan Cameron @ 2020-10-11 20:35 ` Peter Rosin 0 siblings, 0 replies; 5+ messages in thread From: Peter Rosin @ 2020-10-11 20:35 UTC (permalink / raw) To: Jonathan Cameron, linux-iio, Rob Herring; +Cc: Jonathan Cameron Hi! On 2020-10-11 18:30, Jonathan Cameron wrote: > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > Txt to yaml format conversion. I dropped the example section > describind the measurement ADC, as that isn't strictly part > of this binding. Uses a reference to the new iio-consumers.yaml > binding. > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Cc: Peter Rosin <peda@axentia.se> While not being competent at checking the yaml thingies, I can at least ack the zap of the irrelevant part of the example and generally support the conversion to a more strict representation. Acked-by: Peter Rosin <peda@axentia.se> > --- > .../devicetree/bindings/iio/dac/dpot-dac.txt | 41 ------------ > .../devicetree/bindings/iio/dac/dpot-dac.yaml | 67 +++++++++++++++++++ > 2 files changed, 67 insertions(+), 41 deletions(-) > > diff --git a/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt b/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt > deleted file mode 100644 > index fdf47a01bfef..000000000000 > --- a/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt > +++ /dev/null > @@ -1,41 +0,0 @@ > -Bindings for DAC emulation using a digital potentiometer > - > -It is assumed that the dpot is used as a voltage divider between the > -current dpot wiper setting and the maximum resistance of the dpot. The > -divided voltage is provided by a vref regulator. > - > - .------. > - .-----------. | | > - | vref |--' .---. > - | regulator |--. | | > - '-----------' | | d | > - | | p | > - | | o | wiper > - | | t |<---------+ > - | | | > - | '---' dac output voltage > - | | > - '------+------------+ > - > -Required properties: > -- compatible: Should be "dpot-dac" > -- vref-supply: The regulator supplying the voltage divider. > -- io-channels: Channel node of the dpot to be used for the voltage division. > -- io-channel-names: Should be "dpot". > - > -Example: > - > - &i2c { > - dpot: mcp4651-503@28 { > - compatible = "microchip,mcp4651-503"; > - reg = <0x28>; > - #io-channel-cells = <1>; > - }; > - }; > - > - dac { > - compatible = "dpot-dac"; > - vref-supply = <®_3v3>; > - io-channels = <&dpot 0>; > - io-channel-names = "dpot"; > - }; > diff --git a/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml b/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml > new file mode 100644 > index 000000000000..b4a8073a3a3c > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml > @@ -0,0 +1,67 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/dac/dpot-dac.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: DAC emulation using a digital potentiometer > + > +maintainers: > + - Peter Rosin <peda@axentia.se> Heh, I don't know the first thing about yaml so I will probably need help with that. I still want to know about changes though. Cheers, Peter *snip* ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-12 13:30 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-10-11 16:30 [PATCH 0/2] dt-bindings:iio:consumer yaml bindings Jonathan Cameron 2020-10-11 16:30 ` [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers Jonathan Cameron 2020-10-12 13:30 ` Rob Herring 2020-10-11 16:30 ` [PATCH 2/2] dt-bindings:iio:dac:dpot-dac: yaml conversion Jonathan Cameron 2020-10-11 20:35 ` Peter Rosin
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).