Skip to content

Commit 11d7a12

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: dapm: Initialise kcontrol data for mux/demux controls
DAPM keeps a copy of the current value of mux/demux controls, however this value is only initialised in the case of autodisable controls. This leads to false notification events when first modifying a DAPM kcontrol that has a non-zero default. Autodisable controls are left as they are, since they already initialise the value, and there would be more work required to support autodisable muxes where the first option isn't disabled and/or that isn't the default. Technically this issue could affect mixer/switch elements as well, although not on any of the devices I am currently running. There is also a little more work to do to address the issue there due to that side supporting stereo controls, so that has not been tackled in this patch. Signed-off-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1df793d commit 11d7a12

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sound/soc/soc-dapm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ struct snd_soc_dapm_widget *
6262
snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
6363
const struct snd_soc_dapm_widget *widget);
6464

65+
static unsigned int soc_dapm_read(struct snd_soc_dapm_context *dapm, int reg);
66+
6567
/* dapm power sequences - make this per codec in the future */
6668
static int dapm_up_seq[] = {
6769
[snd_soc_dapm_pre] = 1,
@@ -442,6 +444,9 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
442444

443445
snd_soc_dapm_add_path(widget->dapm, data->widget,
444446
widget, NULL, NULL);
447+
} else if (e->reg != SND_SOC_NOPM) {
448+
data->value = soc_dapm_read(widget->dapm, e->reg) &
449+
(e->mask << e->shift_l);
445450
}
446451
break;
447452
default:

0 commit comments

Comments
 (0)