diff mbox series

[v2,09/14] ASoC: audio-graph-card2: add Yaml Document

Message ID 87wnplvk2a.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series [v2,01/14] ASoC: test-component: add Test Component YAML bindings | expand

Commit Message

Kuninori Morimoto July 20, 2021, 1:41 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch adds Audio Graph Card2 Yaml bindings.
It is similar to Audio Graph Card, but different.

	- audio-graph-card  used "dais"  to indicate DAI-links,
	  audio-graph-card2 uses "links" to it.

	- audio-graph-card  used "phandle" to indicate bitclock/frame-master,
	  audio-graph-card2 uses flag to it.

	- audio-graph-card  used "format" to indicate DAI format,
	  audio-graph-card2 assumes CPU/Codec drivers have .get_fmt support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../sound/audio-graph-card2-items.yaml        | 80 +++++++++++++++++++
 .../bindings/sound/audio-graph-card2.yaml     | 51 ++++++++++++
 2 files changed, 131 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card2-items.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card2.yaml

Comments

Rob Herring (Arm) July 20, 2021, 1:11 p.m. UTC | #1
On Tue, 20 Jul 2021 10:41:01 +0900, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch adds Audio Graph Card2 Yaml bindings.
> It is similar to Audio Graph Card, but different.
> 
> 	- audio-graph-card  used "dais"  to indicate DAI-links,
> 	  audio-graph-card2 uses "links" to it.
> 
> 	- audio-graph-card  used "phandle" to indicate bitclock/frame-master,
> 	  audio-graph-card2 uses flag to it.
> 
> 	- audio-graph-card  used "format" to indicate DAI format,
> 	  audio-graph-card2 assumes CPU/Codec drivers have .get_fmt support.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../sound/audio-graph-card2-items.yaml        | 80 +++++++++++++++++++
>  .../bindings/sound/audio-graph-card2.yaml     | 51 ++++++++++++
>  2 files changed, 131 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card2-items.yaml
>  create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/audio-graph-card2-items.yaml: patternProperties:^ports(@[0-1])?$:properties: 'port(@[0-9a-f]+)?' does not match '^[#$a-zA-Z][a-zA-Z0-9,+\\-._@]{0,63}$'
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/audio-graph-card2-items.yaml: ignoring, error in schema: patternProperties: ^ports(@[0-1])?$: properties
warning: no schema found in file: ./Documentation/devicetree/bindings/sound/audio-graph-card2-items.yaml
Documentation/devicetree/bindings/sound/audio-graph-card2.example.dt.yaml:0:0: /example-0/cpu: failed to match any schema with compatible: ['cpu-driver']
Documentation/devicetree/bindings/sound/audio-graph-card2.example.dt.yaml:0:0: /example-0/codec: failed to match any schema with compatible: ['codec-driver']
Documentation/devicetree/bindings/sound/audio-graph-card2-items.example.dt.yaml:0:0: /example-0/mix: failed to match any schema with compatible: ['audio-graph-card2-dsp']
Documentation/devicetree/bindings/sound/audio-graph-card2-items.example.dt.yaml:0:0: /example-0/multi: failed to match any schema with compatible: ['audio-graph-card2-multi']
Documentation/devicetree/bindings/sound/audio-graph-card2-items.example.dt.yaml:0:0: /example-0/codec2codec: failed to match any schema with compatible: ['audio-graph-card2-codec2codec']
\ndoc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1507357

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Mark Brown July 21, 2021, 11:54 a.m. UTC | #2
On Wed, Jul 21, 2021 at 08:32:07AM +0900, Kuninori Morimoto wrote:

> > Why do we need these changes? I'm not wild about a new generic binding

> > replacing an existing one which only has 2 or 3 users IIRC. Plus

> > there's already the Renesas variant. (On the flip side, only a few

> > users, easier to deprecate the old binding.)


> Sorry I don't understand

> 	- Who is "2 or 3 users" ?


Just that there's not that many users of the existing audio-graph-card
(though it's a bit more than 2 or 3 and it's newer stuff rather than
old).

> 	- What is "Renesas variant" ?


I think that's the rsrc-card though that got removed.  There's also the
Tegra audio graph card though.

> audio-graph-card2 is based on audio-graph-card,

