]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: SOF: Update correct LED status at the first time usage of update_mute_led()
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Thu, 30 Apr 2020 09:11:39 +0000 (17:11 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 1 May 2020 11:27:17 +0000 (12:27 +0100)
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>
sound/soc/sof/control.c
sound/soc/sof/sof-audio.h
sound/soc/sof/topology.c

index dfc412e2d95651e11f8f74b296da75d545b21fc6..6d63768d42aa1eec96edcb89a7a27a1b04312829 100644 (file)
@@ -19,8 +19,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);
index bf65f31af85821b8dee165da8380ee3d4d76077f..875a5fc1329707e21e847b1dac1e6809025cc1e2 100644 (file)
@@ -56,7 +56,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 */
index fe8ba3e05e08bd5a351702114d6ae2cb53ddcfb0..ab2b69de1d4d7f0cb923131e2cae5ac6a2a3f74a 100644 (file)
@@ -1203,6 +1203,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
                return ret;
        }
 
+       scontrol->led_ctl.led_value = -1;
+
        dobj->private = scontrol;
        list_add(&scontrol->list, &sdev->kcontrol_list);
        return ret;