[PATCH v5 03/16] spi: dt-bindings: add trigger-source.yaml

David Lechner posted 16 patches 6 days, 21 hours ago
[PATCH v5 03/16] spi: dt-bindings: add trigger-source.yaml
Posted by David Lechner 6 days, 21 hours ago
Add a new binding for SPI offload trigger sources.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---

v5 changes:
* Add MAINTAINERS entry.

v4 changes: new patch in v4.

FWIW, this is essentially identical to the leds trigger-source binding.
---
 .../devicetree/bindings/spi/trigger-source.yaml    | 28 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 29 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/trigger-source.yaml b/Documentation/devicetree/bindings/spi/trigger-source.yaml
new file mode 100644
index 000000000000..d64367726af2
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/trigger-source.yaml
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/trigger-source.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Trigger source providers for SPI offloads
+
+maintainers:
+  - David Lechner <dlechner@baylibre.com>
+
+description:
+  Each trigger source provider should be represented by a device tree node. It
+  may be e.g. a SPI peripheral chip or a clock source.
+
+properties:
+  '#trigger-source-cells':
+    description:
+      Number of cells in a source trigger. Typically 0 for nodes of simple
+      trigger sources. For nodes with more than one output signal, the first
+      cell be used to specify which output signal to use. If the same signal is
+      available on more than one pin, the second cell can be used to specify
+      which pin to use.
+    enum: [ 0, 1, 2 ]
+
+additionalProperties: true
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 75c8ca9a8584..91a4a7eb6194 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22021,6 +22021,7 @@ F:	include/linux/mtd/spi-nor.h
 
 SPI OFFLOAD
 R:	David Lechner <dlechner@baylibre.com>
+F:	Documentation/devicetree/bindings/spi/trigger-source.yaml
 F:	drivers/spi/spi-offload.c
 F:	include/linux/spi/spi-offload.h
 K:	spi_offload

-- 
2.43.0
Re: [PATCH v5 03/16] spi: dt-bindings: add trigger-source.yaml
Posted by Rob Herring 3 days ago
On Fri, Nov 15, 2024 at 02:18:42PM -0600, David Lechner wrote:
> Add a new binding for SPI offload trigger sources.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
> 
> v5 changes:
> * Add MAINTAINERS entry.
> 
> v4 changes: new patch in v4.
> 
> FWIW, this is essentially identical to the leds trigger-source binding.
> ---
>  .../devicetree/bindings/spi/trigger-source.yaml    | 28 ++++++++++++++++++++++
>  MAINTAINERS                                        |  1 +
>  2 files changed, 29 insertions(+)

This should go into dtschema instead and not be just for SPI.

> 
> diff --git a/Documentation/devicetree/bindings/spi/trigger-source.yaml b/Documentation/devicetree/bindings/spi/trigger-source.yaml
> new file mode 100644
> index 000000000000..d64367726af2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/trigger-source.yaml
> @@ -0,0 +1,28 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/spi/trigger-source.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Trigger source providers for SPI offloads
> +
> +maintainers:
> +  - David Lechner <dlechner@baylibre.com>
> +
> +description:
> +  Each trigger source provider should be represented by a device tree node. It
> +  may be e.g. a SPI peripheral chip or a clock source.

select: true

So the schema is always applied.

> +
> +properties:
> +  '#trigger-source-cells':
> +    description:
> +      Number of cells in a source trigger. Typically 0 for nodes of simple
> +      trigger sources. For nodes with more than one output signal, the first
> +      cell be used to specify which output signal to use. If the same signal is
> +      available on more than one pin, the second cell can be used to specify
> +      which pin to use.
> +    enum: [ 0, 1, 2 ]

Not sure it's worth defining how many cells here since the specific 
providers have to define the exact number of cells and their use.

Add "trigger-sources" here with it's type. See other simple 
provider/consumer schemas which have both properties in one schema.

Then when you use trigger-sources in a specific binding, you just need 
to define the entries like clocks, interrupts, resets, etc.


And eventually any types defined in the kernel can be dropped, but that 
should wait a bit since older dtschema won't have them.

Rob