diff mbox series

[1/6] ASoC: dapm: Initialise kcontrol data for mux/demux controls

Message ID 20220623105120.1981154-1-ckeepax@opensource.cirrus.com (mailing list archive)
State Accepted
Commit 11d7a12f7f50baa5af9090b131c9b03af59503e7
Headers show
Series [1/6] ASoC: dapm: Initialise kcontrol data for mux/demux controls | expand

Commit Message

Charles Keepax June 23, 2022, 10:51 a.m. UTC
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 <ckeepax@opensource.cirrus.com>
---
 sound/soc/soc-dapm.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Mark Brown June 23, 2022, 1:58 p.m. UTC | #1
On Thu, 23 Jun 2022 11:51:15 +0100, Charles Keepax wrote:
> 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.
> 
> [...]

Applied to

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

Thanks!

[6/6] ASoC: dapm: Move stereo autodisable check
      commit: 4d6c2b46d81765e920007f76185a8d1fb5e41ca3

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
diff mbox series

Patch

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 869c76506b669..a8e842e02cdc2 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -62,6 +62,8 @@  struct snd_soc_dapm_widget *
 snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
 			 const struct snd_soc_dapm_widget *widget);
 
+static unsigned int soc_dapm_read(struct snd_soc_dapm_context *dapm, int reg);
+
 /* dapm power sequences - make this per codec in the future */
 static int dapm_up_seq[] = {
 	[snd_soc_dapm_pre] = 1,
@@ -442,6 +444,9 @@  static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
 
 			snd_soc_dapm_add_path(widget->dapm, data->widget,
 					      widget, NULL, NULL);
+		} else if (e->reg != SND_SOC_NOPM) {
+			data->value = soc_dapm_read(widget->dapm, e->reg) &
+				      (e->mask << e->shift_l);
 		}
 		break;
 	default: