1 From 8718b700ccbcc3c6016d38a75e005293c3660f1c Mon Sep 17 00:00:00 2001
2 From: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
3 Date: Wed, 4 Mar 2009 14:22:51 -0300
4 Subject: ALSA: hda - Add headphone automute support for 3stack-hp model (ALC888)
8 Mute speaker outputs on headphone insertion for machines that use
11 Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
12 Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 sound/pci/hda/patch_realtek.c | 38 +++++++++++++++++++++++++++++++++-----
16 1 file changed, 33 insertions(+), 5 deletions(-)
18 --- a/sound/pci/hda/patch_realtek.c
19 +++ b/sound/pci/hda/patch_realtek.c
20 @@ -7853,16 +7853,42 @@ static struct hda_verb alc888_lenovo_sky
24 +static struct hda_verb alc888_6st_dell_verbs[] = {
25 + {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
29 +static void alc888_3st_hp_front_automute(struct hda_codec *codec)
31 + unsigned int present, bits;
33 + present = snd_hda_codec_read(codec, 0x1b, 0,
34 + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
35 + bits = present ? HDA_AMP_MUTE : 0;
36 + snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
37 + HDA_AMP_MUTE, bits);
38 + snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
39 + HDA_AMP_MUTE, bits);
40 + snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
41 + HDA_AMP_MUTE, bits);
44 +static void alc888_3st_hp_unsol_event(struct hda_codec *codec,
47 + switch (res >> 26) {
48 + case ALC880_HP_EVENT:
49 + alc888_3st_hp_front_automute(codec);
54 static struct hda_verb alc888_3st_hp_verbs[] = {
55 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
56 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
57 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
61 -static struct hda_verb alc888_6st_dell_verbs[] = {
62 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
68 @@ -8715,6 +8741,8 @@ static struct alc_config_preset alc883_p
69 .channel_mode = alc888_3st_hp_modes,
71 .input_mux = &alc883_capture_source,
72 + .unsol_event = alc888_3st_hp_unsol_event,
73 + .init_hook = alc888_3st_hp_front_automute,
76 .mixers = { alc883_base_mixer, alc883_chmode_mixer },