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