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

ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()

At the first time update_mute_led() gets called, if channels are already
muted, the temp value equals to led_value as 0, skipping the following
LED setting.

So set led_value to -1 as an uninitialized state, to update the correct
LED status at first time usage.

Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Acked-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200430091139.7003-1-kai.heng.feng@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kai-Heng Feng and committed by
Mark Brown
49c22696 8382f294

+5 -3
+2 -2
sound/soc/sof/control.c
··· 19 19 struct snd_kcontrol *kcontrol, 20 20 struct snd_ctl_elem_value *ucontrol) 21 21 { 22 - unsigned int temp = 0; 23 - unsigned int mask; 22 + int temp = 0; 23 + int mask; 24 24 int i; 25 25 26 26 mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
+1 -1
sound/soc/sof/sof-audio.h
··· 56 56 struct snd_sof_led_control { 57 57 unsigned int use_led; 58 58 unsigned int direction; 59 - unsigned int led_value; 59 + int led_value; 60 60 }; 61 61 62 62 /* ALSA SOF Kcontrol device */
+2
sound/soc/sof/topology.c
··· 1203 1203 return ret; 1204 1204 } 1205 1205 1206 + scontrol->led_ctl.led_value = -1; 1207 + 1206 1208 dobj->private = scontrol; 1207 1209 list_add(&scontrol->list, &sdev->kcontrol_list); 1208 1210 return ret;