stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: generic: Fix the micmute led init state
@ 2021-03-12  4:14 Hui Wang
  2021-03-12 13:12 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Wang @ 2021-03-12  4:14 UTC (permalink / raw)
  To: alsa-devel, tiwai, stable

Recently we found the micmute led init state is not correct after
freshly installing the ubuntu linux on a Lenovo AIO machine. The
internal mic is not muted, but the micmute led is on and led mode is
'follow mute'. If we mute internal mic, the led is keeping on, then
unmute the internal mic, the led is off. And from then on, the
micmute led will work correctly.

So the micmute led init state is not correct. The led is controlled
by codec gpio (ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), in the
patch_realtek, the gpio data is set to 0x4 initially and the led is
on with this data. In the hda_generic, the led_value is set to
0 initially, suppose users set the 'capture switch' to on from
user space and the micmute led should change to be off with this
operation, but the check "if (val == spec->micmute_led.led_value)" in
the call_micmute_led_update() will skip the led setting.

To guarantee the led state will be set by the 1st time of changing
"Capture Switch", set -1 to the init led_value.

Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/pci/hda/hda_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 8b7c5508f368..f5cba7afd1c6 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -4065,7 +4065,7 @@ static int add_micmute_led_hook(struct hda_codec *codec)
 
 	spec->micmute_led.led_mode = MICMUTE_LED_FOLLOW_MUTE;
 	spec->micmute_led.capture = 0;
-	spec->micmute_led.led_value = 0;
+	spec->micmute_led.led_value = -1;
 	spec->micmute_led.old_hook = spec->cap_sync_hook;
 	spec->cap_sync_hook = update_micmute_led;
 	if (!snd_hda_gen_add_kctl(spec, NULL, &micmute_led_mode_ctl))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: hda: generic: Fix the micmute led init state
  2021-03-12  4:14 [PATCH] ALSA: hda: generic: Fix the micmute led init state Hui Wang
@ 2021-03-12 13:12 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-03-12 13:12 UTC (permalink / raw)
  To: Hui Wang; +Cc: alsa-devel, stable

On Fri, 12 Mar 2021 05:14:08 +0100,
Hui Wang wrote:
> 
> Recently we found the micmute led init state is not correct after
> freshly installing the ubuntu linux on a Lenovo AIO machine. The
> internal mic is not muted, but the micmute led is on and led mode is
> 'follow mute'. If we mute internal mic, the led is keeping on, then
> unmute the internal mic, the led is off. And from then on, the
> micmute led will work correctly.
> 
> So the micmute led init state is not correct. The led is controlled
> by codec gpio (ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), in the
> patch_realtek, the gpio data is set to 0x4 initially and the led is
> on with this data. In the hda_generic, the led_value is set to
> 0 initially, suppose users set the 'capture switch' to on from
> user space and the micmute led should change to be off with this
> operation, but the check "if (val == spec->micmute_led.led_value)" in
> the call_micmute_led_update() will skip the led setting.
> 
> To guarantee the led state will be set by the 1st time of changing
> "Capture Switch", set -1 to the init led_value.
> 
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Hui Wang <hui.wang@canonical.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-12 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12  4:14 [PATCH] ALSA: hda: generic: Fix the micmute led init state Hui Wang
2021-03-12 13:12 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).