Skip to contentSkip to conversation

Handle edge case on SDCA jack control naming

PATCH In review Charles Keepax 2 participants 5 messages Mar 3 – Mar 16

Subsystems (3)
lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/2 ASoC: dapm: Add a named controls variant of a mux widget

In reply to Charles Keepax

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.

---
 include/sound/soc-dapm.h |  1 +
 sound/soc/soc-dapm.c     | 11 +++++++++++
 2 files changed, 12 insertions(+)
include/sound/soc-dapm.h +1 -0
index 49f0fe05db01f..4f8fb7622a139 100644
@@ -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 */
sound/soc/soc-dapm.c +11 -0
index 2768ba5bfc9f8..d6192204e613d 100644
@@ -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:
Signature · 1 line
2.47.3

Charles Keepax

author maintainer
#0 lore raw

cover Handle edge case on SDCA jack control naming

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.

Thanks,
Charles

Charles Keepax (2):
ASoC: dapm: Add a named controls variant of a mux widget
ASoC: SDCA: Use named control mux for GE/SU controls

 include/sound/soc-dapm.h   |  1 +
 sound/soc/sdca/sdca_asoc.c |  2 +-
 sound/soc/soc-dapm.c       | 11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.47.3
author maintainer
#2 lore raw

PATCH 2/2 ASoC: SDCA: Use named control mux for GE/SU controls

Most of the time a GE Entity will control many SU Entities and thus the generated control will use the control name, since the control is shared. However, in rare cases the GE Entity will only control a single SU Entity. In this case the control is only linked to a single SU widget and will thus inherit the name from that. This leads to the naming for the Selected Mode control to be unpredictable. Update to use the new named control muxes to always force the use of the control name.

---
 sound/soc/sdca/sdca_asoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sdca/sdca_asoc.c +1 -1
index a342a4e56717a..733c9808891a4 100644
@@ -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)++;
Signature · 1 line
2.47.3
maintainer
#3 lore raw
In reply to Charles Keepax
Quoted 10 lines · Charles Keepax

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.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: dapm: Add a named controls variant of a mux widget

      https://git.kernel.org/broonie/misc/c/e29d097ead33
[2/2] ASoC: SDCA: Use named control mux for GE/SU controls
      https://git.kernel.org/broonie/misc/c/b6a6cd3f6b5b

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

maintainer
#4 lore raw
In reply to Charles Keepax
Quoted 11 lines · Charles Keepax

Handle edge case on SDCA jack control naming

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.

Quoted 1 line

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1

Thanks!

[1/2] ASoC: dapm: Add a named controls variant of a mux widget

      https://git.kernel.org/broonie/sound/c/e29d097ead33
[2/2] ASoC: SDCA: Use named control mux for GE/SU controls
      https://git.kernel.org/broonie/sound/c/b6a6cd3f6b5b

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark