2023-07-31 10:17:53

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 00/12] ASoC: dt-bindings: Add sound-card-common.yaml

Hi,

Almost every board machine / sound cards has "audio-routing" and "model"
properties, so we can make things simpler by introducing one common
binding. It is also expected that given property has only one definition.

If the patchset looks good, then the next steps will be:
1. Convert more vendor audio-routing properties to audio-routing,
2. Add dai-links children to common binding.

Best regards,
Krzysztof

Krzysztof Kozlowski (12):
ASoC: dt-bindings: amlogic,gx-sound-card: correct maxItems constraints
ASoC: dt-bindings: Add common sound card properties
ASoC: dt-bindings: mediatek,mt8188-mt6359: use common sound card
ASoC: dt-bindings: samsung,aries-wm8994: use common sound card
ASoC: dt-bindings: samsung,midas-audio: use common sound card
ASoC: dt-bindings: samsung,odroid: use common sound card
ASoC: dt-bindings: samsung,tm2: use common sound card
ASoC: samsung: odroid: use of_property_present to check for property
ASoC: samsung: aries_wm8994: parse audio-routing
ASoC: samsung: midas_wm1811: parse audio-routing
ASoC: samsung: odroid: parse audio-routing
ASoC: samsung: tm2_wm5110: parse audio-routing

.../sound/amlogic,axg-sound-card.yaml | 15 +++--------
.../bindings/sound/amlogic,gx-sound-card.yaml | 16 +++++------
.../devicetree/bindings/sound/fsl,rpmsg.yaml | 17 +++---------
.../bindings/sound/google,sc7180-trogdor.yaml | 17 +++---------
.../sound/google,sc7280-herobrine.yaml | 17 +++---------
.../bindings/sound/imx-audio-card.yaml | 18 +++----------
.../sound/mediatek,mt8188-mt6359.yaml | 17 +++++-------
.../bindings/sound/samsung,aries-wm8994.yaml | 16 +++++------
.../bindings/sound/samsung,midas-audio.yaml | 16 +++++------
.../bindings/sound/samsung,odroid.yaml | 14 +++++-----
.../bindings/sound/samsung,tm2.yaml | 16 +++++------
.../bindings/sound/sound-card-common.yaml | 27 +++++++++++++++++++
sound/soc/samsung/aries_wm8994.c | 10 ++++---
sound/soc/samsung/midas_wm1811.c | 10 ++++---
sound/soc/samsung/odroid.c | 15 ++++++-----
sound/soc/samsung/tm2_wm5110.c | 10 ++++---
16 files changed, 119 insertions(+), 132 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/sound-card-common.yaml

--
2.34.1



2023-07-31 10:17:54

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 10/12] ASoC: samsung: midas_wm1811: parse audio-routing

Parse generic sound card "audio-routing" property and fallback to
"samsung,audio-routing" if it is missing.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/samsung/midas_wm1811.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/samsung/midas_wm1811.c b/sound/soc/samsung/midas_wm1811.c
index 6931b9a45b3e..9e83ed071f39 100644
--- a/sound/soc/samsung/midas_wm1811.c
+++ b/sound/soc/samsung/midas_wm1811.c
@@ -462,10 +462,14 @@ static int midas_probe(struct platform_device *pdev)
return ret;
}

- ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing");
+ ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
if (ret < 0) {
- dev_err(dev, "Audio routing invalid/unspecified\n");
- return ret;
+ /* Backwards compatible way */
+ ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing");
+ if (ret < 0) {
+ dev_err(dev, "Audio routing invalid/unspecified\n");
+ return ret;
+ }
}

cpu = of_get_child_by_name(dev->of_node, "cpu");
--
2.34.1


2023-07-31 10:35:59

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 08/12] ASoC: samsung: odroid: use of_property_present to check for property

"samsung,audio-widgets" and "samsung,audio-routing" are not boolean
properties, thus more appropriate is to use of_property_present() to
check if they are present.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/samsung/odroid.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c
index a5442592bde4..1743bd55ba1a 100644
--- a/sound/soc/samsung/odroid.c
+++ b/sound/soc/samsung/odroid.c
@@ -223,14 +223,14 @@ static int odroid_audio_probe(struct platform_device *pdev)
if (ret < 0)
return ret;

