2023-02-02 18:38:12

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 0/9] ASoC: dt-bindings: meson: covert axg audio to schema

Convert AXG audio dt-binding documentation to schema

Jerome Brunet (9):
ASoC: dt-bindings: create component common schema
ASoC: dt-bindings: meson: fix gx-card codec node regex
ASoC: dt-bindings: meson: convert axg tdm interface to schema
ASoC: dt-bindings: meson: convert axg tdm formatters to schema
ASoC: dt-bindings: meson: convert axg pdm to schema
ASoC: dt-bindings: meson: convert axg fifo to schema
ASoC: dt-bindings: meson: convert axg spdif input to schema
ASoC: dt-bindings: meson: convert axg spdif output to schema
ASoC: dt-bindings: meson: convert axg sound card control to schema

.../bindings/sound/amlogic,axg-fifo.txt | 34 ----
.../bindings/sound/amlogic,axg-fifo.yaml | 116 +++++++++++
.../bindings/sound/amlogic,axg-pdm.txt | 29 ---
.../bindings/sound/amlogic,axg-pdm.yaml | 86 +++++++++
.../bindings/sound/amlogic,axg-sound-card.txt | 124 ------------
.../sound/amlogic,axg-sound-card.yaml | 182 ++++++++++++++++++
.../bindings/sound/amlogic,axg-spdifin.txt | 27 ---
.../bindings/sound/amlogic,axg-spdifin.yaml | 90 +++++++++
.../bindings/sound/amlogic,axg-spdifout.txt | 25 ---
.../bindings/sound/amlogic,axg-spdifout.yaml | 83 ++++++++
.../sound/amlogic,axg-tdm-formatters.txt | 36 ----
.../sound/amlogic,axg-tdm-formatters.yaml | 90 +++++++++
.../bindings/sound/amlogic,axg-tdm-iface.txt | 22 ---
.../bindings/sound/amlogic,axg-tdm-iface.yaml | 59 ++++++
.../bindings/sound/amlogic,gx-sound-card.yaml | 2 +-
.../bindings/sound/component-common.yaml | 21 ++
.../devicetree/bindings/sound/dai-common.yaml | 11 +-
17 files changed, 731 insertions(+), 306 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml
create mode 100644 Documentation/devicetree/bindings/sound/component-common.yaml

--
2.39.0



2023-02-02 18:38:15

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 1/9] ASoC: dt-bindings: create component common schema

All DAIs are component but not all components are DAI.
Move the component properties (sound-name-prefix ATM) to a separate schema
file so it can be used by non-DAI components, such as auxiliary devices.

Signed-off-by: Jerome Brunet <[email protected]>
---
.../bindings/sound/component-common.yaml | 21 +++++++++++++++++++
.../devicetree/bindings/sound/dai-common.yaml | 11 +++-------
2 files changed, 24 insertions(+), 8 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/component-common.yaml

diff --git a/Documentation/devicetree/bindings/sound/component-common.yaml b/Documentation/devicetree/bindings/sound/component-common.yaml
new file mode 100644
index 000000000000..37766c5f3974
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/component-common.yaml
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/component-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Audio Component Common Properties
+
+maintainers:
+ - Jerome Brunet <[email protected]>
+
+properties:
+ sound-name-prefix:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: |
+ Card implementing the routing property define the connection between
+ audio components as list of string pair. Component using the same
+ sink/source names may use this property to prepend the name of their
+ sinks/sources with the provided string.
+
+additionalProperties: true
diff --git a/Documentation/devicetree/bindings/sound/dai-common.yaml b/Documentation/devicetree/bindings/sound/dai-common.yaml
index d858eea73ed7..1aed2f0f1775 100644
--- a/Documentation/devicetree/bindings/sound/dai-common.yaml
+++ b/Documentation/devicetree/bindings/sound/dai-common.yaml
@@ -9,15 +9,10 @@ title: Digital Audio Interface Common Properties
maintainers:
- Jerome Brunet <[email protected]>

-properties:
- sound-name-prefix:
- $ref: /schemas/types.yaml#/definitions/string
- description: |
- Card implementing the routing property define the connection between
- audio components as list of string pair. Component using the same
- sink/source names may use this property to prepend the name of their
- sinks/sources with the provided string.
+allOf:
+ - $ref: component-common.yaml#

+properties:
'#sound-dai-cells': true

additionalProperties: true
--
2.39.0


2023-02-02 18:38:18

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 2/9] ASoC: dt-bindings: meson: fix gx-card codec node regex

'codec' is a valid node name when there is a single codec
in the link. Fix the node regular expression to apply this.

Fixes: fd00366b8e41 ("ASoC: meson: gx: add sound card dt-binding documentation")
Signed-off-by: Jerome Brunet <[email protected]>
---
.../devicetree/bindings/sound/amlogic,gx-sound-card.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
index 5b8d59245f82..b358fd601ed3 100644
--- a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
+++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
@@ -62,7 +62,7 @@ patternProperties:
description: phandle of the CPU DAI

patternProperties:
- "^codec-[0-9]+$":
+ "^codec(-[0-9]+)?$":
type: object
additionalProperties: false
description: |-
--
2.39.0


2023-02-02 18:38:24

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 3/9] ASoC: dt-bindings: meson: convert axg tdm interface to schema

Convert the DT binding documentation for the Amlogic tdm interface to
schema.

Signed-off-by: Jerome Brunet <[email protected]>
---
.../bindings/sound/amlogic,axg-tdm-iface.txt | 22 -------
.../bindings/sound/amlogic,axg-tdm-iface.yaml | 59 +++++++++++++++++++
2 files changed, 59 insertions(+), 22 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml

diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt
deleted file mode 100644
index cabfb26a5f22..000000000000
--- a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-* Amlogic Audio TDM Interfaces
-
-Required properties:
-- compatible: 'amlogic,axg-tdm-iface'
-- clocks: list of clock phandle, one for each entry clock-names.
-- clock-names: should contain the following:
- * "sclk" : bit clock.
- * "lrclk": sample clock
- * "mclk" : master clock
- -> optional if the interface is in clock slave mode.
-- #sound-dai-cells: must be 0.
-
-Example of TDM_A on the A113 SoC:
-
-tdmif_a: audio-controller@0 {
- compatible = "amlogic,axg-tdm-iface";
- #sound-dai-cells = <0>;
- clocks = <&clkc_audio AUD_CLKID_MST_A_MCLK>,
- <&clkc_audio AUD_CLKID_MST_A_SCLK>,
- <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
- clock-names = "mclk", "sclk", "lrclk";
-};
diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml
new file mode 100644
index 000000000000..362414fc9a9b
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-iface.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,axg-tdm-iface.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Audio TDM Interfaces
+
+maintainers:
+ - Jerome Brunet <[email protected]>
+
+allOf:
+ - $ref: dai-common.yaml#
+
+properties:
+ $nodename:
+ pattern: "^audio-controller-.*"
+
+ compatible:
+ items:
+ - const: 'amlogic,axg-tdm-iface'
+
+ "#sound-dai-cells":
+ const: 0
+
+ clocks:
+ minItems: 2
+ items:
+ - description: Bit clock
+ - description: Sample clock
+ - description: Master clock #optional
+
+ clock-names:
+ minItems: 2
+ items:
+ - const: sclk
+ - const: lrclk
+ - const: mclk
+
+required:
+ - compatible
+ - "#sound-dai-cells"
+ - clocks
+ - clock-names
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/axg-audio-clkc.h>
+
+ tdmif_a: audio-controller-0 {
+ compatible = "amlogic,axg-tdm-iface";
+ #sound-dai-cells = <0>;
+ clocks = <&clkc_audio AUD_CLKID_MST_A_SCLK>,
+ <&clkc_audio AUD_CLKID_MST_A_LRCLK>,
+ <&clkc_audio AUD_CLKID_MST_A_MCLK>;
+ clock-names = "sclk", "lrclk", "mclk";
+ };
--
2.39.0


2023-02-02 18:38:28

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 4/9] ASoC: dt-bindings: meson: convert axg tdm formatters to schema

Convert the DT binding documentation for the Amlogic tdm formatters to
schema.

Signed-off-by: Jerome Brunet <[email protected]>
---
.../sound/amlogic,axg-tdm-formatters.txt | 36 --------
.../sound/amlogic,axg-tdm-formatters.yaml | 90 +++++++++++++++++++
2 files changed, 90 insertions(+), 36 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml

diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt
deleted file mode 100644
index 5996c0cd89c2..000000000000
--- a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-* Amlogic Audio TDM formatters
-
-Required properties:
-- compatible: 'amlogic,axg-tdmin' or
- 'amlogic,axg-tdmout' or
- 'amlogic,g12a-tdmin' or
- 'amlogic,g12a-tdmout' or
- 'amlogic,sm1-tdmin' or
- 'amlogic,sm1-tdmout
-- reg: physical base address of the controller and length of memory
- mapped region.
-- clocks: list of clock phandle, one for each entry clock-names.
-- clock-names: should contain the following:
- * "pclk" : peripheral clock.
- * "sclk" : bit clock.
- * "sclk_sel" : bit clock input multiplexer.
- * "lrclk" : sample clock
- * "lrclk_sel": sample clock input multiplexer
-
-Optional property:
-- resets: phandle to the dedicated reset line of the tdm formatter.
-
-Example of TDMOUT_A on the S905X2 SoC:
-
-tdmout_a: audio-controller@500 {
- compatible = "amlogic,axg-tdmout";
- reg = <0x0 0x500 0x0 0x40>;
- resets = <&clkc_audio AUD_RESET_TDMOUT_A>;
- clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>,
- <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>,
- <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>,
- <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>,
- <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>;
- clock-names = "pclk", "sclk", "sclk_sel",
- "lrclk", "lrclk_sel";
-};
diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml
new file mode 100644
index 000000000000..f618724411de
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,axg-tdm-formatters.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Audio AXG TDM formatters
+
+maintainers:
+ - Jerome Brunet <[email protected]>
+
+allOf:
+ - $ref: component-common.yaml#
+
+properties:
+ $nodename:
+ pattern: "^audio-controller@.*"
+
+ compatible:
+ oneOf:
+ - enum:
+ - amlogic,g12a-tdmout
+ - amlogic,sm1-tdmout
+ - amlogic,axg-tdmout
+ - amlogic,g12a-tdmin
+ - amlogic,sm1-tdmin
+ - amlogic,axg-tdmin
+
+ clocks:
+ items:
+ - description: Peripheral clock
+ - description: Bit clock
+ - description: Bit clock input multiplexer
+ - description: Sample clock
+ - description: Sample clock input multiplexer
+
+ clock-names:
+ items:
+ - const: pclk
+ - const: sclk
+ - const: sclk_sel
+ - const: lrclk
+ - const: lrclk_sel
+
+ reg:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+
+if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - amlogic,g12a-tdmin
+ - amlogic,sm1-tdmin
+ - amlogic,g12a-tdmout
+ - amlogic,sm1-tdmout
+then:
+ properties:
+ resets:
+ items:
+ - description: Dedicated device reset line
+
+ required:
+ - resets
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/axg-audio-clkc.h>
+ #include <dt-bindings/reset/amlogic,meson-g12a-audio-reset.h>
+
+ tdmout_a: audio-controller@500 {
+ compatible = "amlogic,g12a-tdmout";
+ reg = <0x500 0x40>;
+ resets = <&clkc_audio AUD_RESET_TDMOUT_A>;
+ clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>,
+ <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>,
+ <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>,
+ <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>,
+ <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>;
+ clock-names = "pclk", "sclk", "sclk_sel",
+ "lrclk", "lrclk_sel";
+ };
--
2.39.0


