Hello, I would like to make the mute and mute mic leds work on my laptop. I own a HP Zbook Studio G5. Mute is Fn+F5 and mute mic is Fn+F8. The following options snd-hda-intel model=hp-dock gives more controls in alsamixer. I can switch between Line, Mic and Internal Mic. I also get controls for Mic Mute-LED Mode and Mute-LED Mode, but they don't turn the leds on or off. The options snd-hda-intel model=mute-led-gpio also gives me the controls for the leds, none of them turn the leds on or off. I tried poking at the GPIOs. hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x1{0..f} hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x1{0..f} hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x1{0..f} turns the mute led on. hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x0{0..f} turns it off. Changing any of the GPIOs turns the mute mic led on and also mutes the microphone, but none of them turns it off and the microphone stays muted until reboot. Please help me sort this out. Thank you.
grep "IO\[" /proc/asound/card0/codec\#0 when both leds are off: IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[2]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[3]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[4]: enable=1, dir=1, wake=0, sticky=0, data=0, unsol=0 IO[5]: enable=1, dir=1, wake=0, sticky=0, data=0, unsol=0 IO[6]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 IO[7]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0 If I leave out the 'options' from modprobe, initially both leds are off. Changing any of the GPIOs will turn the mic mute led on and mutes the microphone until reboot. With one of the 'options' above, the mute mic led will be turned on right after boot and the microphone stays muted. I ran alsa-info.sh, it is uploaded to http://alsa-project.org/db/?f=2fa38e8759f387ec7a66d3ef05badac8ae03ffe7
Hm, from the bug description, it's not clear whether GPIO actually turns on/off the LED or not... Let's test it more carefully at first. First of all, try to disable the runtime PM. This can be done by echo 0 > /sys/module/snd_hda_intel/parameters/power_save There are 8 GPIO pins, and each of them can be toggled via hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK $BIT hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR $BIT hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA $BIT where $BIT is 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80. When you set SET_GPIO_DATA 0, it'll turn off the GPIO pin. And any of those 8 pins change the mute and mic-mute LED states?
Thank you for the response. If I change anything, even if I issue the hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0 command, the mic-mute led comes on and stays on. I can't turn it off afterwards. If $BIT = 0x10 the mute led comes on. When the led is on, SET_GPIO_DATA 0 turns it off. Also 0x01 0x02 0x04 0x08 0x20 0x40 0x80 will turn it off.
(In reply to marietta from comment #3) > Thank you for the response. > > If I change anything, even if I issue the > hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0 > command, the mic-mute led comes on and stays on. I can't turn it off > afterwards. Hmm. In the above test, you'd need to run hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK $BIT hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR $BIT hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA $BIT then hda-verb dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0 for each $BIT value. It's possible that the mute LED is triggered inversely. i.e. clear bit = LED on, set bit = off.
It didn't change.. but you gave me an idea.. so I tried the following: hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x20 hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x20 hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0 -> the led turned off! hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x20 -> the led turned on! Thank you :)
OK, that's the playback mute LED, right? What about the mic mute LED?
The playback mute led worked like this: hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x10 hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x10 hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x10 -> led turns on hda-verb dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0 -> led turns off The mic mute led: -> led is on hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x20 hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x20 hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0 -> the led turns off hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x20 -> the led turns on
OK, thanks. Below is a test patch that adds the mute / mic-mute LED controls. Could you give it a try? It's for 5.12-rc1 kernel, but likely applicable to older kernels, too.
Created attachment 295647 [details] Test patch
I applied the patch. Two more controls have appeared in alsamixer: mic mute-led mode and mute-led mode. The mic mute-led mode turns the mic mute led on, off, or follows capture/mute. The mute-led mode turns the mute led on, off, or follows master. Thank you!
OK, now I submitted and merged the fix patch. It'll be likely included in 5.12-rc3.