Bug 70991

Summary: Mute LED on HP Folio 13-2000 doesn't work
Product: Drivers Reporter: Stefan Nagy (stefan.nagy)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: low CC: tiwai
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.12.9 Subsystem:
Regression: No Bisected commit-id:
Attachments: output of dmidecode
output of alsa-info script
output of lspci -vvnn
dmesg output
Fix patch

Description Stefan Nagy 2014-02-22 16:10:05 UTC
Created attachment 127001 [details]
output of dmidecode

While the mute key on the HP Folio 13-2000 (Fn+F11) works fine, the integrated LED won't work at all. The expected behavior is: on when muted and off when not muted.

Since my notebook reports the string HP_Mute_LED_P_G in DMI I'll attach the output of dmidecode.
Comment 1 Stefan Nagy 2014-02-22 16:12:25 UTC
Created attachment 127011 [details]
output of alsa-info script
Comment 2 Stefan Nagy 2014-02-22 16:13:40 UTC
Created attachment 127021 [details]
output of lspci -vvnn
Comment 3 Stefan Nagy 2014-02-22 16:14:25 UTC
Created attachment 127031 [details]
dmesg output
Comment 4 Takashi Iwai 2014-02-24 09:12:35 UTC
First off, your BIOS is buggy.  It must have filled numbers in P and G of "HP_Mute_LED_P_G" DMI string.  For setting the values manually, you can pass gpio_led and gpio_led_polarity hint strings by early firmware patch (via "patch" module option).

In anyway, you need to figure out which GPIO pin corresponds to the mute LED.  You can toggle each gpio bit with hda-verb.  For setting the GPIO bit 0,
   hda-verb /dev/snd/hwC0D0 SET_GPIO_MASK 0x01
   hda-verb /dev/snd/hwC0D0 SET_GPIO_DIR 0x01
   hda-verb /dev/snd/hwC0D0 SET_GPIO_DATA 0x01

clearing the bit 0,
   hda-verb /dev/snd/hwC0D0 SET_GPIO_DATA 0x00

For setting the GPIO bit 1,
   hda-verb /dev/snd/hwC0D0 SET_GPIO_MASK 0x02
   hda-verb /dev/snd/hwC0D0 SET_GPIO_DIR 0x02
   hda-verb /dev/snd/hwC0D0 SET_GPIO_DATA 0x02

Fog GPIO bit 2, use 0x04, etc.

As default bit 3 (0x08) is used.

Once when you figure out which GPIO bit toggles the mute LED, pass it to gpio_led hint string and also pass either gpio_led_polarity=0 or gpio_led_polarity=1 depending on the mute LED condition (0 = on or 0 = off).
For that, create a file like /lib/firmware/alsa/hp-mute, containing the contents like:

[codec]
0x111d76e5 0x103c1899 0

[hint]
gpio_led = 0x08
gpio_led_polarity = 0


Then pass it via patch option of snd-hda-intel module, e.g. create a file /etc/modprobe.d/50-sound.conf containing

  options snd-hda-intel patch=alsa/hp-mute

For some details, see Documentation/sound/alsa/HD-Audio.txt.
Comment 5 Stefan Nagy 2014-02-24 11:11:50 UTC
Thanks for the detailed info!

After playing around for some time I figured out that GPIO bit 4 toggles the mute LED on this notebook. As suggested I created a file /lib/firmware/alsa/hp-mute containing:

[codec]
0x111d76e5 0x103c1899 0

[hint]
gpio_led = 0x10
gpio_led_polarity = 0

Then I created a file /etc/modprobe.d/50-sound.conf containing:

options snd-hda-intel patch=alsa/hp-mute

Now the mute LED works as expected (on when muted).
Comment 6 Takashi Iwai 2014-02-24 13:25:00 UTC
OK, good to hear.  Does your laptop have a mic mute LED, too (typically on F8 key)?  If not, I can provide a patch to assign statically the GPIO pin for this machine.
Comment 7 Stefan Nagy 2014-02-24 13:59:14 UTC
No, there's no mic mute LED present on this notebook. I'd be happy to test your patch, thanks.
Comment 8 Takashi Iwai 2014-02-24 14:30:26 UTC
Created attachment 127301 [details]
Fix patch
Comment 9 Stefan Nagy 2014-02-24 18:07:01 UTC
I applied the patch attached to comment #8 on top of kernel v3.13.5 and I can confirm that it fixes this bug: the mute LED on HP Folio 13-2000 works as expected.
Comment 10 Takashi Iwai 2014-02-25 07:51:08 UTC
Thanks for testing.  The patch is merged now to sound git tree, will be included in the next 3.14-rc, and backported to stable later.
Comment 11 Stefan Nagy 2014-02-25 09:48:39 UTC
Great, thanks!