2023-02-02 18:38:31

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 6/9] ASoC: dt-bindings: meson: convert axg fifo to schema

Convert the DT binding documentation for the Amlogic axg audio FIFOs to
schema.

Signed-off-by: Jerome Brunet <[email protected]>
---
.../bindings/sound/amlogic,axg-fifo.txt | 34 -----
.../bindings/sound/amlogic,axg-fifo.yaml | 116 ++++++++++++++++++
2 files changed, 116 insertions(+), 34 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml

diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
deleted file mode 100644
index fa4545ed81ca..000000000000
--- a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-* Amlogic Audio FIFO controllers
-
-Required properties:
-- compatible: 'amlogic,axg-toddr' or
- 'amlogic,axg-toddr' or
- 'amlogic,g12a-frddr' or
- 'amlogic,g12a-toddr' or
- 'amlogic,sm1-frddr' or
- 'amlogic,sm1-toddr'
-- reg: physical base address of the controller and length of memory
- mapped region.
-- interrupts: interrupt specifier for the fifo.
-- clocks: phandle to the fifo peripheral clock provided by the audio
- clock controller.
-- resets: list of reset phandle, one for each entry reset-names.
-- reset-names: should contain the following:
- * "arb" : memory ARB line (required)
- * "rst" : dedicated device reset line (optional)
-- #sound-dai-cells: must be 0.
-- amlogic,fifo-depth: The size of the controller's fifo in bytes. This
- is useful for determining certain configuration such
- as the flush threshold of the fifo
-
-Example of FRDDR A on the A113 SoC:
-
-frddr_a: audio-controller@1c0 {
- compatible = "amlogic,axg-frddr";
- reg = <0x0 0x1c0 0x0 0x1c>;
- #sound-dai-cells = <0>;
- interrupts = <GIC_SPI 88 IRQ_TYPE_EDGE_RISING>;
- clocks = <&clkc_audio AUD_CLKID_FRDDR_A>;
- resets = <&arb AXG_ARB_FRDDR_A>;
- fifo-depth = <512>;
-};
diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
new file mode 100644
index 000000000000..f6222ad08880
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,axg-fifo.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic AXG Audio FIFO controllers
+
+maintainers:
+ - Jerome Brunet <[email protected]>
+
+allOf:
+ - $ref: dai-common.yaml#
+
+properties:
+ $nodename:
+ pattern: "^audio-controller@.*"
+
+ compatible:
+ oneOf:
+ - items:
+ - enum:
+ - amlogic,axg-toddr
+ - amlogic,axg-frddr
+ - items:
+ - enum:
+ - amlogic,g12a-toddr
+ - amlogic,sm1-toddr
+ - const:
+ amlogic,axg-toddr
+ - items:
+ - enum:
+ - amlogic,g12a-frddr
+ - amlogic,sm1-frddr
+ - const:
+ amlogic,axg-frddr
+
+ reg:
+ maxItems: 1
+
+ "#sound-dai-cells":
+ const: 0
+
+ clocks:
+ items:
+ - description: Peripheral clock
+
+ interrupts:
+ maxItems: 1
+
+ resets:
+ items:
+ - description: Memory ARB line
+ - description: Dedicated device reset line
+
+ reset-names: true
+
+ amlogic,fifo-depth:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Size of the controller's fifo in bytes
+
+required:
+ - compatible
+ - reg
+ - "#sound-dai-cells"
+ - clocks
+ - interrupts
+ - resets
+ - amlogic,fifo-depth
+
+if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - amlogic,g12a-toddr
+ - amlogic,sm1-toddr
+ - amlogic,g12a-frddr
+ - amlogic,sm1-frddr
+then:
+ properties:
+ resets:
+ minItems: 2
+ reset-names:
+ items:
+ - const: arb
+ - const: rst
+ required:
+ - reset-names
+else:
+ properties:
+ resets:
+ maxItems: 1
+ reset-names:
+ const: arb
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/axg-audio-clkc.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/reset/amlogic,meson-axg-audio-arb.h>
+ #include <dt-bindings/reset/amlogic,meson-g12a-audio-reset.h>
+
+ frddr_a: audio-controller@1c0 {
+ compatible = "amlogic,g12a-frddr", "amlogic,axg-frddr";
+ reg = <0x1c0 0x1c>;
+ #sound-dai-cells = <0>;
+ clocks = <&clkc_audio AUD_CLKID_FRDDR_A>;
+ interrupts = <GIC_SPI 88 IRQ_TYPE_EDGE_RISING>;
+ resets = <&arb>, <&clkc_audio AUD_RESET_FRDDR_A>;
+ reset-names = "arb", "rst";
+ amlogic,fifo-depth = <512>;
+ };
--
2.39.0


2023-02-02 18:38:33

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 5/9] ASoC: dt-bindings: meson: convert axg pdm to schema

Convert the DT binding documentation for the Amlogic axg PDM device to
schema.

Signed-off-by: Jerome Brunet <[email protected]>
---
.../bindings/sound/amlogic,axg-pdm.txt | 29 -------
.../bindings/sound/amlogic,axg-pdm.yaml | 86 +++++++++++++++++++
2 files changed, 86 insertions(+), 29 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml

diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt
deleted file mode 100644
index 716878107a24..000000000000
--- a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-* Amlogic Audio PDM input
-
-Required properties:
-- compatible: 'amlogic,axg-pdm' or
- 'amlogic,g12a-pdm' or
- 'amlogic,sm1-pdm'
-- reg: physical base address of the controller and length of memory
- mapped region.
-- clocks: list of clock phandle, one for each entry clock-names.
-- clock-names: should contain the following:
- * "pclk" : peripheral clock.
- * "dclk" : pdm digital clock
- * "sysclk" : dsp system clock
-- #sound-dai-cells: must be 0.
-
-Optional property:
-- resets: phandle to the dedicated reset line of the pdm input.
-
-Example of PDM on the A113 SoC:
-
-pdm: audio-controller@ff632000 {
- compatible = "amlogic,axg-pdm";
- reg = <0x0 0xff632000 0x0 0x34>;
- #sound-dai-cells = <0>;
- clocks = <&clkc_audio AUD_CLKID_PDM>,
- <&clkc_audio AUD_CLKID_PDM_DCLK>,
- <&clkc_audio AUD_CLKID_PDM_SYSCLK>;
- clock-names = "pclk", "dclk", "sysclk";
-};
diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml
new file mode 100644
index 000000000000..d3da2f8ba7b1
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,axg-pdm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Audio AXG PDM input
+
+maintainers:
+ - Jerome Brunet <[email protected]>
+
+allOf:
+ - $ref: dai-common.yaml#
+
+properties:
+ $nodename:
+ pattern: "^audio-controller@.*"
+
+ compatible:
+ oneOf:
+ - items:
+ - enum:
+ - amlogic,g12a-pdm
+ - amlogic,sm1-pdm
+ - const:
+ amlogic,axg-pdm
+ - items:
+ - const:
+ amlogic,axg-pdm
+
+ reg:
+ maxItems: 1
+
+ "#sound-dai-cells":
+ const: 0
+
+ clocks:
+ items:
+ - description: Peripheral clock
+ - description: PDM digital clock
+ - description: DSP system clock
+
+ clock-names:
+ items:
+ - const: pclk
+ - const: dclk
+ - const: sysclk
+
+required:
+ - compatible
+ - reg
+ - "#sound-dai-cells"
+ - clocks
+ - clock-names
+
+if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - amlogic,g12a-pdm
+ - amlogic,sm1-pdm
+then:
+ properties:
+ resets:
+ items:
+ - description: Dedicated device reset line
+
+ required:
+ - resets
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/axg-audio-clkc.h>
+
+ pdm: audio-controller@ff632000 {
+ compatible = "amlogic,axg-pdm";
+ reg = <0xff632000 0x34>;
+ #sound-dai-cells = <0>;
+ clocks = <&clkc_audio AUD_CLKID_PDM>,
+ <&clkc_audio AUD_CLKID_PDM_DCLK>,
+ <&clkc_audio AUD_CLKID_PDM_SYSCLK>;
+ clock-names = "pclk", "dclk", "sysclk";
+ };
--
2.39.0


2023-02-02 18:38:44

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 7/9] ASoC: dt-bindings: meson: convert axg spdif input to schema

Convert the DT binding documentation for the Amlogic axg spdif input to
schema.

Signed-off-by: Jerome Brunet <[email protected]>
---
.../bindings/sound/amlogic,axg-spdifin.txt | 27 ------
.../bindings/sound/amlogic,axg-spdifin.yaml | 90 +++++++++++++++++++
2 files changed, 90 insertions(+), 27 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml

diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
deleted file mode 100644
index df92a4ecf288..000000000000
--- a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-* Amlogic Audio SPDIF Input
-
-Required properties:
-- compatible: 'amlogic,axg-spdifin' or
- 'amlogic,g12a-spdifin' or
- 'amlogic,sm1-spdifin'
-- interrupts: interrupt specifier for the spdif input.
-- clocks: list of clock phandle, one for each entry clock-names.
-- clock-names: should contain the following:
- * "pclk" : peripheral clock.
- * "refclk" : spdif input reference clock
-- #sound-dai-cells: must be 0.
-
-Optional property:
-- resets: phandle to the dedicated reset line of the spdif input.
-
-Example on the A113 SoC:
-
-spdifin: audio-controller@400 {
- compatible = "amlogic,axg-spdifin";
- reg = <0x0 0x400 0x0 0x30>;
- #sound-dai-cells = <0>;
- interrupts = <GIC_SPI 87 IRQ_TYPE_EDGE_RISING>;
- clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
- <&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
- clock-names = "pclk", "refclk";
-};
diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml
new file mode 100644
index 000000000000..4f7e4c21acc1
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,axg-spdifin.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Audio AXG SPDIF Input
+
+maintainers:
+ - Jerome Brunet <[email protected]>
+
+allOf:
+ - $ref: dai-common.yaml#
+
+properties:
+ $nodename:
+ pattern: "^audio-controller@.*"
+
+ compatible:
+ oneOf:
+ - items:
+ - const:
+ amlogic,axg-spdifin
+ - items:
+ - enum:
+ - amlogic,g12a-spdifin
+ - amlogic,sm1-spdifin
+ - const:
+ amlogic,axg-spdifin
+
+ reg:
+ maxItems: 1
+
+ "#sound-dai-cells":
+ const: 0
+
+ clocks:
+ items:
+ - description: Peripheral clock
+ - description: SPDIF input reference clock
+
+ clock-names:
+ items:
+ - const: pclk
+ - const: refclk
+
+ interrupts:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - "#sound-dai-cells"
+ - clocks
+ - clock-names
+ - interrupts
+
+if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - amlogic,g12a-spdifin
+ - amlogic,sm1-spdifin
+then:
+ properties:
+ resets:
+ items:
+ - description: dedicated device reset line
+
+ required:
+ - resets
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/axg-audio-clkc.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ spdifin: audio-controller@400 {
+ compatible = "amlogic,axg-spdifin";
+ reg = <0x400 0x30>;
+ #sound-dai-cells = <0>;
+ interrupts = <GIC_SPI 87 IRQ_TYPE_EDGE_RISING>;
+ clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
+ <&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
+ clock-names = "pclk", "refclk";
+ };
--
2.39.0


2023-02-02 18:38:48

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 8/9] ASoC: dt-bindings: meson: convert axg spdif output to schema

