]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.drivers/alsa-post-ga-hp-ad1984a-mobile-mute-fix
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / alsa-post-ga-hp-ad1984a-mobile-mute-fix
1 From 1a0aa9b7d709547bb9dec1f31e48754318ff121a Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Thu, 2 Jul 2009 16:10:23 +0200
4 Subject: ALSA: hda - Add GPIO1 control at muting with HP laptops
5 Patch-mainline:
6 References: bnc#515266,bnc#522764
7
8 HP laptops with AD1984A codecs (at least mobile models) need to set
9 GPIO1 appropriately to indicate the mute state. The BIOS checks this
10 bit to judge whether the mute on or off is sent via F8 key.
11 Without changing this bit, the BIOS can be confused and may toggle
12 the mute wrongly.
13
14 Signed-off-by: Takashi Iwai <tiwai@suse.de>
15
16 ---
17 sound/pci/hda/patch_analog.c | 27 ++++++++++++++++++++++++++-
18 1 file changed, 26 insertions(+), 1 deletion(-)
19
20 --- a/sound/pci/hda/patch_analog.c
21 +++ b/sound/pci/hda/patch_analog.c
22 @@ -3713,9 +3713,30 @@
23 { } /* end */
24 };
25
26 +static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol,
27 + struct snd_ctl_elem_value *ucontrol)
28 +{
29 + struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
30 + int ret = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
31 + int mute = (!ucontrol->value.integer.value[0] &&
32 + !ucontrol->value.integer.value[1]);
33 + /* toggle GPIO1 according to the mute state */
34 + snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
35 + mute ? 0x02 : 0x0);
36 + return ret;
37 +}
38 +
39 static struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
40 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
41 - HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
42 + /*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
43 + {
44 + .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
45 + .name = "Master Playback Switch",
46 + .info = snd_hda_mixer_amp_switch_info,
47 + .get = snd_hda_mixer_amp_switch_get,
48 + .put = ad1884a_mobile_master_sw_put,
49 + .private_value = HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
50 + },
51 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
52 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT),
53 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),
54 @@ -3838,6 +3859,10 @@
55 /* unsolicited event for pin-sense */
56 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT},
57 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT},
58 + /* allow to touch GPIO1 (for mute control) */
59 + {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
60 + {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
61 + {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, /* first muted */
62 { } /* end */
63 };
64