Skip to content

Commit 4c11132

Browse files
bardliaobroonie
authored andcommitted
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>
1 parent 84e0a19 commit 4c11132

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

sound/soc/intel/boards/sof_sdw_rt_amp.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,11 @@ static const struct snd_soc_dapm_route rt1318_map[] = {
158158
{ "Speaker", NULL, "rt1318-2 SPOR" },
159159
};
160160

161-
static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_pcm_runtime *rtd,
161+
static const struct snd_soc_dapm_route *get_codec_name_and_route(struct snd_soc_dai *dai,
162162
char *codec_name)
163163
{
164-
const char *dai_name;
165-
166-
dai_name = rtd->dai_link->codecs->dai_name;
167-
168164
/* get the codec name */
169-
snprintf(codec_name, CODEC_NAME_SIZE, "%s", dai_name);
165+
snprintf(codec_name, CODEC_NAME_SIZE, "%s", dai->name);
170166

171167
/* choose the right codec's map */
172168
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
186182
int ret;
187183
int i;
188184

189-
rt_amp_map = get_codec_name_and_route(rtd, codec_name);
185+
rt_amp_map = get_codec_name_and_route(dai, codec_name);
190186

191187
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
192188
"%s spk:%s",

0 commit comments

Comments
 (0)