Commit 9ded5f71 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: mediatek: mt6797-mt6351: use modern dai_link style

ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 587c9844
...@@ -10,140 +10,177 @@ ...@@ -10,140 +10,177 @@
#include "mt6797-afe-common.h" #include "mt6797-afe-common.h"
SND_SOC_DAILINK_DEFS(playback_1,
DAILINK_COMP_ARRAY(COMP_CPU("DL1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(playback_2,
DAILINK_COMP_ARRAY(COMP_CPU("DL2")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(playback_3,
DAILINK_COMP_ARRAY(COMP_CPU("DL3")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture_1,
DAILINK_COMP_ARRAY(COMP_CPU("UL1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture_2,
DAILINK_COMP_ARRAY(COMP_CPU("UL2")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture_3,
DAILINK_COMP_ARRAY(COMP_CPU("UL3")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture_mono_1,
DAILINK_COMP_ARRAY(COMP_CPU("UL_MONO_1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(hostless_lpbk,
DAILINK_COMP_ARRAY(COMP_CPU("Hostless LPBK DAI")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(hostless_speech,
DAILINK_COMP_ARRAY(COMP_CPU("Hostless Speech DAI")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(primary_codec,
DAILINK_COMP_ARRAY(COMP_CPU("ADDA")),
DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "mt6351-snd-codec-aif1")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(pcm1,
DAILINK_COMP_ARRAY(COMP_CPU("PCM 1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(pcm2,
DAILINK_COMP_ARRAY(COMP_CPU("PCM 2")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
static struct snd_soc_dai_link mt6797_mt6351_dai_links[] = { static struct snd_soc_dai_link mt6797_mt6351_dai_links[] = {
/* FE */ /* FE */
{ {
.name = "Playback_1", .name = "Playback_1",
.stream_name = "Playback_1", .stream_name = "Playback_1",
.cpu_dai_name = "DL1",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
SND_SOC_DAILINK_REG(playback_1),
}, },
{ {
.name = "Playback_2", .name = "Playback_2",
.stream_name = "Playback_2", .stream_name = "Playback_2",
.cpu_dai_name = "DL2",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
SND_SOC_DAILINK_REG(playback_2),
}, },
{ {
.name = "Playback_3", .name = "Playback_3",
.stream_name = "Playback_3", .stream_name = "Playback_3",
.cpu_dai_name = "DL3",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
SND_SOC_DAILINK_REG(playback_3),
}, },
{ {
.name = "Capture_1", .name = "Capture_1",
.stream_name = "Capture_1", .stream_name = "Capture_1",
.cpu_dai_name = "UL1",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
SND_SOC_DAILINK_REG(capture_1),
}, },
{ {
.name = "Capture_2", .name = "Capture_2",
.stream_name = "Capture_2", .stream_name = "Capture_2",
.cpu_dai_name = "UL2",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
SND_SOC_DAILINK_REG(capture_2),
}, },
{ {
.name = "Capture_3", .name = "Capture_3",
.stream_name = "Capture_3", .stream_name = "Capture_3",
.cpu_dai_name = "UL3",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
SND_SOC_DAILINK_REG(capture_3),
}, },
{ {
.name = "Capture_Mono_1", .name = "Capture_Mono_1",
.stream_name = "Capture_Mono_1", .stream_name = "Capture_Mono_1",
.cpu_dai_name = "UL_MONO_1",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
SND_SOC_DAILINK_REG(capture_mono_1),
}, },
{ {
.name = "Hostless_LPBK", .name = "Hostless_LPBK",
.stream_name = "Hostless_LPBK", .stream_name = "Hostless_LPBK",
.cpu_dai_name = "Hostless LPBK DAI",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
SND_SOC_DAILINK_REG(hostless_lpbk),
}, },
{ {
.name = "Hostless_Speech", .name = "Hostless_Speech",
.stream_name = "Hostless_Speech", .stream_name = "Hostless_Speech",
.cpu_dai_name = "Hostless Speech DAI",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_PRE, .trigger = {SND_SOC_DPCM_TRIGGER_PRE,
SND_SOC_DPCM_TRIGGER_PRE}, SND_SOC_DPCM_TRIGGER_PRE},
.dynamic = 1, .dynamic = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
SND_SOC_DAILINK_REG(hostless_speech),
}, },
/* BE */ /* BE */
{ {
.name = "Primary Codec", .name = "Primary Codec",
.cpu_dai_name = "ADDA",
.codec_dai_name = "mt6351-snd-codec-aif1",
.no_pcm = 1, .no_pcm = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
SND_SOC_DAILINK_REG(primary_codec),
}, },
{ {
.name = "PCM 1", .name = "PCM 1",
.cpu_dai_name = "PCM 1",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.no_pcm = 1, .no_pcm = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
SND_SOC_DAILINK_REG(pcm1),
}, },
{ {
.name = "PCM 2", .name = "PCM 2",
.cpu_dai_name = "PCM 2",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.no_pcm = 1, .no_pcm = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
SND_SOC_DAILINK_REG(pcm2),
}, },
}; };
...@@ -170,9 +207,9 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev) ...@@ -170,9 +207,9 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
for_each_card_prelinks(card, i, dai_link) { for_each_card_prelinks(card, i, dai_link) {
if (dai_link->platform_name) if (dai_link->platforms->name)
continue; continue;
dai_link->platform_of_node = platform_node; dai_link->platforms->of_node = platform_node;
} }
codec_node = of_parse_phandle(pdev->dev.of_node, codec_node = of_parse_phandle(pdev->dev.of_node,
...@@ -183,9 +220,9 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev) ...@@ -183,9 +220,9 @@ static int mt6797_mt6351_dev_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
for_each_card_prelinks(card, i, dai_link) { for_each_card_prelinks(card, i, dai_link) {
if (dai_link->codec_name) if (dai_link->codecs->name)
continue; continue;
dai_link->codec_of_node = codec_node; dai_link->codecs->of_node = codec_node;
} }
ret = devm_snd_soc_register_card(&pdev->dev, card); ret = devm_snd_soc_register_card(&pdev->dev, card);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment