]> git.karo-electronics.de Git - karo-tx-linux.git/blob - sound/pci/hda/alc880_quirks.c
ALSA: hda/realtek - Replace ALC880 model=tcl with auto-parser
[karo-tx-linux.git] / sound / pci / hda / alc880_quirks.c
1 /*
2  * ALC880 quirk models
3  * included by patch_realtek.c
4  */
5
6 /* ALC880 board config type */
7 enum {
8         ALC880_AUTO,
9         ALC880_3ST,
10         ALC880_3ST_DIG,
11         ALC880_5ST,
12         ALC880_5ST_DIG,
13         ALC880_Z71V,
14         ALC880_6ST,
15         ALC880_6ST_DIG,
16         ALC880_F1734,
17         ALC880_ASUS,
18         ALC880_ASUS_DIG,
19         ALC880_ASUS_W1V,
20         ALC880_ASUS_DIG2,
21         ALC880_FUJITSU,
22         ALC880_UNIWILL_DIG,
23         ALC880_UNIWILL,
24         ALC880_UNIWILL_P53,
25 #ifdef CONFIG_SND_DEBUG
26         ALC880_TEST,
27 #endif
28         ALC880_MODEL_LAST /* last tag */
29 };
30
31 /*
32  * ALC880 3-stack model
33  *
34  * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
35  * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
36  *                 F-Mic = 0x1b, HP = 0x19
37  */
38
39 static const hda_nid_t alc880_dac_nids[4] = {
40         /* front, rear, clfe, rear_surr */
41         0x02, 0x05, 0x04, 0x03
42 };
43
44 static const hda_nid_t alc880_adc_nids[3] = {
45         /* ADC0-2 */
46         0x07, 0x08, 0x09,
47 };
48
49 /* The datasheet says the node 0x07 is connected from inputs,
50  * but it shows zero connection in the real implementation on some devices.
51  * Note: this is a 915GAV bug, fixed on 915GLV
52  */
53 static const hda_nid_t alc880_adc_nids_alt[2] = {
54         /* ADC1-2 */
55         0x08, 0x09,
56 };
57
58 #define ALC880_DIGOUT_NID       0x06
59 #define ALC880_DIGIN_NID        0x0a
60 #define ALC880_PIN_CD_NID       0x1c
61
62 static const struct hda_input_mux alc880_capture_source = {
63         .num_items = 4,
64         .items = {
65                 { "Mic", 0x0 },
66                 { "Front Mic", 0x3 },
67                 { "Line", 0x2 },
68                 { "CD", 0x4 },
69         },
70 };
71
72 /* channel source setting (2/6 channel selection for 3-stack) */
73 /* 2ch mode */
74 static const struct hda_verb alc880_threestack_ch2_init[] = {
75         /* set line-in to input, mute it */
76         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
77         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
78         /* set mic-in to input vref 80%, mute it */
79         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
80         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
81         { } /* end */
82 };
83
84 /* 6ch mode */
85 static const struct hda_verb alc880_threestack_ch6_init[] = {
86         /* set line-in to output, unmute it */
87         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
88         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
89         /* set mic-in to output, unmute it */
90         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
91         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
92         { } /* end */
93 };
94
95 static const struct hda_channel_mode alc880_threestack_modes[2] = {
96         { 2, alc880_threestack_ch2_init },
97         { 6, alc880_threestack_ch6_init },
98 };
99
100 static const struct snd_kcontrol_new alc880_three_stack_mixer[] = {
101         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
102         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
103         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
104         HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
105         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
106         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
107         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
108         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
109         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
110         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
111         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
112         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
113         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
114         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
115         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
116         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
117         HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
118         {
119                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
120                 .name = "Channel Mode",
121                 .info = alc_ch_mode_info,
122                 .get = alc_ch_mode_get,
123                 .put = alc_ch_mode_put,
124         },
125         { } /* end */
126 };
127
128 /*
129  * ALC880 5-stack model
130  *
131  * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
132  *      Side = 0x02 (0xd)
133  * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
134  *                 Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
135  */
136
137 /* additional mixers to alc880_three_stack_mixer */
138 static const struct snd_kcontrol_new alc880_five_stack_mixer[] = {
139         HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
140         HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
141         { } /* end */
142 };
143
144 /* channel source setting (6/8 channel selection for 5-stack) */
145 /* 6ch mode */
146 static const struct hda_verb alc880_fivestack_ch6_init[] = {
147         /* set line-in to input, mute it */
148         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
149         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
150         { } /* end */
151 };
152
153 /* 8ch mode */
154 static const struct hda_verb alc880_fivestack_ch8_init[] = {
155         /* set line-in to output, unmute it */
156         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
157         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
158         { } /* end */
159 };
160
161 static const struct hda_channel_mode alc880_fivestack_modes[2] = {
162         { 6, alc880_fivestack_ch6_init },
163         { 8, alc880_fivestack_ch8_init },
164 };
165
166
167 /*
168  * ALC880 6-stack model
169  *
170  * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
171  *      Side = 0x05 (0x0f)
172  * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
173  *   Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
174  */
175
176 static const hda_nid_t alc880_6st_dac_nids[4] = {
177         /* front, rear, clfe, rear_surr */
178         0x02, 0x03, 0x04, 0x05
179 };
180
181 static const struct hda_input_mux alc880_6stack_capture_source = {
182         .num_items = 4,
183         .items = {
184                 { "Mic", 0x0 },
185                 { "Front Mic", 0x1 },
186                 { "Line", 0x2 },
187                 { "CD", 0x4 },
188         },
189 };
190
191 /* fixed 8-channels */
192 static const struct hda_channel_mode alc880_sixstack_modes[1] = {
193         { 8, NULL },
194 };
195
196 static const struct snd_kcontrol_new alc880_six_stack_mixer[] = {
197         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
198         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
199         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
200         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
201         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
202         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
203         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
204         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
205         HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
206         HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
207         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
208         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
209         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
210         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
211         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
212         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
213         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
214         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
215         {
216                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
217                 .name = "Channel Mode",
218                 .info = alc_ch_mode_info,
219                 .get = alc_ch_mode_get,
220                 .put = alc_ch_mode_put,
221         },
222         { } /* end */
223 };
224
225
226 static const hda_nid_t alc880_w810_dac_nids[3] = {
227         /* front, rear/surround, clfe */
228         0x02, 0x03, 0x04
229 };
230
231 /*
232  * Z710V model
233  *
234  * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
235  * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
236  *                 Line = 0x1a
237  */
238
239 static const hda_nid_t alc880_z71v_dac_nids[1] = {
240         0x02
241 };
242 #define ALC880_Z71V_HP_DAC      0x03
243
244 /* fixed 2 channels */
245 static const struct hda_channel_mode alc880_2_jack_modes[1] = {
246         { 2, NULL }
247 };
248
249 static const struct snd_kcontrol_new alc880_z71v_mixer[] = {
250         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
251         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
252         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
253         HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
254         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
255         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
256         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
257         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
258         { } /* end */
259 };
260
261
262 /*
263  * ALC880 F1734 model
264  *
265  * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
266  * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
267  */
268
269 static const hda_nid_t alc880_f1734_dac_nids[1] = {
270         0x03
271 };
272 #define ALC880_F1734_HP_DAC     0x02
273
274 static const struct snd_kcontrol_new alc880_f1734_mixer[] = {
275         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
276         HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
277         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
278         HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
279         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
280         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
281         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
282         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
283         { } /* end */
284 };
285
286 static const struct hda_input_mux alc880_f1734_capture_source = {
287         .num_items = 2,
288         .items = {
289                 { "Mic", 0x1 },
290                 { "CD", 0x4 },
291         },
292 };
293
294
295 /*
296  * ALC880 ASUS model
297  *
298  * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
299  * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
300  *  Mic = 0x18, Line = 0x1a
301  */
302
303 #define alc880_asus_dac_nids    alc880_w810_dac_nids    /* identical with w810 */
304 #define alc880_asus_modes       alc880_threestack_modes /* 2/6 channel mode */
305
306 static const struct snd_kcontrol_new alc880_asus_mixer[] = {
307         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
308         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
309         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
310         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
311         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
312         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
313         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
314         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
315         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
316         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
317         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
318         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
319         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
320         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
321         {
322                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
323                 .name = "Channel Mode",
324                 .info = alc_ch_mode_info,
325                 .get = alc_ch_mode_get,
326                 .put = alc_ch_mode_put,
327         },
328         { } /* end */
329 };
330
331 /*
332  * ALC880 ASUS W1V model
333  *
334  * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
335  * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
336  *  Mic = 0x18, Line = 0x1a, Line2 = 0x1b
337  */
338
339 /* additional mixers to alc880_asus_mixer */
340 static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
341         HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
342         HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
343         { } /* end */
344 };
345
346 /* Uniwill */
347 static const struct snd_kcontrol_new alc880_uniwill_mixer[] = {
348         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
349         HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
350         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
351         HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
352         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
353         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
354         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
355         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
356         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
357         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
358         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
359         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
360         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
361         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
362         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
363         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
364         {
365                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
366                 .name = "Channel Mode",
367                 .info = alc_ch_mode_info,
368                 .get = alc_ch_mode_get,
369                 .put = alc_ch_mode_put,
370         },
371         { } /* end */
372 };
373
374 static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
375         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
376         HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
377         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
378         HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
379         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
380         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
381         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
382         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
383         HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
384         HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
385         { } /* end */
386 };
387
388 static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
389         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
390         HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
391         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
392         HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
393         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
394         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
395         { } /* end */
396 };
397
398 /*
399  * initialize the codec volumes, etc
400  */
401
402 /*
403  * generic initialization of ADC, input mixers and output mixers
404  */
405 static const struct hda_verb alc880_volume_init_verbs[] = {
406         /*
407          * Unmute ADC0-2 and set the default input to mic-in
408          */
409         {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
410         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
411         {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
412         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
413         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
414         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
415
416         /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
417          * mixer widget
418          * Note: PASD motherboards uses the Line In 2 as the input for front
419          * panel mic (mic 2)
420          */
421         /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
422         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
423         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
424         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
425         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
426         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
427         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
428         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
429
430         /*
431          * Set up output mixers (0x0c - 0x0f)
432          */
433         /* set vol=0 to output mixers */
434         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
435         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
436         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
437         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
438         /* set up input amps for analog loopback */
439         /* Amp Indices: DAC = 0, mixer = 1 */
440         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
441         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
442         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
443         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
444         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
445         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
446         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
447         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
448
449         { }
450 };
451
452 /*
453  * 3-stack pin configuration:
454  * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
455  */
456 static const struct hda_verb alc880_pin_3stack_init_verbs[] = {
457         /*
458          * preset connection lists of input pins
459          * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
460          */
461         {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
462         {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
463         {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
464
465         /*
466          * Set pin mode and muting
467          */
468         /* set front pin widgets 0x14 for output */
469         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
470         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
471         /* Mic1 (rear panel) pin widget for input and vref at 80% */
472         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
473         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
474         /* Mic2 (as headphone out) for HP output */
475         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
476         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
477         /* Line In pin widget for input */
478         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
479         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
480         /* Line2 (as front mic) pin widget for input and vref at 80% */
481         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
482         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
483         /* CD pin widget for input */
484         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
485
486         { }
487 };
488
489 /*
490  * 5-stack pin configuration:
491  * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
492  * line-in/side = 0x1a, f-mic = 0x1b
493  */
494 static const struct hda_verb alc880_pin_5stack_init_verbs[] = {
495         /*
496          * preset connection lists of input pins
497          * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
498          */
499         {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
500         {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
501
502         /*
503          * Set pin mode and muting
504          */
505         /* set pin widgets 0x14-0x17 for output */
506         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
507         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
508         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
509         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
510         /* unmute pins for output (no gain on this amp) */
511         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
512         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
513         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
514         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
515
516         /* Mic1 (rear panel) pin widget for input and vref at 80% */
517         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
518         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
519         /* Mic2 (as headphone out) for HP output */
520         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
521         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
522         /* Line In pin widget for input */
523         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
524         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
525         /* Line2 (as front mic) pin widget for input and vref at 80% */
526         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
527         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
528         /* CD pin widget for input */
529         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
530
531         { }
532 };
533
534 /*
535  * Z71V pin configuration:
536  * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
537  */
538 static const struct hda_verb alc880_pin_z71v_init_verbs[] = {
539         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
540         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
541         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
542         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
543
544         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
545         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
546         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
547         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
548
549         { }
550 };
551
552 /*
553  * 6-stack pin configuration:
554  * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
555  * f-mic = 0x19, line = 0x1a, HP = 0x1b
556  */
557 static const struct hda_verb alc880_pin_6stack_init_verbs[] = {
558         {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
559
560         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
561         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
562         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
563         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
564         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
565         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
566         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
567         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
568
569         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
570         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
571         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
572         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
573         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
574         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
575         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
576         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
577         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
578
579         { }
580 };
581
582 /*
583  * Uniwill pin configuration:
584  * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
585  * line = 0x1a
586  */
587 static const struct hda_verb alc880_uniwill_init_verbs[] = {
588         {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
589
590         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
591         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
592         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
593         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
594         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
595         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
596         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
597         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
598         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
599         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
600         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
601         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
602         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
603         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
604
605         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
606         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
607         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
608         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
609         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
610         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
611         /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
612         /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
613         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
614
615         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
616         {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT},
617
618         { }
619 };
620
621 /*
622 * Uniwill P53
623 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
624  */
625 static const struct hda_verb alc880_uniwill_p53_init_verbs[] = {
626         {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
627
628         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
629         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
630         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
631         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
632         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
633         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
634         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
635         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
636         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
637         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
638         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
639         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
640
641         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
642         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
643         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
644         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
645         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
646         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
647
648         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
649         {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_DCVOL_EVENT},
650
651         { }
652 };
653
654 static const struct hda_verb alc880_beep_init_verbs[] = {
655         { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
656         { }
657 };
658
659 static void alc880_uniwill_setup(struct hda_codec *codec)
660 {
661         struct alc_spec *spec = codec->spec;
662
663         spec->autocfg.hp_pins[0] = 0x14;
664         spec->autocfg.speaker_pins[0] = 0x15;
665         spec->autocfg.speaker_pins[0] = 0x16;
666         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
667 }
668
669 static void alc880_uniwill_init_hook(struct hda_codec *codec)
670 {
671         alc_hp_automute(codec);
672         alc88x_simple_mic_automute(codec);
673 }
674
675 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
676                                        unsigned int res)
677 {
678         /* Looks like the unsol event is incompatible with the standard
679          * definition.  4bit tag is placed at 28 bit!
680          */
681         res >>= 28;
682         switch (res) {
683         case ALC_MIC_EVENT:
684                 alc88x_simple_mic_automute(codec);
685                 break;
686         default:
687                 alc_exec_unsol_event(codec, res);
688                 break;
689         }
690 }
691
692 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
693 {
694         struct alc_spec *spec = codec->spec;
695
696         spec->autocfg.hp_pins[0] = 0x14;
697         spec->autocfg.speaker_pins[0] = 0x15;
698         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
699 }
700
701 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
702 {
703         unsigned int present;
704
705         present = snd_hda_codec_read(codec, 0x21, 0,
706                                      AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
707         present &= HDA_AMP_VOLMASK;
708         snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
709                                  HDA_AMP_VOLMASK, present);
710         snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
711                                  HDA_AMP_VOLMASK, present);
712 }
713
714 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
715                                            unsigned int res)
716 {
717         /* Looks like the unsol event is incompatible with the standard
718          * definition.  4bit tag is placed at 28 bit!
719          */
720         res >>= 28;
721         if (res == ALC_DCVOL_EVENT)
722                 alc880_uniwill_p53_dcvol_automute(codec);
723         else
724                 alc_exec_unsol_event(codec, res);
725 }
726
727 /*
728  * F1734 pin configuration:
729  * HP = 0x14, speaker-out = 0x15, mic = 0x18
730  */
731 static const struct hda_verb alc880_pin_f1734_init_verbs[] = {
732         {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
733         {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
734         {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
735         {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
736         {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
737
738         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
739         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
740         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
741         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
742
743         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
744         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
745         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
746         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
747         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
748         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
749         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
750         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
751         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
752
753         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC_HP_EVENT},
754         {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC_DCVOL_EVENT},
755
756         { }
757 };
758
759 /*
760  * ASUS pin configuration:
761  * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
762  */
763 static const struct hda_verb alc880_pin_asus_init_verbs[] = {
764         {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
765         {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
766         {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
767         {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
768
769         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
770         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
771         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
772         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
773         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
774         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
775         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
776         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
777
778         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
779         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
780         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
781         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
782         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
783         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
784         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
785         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
786         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
787
788         { }
789 };
790
791 /* Enable GPIO mask and set output */
792 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
793 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
794 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
795
796 /*
797  * Test configuration for debugging
798  *
799  * Almost all inputs/outputs are enabled.  I/O pins can be configured via
800  * enum controls.
801  */
802 #ifdef CONFIG_SND_DEBUG
803 static const hda_nid_t alc880_test_dac_nids[4] = {
804         0x02, 0x03, 0x04, 0x05
805 };
806
807 static const struct hda_input_mux alc880_test_capture_source = {
808         .num_items = 7,
809         .items = {
810                 { "In-1", 0x0 },
811                 { "In-2", 0x1 },
812                 { "In-3", 0x2 },
813                 { "In-4", 0x3 },
814                 { "CD", 0x4 },
815                 { "Front", 0x5 },
816                 { "Surround", 0x6 },
817         },
818 };
819
820 static const struct hda_channel_mode alc880_test_modes[4] = {
821         { 2, NULL },
822         { 4, NULL },
823         { 6, NULL },
824         { 8, NULL },
825 };
826
827 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
828                                  struct snd_ctl_elem_info *uinfo)
829 {
830         static const char * const texts[] = {
831                 "N/A", "Line Out", "HP Out",
832                 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
833         };
834         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
835         uinfo->count = 1;
836         uinfo->value.enumerated.items = 8;
837         if (uinfo->value.enumerated.item >= 8)
838                 uinfo->value.enumerated.item = 7;
839         strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
840         return 0;
841 }
842
843 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
844                                 struct snd_ctl_elem_value *ucontrol)
845 {
846         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
847         hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
848         unsigned int pin_ctl, item = 0;
849
850         pin_ctl = snd_hda_codec_read(codec, nid, 0,
851                                      AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
852         if (pin_ctl & AC_PINCTL_OUT_EN) {
853                 if (pin_ctl & AC_PINCTL_HP_EN)
854                         item = 2;
855                 else
856                         item = 1;
857         } else if (pin_ctl & AC_PINCTL_IN_EN) {
858                 switch (pin_ctl & AC_PINCTL_VREFEN) {
859                 case AC_PINCTL_VREF_HIZ: item = 3; break;
860                 case AC_PINCTL_VREF_50:  item = 4; break;
861                 case AC_PINCTL_VREF_GRD: item = 5; break;
862                 case AC_PINCTL_VREF_80:  item = 6; break;
863                 case AC_PINCTL_VREF_100: item = 7; break;
864                 }
865         }
866         ucontrol->value.enumerated.item[0] = item;
867         return 0;
868 }
869
870 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
871                                 struct snd_ctl_elem_value *ucontrol)
872 {
873         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
874         hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
875         static const unsigned int ctls[] = {
876                 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
877                 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
878                 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
879                 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
880                 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
881                 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
882         };
883         unsigned int old_ctl, new_ctl;
884
885         old_ctl = snd_hda_codec_read(codec, nid, 0,
886                                      AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
887         new_ctl = ctls[ucontrol->value.enumerated.item[0]];
888         if (old_ctl != new_ctl) {
889                 int val;
890                 snd_hda_codec_write_cache(codec, nid, 0,
891                                           AC_VERB_SET_PIN_WIDGET_CONTROL,
892                                           new_ctl);
893                 val = ucontrol->value.enumerated.item[0] >= 3 ?
894                         HDA_AMP_MUTE : 0;
895                 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
896                                          HDA_AMP_MUTE, val);
897                 return 1;
898         }
899         return 0;
900 }
901
902 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
903                                  struct snd_ctl_elem_info *uinfo)
904 {
905         static const char * const texts[] = {
906                 "Front", "Surround", "CLFE", "Side"
907         };
908         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
909         uinfo->count = 1;
910         uinfo->value.enumerated.items = 4;
911         if (uinfo->value.enumerated.item >= 4)
912                 uinfo->value.enumerated.item = 3;
913         strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
914         return 0;
915 }
916
917 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
918                                 struct snd_ctl_elem_value *ucontrol)
919 {
920         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
921         hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
922         unsigned int sel;
923
924         sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
925         ucontrol->value.enumerated.item[0] = sel & 3;
926         return 0;
927 }
928
929 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
930                                 struct snd_ctl_elem_value *ucontrol)
931 {
932         struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
933         hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
934         unsigned int sel;
935
936         sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
937         if (ucontrol->value.enumerated.item[0] != sel) {
938                 sel = ucontrol->value.enumerated.item[0] & 3;
939                 snd_hda_codec_write_cache(codec, nid, 0,
940                                           AC_VERB_SET_CONNECT_SEL, sel);
941                 return 1;
942         }
943         return 0;
944 }
945
946 #define PIN_CTL_TEST(xname,nid) {                       \
947                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,    \
948                         .name = xname,                 \
949                         .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
950                         .info = alc_test_pin_ctl_info, \
951                         .get = alc_test_pin_ctl_get,   \
952                         .put = alc_test_pin_ctl_put,   \
953                         .private_value = nid           \
954                         }
955
956 #define PIN_SRC_TEST(xname,nid) {                       \
957                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,    \
958                         .name = xname,                 \
959                         .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
960                         .info = alc_test_pin_src_info, \
961                         .get = alc_test_pin_src_get,   \
962                         .put = alc_test_pin_src_put,   \
963                         .private_value = nid           \
964                         }
965
966 static const struct snd_kcontrol_new alc880_test_mixer[] = {
967         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
968         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
969         HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
970         HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
971         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
972         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
973         HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
974         HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
975         PIN_CTL_TEST("Front Pin Mode", 0x14),
976         PIN_CTL_TEST("Surround Pin Mode", 0x15),
977         PIN_CTL_TEST("CLFE Pin Mode", 0x16),
978         PIN_CTL_TEST("Side Pin Mode", 0x17),
979         PIN_CTL_TEST("In-1 Pin Mode", 0x18),
980         PIN_CTL_TEST("In-2 Pin Mode", 0x19),
981         PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
982         PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
983         PIN_SRC_TEST("In-1 Pin Source", 0x18),
984         PIN_SRC_TEST("In-2 Pin Source", 0x19),
985         PIN_SRC_TEST("In-3 Pin Source", 0x1a),
986         PIN_SRC_TEST("In-4 Pin Source", 0x1b),
987         HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
988         HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
989         HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
990         HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
991         HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
992         HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
993         HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
994         HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
995         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
996         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
997         {
998                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
999                 .name = "Channel Mode",
1000                 .info = alc_ch_mode_info,
1001                 .get = alc_ch_mode_get,
1002                 .put = alc_ch_mode_put,
1003         },
1004         { } /* end */
1005 };
1006
1007 static const struct hda_verb alc880_test_init_verbs[] = {
1008         /* Unmute inputs of 0x0c - 0x0f */
1009         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1010         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1011         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1012         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1013         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1014         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1015         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1016         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1017         /* Vol output for 0x0c-0x0f */
1018         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1019         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1020         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1021         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1022         /* Set output pins 0x14-0x17 */
1023         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1024         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1025         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1026         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1027         /* Unmute output pins 0x14-0x17 */
1028         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1029         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1030         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1031         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1032         /* Set input pins 0x18-0x1c */
1033         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1034         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1035         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1036         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1037         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1038         /* Mute input pins 0x18-0x1b */
1039         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1040         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1041         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1042         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1043         /* ADC set up */
1044         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1045         {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1046         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1047         {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1048         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1049         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1050         /* Analog input/passthru */
1051         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1052         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1053         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1054         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1055         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1056         { }
1057 };
1058 #endif
1059
1060 /*
1061  */
1062
1063 static const char * const alc880_models[ALC880_MODEL_LAST] = {
1064         [ALC880_3ST]            = "3stack",
1065         [ALC880_3ST_DIG]        = "3stack-digout",
1066         [ALC880_5ST]            = "5stack",
1067         [ALC880_5ST_DIG]        = "5stack-digout",
1068         [ALC880_Z71V]           = "z71v",
1069         [ALC880_6ST]            = "6stack",
1070         [ALC880_6ST_DIG]        = "6stack-digout",
1071         [ALC880_ASUS]           = "asus",
1072         [ALC880_ASUS_W1V]       = "asus-w1v",
1073         [ALC880_ASUS_DIG]       = "asus-dig",
1074         [ALC880_ASUS_DIG2]      = "asus-dig2",
1075         [ALC880_UNIWILL_DIG]    = "uniwill",
1076         [ALC880_UNIWILL_P53]    = "uniwill-p53",
1077         [ALC880_FUJITSU]        = "fujitsu",
1078         [ALC880_F1734]          = "F1734",
1079 #ifdef CONFIG_SND_DEBUG
1080         [ALC880_TEST]           = "test",
1081 #endif
1082         [ALC880_AUTO]           = "auto",
1083 };
1084
1085 static const struct snd_pci_quirk alc880_cfg_tbl[] = {
1086         SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
1087         SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
1088         SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
1089         SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
1090         SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
1091         SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
1092         SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
1093         SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
1094         SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
1095         SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
1096         SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
1097         SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
1098         SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
1099         SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
1100         SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
1101         SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
1102         /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
1103         SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
1104         SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
1105         SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
1106         SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
1107         SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
1108         SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
1109         SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
1110         SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
1111         SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
1112         SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
1113         SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
1114         SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
1115         SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
1116         SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
1117         SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
1118         SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
1119         SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
1120         SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
1121         SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
1122         SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734),
1123         SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
1124         SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
1125         SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
1126         SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
1127         SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
1128         SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
1129         SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
1130         SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
1131         SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
1132         SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
1133         SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
1134         SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
1135         SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
1136         SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
1137         SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
1138         SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
1139         SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
1140         SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
1141         SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
1142         SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
1143         /* default Intel */
1144         SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
1145         SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
1146         SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
1147         {}
1148 };
1149
1150 /*
1151  * ALC880 codec presets
1152  */
1153 static const struct alc_config_preset alc880_presets[] = {
1154         [ALC880_3ST] = {
1155                 .mixers = { alc880_three_stack_mixer },
1156                 .init_verbs = { alc880_volume_init_verbs,
1157                                 alc880_pin_3stack_init_verbs },
1158                 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1159                 .dac_nids = alc880_dac_nids,
1160                 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
1161                 .channel_mode = alc880_threestack_modes,
1162                 .need_dac_fix = 1,
1163                 .input_mux = &alc880_capture_source,
1164         },
1165         [ALC880_3ST_DIG] = {
1166                 .mixers = { alc880_three_stack_mixer },
1167                 .init_verbs = { alc880_volume_init_verbs,
1168                                 alc880_pin_3stack_init_verbs },
1169                 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1170                 .dac_nids = alc880_dac_nids,
1171                 .dig_out_nid = ALC880_DIGOUT_NID,
1172                 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
1173                 .channel_mode = alc880_threestack_modes,
1174                 .need_dac_fix = 1,
1175                 .input_mux = &alc880_capture_source,
1176         },
1177         [ALC880_5ST] = {
1178                 .mixers = { alc880_three_stack_mixer,
1179                             alc880_five_stack_mixer},
1180                 .init_verbs = { alc880_volume_init_verbs,
1181                                 alc880_pin_5stack_init_verbs },
1182                 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1183                 .dac_nids = alc880_dac_nids,
1184                 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
1185                 .channel_mode = alc880_fivestack_modes,
1186                 .input_mux = &alc880_capture_source,
1187         },
1188         [ALC880_5ST_DIG] = {
1189                 .mixers = { alc880_three_stack_mixer,
1190                             alc880_five_stack_mixer },
1191                 .init_verbs = { alc880_volume_init_verbs,
1192                                 alc880_pin_5stack_init_verbs },
1193                 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1194                 .dac_nids = alc880_dac_nids,
1195                 .dig_out_nid = ALC880_DIGOUT_NID,
1196                 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
1197                 .channel_mode = alc880_fivestack_modes,
1198                 .input_mux = &alc880_capture_source,
1199         },
1200         [ALC880_6ST] = {
1201                 .mixers = { alc880_six_stack_mixer },
1202                 .init_verbs = { alc880_volume_init_verbs,
1203                                 alc880_pin_6stack_init_verbs },
1204                 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
1205                 .dac_nids = alc880_6st_dac_nids,
1206                 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
1207                 .channel_mode = alc880_sixstack_modes,
1208                 .input_mux = &alc880_6stack_capture_source,
1209         },
1210         [ALC880_6ST_DIG] = {
1211                 .mixers = { alc880_six_stack_mixer },
1212                 .init_verbs = { alc880_volume_init_verbs,
1213                                 alc880_pin_6stack_init_verbs },
1214                 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
1215                 .dac_nids = alc880_6st_dac_nids,
1216                 .dig_out_nid = ALC880_DIGOUT_NID,
1217                 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
1218                 .channel_mode = alc880_sixstack_modes,
1219                 .input_mux = &alc880_6stack_capture_source,
1220         },
1221         [ALC880_Z71V] = {
1222                 .mixers = { alc880_z71v_mixer },
1223                 .init_verbs = { alc880_volume_init_verbs,
1224                                 alc880_pin_z71v_init_verbs },
1225                 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
1226                 .dac_nids = alc880_z71v_dac_nids,
1227                 .dig_out_nid = ALC880_DIGOUT_NID,
1228                 .hp_nid = 0x03,
1229                 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
1230                 .channel_mode = alc880_2_jack_modes,
1231                 .input_mux = &alc880_capture_source,
1232         },
1233         [ALC880_F1734] = {
1234                 .mixers = { alc880_f1734_mixer },
1235                 .init_verbs = { alc880_volume_init_verbs,
1236                                 alc880_pin_f1734_init_verbs },
1237                 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
1238                 .dac_nids = alc880_f1734_dac_nids,
1239                 .hp_nid = 0x02,
1240                 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
1241                 .channel_mode = alc880_2_jack_modes,
1242                 .input_mux = &alc880_f1734_capture_source,
1243                 .unsol_event = alc880_uniwill_p53_unsol_event,
1244                 .setup = alc880_uniwill_p53_setup,
1245                 .init_hook = alc_hp_automute,
1246         },
1247         [ALC880_ASUS] = {
1248                 .mixers = { alc880_asus_mixer },
1249                 .init_verbs = { alc880_volume_init_verbs,
1250                                 alc880_pin_asus_init_verbs,
1251                                 alc880_gpio1_init_verbs },
1252                 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
1253                 .dac_nids = alc880_asus_dac_nids,
1254                 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
1255                 .channel_mode = alc880_asus_modes,
1256                 .need_dac_fix = 1,
1257                 .input_mux = &alc880_capture_source,
1258         },
1259         [ALC880_ASUS_DIG] = {
1260                 .mixers = { alc880_asus_mixer },
1261                 .init_verbs = { alc880_volume_init_verbs,
1262                                 alc880_pin_asus_init_verbs,
1263                                 alc880_gpio1_init_verbs },
1264                 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
1265                 .dac_nids = alc880_asus_dac_nids,
1266                 .dig_out_nid = ALC880_DIGOUT_NID,
1267                 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
1268                 .channel_mode = alc880_asus_modes,
1269                 .need_dac_fix = 1,
1270                 .input_mux = &alc880_capture_source,
1271         },
1272         [ALC880_ASUS_DIG2] = {
1273                 .mixers = { alc880_asus_mixer },
1274                 .init_verbs = { alc880_volume_init_verbs,
1275                                 alc880_pin_asus_init_verbs,
1276                                 alc880_gpio2_init_verbs }, /* use GPIO2 */
1277                 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
1278                 .dac_nids = alc880_asus_dac_nids,
1279                 .dig_out_nid = ALC880_DIGOUT_NID,
1280                 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
1281                 .channel_mode = alc880_asus_modes,
1282                 .need_dac_fix = 1,
1283                 .input_mux = &alc880_capture_source,
1284         },
1285         [ALC880_ASUS_W1V] = {
1286                 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
1287                 .init_verbs = { alc880_volume_init_verbs,
1288                                 alc880_pin_asus_init_verbs,
1289                                 alc880_gpio1_init_verbs },
1290                 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
1291                 .dac_nids = alc880_asus_dac_nids,
1292                 .dig_out_nid = ALC880_DIGOUT_NID,
1293                 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
1294                 .channel_mode = alc880_asus_modes,
1295                 .need_dac_fix = 1,
1296                 .input_mux = &alc880_capture_source,
1297         },
1298         [ALC880_UNIWILL_DIG] = {
1299                 .mixers = { alc880_asus_mixer },
1300                 .init_verbs = { alc880_volume_init_verbs,
1301                                 alc880_pin_asus_init_verbs },
1302                 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
1303                 .dac_nids = alc880_asus_dac_nids,
1304                 .dig_out_nid = ALC880_DIGOUT_NID,
1305                 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
1306                 .channel_mode = alc880_asus_modes,
1307                 .need_dac_fix = 1,
1308                 .input_mux = &alc880_capture_source,
1309         },
1310         [ALC880_UNIWILL] = {
1311                 .mixers = { alc880_uniwill_mixer },
1312                 .init_verbs = { alc880_volume_init_verbs,
1313                                 alc880_uniwill_init_verbs },
1314                 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
1315                 .dac_nids = alc880_asus_dac_nids,
1316                 .dig_out_nid = ALC880_DIGOUT_NID,
1317                 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
1318                 .channel_mode = alc880_threestack_modes,
1319                 .need_dac_fix = 1,
1320                 .input_mux = &alc880_capture_source,
1321                 .unsol_event = alc880_uniwill_unsol_event,
1322                 .setup = alc880_uniwill_setup,
1323                 .init_hook = alc880_uniwill_init_hook,
1324         },
1325         [ALC880_UNIWILL_P53] = {
1326                 .mixers = { alc880_uniwill_p53_mixer },
1327                 .init_verbs = { alc880_volume_init_verbs,
1328                                 alc880_uniwill_p53_init_verbs },
1329                 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
1330                 .dac_nids = alc880_asus_dac_nids,
1331                 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
1332                 .channel_mode = alc880_threestack_modes,
1333                 .input_mux = &alc880_capture_source,
1334                 .unsol_event = alc880_uniwill_p53_unsol_event,
1335                 .setup = alc880_uniwill_p53_setup,
1336                 .init_hook = alc_hp_automute,
1337         },
1338         [ALC880_FUJITSU] = {
1339                 .mixers = { alc880_fujitsu_mixer },
1340                 .init_verbs = { alc880_volume_init_verbs,
1341                                 alc880_uniwill_p53_init_verbs,
1342                                 alc880_beep_init_verbs },
1343                 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1344                 .dac_nids = alc880_dac_nids,
1345                 .dig_out_nid = ALC880_DIGOUT_NID,
1346                 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
1347                 .channel_mode = alc880_2_jack_modes,
1348                 .input_mux = &alc880_capture_source,
1349                 .unsol_event = alc880_uniwill_p53_unsol_event,
1350                 .setup = alc880_uniwill_p53_setup,
1351                 .init_hook = alc_hp_automute,
1352         },
1353 #ifdef CONFIG_SND_DEBUG
1354         [ALC880_TEST] = {
1355                 .mixers = { alc880_test_mixer },
1356                 .init_verbs = { alc880_test_init_verbs },
1357                 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
1358                 .dac_nids = alc880_test_dac_nids,
1359                 .dig_out_nid = ALC880_DIGOUT_NID,
1360                 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
1361                 .channel_mode = alc880_test_modes,
1362                 .input_mux = &alc880_test_capture_source,
1363         },
1364 #endif
1365 };
1366