Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: madera: Fix event generation for rate controls

madera_adsp_rate_put always returns zero regardless of if the control
value was updated. This results in missing notifications to user-space
of the control change. Update the handling to return 1 when the
value is changed.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220623105120.1981154-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Charles Keepax and committed by
Mark Brown
980555e9 e3cabbef

+3 -3
+3 -3
sound/soc/codecs/madera.c
··· 899 899 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 900 900 const int adsp_num = e->shift_l; 901 901 const unsigned int item = ucontrol->value.enumerated.item[0]; 902 - int ret; 902 + int ret = 0; 903 903 904 904 if (item >= e->items) 905 905 return -EINVAL; ··· 916 916 "Cannot change '%s' while in use by active audio paths\n", 917 917 kcontrol->id.name); 918 918 ret = -EBUSY; 919 - } else { 919 + } else if (priv->adsp_rate_cache[adsp_num] != e->values[item]) { 920 920 /* Volatile register so defer until the codec is powered up */ 921 921 priv->adsp_rate_cache[adsp_num] = e->values[item]; 922 - ret = 0; 922 + ret = 1; 923 923 } 924 924 925 925 mutex_unlock(&priv->rate_lock);