Message ID | 20220727164646.387541-1-krzysztof.kozlowski@linaro.org |
---|---|
Headers | show |
Series | dt-bindings: iio: use spi-peripheral-props.yaml | expand |
On Wed, Jul 27, 2022 at 06:46:37PM +0200, Krzysztof Kozlowski 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. > > While changing additionalProperties->unevaluatedProperties, put it in > typical place, just before example DTS. > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> > --- [...] > .../bindings/iio/adc/microchip,mcp3911.yaml | 5 +++- FWIW: Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
On Wed, Jul 27, 2022 at 06:46:40PM +0200, Krzysztof Kozlowski wrote: > diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml > index b0157050f1ee..201b04af2b22 100644 > --- a/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml > +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml > @@ -33,21 +33,22 @@ properties: > vref-supply: > description: Needed to provide output scaling. > > - spi-max-frequency: true > - > required: > - compatible > - reg > - vref-supply > > -additionalProperties: false > - > oneOf: > - required: > - spi-cpha > - required: > - spi-cpol > > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > + > examples: > - | > vref_2v5_reg: regulator-vref { Just to double-check because I'm unsure how the allOf interacts with the oneOf above: The DT must specify either spi-cpha or spi-cpol for this device, but not both. Hopefully that's still enforced after your change? Thanks, Lukas
On Wed, Jul 27, 2022 at 06:46:36PM +0200, Krzysztof Kozlowski wrote:
> 78 files changed, 324 insertions(+), 249 deletions(-)
Pardon me for being dense, but what is the benefit of this series
that justifies inflating the schema definitions by a total of 75 lines?
Thanks,
Lukas
On 31/07/2022 00:46, Lukas Wunner wrote: > On Wed, Jul 27, 2022 at 06:46:36PM +0200, Krzysztof Kozlowski wrote: >> 78 files changed, 324 insertions(+), 249 deletions(-) > > Pardon me for being dense, but what is the benefit of this series > that justifies inflating the schema definitions by a total of 75 lines? The commits were explaining rationale, so let me bring it here. The benefits are: This allows using all properties typical for SPI-connected devices, even these which device bindings author did not tried yet. Also, what I did not mention in commit msg, this makes sure, that spi-xxx properties have a type, which is validated by spi-peripheral-props.yaml. Otherwise, when someone puts bogus data as spi-max-frequency (e.g. phandle) and checks only with that device schema, no errors are reported. Best regards, Krzysztof
On Mon, Aug 01, 2022 at 05:45:07PM +0200, Krzysztof Kozlowski wrote: > On 31/07/2022 00:46, Lukas Wunner wrote: > > On Wed, Jul 27, 2022 at 06:46:36PM +0200, Krzysztof Kozlowski wrote: > >> 78 files changed, 324 insertions(+), 249 deletions(-) > > > > Pardon me for being dense, but what is the benefit of this series > > that justifies inflating the schema definitions by a total of 75 lines? > > The commits were explaining rationale, so let me bring it here. The > benefits are: > This allows using all properties typical for SPI-connected devices, even > these which device bindings author did not tried yet. How do you know these untested properties work with the devices to which you're adding them? Thanks, Lukas
On 01/08/2022 18:04, Lukas Wunner wrote: > On Mon, Aug 01, 2022 at 05:45:07PM +0200, Krzysztof Kozlowski wrote: >> On 31/07/2022 00:46, Lukas Wunner wrote: >>> On Wed, Jul 27, 2022 at 06:46:36PM +0200, Krzysztof Kozlowski wrote: >>>> 78 files changed, 324 insertions(+), 249 deletions(-) >>> >>> Pardon me for being dense, but what is the benefit of this series >>> that justifies inflating the schema definitions by a total of 75 lines? >> >> The commits were explaining rationale, so let me bring it here. The >> benefits are: >> This allows using all properties typical for SPI-connected devices, even >> these which device bindings author did not tried yet. > > How do you know these untested properties work with the devices to which > you're adding them? These properties should be device independent and instead controller-dependent. At least some of them (that's why CPHA/CPOL was moved away and maybe the same we need to do with spi-3wire, spi-cs-high, spi-lsb-first). My approach here is no different than other subsystems. Take a look at regulator - we allow all regulator.yaml properties, even though several are not applicable (e.g. current for voltage regulators) and for sure no tested. Best regards, Krzysztof
On Mon, Aug 01, 2022 at 06:04:10PM +0200, Lukas Wunner wrote: > On Mon, Aug 01, 2022 at 05:45:07PM +0200, Krzysztof Kozlowski wrote: > > On 31/07/2022 00:46, Lukas Wunner wrote: > > > On Wed, Jul 27, 2022 at 06:46:36PM +0200, Krzysztof Kozlowski wrote: > > >> 78 files changed, 324 insertions(+), 249 deletions(-) > > > > > > Pardon me for being dense, but what is the benefit of this series > > > that justifies inflating the schema definitions by a total of 75 lines? > > > > The commits were explaining rationale, so let me bring it here. The > > benefits are: > > This allows using all properties typical for SPI-connected devices, even > > these which device bindings author did not tried yet. > > How do you know these untested properties work with the devices to which > you're adding them? How do we know anything DT works? We don't without testing on h/w. That's not what the schemas provide. The spi-peripheral-props.yaml reference is needed in order to allow controller specific timing properties and to prevent random other undocumented properties from being present. There is not another way to do both of those. Do I wish we didn't have these controller specific timing parameters, yes! But that ship has sailed. Rob