mbox series

[v3,0/3] ASoC: dt-bindings: audio-graph-card: switch to yaml base Documentation

Message ID 87a6wfay7t.wl-kuninori.morimoto.gx@renesas.com
Headers show
Series ASoC: dt-bindings: audio-graph-card: switch to yaml base Documentation | expand

Message

Kuninori Morimoto Oct. 22, 2020, 12:45 a.m. UTC
Hi Rob, Mark
Cc: Sameer

These are v3 of switch to yaml base Documentation for
audio-graph-card and renesas,rsnd which uses audio-graph-card.

v2 -> v3
	- fixuped Rob's pointed points

v1 -> v2
	- upgrade dt-schema, and fixup errors for [2/2] patch


Kuninori Morimoto (3):
  ASoC: dt-bindings: audio-graph-card: switch to yaml base Documentation
  ASoC: dt-bindings: renesas,rsnd: switch to yaml base Documentation
  dt-bindings: ASoC: renesas,rsnd: Add r8a77961 support

 .../bindings/sound/audio-graph-card.txt       | 337 ------------
 .../bindings/sound/audio-graph-card.yaml      | 165 ++++++
 .../bindings/sound/renesas,rsnd.txt           | 520 ------------------
 .../bindings/sound/renesas,rsnd.yaml          | 457 +++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +-
 5 files changed, 623 insertions(+), 858 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.txt
 create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/renesas,rsnd.yaml

Comments

Sameer Pujar Oct. 22, 2020, 5:19 a.m. UTC | #1
Hi Morimoto-san,

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> This patch switches from .txt base to .yaml base Document.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   .../bindings/sound/audio-graph-card.txt       | 337 ------------------
>   .../bindings/sound/audio-graph-card.yaml      | 165 +++++++++
>   .../devicetree/bindings/vendor-prefixes.yaml  |   2 +-
>   3 files changed, 166 insertions(+), 338 deletions(-)
>   delete mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.txt
>   create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.yaml
>
> diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card.txt b/Documentation/devicetree/bindings/sound/audio-graph-card.txt
> deleted file mode 100644
> index d5f6919a2d69..000000000000
> --- a/Documentation/devicetree/bindings/sound/audio-graph-card.txt
> +++ /dev/null
> @@ -1,337 +0,0 @@
...
> diff --git a/Documentation/devicetree/bindings/sound/audio-graph-card.yaml b/Documentation/devicetree/bindings/sound/audio-graph-card.yaml
> new file mode 100644
> index 000000000000..9ccffbda86a8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/audio-graph-card.yaml
> @@ -0,0 +1,165 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/audio-graph-card.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Audio Graph Card Driver Device Tree Bindings
> +
> +maintainers:
> +  - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> +

> +properties:
> +  compatible:
> +    enum:
> +      - audio-graph-card
> +      - audio-graph-scu-card

Since I am trying to re-use most of audio-graph for Tegra, can 
'compatible' be moved to a separate schema?
For example,
audio-graph.yaml -> defines all the common stuff
audio-graph-card.yaml -> audio-graph.yaml + 'compatible' property
Similarly, tegra-audio-graph-card.yaml -> audio-graph.yaml + Tegra 
'compatible' property

> +
> +  dais:
> +    $ref: /schemas/types.yaml#/definitions/phandle-array
> +  label:
> +    maxItems: 1
> +  prefix:
> +    description: "device name prefix"
> +    $ref: /schemas/types.yaml#/definitions/string
> +  "audio-graph-card,prefix":
> +    description: "device name prefix"
> +    $ref: /schemas/types.yaml#/definitions/string
> +  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
> +  widgets:
> +    description: User specified audio sound widgets.
> +    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> +  convert-rate:
> +    description: CPU to Codec rate convert.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +  "audio-graph-card,convert-rate":
> +    description: CPU to Codec rate convert.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +  convert-channels:
> +    description: CPU to Codec rate channels.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +  "audio-graph-card,convert-channels":
> +    description: CPU to Codec rate channels.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +  pa-gpios:
> +    maxItems: 1
> +  hp-det-gpio:
> +    maxItems: 1
> +  mic-det-gpio:
> +    maxItems: 1
> +

> +  endpoint:
> +    type: object
> +    properties:
> +      remote-endpoint:
> +        maxItems: 1
> +      mclk-fs:
> +        description: |
> +          Multiplication factor between stream rate and codec mclk.
> +          When defined, mclk-fs property defined in dai-link sub nodes are ignored.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +      frame-inversion:
> +        description: dai-link uses frame clock inversion
> +        $ref: /schemas/types.yaml#/definitions/flag
> +      bitclock-inversion:
> +        description: dai-link uses bit clock inversion
> +        $ref: /schemas/types.yaml#/definitions/flag
> +      frame-master:
> +        description: Indicates dai-link frame master.
> +        $ref: /schemas/types.yaml#/definitions/phandle-array
> +        maxItems: 1
> +      bitclock-master:
> +        description: Indicates dai-link bit clock master
> +        $ref: /schemas/types.yaml#/definitions/phandle-array
> +        maxItems: 1
> +      dai-format:
> +        description: audio format.
> +        items:
> +          enum:
> +            - i2s
> +            - right_j
> +            - left_j
> +            - dsp_a
> +            - dsp_b
> +            - ac97
> +            - pdm
> +            - msb
> +            - lsb
> +      convert-rate:
> +        description: CPU to Codec rate convert.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +      convert-channels:
> +        description: CPU to Codec rate channels.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +    required:
> +      - remote-endpoint

