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 <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20260715-asoc-tas2562-put-retval-v1-2-97bf467c924e@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
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;
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 */