Skip to content

Commit a0746cb

Browse files
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dd508e3 commit a0746cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/soc/codecs/max98090.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
396396
unsigned int sel = ucontrol->value.integer.value[0];
397397
unsigned int val = snd_soc_component_read(component, mc->reg);
398398
unsigned int *select;
399+
int change;
399400

400401
switch (mc->reg) {
401402
case M98090_REG_MIC1_INPUT_LEVEL:
@@ -416,6 +417,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
416417
if (sel < 0 || sel > mc->max)
417418
return -EINVAL;
418419

420+
change = *select != sel;
419421
*select = sel;
420422

421423
/* 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,
430432
mask << mc->shift,
431433
sel << mc->shift);
432434

433-
return *select != val;
435+
return change;
434436
}
435437

436438
static const char *max98090_perf_pwr_text[] =

0 commit comments

Comments
 (0)