diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-11-14 17:42:11 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-11-14 17:43:17 +0100 |
commit | 5671087ffa80ea7fcc254c08de9697551fecedcf (patch) | |
tree | e207e05f38e2aeb63dacb43c26c106e86ad370cb /sound/pci/hda/patch_realtek.c | |
parent | b25396994b90f69c5fc6d7cd448174d7eea69f14 (diff) | |
download | lwn-5671087ffa80ea7fcc254c08de9697551fecedcf.tar.gz lwn-5671087ffa80ea7fcc254c08de9697551fecedcf.zip |
ALSA: hda/realtek - Move ALC885 macpro and imac24 models to auto-parser
The ALC882 macpro and imac24 static configs can be transferred to the
auto-parser with the additional GPIO setup.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 41590e3a20f5..fb480858ec65 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4296,6 +4296,7 @@ enum { ALC882_FIXUP_ACER_ASPIRE_4930G, ALC882_FIXUP_ACER_ASPIRE_8930G, ALC882_FIXUP_ASPIRE_8930G_VERBS, + ALC885_FIXUP_MACPRO_GPIO, }; static void alc889_fixup_coef(struct hda_codec *codec, @@ -4306,6 +4307,49 @@ static void alc889_fixup_coef(struct hda_codec *codec, alc889_coef_init(codec); } +/* toggle speaker-output according to the hp-jack state */ +static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) +{ + unsigned int gpiostate, gpiomask, gpiodir; + + gpiostate = snd_hda_codec_read(codec, codec->afg, 0, + AC_VERB_GET_GPIO_DATA, 0); + + if (!muted) + gpiostate |= (1 << pin); + else + gpiostate &= ~(1 << pin); + + gpiomask = snd_hda_codec_read(codec, codec->afg, 0, + AC_VERB_GET_GPIO_MASK, 0); + gpiomask |= (1 << pin); + + gpiodir = snd_hda_codec_read(codec, codec->afg, 0, + AC_VERB_GET_GPIO_DIRECTION, 0); + gpiodir |= (1 << pin); + + + snd_hda_codec_write(codec, codec->afg, 0, + AC_VERB_SET_GPIO_MASK, gpiomask); + snd_hda_codec_write(codec, codec->afg, 0, + AC_VERB_SET_GPIO_DIRECTION, gpiodir); + + msleep(1); + + snd_hda_codec_write(codec, codec->afg, 0, + AC_VERB_SET_GPIO_DATA, gpiostate); +} + +/* set up GPIO at initialization */ +static void alc885_fixup_macpro_gpio(struct hda_codec *codec, + const struct alc_fixup *fix, int action) +{ + if (action != ALC_FIXUP_ACT_INIT) + return; + alc882_gpio_mute(codec, 0, 0); + alc882_gpio_mute(codec, 1, 0); +} + static const struct alc_fixup alc882_fixups[] = { [ALC882_FIXUP_ABIT_AW9D_MAX] = { .type = ALC_FIXUP_PINS, @@ -4449,6 +4493,10 @@ static const struct alc_fixup alc882_fixups[] = { { } } }, + [ALC885_FIXUP_MACPRO_GPIO] = { + .type = ALC_FIXUP_FUNC, + .v.func = alc885_fixup_macpro_gpio, + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { @@ -4479,7 +4527,14 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), - SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), /* codec SSID */ + + /* All Apple entries are in codec SSIDs */ + SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO), + SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), + SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), + SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), + SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), + SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), |