ASoC: dapm: Add a named controls variant of a mux widget

There is already a version of the mixer widget that forces use of the
specified control name, rather than factoring in the widget name. Add
the same feature for mux widgets.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260303155308.138989-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax authored and Mark Brown committed 2026-03-16 18:45:28 +00:00
1 parent 1f318b96cc
commit e29d097ead
2 files changed
+12

No files matched your search

+1
View File
@@ -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 */
+11
View File
@@ -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: