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