Skip to content

Commit 2ae6da5

Browse files
committed
ASoC: max9768: Fix event generation for playback mute
The max9768 has a custom control for playback mute which unconditionally returns 0 from the put() operation, rather than returning 1 on change to ensure notifications are generated to userspace. Check to see if the value has changed and return appropriately. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://patch.msgid.link/20241112-asoc-max9768-event-v1-1-ba5d50599787@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent d859923 commit 2ae6da5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sound/soc/codecs/max9768.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,17 @@ static int max9768_set_gpio(struct snd_kcontrol *kcontrol,
5454
{
5555
struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
5656
struct max9768 *max9768 = snd_soc_component_get_drvdata(c);
57+
bool val = !ucontrol->value.integer.value[0];
58+
int ret;
5759

58-
gpiod_set_value_cansleep(max9768->mute, !ucontrol->value.integer.value[0]);
60+
if (val != gpiod_get_value_cansleep(max9768->mute))
61+
ret = 1;
62+
else
63+
ret = 0;
5964

60-
return 0;
65+
gpiod_set_value_cansleep(max9768->mute, val);
66+
67+
return ret;
6168
}
6269

6370
static const DECLARE_TLV_DB_RANGE(volume_tlv,

0 commit comments

Comments
 (0)