Convert the DT binding documentation for the Amlogic axg spdif output to
schema.

Signed-off-by: Jerome Brunet <[email protected]>
---
.../bindings/sound/amlogic,axg-spdifout.txt | 25 ------
.../bindings/sound/amlogic,axg-spdifout.yaml | 83 +++++++++++++++++++
2 files changed, 83 insertions(+), 25 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml

diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt
deleted file mode 100644
index 28381dd1f633..000000000000
--- a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-* Amlogic Audio SPDIF Output
-
-Required properties:
-- compatible: 'amlogic,axg-spdifout' or
- 'amlogic,g12a-spdifout' or
- 'amlogic,sm1-spdifout'
-- clocks: list of clock phandle, one for each entry clock-names.
-- clock-names: should contain the following:
- * "pclk" : peripheral clock.
- * "mclk" : master clock
-- #sound-dai-cells: must be 0.
-
-Optional property:
-- resets: phandle to the dedicated reset line of the spdif output.
-
-Example on the A113 SoC:
-
-spdifout: audio-controller@480 {
- compatible = "amlogic,axg-spdifout";
- reg = <0x0 0x480 0x0 0x50>;
- #sound-dai-cells = <0>;
- clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
- <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
- clock-names = "pclk", "mclk";
-};
diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml
new file mode 100644
index 000000000000..c661ce7f8b9d
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,axg-spdifout.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Audio AXG SPDIF Output
+
+maintainers:
+ - Jerome Brunet <[email protected]>
+
+allOf:
+ - $ref: dai-common.yaml#
+
+properties:
+ $nodename:
+ pattern: "^audio-controller@.*"
+
+ compatible:
+ oneOf:
+ - items:
+ - const:
+ amlogic,axg-spdifout
+ - items:
+ - enum:
+ - amlogic,g12a-spdifout
+ - amlogic,sm1-spdifout
+ - const:
+ amlogic,axg-spdifout
+
+ reg:
+ maxItems: 1
+
+ "#sound-dai-cells":
+ const: 0
+
+ clocks:
+ items:
+ - description: Peripheral clock
+ - description: SPDIF output master clock
+
+ clock-names:
+ items:
+ - const: pclk
+ - const: mclk
+
+required:
+ - compatible
+ - reg
+ - "#sound-dai-cells"
+ - clocks
+ - clock-names
+
+if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - amlogic,g12a-spdifout
+ - amlogic,sm1-spdifout
+then:
+ properties:
+ resets:
+ items:
+ - description: dedicated device reset line
+
+ required:
+ - resets
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/axg-audio-clkc.h>
+
+ spdifout: audio-controller@480 {
+ compatible = "amlogic,axg-spdifout";
+ reg = <0x480 0x50>;
+ #sound-dai-cells = <0>;
+ clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
+ <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
+ clock-names = "pclk", "mclk";
+ };
--
2.39.0


2023-02-02 18:38:52

by Jerome Brunet

[permalink] [raw]
Subject: [PATCH 9/9] ASoC: dt-bindings: meson: convert axg sound card control to schema

Convert the DT binding documentation for the Amlogic axg sound card to
schema.

Signed-off-by: Jerome Brunet <[email protected]>
---
.../bindings/sound/amlogic,axg-sound-card.txt | 124 ------------
.../sound/amlogic,axg-sound-card.yaml | 182 ++++++++++++++++++
2 files changed, 182 insertions(+), 124 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml

diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
deleted file mode 100644
index 80b411296480..000000000000
--- a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
+++ /dev/null
@@ -1,124 +0,0 @@
-Amlogic AXG sound card:
-
-Required properties:
-
-- compatible: "amlogic,axg-sound-card"
-- model : User specified audio sound card name, one string
-
-Optional properties:
-
-- audio-aux-devs : List of phandles pointing to auxiliary devices
-- audio-widgets : Please refer to widgets.txt.
-- audio-routing : A list of the connections between audio components.
-
-Subnodes:
-
-- dai-link: Container for dai-link level properties and the CODEC
- sub-nodes. There should be at least one (and probably more)
- subnode of this type.
-
-Required dai-link properties:
-
-- sound-dai: phandle and port of the CPU DAI.
-
-Required TDM Backend dai-link properties:
-- dai-format : CPU/CODEC common audio format
-
-Optional TDM Backend dai-link properties:
-- dai-tdm-slot-rx-mask-{0,1,2,3}: Receive direction slot masks
-- dai-tdm-slot-tx-mask-{0,1,2,3}: Transmit direction slot masks
- When omitted, mask is assumed to have to no
- slots. A valid must have at one slot, so at
- least one these mask should be provided with
- an enabled slot.
-- dai-tdm-slot-num : Please refer to tdm-slot.txt.
- If omitted, slot number is set to accommodate the largest
- mask provided.
-- dai-tdm-slot-width : Please refer to tdm-slot.txt. default to 32 if omitted.
-- mclk-fs : Multiplication factor between stream rate and mclk
-
-Backend dai-link subnodes:
-
-- codec: dai-link representing backend links should have at least one subnode.
- One subnode for each codec of the dai-link.
- dai-link representing frontend links have no codec, therefore have no
- subnodes
-
-Required codec subnodes properties:
-
-- sound-dai: phandle and port of the CODEC DAI.
-
-Optional codec subnodes properties:
-
-- dai-tdm-slot-tx-mask : Please refer to tdm-slot.txt.
-- dai-tdm-slot-rx-mask : Please refer to tdm-slot.txt.
-
-Example:
-
-sound {
- compatible = "amlogic,axg-sound-card";
- model = "AXG-S420";
- audio-aux-devs = <&tdmin_a>, <&tdmout_c>;
- audio-widgets = "Line", "Lineout",
- "Line", "Linein",
- "Speaker", "Speaker1 Left",
- "Speaker", "Speaker1 Right";
- "Speaker", "Speaker2 Left",
- "Speaker", "Speaker2 Right";
- audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2",
- "SPDIFOUT IN 0", "FRDDR_A OUT 3",
- "TDM_C Playback", "TDMOUT_C OUT",
- "TDMIN_A IN 2", "TDM_C Capture",
- "TDMIN_A IN 5", "TDM_C Loopback",
- "TODDR_A IN 0", "TDMIN_A OUT",
- "Lineout", "Lineout AOUTL",
- "Lineout", "Lineout AOUTR",
- "Speaker1 Left", "SPK1 OUT_A",
- "Speaker2 Left", "SPK2 OUT_A",
- "Speaker1 Right", "SPK1 OUT_B",
- "Speaker2 Right", "SPK2 OUT_B",
- "Linein AINL", "Linein",
- "Linein AINR", "Linein";
-
- dai-link@0 {
- sound-dai = <&frddr_a>;
- };
-
- dai-link@1 {
- sound-dai = <&toddr_a>;
- };
-
- dai-link@2 {
- sound-dai = <&tdmif_c>;
- dai-format = "i2s";
- dai-tdm-slot-tx-mask-2 = <1 1>;
- dai-tdm-slot-tx-mask-3 = <1 1>;
- dai-tdm-slot-rx-mask-1 = <1 1>;
- mclk-fs = <256>;
-
- codec@0 {
- sound-dai = <&lineout>;
- };
-
- codec@1 {
- sound-dai = <&speaker_amp1>;
- };
-
- codec@2 {
- sound-dai = <&speaker_amp2>;
- };
-
- codec@3 {
- sound-dai = <&linein>;
- };
-
- };
-
- dai-link@3 {
- sound-dai = <&spdifout>;
-
- codec {
- sound-dai = <&spdif_dit>;
- };
- };
-};
diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
new file mode 100644
index 000000000000..185cd9fbeda1
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
@@ -0,0 +1,182 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,axg-sound-card.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic AXG sound card
+
+maintainers:
+ - Jerome Brunet <[email protected]>
+
+properties:
+ compatible:
+ items:
+ - const: amlogic,axg-sound-card
+
+ audio-aux-devs:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ description: list of auxiliary devices
+
+ audio-routing:
+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
+ 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.
+
+ audio-widgets:
+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
+ description: |-
+ A list off component DAPM widget. Each entry is a pair of strings,
+ the first being the widget type, the second being the widget name
+
+ model:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: User specified audio sound card name
+
+patternProperties:
+ "^dai-link-[0-9]+$":
+ type: object
+ additionalProperties: false
+ description: |-
+ dai-link child nodes:
+ Container for dai-link level properties and the CODEC sub-nodes.
+ There should be at least one (and probably more) subnode of this type
+
+ properties:
+ dai-format:
+ $ref: /schemas/types.yaml#/definitions/string
+ enum: [ i2s, left-j, dsp_a ]
+
+ dai-tdm-slot-num:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: |
+ Number of slots in use. If omitted, slot number is set to
+ accommodate the largest mask provided.
+ maximum: 32
+
+ dai-tdm-slot-width:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Width in bits for each slot
+ enum: [ 8, 16, 20, 24, 32 ]
+ default: 32
+
+ mclk-fs:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: |-
+ Multiplication factor between the frame rate and master clock
+ rate
+
+ sound-dai:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ description: phandle of the CPU DAI
+
+ patternProperties:
+ "^dai-tdm-slot-(t|r)x-mask-[0-3]$":
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: |-
+ Transmit and receive cpu slot masks of each TDM lane
+ When omitted, mask is assumed to have to no slots. A valid
+ interface must have at least one slot, so at least one these
+ mask should be provided with an enabled slot.
+
+ "^codec(-[0-9]+)?$":
+ type: object
+ additionalProperties: false
+ description: |-
+ dai-link representing backend links should have at least one subnode.
+ One subnode for each codec of the dai-link. dai-link representing
+ frontend links have no codec, therefore have no subnodes
+
+ properties:
+ sound-dai:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ description: phandle of the codec DAI
+
+ patternProperties:
+ "^dai-tdm-slot-(t|r)x-mask$":
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: Transmit and receive codec slot masks
+
+ required:
+ - sound-dai
+
+ required:
+ - sound-dai
+
+required:
+ - model
+ - dai-link-0
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ sound {
+ compatible = "amlogic,axg-sound-card";
+ model = "AXG-S420";
+ audio-aux-devs = <&tdmin_a>, <&tdmout_c>;
+ audio-widgets = "Line", "Lineout",
+ "Line", "Linein",
+ "Speaker", "Speaker1 Left",
+ "Speaker", "Speaker1 Right",
+ "Speaker", "Speaker2 Left",
+ "Speaker", "Speaker2 Right";
+ audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2",
+ "SPDIFOUT IN 0", "FRDDR_A OUT 3",
+ "TDM_C Playback", "TDMOUT_C OUT",
+ "TDMIN_A IN 2", "TDM_C Capture",
+ "TDMIN_A IN 5", "TDM_C Loopback",
+ "TODDR_A IN 0", "TDMIN_A OUT",
+ "Lineout", "Lineout AOUTL",
+ "Lineout", "Lineout AOUTR",
+ "Speaker1 Left", "SPK1 OUT_A",
+ "Speaker2 Left", "SPK2 OUT_A",
+ "Speaker1 Right", "SPK1 OUT_B",
+ "Speaker2 Right", "SPK2 OUT_B",
+ "Linein AINL", "Linein",
+ "Linein AINR", "Linein";
+
+ dai-link-0 {
+ sound-dai = <&frddr_a>;
+ };
+
+ dai-link-1 {
+ sound-dai = <&toddr_a>;
+ };
+
+ dai-link-2 {
+ sound-dai = <&tdmif_c>;
+ dai-format = "i2s";
+ dai-tdm-slot-tx-mask-2 = <1 1>;
+ dai-tdm-slot-tx-mask-3 = <1 1>;
+ dai-tdm-slot-rx-mask-1 = <1 1>;
+ mclk-fs = <256>;
+
+ codec-0 {
+ sound-dai = <&lineout>;
+ };
+
+ codec-1 {
+ sound-dai = <&speaker_amp1>;
+ };
+
+ codec-2 {
+ sound-dai = <&speaker_amp2>;
+ };
+
+ codec-3 {
+ sound-dai = <&linein>;
+ };
+ };
+
+ dai-link-3 {
+ sound-dai = <&spdifout>;
+
+ codec {
+ sound-dai = <&spdif_dit>;
+ };
+ };
+ };
+
--
2.39.0