- if (of_property_read_bool(dev->of_node, "samsung,audio-widgets")) {
+ if (of_property_present(dev->of_node, "samsung,audio-widgets")) {
ret = snd_soc_of_parse_audio_simple_widgets(card,
"samsung,audio-widgets");
if (ret < 0)
return ret;
}

- if (of_property_read_bool(dev->of_node, "samsung,audio-routing")) {
+ if (of_property_present(dev->of_node, "samsung,audio-routing")) {
ret = snd_soc_of_parse_audio_routing(card,
"samsung,audio-routing");
if (ret < 0)
--
2.34.1


2023-07-31 10:45:24

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 03/12] ASoC: dt-bindings: mediatek,mt8188-mt6359: use common sound card

The mediatek,mt8188-mt6359 Linux sound machine driver requires the
"model" property, so binding was incomplete. Reference the common sound
card properties to fix that which also allows to remove duplicated
property definitions. Leave the relevant parts of "audio-routing"
description.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/sound/mediatek,mt8188-mt6359.yaml | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml
index 05e532b5d50a..43b3b67bdf3b 100644
--- a/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml
+++ b/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml
@@ -9,23 +9,19 @@ title: MediaTek MT8188 ASoC sound card
maintainers:
- Trevor Wu <[email protected]>

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
enum:
- mediatek,mt8188-mt6359-evb
- mediatek,mt8188-nau8825

- model:
- $ref: /schemas/types.yaml#/definitions/string
- description: User specified audio sound card name
-
audio-routing:
- $ref: /schemas/types.yaml#/definitions/non-unique-string-array
description:
- A list of the connections between audio components. Each entry is a
- sink/source pair of strings. Valid names could be the input or output
- widgets of audio components, power supplies, MicBias of codec and the
- software switch.
+ Valid names could be the input or output widgets of audio components,
+ power supplies, MicBias of codec and the software switch.

mediatek,platform:
$ref: /schemas/types.yaml#/definitions/phandle
@@ -86,7 +82,7 @@ patternProperties:
required:
- link-name

-additionalProperties: false
+unevaluatedProperties: false

required:
- compatible
@@ -96,6 +92,7 @@ examples:
- |
sound {
compatible = "mediatek,mt8188-mt6359-evb";
+ model = "MT6359-EVB";
mediatek,platform = <&afe>;
pinctrl-names = "default";
pinctrl-0 = <&aud_pins_default>;
--
2.34.1


2023-07-31 10:54:30

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 01/12] ASoC: dt-bindings: amlogic,gx-sound-card: correct maxItems constraints

minItems without maxItems implies upper limit, so add some high maxItems
to fix dtbs_check warnings like:

meson-gxm-s912-libretech-pc.dtb: sound: audio-routing: ['AU2 INL', 'ACODEC LOLN', 'AU2 INR', 'ACODEC LORN', '7J4-14 LEFT', 'AU2 OUTL', '7J4-11 RIGHT', 'AU2 OUTR'] is too long

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../devicetree/bindings/sound/amlogic,gx-sound-card.yaml | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
index b358fd601ed3..45d6202d9730 100644
--- a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
+++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
@@ -21,6 +21,7 @@ properties:
audio-routing:
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
minItems: 2
+ maxItems: 32
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
@@ -29,6 +30,7 @@ properties:
audio-widgets:
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
minItems: 2
+ maxItems: 8
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
--
2.34.1


2023-07-31 10:55:28

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 12/12] ASoC: samsung: tm2_wm5110: parse audio-routing

Parse generic sound card "audio-routing" property and fallback to
"samsung,audio-routing" if it is missing.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/samsung/tm2_wm5110.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c
index d611ec9e5325..5ebf17f3de1e 100644
--- a/sound/soc/samsung/tm2_wm5110.c
+++ b/sound/soc/samsung/tm2_wm5110.c
@@ -523,10 +523,14 @@ static int tm2_probe(struct platform_device *pdev)
return ret;
}

- ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing");
+ ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
if (ret < 0) {
- dev_err(dev, "Audio routing is not specified or invalid\n");
- return ret;
+ /* Backwards compatible way */
+ ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing");
+ if (ret < 0) {
+ dev_err(dev, "Audio routing is not specified or invalid\n");
+ return ret;
+ }
}

card->aux_dev[0].dlc.of_node = of_parse_phandle(dev->of_node,
--
2.34.1


2023-07-31 10:55:53

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 02/12] ASoC: dt-bindings: Add common sound card properties

