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