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