Is it possible to have endpoint without port nodes?

> +
> +  port:
> +    description: single OF-Graph subnode
> +    type: object
> +    properties:
> +      reg:
> +        maxItems: 1
> +      prefix:
> +        description: "device name prefix"
> +        $ref: /schemas/types.yaml#/definitions/string
> +      convert-rate:
> +        description: CPU to Codec rate convert.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +      convert-channels:
> +        description: CPU to Codec rate channels.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +    patternProperties:
> +      "^endpoint(@[0-9a-f]+)?":
> +        $ref: "#/properties/endpoint"
> +
> +  ports:
> +    description: multi OF-Graph subnode
> +    type: object
> +    patternProperties:
> +      "^port(@[0-9a-f]+)?":
> +        $ref: "#/properties/port"
> +
> +required:
> +  - compatible
> +  - dais
> +

> +additionalProperties: false
> +

This needs to be true when other files want to reference this schema 
and/or define some additional properties.

> +examples:
> +  - |
> +    sound {
> +        compatible = "audio-graph-card";
> +
> +        dais = <&cpu_port_a>;
> +    };
> +
> +    cpu {
> +        /*
> +         * dai-controller own settings
> +         */
> +
> +        port {
> +            cpu_endpoint: endpoint {
> +                remote-endpoint = <&codec_endpoint>;
> +                dai-format = "left_j";
> +            };
> +        };
> +    };
> +
> +    codec {
> +        /*
> +         * codec own settings
> +         */
> +
> +        port {
> +            codec_endpoint: endpoint {
> +                remote-endpoint = <&cpu_endpoint>;
> +            };
> +        };
> +    };
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> index 63996ab03521..5ada35ddac7e 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> @@ -20,7 +20,7 @@ patternProperties:
>     "^(keypad|m25p|max8952|max8997|max8998|mpmc),.*": true
>     "^(pinctrl-single|#pinctrl-single|PowerPC),.*": true
>     "^(pl022|pxa-mmc|rcar_sound|rotary-encoder|s5m8767|sdhci),.*": true
> -  "^(simple-audio-card|st-plgpio|st-spics|ts),.*": true
> +  "^(simple-audio-card|audio-graph-card|st-plgpio|st-spics|ts),.*": true
>
>     # Keep list in alphabetical order.
>     "^70mai,.*":
> --
> 2.25.1
>
Sameer Pujar Oct. 23, 2020, 1:52 p.m. UTC | #2
Hi Morimoto-san,

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> This patch switches from .txt base to .yaml base Document.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   .../bindings/sound/audio-graph-card.txt       | 337 ------------------
>   .../bindings/sound/audio-graph-card.yaml      | 165 +++++++++
>   .../devicetree/bindings/vendor-prefixes.yaml  |   2 +-
>   3 files changed, 166 insertions(+), 338 deletions(-)
>   delete mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.txt
>   create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.yaml

...

> +
> +  port:
> +    description: single OF-Graph subnode
> +    type: object
> +    properties:
> +      reg:
> +        maxItems: 1
> +      prefix:
> +        description: "device name prefix"
> +        $ref: /schemas/types.yaml#/definitions/string
> +      convert-rate:
> +        description: CPU to Codec rate convert.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +      convert-channels:
> +        description: CPU to Codec rate channels.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +    patternProperties:
> +      "^endpoint(@[0-9a-f]+)?":
> +        $ref: "#/properties/endpoint"
> +
> +  ports:
> +    description: multi OF-Graph subnode
> +    type: object
> +    patternProperties:
> +      "^port(@[0-9a-f]+)?":
> +        $ref: "#/properties/port"
> +

Can these be referenced from graph.yaml (port and ports properties) and 
only additonal properties (specific to audio-graph) could be populated here?

...

> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> index 63996ab03521..5ada35ddac7e 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> @@ -20,7 +20,7 @@ patternProperties:
>     "^(keypad|m25p|max8952|max8997|max8998|mpmc),.*": true
>     "^(pinctrl-single|#pinctrl-single|PowerPC),.*": true
>     "^(pl022|pxa-mmc|rcar_sound|rotary-encoder|s5m8767|sdhci),.*": true
> -  "^(simple-audio-card|st-plgpio|st-spics|ts),.*": true
> +  "^(simple-audio-card|audio-graph-card|st-plgpio|st-spics|ts),.*": true
>
>     # Keep list in alphabetical order.
>     "^70mai,.*":
> --
> 2.25.1
>
Sameer Pujar Oct. 26, 2020, 2:49 a.m. UTC | #3
Hi Morimoto-san,

