From patchwork Fri May 5 16:55:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 13232849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D9E1C77B75 for ; Fri, 5 May 2023 16:57:27 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 621992D62; Fri, 5 May 2023 18:56:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 621992D62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1683305843; bh=5k2EEJbKh9lvF3Khnjqqy1PqsOydvu2y7CYBKzNMLl4=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lhrV0KL+02b8bNrsZ4TL26nMvGTBc6I017Obrlu/96zl7QqO5heuV+g5CltJTYupC QN5I4AQtVFTDYrxRHo8moDnVrY8DHj6FrwOnmUXDHg+7ToSi8AedxZRu3HdAH+3Rmx R0k4mIJVr8F8dB06uMceW/zB3p/a2WV+p7m+6l8o= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 47614F80548; Fri, 5 May 2023 18:55:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 83366F80520; Fri, 5 May 2023 18:55:37 +0200 (CEST) Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 79FD3F80520 for ; Fri, 5 May 2023 18:55:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 79FD3F80520 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=euW9BAvF Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3f195b164c4so14338945e9.1 for ; Fri, 05 May 2023 09:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683305726; x=1685897726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aF6c8vCGTR2QK7g+acfgalvT960Ey/zX9u4pUO/YPk4=; b=euW9BAvFE3t8iXyBsk24WqybtXMz1hn3/8p/p/SMWqG4ZV999cMBeAtF0afO96udkc hVHkCRO060nJyTif0EyCHr/FIioeqMhH15kXHq6m9gg/aW9nHWW+JjBgx/n/irJFyeNN RKrZaFDs+/5AbGQr6mKXRT0Z5OMw4Zr1jNERuUMH1OPOR9ojXB1+Sm6mzCi+bUyatuRs EPf0tthaARk1SxWI8TGPler1LKwustDq+QSfiN1fttlsMvqNMb6tzxQji395ttDYRqr9 5XOHQmWffE/Z8qnOCD/wNOawcOR1jJexdSnHTd0UGMxsPjZ4ZMa0r0bj0Ahbt5Nd836w G4Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683305726; x=1685897726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aF6c8vCGTR2QK7g+acfgalvT960Ey/zX9u4pUO/YPk4=; b=HTN/Ad1nYyv488OdyLtpCG4CKh+sQh/gsddipaODPPOBTIX2JlZrL83wvtPfxWYQIH Z2+ER4y7PgQ/svNoZdvJgu7yjQ0unMfK4os0+vVxPCiazxaDXz9dhukZQWmRTJrvUb4g Q3VuK21KSWQZCtrwjp70Ww4CM0elsCARuJ4aRk/EUZVQfp2KY/pja4Ac/5ebuBQnY1Rq 4jORplwQiUy2t02D3zORgn4lqGU2zuKP0J8fTZ70zIojVQuTEJhIwOcmcd41AETx/p+S v1WFrjG4DVQNoR4u6nGxqbVGoxarjvu+vpbsBk+VgqT2aMMRQMA8rnQnm4+KQqnn+RYP XQSw== X-Gm-Message-State: AC+VfDynvQecfKiA9ni5SGwplo1WF4HQ+bQFvteVa4HK3Rp7rQQL7NMr VbJ3TC5qg02skrl3ZLayuavfLw== X-Google-Smtp-Source: ACHHUZ4ZlBcgwrnBXnaGvQz3fDW5M2lcW+c3h6TrPi1wm2tp5F2+pVpr65y2y9ab/41UtPIf0A16/Q== X-Received: by 2002:a5d:48cc:0:b0:304:adbe:ea9d with SMTP id p12-20020a5d48cc000000b00304adbeea9dmr2018714wrs.30.1683305726481; Fri, 05 May 2023 09:55:26 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id x7-20020adfffc7000000b002c7066a6f77sm2923551wrs.31.2023.05.05.09.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 09:55:25 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, tiwai@suse.com Subject: [PATCH 1/3] ALSA: pcm: add snd_pcm_add_chmap_ctls_with_prefix Date: Fri, 5 May 2023 17:55:12 +0100 Message-Id: <20230505165514.4666-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230505165514.4666-1-srinivas.kandagatla@linaro.org> References: <20230505165514.4666-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Message-ID-Hash: 3L3AV5CHGCQ3M3OZ3Y7UGQ6BUCDDEVFS X-Message-ID-Hash: 3L3AV5CHGCQ3M3OZ3Y7UGQ6BUCDDEVFS X-MailFrom: srinivas.kandagatla@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Qualcomm SoC which has multiple Display Port controllers, using snd_pcm_add_chmap_ctls() to add chmap controls from every ASoC hdmi codec instance for a give card fails while adding second instance as the control with same name "Playback Channel Map" already exists from the first instance. Fix this by adding a new api wrapper to pass ASoC component name prefix to avoid such duplicate control naming. Signed-off-by: Srinivas Kandagatla --- We can also make snd_pcm_add_chmap_ctls to take prefix argument and avoid adding this new api, but that would touch lots of drivers. include/sound/pcm.h | 7 +++++++ sound/core/pcm_lib.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 27040b472a4f..39efd25b53e3 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -1528,6 +1528,13 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, unsigned long private_value, struct snd_pcm_chmap **info_ret); +int snd_pcm_add_chmap_ctls_with_prefix(struct snd_pcm *pcm, int stream, + const struct snd_pcm_chmap_elem *chmap, + int max_channels, + unsigned long private_value, + struct snd_pcm_chmap **info_ret, + const char *prefix); + /** * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise * @pcm_format: PCM format diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 8b6aeb8a78f7..ed75dd007425 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -2483,11 +2483,12 @@ static void pcm_chmap_ctl_private_free(struct snd_kcontrol *kcontrol) * Create channel-mapping control elements assigned to the given PCM stream(s). * Return: Zero if successful, or a negative error value. */ -int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, +int snd_pcm_add_chmap_ctls_with_prefix(struct snd_pcm *pcm, int stream, const struct snd_pcm_chmap_elem *chmap, int max_channels, unsigned long private_value, - struct snd_pcm_chmap **info_ret) + struct snd_pcm_chmap **info_ret, + const char *prefix) { struct snd_pcm_chmap *info; struct snd_kcontrol_new knew = { @@ -2499,6 +2500,7 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, .get = pcm_chmap_ctl_get, .tlv.c = pcm_chmap_ctl_tlv, }; + char *name = NULL; int err; if (WARN_ON(pcm->streams[stream].chmap_kctl)) @@ -2514,10 +2516,21 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, knew.name = "Playback Channel Map"; else knew.name = "Capture Channel Map"; + + if (prefix) { + name = kasprintf(GFP_KERNEL, "%s %s", prefix, knew.name); + if (!name) { + kfree(info); + return -ENOMEM; + } + knew.name = name; + } + knew.device = pcm->device; knew.count = pcm->streams[stream].substream_count; knew.private_value = private_value; info->kctl = snd_ctl_new1(&knew, info); + kfree(name); if (!info->kctl) { kfree(info); return -ENOMEM; @@ -2530,5 +2543,18 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, if (info_ret) *info_ret = info; return 0; + +} +EXPORT_SYMBOL_GPL(snd_pcm_add_chmap_ctls_with_prefix); + +int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, + const struct snd_pcm_chmap_elem *chmap, + int max_channels, + unsigned long private_value, + struct snd_pcm_chmap **info_ret) +{ + return snd_pcm_add_chmap_ctls_with_prefix(pcm, stream, chmap, + max_channels, private_value, + info_ret, NULL); } EXPORT_SYMBOL_GPL(snd_pcm_add_chmap_ctls); From patchwork Fri May 5 16:55:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 13232848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EDAC4C77B7C for ; Fri, 5 May 2023 16:57:19 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 47AD42D5B; Fri, 5 May 2023 18:56:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 47AD42D5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1683305837; bh=XtGUJPva7M5hIyyYvX7Ft242YfpcVEJV0H+8AslpSu8=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=GSWvSUfMZSIGCXzWyiSUJjM8+ZLpHmKH/2DWnLCtmoffC5F8fbnvPGD3VJWdtUnHN 9c8GrHBDaQoXAaAvmv7OEP0vbEg9IDwnWhcetcvv1MuzPyEqYcZgqPP1BCiBWT3jVa +tcAmVHEMbVE/uSPefK4UerNHj3WiSFIv6zxGC1g= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 8A289F8053B; Fri, 5 May 2023 18:55:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B6104F80533; Fri, 5 May 2023 18:55:33 +0200 (CEST) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 81259F8052D for ; Fri, 5 May 2023 18:55:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 81259F8052D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=c7fc4Z+R Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3f415a90215so512145e9.0 for ; Fri, 05 May 2023 09:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683305727; x=1685897727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BWd518ZVELbkPHYlOpmIJ7g/bmO3wYl7PpJavDJwK68=; b=c7fc4Z+RIAPUqsAFPp2G67pOYWK2PNIVlPcMURVWulSHwlGlmDQWWy0GUszI9vSQTf QhmlUVo9atPB+0/8hRcNFa+61TSG1KufgBpDfcRaQEwNBN13JRfCqcuhKWOliVO8wTMA nfaSDwNkKDXqGGCcI0qtz5ub3c7pGgudH2DAlirxI9mtkN81mD61o1IuiNzs1mvS9B2H l0E++3fyliRVDdn+P+ldd4IgGL6kGUYSry1U75OwRrCZiwTedjUdoe5DTME+tIIqJlEd n/RivTlWxyTDV3TFwQUalnUIA8lcqAylU2E2uAKhaBNGNelN80diIUsq3Drzcp4mXxiW Hwkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683305727; x=1685897727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BWd518ZVELbkPHYlOpmIJ7g/bmO3wYl7PpJavDJwK68=; b=k8F2midnE9DPI7bBnU4JgwfZmAvqetDySj2O0dR+CS7hgaCfsXPHk8IToRi1hp1ZpV lYDr0tRiWk8qQOPy460ulX2uNWeVS0mAuszCjVPhuXTqq8mogWi28cfC7f8DSN75d+Aw 8+Rd4p88UhlnEGzyzkY3eKmXSnGUNk1AaorJ4qywSkSl213/Pckls8m2n7gwGcHbYTpo YVVvVjPGb9NSnpvD6hssBwll+YAWgsjWQxBb319vFDcNbGTRim0nnbwK+6nbj3IAbHR4 59lR7Gosg5qUusDa3Ggc3n/iPPmOu8RABJ4h0l61w52jASrgPRVjeqvGBrLCLRV9510F 9/3w== X-Gm-Message-State: AC+VfDx+npCcrWmIZDy3pGF4CLPaqZjAqm5rNFAZo8w6bBVUoDSNtHYI wtOKH/aZ0gog5hYKoZA4I6Eql9U2A3uCCALhLb8= X-Google-Smtp-Source: ACHHUZ4fK6zbNXMaQt+c/2yHsoyXsoSqwsYxy1PcYMyflrt5ETa+uP3MLXHfFWP0GrIrSYDQ3NK05A== X-Received: by 2002:a05:600c:21cf:b0:3f1:6757:6245 with SMTP id x15-20020a05600c21cf00b003f167576245mr1688995wmj.7.1683305727569; Fri, 05 May 2023 09:55:27 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id x7-20020adfffc7000000b002c7066a6f77sm2923551wrs.31.2023.05.05.09.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 09:55:26 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, tiwai@suse.com Subject: [PATCH 2/3] ASoC: hdmi-codec: use snd_pcm_add_chmap_ctls_with_prefix to add controls Date: Fri, 5 May 2023 17:55:13 +0100 Message-Id: <20230505165514.4666-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230505165514.4666-1-srinivas.kandagatla@linaro.org> References: <20230505165514.4666-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Message-ID-Hash: MKSRWXWGRQMVUMXAY3TTGMC5TMLVPLNV X-Message-ID-Hash: MKSRWXWGRQMVUMXAY3TTGMC5TMLVPLNV X-MailFrom: srinivas.kandagatla@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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; From patchwork Fri May 5 16:55:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 13232850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4D7B2C77B7C for ; Fri, 5 May 2023 16:57:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 60C5E2D6D; Fri, 5 May 2023 18:56:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 60C5E2D6D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1683305864; bh=eG9vcpv4Bz5yalcqqmuJcXKkkF8smslBdM0h9TmfPrM=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=JAov1vqu7vvxLWZXwQ05rW5nSgrWAxWrOVf387ypqdPLotS9m/gvV1WtHPzY6QqK+ xvONjh9NcYqi/zW9sZ43YTGqXqnZ4geX4WgGBRrOcB7uQzGHKrGLYgt7AbGfHamn3F Ydmt4E/zm3VfK5gyFG9sSL5CZyytJAF0yG4wzQEc= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D41B8F80558; Fri, 5 May 2023 18:55:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 762DCF80548; Fri, 5 May 2023 18:55:38 +0200 (CEST) Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8521AF8052E for ; Fri, 5 May 2023 18:55:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8521AF8052E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=h2kiVF0I Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f192c23fffso14046585e9.3 for ; Fri, 05 May 2023 09:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683305729; x=1685897729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t5FjLfR0dXo5At1Nv29Yy33iCFfTFuwOYzh/k0tPY30=; b=h2kiVF0IAYWJVzk/aTOE5lG4mTWGCGqOzz7oqa1cEibfLFqfpXftD8+mXnGJ3ooHWS IwiU2xbAuSOG3BBfRsosNxzd4xmRAxRlZnnj7z66A4FlImtmpVtzl+qhgP/a0TD+xOuc gzHQOwfxqt7hnrRj/4968rJ4XQInsT/bGviRbiJxa6lp6iaAdaZ8mJ+Xc10i/71jTNxw iyisfDrfM94Dy5OW+1LNsZcF/d25rSUTrEdMMQgbqG88q+wtQywmWXOHlqspJuzDXXuw qqVm0we6aasVZV9JEcU00Wy5O5IMDJyTVGI8+ENgD0q5Nlwi3MfJBiUkBan3NJwXnfxO quww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683305729; x=1685897729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t5FjLfR0dXo5At1Nv29Yy33iCFfTFuwOYzh/k0tPY30=; b=h8ufzQmbLsvOSYcGDTXR5N5eXnOZP/H5Ta1R5wLg+ji+C7UHC2+TTWaFOmwgbnqEFb ttujydKHN3Qw2EWSmpVETkYYj9wKQChAlYSRAqH4dtleohZC6ti8H2DP7QReTIdv8tS0 imZEUNIQao9XPsF8+qmdmssIz++zMuiMVJWaW9fbL/f5py+9oMQcAVBAlJGw2v9J2UN3 NRwcuLqCqXAjSn37Xch3VCJpZ0f8DgXwviyZc/QP32TlVAMxhJlZskyv09C6vhhkSLqV DV+D4XOTH38M1jPLgkAnxFTVwM7wVSfAMED8RRzHUQ8DZjPJm288K74UmAzx+qtZ0Rjx UJdQ== X-Gm-Message-State: AC+VfDzvV/7ygifx95vAwI9OMf8Jlv1rPqLbpr2LlQCjWkoRR3UK4mXp JSrzpXUP76BLXivF2Hb7O3M83Q== X-Google-Smtp-Source: ACHHUZ60mo9CYfuAJyu07wBUOWWLk7kW4NKYDEp4m79W50XgNcx+2nLVG5HKWdgdYDrfhhambBQ6rg== X-Received: by 2002:a7b:c7d3:0:b0:3f0:683d:224d with SMTP id z19-20020a7bc7d3000000b003f0683d224dmr1768579wmk.9.1683305728751; Fri, 05 May 2023 09:55:28 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id x7-20020adfffc7000000b002c7066a6f77sm2923551wrs.31.2023.05.05.09.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 09:55:28 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, tiwai@suse.com Subject: [PATCH 3/3] ASoC: hdmi-codec: use snd_soc_cnew to add controls Date: Fri, 5 May 2023 17:55:14 +0100 Message-Id: <20230505165514.4666-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230505165514.4666-1-srinivas.kandagatla@linaro.org> References: <20230505165514.4666-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Message-ID-Hash: ZLTXYQXCLXPTINL7ZEIKNJIYCYUDTHX6 X-Message-ID-Hash: ZLTXYQXCLXPTINL7ZEIKNJIYCYUDTHX6 X-MailFrom: srinivas.kandagatla@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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;