2023-02-03 07:40:06

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 2/9] ASoC: dt-bindings: meson: fix gx-card codec node regex

On 02/02/2023 19:36, Jerome Brunet wrote:
> 'codec' is a valid node name when there is a single codec
> in the link. Fix the node regular expression to apply this.
>
> Fixes: fd00366b8e41 ("ASoC: meson: gx: add sound card dt-binding documentation")
> Signed-off-by: Jerome Brunet <[email protected]>
> ---

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-02-03 07:43:08

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 3/9] ASoC: dt-bindings: meson: convert axg tdm interface to schema

On 02/02/2023 19:36, Jerome Brunet wrote:
> Convert the DT binding documentation for the Amlogic tdm interface to
> schema.
>
> Signed-off-by: Jerome Brunet <[email protected]>


> +title: Amlogic Audio TDM Interfaces
> +
> +maintainers:
> + - Jerome Brunet <[email protected]>
> +
> +allOf:
> + - $ref: dai-common.yaml#
> +
> +properties:
> + $nodename:
> + pattern: "^audio-controller-.*"

Such pattern is also not correct (see your patch #2), but so far we do
not require node naming from individual schemas, so I propose just to
drop it.

> +
> + compatible:
> + items:

Drop items

> + - const: 'amlogic,axg-tdm-iface'

Drop quotes

> +
> + "#sound-dai-cells":
> + const: 0
> +
> + clocks:
> + minItems: 2
> + items:
> + - description: Bit clock
> + - description: Sample clock
> + - description: Master clock #optional
> +
> + clock-names:
> + minItems: 2
> + items:
> + - const: sclk
> + - const: lrclk
> + - const: mclk
> +
> +required:
> + - compatible
> + - "#sound-dai-cells"
> + - clocks
> + - clock-names
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/axg-audio-clkc.h>
> +
> + tdmif_a: audio-controller-0 {

audio-controller (and drop the label)

> + compatible = "amlogic,axg-tdm-iface";
> + #sound-dai-cells = <0>;
> + clocks = <&clkc_audio AUD_CLKID_MST_A_SCLK>,
> + <&clkc_audio AUD_CLKID_MST_A_LRCLK>,
> + <&clkc_audio AUD_CLKID_MST_A_MCLK>;
> + clock-names = "sclk", "lrclk", "mclk";
> + };

Best regards,
Krzysztof


2023-02-03 07:47:48

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 4/9] ASoC: dt-bindings: meson: convert axg tdm formatters to schema

On 02/02/2023 19:36, Jerome Brunet wrote:
> Convert the DT binding documentation for the Amlogic tdm formatters to
> schema.
>
> Signed-off-by: Jerome Brunet <[email protected]>
> ---
> .../sound/amlogic,axg-tdm-formatters.txt | 36 --------
> .../sound/amlogic,axg-tdm-formatters.yaml | 90 +++++++++++++++++++
> 2 files changed, 90 insertions(+), 36 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt
> create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml
>
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt
> deleted file mode 100644
> index 5996c0cd89c2..000000000000
> --- a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -* Amlogic Audio TDM formatters
> -
> -Required properties:
> -- compatible: 'amlogic,axg-tdmin' or
> - 'amlogic,axg-tdmout' or
> - 'amlogic,g12a-tdmin' or
> - 'amlogic,g12a-tdmout' or
> - 'amlogic,sm1-tdmin' or
> - 'amlogic,sm1-tdmout
> -- reg: physical base address of the controller and length of memory
> - mapped region.
> -- clocks: list of clock phandle, one for each entry clock-names.
> -- clock-names: should contain the following:
> - * "pclk" : peripheral clock.
> - * "sclk" : bit clock.
> - * "sclk_sel" : bit clock input multiplexer.
> - * "lrclk" : sample clock
> - * "lrclk_sel": sample clock input multiplexer
> -
> -Optional property:
> -- resets: phandle to the dedicated reset line of the tdm formatter.
> -
> -Example of TDMOUT_A on the S905X2 SoC:
> -
> -tdmout_a: audio-controller@500 {
> - compatible = "amlogic,axg-tdmout";
> - reg = <0x0 0x500 0x0 0x40>;
> - resets = <&clkc_audio AUD_RESET_TDMOUT_A>;
> - clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>,
> - <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>,
> - <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>,
> - <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>,
> - <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>;
> - clock-names = "pclk", "sclk", "sclk_sel",
> - "lrclk", "lrclk_sel";
> -};
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml
> new file mode 100644
> index 000000000000..f618724411de
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.yaml
> @@ -0,0 +1,90 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/amlogic,axg-tdm-formatters.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Amlogic Audio AXG TDM formatters
> +
> +maintainers:
> + - Jerome Brunet <[email protected]>
> +
> +allOf:
> + - $ref: component-common.yaml#
> +
> +properties:
> + $nodename:
> + pattern: "^audio-controller@.*"

Drop.

> +
> + compatible:
> + oneOf:

Drop oneOf.

> + - enum:
> + - amlogic,g12a-tdmout
> + - amlogic,sm1-tdmout
> + - amlogic,axg-tdmout
> + - amlogic,g12a-tdmin
> + - amlogic,sm1-tdmin
> + - amlogic,axg-tdmin
> +
> + clocks:
> + items:
> + - description: Peripheral clock
> + - description: Bit clock
> + - description: Bit clock input multiplexer
> + - description: Sample clock
> + - description: Sample clock input multiplexer
> +
> + clock-names:
> + items:
> + - const: pclk
> + - const: sclk
> + - const: sclk_sel
> + - const: lrclk
> + - const: lrclk_sel
> +
> + reg:
> + maxItems: 1

Missing property resets

> +
> +required:
> + - compatible
> + - reg
> + - clocks
> + - clock-names
> +
> +if:

Put it under allOf.

> + properties:
> + compatible:
> + contains:
> + enum:
> + - amlogic,g12a-tdmin
> + - amlogic,sm1-tdmin
> + - amlogic,g12a-tdmout
> + - amlogic,sm1-tdmout
> +then:
> + properties:
> + resets:

Properties are defined in top-level. You can disallow it for other variants.

> + items:
> + - description: Dedicated device reset line
> +
> + required:
> + - resets
Best regards,
Krzysztof


2023-02-03 07:49:01

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/9] ASoC: dt-bindings: create component common schema

On 02/02/2023 19:36, Jerome Brunet wrote:
> All DAIs are component but not all components are DAI.
> Move the component properties (sound-name-prefix ATM) to a separate schema
> file so it can be used by non-DAI components, such as auxiliary devices.
>
> Signed-off-by: Jerome Brunet <[email protected]>


> -properties:
> - sound-name-prefix:
> - $ref: /schemas/types.yaml#/definitions/string
> - description: |
> - Card implementing the routing property define the connection between
> - audio components as list of string pair. Component using the same
> - sink/source names may use this property to prepend the name of their
> - sinks/sources with the provided string.
> +allOf:
> + - $ref: component-common.yaml#
>
> +properties:
> '#sound-dai-cells': true
>

Probably we should require sound-dai-cells at some point, but anyway:

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-02-03 08:03:20

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 5/9] ASoC: dt-bindings: meson: convert axg pdm to schema

On 02/02/2023 19:36, Jerome Brunet wrote:
> Convert the DT binding documentation for the Amlogic axg PDM device to
> schema.
>
> Signed-off-by: Jerome Brunet <[email protected]>
> ---
> .../bindings/sound/amlogic,axg-pdm.txt | 29 -------
> .../bindings/sound/amlogic,axg-pdm.yaml | 86 +++++++++++++++++++
> 2 files changed, 86 insertions(+), 29 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt
> create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml
>
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt
> deleted file mode 100644
> index 716878107a24..000000000000
> --- a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -* Amlogic Audio PDM input
> -
> -Required properties:
> -- compatible: 'amlogic,axg-pdm' or
> - 'amlogic,g12a-pdm' or
> - 'amlogic,sm1-pdm'
> -- reg: physical base address of the controller and length of memory
> - mapped region.
> -- clocks: list of clock phandle, one for each entry clock-names.
> -- clock-names: should contain the following:
> - * "pclk" : peripheral clock.
> - * "dclk" : pdm digital clock
> - * "sysclk" : dsp system clock
> -- #sound-dai-cells: must be 0.
> -
> -Optional property:
> -- resets: phandle to the dedicated reset line of the pdm input.
> -
> -Example of PDM on the A113 SoC:
> -
> -pdm: audio-controller@ff632000 {
> - compatible = "amlogic,axg-pdm";
> - reg = <0x0 0xff632000 0x0 0x34>;
> - #sound-dai-cells = <0>;
> - clocks = <&clkc_audio AUD_CLKID_PDM>,
> - <&clkc_audio AUD_CLKID_PDM_DCLK>,
> - <&clkc_audio AUD_CLKID_PDM_SYSCLK>;
> - clock-names = "pclk", "dclk", "sysclk";
> -};
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml
> new file mode 100644
> index 000000000000..d3da2f8ba7b1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-pdm.yaml
> @@ -0,0 +1,86 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/amlogic,axg-pdm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Amlogic Audio AXG PDM input
> +
> +maintainers:
> + - Jerome Brunet <[email protected]>
> +
> +allOf:
> + - $ref: dai-common.yaml#
> +
> +properties:
> + $nodename:
> + pattern: "^audio-controller@.*"

Drop

> +
> + compatible:
> + oneOf:
> + - items:
> + - enum:
> + - amlogic,g12a-pdm
> + - amlogic,sm1-pdm
> + - const:
> + amlogic,axg-pdm

One line.

Please use the same coding style as we have in other bindings or
example-schema.

> + - items:

Drop items

> + - const:
> + amlogic,axg-pdm

Keep in one line.

> +
> + reg:
> + maxItems: 1
> +
> + "#sound-dai-cells":
> + const: 0
> +
> + clocks:
> + items:
> + - description: Peripheral clock
> + - description: PDM digital clock
> + - description: DSP system clock
> +
> + clock-names:
> + items:
> + - const: pclk
> + - const: dclk
> + - const: sysclk
> +
> +required:
> + - compatible
> + - reg
> + - "#sound-dai-cells"
> + - clocks
> + - clock-names
> +
> +if:

Keep in allOf here (need to move ref from top to here)

> + properties:
> + compatible:
> + contains:
> + enum:
> + - amlogic,g12a-pdm
> + - amlogic,sm1-pdm
> +then:
> + properties:
> + resets:
> + items:
> + - description: Dedicated device reset line

Define properties in top level properties.

> +
> + required:
> + - resets
> +
> +unevaluatedProperties: false


Best regards,
Krzysztof


2023-02-03 08:04:31

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 6/9] ASoC: dt-bindings: meson: convert axg fifo to schema

