mirror of
https://github.com/torvalds/linux.git
synced 2026-09-27 11:02:03 +02:00
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 <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>
This commit is contained in:
parent
8fb41964f7
commit
9a9269dbbf
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user