2022-07-27 18:25:23

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 00/10] dt-bindings: iio: use spi-peripheral-props.yaml

Technically, this depends on [1] merged to SPI tree, if we want to
preserve existing behavior of not allowing SPI CPHA and CPOL in each of
schemas in this patch.

If this patch comes independently via different tree, the SPI CPHA and
CPOL will be allowed for brief period of time, before [1] is merged.
This will not have negative impact, just DT schema checks will be
loosened for that period.

[1] https://lore.kernel.org/all/[email protected]/

Changes since v1
================
1. Continue the rework for entire IIO.
v1: https://lore.kernel.org/all/[email protected]/

Best regards,
Krzysztof

Krzysztof Kozlowski (10):
dt-bindings: iio: adc: use spi-peripheral-props.yaml
dt-bindings: iio: accel: use spi-peripheral-props.yaml
dt-bindings: iio: amplifiers: adi,ada4250: use
spi-peripheral-props.yaml
dt-bindings: iio: dac: use spi-peripheral-props.yaml
dt-bindings: iio: frequency: adf4371: use spi-peripheral-props.yaml
dt-bindings: iio: health: ti,afe4403: use spi-peripheral-props.yaml
dt-bindings: iio: imu: use spi-peripheral-props.yaml
dt-bindings: iio: potentiometer: use spi-peripheral-props.yaml
dt-bindings: iio: samsung,sensorhub-rinato: use
spi-peripheral-props.yaml
dt-bindings: iio: temperature: use spi-peripheral-props.yaml

.../bindings/iio/accel/adi,adis16201.yaml | 7 ++---
.../bindings/iio/accel/adi,adis16240.yaml | 7 ++---
.../bindings/iio/accel/adi,adxl313.yaml | 9 +++----
.../bindings/iio/accel/adi,adxl345.yaml | 7 ++---
.../bindings/iio/accel/adi,adxl355.yaml | 7 ++---
.../bindings/iio/accel/adi,adxl367.yaml | 7 ++---
.../bindings/iio/accel/adi,adxl372.yaml | 7 ++---
.../bindings/iio/accel/bosch,bma220.yaml | 7 ++---
.../bindings/iio/accel/bosch,bma255.yaml | 5 +++-
.../bindings/iio/accel/bosch,bmi088.yaml | 7 ++---
.../bindings/iio/accel/fsl,mma7455.yaml | 7 ++---
.../bindings/iio/accel/kionix,kxsd9.yaml | 7 ++---
.../bindings/iio/accel/murata,sca3300.yaml | 5 +++-
.../bindings/iio/accel/nxp,fxls8962af.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7124.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7192.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7280a.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7292.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7298.yaml | 6 +++--
.../bindings/iio/adc/adi,ad7476.yaml | 8 +++---
.../bindings/iio/adc/adi,ad7606.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7768-1.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7923.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7949.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 | 6 +++--
.../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,adc161s626.yaml | 7 ++---
.../bindings/iio/adc/ti,ads124s08.yaml | 7 ++---
.../bindings/iio/adc/ti,ads131e08.yaml | 7 ++---
.../bindings/iio/adc/ti,ads8344.yaml | 7 ++---
.../bindings/iio/adc/ti,ads8688.yaml | 7 ++---
.../bindings/iio/adc/ti,tlc4541.yaml | 7 ++---
.../bindings/iio/adc/ti,tsc2046.yaml | 7 ++---
.../bindings/iio/amplifiers/adi,ada4250.yaml | 7 ++---
.../bindings/iio/dac/adi,ad5064.yaml | 7 +++--
.../bindings/iio/dac/adi,ad5360.yaml | 7 +++--
.../bindings/iio/dac/adi,ad5380.yaml | 9 ++++---
.../bindings/iio/dac/adi,ad5421.yaml | 7 ++---
.../bindings/iio/dac/adi,ad5449.yaml | 7 +++--
.../bindings/iio/dac/adi,ad5624r.yaml | 9 ++++---
.../bindings/iio/dac/adi,ad5686.yaml | 9 ++++---
.../bindings/iio/dac/adi,ad5755.yaml | 9 ++++---
.../bindings/iio/dac/adi,ad5758.yaml | 4 +--
.../bindings/iio/dac/adi,ad5761.yaml | 7 +++--
.../bindings/iio/dac/adi,ad5764.yaml | 7 +++--
.../bindings/iio/dac/adi,ad5770r.yaml | 7 ++---
.../bindings/iio/dac/adi,ad5791.yaml | 9 ++++---
.../bindings/iio/dac/adi,ad8801.yaml | 7 +++--
.../bindings/iio/dac/microchip,mcp4922.yaml | 9 ++++---
.../bindings/iio/dac/ti,dac082s085.yaml | 9 ++++---
.../bindings/iio/dac/ti,dac7311.yaml | 7 ++---
.../bindings/iio/dac/ti,dac7612.yaml | 7 ++---
.../bindings/iio/frequency/adf4371.yaml | 7 ++---
.../bindings/iio/health/ti,afe4403.yaml | 9 ++++---
.../bindings/iio/imu/adi,adis16460.yaml | 7 ++---
.../bindings/iio/imu/adi,adis16480.yaml | 9 ++++---
.../bindings/iio/imu/bosch,bmi160.yaml | 7 ++---
.../bindings/iio/imu/invensense,icm42600.yaml | 6 +++--
.../bindings/iio/imu/invensense,mpu6050.yaml | 5 ++--
.../bindings/iio/imu/nxp,fxos8700.yaml | 7 ++---
.../bindings/iio/imu/st,lsm6dsx.yaml | 9 ++++---
.../iio/potentiometer/microchip,mcp41010.yaml | 9 ++++---
.../iio/potentiometer/microchip,mcp4131.yaml | 9 ++++---
.../iio/samsung,sensorhub-rinato.yaml | 9 ++++---
.../iio/temperature/maxim,max31855k.yaml | 4 +--
.../iio/temperature/maxim,max31856.yaml | 6 +++--
.../iio/temperature/maxim,max31865.yaml | 6 +++--
78 files changed, 324 insertions(+), 249 deletions(-)