On 02/02/2023 19:36, Jerome Brunet wrote:
> Convert the DT binding documentation for the Amlogic axg audio FIFOs to
> schema.
>
> Signed-off-by: Jerome Brunet <[email protected]>
> ---
> .../bindings/sound/amlogic,axg-fifo.txt | 34 -----
> .../bindings/sound/amlogic,axg-fifo.yaml | 116 ++++++++++++++++++
> 2 files changed, 116 insertions(+), 34 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
> create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
>
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
> deleted file mode 100644
> index fa4545ed81ca..000000000000
> --- a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -* Amlogic Audio FIFO controllers
> -
> -Required properties:
> -- compatible: 'amlogic,axg-toddr' or
> - 'amlogic,axg-toddr' or
> - 'amlogic,g12a-frddr' or
> - 'amlogic,g12a-toddr' or
> - 'amlogic,sm1-frddr' or
> - 'amlogic,sm1-toddr'
> -- reg: physical base address of the controller and length of memory
> - mapped region.
> -- interrupts: interrupt specifier for the fifo.
> -- clocks: phandle to the fifo peripheral clock provided by the audio
> - clock controller.
> -- resets: list of reset phandle, one for each entry reset-names.
> -- reset-names: should contain the following:
> - * "arb" : memory ARB line (required)
> - * "rst" : dedicated device reset line (optional)
> -- #sound-dai-cells: must be 0.
> -- amlogic,fifo-depth: The size of the controller's fifo in bytes. This
> - is useful for determining certain configuration such
> - as the flush threshold of the fifo
> -
> -Example of FRDDR A on the A113 SoC:
> -
> -frddr_a: audio-controller@1c0 {
> - compatible = "amlogic,axg-frddr";
> - reg = <0x0 0x1c0 0x0 0x1c>;
> - #sound-dai-cells = <0>;
> - interrupts = <GIC_SPI 88 IRQ_TYPE_EDGE_RISING>;
> - clocks = <&clkc_audio AUD_CLKID_FRDDR_A>;
> - resets = <&arb AXG_ARB_FRDDR_A>;
> - fifo-depth = <512>;
> -};
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
> new file mode 100644
> index 000000000000..f6222ad08880
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
> @@ -0,0 +1,116 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/amlogic,axg-fifo.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Amlogic AXG Audio FIFO controllers
> +
> +maintainers:
> + - Jerome Brunet <[email protected]>
> +
> +allOf:
> + - $ref: dai-common.yaml#
> +
> +properties:
> + $nodename:
> + pattern: "^audio-controller@.*"
> +
> + compatible:
> + oneOf:
> + - items:
> + - enum:
> + - amlogic,axg-toddr
> + - amlogic,axg-frddr
> + - items:
> + - enum:
> + - amlogic,g12a-toddr
> + - amlogic,sm1-toddr
> + - const:
> + amlogic,axg-toddr
> + - items:
> + - enum:
> + - amlogic,g12a-frddr
> + - amlogic,sm1-frddr
> + - const:
> + amlogic,axg-frddr
> +

All usual comments apply.

> + reg:
> + maxItems: 1
> +
> + "#sound-dai-cells":
> + const: 0
> +
> + clocks:
> + items:
> + - description: Peripheral clock
> +
> + interrupts:
> + maxItems: 1
> +
> + resets:
> + items:
> + - description: Memory ARB line
> + - description: Dedicated device reset line

This won't work without minItems and you should see errors on your DTS
or in dt_binding_check

> +
> + reset-names: true

minItems
maxItems

> +
> + amlogic,fifo-depth:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Size of the controller's fifo in bytes
> +
> +required:

Best regards,
Krzysztof


2023-02-03 08:05:45

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 7/9] ASoC: dt-bindings: meson: convert axg spdif input to schema

On 02/02/2023 19:36, Jerome Brunet wrote:
> Convert the DT binding documentation for the Amlogic axg spdif input to
> schema.
>
> Signed-off-by: Jerome Brunet <[email protected]>
> ---
> .../bindings/sound/amlogic,axg-spdifin.txt | 27 ------
> .../bindings/sound/amlogic,axg-spdifin.yaml | 90 +++++++++++++++++++
> 2 files changed, 90 insertions(+), 27 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
> create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml
>
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
> deleted file mode 100644
> index df92a4ecf288..000000000000
> --- a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -* Amlogic Audio SPDIF Input
> -
> -Required properties:
> -- compatible: 'amlogic,axg-spdifin' or
> - 'amlogic,g12a-spdifin' or
> - 'amlogic,sm1-spdifin'
> -- interrupts: interrupt specifier for the spdif input.
> -- clocks: list of clock phandle, one for each entry clock-names.
> -- clock-names: should contain the following:
> - * "pclk" : peripheral clock.
> - * "refclk" : spdif input reference clock
> -- #sound-dai-cells: must be 0.
> -
> -Optional property:
> -- resets: phandle to the dedicated reset line of the spdif input.
> -
> -Example on the A113 SoC:
> -
> -spdifin: audio-controller@400 {
> - compatible = "amlogic,axg-spdifin";
> - reg = <0x0 0x400 0x0 0x30>;
> - #sound-dai-cells = <0>;
> - interrupts = <GIC_SPI 87 IRQ_TYPE_EDGE_RISING>;
> - clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
> - <&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
> - clock-names = "pclk", "refclk";
> -};
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml
> new file mode 100644
> index 000000000000..4f7e4c21acc1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.yaml
> @@ -0,0 +1,90 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/amlogic,axg-spdifin.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Amlogic Audio AXG SPDIF Input
> +
> +maintainers:
> + - Jerome Brunet <[email protected]>
> +
> +allOf:
> + - $ref: dai-common.yaml#
> +
> +properties:
> + $nodename:
> + pattern: "^audio-controller@.*"
> +
> + compatible:
> + oneOf:
> + - items:

All usual comments apply.

> + - const:
> + amlogic,axg-spdifin
> + - items:
> + - enum:
> + - amlogic,g12a-spdifin
> + - amlogic,sm1-spdifin
> + - const:
> + amlogic,axg-spdifin

All usual comments apply.

> +
> + reg:
> + maxItems: 1
> +
> + "#sound-dai-cells":
> + const: 0
> +
> + clocks:
> + items:
> + - description: Peripheral clock
> + - description: SPDIF input reference clock
> +
> + clock-names:
> + items:
> + - const: pclk
> + - const: refclk
> +
> + interrupts:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> + - "#sound-dai-cells"
> + - clocks
> + - clock-names
> + - interrupts
> +
> +if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - amlogic,g12a-spdifin
> + - amlogic,sm1-spdifin
> +then:
> + properties:
> + resets:
> + items:
> + - description: dedicated device reset line
> +
> + required:
> + - resets
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/axg-audio-clkc.h>
> + #include <dt-bindings/interrupt-controller/irq.h>
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> + spdifin: audio-controller@400 {
> + compatible = "amlogic,axg-spdifin";

Fix indentation.


Best regards,
Krzysztof


2023-02-03 08:06:01

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 8/9] ASoC: dt-bindings: meson: convert axg spdif output to schema

On 02/02/2023 19:36, Jerome Brunet wrote:
> Convert the DT binding documentation for the Amlogic axg spdif output to
> schema.
>
> Signed-off-by: Jerome Brunet <[email protected]>
> ---
> .../bindings/sound/amlogic,axg-spdifout.txt | 25 ------
> .../bindings/sound/amlogic,axg-spdifout.yaml | 83 +++++++++++++++++++
> 2 files changed, 83 insertions(+), 25 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt
> create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml
>
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt
> deleted file mode 100644
> index 28381dd1f633..000000000000
> --- a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -* Amlogic Audio SPDIF Output
> -
> -Required properties:
> -- compatible: 'amlogic,axg-spdifout' or
> - 'amlogic,g12a-spdifout' or
> - 'amlogic,sm1-spdifout'
> -- clocks: list of clock phandle, one for each entry clock-names.
> -- clock-names: should contain the following:
> - * "pclk" : peripheral clock.
> - * "mclk" : master clock
> -- #sound-dai-cells: must be 0.
> -
> -Optional property:
> -- resets: phandle to the dedicated reset line of the spdif output.
> -
> -Example on the A113 SoC:
> -
> -spdifout: audio-controller@480 {
> - compatible = "amlogic,axg-spdifout";
> - reg = <0x0 0x480 0x0 0x50>;
> - #sound-dai-cells = <0>;
> - clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
> - <&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
> - clock-names = "pclk", "mclk";
> -};
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml
> new file mode 100644
> index 000000000000..c661ce7f8b9d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.yaml
> @@ -0,0 +1,83 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/amlogic,axg-spdifout.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Amlogic Audio AXG SPDIF Output
> +
> +maintainers:
> + - Jerome Brunet <[email protected]>
> +
> +allOf:
> + - $ref: dai-common.yaml#
> +
> +properties:
> + $nodename:
> + pattern: "^audio-controller@.*"
> +
> + compatible:
> + oneOf:
> + - items:
> + - const:
> + amlogic,axg-spdifout

All usual comments apply.

> + - items:
> + - enum:
> + - amlogic,g12a-spdifout
> + - amlogic,sm1-spdifout
> + - const:
> + amlogic,axg-spdifout
> +
> + reg:
> + maxItems: 1
> +
> + "#sound-dai-cells":
> + const: 0
> +
> + clocks:
> + items:
> + - description: Peripheral clock
> + - description: SPDIF output master clock
> +
> + clock-names:
> + items:
> + - const: pclk
> + - const: mclk
> +
> +required:
> + - compatible
> + - reg
> + - "#sound-dai-cells"
> + - clocks
> + - clock-names
> +
> +if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - amlogic,g12a-spdifout
> + - amlogic,sm1-spdifout
> +then:
> + properties:
> + resets:
> + items:
> + - description: dedicated device reset line
> +
> + required:
> + - resets
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/axg-audio-clkc.h>
> +
> + spdifout: audio-controller@480 {
> + compatible = "amlogic,axg-spdifout";

Indentation.


Best regards,
Krzysztof


2023-02-03 08:11:27

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 9/9] ASoC: dt-bindings: meson: convert axg sound card control to schema