Almost every board machine / sound cards has "audio-routing" and "model"
properties, so move them to common schema to have only one definition of
these properties.

For amlogic,gx-sound-card, leave the "audio-routing" constraints in the
original binding.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../sound/amlogic,axg-sound-card.yaml | 15 +++--------
.../bindings/sound/amlogic,gx-sound-card.yaml | 14 +++-------
.../devicetree/bindings/sound/fsl,rpmsg.yaml | 17 +++---------
.../bindings/sound/google,sc7180-trogdor.yaml | 17 +++---------
.../sound/google,sc7280-herobrine.yaml | 17 +++---------
.../bindings/sound/imx-audio-card.yaml | 18 +++----------
.../bindings/sound/sound-card-common.yaml | 27 +++++++++++++++++++
7 files changed, 50 insertions(+), 75 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/sound-card-common.yaml

diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
index bf1234550343..5db718e4d0e7 100644
--- a/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
+++ b/Documentation/devicetree/bindings/sound/amlogic,axg-sound-card.yaml
@@ -9,6 +9,9 @@ title: Amlogic AXG sound card
maintainers:
- Jerome Brunet <[email protected]>

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
const: amlogic,axg-sound-card
@@ -17,23 +20,12 @@ properties:
$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
@@ -108,7 +100,6 @@ patternProperties:
- sound-dai

required:
- - model
- dai-link-0

unevaluatedProperties: false
diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
index 45d6202d9730..9c6c4c0fab88 100644
--- a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
+++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
@@ -9,6 +9,9 @@ title: Amlogic GX sound card
maintainers:
- Jerome Brunet <[email protected]>

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
items:
@@ -19,13 +22,8 @@ properties:
description: list of auxiliary devices

audio-routing:
- $ref: /schemas/types.yaml#/definitions/non-unique-string-array
minItems: 2
maxItems: 32
- 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
@@ -35,10 +33,6 @@ properties:
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
@@ -88,7 +82,7 @@ required:
- model
- dai-link-0

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
index 6df0e03a1d4b..188f38baddec 100644
--- a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
+++ b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
@@ -17,6 +17,9 @@ description: |
such as SAI, MICFIL, .etc through building rpmsg channels between
Cortex-A and Cortex-M.

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
enum:
@@ -27,10 +30,6 @@ properties:
- fsl,imx8ulp-rpmsg-audio
- fsl,imx93-rpmsg-audio

- model:
- $ref: /schemas/types.yaml#/definitions/string
- description: User specified audio sound card name
-
clocks:
items:
- description: Peripheral clock for register access
@@ -66,13 +65,6 @@ properties:
$ref: /schemas/types.yaml#/definitions/phandle
description: The phandle to a node of audio codec

- 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.
-
fsl,enable-lpa:
$ref: /schemas/types.yaml#/definitions/flag
description: enable low power audio path.
@@ -101,9 +93,8 @@ properties:

required:
- compatible
- - model

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
index ba5b7728cf33..bac940553965 100644
--- a/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
+++ b/Documentation/devicetree/bindings/sound/google,sc7180-trogdor.yaml
@@ -13,23 +13,15 @@ maintainers:
description:
This binding describes the SC7180 sound card which uses LPASS for audio.

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
enum:
- google,sc7180-trogdor
- google,sc7180-coachz

- 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.
-
- model:
- $ref: /schemas/types.yaml#/definitions/string
- description: User specified audio sound card name
-
"#address-cells":
const: 1

@@ -86,11 +78,10 @@ patternProperties:

required:
- compatible
- - model
- "#address-cells"
- "#size-cells"

-additionalProperties: false
+unevaluatedProperties: false

examples:

diff --git a/Documentation/devicetree/bindings/sound/google,sc7280-herobrine.yaml b/Documentation/devicetree/bindings/sound/google,sc7280-herobrine.yaml
index 0b1a01a4c14e..ec4b6e547ca6 100644
--- a/Documentation/devicetree/bindings/sound/google,sc7280-herobrine.yaml
+++ b/Documentation/devicetree/bindings/sound/google,sc7280-herobrine.yaml
@@ -13,22 +13,14 @@ maintainers:
description:
This binding describes the SC7280 sound card which uses LPASS for audio.

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
enum:
- google,sc7280-herobrine

- 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.
-
- model:
- $ref: /schemas/types.yaml#/definitions/string
- description: User specified audio sound card name
-
"#address-cells":
const: 1

