All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: broonie@kernel.org, tiwai@suse.com
Cc: perex@perex.cz, lgirdwood@gmail.com,
	ckeepax@opensource.cirrus.com, kuninori.morimoto.gx@renesas.com,
	linux-kernel@vger.kernel.org,
	pierre-louis.bossart@linux.intel.com,
	alsa-devel@alsa-project.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH 3/3] ASoC: hdmi-codec: use snd_soc_cnew to add controls
Date: Fri,  5 May 2023 17:55:14 +0100	[thread overview]
Message-ID: <20230505165514.4666-4-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20230505165514.4666-1-srinivas.kandagatla@linaro.org>

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 <srinivas.kandagatla@linaro.org>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: broonie@kernel.org, tiwai@suse.com
Cc: lgirdwood@gmail.com, ckeepax@opensource.cirrus.com,
	kuninori.morimoto.gx@renesas.com, linux-kernel@vger.kernel.org,
	pierre-louis.bossart@linux.intel.com,
	alsa-devel@alsa-project.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH 3/3] ASoC: hdmi-codec: use snd_soc_cnew to add controls
Date: Fri,  5 May 2023 17:55:14 +0100	[thread overview]
Message-ID: <20230505165514.4666-4-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20230505165514.4666-1-srinivas.kandagatla@linaro.org>

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 <srinivas.kandagatla@linaro.org>
---
 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


  parent reply	other threads:[~2023-05-05 16:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 16:55 [PATCH 0/3] ASoC: hdmi-codec: add component name prefix to controls Srinivas Kandagatla
2023-05-05 16:55 ` Srinivas Kandagatla
2023-05-05 16:55 ` [PATCH 1/3] ALSA: pcm: add snd_pcm_add_chmap_ctls_with_prefix Srinivas Kandagatla
2023-05-05 16:55   ` Srinivas Kandagatla
2023-05-06  5:57   ` Takashi Iwai
2023-05-06  5:57     ` Takashi Iwai
2023-05-06  7:42     ` Srinivas Kandagatla
2023-05-06  7:42       ` Srinivas Kandagatla
2023-05-05 16:55 ` [PATCH 2/3] ASoC: hdmi-codec: use snd_pcm_add_chmap_ctls_with_prefix to add controls Srinivas Kandagatla
2023-05-05 16:55   ` Srinivas Kandagatla
2023-05-05 16:55 ` Srinivas Kandagatla [this message]
2023-05-05 16:55   ` [PATCH 3/3] ASoC: hdmi-codec: use snd_soc_cnew " Srinivas Kandagatla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230505165514.4666-4-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.