>>> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>>>
>>> This patch switches from .txt base to .yaml base Document.
>>>
>>> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>>> ---
>>>    .../bindings/sound/audio-graph-card.txt       | 337 ------------------
>>>    .../bindings/sound/audio-graph-card.yaml      | 165 +++++++++
>>>    .../devicetree/bindings/vendor-prefixes.yaml  |   2 +-
>>>    3 files changed, 166 insertions(+), 338 deletions(-)
>>>    delete mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.txt
>>>    create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card.yaml
>> ...
>>
>>> +
>>> +  port:
>>> +    description: single OF-Graph subnode
>>> +    type: object
>>> +    properties:
>>> +      reg:
>>> +        maxItems: 1
>>> +      prefix:
>>> +        description: "device name prefix"
>>> +        $ref: /schemas/types.yaml#/definitions/string
>>> +      convert-rate:
>>> +        description: CPU to Codec rate convert.
>>> +        $ref: /schemas/types.yaml#/definitions/uint32
>>> +      convert-channels:
>>> +        description: CPU to Codec rate channels.
>>> +        $ref: /schemas/types.yaml#/definitions/uint32
>>> +    patternProperties:
>>> +      "^endpoint(@[0-9a-f]+)?":
>>> +        $ref: "#/properties/endpoint"
>>> +
>>> +  ports:
>>> +    description: multi OF-Graph subnode
>>> +    type: object
>>> +    patternProperties:
>>> +      "^port(@[0-9a-f]+)?":
>>> +        $ref: "#/properties/port"
>>> +
>> Can these be referenced from graph.yaml (port and ports properties)
>> and only additonal properties (specific to audio-graph) could be
>> populated here?
> Yes of course.
> In such case, I need to wait graph.yaml first I think.

Yes we first need to add graph.yaml, which I started to add in series 
https://lkml.org/lkml/2020/10/16/645
Since there is cyclic dependency between your patch and my series, I 
could probably pull out graph.yaml out of my series and independently 
submit that first.
Kuninori Morimoto Oct. 27, 2020, 4:52 a.m. UTC | #4
Hi Sameer

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > This patch switches from .txt base to .yaml base Document.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
(snip)
> > +additionalProperties: false
> > +
> 
> This needs to be true when other files want to reference this schema
> and/or define some additional properties.

*Current* audio-graph-card doesn't assume such case.
I think you need to update it when you support tegra-audio-graph

Thank you for your help !!

Best regards
---
Kuninori Morimoto
Kuninori Morimoto Oct. 27, 2020, 5:32 a.m. UTC | #5
Hi Sameer

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > This patch switches from .txt base to .yaml base Document.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
(snip)
> Since I am trying to re-use most of audio-graph for Tegra, can
> 'compatible' be moved to a separate schema?
> For example,
> audio-graph.yaml -> defines all the common stuff
> audio-graph-card.yaml -> audio-graph.yaml + 'compatible' property
> Similarly, tegra-audio-graph-card.yaml -> audio-graph.yaml + Tegra
> 'compatible' property

I'm not expert of Json-Schema, and it sound very expert technique for me.
(It always indicates me unknown errors...)
I'm posting this patch since many month ago, and not yet accepted
for many reasons (audio-graph DT is very complex).
I spend many times for it and finally come to the point where it
can (might) be accepted. 
I'm sorry but I want to finish this work,
this means I don't want to customize it any more.
If I try it, it needs more month...

Thank you for your help !!

Best regards
---
Kuninori Morimoto
Sameer Pujar Oct. 27, 2020, 6:03 a.m. UTC | #6
Hi Morimoto-san,

>>> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>>>
>>> This patch switches from .txt base to .yaml base Document.
>>>
>>> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> (snip)
>> Since I am trying to re-use most of audio-graph for Tegra, can
>> 'compatible' be moved to a separate schema?
>> For example,
>> audio-graph.yaml -> defines all the common stuff
>> audio-graph-card.yaml -> audio-graph.yaml + 'compatible' property
>> Similarly, tegra-audio-graph-card.yaml -> audio-graph.yaml + Tegra
>> 'compatible' property
> I'm not expert of Json-Schema, and it sound very expert technique for me.
> (It always indicates me unknown errors...)
> I'm posting this patch since many month ago, and not yet accepted
> for many reasons (audio-graph DT is very complex).
> I spend many times for it and finally come to the point where it
> can (might) be accepted.
> I'm sorry but I want to finish this work,
> this means I don't want to customize it any more.
> If I try it, it needs more month...

I am not a json-schema expert either :) From earlier comments on Tegra 
audio graph series, above re-use is possible I suppose. I depend on your 
audio-graph documentation and for 'compatible' I am seeing error. So I 
thought it may be fine to split audio-graph into two json-schemas now 
itself. Otherwise I need to do it separately in my series if I want to 
re-use your audio-graph, which is fine with me.