diff options
author | Vitaliy Kulikov <Vitaliy.Kulikov@idt.com> | 2009-11-04 01:57:45 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-04 01:57:45 -0500 |
commit | 5bdaaada16363d64e10ae081755d1a8d392429f2 (patch) | |
tree | 336d804559ba7e4c72d6c1eb72e8e6f38ea7dd5c /sound | |
parent | ad87c64f00e01a694bf90bddc2b4a6c90796d13c (diff) |
ALSA: hda - Enable GPIO control for mute LED on HP systems
This patch enables GPIO to control mute LED indicator on the HP systems
with the special string in BIOS and applies it with the correct polarity on
HP B-series systems.
It also restores configuration of the pin intended as the second Headphone
on HP B-series systems but configured as something else in the BIOS to
pass MS DTM.
Signed-off-by: Vitaliy Kulikov <Vitaliy.Kulikov@idt.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 66c0876bf734..b513eba2d2f7 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
31 | #include <linux/dmi.h> | ||
31 | #include <sound/core.h> | 32 | #include <sound/core.h> |
32 | #include <sound/asoundef.h> | 33 | #include <sound/asoundef.h> |
33 | #include <sound/jack.h> | 34 | #include <sound/jack.h> |
@@ -1693,6 +1694,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
1693 | "DFI LanParty", STAC_92HD71BXX_REF), | 1694 | "DFI LanParty", STAC_92HD71BXX_REF), |
1694 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb, | 1695 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb, |
1695 | "HP dv4-1222nr", STAC_HP_DV4_1222NR), | 1696 | "HP dv4-1222nr", STAC_HP_DV4_1222NR), |
1697 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720, | ||
1698 | "HP", STAC_HP_DV5), | ||
1696 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, | 1699 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, |
1697 | "HP", STAC_HP_DV5), | 1700 | "HP", STAC_HP_DV5), |
1698 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, | 1701 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, |
@@ -4730,6 +4733,26 @@ static int stac92xx_resume(struct hda_codec *codec) | |||
4730 | return 0; | 4733 | return 0; |
4731 | } | 4734 | } |
4732 | 4735 | ||
4736 | static int hp_bseries_system(u32 subsystem_id) | ||
4737 | { | ||
4738 | switch (subsystem_id) { | ||
4739 | case 0x103c307e: | ||
4740 | case 0x103c307f: | ||
4741 | case 0x103c3080: | ||
4742 | case 0x103c3081: | ||
4743 | case 0x103c1722: | ||
4744 | case 0x103c1723: | ||
4745 | case 0x103c1724: | ||
4746 | case 0x103c1725: | ||
4747 | case 0x103c1726: | ||
4748 | case 0x103c1727: | ||
4749 | case 0x103c1728: | ||
4750 | case 0x103c1729: | ||
4751 | return 1; | ||
4752 | } | ||
4753 | return 0; | ||
4754 | } | ||
4755 | |||
4733 | /* | 4756 | /* |
4734 | * using power check for controlling mute led of HP notebooks | 4757 | * using power check for controlling mute led of HP notebooks |
4735 | * check for mute state only on Speakers (nid = 0x10) | 4758 | * check for mute state only on Speakers (nid = 0x10) |
@@ -4754,6 +4777,11 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec, | |||
4754 | else | 4777 | else |
4755 | spec->gpio_data |= spec->gpio_led; /* white */ | 4778 | spec->gpio_data |= spec->gpio_led; /* white */ |
4756 | 4779 | ||
4780 | if (hp_bseries_system(codec->subsystem_id)) { | ||
4781 | /* LED state is inverted on these systems */ | ||
4782 | spec->gpio_data ^= spec->gpio_led; | ||
4783 | } | ||
4784 | |||
4757 | stac_gpio_set(codec, spec->gpio_mask, | 4785 | stac_gpio_set(codec, spec->gpio_mask, |
4758 | spec->gpio_dir, | 4786 | spec->gpio_dir, |
4759 | spec->gpio_data); | 4787 | spec->gpio_data); |
@@ -5243,6 +5271,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
5243 | { | 5271 | { |
5244 | struct sigmatel_spec *spec; | 5272 | struct sigmatel_spec *spec; |
5245 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; | 5273 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; |
5274 | unsigned int pin_cfg; | ||
5246 | int err = 0; | 5275 | int err = 0; |
5247 | 5276 | ||
5248 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5277 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -5426,6 +5455,45 @@ again: | |||
5426 | break; | 5455 | break; |
5427 | } | 5456 | } |
5428 | 5457 | ||
5458 | if (hp_bseries_system(codec->subsystem_id)) { | ||
5459 | pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f); | ||
5460 | if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT || | ||
5461 | get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER || | ||
5462 | get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) { | ||
5463 | /* It was changed in the BIOS to just satisfy MS DTM. | ||
5464 | * Lets turn it back into slaved HP | ||
5465 | */ | ||
5466 | pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE)) | ||
5467 | | (AC_JACK_HP_OUT << | ||
5468 | AC_DEFCFG_DEVICE_SHIFT); | ||
5469 | pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC | ||
5470 | | AC_DEFCFG_SEQUENCE))) | ||
5471 | | 0x1f; | ||
5472 | snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg); | ||
5473 | } | ||
5474 | } | ||
5475 | |||
5476 | if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) { | ||
5477 | const struct dmi_device *dev = NULL; | ||
5478 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, | ||
5479 | NULL, dev))) { | ||
5480 | if (strcmp(dev->name, "HP_Mute_LED_1")) { | ||
5481 | switch (codec->vendor_id) { | ||
5482 | case 0x111d7608: | ||
5483 | spec->gpio_led = 0x01; | ||
5484 | break; | ||
5485 | case 0x111d7600: | ||
5486 | case 0x111d7601: | ||
5487 | case 0x111d7602: | ||
5488 | case 0x111d7603: | ||
5489 | spec->gpio_led = 0x08; | ||
5490 | break; | ||
5491 | } | ||
5492 | break; | ||
5493 | } | ||
5494 | } | ||
5495 | } | ||
5496 | |||
5429 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5497 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5430 | if (spec->gpio_led) { | 5498 | if (spec->gpio_led) { |
5431 | spec->gpio_mask |= spec->gpio_led; | 5499 | spec->gpio_mask |= spec->gpio_led; |