Message ID | 20220715095302.214276-1-krzysztof.kozlowski@linaro.org (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | [RFC] dt-bindings: iio: adc: use spi-peripheral-props.yaml | expand |
On Fri, 15 Jul 2022 11:53:02 +0200 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > Instead of listing directly properties typical for SPI peripherals, > reference the spi-peripheral-props.yaml schema. This allows using all > properties typical for SPI-connected devices, even these which device > bindings author did not tried yet. > > Remove the spi-* properties which now come via spi-peripheral-props.yaml > schema, except for the cases when device schema adds some constraints > like maximum frequency. > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > > --- > > This is an RFC with only some files changed, as I am still not sure of > benefits for typical case - device node has just spi-max-frequency and > nothing more. I still find useful to reference the schema, but maybe I > am missing something? > > Before doing wide-tree cleanup like this, I would be happy to receive > some feedback whether this makes sense. Hi Krzysztof, This has the side effect of allowing spi-cpol / spi-cpha for devices where they weren't previously allowed by the binding. A typical device only supports a subset of combinations of those. I'm not clear whether these should always be allowed (e.g. allow for inverters etc in the path) or whether we should be enforcing the "correct" settings for devices assuming they are directly connected. Currently we have a bunch of bindings that are documenting the allowed flexibility - including cases where only particular combinations of these settings are allowed. So we could either: 1) Note that we've been doing it wrong and the binding should not enforce these constraints so remove them. 2) Add explicit spi-cpol: false statements etc the drivers where they are not allowed. Jonathan > --- > .../bindings/iio/adc/adi,ad7124.yaml | 7 ++--- > .../bindings/iio/adc/adi,ad7192.yaml | 11 +++----- > .../bindings/iio/adc/adi,ad7280a.yaml | 7 ++--- > .../bindings/iio/adc/adi,ad7292.yaml | 9 +++---- > .../bindings/iio/adc/adi,ad7476.yaml | 8 +++--- > .../bindings/iio/adc/adi,ad7606.yaml | 11 +++----- > .../bindings/iio/adc/adi,ad7768-1.yaml | 11 +++----- > .../bindings/iio/adc/adi,ad7923.yaml | 7 ++--- > .../bindings/iio/adc/holt,hi8435.yaml | 7 ++--- > .../bindings/iio/adc/lltc,ltc2496.yaml | 8 +++--- > .../bindings/iio/adc/maxim,max1027.yaml | 5 +++- > .../bindings/iio/adc/maxim,max11100.yaml | 7 +++-- > .../bindings/iio/adc/maxim,max1118.yaml | 26 ++++++++++--------- > .../bindings/iio/adc/maxim,max1241.yaml | 7 ++--- > .../bindings/iio/adc/microchip,mcp3201.yaml | 9 +++---- > .../bindings/iio/adc/microchip,mcp3911.yaml | 5 +++- > .../bindings/iio/adc/ti,adc0832.yaml | 7 ++--- > .../bindings/iio/adc/ti,adc084s021.yaml | 7 ++--- > .../bindings/iio/adc/ti,adc108s102.yaml | 6 +++-- > .../bindings/iio/adc/ti,adc12138.yaml | 7 ++--- > .../bindings/iio/adc/ti,adc128s052.yaml | 7 ++--- > .../bindings/iio/adc/ti,ads124s08.yaml | 9 +++---- > .../bindings/iio/adc/ti,ads131e08.yaml | 9 +++---- > 23 files changed, 103 insertions(+), 94 deletions(-) > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml > index fb3d0dae9bae..75a7184a4735 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml > @@ -52,8 +52,6 @@ properties: > avdd-supply: > description: avdd supply can be used as reference for conversion. > > - spi-max-frequency: true > - > required: > - compatible > - reg > @@ -106,7 +104,10 @@ patternProperties: > > additionalProperties: false > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml > index 22b7ed3723f6..195c7e6e5206 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml > @@ -26,12 +26,6 @@ properties: > reg: > maxItems: 1 > > - spi-cpol: true > - > - spi-cpha: true > - > - spi-max-frequency: true > - > clocks: > maxItems: 1 > description: phandle to the master clock (mclk) > @@ -94,7 +88,10 @@ required: > - spi-cpol > - spi-cpha > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7280a.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7280a.yaml > index a694d5794d4a..dfb8f305e2f0 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7280a.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7280a.yaml > @@ -28,8 +28,6 @@ properties: > description: IRQ line for the ADC > maxItems: 1 > > - spi-max-frequency: true > - > adi,voltage-alert-last-chan: > $ref: /schemas/types.yaml#/definitions/uint32 > description: > @@ -55,7 +53,10 @@ required: > - compatible > - reg > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml > index a3e39a40c9b3..8ebeb06675bb 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml > @@ -28,10 +28,6 @@ properties: > description: | > The regulator supply for ADC and DAC reference voltage. > > - spi-cpha: true > - > - spi-max-frequency: true > - > '#address-cells': > const: 1 > > @@ -65,7 +61,10 @@ patternProperties: > > additionalProperties: true > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml > index 666414a9c0de..44c671eeda73 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml > @@ -66,8 +66,6 @@ properties: > to the other supplies. Needed to be able to establish channel scaling > unless there is also an internal reference available (e.g. ad7091r) > > - spi-max-frequency: true > - > adi,conversion-start-gpios: > description: A GPIO used to trigger the start of a conversion > maxItems: 1 > @@ -76,9 +74,9 @@ required: > - compatible > - reg > > -additionalProperties: false > - > allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > # Devices where reference is vcc > - if: > properties: > @@ -158,6 +156,8 @@ allOf: > properties: > adi,conversion-start-gpios: false > > +unevaluatedProperties: false > + > examples: > - | > spi { > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml > index 73775174cf57..f76eaa4ca154 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml > @@ -29,12 +29,6 @@ properties: > reg: > maxItems: 1 > > - spi-cpha: true > - > - spi-cpol: true > - > - spi-max-frequency: true > - > avcc-supply: true > > interrupts: > @@ -106,7 +100,10 @@ required: > - interrupts > - adi,conversion-start-gpios > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml > index a85a28145ef6..117c4eb28f4e 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml > @@ -50,12 +50,6 @@ properties: > reset-gpios: > maxItems: 1 > > - spi-max-frequency: true > - > - spi-cpol: true > - > - spi-cpha: true > - > "#io-channel-cells": > const: 1 > > @@ -88,7 +82,10 @@ patternProperties: > - reg > additionalProperties: false > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7923.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7923.yaml > index e82194974eea..24a810c23197 100644 > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7923.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7923.yaml > @@ -43,13 +43,14 @@ properties: > '#size-cells': > const: 0 > > - spi-max-frequency: true > - > required: > - compatible > - reg > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml b/Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml > index 52490cbb0af0..56bcbe5dcd79 100644 > --- a/Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml > @@ -24,8 +24,6 @@ properties: > GPIO used for controlling the reset pin > maxItems: 1 > > - spi-max-frequency: true > - > "#io-channel-cells": > const: 1 > > @@ -33,7 +31,10 @@ required: > - compatible > - reg > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml > index 0bd2fc0356c8..5207c919abe0 100644 > --- a/Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml > @@ -22,15 +22,15 @@ properties: > reg: > maxItems: 1 > > - spi-max-frequency: > - description: maximal spi bus frequency supported > - > required: > - compatible > - vref-supply > - reg > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml > index 46b7747076b9..d0a7ed26d9ea 100644 > --- a/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml > @@ -45,7 +45,10 @@ required: > - compatible > - reg > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max11100.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max11100.yaml > index 0cf87556ef82..4f74cb33383a 100644 > --- a/Documentation/devicetree/bindings/iio/adc/maxim,max11100.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max11100.yaml > @@ -26,13 +26,16 @@ properties: > minimum: 100000 > maximum: 4800000 > > -additionalProperties: false > - > required: > - compatible > - reg > - vref-supply > > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > + > examples: > - | > spi { > diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1118.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1118.yaml > index e948b3e37b0c..bb336e33ebe2 100644 > --- a/Documentation/devicetree/bindings/iio/adc/maxim,max1118.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1118.yaml > @@ -28,23 +28,25 @@ properties: > vref-supply: > description: External reference, needed to establish input scaling > > -if: > - properties: > - compatible: > - contains: > - const: maxim,max1118 > -then: > - required: > - - vref-supply > -else: > - properties: > - vref-supply: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + - if: > + properties: > + compatible: > + contains: > + const: maxim,max1118 > + then: > + required: > + - vref-supply > + else: > + properties: > + vref-supply: false > > required: > - compatible > - reg > > -additionalProperties: false > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml > index 4c7e0d94bff1..58b12fe8070c 100644 > --- a/Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml > @@ -39,15 +39,16 @@ properties: > thus enabling power-down mode. > maxItems: 1 > > - spi-max-frequency: true > - > required: > - compatible > - reg > - vdd-supply > - vref-supply > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml > index fcc1ba53b20d..dc7a8a50495d 100644 > --- a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml > @@ -32,10 +32,6 @@ properties: > reg: > maxItems: 1 > > - spi-max-frequency: true > - spi-cpha: true > - spi-cpol: true > - > vref-supply: > description: External reference. > > @@ -51,7 +47,10 @@ required: > - reg > - vref-supply > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml > index 95ab285f4eba..067a7bbadab8 100644 > --- a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml > @@ -51,7 +51,10 @@ required: > - compatible > - reg > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc0832.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc0832.yaml > index f5a923cc847f..686721176a58 100644 > --- a/Documentation/devicetree/bindings/iio/adc/ti,adc0832.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc0832.yaml > @@ -24,8 +24,6 @@ properties: > reg: > maxItems: 1 > > - spi-max-frequency: true > - > vref-supply: > description: External reference, needed to establish input scaling > > @@ -37,7 +35,10 @@ required: > - reg > - vref-supply > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc084s021.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc084s021.yaml > index 1a113b30a414..726d2cbfa368 100644 > --- a/Documentation/devicetree/bindings/iio/adc/ti,adc084s021.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc084s021.yaml > @@ -19,8 +19,6 @@ properties: > reg: > maxItems: 1 > > - spi-max-frequency: true > - > vref-supply: > description: External reference, needed to establish input scaling > > @@ -37,7 +35,10 @@ required: > - spi-cpol > - spi-cpha > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc108s102.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc108s102.yaml > index 54955f03df93..1a589ad1659f 100644 > --- a/Documentation/devicetree/bindings/iio/adc/ti,adc108s102.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc108s102.yaml > @@ -19,7 +19,6 @@ properties: > > reg: true > vref-supply: true > - spi-max-frequency: true > "#io-channel-cells": > const: 1 > > @@ -28,7 +27,10 @@ required: > - reg > - vref-supply > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc12138.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc12138.yaml > index ec3b2edf1fb7..076088a328c3 100644 > --- a/Documentation/devicetree/bindings/iio/adc/ti,adc12138.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc12138.yaml > @@ -31,8 +31,6 @@ properties: > maxItems: 1 > description: Conversion clock input. > > - spi-max-frequency: true > - > vref-p-supply: > description: The regulator supply for positive analog voltage reference > > @@ -62,7 +60,10 @@ required: > - clocks > - vref-p-supply > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc128s052.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc128s052.yaml > index d54a0183f024..775eee972b12 100644 > --- a/Documentation/devicetree/bindings/iio/adc/ti,adc128s052.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc128s052.yaml > @@ -27,8 +27,6 @@ properties: > reg: > maxItems: 1 > > - spi-max-frequency: true > - > vref-supply: true > > "#io-channel-cells": > @@ -39,7 +37,10 @@ required: > - reg > - vref-supply > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml > index 9f5e96439c01..efdc8701a2e5 100644 > --- a/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml > @@ -18,10 +18,6 @@ properties: > reg: > maxItems: 1 > > - spi-max-frequency: true > - > - spi-cpha: true > - > reset-gpios: > maxItems: 1 > > @@ -32,7 +28,10 @@ required: > - compatible > - reg > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - | > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml > index e0670e3fbb72..b8608f58bbca 100644 > --- a/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml > +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml > @@ -28,10 +28,6 @@ properties: > reg: > maxItems: 1 > > - spi-max-frequency: true > - > - spi-cpha: true > - > clocks: > description: | > Device tree identifier to the clock source (2.048 MHz). > @@ -120,7 +116,10 @@ patternProperties: > > additionalProperties: false > > -additionalProperties: false > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > > examples: > - |
On Sat, Jul 16, 2022 at 07:26:04PM +0100, Jonathan Cameron wrote: > On Fri, 15 Jul 2022 11:53:02 +0200 > Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > > Instead of listing directly properties typical for SPI peripherals, > > reference the spi-peripheral-props.yaml schema. This allows using all > > properties typical for SPI-connected devices, even these which device > > bindings author did not tried yet. > > > > Remove the spi-* properties which now come via spi-peripheral-props.yaml > > schema, except for the cases when device schema adds some constraints > > like maximum frequency. > > > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > > > > --- > > > > This is an RFC with only some files changed, as I am still not sure of > > benefits for typical case - device node has just spi-max-frequency and > > nothing more. I still find useful to reference the schema, but maybe I > > am missing something? > > > > Before doing wide-tree cleanup like this, I would be happy to receive > > some feedback whether this makes sense. > > Hi Krzysztof, > > This has the side effect of allowing spi-cpol / spi-cpha for devices > where they weren't previously allowed by the binding. A typical device > only supports a subset of combinations of those. > > I'm not clear whether these should always be allowed (e.g. allow for inverters > etc in the path) or whether we should be enforcing the "correct" > settings for devices assuming they are directly connected. > > Currently we have a bunch of bindings that are documenting the allowed > flexibility - including cases where only particular combinations of these > settings are allowed. > > So we could either: > 1) Note that we've been doing it wrong and the binding should not enforce > these constraints so remove them. I'd lean towards this. > 2) Add explicit spi-cpol: false statements etc the drivers where they > are not allowed. 3) Drop spi-cpol / spi-cpha from spi-peripheral-props.yaml. It's purpose is to collect all possible SPI controller properties that are per child node. Whereas we've said spi-cpol / spi-cpha are device specific properties. Rob
On 19/07/2022 00:00, Rob Herring wrote: > On Sat, Jul 16, 2022 at 07:26:04PM +0100, Jonathan Cameron wrote: >> On Fri, 15 Jul 2022 11:53:02 +0200 >> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: >> >>> Instead of listing directly properties typical for SPI peripherals, >>> reference the spi-peripheral-props.yaml schema. This allows using all >>> properties typical for SPI-connected devices, even these which device >>> bindings author did not tried yet. >>> >>> Remove the spi-* properties which now come via spi-peripheral-props.yaml >>> schema, except for the cases when device schema adds some constraints >>> like maximum frequency. >>> >>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> >>> >>> --- >>> >>> This is an RFC with only some files changed, as I am still not sure of >>> benefits for typical case - device node has just spi-max-frequency and >>> nothing more. I still find useful to reference the schema, but maybe I >>> am missing something? >>> >>> Before doing wide-tree cleanup like this, I would be happy to receive >>> some feedback whether this makes sense. >> >> Hi Krzysztof, >> >> This has the side effect of allowing spi-cpol / spi-cpha for devices >> where they weren't previously allowed by the binding. A typical device >> only supports a subset of combinations of those. >> >> I'm not clear whether these should always be allowed (e.g. allow for inverters >> etc in the path) or whether we should be enforcing the "correct" >> settings for devices assuming they are directly connected. >> >> Currently we have a bunch of bindings that are documenting the allowed >> flexibility - including cases where only particular combinations of these >> settings are allowed. >> >> So we could either: >> 1) Note that we've been doing it wrong and the binding should not enforce >> these constraints so remove them. > > I'd lean towards this. > >> 2) Add explicit spi-cpol: false statements etc the drivers where they >> are not allowed. > > 3) Drop spi-cpol / spi-cpha from spi-peripheral-props.yaml. It's purpose > is to collect all possible SPI controller properties that are per child > node. Whereas we've said spi-cpol / spi-cpha are device specific > properties. Thanks Rob and Jonathan. I can go with (3). Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml index fb3d0dae9bae..75a7184a4735 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml @@ -52,8 +52,6 @@ properties: avdd-supply: description: avdd supply can be used as reference for conversion. - spi-max-frequency: true - required: - compatible - reg @@ -106,7 +104,10 @@ patternProperties: additionalProperties: false -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml index 22b7ed3723f6..195c7e6e5206 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml @@ -26,12 +26,6 @@ properties: reg: maxItems: 1 - spi-cpol: true - - spi-cpha: true - - spi-max-frequency: true - clocks: maxItems: 1 description: phandle to the master clock (mclk) @@ -94,7 +88,10 @@ required: - spi-cpol - spi-cpha -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7280a.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7280a.yaml index a694d5794d4a..dfb8f305e2f0 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7280a.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7280a.yaml @@ -28,8 +28,6 @@ properties: description: IRQ line for the ADC maxItems: 1 - spi-max-frequency: true - adi,voltage-alert-last-chan: $ref: /schemas/types.yaml#/definitions/uint32 description: @@ -55,7 +53,10 @@ required: - compatible - reg -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml index a3e39a40c9b3..8ebeb06675bb 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml @@ -28,10 +28,6 @@ properties: description: | The regulator supply for ADC and DAC reference voltage. - spi-cpha: true - - spi-max-frequency: true - '#address-cells': const: 1 @@ -65,7 +61,10 @@ patternProperties: additionalProperties: true -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml index 666414a9c0de..44c671eeda73 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml @@ -66,8 +66,6 @@ properties: to the other supplies. Needed to be able to establish channel scaling unless there is also an internal reference available (e.g. ad7091r) - spi-max-frequency: true - adi,conversion-start-gpios: description: A GPIO used to trigger the start of a conversion maxItems: 1 @@ -76,9 +74,9 @@ required: - compatible - reg -additionalProperties: false - allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + # Devices where reference is vcc - if: properties: @@ -158,6 +156,8 @@ allOf: properties: adi,conversion-start-gpios: false +unevaluatedProperties: false + examples: - | spi { diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml index 73775174cf57..f76eaa4ca154 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml @@ -29,12 +29,6 @@ properties: reg: maxItems: 1 - spi-cpha: true - - spi-cpol: true - - spi-max-frequency: true - avcc-supply: true interrupts: @@ -106,7 +100,10 @@ required: - interrupts - adi,conversion-start-gpios -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml index a85a28145ef6..117c4eb28f4e 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml @@ -50,12 +50,6 @@ properties: reset-gpios: maxItems: 1 - spi-max-frequency: true - - spi-cpol: true - - spi-cpha: true - "#io-channel-cells": const: 1 @@ -88,7 +82,10 @@ patternProperties: - reg additionalProperties: false -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7923.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7923.yaml index e82194974eea..24a810c23197 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7923.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7923.yaml @@ -43,13 +43,14 @@ properties: '#size-cells': const: 0 - spi-max-frequency: true - required: - compatible - reg -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml b/Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml index 52490cbb0af0..56bcbe5dcd79 100644 --- a/Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml +++ b/Documentation/devicetree/bindings/iio/adc/holt,hi8435.yaml @@ -24,8 +24,6 @@ properties: GPIO used for controlling the reset pin maxItems: 1 - spi-max-frequency: true - "#io-channel-cells": const: 1 @@ -33,7 +31,10 @@ required: - compatible - reg -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml index 0bd2fc0356c8..5207c919abe0 100644 --- a/Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml +++ b/Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml @@ -22,15 +22,15 @@ properties: reg: maxItems: 1 - spi-max-frequency: - description: maximal spi bus frequency supported - required: - compatible - vref-supply - reg -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml index 46b7747076b9..d0a7ed26d9ea 100644 --- a/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml @@ -45,7 +45,10 @@ required: - compatible - reg -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max11100.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max11100.yaml index 0cf87556ef82..4f74cb33383a 100644 --- a/Documentation/devicetree/bindings/iio/adc/maxim,max11100.yaml +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max11100.yaml @@ -26,13 +26,16 @@ properties: minimum: 100000 maximum: 4800000 -additionalProperties: false - required: - compatible - reg - vref-supply +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false + examples: - | spi { diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1118.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1118.yaml index e948b3e37b0c..bb336e33ebe2 100644 --- a/Documentation/devicetree/bindings/iio/adc/maxim,max1118.yaml +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1118.yaml @@ -28,23 +28,25 @@ properties: vref-supply: description: External reference, needed to establish input scaling -if: - properties: - compatible: - contains: - const: maxim,max1118 -then: - required: - - vref-supply -else: - properties: - vref-supply: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + - if: + properties: + compatible: + contains: + const: maxim,max1118 + then: + required: + - vref-supply + else: + properties: + vref-supply: false required: - compatible - reg -additionalProperties: false +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml index 4c7e0d94bff1..58b12fe8070c 100644 --- a/Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1241.yaml @@ -39,15 +39,16 @@ properties: thus enabling power-down mode. maxItems: 1 - spi-max-frequency: true - required: - compatible - reg - vdd-supply - vref-supply -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml index fcc1ba53b20d..dc7a8a50495d 100644 --- a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml +++ b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml @@ -32,10 +32,6 @@ properties: reg: maxItems: 1 - spi-max-frequency: true - spi-cpha: true - spi-cpol: true - vref-supply: description: External reference. @@ -51,7 +47,10 @@ required: - reg - vref-supply -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml index 95ab285f4eba..067a7bbadab8 100644 --- a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml +++ b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml @@ -51,7 +51,10 @@ required: - compatible - reg -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc0832.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc0832.yaml index f5a923cc847f..686721176a58 100644 --- a/Documentation/devicetree/bindings/iio/adc/ti,adc0832.yaml +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc0832.yaml @@ -24,8 +24,6 @@ properties: reg: maxItems: 1 - spi-max-frequency: true - vref-supply: description: External reference, needed to establish input scaling @@ -37,7 +35,10 @@ required: - reg - vref-supply -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc084s021.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc084s021.yaml index 1a113b30a414..726d2cbfa368 100644 --- a/Documentation/devicetree/bindings/iio/adc/ti,adc084s021.yaml +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc084s021.yaml @@ -19,8 +19,6 @@ properties: reg: maxItems: 1 - spi-max-frequency: true - vref-supply: description: External reference, needed to establish input scaling @@ -37,7 +35,10 @@ required: - spi-cpol - spi-cpha -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc108s102.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc108s102.yaml index 54955f03df93..1a589ad1659f 100644 --- a/Documentation/devicetree/bindings/iio/adc/ti,adc108s102.yaml +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc108s102.yaml @@ -19,7 +19,6 @@ properties: reg: true vref-supply: true - spi-max-frequency: true "#io-channel-cells": const: 1 @@ -28,7 +27,10 @@ required: - reg - vref-supply -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc12138.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc12138.yaml index ec3b2edf1fb7..076088a328c3 100644 --- a/Documentation/devicetree/bindings/iio/adc/ti,adc12138.yaml +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc12138.yaml @@ -31,8 +31,6 @@ properties: maxItems: 1 description: Conversion clock input. - spi-max-frequency: true - vref-p-supply: description: The regulator supply for positive analog voltage reference @@ -62,7 +60,10 @@ required: - clocks - vref-p-supply -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/ti,adc128s052.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc128s052.yaml index d54a0183f024..775eee972b12 100644 --- a/Documentation/devicetree/bindings/iio/adc/ti,adc128s052.yaml +++ b/Documentation/devicetree/bindings/iio/adc/ti,adc128s052.yaml @@ -27,8 +27,6 @@ properties: reg: maxItems: 1 - spi-max-frequency: true - vref-supply: true "#io-channel-cells": @@ -39,7 +37,10 @@ required: - reg - vref-supply -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml index 9f5e96439c01..efdc8701a2e5 100644 --- a/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml @@ -18,10 +18,6 @@ properties: reg: maxItems: 1 - spi-max-frequency: true - - spi-cpha: true - reset-gpios: maxItems: 1 @@ -32,7 +28,10 @@ required: - compatible - reg -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - | diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml index e0670e3fbb72..b8608f58bbca 100644 --- a/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml @@ -28,10 +28,6 @@ properties: reg: maxItems: 1 - spi-max-frequency: true - - spi-cpha: true - clocks: description: | Device tree identifier to the clock source (2.048 MHz). @@ -120,7 +116,10 @@ patternProperties: additionalProperties: false -additionalProperties: false +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false examples: - |
Instead of listing directly properties typical for SPI peripherals, reference the spi-peripheral-props.yaml schema. This allows using all properties typical for SPI-connected devices, even these which device bindings author did not tried yet. Remove the spi-* properties which now come via spi-peripheral-props.yaml schema, except for the cases when device schema adds some constraints like maximum frequency. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> --- This is an RFC with only some files changed, as I am still not sure of benefits for typical case - device node has just spi-max-frequency and nothing more. I still find useful to reference the schema, but maybe I am missing something? Before doing wide-tree cleanup like this, I would be happy to receive some feedback whether this makes sense. --- .../bindings/iio/adc/adi,ad7124.yaml | 7 ++--- .../bindings/iio/adc/adi,ad7192.yaml | 11 +++----- .../bindings/iio/adc/adi,ad7280a.yaml | 7 ++--- .../bindings/iio/adc/adi,ad7292.yaml | 9 +++---- .../bindings/iio/adc/adi,ad7476.yaml | 8 +++--- .../bindings/iio/adc/adi,ad7606.yaml | 11 +++----- .../bindings/iio/adc/adi,ad7768-1.yaml | 11 +++----- .../bindings/iio/adc/adi,ad7923.yaml | 7 ++--- .../bindings/iio/adc/holt,hi8435.yaml | 7 ++--- .../bindings/iio/adc/lltc,ltc2496.yaml | 8 +++--- .../bindings/iio/adc/maxim,max1027.yaml | 5 +++- .../bindings/iio/adc/maxim,max11100.yaml | 7 +++-- .../bindings/iio/adc/maxim,max1118.yaml | 26 ++++++++++--------- .../bindings/iio/adc/maxim,max1241.yaml | 7 ++--- .../bindings/iio/adc/microchip,mcp3201.yaml | 9 +++---- .../bindings/iio/adc/microchip,mcp3911.yaml | 5 +++- .../bindings/iio/adc/ti,adc0832.yaml | 7 ++--- .../bindings/iio/adc/ti,adc084s021.yaml | 7 ++--- .../bindings/iio/adc/ti,adc108s102.yaml | 6 +++-- .../bindings/iio/adc/ti,adc12138.yaml | 7 ++--- .../bindings/iio/adc/ti,adc128s052.yaml | 7 ++--- .../bindings/iio/adc/ti,ads124s08.yaml | 9 +++---- .../bindings/iio/adc/ti,ads131e08.yaml | 9 +++---- 23 files changed, 103 insertions(+), 94 deletions(-)