> but different driver not minor variant.

> Becase these are different, it can't keep compatibility.

> This is the reason why we need audio-graph-card2 instead of expanding

> audio-graph-card.


I think what Rob is looking for here is a more detailed description of
what the problems are with the existing binding that require a new
binding - what's driving these big changes?  TBH this is part of why
I've been holding off on review, I need to get my head round why we
can't fix the existing binding in place.

> > I also would like to see the graph card replace the simple card

> > binding. Surely it can handle the 'simple' case too.


> Do you mean you want to merge audio-graph-card and simple-card DT binding ??

> audio-graph-card and simple-card are different drivers.


It's more about making sure that new users that currently use
simple-card are using audio-graph-card instead - we need to keep
simple-card around for existing users (or at least the binding but
probably it's more effort than it's worth to merge the binding parsing
code elsewhere) but we should be avoiding adding new users of it.  I've
been pushing people to use audio-graph-card for a while, TBH we should
probably just go ahead and flag simple-card as deprecated in the binding
now since I don't think there's any reason anyone is forced to use it at
this point.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card2-items.yaml b/Documentation/devicetree/bindings/sound/audio-graph-card2-items.yaml
new file mode 100644
index 000000000000..ec94cad6b939
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/audio-graph-card2-items.yaml
@@ -0,0 +1,80 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/audio-graph-card2-items.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Audio Graph Card2 Items Bindings
+
+maintainers:
+  - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+
+properties:
+  compatible:
+    enum:
+      - audio-graph-card2-dsp
+      - audio-graph-card2-multi
+      - audio-graph-card2-codec2codec
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^ports(@[0-1])?$":
+    $ref: /schemas/graph.yaml#/properties/ports
+    properties:
+      port(@[0-9a-f]+)?:
+        $ref: audio-graph-port.yaml#
+        unevaluatedProperties: false
+    additionalProperties: true
+
+required:
+  - compatible
+
+additionalProperties: true
+
+examples:
+  - |
+    mix {
+        compatible = "audio-graph-card2-dsp";
+
+        /* sample ports
+        ports@0 {
+            port@0 { mix_fe0_ep: endpoint { remote-endpoint = <&cpu0_ep>; }; };
+            port@1 { mix_fe1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; };
+        };
+        ports@1 {
+            port@0 { mix_be0_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
+        };
+        */
+    };
+
+    multi {
+        compatible = "audio-graph-card2-multi";
+
+        /* sample ports
+        ports@0 {
+            port@0 { multi_00_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; };
+            port@1 { multi_01_ep: endpoint { remote-endpoint = <&cpu3_ep>; }; };
+        };
+        ports@1 {
+            port@0 { multi_10_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
+            port@1 { multi_11_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
+        };
+        */
+    };
+
+    codec2codec {
+        compatible = "audio-graph-card2-codec2codec";
+
+        /* sample ports
+        rate = <48000>;
+        ports {
+            port@0 { c2c_0_ep: endpoint { remote-endpoint = <&codec3_ep>; }; };
+            port@1 { c2c_1_ep: endpoint { remote-endpoint = <&codec4_ep>; }; };
+        };
+        */
+    };
diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml b/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
new file mode 100644
index 000000000000..4975f88de025
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
@@ -0,0 +1,51 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/audio-graph-card2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Audio Graph Card2 Device Tree Bindings
+
+maintainers:
+  - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+
+properties:
+  compatible:
+    enum:
+      - audio-graph-card2
+  links:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+  label:
+    maxItems: 1
+  routing:
+    description: |
+      A list of the connections between audio components.
+      Each entry is a pair of strings, the first being the
+      connection's sink, the second being the connection's source.
+    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
+
+required:
+  - compatible
+  - links
+
+additionalProperties: false
+
+examples:
+  - |
+    sound {
+        compatible = "audio-graph-card2";
+
+        links = <&cpu_port>;
+    };
+
+    cpu {
+        compatible = "cpu-driver";
+
+        cpu_port: port { cpu_ep: endpoint { remote-endpoint = <&codec_ep>; }; };
+    };
+
+    codec {
+        compatible = "codec-driver";
+
+        port { codec_ep: endpoint { remote-endpoint = <&cpu_ep>; }; };
+    };