@@ -97,11 +89,10 @@ patternProperties:

required:
- compatible
- - model
- "#address-cells"
- "#size-cells"

-additionalProperties: false
+unevaluatedProperties: false

examples:

diff --git a/Documentation/devicetree/bindings/sound/imx-audio-card.yaml b/Documentation/devicetree/bindings/sound/imx-audio-card.yaml
index b6f5d486600e..f7ad5ea2491e 100644
--- a/Documentation/devicetree/bindings/sound/imx-audio-card.yaml
+++ b/Documentation/devicetree/bindings/sound/imx-audio-card.yaml
@@ -9,23 +9,14 @@ title: NXP i.MX audio sound card.
maintainers:
- Shengjiu Wang <[email protected]>

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
enum:
- fsl,imx-audio-card

- model:
- $ref: /schemas/types.yaml#/definitions/string
- description: User specified audio sound card name
-
- 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. Valid names could be power supplies,
- MicBias of codec and the jacks on the board.
-
patternProperties:
".*-dai-link$":
description:
@@ -84,9 +75,8 @@ patternProperties:

required:
- compatible
- - model

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
diff --git a/Documentation/devicetree/bindings/sound/sound-card-common.yaml b/Documentation/devicetree/bindings/sound/sound-card-common.yaml
new file mode 100644
index 000000000000..3a941177f684
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sound-card-common.yaml
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/sound-card-common.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Board Sound Card Common Properties
+
+maintainers:
+ - Mark Brown <[email protected]>
+
+properties:
+ 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.
+
+ model:
+ $ref: /schemas/types.yaml#/definitions/string
+ description: User specified audio sound card name
+
+required:
+ - model
+
+additionalProperties: true
--
2.34.1


2023-07-31 10:57:08

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 06/12] ASoC: dt-bindings: samsung,odroid: use common sound card

Reference the common sound card properties and deprecate the
custom "samsung,audio-routing" in favor of generic one. This allows to
remove "model" property and make the binding closer to other sounds
cards.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../devicetree/bindings/sound/samsung,odroid.yaml | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/samsung,odroid.yaml b/Documentation/devicetree/bindings/sound/samsung,odroid.yaml
index c6751c40e63f..b77284e3e26a 100644
--- a/Documentation/devicetree/bindings/sound/samsung,odroid.yaml
+++ b/Documentation/devicetree/bindings/sound/samsung,odroid.yaml
@@ -10,6 +10,9 @@ maintainers:
- Krzysztof Kozlowski <[email protected]>
- Sylwester Nawrocki <[email protected]>

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
oneOf:
@@ -24,10 +27,6 @@ properties:
- const: samsung,odroid-xu4-audio
deprecated: true

- model:
- $ref: /schemas/types.yaml#/definitions/string
- description: The user-visible name of this sound complex.
-
assigned-clock-parents: true
assigned-clock-rates: true
assigned-clocks: true
@@ -52,6 +51,7 @@ properties:

samsung,audio-routing:
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
+ deprecated: true
description: |
List of the connections between audio
components; each entry is a pair of strings, the first being the
@@ -61,6 +61,7 @@ properties:
For Odroid X2: "Headphone Jack", "Mic Jack", "DMIC"
For Odroid U3, XU3: "Headphone Jack", "Speakers"
For Odroid XU4: no entries
+ Deprecated, use audio-routing.

samsung,audio-widgets:
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
@@ -70,18 +71,17 @@ properties:

required:
- compatible
- - model
- cpu
- codec

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
sound {
compatible = "hardkernel,odroid-xu3-audio";
model = "Odroid-XU3";
- samsung,audio-routing =
+ audio-routing =
"Headphone Jack", "HPL",
"Headphone Jack", "HPR",
"IN1", "Mic Jack",
--
2.34.1


2023-07-31 11:00:03

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 11/12] ASoC: samsung: odroid: parse audio-routing

Parse generic sound card "audio-routing" property and fallback to
"samsung,audio-routing" if it is missing.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
sound/soc/samsung/odroid.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c
index 1743bd55ba1a..c93cb5a86426 100644
--- a/sound/soc/samsung/odroid.c
+++ b/sound/soc/samsung/odroid.c
@@ -230,12 +230,13 @@ static int odroid_audio_probe(struct platform_device *pdev)
return ret;
}

