Commit d38cce7046cfd0011f69d5dcf6a22525438154f6

Authored by Kunal Gangakhedkar
Committed by Takashi Iwai
1 parent c7a8eb1032

ALSA: hda - Fix mute led GPIO on HP dv-series notebooks

On my laptop (HP dv6-1110ax), there are no OEM strings in SMBIOS of type
"HP_Mute_LED*". Hence, the GPIO for the mute button LED doesn't get set
properly. I didn't find the strings in my cousin's laptop (HP dv9500t CTO)
either.

As per the documentation of find_mute_led_gpio(), these strings occur
in HP B-series systems - so, before scanning the SMBIOS strings, we need to
check if we're dealing with a B-series system.
Need to get confirmation from HP if this logic takes care of all the
systems. I'm trying to poke a friend there.

Signed-off-by: Kunal Gangakhedkar <kunal.gangakhedkar@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 1 changed file with 45 additions and 16 deletions Side-by-side Diff

sound/pci/hda/patch_sigmatel.c
... ... @@ -4730,6 +4730,26 @@
4730 4730 }
4731 4731 }
4732 4732  
  4733 +static int hp_blike_system(u32 subsystem_id);
  4734 +
  4735 +static void set_hp_led_gpio(struct hda_codec *codec)
  4736 +{
  4737 + struct sigmatel_spec *spec = codec->spec;
  4738 + switch (codec->vendor_id) {
  4739 + case 0x111d7608:
  4740 + /* GPIO 0 */
  4741 + spec->gpio_led = 0x01;
  4742 + break;
  4743 + case 0x111d7600:
  4744 + case 0x111d7601:
  4745 + case 0x111d7602:
  4746 + case 0x111d7603:
  4747 + /* GPIO 3 */
  4748 + spec->gpio_led = 0x08;
  4749 + break;
  4750 + }
  4751 +}
  4752 +
4733 4753 /*
4734 4754 * This method searches for the mute LED GPIO configuration
4735 4755 * provided as OEM string in SMBIOS. The format of that string
... ... @@ -4741,6 +4761,14 @@
4741 4761 *
4742 4762 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
4743 4763 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
  4764 + *
  4765 + *
  4766 + * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
  4767 + * SMBIOS - at least the ones I have seen do not have them - which include
  4768 + * my own system (HP Pavilion dv6-1110ax) and my cousin's
  4769 + * HP Pavilion dv9500t CTO.
  4770 + * Need more information on whether it is true across the entire series.
  4771 + * -- kunal
4744 4772 */
4745 4773 static int find_mute_led_gpio(struct hda_codec *codec)
4746 4774 {
4747 4775  
4748 4776  
... ... @@ -4751,28 +4779,27 @@
4751 4779 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
4752 4780 NULL, dev))) {
4753 4781 if (sscanf(dev->name, "HP_Mute_LED_%d_%d",
4754   - &spec->gpio_led_polarity,
4755   - &spec->gpio_led) == 2) {
  4782 + &spec->gpio_led_polarity,
  4783 + &spec->gpio_led) == 2) {
4756 4784 spec->gpio_led = 1 << spec->gpio_led;
4757 4785 return 1;
4758 4786 }
4759 4787 if (sscanf(dev->name, "HP_Mute_LED_%d",
4760   - &spec->gpio_led_polarity) == 1) {
4761   - switch (codec->vendor_id) {
4762   - case 0x111d7608:
4763   - /* GPIO 0 */
4764   - spec->gpio_led = 0x01;
4765   - return 1;
4766   - case 0x111d7600:
4767   - case 0x111d7601:
4768   - case 0x111d7602:
4769   - case 0x111d7603:
4770   - /* GPIO 3 */
4771   - spec->gpio_led = 0x08;
4772   - return 1;
4773   - }
  4788 + &spec->gpio_led_polarity) == 1) {
  4789 + set_hp_led_gpio(codec);
  4790 + return 1;
4774 4791 }
4775 4792 }
  4793 +
  4794 + /*
  4795 + * Fallback case - if we don't find the DMI strings,
  4796 + * we statically set the GPIO - if not a B-series system.
  4797 + */
  4798 + if (!hp_blike_system(codec->subsystem_id)) {
  4799 + set_hp_led_gpio(codec);
  4800 + spec->gpio_led_polarity = 1;
  4801 + return 1;
  4802 + }
4776 4803 }
4777 4804 return 0;
4778 4805 }
... ... @@ -5547,6 +5574,8 @@
5547 5574 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids);
5548 5575 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5549 5576 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
  5577 +
  5578 + snd_printdd("Found board config: %d\n", spec->board_config);
5550 5579  
5551 5580 switch (spec->board_config) {
5552 5581 case STAC_HP_M4: