Commit 4b990642 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: mediatek: mt8183-da7219-max98357: 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 1fcd2564
...@@ -18,18 +18,6 @@ ...@@ -18,18 +18,6 @@
static struct snd_soc_jack headset_jack; static struct snd_soc_jack headset_jack;
static struct snd_soc_dai_link_component
mt8183_da7219_max98357_external_codecs[] = {
{
.name = "max98357a",
.dai_name = "HiFi",
},
{
.name = "da7219.5-001a",
.dai_name = "da7219-hifi",
},
};
static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream, static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -137,191 +125,244 @@ static const struct snd_soc_dapm_route mt8183_da7219_max98357_dapm_routes[] = { ...@@ -137,191 +125,244 @@ static const struct snd_soc_dapm_route mt8183_da7219_max98357_dapm_routes[] = {
{"IT6505_8CH", NULL, "TDM"}, {"IT6505_8CH", NULL, "TDM"},
}; };
/* FE */
SND_SOC_DAILINK_DEFS(playback1,
DAILINK_COMP_ARRAY(COMP_CPU("DL1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(playback2,
DAILINK_COMP_ARRAY(COMP_CPU("DL2")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(playback3,
DAILINK_COMP_ARRAY(COMP_CPU("DL3")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture1,
DAILINK_COMP_ARRAY(COMP_CPU("UL1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture2,
DAILINK_COMP_ARRAY(COMP_CPU("UL2")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture3,
DAILINK_COMP_ARRAY(COMP_CPU("UL3")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(capture_mono,
DAILINK_COMP_ARRAY(COMP_CPU("UL_MONO_1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(playback_hdmi,
DAILINK_COMP_ARRAY(COMP_CPU("HDMI")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
/* BE */
SND_SOC_DAILINK_DEFS(primary_codec,
DAILINK_COMP_ARRAY(COMP_CPU("ADDA")),
DAILINK_COMP_ARRAY(COMP_CODEC("mt6358-sound", "mt6358-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()));
SND_SOC_DAILINK_DEFS(i2s0,
DAILINK_COMP_ARRAY(COMP_CPU("I2S0")),
DAILINK_COMP_ARRAY(COMP_CODEC("bt-sco", "bt-sco-pcm")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(i2s1,
DAILINK_COMP_ARRAY(COMP_CPU("I2S1")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(i2s2,
DAILINK_COMP_ARRAY(COMP_CPU("I2S2")),
DAILINK_COMP_ARRAY(COMP_CODEC("da7219.5-001a", "da7219-hifi")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(i2s3,
DAILINK_COMP_ARRAY(COMP_CPU("I2S3")),
DAILINK_COMP_ARRAY(COMP_CODEC("max98357a", "HiFi"),
COMP_CODEC("da7219.5-001a", "da7219-hifi")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(i2s5,
DAILINK_COMP_ARRAY(COMP_CPU("I2S5")),
DAILINK_COMP_ARRAY(COMP_CODEC("bt-sco", "bt-sco-pcm")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(tdm,
DAILINK_COMP_ARRAY(COMP_CPU("TDM")),
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
static struct snd_soc_dai_link mt8183_da7219_max98357_dai_links[] = { static struct snd_soc_dai_link mt8183_da7219_max98357_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(playback1),
}, },
{ {
.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(playback2),
}, },
{ {
.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(playback3),
}, },
{ {
.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(capture1),
}, },
{ {
.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(capture2),
}, },
{ {
.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(capture3),
}, },
{ {
.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),
}, },
{ {
.name = "Playback_HDMI", .name = "Playback_HDMI",
.stream_name = "Playback_HDMI", .stream_name = "Playback_HDMI",
.cpu_dai_name = "HDMI",
.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_hdmi),
}, },
/* BE */ /* BE */
{ {
.name = "Primary Codec", .name = "Primary Codec",
.cpu_dai_name = "ADDA",
.codec_dai_name = "mt6358-snd-codec-aif1",
.codec_name = "mt6358-sound",
.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),
}, },
{ {
.name = "I2S0", .name = "I2S0",
.cpu_dai_name = "I2S0",
.codec_dai_name = "bt-sco-pcm",
.codec_name = "bt-sco",
.no_pcm = 1, .no_pcm = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
.be_hw_params_fixup = mt8183_i2s_hw_params_fixup, .be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
.ops = &mt8183_mt6358_i2s_ops, .ops = &mt8183_mt6358_i2s_ops,
SND_SOC_DAILINK_REG(i2s0),
}, },
{ {
.name = "I2S1", .name = "I2S1",
.cpu_dai_name = "I2S1",
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.no_pcm = 1, .no_pcm = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
.be_hw_params_fixup = mt8183_i2s_hw_params_fixup, .be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
.ops = &mt8183_mt6358_i2s_ops, .ops = &mt8183_mt6358_i2s_ops,
SND_SOC_DAILINK_REG(i2s1),
}, },
{ {
.name = "I2S2", .name = "I2S2",
.cpu_dai_name = "I2S2",
.codec_dai_name = "da7219-hifi",
.codec_name = "da7219.5-001a",
.no_pcm = 1, .no_pcm = 1,
.dpcm_capture = 1, .dpcm_capture = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
.be_hw_params_fixup = mt8183_i2s_hw_params_fixup, .be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
.ops = &mt8183_da7219_i2s_ops, .ops = &mt8183_da7219_i2s_ops,
SND_SOC_DAILINK_REG(i2s2),
}, },
{ {
.name = "I2S3", .name = "I2S3",
.cpu_dai_name = "I2S3",
.codecs = mt8183_da7219_max98357_external_codecs,
.num_codecs =
ARRAY_SIZE(mt8183_da7219_max98357_external_codecs),
.no_pcm = 1, .no_pcm = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
.be_hw_params_fixup = mt8183_i2s_hw_params_fixup, .be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
.ops = &mt8183_da7219_i2s_ops, .ops = &mt8183_da7219_i2s_ops,
SND_SOC_DAILINK_REG(i2s3),
}, },
{ {
.name = "I2S5", .name = "I2S5",
.cpu_dai_name = "I2S5",
.codec_dai_name = "bt-sco-pcm",
.codec_name = "bt-sco",
.no_pcm = 1, .no_pcm = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
.be_hw_params_fixup = mt8183_i2s_hw_params_fixup, .be_hw_params_fixup = mt8183_i2s_hw_params_fixup,
.ops = &mt8183_mt6358_i2s_ops, .ops = &mt8183_mt6358_i2s_ops,
SND_SOC_DAILINK_REG(i2s5),
}, },
{ {
.name = "TDM", .name = "TDM",
.cpu_dai_name = "TDM",
.codec_name = "snd-soc-dummy",
.codec_dai_name = "snd-soc-dummy-dai",
.no_pcm = 1, .no_pcm = 1,
.dpcm_playback = 1, .dpcm_playback = 1,
.ignore_suspend = 1, .ignore_suspend = 1,
SND_SOC_DAILINK_REG(tdm),
}, },
}; };
...@@ -390,18 +431,9 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) ...@@ -390,18 +431,9 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev)
} }
for_each_card_prelinks(card, i, dai_link) { for_each_card_prelinks(card, i, dai_link) {
/* In the alsa soc-core, the "platform" will be if (dai_link->platforms->name)
* allocated by devm_kzalloc if null.
* There is a special case that registerring
* sound card is failed at the first time, but
* the "platform" will not null when probe is trying
* again. It's not expected normally.
*/
dai_link->platforms = NULL;
if (dai_link->platform_name)
continue; continue;
dai_link->platform_of_node = platform_node; dai_link->platforms->of_node = platform_node;
} }
mt8183_da7219_max98357_headset_dev.codec_of_node = mt8183_da7219_max98357_headset_dev.codec_of_node =
......
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