Bug 216818

Summary: The microphone mute led not working after linux 6
Product: Drivers Reporter: sonic82003
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: bwyazel, jwrdegoede
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: >= 6.0 Subsystem:
Regression: No Bisected commit-id:

Description sonic82003 2022-12-18 08:52:32 UTC
The mic mute led of my ThinkPad X1 Carbon Gen 9 doesn't work anymore after updating linux to version 6.
I can still turn it on by  running 

echo 1 > /sys/class/leds/platform::micmute/brightness

With linux-lts it still works fine.
Comment 1 Hans de Goede 2022-12-19 09:58:13 UTC
This is caused by a behavior change of the kernel code controlling the LED to only turn on the LED when all inputs, including e.g. the jack mic input are turned off in the alsa-mixer settings.

But most userspace code only turns the mic which it is actually using on/off when you hit the mic-mute hotkey.

Also see: https://bugzilla.redhat.com/show_bug.cgi?id=2134824

Which is the same bug.

There is a set of fixes available in the form of an alsa-ucm update which tells the kernel to ignore the state of the jack mic input restoring the old behavior:

https://git.alsa-project.org/?p=alsa-ucm-conf.git;a=commitdiff;h=79a8ec44d3dcf097f4a4492c506cbcf338324175
https://git.alsa-project.org/?p=alsa-ucm-conf.git;a=commitdiff;h=9ce9ddb4a84fb467602b716575ea1d8f2bab0c39
Comment 2 Jaroslav Kysela 2022-12-19 17:08:25 UTC
The easy way is to ask your distro to update the UCM configuration to the recent one.

Note that all previous kernels have a bug which may cause that the microphone LED is not updated correctly with the sof-hda-dsp driver. Just plug something to the analog jack on your system and mute/unmute/mute the analog input. The microphone LED will follow those changes, too. So you cannot trust the state for the old kernels anyway.
Comment 3 Britt Yazel 2023-05-15 18:42:36 UTC
On my Lenovo z13 Gen1, I believe I also have this same issue, the issue was filed in the my distro's bugtracker here:
https://bugs.archlinux.org/task/71768

The advice given at the bottom of that page seems to work fine as a temporary workaround:
> As a workaround, you can apply the correct trigger on every boot by creating
> a file /etc/tmpfiles.d/micmute-led.conf with the following contents:

> w /sys/class/leds/platform::micmute/trigger - - - - audio-micmute


Is the guidance still that there's nothing that can be done on the kernel-side to remediate this issue and that it's reliant on the distro to sort this out? If so, I can re-open the issue downstream with them.
Comment 4 Britt Yazel 2023-05-15 18:53:34 UTC
I just checked, and it seems like Archlinux is already shipping the updated alsa-ucm with both of the above patches. So there is possibly something else going on?
Comment 5 Jaroslav Kysela 2023-05-15 21:02:36 UTC
The above settings is not related to the sound driver but to the LED driver. The audio-micmute trigger should be set by default in the kernel for the micmute led. See:

  ./platform/x86/thinkpad_acpi.c:
        {
                 .name           = "platform::mute",
                .max_brightness = 1,
                .brightness_set_blocking = tpacpi_led_mute_set,
                .default_trigger = "audio-mute",
        },
        [LED_AUDIO_MICMUTE] = {
                .name           = "platform::micmute",
                .max_brightness = 1,
                .brightness_set_blocking = tpacpi_led_micmute_set,
                .default_trigger = "audio-micmute",
        },

So the question is why the defaults are not set for your kernel.

What does say 'readlink /sys/class/leds/platform\:\:micmute/device/driver' ?
Comment 6 Britt Yazel 2023-05-15 21:49:10 UTC
It returns:

> ../../../bus/platform/drivers/thinkpad_acpi
Comment 7 Jaroslav Kysela 2023-05-16 06:33:31 UTC
So the code in comment#5 is the right one. You may try to find, why the default trigger is not active by default on your system for micmute.
Comment 8 Britt Yazel 2023-05-17 19:18:34 UTC
Would this commit explain the behavior? This was the commit listed in the archlinux issue that I linked above:

https://github.com/torvalds/linux/commit/e2da5ff435d64b59880648269c136484bea5c312?diff=split

An interesting thing to note is that adding the line to my /etc/tmpfiles.d/micmute-led.conf solved my issue, but I have no subsequently removed that line and the issue is still seemingly resolved, even persisting through reboots.
Comment 9 Britt Yazel 2023-05-17 19:20:04 UTC
I have now***