]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - 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/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / alsa-post-ga-hp-ad1984a-mobile-mute-fix
diff --git a/src/patches/suse-2.6.27.31/patches.drivers/alsa-post-ga-hp-ad1984a-mobile-mute-fix b/src/patches/suse-2.6.27.31/patches.drivers/alsa-post-ga-hp-ad1984a-mobile-mute-fix
new file mode 100644 (file)
index 0000000..96fe2eb
--- /dev/null
@@ -0,0 +1,64 @@
+From 1a0aa9b7d709547bb9dec1f31e48754318ff121a Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 2 Jul 2009 16:10:23 +0200
+Subject: ALSA: hda - Add GPIO1 control at muting with HP laptops
+Patch-mainline: 
+References: bnc#515266,bnc#522764
+
+HP laptops with AD1984A codecs (at least mobile models) need to set
+GPIO1 appropriately to indicate the mute state.  The BIOS checks this
+bit to judge whether the mute on or off is sent via F8 key.
+Without changing this bit, the BIOS can be confused and may toggle
+the mute wrongly.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ sound/pci/hda/patch_analog.c |   27 ++++++++++++++++++++++++++-
+ 1 file changed, 26 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_analog.c
++++ b/sound/pci/hda/patch_analog.c
+@@ -3713,9 +3713,30 @@
+       { } /* end */
+ };
++static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol,
++                                      struct snd_ctl_elem_value *ucontrol)
++{
++      struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
++      int ret = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
++      int mute = (!ucontrol->value.integer.value[0] &&
++                  !ucontrol->value.integer.value[1]);
++      /* toggle GPIO1 according to the mute state */
++      snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
++                          mute ? 0x02 : 0x0);
++      return ret;
++}
++
+ static struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
+       HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
+-      HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
++      /*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
++      {
++              .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
++              .name = "Master Playback Switch",
++              .info = snd_hda_mixer_amp_switch_info,
++              .get = snd_hda_mixer_amp_switch_get,
++              .put = ad1884a_mobile_master_sw_put,
++              .private_value = HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
++      },
+       HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
+       HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT),
+       HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),
+@@ -3838,6 +3859,10 @@
+       /* unsolicited event for pin-sense */
+       {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT},
+       {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT},
++      /* allow to touch GPIO1 (for mute control) */
++      {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
++      {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
++      {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, /* first muted */
+       { } /* end */
+ };