All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: max98090: Fix event generation for custom controls
@ 2022-04-28 11:32 Mark Brown
  2022-05-03 15:50 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2022-04-28 11:32 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, Mark Brown

The previous fix for event generation for custom controls compared the
value already in the register with the value being written, missing the
logic that only applies the value to the register when the control is
already enabled. Fix this, compare the value cached in the driver data
rather than the register.

This should really be an autodisable control rather than open coded.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/max98090.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 5146837c0fce..48dcf071bb5a 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -396,6 +396,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
 	unsigned int sel = ucontrol->value.integer.value[0];
 	unsigned int val = snd_soc_component_read(component, mc->reg);
 	unsigned int *select;
+	int change;
 
 	switch (mc->reg) {
 	case M98090_REG_MIC1_INPUT_LEVEL:
@@ -416,6 +417,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
 	if (sel < 0 || sel > mc->max)
 		return -EINVAL;
 
+	change = *select != sel;
 	*select = sel;
 
 	/* Setting a volume is only valid if it is already On */
@@ -430,7 +432,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
 		mask << mc->shift,
 		sel << mc->shift);
 
-	return *select != val;
+	return change;
 }
 
 static const char *max98090_perf_pwr_text[] =
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: max98090: Fix event generation for custom controls
  2022-04-28 11:32 [PATCH] ASoC: max98090: Fix event generation for custom controls Mark Brown
@ 2022-05-03 15:50 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-05-03 15:50 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: alsa-devel

On Thu, 28 Apr 2022 12:32:21 +0100, Mark Brown wrote:
> The previous fix for event generation for custom controls compared the
> value already in the register with the value being written, missing the
> logic that only applies the value to the register when the control is
> already enabled. Fix this, compare the value cached in the driver data
> rather than the register.
> 
> This should really be an autodisable control rather than open coded.
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: max98090: Fix event generation for custom controls
      commit: a0746cbd0b8224c4c0e4ae59968075cb7c14762a

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-03 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 11:32 [PATCH] ASoC: max98090: Fix event generation for custom controls Mark Brown
2022-05-03 15:50 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.