aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorHarald Welte <HaraldWelte@viatech.com>2008-09-09 03:50:37 -0400
committerJaroslav Kysela <perex@perex.cz>2008-09-09 12:51:59 -0400
commit76d9b0dd78197c473892e44b1fbf6be4592cc440 (patch)
treef052d9bf7978247eeca59e54292deb4f1554020c /sound/pci
parenteb14a46cf974c59aadef8c120b7dfcb27bc81f24 (diff)
ALSA: HDA patch_via.c: HP and CD pin connect config
Signed-off-by: Harald Welte <HaraldWelte@viatech.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_via.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 3e148373334d..d397f528cb51 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * HD audio interface patch for VIA VT1708 codec 4 * HD audio interface patch for VIA VT1708 codec
5 * 5 *
6 * Copyright (c) 2006 Lydia Wang <lydiawang@viatech.com> 6 * Copyright (c) 2006-2008 Lydia Wang <lydiawang@viatech.com>
7 * Takashi Iwai <tiwai@suse.de> 7 * Takashi Iwai <tiwai@suse.de>
8 * 8 *
9 * This driver is free software; you can redistribute it and/or modify 9 * This driver is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@
29/* 2006-09-08 Lydia Wang Fix internal loopback recording source select bug */ 29/* 2006-09-08 Lydia Wang Fix internal loopback recording source select bug */
30/* 2007-09-12 Lydia Wang Add EAPD enable during driver initialization */ 30/* 2007-09-12 Lydia Wang Add EAPD enable during driver initialization */
31/* 2007-09-17 Lydia Wang Add VT1708B codec support */ 31/* 2007-09-17 Lydia Wang Add VT1708B codec support */
32/* 2007-11-14 Lydia Wang Add VT1708A codec HP and CD pin connect config */
32/* */ 33/* */
33/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 34/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
34 35
@@ -53,6 +54,8 @@
53#define VT1708_DIGOUT_NID 0x14 54#define VT1708_DIGOUT_NID 0x14
54#define VT1708_DIGIN_NID 0x16 55#define VT1708_DIGIN_NID 0x16
55#define VT1708_DIGIN_PIN 0x26 56#define VT1708_DIGIN_PIN 0x26
57#define VT1708_HP_PIN_NID 0x20
58#define VT1708_CD_PIN_NID 0x24
56 59
57#define VT1709_HP_DAC_NID 0x28 60#define VT1709_HP_DAC_NID 0x28
58#define VT1709_DIGOUT_NID 0x13 61#define VT1709_DIGOUT_NID 0x13
@@ -840,11 +843,36 @@ static struct hda_amp_list vt1708_loopbacks[] = {
840}; 843};
841#endif 844#endif
842 845
846static void vt1708_set_pinconfig_connect(struct hda_codec *codec, hda_nid_t nid)
847{
848 unsigned int def_conf;
849 unsigned char seqassoc;
850
851 def_conf = snd_hda_codec_read(codec, nid, 0,
852 AC_VERB_GET_CONFIG_DEFAULT, 0);
853 seqassoc = (unsigned char) get_defcfg_association(def_conf);
854 seqassoc = (seqassoc << 4) | get_defcfg_sequence(def_conf);
855 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) {
856 if (seqassoc == 0xff) {
857 def_conf = def_conf & (~(AC_JACK_PORT_BOTH << 30));
858 snd_hda_codec_write(codec, nid, 0,
859 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
860 def_conf >> 24);
861 }
862 }
863
864 return;
865}
866
843static int vt1708_parse_auto_config(struct hda_codec *codec) 867static int vt1708_parse_auto_config(struct hda_codec *codec)
844{ 868{
845 struct via_spec *spec = codec->spec; 869 struct via_spec *spec = codec->spec;
846 int err; 870 int err;
847 871
872 /* Add HP and CD pin config connect bit re-config action */
873 vt1708_set_pinconfig_connect(codec, VT1708_HP_PIN_NID);
874 vt1708_set_pinconfig_connect(codec, VT1708_CD_PIN_NID);
875
848 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); 876 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL);
849 if (err < 0) 877 if (err < 0)
850 return err; 878 return err;