- if (of_property_present(dev->of_node, "samsung,audio-routing")) {
- ret = snd_soc_of_parse_audio_routing(card,
- "samsung,audio-routing");
- if (ret < 0)
- return ret;
- }
+ ret = 0;
+ if (of_property_present(dev->of_node, "audio-routing"))
+ ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
+ else if (of_property_present(dev->of_node, "samsung,audio-routing"))
+ ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing");
+ if (ret < 0)
+ return ret;

card->dai_link = odroid_card_dais;
card->num_links = ARRAY_SIZE(odroid_card_dais);
--
2.34.1


2023-07-31 11:13:54

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 05/12] ASoC: dt-bindings: samsung,midas-audio: use common sound card

Reference the common sound card properties and deprecate the
custom "samsung,audio-routing" in favor of generic one. This allows to
remove "model" property and make the binding closer to other sounds
cards.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/sound/samsung,midas-audio.yaml | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml b/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml
index 31095913e330..6ec80f529d84 100644
--- a/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml
+++ b/Documentation/devicetree/bindings/sound/samsung,midas-audio.yaml
@@ -9,14 +9,13 @@ title: Samsung Midas audio complex with WM1811 codec
maintainers:
- Sylwester Nawrocki <[email protected]>

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
const: samsung,midas-audio

- model:
- $ref: /schemas/types.yaml#/definitions/string
- description: The user-visible name of this sound complex.
-
cpu:
type: object
additionalProperties: false
@@ -38,6 +37,7 @@ properties:
- sound-dai

samsung,audio-routing:
+ deprecated: true
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
description: |
List of the connections between audio components; each entry is
@@ -45,6 +45,7 @@ properties:
being the connection's source; valid names for sources and sinks are
the WM1811's pins (as documented in its binding), and the jacks
on the board: HP, SPK, Main Mic, Sub Mic, Headset Mic.
+ Deprecated, use audio-routing.

mic-bias-supply:
description: Supply for the micbias on the Main microphone
@@ -62,14 +63,13 @@ properties:

required:
- compatible
- - model
- cpu
- codec
- - samsung,audio-routing
+ - audio-routing
- mic-bias-supply
- submic-bias-supply

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
@@ -84,7 +84,7 @@ examples:
mic-bias-supply = <&mic_bias_reg>;
submic-bias-supply = <&submic_bias_reg>;

- samsung,audio-routing =
+ audio-routing =
"HP", "HPOUT1L",
"HP", "HPOUT1R",

--
2.34.1


2023-07-31 11:35:57

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 07/12] ASoC: dt-bindings: samsung,tm2: use common sound card

Reference the common sound card properties and deprecate the
custom "samsung,audio-routing" in favor of generic one. This allows to
remove "model" property and make the binding closer to other sounds
cards.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
.../devicetree/bindings/sound/samsung,tm2.yaml | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/samsung,tm2.yaml b/Documentation/devicetree/bindings/sound/samsung,tm2.yaml
index 491e08019c04..760592599143 100644
--- a/Documentation/devicetree/bindings/sound/samsung,tm2.yaml
+++ b/Documentation/devicetree/bindings/sound/samsung,tm2.yaml
@@ -10,6 +10,9 @@ maintainers:
- Krzysztof Kozlowski <[email protected]>
- Sylwester Nawrocki <[email protected]>

+allOf:
+ - $ref: sound-card-common.yaml#
+
properties:
compatible:
const: samsung,tm2-audio
@@ -32,6 +35,8 @@ properties:
being the connection's source; valid names for sources and sinks are the
WM5110's and MAX98504's pins and the jacks on the board: HP, SPK, Main
Mic, Sub Mic, Third Mic, Headset Mic.
+ Deprecated, use audio-routing.
+ deprecated: true
$ref: /schemas/types.yaml#/definitions/non-unique-string-array

i2s-controller:
@@ -44,20 +49,15 @@ properties:
mic-bias-gpios:
description: GPIO pin that enables the Main Mic bias regulator.

- model:
- description: The user-visible name of this sound complex.
- $ref: /schemas/types.yaml#/definitions/string
-
required:
- compatible
- audio-amplifier
- audio-codec
- - samsung,audio-routing
+ - audio-routing
- i2s-controller
- mic-bias-gpios
- - model

-additionalProperties: false
+unevaluatedProperties: false

