Skip to content

Commit 787f190

Browse files
AngeloGioacchino Del Regnobroonie
authored andcommitted
ASoC: dt-bindings: mt8186: Document audio-routing and dai-link subnode
Document the dai-link subnodes and the audio-routing property, allowing to describe machine specific audio hardware and links in device tree. While at it, also deprecate the old properties which were previously used with the driver's partially hardcoded configuration. Also, since describing machine specific audio hardware and links replaces the now deprecated old logic doing the same in a driver hardcoded fashion, it is not allowed to have both the old and new properties together. Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20240416071410.75620-17-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5a50483 commit 787f190

2 files changed

Lines changed: 233 additions & 18 deletions

File tree

Documentation/devicetree/bindings/sound/mt8186-mt6366-da7219-max98357.yaml

Lines changed: 122 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,46 @@ maintainers:
1212
description:
1313
This binding describes the MT8186 sound card.
1414

15+
allOf:
16+
- $ref: sound-card-common.yaml#
17+
1518
properties:
1619
compatible:
1720
enum:
1821
- mediatek,mt8186-mt6366-da7219-max98357-sound
1922

23+
audio-routing:
24+
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
25+
description:
26+
A list of the connections between audio components. Each entry is a
27+
pair of strings, the first being the connection's sink, the second
28+
being the connection's source.
29+
Valid names could be the input or output widgets of audio components,
30+
power supplies, MicBias of codec and the software switch.
31+
minItems: 2
32+
items:
33+
enum:
34+
# Sinks
35+
- HDMI1
36+
- Headphones
37+
- Line Out
38+
- MIC
39+
- Speakers
40+
41+
# Sources
42+
- Headset Mic
43+
- HPL
44+
- HPR
45+
- Speaker
46+
- TX
47+
2048
mediatek,platform:
2149
$ref: /schemas/types.yaml#/definitions/phandle
2250
description: The phandle of MT8186 ASoC platform.
2351

2452
headset-codec:
2553
type: object
54+
deprecated: true
2655
additionalProperties: false
2756
properties:
2857
sound-dai:
@@ -32,6 +61,7 @@ properties:
3261

3362
playback-codecs:
3463
type: object
64+
deprecated: true
3565
additionalProperties: false
3666
properties:
3767
sound-dai:
@@ -53,32 +83,115 @@ properties:
5383
A list of the desired dai-links in the sound card. Each entry is a
5484
name defined in the machine driver.
5585

56-
additionalProperties: false
86+
patternProperties:
87+
".*-dai-link$":
88+
type: object
89+
additionalProperties: false
90+
description:
91+
Container for dai-link level properties and CODEC sub-nodes.
92+
93+
properties:
94+
link-name:
95+
description: Indicates dai-link name and PCM stream name
96+
items:
97+
enum:
98+
- I2S0
99+
- I2S1
100+
- I2S2
101+
- I2S3
102+
103+
codec:
104+
description: Holds subnode which indicates codec dai.
105+
type: object
106+
additionalProperties: false
107+
properties:
108+
sound-dai:
109+
minItems: 1
110+
maxItems: 2
111+
required:
112+
- sound-dai
113+
114+
dai-format:
115+
description: audio format
116+
items:
117+
enum:
118+
- i2s
119+
- right_j
120+
- left_j
121+
- dsp_a
122+
- dsp_b
123+
124+
mediatek,clk-provider:
125+
$ref: /schemas/types.yaml#/definitions/string
126+
description: Indicates dai-link clock master.
127+
items:
128+
enum:
129+
- cpu
130+
- codec
131+
132+
required:
133+
- link-name
134+
135+
unevaluatedProperties: false
57136

58137
required:
59138
- compatible
60139
- mediatek,platform
61-
- headset-codec
62-
- playback-codecs
140+
141+
# Disallow legacy properties if xxx-dai-link nodes are specified
142+
if:
143+
not:
144+
patternProperties:
145+
".*-dai-link$": false
146+
then:
147+
properties:
148+
headset-codec: false
149+
speaker-codecs: false
63150