--
2.34.1


2022-07-27 18:25:42

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 08/10] dt-bindings: iio: potentiometer: use spi-peripheral-props.yaml

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 <[email protected]>
---
.../bindings/iio/potentiometer/microchip,mcp41010.yaml | 9 +++++----
.../bindings/iio/potentiometer/microchip,mcp4131.yaml | 9 +++++----
2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp41010.yaml b/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp41010.yaml
index 567697d996ec..87e88f2a9908 100644
--- a/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp41010.yaml
+++ b/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp41010.yaml
@@ -25,14 +25,15 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
-additionalProperties: false
-
required:
- compatible
- reg

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4131.yaml b/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4131.yaml
index 32e92bced81f..896fe0b5edcc 100644
--- a/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4131.yaml
+++ b/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4131.yaml
@@ -80,14 +80,15 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
-additionalProperties: false
-
required:
- compatible
- reg

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
spi {
--
2.34.1

2022-07-27 18:27:13

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 07/10] dt-bindings: iio: imu: use spi-peripheral-props.yaml

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 <[email protected]>
---
.../devicetree/bindings/iio/imu/adi,adis16460.yaml | 7 ++++---
.../devicetree/bindings/iio/imu/adi,adis16480.yaml | 9 +++++----
.../devicetree/bindings/iio/imu/bosch,bmi160.yaml | 7 ++++---
.../devicetree/bindings/iio/imu/invensense,icm42600.yaml | 6 ++++--
.../devicetree/bindings/iio/imu/invensense,mpu6050.yaml | 5 ++---
.../devicetree/bindings/iio/imu/nxp,fxos8700.yaml | 7 ++++---
.../devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 9 +++++----
7 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml
index 340be256f283..d166dbca18c3 100644
--- a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml
@@ -25,8 +25,6 @@ properties:

