[PATCH 2/3] ASoC: tas2562: Fix event generation for volume control

From: Mark Brown

Date: Wed Jul 15 2026 - 16:19:38 EST


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.

Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
---
sound/soc/codecs/tas2562.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index 82bc0078a5c7..9b863b000470 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 */

--
2.47.3