From patchwork Mon Aug 14 23:23:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 714086 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 9C57CC001B0 for ; Mon, 14 Aug 2023 23:25:32 +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 F19AF83E; Tue, 15 Aug 2023 01:24:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F19AF83E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692055531; bh=YWiIp/tFL4a9PLxSEQX+uwLd81Di0oyL5y5PXi/twzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ajmYf0gscBHywXdugJBQ8MT97INKMUxURf9CUfocfyLnxyvoxEqymlnvU/ej9XFxg sGUYckukpwTgcOoa9y1TLxWh6AnEYPIOvE3kcFvH5ohRlaSd6QJay1TFER3rNzgT6j LAv4mVwO0CJKmzPTbaIxNb8CKu6GED24/9BVyHWo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0842AF801EB; Tue, 15 Aug 2023 01:23:51 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 6CFD9F80557; Tue, 15 Aug 2023 01:23:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F16E4F80016; Tue, 15 Aug 2023 01:23:46 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 968FCF80016 for ; Tue, 15 Aug 2023 01:23:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 968FCF80016 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Ib6O6bZY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692055424; x=1723591424; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YWiIp/tFL4a9PLxSEQX+uwLd81Di0oyL5y5PXi/twzg=; b=Ib6O6bZYTuLcgccd9aDHHUjcOtqssU0gP/UMPqxDKFhxnd3XBJj908fD E5jyNkvYDB5wXoOeP383m59GzEKLoh0x8XY3KqEWowR7Y2csuZgHOMYpH zzAmKIoSAmZH0nRCqleq0ho8Xm5uZMBa6qprF0U5YcyoCIbYtarviGEXJ gRZymFBrqJKviCQx7p0TrWZeSdbEjMiByRj1OO7zFl5BjwHQHTgkiArdo B0uKrQxAK2eKbni1s+aEoqnLH1P4ryeURaTCPA634x0kYvOipcEw0CI1Q 23k/5VvrZsknaPbBM2mEJMySI+5n8bkpbwdj9ofJGJ5IQcJK2j1negngK Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="436051851" X-IronPort-AV: E=Sophos;i="6.01,173,1684825200"; d="scan'208";a="436051851" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2023 16:23:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="823642504" X-IronPort-AV: E=Sophos;i="6.01,173,1684825200"; d="scan'208";a="823642504" Received: from dishasur-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.104.139]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2023 16:23:34 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Jyri Sarha , Ranjani Sridharan , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 1/2] ASoC: dapm: Add a flag for not having widget name in kcontrol name Date: Mon, 14 Aug 2023 18:23:24 -0500 Message-Id: <20230814232325.86397-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230814232325.86397-1-pierre-louis.bossart@linux.intel.com> References: <20230814232325.86397-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: P4BW7WCJQOX2IQGU5FWLA555ASXMYJ7G X-Message-ID-Hash: P4BW7WCJQOX2IQGU5FWLA555ASXMYJ7G X-MailFrom: pierre-louis.bossart@linux.intel.com 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 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: From: Jyri Sarha The existing soc-dapm code may add a prefix to control names, which in some cases is useful but in others leads to long and confusing kcontrol names such as "gain 2.1 Main Playback Volume". This patch suggests an added flag to prevent the widget name prefix from being added. That flag will be set in the topology file on a per-widget basis. The flag no_wname_in_kcontrol_name is added to struct snd_soc_dapm_widget, and the logic in dapm_create_or_share_kcontrol() is changed to not to add widget name if the flag is set. Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Signed-off-by: Jyri Sarha Signed-off-by: Pierre-Louis Bossart --- include/sound/soc-dapm.h | 1 + sound/soc/soc-dapm.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 2e38dff16779..d2faec9a323e 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -650,6 +650,7 @@ struct snd_soc_dapm_widget { unsigned char power_checked:1; /* power checked this run */ unsigned char is_supply:1; /* Widget is a supply type widget */ unsigned char is_ep:2; /* Widget is a endpoint type widget */ + unsigned char no_wname_in_kcontrol_name:1; /* No widget name prefix in kcontrol name */ int subseq; /* sort within widget type */ int (*power_check)(struct snd_soc_dapm_widget *w); diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 3091e8160bad..f07e83678373 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -916,6 +916,8 @@ static int dapm_create_or_share_kcontrol(struct snd_soc_dapm_widget *w, return -EINVAL; } } + if (w->no_wname_in_kcontrol_name) + wname_in_long_name = false; if (wname_in_long_name && kcname_in_long_name) { /* From patchwork Mon Aug 14 23:23:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 713502 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 8A0EFC001B0 for ; Mon, 14 Aug 2023 23:25:39 +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 6ADD884B; Tue, 15 Aug 2023 01:24:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6ADD884B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692055537; bh=xByKIulZWn2pyal9fs3gKTJA7pVyZU7i2HRuHKlJo3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=u1Wp4iBS03TqzXetPS6LMK22pMGpVPK1vRGYzkX8OxAMj182rYFFFv7LsBUysDscP srYW5k2LEl0vC5RgG9ir9d1N89aLaUel0vy7PDNVSHr5WIgnab48n3qrwHpPjF2rby xG8Ke43PmQMQz+8DE0v7QOJVmda7ilBOw7sExVwU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id F3565F80571; Tue, 15 Aug 2023 01:23:54 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 2DA4FF80578; Tue, 15 Aug 2023 01:23:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7F22CF80016; Tue, 15 Aug 2023 01:23:49 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ACAF3F801EB for ; Tue, 15 Aug 2023 01:23:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ACAF3F801EB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=evk4hIq2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692055426; x=1723591426; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xByKIulZWn2pyal9fs3gKTJA7pVyZU7i2HRuHKlJo3k=; b=evk4hIq2qs2eCJPjYAGlr5EixSuJll7u/Au9KukHg9I6VkwvxbaQm3Ka 6Q8SX5bmU3DJ68196zKhus14haqjfPEK5oEYhA86iZpAGDg/97i2XynPI BXRYfrOslZuvxm4er7TDKTCZbtHNx4BDsqUWbANpJH6KCozdZb0MUuLnH JCwPKrm+yY2cRnJRGX96V6t1BxlyEDLyV4uiWR8mD3JvXSlJJOvmFcu5J f26VM/7ePFhQLdiTrid5LjuMbGvmSyOFUcG8kMH25YPMMJQIYD1WQF1zL OCKcYF7WV9ChFDBs8WoF1cgBXSxEN2bKxGd/KR2nuTj+nDf7cgbPbu7+k A==; X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="436051855" X-IronPort-AV: E=Sophos;i="6.01,173,1684825200"; d="scan'208";a="436051855" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2023 16:23:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="823642507" X-IronPort-AV: E=Sophos;i="6.01,173,1684825200"; d="scan'208";a="823642507" Received: from dishasur-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.104.139]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2023 16:23:35 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Jyri Sarha , Ranjani Sridharan , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 2/2] ASoC: SOF: topology: Add a token for dropping widget name in kcontrol name Date: Mon, 14 Aug 2023 18:23:25 -0500 Message-Id: <20230814232325.86397-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230814232325.86397-1-pierre-louis.bossart@linux.intel.com> References: <20230814232325.86397-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: ZYSKX2WTKJ7MXMZLCUSFBVZAMD6LG7OI X-Message-ID-Hash: ZYSKX2WTKJ7MXMZLCUSFBVZAMD6LG7OI X-MailFrom: pierre-louis.bossart@linux.intel.com 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 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: From: Jyri Sarha Adds SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME token, and copies the token's tuple value to the no_wname_in_kcontrol_name flag in struct snd_soc_dapm_widget. If the tuple value for the token in the topology is true, then the widget name is not added to the mixer name. In practice "gain.2.1 Post Mixer Analog Playback Volume" becomes just "Post Mixer Analog Playback Volume". Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Signed-off-by: Jyri Sarha Signed-off-by: Pierre-Louis Bossart --- include/uapi/sound/sof/tokens.h | 6 +++++- sound/soc/sof/topology.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h index e9ec7e4eb982..453cab2a1209 100644 --- a/include/uapi/sound/sof/tokens.h +++ b/include/uapi/sound/sof/tokens.h @@ -99,7 +99,11 @@ #define SOF_TKN_COMP_OUTPUT_PIN_BINDING_WNAME 414 #define SOF_TKN_COMP_NUM_INPUT_AUDIO_FORMATS 415 #define SOF_TKN_COMP_NUM_OUTPUT_AUDIO_FORMATS 416 - +/* + * The token value is copied to the dapm_widget's + * no_wname_in_kcontrol_name. + */ +#define SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME 417 /* SSP */ #define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500 diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index be63ba06762f..a3a3af252259 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1367,6 +1367,20 @@ static int sof_parse_pin_binding(struct snd_sof_widget *swidget, return ret; } +static int get_w_no_wname_in_long_name(void *elem, void *object, u32 offset) +{ + struct snd_soc_tplg_vendor_value_elem *velem = elem; + struct snd_soc_dapm_widget *w = object; + + w->no_wname_in_kcontrol_name = !!le32_to_cpu(velem->value); + return 0; +} + +static const struct sof_topology_token dapm_widget_tokens[] = { + {SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME, SND_SOC_TPLG_TUPLE_TYPE_BOOL, + get_w_no_wname_in_long_name, 0} +}; + /* external widget init - used for any driver specific init */ static int sof_widget_ready(struct snd_soc_component *scomp, int index, struct snd_soc_dapm_widget *w, @@ -1397,6 +1411,14 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index, ida_init(&swidget->output_queue_ida); ida_init(&swidget->input_queue_ida); + ret = sof_parse_tokens(scomp, w, dapm_widget_tokens, ARRAY_SIZE(dapm_widget_tokens), + priv->array, le32_to_cpu(priv->size)); + if (ret < 0) { + dev_err(scomp->dev, "failed to parse dapm widget tokens for %s\n", + w->name); + goto widget_free; + } + ret = sof_parse_tokens(scomp, swidget, comp_pin_tokens, ARRAY_SIZE(comp_pin_tokens), priv->array, le32_to_cpu(priv->size));