spi-cpol: true

- spi-max-frequency: true
-
interrupts:
maxItems: 1

@@ -35,7 +33,10 @@ required:
- reg
- interrupts

-additionalProperties: false
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16480.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16480.yaml
index dd29dc6c4c19..56e0dc20f5e4 100644
--- a/Documentation/devicetree/bindings/iio/imu/adi,adis16480.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16480.yaml
@@ -47,8 +47,6 @@ properties:
- DIO3
- DIO4

- spi-max-frequency: true
-
spi-cpha: true
spi-cpol: true

@@ -96,8 +94,6 @@ properties:
- DIO3
- DIO4

-additionalProperties: false
-
required:
- compatible
- reg
@@ -106,6 +102,11 @@ required:
- spi-cpol
- spi-max-frequency

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
diff --git a/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml b/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml
index 6e73cd889b5c..a0760382548d 100644
--- a/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml
@@ -46,13 +46,14 @@ properties:
mount-matrix:
description: an optional 3x3 mounting rotation matrix

- 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/imu/invensense,icm42600.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
index 4c1c083d0e92..488349755c99 100644
--- a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
@@ -47,7 +47,6 @@ properties:
vddio-supply:
description: Regulator that provides power to the bus

- spi-max-frequency: true
spi-cpha: true
spi-cpol: true

@@ -56,7 +55,10 @@ required:
- reg
- interrupts

-additionalProperties: false
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
index 3ebc6526d82d..ec64d7877fe5 100644
--- a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml
@@ -40,8 +40,6 @@ properties:
interrupts:
maxItems: 1

- spi-max-frequency: true
-
vdd-supply: true
vddio-supply: true

@@ -54,6 +52,7 @@ properties:
These devices also support an auxiliary i2c bus via an i2c-gate.

allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
- if:
not:
properties:
@@ -67,7 +66,7 @@ allOf:
properties:
i2c-gate: false

-additionalProperties: false
+unevaluatedProperties: false

required:
- compatible
diff --git a/Documentation/devicetree/bindings/iio/imu/nxp,fxos8700.yaml b/Documentation/devicetree/bindings/iio/imu/nxp,fxos8700.yaml
index 479e7065d4eb..beeaa3c902cd 100644
--- a/Documentation/devicetree/bindings/iio/imu/nxp,fxos8700.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/nxp,fxos8700.yaml
@@ -36,13 +36,14 @@ properties:
drive-open-drain:
type: boolean

- 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/imu/st,lsm6dsx.yaml b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
index 5d4839f00898..0ceb29fb01b7 100644
--- a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
@@ -45,8 +45,6 @@ properties:
description:
Supports up to 2 interrupt lines via the INT1 and INT2 pins.

- spi-max-frequency: true
-
vdd-supply:
description: if defined provides VDD power to the sensor.

@@ -81,12 +79,15 @@ properties:
wakeup-source:
$ref: /schemas/types.yaml#/definitions/flag

-additionalProperties: false
-
required:
- compatible
- reg

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
--
2.34.1

2022-07-27 18:27:26

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 01/10] dt-bindings: iio: adc: use spi-peripheral-props.yaml

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 <[email protected]>
---
.../bindings/iio/adc/adi,ad7124.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7192.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7280a.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7292.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7298.yaml | 6 +++--
.../bindings/iio/adc/adi,ad7476.yaml | 8 +++---
.../bindings/iio/adc/adi,ad7606.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7768-1.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7923.yaml | 7 ++---
.../bindings/iio/adc/adi,ad7949.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 | 6 +++--
.../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,adc161s626.yaml | 7 ++---
.../bindings/iio/adc/ti,ads124s08.yaml | 7 ++---
.../bindings/iio/adc/ti,ads131e08.yaml | 7 ++---
.../bindings/iio/adc/ti,ads8344.yaml | 7 ++---
.../bindings/iio/adc/ti,ads8688.yaml | 7 ++---
.../bindings/iio/adc/ti,tlc4541.yaml | 7 ++---
.../bindings/iio/adc/ti,tsc2046.yaml | 7 ++---
30 files changed, 131 insertions(+), 93 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..cc347dade4ef 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml
@@ -30,8 +30,6 @@ properties:

