Commit 8266c731 authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: Intel: sof_sdw: add common sdw dai link init

Currently, we set sdw dai link .init callback in the codec_info_list's
dais.init function. This works fine if all codecs in the dai link are
the same. However, we need to do all the .init stuff for all different
codecs in the dai link if not all codecs in the dai link are the same.
Use a common dai link .init callback to call the new rtd_init callback
in sof_sdw_dai_info{} to do rtd_init for each dai.
Some codec init callback will become empty after this change. They will
be removed in the follow up patch.
Reviewed-by: default avatarRander Wang <rander.wang@intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-18-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7bc6ceba
...@@ -651,6 +651,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -651,6 +651,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_JACK, .dai_type = SOF_SDW_DAI_TYPE_JACK,
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID},
.init = sof_sdw_rt700_init, .init = sof_sdw_rt700_init,
.rtd_init = rt700_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -666,6 +667,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -666,6 +667,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID},
.init = sof_sdw_rt_sdca_jack_init, .init = sof_sdw_rt_sdca_jack_init,
.exit = sof_sdw_rt_sdca_jack_exit, .exit = sof_sdw_rt_sdca_jack_exit,
.rtd_init = rt_sdca_jack_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -681,6 +683,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -681,6 +683,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID},
.init = sof_sdw_rt711_init, .init = sof_sdw_rt711_init,
.exit = sof_sdw_rt711_exit, .exit = sof_sdw_rt711_exit,
.rtd_init = rt711_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -696,6 +699,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -696,6 +699,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID},
.init = sof_sdw_rt_sdca_jack_init, .init = sof_sdw_rt_sdca_jack_init,
.exit = sof_sdw_rt_sdca_jack_exit, .exit = sof_sdw_rt_sdca_jack_exit,
.rtd_init = rt_sdca_jack_rtd_init,
}, },
{ {
.direction = {true, false}, .direction = {true, false},
...@@ -703,6 +707,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -703,6 +707,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_AMP, .dai_type = SOF_SDW_DAI_TYPE_AMP,
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID}, .dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID},
.init = sof_sdw_rt712_spk_init, .init = sof_sdw_rt712_spk_init,
.rtd_init = rt712_spk_rtd_init,
}, },
}, },
.dai_num = 2, .dai_num = 2,
...@@ -717,6 +722,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -717,6 +722,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_MIC, .dai_type = SOF_SDW_DAI_TYPE_MIC,
.dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID},
.init = sof_sdw_rt712_sdca_dmic_init, .init = sof_sdw_rt712_sdca_dmic_init,
.rtd_init = rt712_sdca_dmic_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -732,6 +738,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -732,6 +738,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID},
.init = sof_sdw_rt_sdca_jack_init, .init = sof_sdw_rt_sdca_jack_init,
.exit = sof_sdw_rt_sdca_jack_exit, .exit = sof_sdw_rt_sdca_jack_exit,
.rtd_init = rt_sdca_jack_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -746,6 +753,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -746,6 +753,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_MIC, .dai_type = SOF_SDW_DAI_TYPE_MIC,
.dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID},
.init = sof_sdw_rt712_sdca_dmic_init, .init = sof_sdw_rt712_sdca_dmic_init,
.rtd_init = rt712_sdca_dmic_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -761,6 +769,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -761,6 +769,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID}, .dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID},
.init = sof_sdw_rt_amp_init, .init = sof_sdw_rt_amp_init,
.exit = sof_sdw_rt_amp_exit, .exit = sof_sdw_rt_amp_exit,
.rtd_init = rt_amp_spk_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -776,6 +785,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -776,6 +785,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID}, .dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID},
.init = sof_sdw_rt_amp_init, .init = sof_sdw_rt_amp_init,
.exit = sof_sdw_rt_amp_exit, .exit = sof_sdw_rt_amp_exit,
.rtd_init = rt_amp_spk_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -790,6 +800,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -790,6 +800,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID}, .dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID},
.init = sof_sdw_rt_amp_init, .init = sof_sdw_rt_amp_init,
.exit = sof_sdw_rt_amp_exit, .exit = sof_sdw_rt_amp_exit,
.rtd_init = rt_amp_spk_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -805,6 +816,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -805,6 +816,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_MIC, .dai_type = SOF_SDW_DAI_TYPE_MIC,
.dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID},
.init = sof_sdw_rt715_sdca_init, .init = sof_sdw_rt715_sdca_init,
.rtd_init = rt715_sdca_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -820,6 +832,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -820,6 +832,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_MIC, .dai_type = SOF_SDW_DAI_TYPE_MIC,
.dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID},
.init = sof_sdw_rt715_sdca_init, .init = sof_sdw_rt715_sdca_init,
.rtd_init = rt715_sdca_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -835,6 +848,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -835,6 +848,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_MIC, .dai_type = SOF_SDW_DAI_TYPE_MIC,
.dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID},
.init = sof_sdw_rt715_init, .init = sof_sdw_rt715_init,
.rtd_init = rt715_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -850,6 +864,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -850,6 +864,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_MIC, .dai_type = SOF_SDW_DAI_TYPE_MIC,
.dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID},
.init = sof_sdw_rt715_init, .init = sof_sdw_rt715_init,
.rtd_init = rt715_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -893,6 +908,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -893,6 +908,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_AMP, .dai_type = SOF_SDW_DAI_TYPE_AMP,
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID}, .dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID},
.init = sof_sdw_maxim_init, .init = sof_sdw_maxim_init,
.rtd_init = maxim_spk_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -906,6 +922,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -906,6 +922,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_AMP, .dai_type = SOF_SDW_DAI_TYPE_AMP,
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID}, .dailink = {SDW_AMP_OUT_DAI_ID, SDW_UNUSED_DAI_ID},
.init = sof_sdw_maxim_init, .init = sof_sdw_maxim_init,
.rtd_init = maxim_spk_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -919,6 +936,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -919,6 +936,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_JACK, .dai_type = SOF_SDW_DAI_TYPE_JACK,
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID},
.init = sof_sdw_rt5682_init, .init = sof_sdw_rt5682_init,
.rtd_init = rt5682_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -932,6 +950,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -932,6 +950,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_AMP, .dai_type = SOF_SDW_DAI_TYPE_AMP,
.dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID}, .dailink = {SDW_AMP_OUT_DAI_ID, SDW_AMP_IN_DAI_ID},
.init = sof_sdw_cs_amp_init, .init = sof_sdw_cs_amp_init,
.rtd_init = cs_spk_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -945,6 +964,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -945,6 +964,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_JACK, .dai_type = SOF_SDW_DAI_TYPE_JACK,
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID}, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_JACK_IN_DAI_ID},
.init = sof_sdw_cs42l42_init, .init = sof_sdw_cs42l42_init,
.rtd_init = cs42l42_rtd_init,
}, },
}, },
.dai_num = 1, .dai_num = 1,
...@@ -959,6 +979,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -959,6 +979,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_JACK, .dai_type = SOF_SDW_DAI_TYPE_JACK,
.dailink = {SDW_JACK_OUT_DAI_ID, SDW_UNUSED_DAI_ID}, .dailink = {SDW_JACK_OUT_DAI_ID, SDW_UNUSED_DAI_ID},
.init = sof_sdw_cs42l43_hs_init, .init = sof_sdw_cs42l43_hs_init,
.rtd_init = cs42l43_hs_rtd_init,
}, },
{ {
.direction = {false, true}, .direction = {false, true},
...@@ -966,6 +987,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { ...@@ -966,6 +987,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
.dai_type = SOF_SDW_DAI_TYPE_MIC, .dai_type = SOF_SDW_DAI_TYPE_MIC,
.dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID}, .dailink = {SDW_UNUSED_DAI_ID, SDW_DMIC_DAI_ID},
.init = sof_sdw_cs42l43_dmic_init, .init = sof_sdw_cs42l43_dmic_init,
.rtd_init = cs42l43_dmic_rtd_init,
}, },
{ {
.direction = {false, true}, .direction = {false, true},
...@@ -1387,6 +1409,56 @@ static void set_dailink_map(struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps, ...@@ -1387,6 +1409,56 @@ static void set_dailink_map(struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps,
} }
} }
static inline int find_codec_info_dai(const char *dai_name, int *dai_index)
{
int i, j;
for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) {
for (j = 0; j < codec_info_list[i].dai_num; j++) {
if (!strcmp(codec_info_list[i].dais[j].dai_name, dai_name)) {
*dai_index = j;
return i;
}
}
}
return -EINVAL;
}
static int sof_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd)
{
struct sof_sdw_codec_info *codec_info;
struct snd_soc_dai *dai;
int codec_index;
int dai_index;
int ret;
int i;
for_each_rtd_codec_dais(rtd, i, dai) {
codec_index = find_codec_info_dai(dai->name, &dai_index);
if (codec_index < 0)
return -EINVAL;
codec_info = &codec_info_list[codec_index];
/*
* A codec dai can be connected to different dai links for capture and playback,
* but we only need to call the rtd_init function once.
* The rtd_init for each codec dai is independent. So, the order of rtd_init
* doesn't matter.
*/
if (codec_info->dais[dai_index].rtd_init_done)
continue;
if (codec_info->dais[dai_index].rtd_init) {
ret = codec_info->dais[dai_index].rtd_init(rtd);
if (ret)
return ret;
}
codec_info->dais[dai_index].rtd_init_done = true;
}
return 0;
}
static const char * const type_strings[] = {"SimpleJack", "SmartAmp", "SmartMic"}; static const char * const type_strings[] = {"SimpleJack", "SmartAmp", "SmartMic"};
static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
...@@ -1547,7 +1619,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, ...@@ -1547,7 +1619,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
init_dai_link(dev, dai_links + *link_index, be_id, name, init_dai_link(dev, dai_links + *link_index, be_id, name,
playback, capture, cpus, cpu_dai_num, codecs, codec_num, playback, capture, cpus, cpu_dai_num, codecs, codec_num,
NULL, &sdw_ops); sof_sdw_rtd_init, &sdw_ops);
/* /*
* SoundWire DAILINKs use 'stream' functions and Bank Switch operations * SoundWire DAILINKs use 'stream' functions and Bank Switch operations
...@@ -1880,6 +1952,7 @@ static void mc_dailink_exit_loop(struct snd_soc_card *card) ...@@ -1880,6 +1952,7 @@ static void mc_dailink_exit_loop(struct snd_soc_card *card)
for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) { for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) {
for (j = 0; j < codec_info_list[i].dai_num; j++) { for (j = 0; j < codec_info_list[i].dai_num; j++) {
codec_info_list[i].dais[j].rtd_init_done = false;
/* Check each dai in codec_info_lis to see if it is used in the link */ /* Check each dai in codec_info_lis to see if it is used in the link */
if (!codec_info_list[i].dais[j].exit) if (!codec_info_list[i].dais[j].exit)
continue; continue;
......
...@@ -78,6 +78,8 @@ struct sof_sdw_dai_info { ...@@ -78,6 +78,8 @@ struct sof_sdw_dai_info {
struct sof_sdw_codec_info *info, struct sof_sdw_codec_info *info,
bool playback); bool playback);
int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
int (*rtd_init)(struct snd_soc_pcm_runtime *rtd);
bool rtd_init_done; /* Indicate that the rtd_init callback is done */
}; };
struct sof_sdw_codec_info { struct sof_sdw_codec_info {
...@@ -235,4 +237,22 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card, ...@@ -235,4 +237,22 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links, struct snd_soc_dai_link *dai_links,
struct sof_sdw_codec_info *info, struct sof_sdw_codec_info *info,
bool playback); bool playback);
/* dai_link init callbacks */
int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd);
int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd);
int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd);
int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd);
int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt712_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt715_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt715_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd);
int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd);
#endif #endif
...@@ -51,7 +51,7 @@ static const char * const jack_codecs[] = { ...@@ -51,7 +51,7 @@ static const char * const jack_codecs[] = {
"cs42l42" "cs42l42"
}; };
static int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -135,8 +135,6 @@ int sof_sdw_cs42l42_init(struct snd_soc_card *card, ...@@ -135,8 +135,6 @@ int sof_sdw_cs42l42_init(struct snd_soc_card *card,
if (!playback) if (!playback)
return 0; return 0;
dai_links->init = cs42l42_rtd_init;
return 0; return 0;
} }
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS);
...@@ -50,7 +50,7 @@ static struct snd_soc_jack_pin sof_jack_pins[] = { ...@@ -50,7 +50,7 @@ static struct snd_soc_jack_pin sof_jack_pins[] = {
}, },
}; };
static int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component; struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
struct mc_private *ctx = snd_soc_card_get_drvdata(rtd->card); struct mc_private *ctx = snd_soc_card_get_drvdata(rtd->card);
...@@ -116,12 +116,11 @@ int sof_sdw_cs42l43_hs_init(struct snd_soc_card *card, const struct snd_soc_acpi ...@@ -116,12 +116,11 @@ int sof_sdw_cs42l43_hs_init(struct snd_soc_card *card, const struct snd_soc_acpi
* No need to test if (!playback) like other codecs as cs42l43 uses separated dai for * No need to test if (!playback) like other codecs as cs42l43 uses separated dai for
* playback and capture, and sof_sdw_cs42l43_init is only linked to the playback dai. * playback and capture, and sof_sdw_cs42l43_init is only linked to the playback dai.
*/ */
dai_links->init = cs42l43_hs_rtd_init;
return 0; return 0;
} }
static int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -150,7 +149,5 @@ int sof_sdw_cs42l43_dmic_init(struct snd_soc_card *card, const struct snd_soc_ac ...@@ -150,7 +149,5 @@ int sof_sdw_cs42l43_dmic_init(struct snd_soc_card *card, const struct snd_soc_ac
struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info,
bool playback) bool playback)
{ {
dai_links->init = cs42l43_dmic_rtd_init;
return 0; return 0;
} }
...@@ -18,7 +18,7 @@ static const struct snd_soc_dapm_widget sof_widgets[] = { ...@@ -18,7 +18,7 @@ static const struct snd_soc_dapm_widget sof_widgets[] = {
SND_SOC_DAPM_SPK("Speakers", NULL), SND_SOC_DAPM_SPK("Speakers", NULL),
}; };
static int cs_spk_init(struct snd_soc_pcm_runtime *rtd) int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
const char *dai_name = rtd->dai_link->codecs->dai_name; const char *dai_name = rtd->dai_link->codecs->dai_name;
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
...@@ -67,7 +67,6 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card, ...@@ -67,7 +67,6 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card,
return 0; return 0;
info->amp_num++; info->amp_num++;
dai_links->init = cs_spk_init;
return 0; return 0;
} }
...@@ -27,7 +27,7 @@ static const struct snd_kcontrol_new maxim_controls[] = { ...@@ -27,7 +27,7 @@ static const struct snd_kcontrol_new maxim_controls[] = {
SOC_DAPM_PIN_SWITCH("Right Spk"), SOC_DAPM_PIN_SWITCH("Right Spk"),
}; };
static int spk_init(struct snd_soc_pcm_runtime *rtd) int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -145,8 +145,6 @@ int sof_sdw_maxim_init(struct snd_soc_card *card, ...@@ -145,8 +145,6 @@ int sof_sdw_maxim_init(struct snd_soc_card *card,
bool playback) bool playback)
{ {
info->amp_num++; info->amp_num++;
if (info->amp_num == 2)
dai_links->init = spk_init;
maxim_part_id = info->part_id; maxim_part_id = info->part_id;
switch (maxim_part_id) { switch (maxim_part_id) {
......
...@@ -50,7 +50,7 @@ static const char * const jack_codecs[] = { ...@@ -50,7 +50,7 @@ static const char * const jack_codecs[] = {
"rt5682" "rt5682"
}; };
static int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -134,8 +134,6 @@ int sof_sdw_rt5682_init(struct snd_soc_card *card, ...@@ -134,8 +134,6 @@ int sof_sdw_rt5682_init(struct snd_soc_card *card,
if (!playback) if (!playback)
return 0; return 0;
dai_links->init = rt5682_rtd_init;
return 0; return 0;
} }
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS);
...@@ -50,7 +50,7 @@ static const char * const jack_codecs[] = { ...@@ -50,7 +50,7 @@ static const char * const jack_codecs[] = {
"rt700" "rt700"
}; };
static int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -133,8 +133,6 @@ int sof_sdw_rt700_init(struct snd_soc_card *card, ...@@ -133,8 +133,6 @@ int sof_sdw_rt700_init(struct snd_soc_card *card,
if (!playback) if (!playback)
return 0; return 0;
dai_links->init = rt700_rtd_init;
return 0; return 0;
} }
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS);
...@@ -74,7 +74,7 @@ static const char * const jack_codecs[] = { ...@@ -74,7 +74,7 @@ static const char * const jack_codecs[] = {
"rt711" "rt711"
}; };
static int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -186,8 +186,6 @@ int sof_sdw_rt711_init(struct snd_soc_card *card, ...@@ -186,8 +186,6 @@ int sof_sdw_rt711_init(struct snd_soc_card *card,
} }
ctx->headset_codec_dev = sdw_dev; ctx->headset_codec_dev = sdw_dev;
dai_links->init = rt711_rtd_init;
return 0; return 0;
} }
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS);
...@@ -35,7 +35,7 @@ static const struct snd_kcontrol_new rt712_spk_controls[] = { ...@@ -35,7 +35,7 @@ static const struct snd_kcontrol_new rt712_spk_controls[] = {
SOC_DAPM_PIN_SWITCH("Speaker"), SOC_DAPM_PIN_SWITCH("Speaker"),
}; };
static int rt712_spk_init(struct snd_soc_pcm_runtime *rtd) int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -73,8 +73,6 @@ int sof_sdw_rt712_spk_init(struct snd_soc_card *card, ...@@ -73,8 +73,6 @@ int sof_sdw_rt712_spk_init(struct snd_soc_card *card,
struct sof_sdw_codec_info *info, struct sof_sdw_codec_info *info,
bool playback) bool playback)
{ {
dai_links->init = rt712_spk_init;
return 0; return 0;
} }
...@@ -82,7 +80,7 @@ static const char * const dmics[] = { ...@@ -82,7 +80,7 @@ static const char * const dmics[] = {
"rt712-sdca-dmic" "rt712-sdca-dmic"
}; };
static int rt712_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt712_sdca_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
...@@ -108,8 +106,6 @@ int sof_sdw_rt712_sdca_dmic_init(struct snd_soc_card *card, ...@@ -108,8 +106,6 @@ int sof_sdw_rt712_sdca_dmic_init(struct snd_soc_card *card,
struct sof_sdw_codec_info *info, struct sof_sdw_codec_info *info,
bool playback) bool playback)
{ {
dai_links->init = rt712_sdca_dmic_rtd_init;
return 0; return 0;
} }
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS);
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static int rt715_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt715_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
...@@ -30,7 +30,5 @@ int sof_sdw_rt715_init(struct snd_soc_card *card, ...@@ -30,7 +30,5 @@ int sof_sdw_rt715_init(struct snd_soc_card *card,
struct sof_sdw_codec_info *info, struct sof_sdw_codec_info *info,
bool playback) bool playback)
{ {
dai_links->init = rt715_rtd_init;
return 0; return 0;
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static int rt715_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt715_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
...@@ -30,7 +30,5 @@ int sof_sdw_rt715_sdca_init(struct snd_soc_card *card, ...@@ -30,7 +30,5 @@ int sof_sdw_rt715_sdca_init(struct snd_soc_card *card,
struct sof_sdw_codec_info *info, struct sof_sdw_codec_info *info,
bool playback) bool playback)
{ {
dai_links->init = rt715_sdca_rtd_init;
return 0; return 0;
} }
...@@ -185,7 +185,7 @@ static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_ ...@@ -185,7 +185,7 @@ static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_
return rt1318_map; return rt1318_map;
} }
static int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
const struct snd_soc_dapm_route *rt_amp_map; const struct snd_soc_dapm_route *rt_amp_map;
...@@ -295,7 +295,6 @@ int sof_sdw_rt_amp_init(struct snd_soc_card *card, ...@@ -295,7 +295,6 @@ int sof_sdw_rt_amp_init(struct snd_soc_card *card,
return 0; return 0;
info->amp_num++; info->amp_num++;
dai_links->init = rt_amp_spk_rtd_init;
if (info->amp_num == 2) { if (info->amp_num == 2) {
sdw_dev1 = bus_find_device_by_name(&sdw_bus_type, NULL, dai_links->codecs[0].name); sdw_dev1 = bus_find_device_by_name(&sdw_bus_type, NULL, dai_links->codecs[0].name);
......
...@@ -89,7 +89,7 @@ static const char * const jack_codecs[] = { ...@@ -89,7 +89,7 @@ static const char * const jack_codecs[] = {
"rt711", "rt712", "rt713" "rt711", "rt712", "rt713"
}; };
static int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
...@@ -219,8 +219,6 @@ int sof_sdw_rt_sdca_jack_init(struct snd_soc_card *card, ...@@ -219,8 +219,6 @@ int sof_sdw_rt_sdca_jack_init(struct snd_soc_card *card,
} }
ctx->headset_codec_dev = sdw_dev; ctx->headset_codec_dev = sdw_dev;
dai_links->init = rt_sdca_jack_rtd_init;
return 0; return 0;
} }
MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS); MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS);
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