Commit 1fcd2564 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: mediatek: mt8173-rt5650-rt5514: 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 05ab6617
...@@ -98,51 +98,51 @@ static int mt8173_rt5650_rt5514_init(struct snd_soc_pcm_runtime *runtime) ...@@ -98,51 +98,51 @@ static int mt8173_rt5650_rt5514_init(struct snd_soc_pcm_runtime *runtime)
&mt8173_rt5650_rt5514_jack); &mt8173_rt5650_rt5514_jack);
} }
static struct snd_soc_dai_link_component mt8173_rt5650_rt5514_codecs[] = {
{
.dai_name = "rt5645-aif1",
},
{
.dai_name = "rt5514-aif1",
},
};
enum { enum {
DAI_LINK_PLAYBACK, DAI_LINK_PLAYBACK,
DAI_LINK_CAPTURE, DAI_LINK_CAPTURE,
DAI_LINK_CODEC_I2S, DAI_LINK_CODEC_I2S,
}; };
SND_SOC_DAILINK_DEFS(playback,
DAILINK_COMP_ARRAY(COMP_CPU("DL1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture,
DAILINK_COMP_ARRAY(COMP_CPU("VUL")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(codec,
DAILINK_COMP_ARRAY(COMP_CPU("I2S")),
DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "rt5645-aif1"),
COMP_CODEC(NULL, "rt5514-aif1")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
/* Digital audio interface glue - connects codec <---> CPU */ /* Digital audio interface glue - connects codec <---> CPU */
static struct snd_soc_dai_link mt8173_rt5650_rt5514_dais[] = { static struct snd_soc_dai_link mt8173_rt5650_rt5514_dais[] = {
/* Front End DAI links */ /* Front End DAI links */
[DAI_LINK_PLAYBACK] = { [DAI_LINK_PLAYBACK] = {
.name = "rt5650_rt5514 Playback", .name = "rt5650_rt5514 Playback",
.stream_name = "rt5650_rt5514 Playback", .stream_name = "rt5650_rt5514 Playback",
.cpu_dai_name = "DL1",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
.dynamic = 1, .dynamic = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
SND_SOC_DAILINK_REG(playback),
}, },
[DAI_LINK_CAPTURE] = { [DAI_LINK_CAPTURE] = {
.name = "rt5650_rt5514 Capture", .name = "rt5650_rt5514 Capture",
.stream_name = "rt5650_rt5514 Capture", .stream_name = "rt5650_rt5514 Capture",
.cpu_dai_name = "VUL",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
.dynamic = 1, .dynamic = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
SND_SOC_DAILINK_REG(capture),
}, },
/* Back End DAI links */ /* Back End DAI links */
[DAI_LINK_CODEC_I2S] = { [DAI_LINK_CODEC_I2S] = {
.name = "Codec", .name = "Codec",
.cpu_dai_name = "I2S",
.no_pcm = 1, .no_pcm = 1,
.codecs = mt8173_rt5650_rt5514_codecs,
.num_codecs = 2,
.init = mt8173_rt5650_rt5514_init, .init = mt8173_rt5650_rt5514_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS, SND_SOC_DAIFMT_CBS_CFS,
...@@ -150,6 +150,7 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5514_dais[] = { ...@@ -150,6 +150,7 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5514_dais[] = {
.ignore_pmdown_time = 1, .ignore_pmdown_time = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
SND_SOC_DAILINK_REG(codec),
}, },
}; };
...@@ -189,27 +190,27 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) ...@@ -189,27 +190,27 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)
} }
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;
} }
mt8173_rt5650_rt5514_codecs[0].of_node = mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node =
of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0); of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0);
if (!mt8173_rt5650_rt5514_codecs[0].of_node) { if (!mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'audio-codec' missing or invalid\n"); "Property 'audio-codec' missing or invalid\n");
return -EINVAL; return -EINVAL;
} }
mt8173_rt5650_rt5514_codecs[1].of_node = mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node =
of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1); of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1);
if (!mt8173_rt5650_rt5514_codecs[1].of_node) { if (!mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'audio-codec' missing or invalid\n"); "Property 'audio-codec' missing or invalid\n");
return -EINVAL; return -EINVAL;
} }
mt8173_rt5650_rt5514_codec_conf[0].of_node = mt8173_rt5650_rt5514_codec_conf[0].of_node =
mt8173_rt5650_rt5514_codecs[1].of_node; mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node;
card->dev = &pdev->dev; card->dev = &pdev->dev;
......
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