Skip to content

Commit 15b2e5d

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: wm8998: Fix event generation for input mux
wm8998_inmux_put returns the value of snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for the kcontrol. This is obviously different to the expected return a 1 if the control was updated value. This results in spurious notifications to user-space. Update the handling to only return a 1 when the value is changed. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220628153409.3266932-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 71b5ab9 commit 15b2e5d

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

sound/soc/codecs/wm8998.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,
108108
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
109109
unsigned int mode_reg, mode_index;
110110
unsigned int mux, inmode, src_val, mode_val;
111+
int change, ret;
111112

112113
mux = ucontrol->value.enumerated.item[0];
113114
if (mux > 1)
@@ -137,14 +138,20 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,
137138
snd_soc_component_update_bits(component, mode_reg,
138139
ARIZONA_IN1_MODE_MASK, mode_val);
139140

140-
snd_soc_component_update_bits(component, e->reg,
141-
ARIZONA_IN1L_SRC_MASK |
142-
ARIZONA_IN1L_SRC_SE_MASK,
143-
src_val);
141+
change = snd_soc_component_update_bits(component, e->reg,
142+
ARIZONA_IN1L_SRC_MASK |
143+
ARIZONA_IN1L_SRC_SE_MASK,
144+
src_val);
144145

145-
return snd_soc_dapm_mux_update_power(dapm, kcontrol,
146-
ucontrol->value.enumerated.item[0],
147-
e, NULL);
146+
ret = snd_soc_dapm_mux_update_power(dapm, kcontrol,
147+
ucontrol->value.enumerated.item[0],
148+
e, NULL);
149+
if (ret < 0) {
150+
dev_err(arizona->dev, "Failed to update demux power state: %d\n", ret);
151+
return ret;
152+
}
153+
154+
return change;
148155
}
149156

150157
static const char * const wm8998_inmux_texts[] = {

0 commit comments

Comments
 (0)