spi-cpha: true

- spi-max-frequency: true
-
clocks:
maxItems: 1
description: phandle to the master clock (mclk)
@@ -94,7 +92,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..1bfbeed6f299 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml
@@ -30,8 +30,6 @@ properties:

spi-cpha: true

- spi-max-frequency: true
-
'#address-cells':
const: 1

@@ -65,7 +63,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,ad7298.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7298.yaml
index ca414bb396c5..cd8ac5162d27 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7298.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7298.yaml
@@ -24,13 +24,15 @@ properties:

vref-supply: true
vdd-supply: true
- 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/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..7c734b2f7e43 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
@@ -33,8 +33,6 @@ properties:

spi-cpol: true

- spi-max-frequency: true
-
avcc-supply: true

interrupts:
@@ -106,7 +104,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..3ce59d4d065f 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
@@ -50,8 +50,6 @@ properties:
reset-gpios:
maxItems: 1

- spi-max-frequency: true
-
spi-cpol: true

spi-cpha: true
@@ -88,7 +86,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/adi,ad7949.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7949.yaml
index 0b10ed5f74ae..9ee4d977c5ed 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7949.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7949.yaml
@@ -49,8 +49,6 @@ properties:
default: 4096000


- spi-max-frequency: true
-
'#io-channel-cells':
const: 1

@@ -64,7 +62,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/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..18108f0f3731 100644
--- a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3201.yaml
@@ -32,7 +32,6 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
spi-cpha: true
spi-cpol: true

@@ -51,7 +50,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,adc161s626.yaml b/Documentation/devicetree/bindings/iio/adc/ti,adc161s626.yaml
index 3f4f334d6f73..afe782522904 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti,adc161s626.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/ti,adc161s626.yaml
@@ -21,8 +21,6 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vdda-supply: true

"#io-channel-cells":
@@ -32,7 +30,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,ads124s08.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml
index 9f5e96439c01..4a6e54debf10 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/ti,ads124s08.yaml
@@ -18,8 +18,6 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
spi-cpha: true

reset-gpios:
@@ -32,7 +30,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..5882de6fd967 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/ti,ads131e08.yaml
@@ -28,8 +28,6 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
spi-cpha: true

clocks:
@@ -120,7 +118,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/ti,ads8344.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads8344.yaml
index b8c398187d5c..f75b2c702986 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti,ads8344.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/ti,ads8344.yaml
@@ -19,8 +19,6 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vref-supply:
description: Supply the 2.5V or 5V reference voltage

@@ -32,7 +30,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,ads8688.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads8688.yaml
index a0af4b24877f..f26fdbc15f84 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti,ads8688.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/ti,ads8688.yaml
@@ -25,13 +25,14 @@ properties:
description: Optional external reference. If not supplied, assume
REFSEL input tied low to enable the internal reference.

- 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/ti,tlc4541.yaml b/Documentation/devicetree/bindings/iio/adc/ti,tlc4541.yaml
index 6c2539b3d707..314d1d99bf73 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti,tlc4541.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/ti,tlc4541.yaml
@@ -21,8 +21,6 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vref-supply: true

"#io-channel-cells":
@@ -33,7 +31,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,tsc2046.yaml b/Documentation/devicetree/bindings/iio/adc/ti,tsc2046.yaml
index 601d69971d84..0b48814c0dc2 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti,tsc2046.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/ti,tsc2046.yaml
@@ -23,8 +23,6 @@ properties:
interrupts:
maxItems: 1

- spi-max-frequency: true
-
"#io-channel-cells":
const: 1

@@ -59,7 +57,10 @@ patternProperties:

