While adding audio support to two instances of Display port on x13s,
hdmi-codec failed to add controls as two codec instances were trying
to add controls with same name.
snd-sc8280xp sound: control 3:16:0:IEC958 Playback Mask:0 is already present
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
To fix this issue, I have added a new api snd_pcm_add_chmap_ctls_with_prefix()
to allow to pass asoc component name prefix, which should provide a unique control
names. We can also make snd_pcm_add_chmap_ctls() take prefix argument to do the same
this.
Srinivas Kandagatla (3):
ALSA: pcm: add snd_pcm_add_chmap_ctls_with_prefix
ASoC: hdmi-codec: use snd_pcm_add_chmap_ctls_with_prefix to add
controls
ASoC: hdmi-codec: use snd_soc_cnew to add controls
include/sound/pcm.h | 7 +++++++
sound/core/pcm_lib.c | 30 ++++++++++++++++++++++++++++--
sound/soc/codecs/hdmi-codec.c | 10 ++++++----
3 files changed, 41 insertions(+), 6 deletions(-)
--
2.21.0
If there are multiple instances of this codec in a sound card using snd_ctl_new1
will fail with below error because of duplicate control names.
snd-sc8280xp sound: control 3:16:0:IEC958 Playback Mask: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_soc_cnew along with component name prefix to avoid
this duplication.
This issue is noticed on x13s laptop which has multiple instances of Displayport.
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/codecs/hdmi-codec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 8c54cddf86b6..48d1eef9c806 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -801,7 +801,8 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
struct snd_kcontrol *kctl;
/* add ELD ctl with the device number corresponding to the PCM stream */
- kctl = snd_ctl_new1(&hdmi_codec_controls[i], dai->component);
+ kctl = snd_soc_cnew(&hdmi_codec_controls[i], dai->component, NULL,
+ dai->component->name_prefix);
if (!kctl)
return -ENOMEM;
--
2.21.0
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 <[email protected]>
---
sound/soc/codecs/hdmi-codec.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
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;
--
2.21.0