examples:
- |
@@ -70,7 +70,7 @@ examples:
audio-amplifier = <&max98504>;
mic-bias-gpios = <&gpr3 2 GPIO_ACTIVE_HIGH>;
model = "wm5110";
- samsung,audio-routing = "HP", "HPOUT1L",
+ audio-routing = "HP", "HPOUT1L",
"HP", "HPOUT1R",
"SPK", "SPKOUT",
"SPKOUT", "HPOUT2L",
--
2.34.1


2023-07-31 11:39:45

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 06/12] ASoC: dt-bindings: samsung,odroid: use common sound card


On Mon, 31 Jul 2023 11:42:57 +0200, Krzysztof Kozlowski wrote:
> Reference the common sound card properties and deprecate the
> custom "samsung,audio-routing" in favor of generic one. This allows to
> remove "model" property and make the binding closer to other sounds
> cards.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> .../devicetree/bindings/sound/samsung,odroid.yaml | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>

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

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/samsung,odroid.yaml:
Error in referenced schema matching $id: http://devicetree.org/schemas/sound/sound-card-common.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/samsung,odroid.example.dtb: sound: False schema does not allow {'compatible': ['hardkernel,odroid-xu3-audio'], 'model': ['Odroid-XU3'], 'audio-routing': ['Headphone Jack', 'HPL', 'Headphone Jack', 'HPR', 'IN1', 'Mic Jack', 'Mic Jack', 'MICBIAS'], 'cpu': {'sound-dai': [[4294967295, 0]]}, 'codec': {'sound-dai': [[4294967295], [4294967295]]}, '$nodename': ['sound']}
from schema $id: http://devicetree.org/schemas/sound/samsung,odroid.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/samsung,odroid.example.dtb: sound: Unevaluated properties are not allowed ('audio-routing', 'model' were unexpected)
from schema $id: http://devicetree.org/schemas/sound/samsung,odroid.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

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

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


Subject: Re: [PATCH 03/12] ASoC: dt-bindings: mediatek,mt8188-mt6359: use common sound card

Il 31/07/23 11:42, Krzysztof Kozlowski ha scritto:
> The mediatek,mt8188-mt6359 Linux sound machine driver requires the
> "model" property, so binding was incomplete. Reference the common sound
> card properties to fix that which also allows to remove duplicated
> property definitions. Leave the relevant parts of "audio-routing"
> description.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>


Reviewed-by: AngeloGioacchino Del Regno <[email protected]>


2023-07-31 12:03:56

by Jerome Brunet

[permalink] [raw]
Subject: Re: [PATCH 01/12] ASoC: dt-bindings: amlogic,gx-sound-card: correct maxItems constraints


On Mon 31 Jul 2023 at 11:42, Krzysztof Kozlowski <[email protected]> wrote:

> minItems without maxItems implies upper limit, so add some high maxItems
> to fix dtbs_check warnings like:
>
> meson-gxm-s912-libretech-pc.dtb: sound: audio-routing: ['AU2 INL', 'ACODEC LOLN', 'AU2 INR', 'ACODEC LORN', '7J4-14 LEFT', 'AU2 OUTL', '7J4-11 RIGHT', 'AU2 OUTR'] is too long

The only contraints is that values come in pair and there is no upper
limit to the number of routes a device (using this driver) may have.

The upper limit of 8 might work now but is very likely to be wrong for
the next device to come.

Is there way to correctly describe this "pair" contraint with DT schema ?

If not, then I guess the most adequate solution is to drop minItems and
give no bound, like simple-card is doing for the same type of properties.

Same goes for the audio-widgets property

>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> .../devicetree/bindings/sound/amlogic,gx-sound-card.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
> index b358fd601ed3..45d6202d9730 100644
> --- a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
> +++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
> @@ -21,6 +21,7 @@ properties:
> audio-routing:
> $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> minItems: 2
> + maxItems: 32
> 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
> @@ -29,6 +30,7 @@ properties:
> audio-widgets:
> $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> minItems: 2
> + maxItems: 8
> 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


Subject: Re: [PATCH 02/12] ASoC: dt-bindings: Add common sound card properties

Il 31/07/23 11:42, Krzysztof Kozlowski ha scritto:
> Almost every board machine / sound cards has "audio-routing" and "model"
> properties, so move them to common schema to have only one definition of
> these properties.
>
> For amlogic,gx-sound-card, leave the "audio-routing" constraints in the
> original binding.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>



2023-07-31 15:09:45

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 03/12] ASoC: dt-bindings: mediatek,mt8188-mt6359: use common sound card

