]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.drivers/alsa-post-ga-alc888-hp-3stack-auto-mute
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / alsa-post-ga-alc888-hp-3stack-auto-mute
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)
5 Patch-mainline:
6 References: bnc#482796
7
8 Mute speaker outputs on headphone insertion for machines that use
9 3stack-hp model.
10
11 Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
12 Signed-off-by: Takashi Iwai <tiwai@suse.de>
13
14 ---
15 sound/pci/hda/patch_realtek.c | 38 +++++++++++++++++++++++++++++++++-----
16 1 file changed, 33 insertions(+), 5 deletions(-)
17
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
21 { } /* end */
22 };
23
24 +static struct hda_verb alc888_6st_dell_verbs[] = {
25 + {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
26 + { }
27 +};
28 +
29 +static void alc888_3st_hp_front_automute(struct hda_codec *codec)
30 +{
31 + unsigned int present, bits;
32 +
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);
42 +}
43 +
44 +static void alc888_3st_hp_unsol_event(struct hda_codec *codec,
45 + unsigned int res)
46 +{
47 + switch (res >> 26) {
48 + case ALC880_HP_EVENT:
49 + alc888_3st_hp_front_automute(codec);
50 + break;
51 + }
52 +}
53 +
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) */
58 - { }
59 -};
60 -
61 -static struct hda_verb alc888_6st_dell_verbs[] = {
62 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
63 - { }
64 + { } /* end */
65 };
66
67 /*
68 @@ -8715,6 +8741,8 @@ static struct alc_config_preset alc883_p
69 .channel_mode = alc888_3st_hp_modes,
70 .need_dac_fix = 1,
71 .input_mux = &alc883_capture_source,
72 + .unsol_event = alc888_3st_hp_unsol_event,
73 + .init_hook = alc888_3st_hp_front_automute,
74 },
75 [ALC888_6ST_DELL] = {
76 .mixers = { alc883_base_mixer, alc883_chmode_mixer },