Commit 84e0a19a authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: Intel: sof_sdw: add dai parameter to rtd_init callback

A generic .rtd_init() callback could be used by different dais. It is
useful to pass dai parameter to the callback. The dai parameter will be
used in the follow up commit. No functional change here.
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.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/20240509163418.67746-18-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2e3bc947
...@@ -1411,7 +1411,7 @@ static int sof_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -1411,7 +1411,7 @@ static int sof_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd)
skip_add_controls_widgets: skip_add_controls_widgets:
if (codec_info->dais[dai_index].rtd_init) { if (codec_info->dais[dai_index].rtd_init) {
ret = codec_info->dais[dai_index].rtd_init(rtd); ret = codec_info->dais[dai_index].rtd_init(rtd, dai);
if (ret) if (ret)
return ret; return ret;
} }
......
...@@ -95,7 +95,7 @@ struct sof_sdw_dai_info { ...@@ -95,7 +95,7 @@ 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); int (*rtd_init)(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
bool rtd_init_done; /* Indicate that the rtd_init callback is done */ bool rtd_init_done; /* Indicate that the rtd_init callback is done */
unsigned long quirk; unsigned long quirk;
}; };
...@@ -208,19 +208,19 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card, ...@@ -208,19 +208,19 @@ int sof_sdw_cs_amp_init(struct snd_soc_card *card,
/* dai_link init callbacks */ /* dai_link init callbacks */
int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
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_dai *dai);
int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
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_dai *dai);
int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd); int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
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_dai *dai);
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_dai *dai);
#endif #endif
...@@ -40,7 +40,7 @@ static const char * const jack_codecs[] = { ...@@ -40,7 +40,7 @@ static const char * const jack_codecs[] = {
"cs42l42" "cs42l42"
}; };
int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
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);
......
...@@ -48,7 +48,7 @@ static struct snd_soc_jack_pin sof_jack_pins[] = { ...@@ -48,7 +48,7 @@ static struct snd_soc_jack_pin sof_jack_pins[] = {
}, },
}; };
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_dai *dai)
{ {
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);
...@@ -99,7 +99,7 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -99,7 +99,7 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
} }
int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
...@@ -135,7 +135,7 @@ int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card, ...@@ -135,7 +135,7 @@ int sof_sdw_cs42l43_spk_init(struct snd_soc_card *card,
return bridge_cs35l56_spk_init(card, dai_links, info, playback); return bridge_cs35l56_spk_init(card, dai_links, info, playback);
} }
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_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#define CODEC_NAME_SIZE 8 #define CODEC_NAME_SIZE 8
int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
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;
......
...@@ -21,7 +21,7 @@ static const struct snd_soc_dapm_route max_98373_dapm_routes[] = { ...@@ -21,7 +21,7 @@ static const struct snd_soc_dapm_route max_98373_dapm_routes[] = {
{ "Right Spk", NULL, "Right BE_OUT" }, { "Right Spk", NULL, "Right BE_OUT" },
}; };
int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) int maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
......
...@@ -39,7 +39,7 @@ static const char * const jack_codecs[] = { ...@@ -39,7 +39,7 @@ static const char * const jack_codecs[] = {
"rt5682" "rt5682"
}; };
int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
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);
......
...@@ -37,7 +37,7 @@ static const char * const jack_codecs[] = { ...@@ -37,7 +37,7 @@ static const char * const jack_codecs[] = {
"rt700" "rt700"
}; };
int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
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);
......
...@@ -63,7 +63,7 @@ static const char * const jack_codecs[] = { ...@@ -63,7 +63,7 @@ static const char * const jack_codecs[] = {
"rt711" "rt711"
}; };
int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
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);
......
...@@ -26,7 +26,7 @@ static const struct snd_soc_dapm_route rt712_spk_map[] = { ...@@ -26,7 +26,7 @@ static const struct snd_soc_dapm_route rt712_spk_map[] = {
{ "Speaker", NULL, "rt712 SPOR" }, { "Speaker", NULL, "rt712 SPOR" },
}; };
int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
......
...@@ -19,7 +19,7 @@ static const struct snd_soc_dapm_route rt722_spk_map[] = { ...@@ -19,7 +19,7 @@ static const struct snd_soc_dapm_route rt722_spk_map[] = {
{ "Speaker", NULL, "rt722 SPK" }, { "Speaker", NULL, "rt722 SPK" },
}; };
int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
int ret; int ret;
......
...@@ -177,12 +177,12 @@ static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_ ...@@ -177,12 +177,12 @@ static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_
return rt1318_map; return rt1318_map;
} }
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_dai *dai)
{ {
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;
char codec_name[CODEC_NAME_SIZE]; char codec_name[CODEC_NAME_SIZE];
struct snd_soc_dai *dai; struct snd_soc_dai *codec_dai;
int ret; int ret;
int i; int i;
...@@ -194,10 +194,10 @@ int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -194,10 +194,10 @@ int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
for_each_rtd_codec_dais(rtd, i, dai) { for_each_rtd_codec_dais(rtd, i, codec_dai) {
if (strstr(dai->component->name_prefix, "-1")) if (strstr(codec_dai->component->name_prefix, "-1"))
ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map, 2); ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map, 2);
else if (strstr(dai->component->name_prefix, "-2")) else if (strstr(codec_dai->component->name_prefix, "-2"))
ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map + 2, 2); ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map + 2, 2);
} }
......
...@@ -19,7 +19,7 @@ static const char * const dmics[] = { ...@@ -19,7 +19,7 @@ static const char * const dmics[] = {
"rt722-sdca", "rt722-sdca",
}; };
int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) int rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{ {
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct snd_soc_component *component; struct snd_soc_component *component;
......
...@@ -87,7 +87,7 @@ static const char * const need_sdca_suffix[] = { ...@@ -87,7 +87,7 @@ static const char * const need_sdca_suffix[] = {
"rt711", "rt713" "rt711", "rt713"
}; };
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_dai *dai)
{ {
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);
......
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