aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-06-10 13:58:24 -0400
committerJaroslav Kysela <perex@suse.cz>2005-06-22 06:28:51 -0400
commit16ded525389c31256bcc9fd44352ab799b60b7fc (patch)
tree481fc40097ccef94f0ec595a25891e91bee9e4fb /sound/pci/hda
parent5ecd7022f52872db32eddf85a527064ed7b522a3 (diff)
[ALSA] hda-codec - Add support of more models with ALC codecs
HDA Codec driver,HDA Intel driver Merged the work of pshou <pshou@realtek.com.tw> for the support of more models with ALC codecs: ALC880 ASUS, Uniwill, FSC1734, generic 6-stack, and ALC260 HP. Tests with the real hardwares are appreciated. The codec patch is cleaned up: The preset configuration of codecs are stored in the table and copied to the spec instance. Added/fixed comments. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_codec.h6
-rw-r--r--sound/pci/hda/hda_intel.c1
-rw-r--r--sound/pci/hda/patch_realtek.c878
3 files changed, 723 insertions, 162 deletions
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 1b1203539ea6..59991560d492 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -75,6 +75,9 @@ enum {
75#define AC_VERB_GET_DIGI_CONVERT 0x0f0d 75#define AC_VERB_GET_DIGI_CONVERT 0x0f0d
76#define AC_VERB_GET_VOLUME_KNOB_CONTROL 0x0f0f 76#define AC_VERB_GET_VOLUME_KNOB_CONTROL 0x0f0f
77/* f10-f1a: GPIO */ 77/* f10-f1a: GPIO */
78#define AC_VERB_GET_GPIO_DATA 0x0f15
79#define AC_VERB_GET_GPIO_MASK 0x0f16
80#define AC_VERB_GET_GPIO_DIRECTION 0x0f17
78#define AC_VERB_GET_CONFIG_DEFAULT 0x0f1c 81#define AC_VERB_GET_CONFIG_DEFAULT 0x0f1c
79 82
80/* 83/*
@@ -97,6 +100,9 @@ enum {
97#define AC_VERB_SET_DIGI_CONVERT_1 0x70d 100#define AC_VERB_SET_DIGI_CONVERT_1 0x70d
98#define AC_VERB_SET_DIGI_CONVERT_2 0x70e 101#define AC_VERB_SET_DIGI_CONVERT_2 0x70e
99#define AC_VERB_SET_VOLUME_KNOB_CONTROL 0x70f 102#define AC_VERB_SET_VOLUME_KNOB_CONTROL 0x70f
103#define AC_VERB_SET_GPIO_DATA 0x715
104#define AC_VERB_SET_GPIO_MASK 0x716
105#define AC_VERB_SET_GPIO_DIRECTION 0x717
100#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 0x71c 106#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 0x71c
101#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_1 0x71d 107#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_1 0x71d
102#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_2 0x71e 108#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_2 0x71e
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 0d546addc091..d89849197422 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1458,6 +1458,7 @@ static struct pci_device_id azx_ids[] = {
1458 { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ESB2 */ 1458 { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ESB2 */
1459 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ATI SB450 */ 1459 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ATI SB450 */
1460 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* VIA VT8251/VT8237A */ 1460 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* VIA VT8251/VT8237A */
1461 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ULI */
1461 { 0, } 1462 { 0, }
1462}; 1463};
1463MODULE_DEVICE_TABLE(pci, azx_ids); 1464MODULE_DEVICE_TABLE(pci, azx_ids);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 84ae90cc1114..ce280c006be1 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -33,7 +33,6 @@
33 33
34/* ALC880 board config type */ 34/* ALC880 board config type */
35enum { 35enum {
36 ALC880_MINIMAL,
37 ALC880_3ST, 36 ALC880_3ST,
38 ALC880_3ST_DIG, 37 ALC880_3ST_DIG,
39 ALC880_5ST, 38 ALC880_5ST,
@@ -41,32 +40,54 @@ enum {
41 ALC880_W810, 40 ALC880_W810,
42 ALC880_Z71V, 41 ALC880_Z71V,
43 ALC880_TEST, 42 ALC880_TEST,
43 ALC880_6ST_DIG,
44 ALC880_F1734,
45 ALC880_ASUS,
46 ALC880_ASUS_DIG,
47 ALC880_ASUS_W1V,
48 ALC880_UNIWILL_DIG,
49 ALC880_MODEL_LAST /* last tag */
50};
51
52/* ALC260 models */
53enum {
54 ALC260_BASIC,
55 ALC260_HP,
56 ALC260_MODEL_LAST /* last tag */
44}; 57};
45 58
46struct alc_spec { 59struct alc_spec {
47 /* codec parameterization */ 60 /* codec parameterization */
48 unsigned int front_panel: 1; 61 unsigned int front_panel: 1; /* indicates the board has a front panel;
49 62 * not referred currently for any purpose,
50 snd_kcontrol_new_t* mixers[2]; 63 * though...
64 */
65
66 snd_kcontrol_new_t *mixers[2]; /* mixer arrays */
51 unsigned int num_mixers; 67 unsigned int num_mixers;
52 68
53 struct hda_verb *init_verbs; 69 struct hda_verb *init_verbs; /* initialization verbs
70 * don't forget NULL termination!
71 */
54 72
55 char* stream_name_analog; 73 char *stream_name_analog; /* analog PCM stream */
56 struct hda_pcm_stream *stream_analog_playback; 74 struct hda_pcm_stream *stream_analog_playback;
57 struct hda_pcm_stream *stream_analog_capture; 75 struct hda_pcm_stream *stream_analog_capture;
58 76
59 char* stream_name_digital; 77 char *stream_name_digital; /* digital PCM stream */
60 struct hda_pcm_stream *stream_digital_playback; 78 struct hda_pcm_stream *stream_digital_playback;
61 struct hda_pcm_stream *stream_digital_capture; 79 struct hda_pcm_stream *stream_digital_capture;
62 80
63 /* playback */ 81 /* playback */
64 struct hda_multi_out multiout; 82 struct hda_multi_out multiout; /* playback set-up
83 * max_channels, dacs must be set
84 * dig_out_nid and hp_nid are optional
85 */
65 86
66 /* capture */ 87 /* capture */
67 unsigned int num_adc_nids; 88 unsigned int num_adc_nids;
68 hda_nid_t *adc_nids; 89 hda_nid_t *adc_nids;
69 hda_nid_t dig_in_nid; 90 hda_nid_t dig_in_nid; /* digital-in NID; optional */
70 91
71 /* capture source */ 92 /* capture source */
72 const struct hda_input_mux *input_mux; 93 const struct hda_input_mux *input_mux;
@@ -77,9 +98,9 @@ struct alc_spec {
77 int num_channel_mode; 98 int num_channel_mode;
78 99
79 /* PCM information */ 100 /* PCM information */
80 struct hda_pcm pcm_rec[2]; 101 struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */
81 102
82 struct semaphore bind_mutex; 103 struct semaphore bind_mutex; /* for bound controls */
83}; 104};
84 105
85/* DAC/ADC assignment */ 106/* DAC/ADC assignment */
@@ -89,6 +110,11 @@ static hda_nid_t alc880_dac_nids[4] = {
89 0x02, 0x05, 0x04, 0x03 110 0x02, 0x05, 0x04, 0x03
90}; 111};
91 112
113static hda_nid_t alc880_6st_dac_nids[4] = {
114 /* front, rear, clfe, rear_surr */
115 0x02, 0x03, 0x04, 0x05
116};
117
92static hda_nid_t alc880_w810_dac_nids[3] = { 118static hda_nid_t alc880_w810_dac_nids[3] = {
93 /* front, rear/surround, clfe */ 119 /* front, rear/surround, clfe */
94 0x02, 0x03, 0x04 120 0x02, 0x03, 0x04
@@ -122,9 +148,14 @@ static hda_nid_t alc260_dac_nids[1] = {
122 0x02, 148 0x02,
123}; 149};
124 150
125static hda_nid_t alc260_adc_nids[2] = { 151static hda_nid_t alc260_adc_nids[1] = {
126 /* ADC0-1 */ 152 /* ADC0 */
127 0x04, 0x05, 153 0x04,
154};
155
156static hda_nid_t alc260_hp_adc_nids[1] = {
157 /* ADC1 */
158 0x05,
128}; 159};
129 160
130#define ALC260_DIGOUT_NID 0x03 161#define ALC260_DIGOUT_NID 0x03
@@ -140,6 +171,17 @@ static struct hda_input_mux alc880_capture_source = {
140 }, 171 },
141}; 172};
142 173
174//pshou 05/24/05
175static struct hda_input_mux alc880_6stack_capture_source = {
176 .num_items = 4,
177 .items = {
178 { "Mic", 0x0 },
179 { "Front Mic", 0x1 },
180 { "Line", 0x2 },
181 { "CD", 0x4 },
182 },
183};
184
143static struct hda_input_mux alc260_capture_source = { 185static struct hda_input_mux alc260_capture_source = {
144 .num_items = 4, 186 .num_items = 4,
145 .items = { 187 .items = {
@@ -307,6 +349,11 @@ static struct alc_channel_mode alc880_z71v_modes[1] = {
307 { 2, NULL } 349 { 2, NULL }
308}; 350};
309 351
352//pshou 05/19/05
353static struct alc_channel_mode alc880_sixstack_modes[1] = {
354 { 8, NULL },
355};
356
310/* 357/*
311 */ 358 */
312static int alc880_ch_mode_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 359static int alc880_ch_mode_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
@@ -605,6 +652,172 @@ static snd_kcontrol_new_t alc880_z71v_mixer[] = {
605 { } /* end */ 652 { } /* end */
606}; 653};
607 654
655//pshou 05/24/05
656static snd_kcontrol_new_t alc880_six_stack_mixer[] = {
657 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
658 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
659 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
660 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
661 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
662 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
663 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
664 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
665 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
666 ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
667 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
668 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
669 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
670 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
673 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
674 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
675 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
676 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
677 /* HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), */
678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
679 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
680 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
681 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
682 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
683 {
684 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
685 /* The multiple "Capture Source" controls confuse alsamixer
686 * So call somewhat different..
687 * FIXME: the controls appear in the "playback" view!
688 */
689 /* .name = "Capture Source", */
690 .name = "Input Source",
691 .count = 2,
692 .info = alc_mux_enum_info,
693 .get = alc_mux_enum_get,
694 .put = alc_mux_enum_put,
695 },
696 {
697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
698 .name = "Channel Mode",
699 .info = alc880_ch_mode_info,
700 .get = alc880_ch_mode_get,
701 .put = alc880_ch_mode_put,
702 },
703 { } /* end */
704};
705
706// 03/08/05 Fujitsu
707static snd_kcontrol_new_t alc880_2_jack_mixer[] = {
708 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
709 ALC_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
710 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
711 ALC_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
712 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
713 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
714 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
715 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
716 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
717 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
718 {
719 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
720 /* The multiple "Capture Source" controls confuse alsamixer
721 * So call somewhat different..
722 * FIXME: the controls appear in the "playback" view!
723 */
724 /* .name = "Capture Source", */
725 .name = "Input Source",
726 .count = 1,
727 .info = alc_mux_enum_info,
728 .get = alc_mux_enum_get,
729 .put = alc_mux_enum_put,
730 },
731 { } /* end */
732};
733
734//pshou 04/24/05
735static snd_kcontrol_new_t alc880_asus_mixer[] = {
736 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
737 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
738 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
739 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
740 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
741 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
742 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
743 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
744 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
745 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
746 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
747 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
748 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
749 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
750 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
751 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
752 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
753 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
754 {
755 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
756 /* The multiple "Capture Source" controls confuse alsamixer
757 * So call somewhat different..
758 * FIXME: the controls appear in the "playback" view!
759 */
760 /* .name = "Capture Source", */
761 .name = "Input Source",
762 .count = 2,
763 .info = alc_mux_enum_info,
764 .get = alc_mux_enum_get,
765 .put = alc_mux_enum_put,
766 },
767 {
768 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
769 .name = "Channel Mode",
770 .info = alc880_ch_mode_info,
771 .get = alc880_ch_mode_get,
772 .put = alc880_ch_mode_put,
773 },
774 { } /* end */
775};
776
777// pshou 05/03/05
778static snd_kcontrol_new_t alc880_asus_w1v_mixer[] = {
779 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
780 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
781 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
782 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
783 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
784 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
785 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
786 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
787 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
788 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
789 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
790 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
791 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
792 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
793 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
795 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
796 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
797 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
798 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
799 {
800 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
801 /* The multiple "Capture Source" controls confuse alsamixer
802 * So call somewhat different..
803 * FIXME: the controls appear in the "playback" view!
804 */
805 /* .name = "Capture Source", */
806 .name = "Input Source",
807 .count = 2,
808 .info = alc_mux_enum_info,
809 .get = alc_mux_enum_get,
810 .put = alc_mux_enum_put,
811 },
812 {
813 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
814 .name = "Channel Mode",
815 .info = alc880_ch_mode_info,
816 .get = alc880_ch_mode_get,
817 .put = alc880_ch_mode_put,
818 },
819 { } /* end */
820};
608/* 821/*
609 */ 822 */
610static int alc_build_controls(struct hda_codec *codec) 823static int alc_build_controls(struct hda_codec *codec)
@@ -642,7 +855,8 @@ static int alc_build_controls(struct hda_codec *codec)
642#define AMP_OUT_UNMUTE 0xb000 855#define AMP_OUT_UNMUTE 0xb000
643#define AMP_OUT_ZERO 0xb000 856#define AMP_OUT_ZERO 0xb000
644#define PIN_IN 0x20 857#define PIN_IN 0x20
645#define PIN_VREF 0x24 858#define PIN_VREF80 0x24
859#define PIN_VREF50 0x21
646#define PIN_OUT 0x40 860#define PIN_OUT 0x40
647#define PIN_HP 0xc0 861#define PIN_HP 0xc0
648 862
@@ -657,19 +871,19 @@ static struct hda_verb alc880_init_verbs_three_stack[] = {
657 /* CD pin widget for input */ 871 /* CD pin widget for input */
658 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 872 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
659 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 873 /* Mic1 (rear panel) pin widget for input and vref at 80% */
660 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 874 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
661 /* Mic2 (front panel) pin widget for input and vref at 80% */ 875 /* Mic2 (front panel) pin widget for input and vref at 80% */
662 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 876 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
663 /* unmute capture amp left and right */ 877 /* unmute capture amp left and right */
664 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 878 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
665 /* set connection select to mic in */ 879 /* set connection select to mic in */
666 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 880 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
667 /* unmute capture1 amp left and right */ 881 /* unmute capture1 amp left and right */
668 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 882 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
669 /* set connection select to mic in */ 883 /* set connection select to mic in */
670 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 884 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
671 /* unmute capture2 amp left and right */ 885 /* unmute capture2 amp left and right */
672 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 886 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
673 /* set connection select to mic in */ 887 /* set connection select to mic in */
674 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 888 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
675 /* set vol=0 front mixer amp */ 889 /* set vol=0 front mixer amp */
@@ -704,11 +918,11 @@ static struct hda_verb alc880_init_verbs_three_stack[] = {
704 */ 918 */
705 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ 919 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
706 /* mute CD */ 920 /* mute CD */
707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
708 /* unmute Line In */ 922 /* unmute Line In */
709 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 923 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
710 /* mute Mic 1 */ 924 /* mute Mic 1 */
711 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
712 /* mute Line In 2 (for PASD boards Mic 2) */ 926 /* mute Line In 2 (for PASD boards Mic 2) */
713 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
714 928
@@ -745,19 +959,19 @@ static struct hda_verb alc880_init_verbs_five_stack[] = {
745 /* CD pin widget for input */ 959 /* CD pin widget for input */
746 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 960 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
747 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 961 /* Mic1 (rear panel) pin widget for input and vref at 80% */
748 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 962 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
749 /* Mic2 (front panel) pin widget for input and vref at 80% */ 963 /* Mic2 (front panel) pin widget for input and vref at 80% */
750 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
751 /* mute capture amp left and right */ 965 /* mute capture amp left and right */
752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
753 /* set connection select to mic in */ 967 /* set connection select to mic in */
754 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 968 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
755 /* mute amp1 left and right */ 969 /* mute amp1 left and right */
756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 970 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
757 /* set connection select to mic in */ 971 /* set connection select to mic in */
758 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 972 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
759 /* mute amp left and right */ 973 /* mute amp left and right */
760 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 974 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
761 /* set connection select to mic in */ 975 /* set connection select to mic in */
762 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 976 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
763 /* set vol=0 front mixer amp */ 977 /* set vol=0 front mixer amp */
@@ -792,13 +1006,13 @@ static struct hda_verb alc880_init_verbs_five_stack[] = {
792 /* Note: PASD motherboards uses the Line In 2 as the input for front panel mic (mic 2) */ 1006 /* Note: PASD motherboards uses the Line In 2 as the input for front panel mic (mic 2) */
793 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03*/ 1007 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03*/
794 /* unmute CD */ 1008 /* unmute CD */
795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 1009 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
796 /* unmute Line In */ 1010 /* unmute Line In */
797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 1011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
798 /* unmute Mic 1 */ 1012 /* unmute Mic 1 */
799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
800 /* unmute Line In 2 (for PASD boards Mic 2) */ 1014 /* unmute Line In 2 (for PASD boards Mic 2) */
801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 1015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
802 1016
803 /* Unmute input amps for the line out paths to support the output path of 1017 /* Unmute input amps for the line out paths to support the output path of
804 * analog loopback 1018 * analog loopback
@@ -909,19 +1123,19 @@ static struct hda_verb alc880_z71v_init_verbs[] = {
909 /* CD pin widget for input */ 1123 /* CD pin widget for input */
910 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1124 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
911 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 1125 /* Mic1 (rear panel) pin widget for input and vref at 80% */
912 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 1126 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
913 /* Mic2 (front panel) pin widget for input and vref at 80% */ 1127 /* Mic2 (front panel) pin widget for input and vref at 80% */
914 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 1128 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
915 /* unmute amp left and right */ 1129 /* unmute amp left and right */
916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
917 /* set connection select to mic in */ 1131 /* set connection select to mic in */
918 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 1132 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
919 /* unmute amp left and right */ 1133 /* unmute amp left and right */
920 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1134 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
921 /* set connection select to mic in */ 1135 /* set connection select to mic in */
922 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 1136 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
923 /* unmute amp left and right */ 1137 /* unmute amp left and right */
924 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1138 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
925 /* set connection select to mic in */ 1139 /* set connection select to mic in */
926 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 1140 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
927 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) for mixer 1141 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) for mixer
@@ -930,17 +1144,150 @@ static struct hda_verb alc880_z71v_init_verbs[] = {
930 /* Note: PASD motherboards uses the Line In 2 as the input for front panel mic (mic 2) */ 1144 /* Note: PASD motherboards uses the Line In 2 as the input for front panel mic (mic 2) */
931 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03*/ 1145 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03*/
932 /* unmute CD */ 1146 /* unmute CD */
933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 1147 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
934 /* unmute Line In */ 1148 /* unmute Line In */
935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 1149 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
936 /* unmute Mic 1 */ 1150 /* unmute Mic 1 */
937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1151 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
938 /* unmute Line In 2 (for PASD boards Mic 2) */ 1152 /* unmute Line In 2 (for PASD boards Mic 2) */
939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 1153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
1154
1155 { }
1156};
1157
1158//pshou 05/24/05
1159static struct hda_verb alc880_six_stack_init_verbs[] = {
1160 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1161 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1162 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1163 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1164 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1166 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1167 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1168 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1169
1170 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1171 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1172 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1173 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1174
1175 /* unmute amp left and right */
1176 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1177 {0x07, AC_VERB_SET_CONNECT_SEL, 0x02},
1178 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1181 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1182 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1184 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1185 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1187
1188 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) for mixer
1189 * widget(nid=0x0B) to support the input path of analog loopback
1190 */
1191 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
1192 /* unmute Line In */
1193 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
1194 /* unmute Mic 1 */
1195 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1196 /* unmute Mic 2 */
1197 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1198
1199 /* Unmute Front out path */
1200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1202 /* Unmute Surround (used as HP) out path */
1203 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1205 /* Unmute C/LFE out path */
1206 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mute */
1208 /* Unmute rear Surround out path */
1209 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1210 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1211
1212 { }
1213};
1214
1215static struct hda_verb alc880_2_jack_init_verbs[] = {
1216 /* front channel selector/amp: input 0: DAC: unmuted, (no volume selection) */
1217 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1219 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1220 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1221 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1222 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1223 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1224 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1225 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1226 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1227 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1229 {0x07, AC_VERB_SET_CONNECT_SEL, 0x02},
1230 {0x0C, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1231 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1232 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1233 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1234 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1235 {0x1B, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1236 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1238 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1239 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1240 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1241 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1242 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
940 1243
941 { } 1244 { }
942}; 1245};
943 1246
1247static struct hda_verb alc880_asus_init_verbs[] = {
1248 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
1249 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
1250 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
1251 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
1252
1253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1255 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1256 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1257 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
1258 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
1259 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
1260 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1261 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1262
1263 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
1264 /* unmute CD */
1265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
1266 /* unmute Line In */
1267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
1268 /* unmute Mic 1 */
1269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1270 /* unmute Line In 2 (for PASD boards Mic 2) */
1271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1272
1273 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
1274 /* Unmute Front out path */
1275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1277 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1278 /* Unmute Surround (used as HP) out path */
1279 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1282 /* Unmute C/LFE out path */
1283 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1284 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1285 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1286
1287 { }
1288};
1289
1290
944static int alc_init(struct hda_codec *codec) 1291static int alc_init(struct hda_codec *codec)
945{ 1292{
946 struct alc_spec *spec = codec->spec; 1293 struct alc_spec *spec = codec->spec;
@@ -1379,8 +1726,8 @@ static struct hda_verb alc880_test_init_verbs[] = {
1379 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1726 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1380 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1727 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1381 /* Set input pins 0x18-0x1c */ 1728 /* Set input pins 0x18-0x1c */
1382 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 1729 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1383 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 1730 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1384 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1731 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1386 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1733 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -1447,6 +1794,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1447 1794
1448 /* Back 3 jack, front 2 jack (Internal add Aux-In) */ 1795 /* Back 3 jack, front 2 jack (Internal add Aux-In) */
1449 { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST }, 1796 { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST },
1797 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST },
1450 1798
1451 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ 1799 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */
1452 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, 1800 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG },
@@ -1463,6 +1811,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1463 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4039, .config = ALC880_5ST }, 1811 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4039, .config = ALC880_5ST },
1464 { .pci_subvendor = 0x107b, .pci_subdevice = 0x3032, .config = ALC880_5ST }, 1812 { .pci_subvendor = 0x107b, .pci_subdevice = 0x3032, .config = ALC880_5ST },
1465 { .pci_subvendor = 0x103c, .pci_subdevice = 0x2a09, .config = ALC880_5ST }, 1813 { .pci_subvendor = 0x103c, .pci_subdevice = 0x2a09, .config = ALC880_5ST },
1814 { .pci_subvendor = 0x1043, .pci_subdevice = 0x814e, .config = ALC880_5ST },
1466 1815
1467 /* Back 5 jack plus 1 SPDIF out jack, front 2 jack */ 1816 /* Back 5 jack plus 1 SPDIF out jack, front 2 jack */
1468 { .modelname = "5stack-digout", .config = ALC880_5ST_DIG }, 1817 { .modelname = "5stack-digout", .config = ALC880_5ST_DIG },
@@ -1474,6 +1823,10 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1474 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd401, .config = ALC880_5ST_DIG }, 1823 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd401, .config = ALC880_5ST_DIG },
1475 { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG }, 1824 { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG },
1476 { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG }, 1825 { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG },
1826 { .pci_subvendor = 0x1019, .pci_subdevice = 0xa880, .config = ALC880_5ST_DIG },
1827 { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG },
1828 { .pci_subvendor = 0x1695, .pci_subdevice = 0x400d, .config = ALC880_5ST_DIG },
1829 { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG },
1477 1830
1478 { .modelname = "w810", .config = ALC880_W810 }, 1831 { .modelname = "w810", .config = ALC880_W810 },
1479 { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 }, 1832 { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 },
@@ -1481,6 +1834,30 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1481 { .modelname = "z71v", .config = ALC880_Z71V }, 1834 { .modelname = "z71v", .config = ALC880_Z71V },
1482 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V }, 1835 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V },
1483 1836
1837 { .modelname = "6statack-digout", .config = ALC880_6ST_DIG },
1838 { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG },
1839 { .pci_subvendor = 0x8086, .pci_subdevice = 0x2668, .config = ALC880_6ST_DIG },
1840 { .pci_subvendor = 0x1462, .pci_subdevice = 0x1150, .config = ALC880_6ST_DIG },
1841 { .pci_subvendor = 0xe803, .pci_subdevice = 0x1019, .config = ALC880_6ST_DIG },
1842
1843 { .modelname = "asua", .config = ALC880_ASUS },
1844 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_ASUS_DIG },
1845 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG },
1846 { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG },
1847 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG },
1848 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS },
1849 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG },
1850 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS },
1851 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1123, .config = ALC880_ASUS_DIG },
1852 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1143, .config = ALC880_ASUS },
1853 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10b3, .config = ALC880_ASUS_W1V },
1854
1855 { .modelname = "uniwill", .config = ALC880_UNIWILL_DIG },
1856 { .pci_subvendor = 0x1584, .pci_subdevice = 0x9050, .config = ALC880_UNIWILL_DIG },
1857
1858 { .modelname = "F1734", .config = ALC880_F1734 },
1859 { .pci_subvendor = 0x1734, .pci_subdevice = 0x107c, .config = ALC880_F1734 },
1860
1484#ifdef CONFIG_SND_DEBUG 1861#ifdef CONFIG_SND_DEBUG
1485 { .modelname = "test", .config = ALC880_TEST }, 1862 { .modelname = "test", .config = ALC880_TEST },
1486#endif 1863#endif
@@ -1488,10 +1865,207 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1488 {} 1865 {}
1489}; 1866};
1490 1867
1868/*
1869 * configuration template - to be copied to the spec instance
1870 */
1871struct alc_config_preset {
1872 snd_kcontrol_new_t *mixers;
1873 unsigned int front_panel: 1; /* optional */
1874 unsigned int gpio_payload; /* optional */
1875 struct hda_verb *init_verbs;
1876 unsigned int num_dacs;
1877 hda_nid_t *dac_nids;
1878 hda_nid_t dig_out_nid; /* optional */
1879 hda_nid_t hp_nid; /* optional */
1880 unsigned int num_adc_nids;
1881 hda_nid_t *adc_nids;
1882 unsigned int num_channel_mode;
1883 const struct alc_channel_mode *channel_mode;
1884 const struct hda_input_mux *input_mux;
1885};
1886
1887static struct alc_config_preset alc880_presets[] = {
1888 [ALC880_3ST] = {
1889 .mixers = alc880_base_mixer,
1890 .init_verbs = alc880_init_verbs_three_stack,
1891 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1892 .front_panel = 1,
1893 .dac_nids = alc880_dac_nids,
1894 .hp_nid = 0x03,
1895 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
1896 .adc_nids = alc880_adc_nids,
1897 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
1898 .channel_mode = alc880_threestack_modes,
1899 .input_mux = &alc880_capture_source,
1900 },
1901 [ALC880_3ST_DIG] = {
1902 .mixers = alc880_base_mixer,
1903 .init_verbs = alc880_init_verbs_three_stack,
1904 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1905 .front_panel = 1,
1906 .dac_nids = alc880_dac_nids,
1907 .dig_out_nid = ALC880_DIGOUT_NID,
1908 .hp_nid = 0x03,
1909 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
1910 .adc_nids = alc880_adc_nids,
1911 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
1912 .channel_mode = alc880_threestack_modes,
1913 .input_mux = &alc880_capture_source,
1914 },
1915 [ALC880_5ST] = {
1916 .mixers = alc880_five_stack_mixer,
1917 .init_verbs = alc880_init_verbs_five_stack,
1918 .front_panel = 1,
1919 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1920 .dac_nids = alc880_dac_nids,
1921 .hp_nid = 0x03,
1922 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
1923 .adc_nids = alc880_adc_nids,
1924 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
1925 .channel_mode = alc880_fivestack_modes,
1926 .input_mux = &alc880_capture_source,
1927 },
1928 [ALC880_5ST_DIG] = {
1929 .mixers = alc880_five_stack_mixer,
1930 .init_verbs = alc880_init_verbs_five_stack,
1931 .front_panel = 1,
1932 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1933 .dac_nids = alc880_dac_nids,
1934 .dig_out_nid = ALC880_DIGOUT_NID,
1935 .hp_nid = 0x03,
1936 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
1937 .adc_nids = alc880_adc_nids,
1938 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
1939 .channel_mode = alc880_fivestack_modes,
1940 .input_mux = &alc880_capture_source,
1941 },
1942 [ALC880_6ST_DIG] = {
1943 .mixers = alc880_six_stack_mixer,
1944 .init_verbs = alc880_six_stack_init_verbs,
1945 .front_panel = 1,
1946 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
1947 .dac_nids = alc880_6st_dac_nids,
1948 .dig_out_nid = ALC880_DIGOUT_NID,
1949 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
1950 .adc_nids = alc880_adc_nids,
1951 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
1952 .channel_mode = alc880_sixstack_modes,
1953 .input_mux = &alc880_6stack_capture_source,
1954 },
1955 [ALC880_W810] = {
1956 .mixers = alc880_w810_base_mixer,
1957 .init_verbs = alc880_w810_init_verbs,
1958 .gpio_payload = 0x2,
1959 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
1960 .dac_nids = alc880_w810_dac_nids,
1961 .dig_out_nid = ALC880_DIGOUT_NID,
1962 // No dedicated headphone socket - it's shared with built-in speakers.
1963 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
1964 .adc_nids = alc880_adc_nids,
1965 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
1966 .channel_mode = alc880_w810_modes,
1967 .input_mux = &alc880_capture_source,
1968 },
1969 [ALC880_Z71V] = {
1970 .mixers = alc880_z71v_mixer,
1971 .init_verbs = alc880_z71v_init_verbs,
1972 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
1973 .dac_nids = alc880_z71v_dac_nids,
1974 .dig_out_nid = ALC880_DIGOUT_NID,
1975 .hp_nid = 0x03,
1976 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
1977 .adc_nids = alc880_adc_nids,
1978 .num_channel_mode = ARRAY_SIZE(alc880_z71v_modes),
1979 .channel_mode = alc880_z71v_modes,
1980 .input_mux = &alc880_capture_source,
1981 },
1982 [ALC880_F1734] = {
1983 .mixers = alc880_2_jack_mixer,
1984 .init_verbs = alc880_2_jack_init_verbs,
1985 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1986 .dac_nids = alc880_dac_nids,
1987 .hp_nid = 0x03,
1988 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
1989 .adc_nids = alc880_adc_nids,
1990 .num_channel_mode = ARRAY_SIZE(alc880_z71v_modes),
1991 .channel_mode = alc880_z71v_modes,
1992 .input_mux = &alc880_capture_source,
1993 },
1994 [ALC880_ASUS] = {
1995 .mixers = alc880_asus_mixer,
1996 .init_verbs = alc880_asus_init_verbs,
1997 .gpio_payload = 0x1,
1998 .front_panel = 1,
1999 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2000 .dac_nids = alc880_w810_dac_nids,
2001 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
2002 .adc_nids = alc880_adc_nids,
2003 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2004 .channel_mode = alc880_threestack_modes,
2005 .input_mux = &alc880_capture_source,
2006 },
2007 [ALC880_ASUS_DIG] = {
2008 .mixers = alc880_asus_mixer,
2009 .init_verbs = alc880_asus_init_verbs,
2010 .gpio_payload = 0x1,
2011 .front_panel = 1,
2012 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2013 .dac_nids = alc880_w810_dac_nids,
2014 .dig_out_nid = ALC880_DIGOUT_NID,
2015 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
2016 .adc_nids = alc880_adc_nids,
2017 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2018 .channel_mode = alc880_threestack_modes,
2019 .input_mux = &alc880_capture_source,
2020 },
2021 [ALC880_ASUS_W1V] = {
2022 .mixers = alc880_asus_w1v_mixer,
2023 .init_verbs = alc880_asus_init_verbs,
2024 .gpio_payload = 0x1,
2025 .front_panel = 1,
2026 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
2027 .dac_nids = alc880_w810_dac_nids,
2028 .dig_out_nid = ALC880_DIGOUT_NID,
2029 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
2030 .adc_nids = alc880_adc_nids,
2031 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2032 .channel_mode = alc880_threestack_modes,
2033 .input_mux = &alc880_capture_source,
2034 },
2035 [ALC880_UNIWILL_DIG] = {
2036 .mixers = alc880_asus_mixer,
2037 .init_verbs = alc880_asus_init_verbs,
2038 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
2039 .dac_nids = alc880_dac_nids,
2040 .dig_out_nid = ALC880_DIGOUT_NID,
2041 .hp_nid = 0x03,
2042 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
2043 .adc_nids = alc880_adc_nids,
2044 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2045 .channel_mode = alc880_threestack_modes,
2046 .input_mux = &alc880_capture_source,
2047 },
2048#ifdef CONFIG_SND_DEBUG
2049 [ALC880_TEST] = {
2050 .mixers = alc880_test_mixer,
2051 .init_verbs = alc880_test_init_verbs,
2052 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
2053 .dac_nids = alc880_test_dac_nids,
2054 .dig_out_nid = ALC880_DIGOUT_NID,
2055 .num_adc_nids = ARRAY_SIZE(alc880_adc_nids),
2056 .adc_nids = alc880_adc_nids,
2057 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
2058 .channel_mode = alc880_test_modes,
2059 .input_mux = &alc880_test_capture_source,
2060 },
2061#endif
2062};
2063
1491static int patch_alc880(struct hda_codec *codec) 2064static int patch_alc880(struct hda_codec *codec)
1492{ 2065{
1493 struct alc_spec *spec; 2066 struct alc_spec *spec;
1494 int board_config; 2067 int board_config;
2068 const struct alc_config_preset *preset;
1495 2069
1496 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 2070 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
1497 if (spec == NULL) 2071 if (spec == NULL)
@@ -1501,91 +2075,31 @@ static int patch_alc880(struct hda_codec *codec)
1501 codec->spec = spec; 2075 codec->spec = spec;
1502 2076
1503 board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl); 2077 board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl);
1504 if (board_config < 0) { 2078 if (board_config < 0 || board_config >= ALC880_MODEL_LAST) {
1505 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC880\n"); 2079 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC880\n");
1506 board_config = ALC880_MINIMAL; 2080 board_config = ALC880_3ST;
1507 } 2081 }
2082 preset = &alc880_presets[board_config];
1508 2083
1509 switch (board_config) { 2084 spec->mixers[spec->num_mixers] = preset->mixers;
1510 case ALC880_W810: 2085 snd_assert(spec->mixers[0], kfree(spec);return -EINVAL);
1511 spec->mixers[spec->num_mixers] = alc880_w810_base_mixer; 2086 spec->num_mixers++;
1512 spec->num_mixers++;
1513 break;
1514 case ALC880_5ST:
1515 case ALC880_5ST_DIG:
1516 spec->mixers[spec->num_mixers] = alc880_five_stack_mixer;
1517 spec->num_mixers++;
1518 break;
1519 case ALC880_Z71V:
1520 spec->mixers[spec->num_mixers] = alc880_z71v_mixer;
1521 spec->num_mixers++;
1522 break;
1523#ifdef CONFIG_SND_DEBUG
1524 case ALC880_TEST:
1525 spec->mixers[spec->num_mixers] = alc880_test_mixer;
1526 spec->num_mixers++;
1527 break;
1528#endif
1529 default:
1530 spec->mixers[spec->num_mixers] = alc880_base_mixer;
1531 spec->num_mixers++;
1532 break;
1533 }
1534
1535 switch (board_config) {
1536 case ALC880_3ST_DIG:
1537 case ALC880_5ST_DIG:
1538 case ALC880_W810:
1539 case ALC880_Z71V:
1540 case ALC880_TEST:
1541 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
1542 break;
1543 default:
1544 break;
1545 }
1546 2087
1547 switch (board_config) { 2088 /* some MBs need GPIO setup */
1548 case ALC880_3ST: 2089 if (preset->gpio_payload) {
1549 case ALC880_3ST_DIG: 2090 /* Enable mask and set output */
1550 case ALC880_5ST: 2091 snd_hda_codec_write(codec, codec->afg, 0,
1551 case ALC880_5ST_DIG: 2092 AC_VERB_SET_GPIO_MASK, preset->gpio_payload);
1552 case ALC880_W810: 2093 snd_hda_codec_write(codec, codec->afg, 0,
1553 spec->front_panel = 1; 2094 AC_VERB_SET_GPIO_DIRECTION, preset->gpio_payload);
1554 break; 2095 snd_hda_codec_write(codec, codec->afg, 0,
1555 default: 2096 AC_VERB_SET_GPIO_DATA, preset->gpio_payload);
1556 break;
1557 } 2097 }
1558 2098
1559 switch (board_config) { 2099 spec->front_panel = preset->front_panel;
1560 case ALC880_5ST: 2100 spec->init_verbs = preset->init_verbs;
1561 case ALC880_5ST_DIG: 2101 spec->channel_mode = preset->channel_mode;
1562 spec->init_verbs = alc880_init_verbs_five_stack; 2102 spec->num_channel_mode = preset->num_channel_mode;
1563 spec->channel_mode = alc880_fivestack_modes;
1564 spec->num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes);
1565 break;
1566 case ALC880_W810:
1567 spec->init_verbs = alc880_w810_init_verbs;
1568 spec->channel_mode = alc880_w810_modes;
1569 spec->num_channel_mode = ARRAY_SIZE(alc880_w810_modes);
1570 break;
1571 case ALC880_Z71V:
1572 spec->init_verbs = alc880_z71v_init_verbs;
1573 spec->channel_mode = alc880_z71v_modes;
1574 spec->num_channel_mode = ARRAY_SIZE(alc880_z71v_modes);
1575 break;
1576#ifdef CONFIG_SND_DEBUG
1577 case ALC880_TEST:
1578 spec->init_verbs = alc880_test_init_verbs;
1579 spec->channel_mode = alc880_test_modes;
1580 spec->num_channel_mode = ARRAY_SIZE(alc880_test_modes);
1581 break;
1582#endif
1583 default:
1584 spec->init_verbs = alc880_init_verbs_three_stack;
1585 spec->channel_mode = alc880_threestack_modes;
1586 spec->num_channel_mode = ARRAY_SIZE(alc880_threestack_modes);
1587 break;
1588 }
1589 2103
1590 spec->stream_name_analog = "ALC880 Analog"; 2104 spec->stream_name_analog = "ALC880 Analog";
1591 spec->stream_analog_playback = &alc880_pcm_analog_playback; 2105 spec->stream_analog_playback = &alc880_pcm_analog_playback;
@@ -1597,35 +2111,14 @@ static int patch_alc880(struct hda_codec *codec)
1597 2111
1598 spec->multiout.max_channels = spec->channel_mode[0].channels; 2112 spec->multiout.max_channels = spec->channel_mode[0].channels;
1599 2113
1600 switch (board_config) { 2114 spec->multiout.num_dacs = preset->num_dacs;
1601 case ALC880_W810: 2115 spec->multiout.dac_nids = preset->adc_nids;
1602 spec->multiout.num_dacs = ARRAY_SIZE(alc880_w810_dac_nids); 2116 spec->multiout.dig_out_nid = preset->dig_out_nid;
1603 spec->multiout.dac_nids = alc880_w810_dac_nids; 2117 spec->multiout.hp_nid = preset->hp_nid;
1604 // No dedicated headphone socket - it's shared with built-in speakers.
1605 break;
1606 case ALC880_Z71V:
1607 spec->multiout.num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids);
1608 spec->multiout.dac_nids = alc880_z71v_dac_nids;
1609 spec->multiout.hp_nid = 0x03;
1610 break;
1611#ifdef CONFIG_SND_DEBUG
1612 case ALC880_TEST:
1613 spec->multiout.num_dacs = ARRAY_SIZE(alc880_test_dac_nids);
1614 spec->multiout.dac_nids = alc880_test_dac_nids;
1615 spec->input_mux = &alc880_test_capture_source;
1616 break;
1617#endif
1618 default:
1619 spec->multiout.num_dacs = ARRAY_SIZE(alc880_dac_nids);
1620 spec->multiout.dac_nids = alc880_dac_nids;
1621 spec->multiout.hp_nid = 0x03; /* rear-surround NID */
1622 break;
1623 }
1624 2118
1625 if (! spec->input_mux) 2119 spec->input_mux = preset->input_mux;
1626 spec->input_mux = &alc880_capture_source; 2120 spec->num_adc_nids = preset->num_adc_nids;
1627 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); 2121 spec->adc_nids = preset->adc_nids;
1628 spec->adc_nids = alc880_adc_nids;
1629 2122
1630 codec->patch_ops = alc_patch_ops; 2123 codec->patch_ops = alc_patch_ops;
1631 2124
@@ -1675,15 +2168,42 @@ snd_kcontrol_new_t alc260_base_mixer[] = {
1675 { } /* end */ 2168 { } /* end */
1676}; 2169};
1677 2170
2171snd_kcontrol_new_t alc260_hp_mixer[] = {
2172 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
2173 ALC_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
2174 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
2175 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
2176 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
2177 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
2178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
2179 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
2180 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
2181 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
2182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
2183 ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
2184 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
2185 ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_OUTPUT),
2186 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
2187 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
2188 {
2189 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2190 .name = "Capture Source",
2191 .info = alc_mux_enum_info,
2192 .get = alc_mux_enum_get,
2193 .put = alc_mux_enum_put,
2194 },
2195 { } /* end */
2196};
2197
1678static struct hda_verb alc260_init_verbs[] = { 2198static struct hda_verb alc260_init_verbs[] = {
1679 /* Line In pin widget for input */ 2199 /* Line In pin widget for input */
1680 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1681 /* CD pin widget for input */ 2201 /* CD pin widget for input */
1682 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2202 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1683 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 2203 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1684 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 2204 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1685 /* Mic2 (front panel) pin widget for input and vref at 80% */ 2205 /* Mic2 (front panel) pin widget for input and vref at 80% */
1686 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 2206 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1687 /* LINE-2 is used for line-out in rear */ 2207 /* LINE-2 is used for line-out in rear */
1688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1689 /* select line-out */ 2209 /* select line-out */
@@ -1695,9 +2215,13 @@ static struct hda_verb alc260_init_verbs[] = {
1695 /* enable Mono */ 2215 /* enable Mono */
1696 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2216 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1697 /* mute capture amp left and right */ 2217 /* mute capture amp left and right */
1698 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2218 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1699 /* set connection select to line in (default select for this ADC) */ 2219 /* set connection select to line in (default select for this ADC) */
1700 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, 2220 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
2221 /* mute capture amp left and right */
2222 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2223 /* set connection select to line in (default select for this ADC) */
2224 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
1701 /* set vol=0 Line-Out mixer amp left and right */ 2225 /* set vol=0 Line-Out mixer amp left and right */
1702 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 2226 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1703 /* unmute pin widget amp left and right (no gain on this amp) */ 2227 /* unmute pin widget amp left and right (no gain on this amp) */
@@ -1714,11 +2238,11 @@ static struct hda_verb alc260_init_verbs[] = {
1714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1715 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ 2239 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
1716 /* mute CD */ 2240 /* mute CD */
1717 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 2241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
1718 /* mute Line In */ 2242 /* mute Line In */
1719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 2243 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
1720 /* mute Mic */ 2244 /* mute Mic */
1721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2245 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1722 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ 2246 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
1723 /* mute Front out path */ 2247 /* mute Front out path */
1724 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2248 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -1746,9 +2270,16 @@ static struct hda_pcm_stream alc260_pcm_analog_capture = {
1746 .nid = 0x4, 2270 .nid = 0x4,
1747}; 2271};
1748 2272
2273static struct hda_board_config alc260_cfg_tbl[] = {
2274 { .modelname = "hp", .config = ALC260_HP },
2275 { .pci_subvendor = 0x103c, .config = ALC260_HP },
2276 {}
2277};
2278
1749static int patch_alc260(struct hda_codec *codec) 2279static int patch_alc260(struct hda_codec *codec)
1750{ 2280{
1751 struct alc_spec *spec; 2281 struct alc_spec *spec;
2282 int board_config;
1752 2283
1753 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 2284 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
1754 if (spec == NULL) 2285 if (spec == NULL)
@@ -1757,8 +2288,22 @@ static int patch_alc260(struct hda_codec *codec)
1757 init_MUTEX(&spec->bind_mutex); 2288 init_MUTEX(&spec->bind_mutex);
1758 codec->spec = spec; 2289 codec->spec = spec;
1759 2290
1760 spec->mixers[spec->num_mixers] = alc260_base_mixer; 2291 board_config = snd_hda_check_board_config(codec, alc260_cfg_tbl);
1761 spec->num_mixers++; 2292 if (board_config < 0 || board_config >= ALC260_MODEL_LAST) {
2293 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260\n");
2294 board_config = ALC260_BASIC;
2295 }
2296
2297 switch (board_config) {
2298 case ALC260_HP:
2299 spec->mixers[spec->num_mixers] = alc260_base_mixer;
2300 spec->num_mixers++;
2301 break;
2302 default:
2303 spec->mixers[spec->num_mixers] = alc260_base_mixer;
2304 spec->num_mixers++;
2305 break;
2306 }
1762 2307
1763 spec->init_verbs = alc260_init_verbs; 2308 spec->init_verbs = alc260_init_verbs;
1764 spec->channel_mode = alc260_modes; 2309 spec->channel_mode = alc260_modes;
@@ -1773,8 +2318,17 @@ static int patch_alc260(struct hda_codec *codec)
1773 spec->multiout.dac_nids = alc260_dac_nids; 2318 spec->multiout.dac_nids = alc260_dac_nids;
1774 2319
1775 spec->input_mux = &alc260_capture_source; 2320 spec->input_mux = &alc260_capture_source;
1776 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); 2321 switch (board_config) {
1777 spec->adc_nids = alc260_adc_nids; 2322 case ALC260_HP:
2323 spec->stream_analog_capture->nid = 5;
2324 spec->num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids);
2325 spec->adc_nids = alc260_hp_adc_nids;
2326 break;
2327 default:
2328 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
2329 spec->adc_nids = alc260_adc_nids;
2330 break;
2331 }
1778 2332
1779 codec->patch_ops = alc_patch_ops; 2333 codec->patch_ops = alc_patch_ops;
1780 2334
@@ -1940,9 +2494,9 @@ static struct hda_verb alc882_init_verbs[] = {
1940 /* select Front mixer (0x0c, index 0) */ 2494 /* select Front mixer (0x0c, index 0) */
1941 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 2495 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1942 /* Mic (rear) pin widget for input and vref at 80% */ 2496 /* Mic (rear) pin widget for input and vref at 80% */
1943 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 2497 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1944 /* Front Mic pin widget for input and vref at 80% */ 2498 /* Front Mic pin widget for input and vref at 80% */
1945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF}, 2499 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1946 /* Line In pin widget for input */ 2500 /* Line In pin widget for input */
1947 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1948 /* CD pin widget for input */ 2502 /* CD pin widget for input */