On Mon, Jul 31, 2023 at 04:51:46AM -0600, Rob Herring wrote:
>
> On Mon, 31 Jul 2023 11:42:54 +0200, Krzysztof Kozlowski wrote:
> > The mediatek,mt8188-mt6359 Linux sound machine driver requires the
> > "model" property, so binding was incomplete. Reference the common sound
> > card properties to fix that which also allows to remove duplicated
> > property definitions. Leave the relevant parts of "audio-routing"
> > description.
> >
> > Signed-off-by: Krzysztof Kozlowski <[email protected]>
> > ---
> > .../bindings/sound/mediatek,mt8188-mt6359.yaml | 17 +++++++----------
> > 1 file changed, 7 insertions(+), 10 deletions(-)
> >
>
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.yaml:
> Error in referenced schema matching $id: http://devicetree.org/schemas/sound/sound-card-common.yaml
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.example.dtb: sound: False schema does not allow {'compatible': ['mediatek,mt8188-mt6359-evb'], 'model': ['MT6359-EVB'], 'mediatek,platform': [[4294967295]], 'pinctrl-names': ['default'], 'pinctrl-0': [[4294967295]], 'audio-routing': ['Headphone', 'Headphone L', 'Headphone', 'Headphone R', 'AIN1', 'Headset Mic'], 'dai-link-0': {'link-name': ['ETDM3_OUT_BE'], 'dai-format': ['i2s'], 'mediatek,clk-provider': ['cpu'], 'codec': {'sound-dai': [[4294967295]]}}, '$nodename': ['sound']}
> from schema $id: http://devicetree.org/schemas/sound/mediatek,mt8188-mt6359.yaml#
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/mediatek,mt8188-mt6359.example.dtb: sound: Unevaluated properties are not allowed ('model' was unexpected)
> from schema $id: http://devicetree.org/schemas/sound/mediatek,mt8188-mt6359.yaml#

Looks like patch 2 could not be applied causing this.

Rob

2023-07-31 15:09:46

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 05/12] ASoC: dt-bindings: samsung,midas-audio: use common sound card


On Mon, 31 Jul 2023 11:42:56 +0200, Krzysztof Kozlowski wrote:
> Reference the common sound card properties and deprecate the
> custom "samsung,audio-routing" in favor of generic one. This allows to
> remove "model" property and make the binding closer to other sounds
> cards.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> .../bindings/sound/samsung,midas-audio.yaml | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>

Reviewed-by: Rob Herring <[email protected]>


2023-07-31 15:33:52

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 01/12] ASoC: dt-bindings: amlogic,gx-sound-card: correct maxItems constraints

On Mon, Jul 31, 2023 at 11:52:53AM +0200, Jerome Brunet wrote:

> The upper limit of 8 might work now but is very likely to be wrong for
> the next device to come.

> Is there way to correctly describe this "pair" contraint with DT schema ?

> If not, then I guess the most adequate solution is to drop minItems and
> give no bound, like simple-card is doing for the same type of properties.

> Same goes for the audio-widgets property

Right, dropping minItems seems better than pulling a maxItems out of
thin air.


Attachments:
(No filename) (530.00 B)
signature.asc (499.00 B)
Download all attachments

2023-07-31 15:39:55

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 07/12] ASoC: dt-bindings: samsung,tm2: use common sound card


On Mon, 31 Jul 2023 11:42:58 +0200, Krzysztof Kozlowski wrote:
> Reference the common sound card properties and deprecate the
> custom "samsung,audio-routing" in favor of generic one. This allows to
> remove "model" property and make the binding closer to other sounds
> cards.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> .../devicetree/bindings/sound/samsung,tm2.yaml | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>

Reviewed-by: Rob Herring <[email protected]>


2023-08-10 07:28:30

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 01/12] ASoC: dt-bindings: amlogic,gx-sound-card: correct maxItems constraints

On 31/07/2023 16:46, Mark Brown wrote:
>> The upper limit of 8 might work now but is very likely to be wrong for
>> the next device to come.
>
>> Is there way to correctly describe this "pair" contraint with DT schema ?
>
>> If not, then I guess the most adequate solution is to drop minItems and
>> give no bound, like simple-card is doing for the same type of properties.
>
>> Same goes for the audio-widgets property
>
> Right, dropping minItems seems better than pulling a maxItems out of
> thin air.

OK, I will drop the min/maxItems and send v2.

Best regards,
Krzysztof