additionalProperties: false

-additionalProperties: false
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false

examples:
- |
--
2.34.1

2022-07-27 18:28:00

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 03/10] dt-bindings: iio: amplifiers: adi,ada4250: use spi-peripheral-props.yaml

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 <[email protected]>
---
.../devicetree/bindings/iio/amplifiers/adi,ada4250.yaml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/amplifiers/adi,ada4250.yaml b/Documentation/devicetree/bindings/iio/amplifiers/adi,ada4250.yaml
index 5277479be382..c15da155d300 100644
--- a/Documentation/devicetree/bindings/iio/amplifiers/adi,ada4250.yaml
+++ b/Documentation/devicetree/bindings/iio/amplifiers/adi,ada4250.yaml
@@ -27,14 +27,15 @@ properties:
Enable internal buffer to drive the reference pin.
type: boolean

- spi-max-frequency: true
-
required:
- compatible
- reg
- avdd-supply

-additionalProperties: false
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false

examples:
- |
--
2.34.1

2022-07-27 18:27:59

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 04/10] dt-bindings: iio: dac: use spi-peripheral-props.yaml

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 <[email protected]>
---
.../devicetree/bindings/iio/dac/adi,ad5064.yaml | 7 +++----
.../devicetree/bindings/iio/dac/adi,ad5360.yaml | 7 +++----
.../devicetree/bindings/iio/dac/adi,ad5380.yaml | 9 +++++----
.../devicetree/bindings/iio/dac/adi,ad5421.yaml | 7 ++++---
.../devicetree/bindings/iio/dac/adi,ad5449.yaml | 7 +++----
.../devicetree/bindings/iio/dac/adi,ad5624r.yaml | 9 +++++----
.../devicetree/bindings/iio/dac/adi,ad5686.yaml | 9 +++++----
.../devicetree/bindings/iio/dac/adi,ad5755.yaml | 9 +++++----
.../devicetree/bindings/iio/dac/adi,ad5758.yaml | 4 ++--
.../devicetree/bindings/iio/dac/adi,ad5761.yaml | 7 +++----
.../devicetree/bindings/iio/dac/adi,ad5764.yaml | 7 +++----
.../devicetree/bindings/iio/dac/adi,ad5770r.yaml | 7 ++++---
.../devicetree/bindings/iio/dac/adi,ad5791.yaml | 9 +++++----
.../devicetree/bindings/iio/dac/adi,ad8801.yaml | 7 +++----
.../devicetree/bindings/iio/dac/microchip,mcp4922.yaml | 9 +++++----
.../devicetree/bindings/iio/dac/ti,dac082s085.yaml | 9 +++++----
.../devicetree/bindings/iio/dac/ti,dac7311.yaml | 7 ++++---
.../devicetree/bindings/iio/dac/ti,dac7612.yaml | 7 ++++---
18 files changed, 71 insertions(+), 66 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5064.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5064.yaml
index 05ed4e0ec364..c04165fa9259 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5064.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5064.yaml
@@ -95,15 +95,12 @@ properties:
vrefD-supply: true
vref-supply: true

- spi-max-frequency: true
-
-additionalProperties: false
-
required:
- compatible
- reg

allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
- # Shared external vref, no internal reference
if:
properties:
@@ -232,6 +229,8 @@ allOf:
- vrefA-supply
- vrefB-supply

+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5360.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5360.yaml
index 65f86f26947c..86e2884cdfb1 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5360.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5360.yaml
@@ -28,10 +28,6 @@ properties:
vref1-supply: true
vref2-supply: true

- spi-max-frequency: true
-
-additionalProperties: false
-
required:
- compatible
- reg
@@ -39,6 +35,7 @@ required:
- vref1-supply

allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
- if:
properties:
compatible:
@@ -63,6 +60,8 @@ allOf:
required:
- vref2-supply

