Skip to content

Commit 49c2269

Browse files
khfengbroonie
authored andcommitted
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: 5d43001 ("ASoC: SOF: acpi led support for switch controls") Signed-off-by: Kai-Heng Feng <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Acked-by: Kai Vehmanen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8382f29 commit 49c2269

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

sound/soc/sof/control.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ static void update_mute_led(struct snd_sof_control *scontrol,
1919
struct snd_kcontrol *kcontrol,
2020
struct snd_ctl_elem_value *ucontrol)
2121
{
22-
unsigned int temp = 0;
23-
unsigned int mask;
22+
int temp = 0;
23+
int mask;
2424
int i;
2525

2626
mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);

sound/soc/sof/sof-audio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct snd_sof_pcm {
5656
struct snd_sof_led_control {
5757
unsigned int use_led;
5858
unsigned int direction;
59-
unsigned int led_value;
59+
int led_value;
6060
};
6161

6262
/* ALSA SOF Kcontrol device */

sound/soc/sof/topology.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
12031203
return ret;
12041204
}
12051205

1206+
scontrol->led_ctl.led_value = -1;
1207+
12061208
dobj->private = scontrol;
12071209
list_add(&scontrol->list, &sdev->kcontrol_list);
12081210
return ret;

0 commit comments

Comments
 (0)