[F] [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
Kai-Heng Feng
kai.heng.feng at canonical.com
Tue May 5 06:02:40 UTC 2020
BugLink: https://bugs.launchpad.net/bugs/1876859
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 at canonical.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
Acked-by: Kai Vehmanen <kai.vehmanen at linux.intel.com>
Link: https://lore.kernel.org/r/20200430091139.7003-1-kai.heng.feng@canonical.com
Signed-off-by: Mark Brown <broonie at kernel.org>
(backported from commit 49c22696348d6e7c8a2ecfd7e60fddfe188ded82 linux-next)
Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.com>
---
sound/soc/sof/control.c | 4 ++--
sound/soc/sof/sof-priv.h | 2 +-
sound/soc/sof/topology.c | 2 ++
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
index b73d4587c5da..9a5b71b45045 100644
--- a/sound/soc/sof/control.c
+++ b/sound/soc/sof/control.c
@@ -18,8 +18,8 @@ static void update_mute_led(struct snd_sof_control *scontrol,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- unsigned int temp = 0;
- unsigned int mask;
+ int temp = 0;
+ int mask;
int i;
mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index b8c30c0a22e3..cfdd2ab687ff 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -309,7 +309,7 @@ struct snd_sof_pcm {
struct snd_sof_led_control {
unsigned int use_led;
unsigned int direction;
- unsigned int led_value;
+ int led_value;
};
/* ALSA SOF Kcontrol device */
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 4e1a83cb9b48..9ad4becce98f 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -1112,6 +1112,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
return 0;
}
+ scontrol->led_ctl.led_value = -1;
+
dobj->private = scontrol;
list_add(&scontrol->list, &sdev->kcontrol_list);
return ret;
--
2.17.1
More information about the kernel-team
mailing list