Skip to content

Commit 97e1145

Browse files
PC Liaobroonie
authored andcommitted
ASoC: mediatek: Add HDMI dai-links to the mt8173-rt5650 machine driver
This patch adds HDMI audio output support to the MT8173 RT5650 machine driver. Signed-off-by: PC Liao <[email protected]> Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 25d01dc commit 97e1145

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

Documentation/devicetree/bindings/sound/mt8173-rt5650.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
MT8173 with RT5650 CODECS
1+
MT8173 with RT5650 CODECS and HDMI via I2S
22

33
Required properties:
44
- compatible : "mediatek,mt8173-rt5650"
55
- mediatek,audio-codec: the phandles of rt5650 codecs
6+
and of the hdmi encoder node
67
- mediatek,platform: the phandle of MT8173 ASoC platform
78

89
Optional subnodes:
@@ -20,7 +21,7 @@ Example:
2021

2122
sound {
2223
compatible = "mediatek,mt8173-rt5650";
23-
mediatek,audio-codec = <&rt5650>;
24+
mediatek,audio-codec = <&rt5650 &hdmi0>;
2425
mediatek,platform = <&afe>;
2526
mediatek,mclk = <0>;
2627
codec-capture {

sound/soc/mediatek/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ config SND_SOC_MT8173_RT5650
4646
tristate "ASoC Audio driver for MT8173 with RT5650 codec"
4747
depends on SND_SOC_MT8173 && I2C
4848
select SND_SOC_RT5645
49+
select SND_SOC_HDMI_CODEC
4950
help
5051
This adds ASoC driver for Mediatek MT8173 boards
5152
with the RT5650 audio codec.

sound/soc/mediatek/mt8173/mt8173-rt5650.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ static struct snd_soc_dai_link_component mt8173_rt5650_codecs[] = {
169169
enum {
170170
DAI_LINK_PLAYBACK,
171171
DAI_LINK_CAPTURE,
172+
DAI_LINK_HDMI,
172173
DAI_LINK_CODEC_I2S,
174+
DAI_LINK_HDMI_I2S,
173175
};
174176

175177
/* Digital audio interface glue - connects codec <---> CPU */
@@ -195,6 +197,16 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
195197
.dynamic = 1,
196198
.dpcm_capture = 1,
197199
},
200+
[DAI_LINK_HDMI] = {
201+
.name = "HDMI",
202+
.stream_name = "HDMI PCM",
203+
.cpu_dai_name = "HDMI",
204+
.codec_name = "snd-soc-dummy",
205+
.codec_dai_name = "snd-soc-dummy-dai",
206+
.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
207+
.dynamic = 1,
208+
.dpcm_playback = 1,
209+
},
198210
/* Back End DAI links */
199211
[DAI_LINK_CODEC_I2S] = {
200212
.name = "Codec",
@@ -210,6 +222,13 @@ static struct snd_soc_dai_link mt8173_rt5650_dais[] = {
210222
.dpcm_playback = 1,
211223
.dpcm_capture = 1,
212224
},
225+
[DAI_LINK_HDMI_I2S] = {
226+
.name = "HDMI BE",
227+
.cpu_dai_name = "HDMIO",
228+
.no_pcm = 1,
229+
.codec_dai_name = "i2s-hifi",
230+
.dpcm_playback = 1,
231+
},
213232
};
214233

215234
static struct snd_soc_card mt8173_rt5650_card = {
@@ -284,6 +303,13 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev)
284303
}
285304
}
286305

306+
mt8173_rt5650_dais[DAI_LINK_HDMI_I2S].codec_of_node =
307+
of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1);
308+
if (!mt8173_rt5650_dais[DAI_LINK_HDMI_I2S].codec_of_node) {
309+
dev_err(&pdev->dev,
310+
"Property 'audio-codec' missing or invalid\n");
311+
return -EINVAL;
312+
}
287313
card->dev = &pdev->dev;
288314
platform_set_drvdata(pdev, card);
289315

0 commit comments

Comments
 (0)