diff mbox series

[2/3] ASoC: hdmi-codec: use snd_pcm_add_chmap_ctls_with_prefix to add controls

Message ID 20230505165514.4666-3-srinivas.kandagatla@linaro.org
State New
Headers show
Series ASoC: hdmi-codec: add component name prefix to controls | expand

Commit Message

Srinivas Kandagatla May 5, 2023, 4:55 p.m. UTC
If there are multiple instances of this codec in a sound card
snd_pcm_add_chmap_ctls() will fail with below error because of
duplicate control names.

snd-sc8280xp sound: control 3:16:0:Playback Channel Map:0 is already present
hdmi-audio-codec hdmi-audio-codec.4.auto: ASoC: error at snd_soc_pcm_dai_new on i2s-hifi: -16

Fix this by using snd_pcm_add_chmap_ctls_with_prefix along wth component
name prefix.

This issue is noticed on x13s laptop which has multiple instances of Displayport.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/codecs/hdmi-codec.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 6d980fbc4207..8c54cddf86b6 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -782,9 +782,10 @@  static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
 	unsigned int i;
 	int ret;
 
-	ret =  snd_pcm_add_chmap_ctls(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK,
-				      NULL, drv->playback.channels_max, 0,
-				      &hcp->chmap_info);
+	ret =  snd_pcm_add_chmap_ctls_with_prefix(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK,
+						  NULL, drv->playback.channels_max, 0,
+						  &hcp->chmap_info,
+						  dai->component->name_prefix);
 	if (ret < 0)
 		return ret;