summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorBard Liao <yung-chuan.liao@linux.intel.com>2024-05-09 18:34:18 +0200
committerMark Brown <broonie@kernel.org>2024-05-10 08:11:50 +0200
commit4c11132a886ea93865e205e2d92d810722237b48 (patch)
tree6b1e35192e03c1744bf2743c70a4963e1234d33d /sound
parentASoC: Intel: sof_sdw: add dai parameter to rtd_init callback (diff)
downloadlinux-4c11132a886ea93865e205e2d92d810722237b48.tar.xz
linux-4c11132a886ea93865e205e2d92d810722237b48.zip
ASoC: Intel: sof_sdw_rt_amp: use dai parameter
get_codec_name_and_route() get dai name from the first codec dai in a dai link. However, the dai may not always be the first codec dai. Use the dai parameter to make sure get_codec_name_and_route() refers to the correct dai. Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20240509163418.67746-19-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/boards/sof_sdw_rt_amp.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sound/soc/intel/boards/sof_sdw_rt_amp.c b/sound/soc/intel/boards/sof_sdw_rt_amp.c
index df03441ab364..797ea9ffa77a 100644
--- a/sound/soc/intel/boards/sof_sdw_rt_amp.c
+++ b/sound/soc/intel/boards/sof_sdw_rt_amp.c
@@ -158,15 +158,11 @@ static const struct snd_soc_dapm_route rt1318_map[] = {
{ "Speaker", NULL, "rt1318-2 SPOR" },
};
-static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_pcm_runtime *rtd,
+static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_dai *dai,
char *codec_name)
{
- const char *dai_name;
-
- dai_name = rtd->dai_link->codecs->dai_name;
-
/* get the codec name */
- snprintf(codec_name, CODEC_NAME_SIZE, "%s", dai_name);
+ snprintf(codec_name, CODEC_NAME_SIZE, "%s", dai->name);
/* choose the right codec's map */
if (strcmp(codec_name, "rt1308") == 0)
@@ -186,7 +182,7 @@ int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai
int ret;
int i;
- rt_amp_map = get_codec_name_and_route(rtd, codec_name);
+ rt_amp_map = get_codec_name_and_route(dai, codec_name);
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s spk:%s",