[PATCH 1/2] ASoC: dapm: Add a flag for not having widget name in kcontrol name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jyri Sarha <jyri.sarha@xxxxxxxxx>

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 <ranjani.sridharan@xxxxxxxxxxxxxxx>
Reviewed-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
Signed-off-by: Jyri Sarha <jyri.sarha@xxxxxxxxx>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
---
 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) {
 			/*
-- 
2.39.2




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux