summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-03-16 21:45:30 +0300
committerMark Brown <broonie@kernel.org>2026-03-16 21:45:30 +0300
commitb7cbc6b8646eec120a652bbfc867e9cc50a14d5f (patch)
tree4c27f159aede18ebdc1542fc5a11736c35ce5cd5
parentf8d51e903a6c97d8d298f14d9f8b4fff808670e3 (diff)
parentb6a6cd3f6b5b0de65b398383ba12e72eb7322c82 (diff)
downloadlinux-b7cbc6b8646eec120a652bbfc867e9cc50a14d5f.tar.xz
ASoC: Handle edge case on SDCA jack control naming
Charles Keepax <ckeepax@opensource.cirrus.com> says: Normally the SDCA jack detection controls will be named after the GE widget that represents the grouping of everything in the topology controlled by the jack selection. However, in the case that the jack selection only controls a single widget the control will be named after the SU widget that implements that. It is rather confusing to have the jack detection controls change naming scheme between devices. Add a new widget type, similar to mixer widgets, to force use of the control name rather than falling back to the widget names.
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--sound/soc/sdca/sdca_asoc.c2
-rw-r--r--sound/soc/soc-dapm.c11
3 files changed, 13 insertions, 1 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 49f0fe05db01..4f8fb7622a13 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -424,6 +424,7 @@ enum snd_soc_dapm_type {
snd_soc_dapm_input = 0, /* input pin */
snd_soc_dapm_output, /* output pin */
snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
+ snd_soc_dapm_mux_named_ctl, /* mux with named controls */
snd_soc_dapm_demux, /* connects the input to one of multiple outputs */
snd_soc_dapm_mixer, /* mixes several analog signals together */
snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
diff --git a/sound/soc/sdca/sdca_asoc.c b/sound/soc/sdca/sdca_asoc.c
index a342a4e56717..733c9808891a 100644
--- a/sound/soc/sdca/sdca_asoc.c
+++ b/sound/soc/sdca/sdca_asoc.c
@@ -487,7 +487,7 @@ static int entity_parse_su_device(struct device *dev,
if (!range)
return -EINVAL;
- (*widget)->id = snd_soc_dapm_mux;
+ (*widget)->id = snd_soc_dapm_mux_named_ctl;
(*widget)->kcontrol_news = entity->group->ge.kctl;
(*widget)->num_kcontrols = 1;
(*widget)++;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 2768ba5bfc9f..d6192204e613 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -89,6 +89,7 @@ static int dapm_up_seq[] = {
[snd_soc_dapm_input] = 6,
[snd_soc_dapm_output] = 6,
[snd_soc_dapm_mux] = 7,
+ [snd_soc_dapm_mux_named_ctl] = 7,
[snd_soc_dapm_demux] = 7,
[snd_soc_dapm_dac] = 8,
[snd_soc_dapm_switch] = 9,
@@ -140,6 +141,7 @@ static int dapm_down_seq[] = {
[snd_soc_dapm_micbias] = 10,
[snd_soc_dapm_vmid] = 10,
[snd_soc_dapm_mux] = 11,
+ [snd_soc_dapm_mux_named_ctl] = 11,
[snd_soc_dapm_demux] = 11,
[snd_soc_dapm_aif_in] = 12,
[snd_soc_dapm_aif_out] = 12,
@@ -577,6 +579,7 @@ static int dapm_check_dynamic_path(
switch (sink->id) {
case snd_soc_dapm_mux:
+ case snd_soc_dapm_mux_named_ctl:
case snd_soc_dapm_switch:
case snd_soc_dapm_mixer:
case snd_soc_dapm_mixer_named_ctl:
@@ -668,6 +671,7 @@ static int dapm_add_path(
switch (wsink->id) {
case snd_soc_dapm_mux:
+ case snd_soc_dapm_mux_named_ctl:
ret = dapm_connect_mux(dapm, path, control, wsink);
if (ret != 0)
goto err;
@@ -766,6 +770,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
break;
case snd_soc_dapm_demux:
case snd_soc_dapm_mux:
+ case snd_soc_dapm_mux_named_ctl:
e = (struct soc_enum *)kcontrol->private_value;
if (e->autodisable) {
@@ -915,6 +920,7 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol,
break;
case snd_soc_dapm_demux:
case snd_soc_dapm_mux:
+ case snd_soc_dapm_mux_named_ctl:
data->widget->on_val = value >> data->widget->shift;
break;
default:
@@ -1198,6 +1204,7 @@ static int dapm_create_or_share_kcontrol(struct snd_soc_dapm_widget *w,
wname_in_long_name = true;
kcname_in_long_name = true;
break;
+ case snd_soc_dapm_mux_named_ctl:
case snd_soc_dapm_mixer_named_ctl:
wname_in_long_name = false;
kcname_in_long_name = true;
@@ -1317,6 +1324,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
switch (w->id) {
case snd_soc_dapm_mux:
+ case snd_soc_dapm_mux_named_ctl:
dir = SND_SOC_DAPM_DIR_OUT;
type = "mux";
break;
@@ -2399,6 +2407,7 @@ static const char * const dapm_type_name[] = {
[snd_soc_dapm_input] = "input",
[snd_soc_dapm_output] = "output",
[snd_soc_dapm_mux] = "mux",
+ [snd_soc_dapm_mux_named_ctl] = "mux_named_ctl",
[snd_soc_dapm_demux] = "demux",
[snd_soc_dapm_mixer] = "mixer",
[snd_soc_dapm_mixer_named_ctl] = "mixer_named_ctl",
@@ -3347,6 +3356,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
dapm_new_mixer(w);
break;
case snd_soc_dapm_mux:
+ case snd_soc_dapm_mux_named_ctl:
case snd_soc_dapm_demux:
dapm_new_mux(w);
break;
@@ -3834,6 +3844,7 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
break;
case snd_soc_dapm_mux:
+ case snd_soc_dapm_mux_named_ctl:
case snd_soc_dapm_demux:
case snd_soc_dapm_switch:
case snd_soc_dapm_mixer: