aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown2022-04-28 12:32:21 +0100
committerMark Brown2022-05-03 13:42:25 +0100
commita0746cbd0b8224c4c0e4ae59968075cb7c14762a (patch)
tree44ede7e668c934a22255f6372f08218e0638b09d
parentdd508e324cdde1c06ace08a8143fa50333a90703 (diff)
ASoC: max98090: Fix event generation for custom controls
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> Link: https://lore.kernel.org/r/20220428113221.15326-1-broonie@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/max98090.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 62b41ca050a2..ad265092ed08 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[] =