+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5380.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5380.yaml
index d599b418a020..ff50c72c62b5 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5380.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5380.yaml
@@ -39,14 +39,15 @@ properties:
description:
If not supplied devices will use internal regulators.

- spi-max-frequency: true
-
-additionalProperties: false
-
required:
- compatible
- reg

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5421.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5421.yaml
index 188f656617e3..52d089ebde95 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5421.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5421.yaml
@@ -26,13 +26,14 @@ properties:
maxItems: 1
description: Fault signal.

- 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/dac/adi,ad5449.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5449.yaml
index 044332c97743..d2af2d491986 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5449.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5449.yaml
@@ -27,19 +27,16 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
VREF-supply: true
VREFA-supply: true
VREFB-supply: true

-additionalProperties: false
-
required:
- compatible
- reg

allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
- if:
properties:
compatible:
@@ -72,6 +69,8 @@ allOf:
- VREFA-supply
- VREFB-supply

+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5624r.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5624r.yaml
index 330383b85eeb..4d5111a5f9bd 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5624r.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5624r.yaml
@@ -22,17 +22,18 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vref-supply:
description: If not present, internal reference will be used.

-additionalProperties: false
-
required:
- compatible
- reg

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
index 5c26441eae9f..13f214234b8e 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
@@ -53,14 +53,15 @@ properties:
vcc-supply:
description: If not supplied the internal reference is used.

- spi-max-frequency: true
-
-additionalProperties: false
-
required:
- compatible
- reg

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5755.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5755.yaml
index f866b88e1440..9a3c2926bf85 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5755.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5755.yaml
@@ -25,8 +25,6 @@ properties:
description: Either this or spi-cpol but not both.
spi-cpol: true

- spi-max-frequency: true
-
adi,ext-dc-dc-compenstation-resistor:
$ref: /schemas/types.yaml#/definitions/flag
description:
@@ -67,8 +65,6 @@ required:
- compatible
- reg

-additionalProperties: false
-
patternProperties:
"^channel@[0-7]$":
type: object
@@ -123,6 +119,11 @@ oneOf:
- required:
- spi-cpol

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5758.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5758.yaml
index fd4edca34a28..e49e7556175d 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5758.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5758.yaml
@@ -16,7 +16,6 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
spi-cpha: true

adi,dc-dc-mode:
@@ -99,6 +98,7 @@ required:
- adi,dc-dc-mode

allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
- if:
properties:
adi,dc-dc-mode:
@@ -115,7 +115,7 @@ allOf:
required:
- adi,range-microvolt

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5761.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5761.yaml
index 7f95a9ed55fe..df550b5af2f7 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5761.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5761.yaml
@@ -22,18 +22,15 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vref-supply:
description: If not supplied, internal reference will be used.

-additionalProperties: false
-
required:
- compatible
- reg

allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
- if:
properties:
compatible:
@@ -45,6 +42,8 @@ allOf:
required:
- vref-supply

+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5764.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5764.yaml
index 8e893d52bfb1..0b409a727a43 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5764.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5764.yaml
@@ -22,18 +22,15 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vrefAB-supply: true
vrefCD-supply: true

-additionalProperties: false
-
required:
- compatible
- reg

allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
- if:
properties:
compatible:
@@ -46,6 +43,8 @@ allOf:
- vrefAB-supply
- vrefCD-supply

+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
index 24ac40180ac1..ca5432ffdedb 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
@@ -49,8 +49,6 @@ properties:
asserted during driver probe.
maxItems: 1

- spi-max-frequency: true
-
'#address-cells':
const: 1

@@ -138,7 +136,10 @@ required:
- channel@4
- channel@5

-additionalProperties: false
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5791.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5791.yaml
index 650d1ebdcec3..3a84739736f6 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5791.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5791.yaml
@@ -23,19 +23,20 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vdd-supply: true
vss-supply: true

-additionalProperties: false
-
required:
- compatible
- reg
- vdd-supply
- vss-supply

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad8801.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad8801.yaml
index 6a3990a8d0ad..1849a2ff05c7 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad8801.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad8801.yaml
@@ -19,19 +19,16 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vrefh-supply: true
vrefl-supply: true

-additionalProperties: false
-
required:
- compatible
- reg
- vrefh-supply

allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
- if:
properties:
compatible:
@@ -44,6 +41,8 @@ allOf:
properties:
vrefl-supply: false

+unevaluatedProperties: false
+
examples:
- |
spi {
diff --git a/Documentation/devicetree/bindings/iio/dac/microchip,mcp4922.yaml b/Documentation/devicetree/bindings/iio/dac/microchip,mcp4922.yaml
index 4c430abcdbf9..19374401e509 100644
--- a/Documentation/devicetree/bindings/iio/dac/microchip,mcp4922.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/microchip,mcp4922.yaml
@@ -21,17 +21,18 @@ properties:
reg:
maxItems: 1

- spi-max-frequency: true
-
vref-supply: true

-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/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 {
diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac7311.yaml b/Documentation/devicetree/bindings/iio/dac/ti,dac7311.yaml
index 10be98d1f19c..a6814587dbc4 100644
--- a/Documentation/devicetree/bindings/iio/dac/ti,dac7311.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/ti,dac7311.yaml
@@ -24,14 +24,15 @@ properties:
Reference voltage must be supplied to establish the scaling of the
output voltage.

- spi-max-frequency: true
-
required:
- compatible
- reg
- vref-supply

-additionalProperties: false
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac7612.yaml b/Documentation/devicetree/bindings/iio/dac/ti,dac7612.yaml
index d172b142f6ed..20dd1370660d 100644
--- a/Documentation/devicetree/bindings/iio/dac/ti,dac7612.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/ti,dac7612.yaml
@@ -29,13 +29,14 @@ properties:
DACs are loaded when the pin connected to this GPIO is pulled low.
maxItems: 1

- spi-max-frequency: true
-
required:
- compatible
- reg

-additionalProperties: false
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false

examples:
- |
--
2.34.1

2022-07-27 18:32:01

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 09/10] dt-bindings: iio: samsung,sensorhub-rinato: use spi-peripheral-props.yaml

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 <[email protected]>
---
.../bindings/iio/samsung,sensorhub-rinato.yaml | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/samsung,sensorhub-rinato.yaml b/Documentation/devicetree/bindings/iio/samsung,sensorhub-rinato.yaml
index a88b3b14d6bd..dd2ae2bd1ad7 100644
--- a/Documentation/devicetree/bindings/iio/samsung,sensorhub-rinato.yaml
+++ b/Documentation/devicetree/bindings/iio/samsung,sensorhub-rinato.yaml
@@ -40,10 +40,6 @@ properties:
description:
Reset the sensorhub.

- spi-max-frequency: true
-
-additionalProperties: false
-
required:
- compatible
- reg
@@ -52,6 +48,11 @@ required:
- mcu-ap-gpios
- mcu-reset-gpios

+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
examples:
- |
spi {
--
2.34.1

2022-07-30 22:47:36

by Lukas Wunner

[permalink] [raw]
Subject: Re: [PATCH v2 04/10] dt-bindings: iio: dac: use spi-peripheral-props.yaml

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

2022-07-30 23:21:38

by Lukas Wunner

[permalink] [raw]
Subject: Re: [PATCH v2 00/10] dt-bindings: iio: use spi-peripheral-props.yaml

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

2022-08-01 15:47:15

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 00/10] dt-bindings: iio: use spi-peripheral-props.yaml

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

2022-08-01 16:58:21

by Lukas Wunner

[permalink] [raw]
Subject: Re: [PATCH v2 00/10] dt-bindings: iio: use spi-peripheral-props.yaml

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

2022-08-02 08:16:41

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 00/10] dt-bindings: iio: use spi-peripheral-props.yaml

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

2022-08-03 21:59:47

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v2 00/10] dt-bindings: iio: use spi-peripheral-props.yaml

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