On 02/02/2023 19:36, Jerome Brunet wrote:
> Convert the DT binding documentation for the Amlogic axg sound card to
> schema.
>
> Signed-off-by: Jerome Brunet <[email protected]>
> ---
> .../bindings/sound/amlogic,axg-sound-card.txt | 124 ------------
> .../sound/amlogic,axg-sound-card.yaml | 182 ++++++++++++++++++
> 2 files changed, 182 insertions(+), 124 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
> create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
>
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
> deleted file mode 100644
> index 80b411296480..000000000000
> --- a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
> +++ /dev/null
> @@ -1,124 +0,0 @@
> -Amlogic AXG sound card:
> -
> -Required properties:
> -
> -- compatible: "amlogic,axg-sound-card"
> -- model : User specified audio sound card name, one string
> -
> -Optional properties:
> -
> -- audio-aux-devs : List of phandles pointing to auxiliary devices
> -- audio-widgets : Please refer to widgets.txt.
> -- audio-routing : A list of the connections between audio components.
> -
> -Subnodes:
> -
> -- dai-link: Container for dai-link level properties and the CODEC
> - sub-nodes. There should be at least one (and probably more)
> - subnode of this type.
> -
> -Required dai-link properties:
> -
> -- sound-dai: phandle and port of the CPU DAI.
> -
> -Required TDM Backend dai-link properties:
> -- dai-format : CPU/CODEC common audio format
> -
> -Optional TDM Backend dai-link properties:
> -- dai-tdm-slot-rx-mask-{0,1,2,3}: Receive direction slot masks
> -- dai-tdm-slot-tx-mask-{0,1,2,3}: Transmit direction slot masks
> - When omitted, mask is assumed to have to no
> - slots. A valid must have at one slot, so at
> - least one these mask should be provided with
> - an enabled slot.
> -- dai-tdm-slot-num : Please refer to tdm-slot.txt.
> - If omitted, slot number is set to accommodate the largest
> - mask provided.
> -- dai-tdm-slot-width : Please refer to tdm-slot.txt. default to 32 if omitted.
> -- mclk-fs : Multiplication factor between stream rate and mclk
> -
> -Backend dai-link subnodes:
> -
> -- codec: dai-link representing backend links should have at least one subnode.
> - One subnode for each codec of the dai-link.
> - dai-link representing frontend links have no codec, therefore have no
> - subnodes
> -
> -Required codec subnodes properties:
> -
> -- sound-dai: phandle and port of the CODEC DAI.
> -
> -Optional codec subnodes properties:
> -
> -- dai-tdm-slot-tx-mask : Please refer to tdm-slot.txt.
> -- dai-tdm-slot-rx-mask : Please refer to tdm-slot.txt.
> -
> -Example:
> -
> -sound {
> - compatible = "amlogic,axg-sound-card";
> - model = "AXG-S420";
> - audio-aux-devs = <&tdmin_a>, <&tdmout_c>;
> - audio-widgets = "Line", "Lineout",
> - "Line", "Linein",
> - "Speaker", "Speaker1 Left",
> - "Speaker", "Speaker1 Right";
> - "Speaker", "Speaker2 Left",
> - "Speaker", "Speaker2 Right";
> - audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2",
> - "SPDIFOUT IN 0", "FRDDR_A OUT 3",
> - "TDM_C Playback", "TDMOUT_C OUT",
> - "TDMIN_A IN 2", "TDM_C Capture",
> - "TDMIN_A IN 5", "TDM_C Loopback",
> - "TODDR_A IN 0", "TDMIN_A OUT",
> - "Lineout", "Lineout AOUTL",
> - "Lineout", "Lineout AOUTR",
> - "Speaker1 Left", "SPK1 OUT_A",
> - "Speaker2 Left", "SPK2 OUT_A",
> - "Speaker1 Right", "SPK1 OUT_B",
> - "Speaker2 Right", "SPK2 OUT_B",
> - "Linein AINL", "Linein",
> - "Linein AINR", "Linein";
> -
> - dai-link@0 {
> - sound-dai = <&frddr_a>;
> - };
> -
> - dai-link@1 {
> - sound-dai = <&toddr_a>;
> - };
> -
> - dai-link@2 {
> - sound-dai = <&tdmif_c>;
> - dai-format = "i2s";
> - dai-tdm-slot-tx-mask-2 = <1 1>;
> - dai-tdm-slot-tx-mask-3 = <1 1>;
> - dai-tdm-slot-rx-mask-1 = <1 1>;
> - mclk-fs = <256>;
> -
> - codec@0 {
> - sound-dai = <&lineout>;
> - };
> -
> - codec@1 {
> - sound-dai = <&speaker_amp1>;
> - };
> -
> - codec@2 {
> - sound-dai = <&speaker_amp2>;
> - };
> -
> - codec@3 {
> - sound-dai = <&linein>;
> - };
> -
> - };
> -
> - dai-link@3 {
> - sound-dai = <&spdifout>;
> -
> - codec {
> - sound-dai = <&spdif_dit>;
> - };
> - };
> -};
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
> new file mode 100644
> index 000000000000..185cd9fbeda1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
> @@ -0,0 +1,182 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/amlogic,axg-sound-card.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Amlogic AXG sound card
> +
> +maintainers:
> + - Jerome Brunet <[email protected]>
> +
> +properties:
> + compatible:
> + items:

Drop

> + - const: amlogic,axg-sound-card

And here you can keep such code in one line?

> +
> + audio-aux-devs:
> + $ref: /schemas/types.yaml#/definitions/phandle-array
> + description: list of auxiliary devices

min/maxItems

> +
> + audio-routing:
> + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> + 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.
> +
> + audio-widgets:
> + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> + description: |-
> + A list off component DAPM widget. Each entry is a pair of strings,
> + the first being the widget type, the second being the widget name
> +
> + model:
> + $ref: /schemas/types.yaml#/definitions/string
> + description: User specified audio sound card name
> +
> +patternProperties:
> + "^dai-link-[0-9]+$":
> + type: object
> + additionalProperties: false
> + description: |-

Drop |-

> + dai-link child nodes:

Drop, this is not a property list.

> + Container for dai-link level properties and the CODEC sub-nodes.
> + There should be at least one (and probably more) subnode of this type
> +
> + properties:
> + dai-format:
> + $ref: /schemas/types.yaml#/definitions/string
> + enum: [ i2s, left-j, dsp_a ]
> +
> + dai-tdm-slot-num:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: |
> + Number of slots in use. If omitted, slot number is set to
> + accommodate the largest mask provided.
> + maximum: 32
> +
> + dai-tdm-slot-width:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Width in bits for each slot
> + enum: [ 8, 16, 20, 24, 32 ]
> + default: 32
> +
> + mclk-fs:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: |-

Drop |-
Drop it everywhere where not needed

> + Multiplication factor between the frame rate and master clock
> + rate
> +
> + sound-dai:
> + $ref: /schemas/types.yaml#/definitions/phandle-array

Old binding was saying it is just phandle

> + description: phandle of the CPU DAI
> +
> + patternProperties:
> + "^dai-tdm-slot-(t|r)x-mask-[0-3]$":
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description: |-

Drop |-

> + Transmit and receive cpu slot masks of each TDM lane
> + When omitted, mask is assumed to have to no slots. A valid
> + interface must have at least one slot, so at least one these
> + mask should be provided with an enabled slot.
> +
> + "^codec(-[0-9]+)?$":
> + type: object
> + additionalProperties: false
> + description: |-
> + dai-link representing backend links should have at least one subnode.
> + One subnode for each codec of the dai-link. dai-link representing
> + frontend links have no codec, therefore have no subnodes
> +
> + properties:
> + sound-dai:
> + $ref: /schemas/types.yaml#/definitions/phandle-array

phandle

> + description: phandle of the codec DAI
> +
> + patternProperties:
> + "^dai-tdm-slot-(t|r)x-mask$":
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description: Transmit and receive codec slot masks

Are you sure codec has dai-tdm-slot-....?

> +
> + required:
> + - sound-dai
> +
> + required:
> + - sound-dai
> +
> +required:
> + - model
> + - dai-link-0
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + sound {
> + compatible = "amlogic,axg-sound-card";
> + model = "AXG-S420";
> + audio-aux-devs = <&tdmin_a>, <&tdmout_c>;
> + audio-widgets = "Line", "Lineout",
> + "Line", "Linein",
> + "Speaker", "Speaker1 Left",
> + "Speaker", "Speaker1 Right",
> + "Speaker", "Speaker2 Left",
> + "Speaker", "Speaker2 Right";
> + audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2",
> + "SPDIFOUT IN 0", "FRDDR_A OUT 3",
> + "TDM_C Playback", "TDMOUT_C OUT",
> + "TDMIN_A IN 2", "TDM_C Capture",
> + "TDMIN_A IN 5", "TDM_C Loopback",
> + "TODDR_A IN 0", "TDMIN_A OUT",
> + "Lineout", "Lineout AOUTL",
> + "Lineout", "Lineout AOUTR",
> + "Speaker1 Left", "SPK1 OUT_A",
> + "Speaker2 Left", "SPK2 OUT_A",
> + "Speaker1 Right", "SPK1 OUT_B",
> + "Speaker2 Right", "SPK2 OUT_B",
> + "Linein AINL", "Linein",
> + "Linein AINR", "Linein";
> +
> + dai-link-0 {
> + sound-dai = <&frddr_a>;

Use 4 spaces for example indentation.

> + };
> +
> + dai-link-1 {
> + sound-dai = <&toddr_a>;
> + };

Best regards,
Krzysztof


2023-02-03 09:41:10

by Jerome Brunet

[permalink] [raw]
Subject: Re: [PATCH 5/9] ASoC: dt-bindings: meson: convert axg pdm to schema


On Fri 03 Feb 2023 at 09:01, Krzysztof Kozlowski <[email protected]> wrote:

> On 02/02/2023 19:36, Jerome Brunet wrote:

[...]

>> +required:
>> + - compatible
>> + - reg
>> + - "#sound-dai-cells"
>> + - clocks
>> + - clock-names
>> +
>> +if:
>
> Keep in allOf here (need to move ref from top to here)
>

I'm not sure I get it. As it is, it seems to have the effect I had in
mind while trying with dt_bindings_check.

What does it do when putting the conditional under the AllOf section ?

>> + properties:
>> + compatible:
>> + contains:
>> + enum:
>> + - amlogic,g12a-pdm
>> + - amlogic,sm1-pdm
>> +then:
>> + properties:
>> + resets:
>> + items:
>> + - description: Dedicated device reset line
>
> Define properties in top level properties.
>
>> +
>> + required:
>> + - resets
>> +
>> +unevaluatedProperties: false
>
>
> Best regards,
> Krzysztof


2023-02-03 10:18:00

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 5/9] ASoC: dt-bindings: meson: convert axg pdm to schema

On 03/02/2023 10:37, Jerome Brunet wrote:
>
> On Fri 03 Feb 2023 at 09:01, Krzysztof Kozlowski <[email protected]> wrote:
>
>> On 02/02/2023 19:36, Jerome Brunet wrote:
>
> [...]
>
>>> +required:
>>> + - compatible
>>> + - reg
>>> + - "#sound-dai-cells"
>>> + - clocks
>>> + - clock-names
>>> +
>>> +if:
>>
>> Keep in allOf here (need to move ref from top to here)
>>
>
> I'm not sure I get it. As it is, it seems to have the effect I had in
> mind while trying with dt_bindings_check.
>
> What does it do when putting the conditional under the AllOf section ?

It avoids any future re-indents if you need to add one more if clause.

Best regards,
Krzysztof


2023-02-03 13:43:24

by Jerome Brunet

[permalink] [raw]
Subject: Re: [PATCH 6/9] ASoC: dt-bindings: meson: convert axg fifo to schema


On Fri 03 Feb 2023 at 09:02, Krzysztof Kozlowski <[email protected]> wrote:

