From: Mark Brown Date: Wed, 15 Jul 2026 20:18:10 +0000 (+0100) Subject: ASoC: tas2562: Fix event generation for volume control X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a9269dbbf1aba4bf329f770d6c473dc9cfb29e8;p=thirdparty%2Flinux.git ASoC: tas2562: Fix event generation for volume control ALSA put() operations should return 0 for noop updates and 1 if the value of the control changed, this is used by the ALSA core to generate events to userspace. tas2562_volume_control_put() does not implement this, it just writes whatever value userspace wrote to the device and returns 0 regardless of what the previous value was. Fix this by suppressing writes if the value is unchanged and returning 1 if the writes succeed. Reviewed-by: Cezary Rojewski Link: https://patch.msgid.link/20260715-asoc-tas2562-put-retval-v1-2-97bf467c924e@kernel.org Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c index 40b7803c68be..d3d0aaa0f607 100644 --- a/sound/soc/codecs/tas2562.c +++ b/sound/soc/codecs/tas2562.c @@ -474,6 +474,9 @@ static int tas2562_volume_control_put(struct snd_kcontrol *kcontrol, int ret, index; u32 reg_val; + if (tas2562->volume_lvl == ucontrol->value.integer.value[0]) + return 0; + index = ucontrol->value.integer.value[0] / 2; if (index < 0 || index >= ARRAY_SIZE(float_vol_db_lookup)) return -EINVAL; @@ -498,7 +501,7 @@ static int tas2562_volume_control_put(struct snd_kcontrol *kcontrol, tas2562->volume_lvl = ucontrol->value.integer.value[0]; - return 0; + return 1; } /* Digital Volume Control. From 0 dB to -110 dB in 1 dB steps */