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>

authored by Kunal Gangakhedkar and committed by Takashi Iwai d38cce70 c7a8eb10

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