> On 02/02/2023 19:36, Jerome Brunet wrote:
>> Convert the DT binding documentation for the Amlogic axg audio FIFOs to
>> schema.
>>
>> Signed-off-by: Jerome Brunet <[email protected]>
>> ---
>> .../bindings/sound/amlogic,axg-fifo.txt | 34 -----
>> .../bindings/sound/amlogic,axg-fifo.yaml | 116 ++++++++++++++++++
>> 2 files changed, 116 insertions(+), 34 deletions(-)
>> delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
>> create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
>> deleted file mode 100644
>> index fa4545ed81ca..000000000000
>> --- a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt
>> +++ /dev/null
>> @@ -1,34 +0,0 @@
>> -* Amlogic Audio FIFO controllers
>> -
>> -Required properties:
>> -- compatible: 'amlogic,axg-toddr' or
>> - 'amlogic,axg-toddr' or
>> - 'amlogic,g12a-frddr' or
>> - 'amlogic,g12a-toddr' or
>> - 'amlogic,sm1-frddr' or
>> - 'amlogic,sm1-toddr'
>> -- reg: physical base address of the controller and length of memory
>> - mapped region.
>> -- interrupts: interrupt specifier for the fifo.
>> -- clocks: phandle to the fifo peripheral clock provided by the audio
>> - clock controller.
>> -- resets: list of reset phandle, one for each entry reset-names.
>> -- reset-names: should contain the following:
>> - * "arb" : memory ARB line (required)
>> - * "rst" : dedicated device reset line (optional)
>> -- #sound-dai-cells: must be 0.
>> -- amlogic,fifo-depth: The size of the controller's fifo in bytes. This
>> - is useful for determining certain configuration such
>> - as the flush threshold of the fifo
>> -
>> -Example of FRDDR A on the A113 SoC:
>> -
>> -frddr_a: audio-controller@1c0 {
>> - compatible = "amlogic,axg-frddr";
>> - reg = <0x0 0x1c0 0x0 0x1c>;
>> - #sound-dai-cells = <0>;
>> - interrupts = <GIC_SPI 88 IRQ_TYPE_EDGE_RISING>;
>> - clocks = <&clkc_audio AUD_CLKID_FRDDR_A>;
>> - resets = <&arb AXG_ARB_FRDDR_A>;
>> - fifo-depth = <512>;
>> -};
>> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
>> new file mode 100644
>> index 000000000000..f6222ad08880
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml
>> @@ -0,0 +1,116 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/sound/amlogic,axg-fifo.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Amlogic AXG Audio FIFO controllers
>> +
>> +maintainers:
>> + - Jerome Brunet <[email protected]>
>> +
>> +allOf:
>> + - $ref: dai-common.yaml#
>> +
>> +properties:
>> + $nodename:
>> + pattern: "^audio-controller@.*"
>> +
>> + compatible:
>> + oneOf:
>> + - items:
>> + - enum:
>> + - amlogic,axg-toddr
>> + - amlogic,axg-frddr
>> + - items:
>> + - enum:
>> + - amlogic,g12a-toddr
>> + - amlogic,sm1-toddr
>> + - const:
>> + amlogic,axg-toddr
>> + - items:
>> + - enum:
>> + - amlogic,g12a-frddr
>> + - amlogic,sm1-frddr
>> + - const:
>> + amlogic,axg-frddr
>> +
>
> All usual comments apply.
>
>> + reg:
>> + maxItems: 1
>> +
>> + "#sound-dai-cells":
>> + const: 0
>> +
>> + clocks:
>> + items:
>> + - description: Peripheral clock
>> +
>> + interrupts:
>> + maxItems: 1
>> +
>> + resets:
>> + items:
>> + - description: Memory ARB line
>> + - description: Dedicated device reset line
>
> This won't work without minItems and you should see errors on your DTS
> or in dt_binding_check
>

The example provided here worked but there is indeed a warning with the
axg-frddr variant.

I'm adding a 2nd example so it does not happen again.

>> +
>> + reset-names: true
>
> minItems
> maxItems

Adding this causes troubles with the reset-names definitions in the 'if'
clause. If I put min: 1, max: 2 and min: 2 in the 'then' clause I get:

> Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml: allOf:1:then:properties:reset-names: 'oneOf' conditional failed, one must be fixed:
> [{'const': 'arb'}, {'const': 'rst'}] is too long
> [{'const': 'arb'}, {'const': 'rst'}] is too short
> False schema does not allow 2
> 1 was expected
> hint: "minItems" is only needed if less than the "items" list length
> from schema $id: http://devicetree.org/meta-schemas/items.yaml#

The older devices just have the 'arb' reset.
Newer devices have a 2nd reset line (called rst here)

If I just restrict the min and max, it would be valid for the older
devices to have 'rst' only - but it is not valid.

With just 'true', it works as expected (throw errors if an incorrect
name or number of names is passed). Min and Max comes from the items list.

Any suggestions ?

>
>> +
>> + amlogic,fifo-depth:
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + description: Size of the controller's fifo in bytes
>> +
>> +required:
>
> Best regards,
> Krzysztof


2023-02-03 14:28:44

by Jerome Brunet

[permalink] [raw]
Subject: Re: [PATCH 9/9] ASoC: dt-bindings: meson: convert axg sound card control to schema


On Fri 03 Feb 2023 at 09:09, Krzysztof Kozlowski <[email protected]> wrote:

> On 02/02/2023 19:36, Jerome Brunet wrote:
>> Convert the DT binding documentation for the Amlogic axg sound card to
>> schema.
>>
>> Signed-off-by: Jerome Brunet <[email protected]>
>> ---
>> .../bindings/sound/amlogic,axg-sound-card.txt | 124 ------------
>> .../sound/amlogic,axg-sound-card.yaml | 182 ++++++++++++++++++
>> 2 files changed, 182 insertions(+), 124 deletions(-)
>> delete mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
>> create mode 100644 Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
>> deleted file mode 100644
>> index 80b411296480..000000000000
>> --- a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.txt
>> +++ /dev/null
>> @@ -1,124 +0,0 @@
>> -Amlogic AXG sound card:
>> -
>> -Required properties:
>> -
>> -- compatible: "amlogic,axg-sound-card"
>> -- model : User specified audio sound card name, one string
>> -
>> -Optional properties:
>> -
>> -- audio-aux-devs : List of phandles pointing to auxiliary devices
>> -- audio-widgets : Please refer to widgets.txt.
>> -- audio-routing : A list of the connections between audio components.
>> -
>> -Subnodes:
>> -
>> -- dai-link: Container for dai-link level properties and the CODEC
>> - sub-nodes. There should be at least one (and probably more)
>> - subnode of this type.
>> -
>> -Required dai-link properties:
>> -
>> -- sound-dai: phandle and port of the CPU DAI.
>> -
>> -Required TDM Backend dai-link properties:
>> -- dai-format : CPU/CODEC common audio format
>> -
>> -Optional TDM Backend dai-link properties:
>> -- dai-tdm-slot-rx-mask-{0,1,2,3}: Receive direction slot masks
>> -- dai-tdm-slot-tx-mask-{0,1,2,3}: Transmit direction slot masks
>> - When omitted, mask is assumed to have to no
>> - slots. A valid must have at one slot, so at
>> - least one these mask should be provided with
>> - an enabled slot.
>> -- dai-tdm-slot-num : Please refer to tdm-slot.txt.
>> - If omitted, slot number is set to accommodate the largest
>> - mask provided.
>> -- dai-tdm-slot-width : Please refer to tdm-slot.txt. default to 32 if omitted.
>> -- mclk-fs : Multiplication factor between stream rate and mclk
>> -
>> -Backend dai-link subnodes:
>> -
>> -- codec: dai-link representing backend links should have at least one subnode.
>> - One subnode for each codec of the dai-link.
>> - dai-link representing frontend links have no codec, therefore have no
>> - subnodes
>> -
>> -Required codec subnodes properties:
>> -
>> -- sound-dai: phandle and port of the CODEC DAI.
>> -
>> -Optional codec subnodes properties:
>> -
>> -- dai-tdm-slot-tx-mask : Please refer to tdm-slot.txt.
>> -- dai-tdm-slot-rx-mask : Please refer to tdm-slot.txt.
>> -
>> -Example:
>> -
>> -sound {
>> - compatible = "amlogic,axg-sound-card";
>> - model = "AXG-S420";
>> - audio-aux-devs = <&tdmin_a>, <&tdmout_c>;
>> - audio-widgets = "Line", "Lineout",
>> - "Line", "Linein",
>> - "Speaker", "Speaker1 Left",
>> - "Speaker", "Speaker1 Right";
>> - "Speaker", "Speaker2 Left",
>> - "Speaker", "Speaker2 Right";
>> - audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2",
>> - "SPDIFOUT IN 0", "FRDDR_A OUT 3",
>> - "TDM_C Playback", "TDMOUT_C OUT",
>> - "TDMIN_A IN 2", "TDM_C Capture",
>> - "TDMIN_A IN 5", "TDM_C Loopback",
>> - "TODDR_A IN 0", "TDMIN_A OUT",
>> - "Lineout", "Lineout AOUTL",
>> - "Lineout", "Lineout AOUTR",
>> - "Speaker1 Left", "SPK1 OUT_A",
>> - "Speaker2 Left", "SPK2 OUT_A",
>> - "Speaker1 Right", "SPK1 OUT_B",
>> - "Speaker2 Right", "SPK2 OUT_B",
>> - "Linein AINL", "Linein",
>> - "Linein AINR", "Linein";
>> -
>> - dai-link@0 {
>> - sound-dai = <&frddr_a>;
>> - };
>> -
>> - dai-link@1 {
>> - sound-dai = <&toddr_a>;
>> - };
>> -
>> - dai-link@2 {
>> - sound-dai = <&tdmif_c>;
>> - dai-format = "i2s";
>> - dai-tdm-slot-tx-mask-2 = <1 1>;
>> - dai-tdm-slot-tx-mask-3 = <1 1>;
>> - dai-tdm-slot-rx-mask-1 = <1 1>;
>> - mclk-fs = <256>;
>> -
>> - codec@0 {
>> - sound-dai = <&lineout>;
>> - };
>> -
>> - codec@1 {
>> - sound-dai = <&speaker_amp1>;
>> - };
>> -
>> - codec@2 {
>> - sound-dai = <&speaker_amp2>;
>> - };
>> -
>> - codec@3 {
>> - sound-dai = <&linein>;
>> - };
>> -
>> - };
>> -
>> - dai-link@3 {
>> - sound-dai = <&spdifout>;
>> -
>> - codec {
>> - sound-dai = <&spdif_dit>;
>> - };
>> - };
>> -};
>> diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
>> new file mode 100644
>> index 000000000000..185cd9fbeda1
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
>> @@ -0,0 +1,182 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/sound/amlogic,axg-sound-card.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Amlogic AXG sound card
>> +
>> +maintainers:
>> + - Jerome Brunet <[email protected]>
>> +
>> +properties:
>> + compatible:
>> + items:
>
> Drop
>
>> + - const: amlogic,axg-sound-card
>
> And here you can keep such code in one line?
>
>> +
>> + audio-aux-devs:
>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>> + description: list of auxiliary devices
>
> min/maxItems

Auxiliary devices are not mandatory and there is no limit on how many a
sound card may have. Any number of item is valid.

>
>> +
>> + audio-routing:
>> + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
>> + 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.
>> +
>> + audio-widgets:
>> + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
>> + description: |-
>> + A list off component DAPM widget. Each entry is a pair of strings,
>> + the first being the widget type, the second being the widget name
>> +
>> + model:
>> + $ref: /schemas/types.yaml#/definitions/string
>> + description: User specified audio sound card name
>> +
>> +patternProperties:
>> + "^dai-link-[0-9]+$":
>> + type: object
>> + additionalProperties: false
>> + description: |-
>
> Drop |-
>
>> + dai-link child nodes:
>
> Drop, this is not a property list.
>
>> + Container for dai-link level properties and the CODEC sub-nodes.
>> + There should be at least one (and probably more) subnode of this type
>> +
>> + properties:
>> + dai-format:
>> + $ref: /schemas/types.yaml#/definitions/string
>> + enum: [ i2s, left-j, dsp_a ]
>> +
>> + dai-tdm-slot-num:
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + description: |
>> + Number of slots in use. If omitted, slot number is set to
>> + accommodate the largest mask provided.
>> + maximum: 32
>> +
>> + dai-tdm-slot-width:
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + description: Width in bits for each slot
>> + enum: [ 8, 16, 20, 24, 32 ]
>> + default: 32
>> +
>> + mclk-fs:
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + description: |-
>
> Drop |-
> Drop it everywhere where not needed
>
>> + Multiplication factor between the frame rate and master clock
>> + rate
>> +
>> + sound-dai:
>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>
> Old binding was saying it is just phandle

It is just a phandle but the bindings used to have problem with phandle
that had cells.

See:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml?h=v6.2-rc6&id=d031d99b02eaf7363c33f5b27b38086cc8104082

Was it wrong or did the situation change since then ?

>
>> + description: phandle of the CPU DAI
>> +
>> + patternProperties:
>> + "^dai-tdm-slot-(t|r)x-mask-[0-3]$":
>> + $ref: /schemas/types.yaml#/definitions/uint32-array
>> + description: |-
>
> Drop |-
>
>> + Transmit and receive cpu slot masks of each TDM lane
>> + When omitted, mask is assumed to have to no slots. A valid
>> + interface must have at least one slot, so at least one these
>> + mask should be provided with an enabled slot.
>> +
>> + "^codec(-[0-9]+)?$":
>> + type: object
>> + additionalProperties: false
>> + description: |-
>> + dai-link representing backend links should have at least one subnode.
>> + One subnode for each codec of the dai-link. dai-link representing
>> + frontend links have no codec, therefore have no subnodes
>> +
>> + properties:
>> + sound-dai:
>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>
> phandle
>
>> + description: phandle of the codec DAI
>> +
>> + patternProperties:
>> + "^dai-tdm-slot-(t|r)x-mask$":
>> + $ref: /schemas/types.yaml#/definitions/uint32-array
>> + description: Transmit and receive codec slot masks
>
> Are you sure codec has dai-tdm-slot-....?

Yes. Both CPU and and codecs have slots.

A classic case is a CPU with 2 codecs attached
Codec #0 plays slots 0,1
Codec #1 plays slots 2,3

CPU tx slots is <1, 1, 1, 1>
Codec #0 rx slots is <1, 1, 0, 0>
Codec #1 rx slots is <0, 0, 1, 1>

>
>> +
>> + required:
>> + - sound-dai
>> +
>> + required:
>> + - sound-dai
>> +
>> +required:
>> + - model
>> + - dai-link-0
>> +
>> +unevaluatedProperties: false
>> +
>> +examples:
>> + - |
>> + sound {
>> + compatible = "amlogic,axg-sound-card";
>> + model = "AXG-S420";
>> + audio-aux-devs = <&tdmin_a>, <&tdmout_c>;
>> + audio-widgets = "Line", "Lineout",
>> + "Line", "Linein",
>> + "Speaker", "Speaker1 Left",
>> + "Speaker", "Speaker1 Right",
>> + "Speaker", "Speaker2 Left",
>> + "Speaker", "Speaker2 Right";
>> + audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2",
>> + "SPDIFOUT IN 0", "FRDDR_A OUT 3",
>> + "TDM_C Playback", "TDMOUT_C OUT",
>> + "TDMIN_A IN 2", "TDM_C Capture",
>> + "TDMIN_A IN 5", "TDM_C Loopback",
>> + "TODDR_A IN 0", "TDMIN_A OUT",
>> + "Lineout", "Lineout AOUTL",
>> + "Lineout", "Lineout AOUTR",
>> + "Speaker1 Left", "SPK1 OUT_A",
>> + "Speaker2 Left", "SPK2 OUT_A",
>> + "Speaker1 Right", "SPK1 OUT_B",
>> + "Speaker2 Right", "SPK2 OUT_B",
>> + "Linein AINL", "Linein",
>> + "Linein AINR", "Linein";
>> +
>> + dai-link-0 {
>> + sound-dai = <&frddr_a>;
>
> Use 4 spaces for example indentation.
>
>> + };
>> +
>> + dai-link-1 {
>> + sound-dai = <&toddr_a>;
>> + };
>
> Best regards,
> Krzysztof


2023-02-03 14:56:13

by Mark Brown

[permalink] [raw]
Subject: Re: (subset) [PATCH 0/9] ASoC: dt-bindings: meson: covert axg audio to schema

On Thu, 02 Feb 2023 19:36:44 +0100, Jerome Brunet wrote:
> Convert AXG audio dt-binding documentation to schema
>
> Jerome Brunet (9):
> ASoC: dt-bindings: create component common schema
> ASoC: dt-bindings: meson: fix gx-card codec node regex
> ASoC: dt-bindings: meson: convert axg tdm interface to schema
> ASoC: dt-bindings: meson: convert axg tdm formatters to schema
> ASoC: dt-bindings: meson: convert axg pdm to schema
> ASoC: dt-bindings: meson: convert axg fifo to schema
> ASoC: dt-bindings: meson: convert axg spdif input to schema
> ASoC: dt-bindings: meson: convert axg spdif output to schema
> ASoC: dt-bindings: meson: convert axg sound card control to schema
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/9] ASoC: dt-bindings: create component common schema
commit: e398bbb9834a2f6cbe27cbd72956159ecc92055f
[2/9] ASoC: dt-bindings: meson: fix gx-card codec node regex
commit: 480b26226873c88e482575ceb0d0a38d76e1be57

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


2023-02-03 17:58:26

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 6/9] ASoC: dt-bindings: meson: convert axg fifo to schema

On 03/02/2023 14:27, Jerome Brunet wrote:
>

>>> + resets:
>>> + items:
>>> + - description: Memory ARB line
>>> + - description: Dedicated device reset line
>>
>> This won't work without minItems and you should see errors on your DTS
>> or in dt_binding_check
>>
>
> The example provided here worked but there is indeed a warning with the
> axg-frddr variant.
>
> I'm adding a 2nd example so it does not happen again.

If the difference is only in one property, no need. If the difference is
in more properties - then could be. We do not keep examples for every
trivial change, because the assumption is that submitter tests DTS as well.

>
>>> +
>>> + reset-names: true
>>
>> minItems
>> maxItems
>
> Adding this causes troubles with the reset-names definitions in the 'if'
> clause. If I put min: 1, max: 2 and min: 2 in the 'then' clause I get:
>
>> Documentation/devicetree/bindings/sound/amlogic,axg-fifo.yaml: allOf:1:then:properties:reset-names: 'oneOf' conditional failed, one must be fixed:
>> [{'const': 'arb'}, {'const': 'rst'}] is too long
>> [{'const': 'arb'}, {'const': 'rst'}] is too short
>> False schema does not allow 2
>> 1 was expected
>> hint: "minItems" is only needed if less than the "items" list length
>> from schema $id: http://devicetree.org/meta-schemas/items.yaml#

Probably because rest of binding does not match. One way is like this:

https://elixir.bootlin.com/linux/v5.19-rc6/source/Documentation/devicetree/bindings/clock/samsung,exynos7-clock.yaml#L57

>
> The older devices just have the 'arb' reset.
> Newer devices have a 2nd reset line (called rst here)
>
> If I just restrict the min and max, it would be valid for the older
> devices to have 'rst' only - but it is not valid.

How? Why would you define for old devices "rst" as one name if this is
not correct?

>
> With just 'true', it works as expected (throw errors if an incorrect
> name or number of names is passed). Min and Max comes from the items list.

Because the rest is not in recommended way. Once you implement it in
recommended way, there will be no such...

>
> Any suggestions ?

Implement rest of comments.


Best regards,
Krzysztof


2023-02-03 17:59:40

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 9/9] ASoC: dt-bindings: meson: convert axg sound card control to schema

On 03/02/2023 15:13, Jerome Brunet wrote:
>>> + Multiplication factor between the frame rate and master clock
>>> + rate
>>> +
>>> + sound-dai:
>>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>>
>> Old binding was saying it is just phandle
>
> It is just a phandle but the bindings used to have problem with phandle
> that had cells.
>
> See:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml?h=v6.2-rc6&id=d031d99b02eaf7363c33f5b27b38086cc8104082
>
> Was it wrong or did the situation change since then ?

Then define it as having cells:

https://elixir.bootlin.com/linux/v5.18-rc1/source/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml#L42


Best regards,
Krzysztof


2023-02-03 19:37:56

by Jerome Brunet

[permalink] [raw]
Subject: Re: [PATCH 9/9] ASoC: dt-bindings: meson: convert axg sound card control to schema


On Fri 03 Feb 2023 at 18:59, Krzysztof Kozlowski <[email protected]> wrote:

> On 03/02/2023 15:13, Jerome Brunet wrote:
>>>> + Multiplication factor between the frame rate and master clock
>>>> + rate
>>>> +
>>>> + sound-dai:
>>>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>>>
>>> Old binding was saying it is just phandle
>>
>> It is just a phandle but the bindings used to have problem with phandle
>> that had cells.
>>
>> See:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml?h=v6.2-rc6&id=d031d99b02eaf7363c33f5b27b38086cc8104082
>>
>> Was it wrong or did the situation change since then ?
>
> Then define it as having cells:
>
> https://elixir.bootlin.com/linux/v5.18-rc1/source/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml#L42
>

The card is provided with the phandle.
Whether or not the phandle has cells or not has nothing do with card
driver. The card just consums sound-dai. I don't understand this comment.

>
> Best regards,
> Krzysztof


2023-02-03 20:21:43

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 9/9] ASoC: dt-bindings: meson: convert axg sound card control to schema

On 03/02/2023 20:34, Jerome Brunet wrote:
>
> On Fri 03 Feb 2023 at 18:59, Krzysztof Kozlowski <[email protected]> wrote:
>
>> On 03/02/2023 15:13, Jerome Brunet wrote:
>>>>> + Multiplication factor between the frame rate and master clock
>>>>> + rate
>>>>> +
>>>>> + sound-dai:
>>>>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>>>>
>>>> Old binding was saying it is just phandle
>>>
>>> It is just a phandle but the bindings used to have problem with phandle
>>> that had cells.
>>>
>>> See:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml?h=v6.2-rc6&id=d031d99b02eaf7363c33f5b27b38086cc8104082
>>>
>>> Was it wrong or did the situation change since then ?
>>
>> Then define it as having cells:
>>
>> https://elixir.bootlin.com/linux/v5.18-rc1/source/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml#L42
>>
>
> The card is provided with the phandle.
> Whether or not the phandle has cells or not has nothing do with card
> driver. The card just consums sound-dai. I don't understand this comment.

You said this is only a phandle. Then you have just two options - either
this is one phandle without arguments (then change it as I asked
originally) or this is one phandle with arguments (then change it to
define the arguments like in example I gave you).

Best regards,
Krzysztof


2023-02-03 20:28:11

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 9/9] ASoC: dt-bindings: meson: convert axg sound card control to schema

On 03/02/2023 20:34, Jerome Brunet wrote:
>
> On Fri 03 Feb 2023 at 18:59, Krzysztof Kozlowski <[email protected]> wrote:
>
>> On 03/02/2023 15:13, Jerome Brunet wrote:
>>>>> + Multiplication factor between the frame rate and master clock
>>>>> + rate
>>>>> +
>>>>> + sound-dai:
>>>>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>>>>
>>>> Old binding was saying it is just phandle
>>>
>>> It is just a phandle but the bindings used to have problem with phandle
>>> that had cells.
>>>
>>> See:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml?h=v6.2-rc6&id=d031d99b02eaf7363c33f5b27b38086cc8104082
>>>
>>> Was it wrong or did the situation change since then ?
>>
>> Then define it as having cells:
>>
>> https://elixir.bootlin.com/linux/v5.18-rc1/source/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml#L42

Eh, it is already defined, so my advice is incorrect. Drop the ref and
define maxItems.

Best regards,
Krzysztof