64151
examples:
65152
- |
66153
67154
sound: mt8186-sound {
68155
compatible = "mediatek,mt8186-mt6366-da7219-max98357-sound";
69-
mediatek,platform = <&afe>;
156+
model = "mt8186_da7219_m98357";
70157
pinctrl-names = "aud_clk_mosi_off",
71158
"aud_clk_mosi_on";
72159
pinctrl-0 = <&aud_clk_mosi_off>;
73160
pinctrl-1 = <&aud_clk_mosi_on>;
161+
mediatek,platform = <&afe>;
162+
163+
audio-routing =
164+
"Headphones", "HPL",
165+
"Headphones", "HPR",
166+
"MIC", "Headset Mic",
167+
"Speakers", "Speaker",
168+
"HDMI1", "TX";
169+
170+
hs-playback-dai-link {
171+
link-name = "I2S0";
172+
dai-format = "i2s";
173+
mediatek,clk-provider = "cpu";
174+
codec {
175+
sound-dai = <&da7219>;
176+
};
177+
};
74178
75-
headset-codec {
76-
sound-dai = <&da7219>;
179+
hs-capture-dai-link {
180+
link-name = "I2S1";
181+
dai-format = "i2s";
182+
mediatek,clk-provider = "cpu";
183+
codec {
184+
sound-dai = <&da7219>;
185+
};
77186
};
78187
79-
playback-codecs {
80-
sound-dai = <&anx_bridge_dp>,
81-
<&max98357a>;
188+
spk-dp-playback-dai-link {
189+
link-name = "I2S3";
190+
dai-format = "i2s";
191+
mediatek,clk-provider = "cpu";
192+
codec {
193+
sound-dai = <&anx_bridge_dp>, <&max98357a>;
194+
};
82195
};
83196
};
84197

Documentation/devicetree/bindings/sound/mt8186-mt6366-rt1019-rt5682s.yaml

Lines changed: 111 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,44 @@ maintainers:
1212
description:
1313
This binding describes the MT8186 sound card.
1414

15+
allOf:
16+
- $ref: sound-card-common.yaml#
17+
1518
properties:
1619
compatible:
1720
enum:
1821
- mediatek,mt8186-mt6366-rt1019-rt5682s-sound
1922
- mediatek,mt8186-mt6366-rt5682s-max98360-sound
2023
- mediatek,mt8186-mt6366-rt5650-sound
2124

25+
audio-routing:
26+
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
27+
description:
28+
A list of the connections between audio components. Each entry is a
29+
pair of strings, the first being the connection's sink, the second
30+
being the connection's source.
31+
Valid names could be the input or output widgets of audio components,
32+
power supplies, MicBias of codec and the software switch.
33+
minItems: 2
34+
items:
35+
enum:
36+
# Sinks
37+
- HDMI1
38+
- Headphone
39+
- IN1P
40+
- IN1N
41+
- Line Out
42+
- Speakers
43+
44+
# Sources
45+
- Headset Mic
46+
- HPOL
47+
- HPOR
48+
- Speaker
49+
- SPOL
50+
- SPOR
51+
- TX
52+
2253
mediatek,platform:
2354
$ref: /schemas/types.yaml#/definitions/phandle
2455
description: The phandle of MT8186 ASoC platform.
@@ -32,6 +63,7 @@ properties:
3263

3364
headset-codec:
3465
type: object
66+
deprecated: true
3567
additionalProperties: false
3668
properties:
3769
sound-dai:
@@ -41,6 +73,7 @@ properties:
4173

4274
playback-codecs:
4375
type: object
76+
deprecated: true
4477
additionalProperties: false
4578
properties:
4679
sound-dai:
@@ -62,37 +95,106 @@ properties:
6295
A list of the desired dai-links in the sound card. Each entry is a
6396
name defined in the machine driver.
6497

65-
additionalProperties: false
98+
patternProperties:
99+
".*-dai-link$":
100+
type: object
101+
additionalProperties: false
102+
description:
103+
Container for dai-link level properties and CODEC sub-nodes.
104+
105+
properties:
106+
link-name:
107+
description: Indicates dai-link name and PCM stream name
108+
enum: [ I2S0, I2S1, I2S2, I2S3 ]
109+
110+
codec:
111+
description: Holds subnode which indicates codec dai.
112+
type: object
113+
additionalProperties: false
114+
properties:
115+
sound-dai:
116+
minItems: 1
117+
maxItems: 2
118+
required:
119+
- sound-dai
120+
121+
dai-format:
122+
description: audio format
123+
enum: [ i2s, right_j, left_j, dsp_a, dsp_b ]
124+
125+
mediatek,clk-provider:
126+
$ref: /schemas/types.yaml#/definitions/string
127+
description: Indicates dai-link clock master.
128+
enum: [ cpu, codec ]
129+
130+
required:
131+
- link-name
132+
133+
unevaluatedProperties: false
66134

67135
required:
68136
- compatible
69137
- mediatek,platform
70-
- headset-codec
71-
- playback-codecs
138+
139+
# Disallow legacy properties if xxx-dai-link nodes are specified
140+
if:
141+
not:
142+
patternProperties:
143+
".*-dai-link$": false
144+
then:
145+
properties:
146+
headset-codec: false
147+
speaker-codecs: false
72148

73149
examples:
74150
- |
75151
#include <dt-bindings/gpio/gpio.h>
76152
77153
sound: mt8186-sound {
78154
compatible = "mediatek,mt8186-mt6366-rt1019-rt5682s-sound";
79-
mediatek,platform = <&afe>;
155+
model = "mt8186_rt1019_rt5682s";
80156
pinctrl-names = "aud_clk_mosi_off",
81157
"aud_clk_mosi_on",
82158
"aud_gpio_dmic_sec";
83159
pinctrl-0 = <&aud_clk_mosi_off>;
84160
pinctrl-1 = <&aud_clk_mosi_on>;
85161
pinctrl-2 = <&aud_gpio_dmic_sec>;
162+
mediatek,platform = <&afe>;
86163
87164
dmic-gpios = <&pio 23 GPIO_ACTIVE_HIGH>;
88165
89-
headset-codec {
90-
sound-dai = <&rt5682s>;
166+
audio-routing =
167+
"Headphone", "HPOL",
168+
"Headphone", "HPOR",
169+
"IN1P", "Headset Mic",
170+
"Speakers", "Speaker",
171+
"HDMI1", "TX";
172+
173+
hs-playback-dai-link {
174+
link-name = "I2S0";
175+
dai-format = "i2s";
176+
mediatek,clk-provider = "cpu";
177+
codec {
178+
sound-dai = <&rt5682s 0>;
179+
};
180+
};
181+
182+
hs-capture-dai-link {
183+
link-name = "I2S1";
184+
dai-format = "i2s";
185+
mediatek,clk-provider = "cpu";
186+
codec {
187+
sound-dai = <&rt5682s 0>;
188+
};
91189
};
92190
93-
playback-codecs {
94-
sound-dai = <&it6505dptx>,
95-
<&rt1019p>;
191+
spk-hdmi-playback-dai-link {
192+
link-name = "I2S3";
193+
dai-format = "i2s";
194+
mediatek,clk-provider = "cpu";
195+
codec {
196+
sound-dai = <&it6505dptx>, <&rt1019p>;
197+
};
96198
};
97199
};
98200

0 commit comments

Comments
 (0)