OSDN Git Service

ALSA: hda/realtek - Drop ALC882 model=clevo-m720 quirk
[uclinux-h8/linux.git] / sound / pci / hda / alc882_quirks.c
1 /*
2  * ALC882/ALC883/ALC888/ALC889 quirk models
3  * included by patch_realtek.c
4  */
5
6 /* ALC882 models */
7 enum {
8         ALC882_AUTO,
9         ALC882_3ST_DIG,
10         ALC882_6ST_DIG,
11         ALC882_W2JC,
12         ALC882_TARGA,
13         ALC885_MACPRO,
14         ALC885_MBA21,
15         ALC885_MBP3,
16         ALC885_MB5,
17         ALC885_MACMINI3,
18         ALC885_IMAC24,
19         ALC885_IMAC91,
20         ALC883_3ST_2ch_DIG,
21         ALC883_3ST_6ch_DIG,
22         ALC883_3ST_6ch,
23         ALC883_6ST_DIG,
24         ALC883_TARGA_DIG,
25         ALC883_TARGA_2ch_DIG,
26         ALC883_TARGA_8ch_DIG,
27         ALC883_ACER,
28         ALC883_ACER_ASPIRE,
29         ALC888_ACER_ASPIRE_4930G,
30         ALC888_ACER_ASPIRE_6530G,
31         ALC888_ACER_ASPIRE_8930G,
32         ALC888_ACER_ASPIRE_7730G,
33         ALC883_3ST_6ch_INTEL,
34         ALC889A_INTEL,
35         ALC889_INTEL,
36         ALC889A_MB31,
37         ALC882_MODEL_LAST,
38 };
39
40 /*
41  * 2ch mode
42  */
43 static const struct hda_verb alc888_4ST_ch2_intel_init[] = {
44 /* Mic-in jack as mic in */
45         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
46         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
47 /* Line-in jack as Line in */
48         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
49         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
50 /* Line-Out as Front */
51         { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
52         { } /* end */
53 };
54
55 /*
56  * 4ch mode
57  */
58 static const struct hda_verb alc888_4ST_ch4_intel_init[] = {
59 /* Mic-in jack as mic in */
60         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
61         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
62 /* Line-in jack as Surround */
63         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
64         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
65 /* Line-Out as Front */
66         { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
67         { } /* end */
68 };
69
70 /*
71  * 6ch mode
72  */
73 static const struct hda_verb alc888_4ST_ch6_intel_init[] = {
74 /* Mic-in jack as CLFE */
75         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
76         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
77 /* Line-in jack as Surround */
78         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
79         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
80 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
81         { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
82         { } /* end */
83 };
84
85 /*
86  * 8ch mode
87  */
88 static const struct hda_verb alc888_4ST_ch8_intel_init[] = {
89 /* Mic-in jack as CLFE */
90         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
91         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
92 /* Line-in jack as Surround */
93         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
94         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
95 /* Line-Out as Side */
96         { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
97         { } /* end */
98 };
99
100 static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
101         { 2, alc888_4ST_ch2_intel_init },
102         { 4, alc888_4ST_ch4_intel_init },
103         { 6, alc888_4ST_ch6_intel_init },
104         { 8, alc888_4ST_ch8_intel_init },
105 };
106
107 static void alc889_automute_setup(struct hda_codec *codec)
108 {
109         struct alc_spec *spec = codec->spec;
110
111         spec->autocfg.hp_pins[0] = 0x15;
112         spec->autocfg.speaker_pins[0] = 0x14;
113         spec->autocfg.speaker_pins[1] = 0x16;
114         spec->autocfg.speaker_pins[2] = 0x17;
115         spec->autocfg.speaker_pins[3] = 0x19;
116         spec->autocfg.speaker_pins[4] = 0x1a;
117         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
118 }
119
120 static void alc889_intel_init_hook(struct hda_codec *codec)
121 {
122         alc889_coef_init(codec);
123         alc_hp_automute(codec);
124 }
125
126 /*
127  * ALC888 Acer Aspire 4930G model
128  */
129
130 static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
131 /* Front Mic: set to PIN_IN (empty by default) */
132         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
133 /* Unselect Front Mic by default in input mixer 3 */
134         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
135 /* Enable unsolicited event for HP jack */
136         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
137 /* Connect Internal HP to front */
138         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
139         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
140         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
141 /* Connect HP out to front */
142         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
143         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
144         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
145         {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
146         { }
147 };
148
149 /*
150  * ALC888 Acer Aspire 6530G model
151  */
152
153 static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
154 /* Route to built-in subwoofer as well as speakers */
155         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
156         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
157         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
158         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
159 /* Bias voltage on for external mic port */
160         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
161 /* Front Mic: set to PIN_IN (empty by default) */
162         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
163 /* Unselect Front Mic by default in input mixer 3 */
164         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
165 /* Enable unsolicited event for HP jack */
166         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
167 /* Enable speaker output */
168         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
169         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
170         {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
171 /* Enable headphone output */
172         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
173         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
174         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
175         {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
176         { }
177 };
178
179 /*
180  *ALC888 Acer Aspire 7730G model
181  */
182
183 static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
184 /* Bias voltage on for external mic port */
185         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
186 /* Front Mic: set to PIN_IN (empty by default) */
187         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
188 /* Unselect Front Mic by default in input mixer 3 */
189         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
190 /* Enable unsolicited event for HP jack */
191         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
192 /* Enable speaker output */
193         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
194         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
195         {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
196 /* Enable headphone output */
197         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
198         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
199         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
200         {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
201 /*Enable internal subwoofer */
202         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
203         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
204         {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
205         {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
206         { }
207 };
208
209 /*
210  * ALC889 Acer Aspire 8930G model
211  */
212
213 static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
214 /* Front Mic: set to PIN_IN (empty by default) */
215         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
216 /* Unselect Front Mic by default in input mixer 3 */
217         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
218 /* Enable unsolicited event for HP jack */
219         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
220 /* Connect Internal Front to Front */
221         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
222         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
223         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
224 /* Connect Internal Rear to Rear */
225         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
226         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
227         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
228 /* Connect Internal CLFE to CLFE */
229         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
230         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
231         {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
232 /* Connect HP out to Front */
233         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
234         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
235         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
236 /* Enable all DACs */
237 /*  DAC DISABLE/MUTE 1? */
238 /*  setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
239         {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
240         {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
241 /*  DAC DISABLE/MUTE 2? */
242 /*  some bit here disables the other DACs. Init=0x4900 */
243         {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
244         {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
245 /* DMIC fix
246  * This laptop has a stereo digital microphone. The mics are only 1cm apart
247  * which makes the stereo useless. However, either the mic or the ALC889
248  * makes the signal become a difference/sum signal instead of standard
249  * stereo, which is annoying. So instead we flip this bit which makes the
250  * codec replicate the sum signal to both channels, turning it into a
251  * normal mono mic.
252  */
253 /*  DMIC_CONTROL? Init value = 0x0001 */
254         {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
255         {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
256         { }
257 };
258
259 static const struct hda_input_mux alc888_2_capture_sources[2] = {
260         /* Front mic only available on one ADC */
261         {
262                 .num_items = 4,
263                 .items = {
264                         { "Mic", 0x0 },
265                         { "Line", 0x2 },
266                         { "CD", 0x4 },
267                         { "Front Mic", 0xb },
268                 },
269         },
270         {
271                 .num_items = 3,
272                 .items = {
273                         { "Mic", 0x0 },
274                         { "Line", 0x2 },
275                         { "CD", 0x4 },
276                 },
277         }
278 };
279
280 static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
281         /* Interal mic only available on one ADC */
282         {
283                 .num_items = 5,
284                 .items = {
285                         { "Mic", 0x0 },
286                         { "Line In", 0x2 },
287                         { "CD", 0x4 },
288                         { "Input Mix", 0xa },
289                         { "Internal Mic", 0xb },
290                 },
291         },
292         {
293                 .num_items = 4,
294                 .items = {
295                         { "Mic", 0x0 },
296                         { "Line In", 0x2 },
297                         { "CD", 0x4 },
298                         { "Input Mix", 0xa },
299                 },
300         }
301 };
302
303 static const struct hda_input_mux alc889_capture_sources[3] = {
304         /* Digital mic only available on first "ADC" */
305         {
306                 .num_items = 5,
307                 .items = {
308                         { "Mic", 0x0 },
309                         { "Line", 0x2 },
310                         { "CD", 0x4 },
311                         { "Front Mic", 0xb },
312                         { "Input Mix", 0xa },
313                 },
314         },
315         {
316                 .num_items = 4,
317                 .items = {
318                         { "Mic", 0x0 },
319                         { "Line", 0x2 },
320                         { "CD", 0x4 },
321                         { "Input Mix", 0xa },
322                 },
323         },
324         {
325                 .num_items = 4,
326                 .items = {
327                         { "Mic", 0x0 },
328                         { "Line", 0x2 },
329                         { "CD", 0x4 },
330                         { "Input Mix", 0xa },
331                 },
332         }
333 };
334
335 static const struct snd_kcontrol_new alc888_base_mixer[] = {
336         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
337         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
338         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
339         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
340         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
341                 HDA_OUTPUT),
342         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
343         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
344         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
345         HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
346         HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
347         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
348         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
349         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
350         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
351         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
352         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
353         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
354         { } /* end */
355 };
356
357 static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
358         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
359         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
360         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
361         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
362         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
363                 HDA_OUTPUT),
364         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
365         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
366         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
367         HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
368         HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
369         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
370         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
371         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
372         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
373         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
374         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
375         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
376         { } /* end */
377 };
378
379 static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
380         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
381         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
382         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
383         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
384         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
385                 HDA_OUTPUT),
386         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
387         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
388         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
389         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
390         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
391         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
392         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
393         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
394         { } /* end */
395 };
396
397
398 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
399 {
400         struct alc_spec *spec = codec->spec;
401
402         spec->autocfg.hp_pins[0] = 0x15;
403         spec->autocfg.speaker_pins[0] = 0x14;
404         spec->autocfg.speaker_pins[1] = 0x16;
405         spec->autocfg.speaker_pins[2] = 0x17;
406         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
407 }
408
409 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
410 {
411         struct alc_spec *spec = codec->spec;
412
413         spec->autocfg.hp_pins[0] = 0x15;
414         spec->autocfg.speaker_pins[0] = 0x14;
415         spec->autocfg.speaker_pins[1] = 0x16;
416         spec->autocfg.speaker_pins[2] = 0x17;
417         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
418 }
419
420 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
421 {
422         struct alc_spec *spec = codec->spec;
423
424         spec->autocfg.hp_pins[0] = 0x15;
425         spec->autocfg.speaker_pins[0] = 0x14;
426         spec->autocfg.speaker_pins[1] = 0x16;
427         spec->autocfg.speaker_pins[2] = 0x17;
428         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
429 }
430
431 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
432 {
433         struct alc_spec *spec = codec->spec;
434
435         spec->autocfg.hp_pins[0] = 0x15;
436         spec->autocfg.speaker_pins[0] = 0x14;
437         spec->autocfg.speaker_pins[1] = 0x16;
438         spec->autocfg.speaker_pins[2] = 0x1b;
439         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
440 }
441
442 #define ALC882_DIGOUT_NID       0x06
443 #define ALC882_DIGIN_NID        0x0a
444 #define ALC883_DIGOUT_NID       ALC882_DIGOUT_NID
445 #define ALC883_DIGIN_NID        ALC882_DIGIN_NID
446 #define ALC1200_DIGOUT_NID      0x10
447
448
449 static const struct hda_channel_mode alc882_ch_modes[1] = {
450         { 8, NULL }
451 };
452
453 /* DACs */
454 static const hda_nid_t alc882_dac_nids[4] = {
455         /* front, rear, clfe, rear_surr */
456         0x02, 0x03, 0x04, 0x05
457 };
458 #define alc883_dac_nids         alc882_dac_nids
459
460 /* ADCs */
461 #define alc882_adc_nids         alc880_adc_nids
462 #define alc882_adc_nids_alt     alc880_adc_nids_alt
463 #define alc883_adc_nids         alc882_adc_nids_alt
464 static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
465 static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
466 #define alc889_adc_nids         alc880_adc_nids
467
468 static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
469 static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
470 #define alc883_capsrc_nids      alc882_capsrc_nids_alt
471 static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
472 #define alc889_capsrc_nids      alc882_capsrc_nids
473
474 /* input MUX */
475 /* FIXME: should be a matrix-type input source selection */
476
477 static const struct hda_input_mux alc882_capture_source = {
478         .num_items = 4,
479         .items = {
480                 { "Mic", 0x0 },
481                 { "Front Mic", 0x1 },
482                 { "Line", 0x2 },
483                 { "CD", 0x4 },
484         },
485 };
486
487 #define alc883_capture_source   alc882_capture_source
488
489 static const struct hda_input_mux alc889_capture_source = {
490         .num_items = 3,
491         .items = {
492                 { "Front Mic", 0x0 },
493                 { "Mic", 0x3 },
494                 { "Line", 0x2 },
495         },
496 };
497
498 static const struct hda_input_mux mb5_capture_source = {
499         .num_items = 3,
500         .items = {
501                 { "Mic", 0x1 },
502                 { "Line", 0x7 },
503                 { "CD", 0x4 },
504         },
505 };
506
507 static const struct hda_input_mux macmini3_capture_source = {
508         .num_items = 2,
509         .items = {
510                 { "Line", 0x2 },
511                 { "CD", 0x4 },
512         },
513 };
514
515 static const struct hda_input_mux alc883_3stack_6ch_intel = {
516         .num_items = 4,
517         .items = {
518                 { "Mic", 0x1 },
519                 { "Front Mic", 0x0 },
520                 { "Line", 0x2 },
521                 { "CD", 0x4 },
522         },
523 };
524
525 static const struct hda_input_mux alc889A_mb31_capture_source = {
526         .num_items = 2,
527         .items = {
528                 { "Mic", 0x0 },
529                 /* Front Mic (0x01) unused */
530                 { "Line", 0x2 },
531                 /* Line 2 (0x03) unused */
532                 /* CD (0x04) unused? */
533         },
534 };
535
536 static const struct hda_input_mux alc889A_imac91_capture_source = {
537         .num_items = 2,
538         .items = {
539                 { "Mic", 0x01 },
540                 { "Line", 0x2 }, /* Not sure! */
541         },
542 };
543
544 /*
545  * 2ch mode
546  */
547 static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
548         { 2, NULL }
549 };
550
551 /*
552  * 2ch mode
553  */
554 static const struct hda_verb alc882_3ST_ch2_init[] = {
555         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
556         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
557         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
558         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
559         { } /* end */
560 };
561
562 /*
563  * 4ch mode
564  */
565 static const struct hda_verb alc882_3ST_ch4_init[] = {
566         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
567         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
568         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
569         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
570         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
571         { } /* end */
572 };
573
574 /*
575  * 6ch mode
576  */
577 static const struct hda_verb alc882_3ST_ch6_init[] = {
578         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
579         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
580         { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
581         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
582         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
583         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
584         { } /* end */
585 };
586
587 static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
588         { 2, alc882_3ST_ch2_init },
589         { 4, alc882_3ST_ch4_init },
590         { 6, alc882_3ST_ch6_init },
591 };
592
593 #define alc883_3ST_6ch_modes    alc882_3ST_6ch_modes
594
595 /*
596  * 2ch mode
597  */
598 static const struct hda_verb alc883_3ST_ch2_clevo_init[] = {
599         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
600         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
601         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
602         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
603         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
604         { } /* end */
605 };
606
607 /*
608  * 4ch mode
609  */
610 static const struct hda_verb alc883_3ST_ch4_clevo_init[] = {
611         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
612         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
613         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
614         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
615         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
616         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
617         { } /* end */
618 };
619
620 /*
621  * 6ch mode
622  */
623 static const struct hda_verb alc883_3ST_ch6_clevo_init[] = {
624         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
625         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
626         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
627         { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
628         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
629         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
630         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
631         { } /* end */
632 };
633
634 static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
635         { 2, alc883_3ST_ch2_clevo_init },
636         { 4, alc883_3ST_ch4_clevo_init },
637         { 6, alc883_3ST_ch6_clevo_init },
638 };
639
640
641 /*
642  * 6ch mode
643  */
644 static const struct hda_verb alc882_sixstack_ch6_init[] = {
645         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
646         { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
647         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
648         { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
649         { } /* end */
650 };
651
652 /*
653  * 8ch mode
654  */
655 static const struct hda_verb alc882_sixstack_ch8_init[] = {
656         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
657         { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
658         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
659         { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
660         { } /* end */
661 };
662
663 static const struct hda_channel_mode alc882_sixstack_modes[2] = {
664         { 6, alc882_sixstack_ch6_init },
665         { 8, alc882_sixstack_ch8_init },
666 };
667
668
669 /* Macbook Air 2,1 */
670
671 static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
672       { 2, NULL },
673 };
674
675 /*
676  * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
677  */
678
679 /*
680  * 2ch mode
681  */
682 static const struct hda_verb alc885_mbp_ch2_init[] = {
683         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
684         { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
685         { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
686         { } /* end */
687 };
688
689 /*
690  * 4ch mode
691  */
692 static const struct hda_verb alc885_mbp_ch4_init[] = {
693         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
694         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
695         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
696         { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
697         { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
698         { } /* end */
699 };
700
701 static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
702         { 2, alc885_mbp_ch2_init },
703         { 4, alc885_mbp_ch4_init },
704 };
705
706 /*
707  * 2ch
708  * Speakers/Woofer/HP = Front
709  * LineIn = Input
710  */
711 static const struct hda_verb alc885_mb5_ch2_init[] = {
712         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
713         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
714         { } /* end */
715 };
716
717 /*
718  * 6ch mode
719  * Speakers/HP = Front
720  * Woofer = LFE
721  * LineIn = Surround
722  */
723 static const struct hda_verb alc885_mb5_ch6_init[] = {
724         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
725         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
726         {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
727         { } /* end */
728 };
729
730 static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
731         { 2, alc885_mb5_ch2_init },
732         { 6, alc885_mb5_ch6_init },
733 };
734
735 #define alc885_macmini3_6ch_modes       alc885_mb5_6ch_modes
736
737 /*
738  * 2ch mode
739  */
740 static const struct hda_verb alc883_4ST_ch2_init[] = {
741         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
742         { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
743         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
744         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
745         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
746         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
747         { } /* end */
748 };
749
750 /*
751  * 4ch mode
752  */
753 static const struct hda_verb alc883_4ST_ch4_init[] = {
754         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
755         { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
756         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
757         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
758         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
759         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
760         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
761         { } /* end */
762 };
763
764 /*
765  * 6ch mode
766  */
767 static const struct hda_verb alc883_4ST_ch6_init[] = {
768         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
769         { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
770         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
771         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
772         { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
773         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
774         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
775         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
776         { } /* end */
777 };
778
779 /*
780  * 8ch mode
781  */
782 static const struct hda_verb alc883_4ST_ch8_init[] = {
783         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
784         { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
785         { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
786         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
787         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
788         { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
789         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
790         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
791         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
792         { } /* end */
793 };
794
795 static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
796         { 2, alc883_4ST_ch2_init },
797         { 4, alc883_4ST_ch4_init },
798         { 6, alc883_4ST_ch6_init },
799         { 8, alc883_4ST_ch8_init },
800 };
801
802
803 /*
804  * 2ch mode
805  */
806 static const struct hda_verb alc883_3ST_ch2_intel_init[] = {
807         { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
808         { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
809         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
810         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
811         { } /* end */
812 };
813
814 /*
815  * 4ch mode
816  */
817 static const struct hda_verb alc883_3ST_ch4_intel_init[] = {
818         { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
819         { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
820         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
821         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
822         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
823         { } /* end */
824 };
825
826 /*
827  * 6ch mode
828  */
829 static const struct hda_verb alc883_3ST_ch6_intel_init[] = {
830         { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
831         { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
832         { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
833         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
834         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
835         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
836         { } /* end */
837 };
838
839 static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
840         { 2, alc883_3ST_ch2_intel_init },
841         { 4, alc883_3ST_ch4_intel_init },
842         { 6, alc883_3ST_ch6_intel_init },
843 };
844
845 /*
846  * 2ch mode
847  */
848 static const struct hda_verb alc889_ch2_intel_init[] = {
849         { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
850         { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
851         { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
852         { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
853         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
854         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
855         { } /* end */
856 };
857
858 /*
859  * 6ch mode
860  */
861 static const struct hda_verb alc889_ch6_intel_init[] = {
862         { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
863         { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
864         { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
865         { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
866         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
867         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
868         { } /* end */
869 };
870
871 /*
872  * 8ch mode
873  */
874 static const struct hda_verb alc889_ch8_intel_init[] = {
875         { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
876         { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
877         { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
878         { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
879         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
880         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
881         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
882         { } /* end */
883 };
884
885 static const struct hda_channel_mode alc889_8ch_intel_modes[3] = {
886         { 2, alc889_ch2_intel_init },
887         { 6, alc889_ch6_intel_init },
888         { 8, alc889_ch8_intel_init },
889 };
890
891 /*
892  * 6ch mode
893  */
894 static const struct hda_verb alc883_sixstack_ch6_init[] = {
895         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
896         { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
897         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
898         { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
899         { } /* end */
900 };
901
902 /*
903  * 8ch mode
904  */
905 static const struct hda_verb alc883_sixstack_ch8_init[] = {
906         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
907         { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
908         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
909         { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
910         { } /* end */
911 };
912
913 static const struct hda_channel_mode alc883_sixstack_modes[2] = {
914         { 6, alc883_sixstack_ch6_init },
915         { 8, alc883_sixstack_ch8_init },
916 };
917
918
919 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
920  *                 Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
921  */
922 static const struct snd_kcontrol_new alc882_base_mixer[] = {
923         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
924         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
925         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
926         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
927         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
928         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
929         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
930         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
931         HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
932         HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
933         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
934         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
935         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
936         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
937         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
938         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
939         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
940         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
941         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
942         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
943         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
944         { } /* end */
945 };
946
947 /* Macbook Air 2,1 same control for HP and internal Speaker */
948
949 static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
950       HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
951       HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
952      { }
953 };
954
955
956 static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
957         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
958         HDA_BIND_MUTE   ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
959         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
960         HDA_BIND_MUTE   ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
961         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
962         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
963         HDA_CODEC_MUTE  ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
964         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
965         HDA_CODEC_MUTE  ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
966         HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
967         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
968         { } /* end */
969 };
970
971 static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
972         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
973         HDA_BIND_MUTE   ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
974         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
975         HDA_BIND_MUTE   ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
976         HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
977         HDA_BIND_MUTE   ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
978         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
979         HDA_BIND_MUTE   ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
980         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
981         HDA_CODEC_MUTE  ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
982         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
983         HDA_CODEC_MUTE  ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
984         HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
985         HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
986         { } /* end */
987 };
988
989 static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
990         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
991         HDA_BIND_MUTE   ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
992         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
993         HDA_BIND_MUTE   ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
994         HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
995         HDA_BIND_MUTE   ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
996         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
997         HDA_BIND_MUTE   ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
998         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
999         HDA_CODEC_MUTE  ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
1000         HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
1001         { } /* end */
1002 };
1003
1004 static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
1005         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1006         HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
1007         { } /* end */
1008 };
1009
1010
1011 static const struct snd_kcontrol_new alc882_w2jc_mixer[] = {
1012         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1013         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1014         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1015         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1016         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1017         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1018         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1019         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1020         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1021         { } /* end */
1022 };
1023
1024 static const struct snd_kcontrol_new alc882_targa_mixer[] = {
1025         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1026         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1027         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1028         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1029         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1030         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1031         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1032         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1033         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1034         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1035         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1036         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1037         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1038         { } /* end */
1039 };
1040
1041 static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
1042         {
1043                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1044                 .name = "Channel Mode",
1045                 .info = alc_ch_mode_info,
1046                 .get = alc_ch_mode_get,
1047                 .put = alc_ch_mode_put,
1048         },
1049         { } /* end */
1050 };
1051
1052 static const struct hda_verb alc882_base_init_verbs[] = {
1053         /* Front mixer: unmute input/output amp left and right (volume = 0) */
1054         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1055         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1056         /* Rear mixer */
1057         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1058         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1059         /* CLFE mixer */
1060         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1061         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1062         /* Side mixer */
1063         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1064         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1065
1066         /* Front Pin: output 0 (0x0c) */
1067         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1068         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1069         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1070         /* Rear Pin: output 1 (0x0d) */
1071         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1072         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1073         {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
1074         /* CLFE Pin: output 2 (0x0e) */
1075         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1076         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1077         {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1078         /* Side Pin: output 3 (0x0f) */
1079         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1080         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1081         {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1082         /* Mic (rear) pin: input vref at 80% */
1083         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1084         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1085         /* Front Mic pin: input vref at 80% */
1086         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1087         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1088         /* Line In pin: input */
1089         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1090         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1091         /* Line-2 In: Headphone output (output 0 - 0x0c) */
1092         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1093         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1094         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1095         /* CD pin widget for input */
1096         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1097
1098         /* FIXME: use matrix-type input source selection */
1099         /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
1100         /* Input mixer2 */
1101         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1102         /* Input mixer3 */
1103         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1104         /* ADC2: mute amp left and right */
1105         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1106         {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1107         /* ADC3: mute amp left and right */
1108         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1109         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1110
1111         { }
1112 };
1113
1114 static const struct hda_verb alc882_adc1_init_verbs[] = {
1115         /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
1116         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1117         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1118         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1119         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1120         /* ADC1: mute amp left and right */
1121         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1122         {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1123         { }
1124 };
1125
1126 static const struct hda_verb alc882_eapd_verbs[] = {
1127         /* change to EAPD mode */
1128         {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1129         {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1130         { }
1131 };
1132
1133 static const struct hda_verb alc889_eapd_verbs[] = {
1134         {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1135         {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1136         { }
1137 };
1138
1139 static const struct hda_verb alc_hp15_unsol_verbs[] = {
1140         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
1141         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1142         {}
1143 };
1144
1145 static const struct hda_verb alc885_init_verbs[] = {
1146         /* Front mixer: unmute input/output amp left and right (volume = 0) */
1147         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1148         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1149         /* Rear mixer */
1150         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1151         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1152         /* CLFE mixer */
1153         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1154         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1155         /* Side mixer */
1156         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1157         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1158
1159         /* Front HP Pin: output 0 (0x0c) */
1160         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1161         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1162         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1163         /* Front Pin: output 0 (0x0c) */
1164         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1165         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1166         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1167         /* Rear Pin: output 1 (0x0d) */
1168         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1169         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1170         {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
1171         /* CLFE Pin: output 2 (0x0e) */
1172         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1173         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1174         {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1175         /* Side Pin: output 3 (0x0f) */
1176         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1177         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1178         {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1179         /* Mic (rear) pin: input vref at 80% */
1180         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1181         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1182         /* Front Mic pin: input vref at 80% */
1183         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1184         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1185         /* Line In pin: input */
1186         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1187         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1188
1189         /* Mixer elements: 0x18, , 0x1a, 0x1b */
1190         /* Input mixer1 */
1191         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1192         /* Input mixer2 */
1193         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1194         /* Input mixer3 */
1195         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1196         /* ADC2: mute amp left and right */
1197         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1198         /* ADC3: mute amp left and right */
1199         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1200
1201         { }
1202 };
1203
1204 static const struct hda_verb alc885_init_input_verbs[] = {
1205         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1206         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
1207         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
1208         { }
1209 };
1210
1211
1212 /* Unmute Selector 24h and set the default input to front mic */
1213 static const struct hda_verb alc889_init_input_verbs[] = {
1214         {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
1215         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1216         { }
1217 };
1218
1219
1220 #define alc883_init_verbs       alc882_base_init_verbs
1221
1222 /* Mac Pro test */
1223 static const struct snd_kcontrol_new alc882_macpro_mixer[] = {
1224         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1225         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1226         HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
1227         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
1228         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
1229         /* FIXME: this looks suspicious...
1230         HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
1231         HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
1232         */
1233         { } /* end */
1234 };
1235
1236 static const struct hda_verb alc882_macpro_init_verbs[] = {
1237         /* Front mixer: unmute input/output amp left and right (volume = 0) */
1238         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1239         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1240         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1241         /* Front Pin: output 0 (0x0c) */
1242         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1243         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1244         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1245         /* Front Mic pin: input vref at 80% */
1246         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1247         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1248         /* Speaker:  output */
1249         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1250         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1251         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
1252         /* Headphone output (output 0 - 0x0c) */
1253         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1254         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1255         {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1256
1257         /* FIXME: use matrix-type input source selection */
1258         /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
1259         /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
1260         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1261         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1262         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1263         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1264         /* Input mixer2 */
1265         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1266         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1267         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1268         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1269         /* Input mixer3 */
1270         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1271         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1272         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1273         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1274         /* ADC1: mute amp left and right */
1275         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1276         {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1277         /* ADC2: mute amp left and right */
1278         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1279         {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1280         /* ADC3: mute amp left and right */
1281         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1282         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1283
1284         { }
1285 };
1286
1287 /* Macbook 5,1 */
1288 static const struct hda_verb alc885_mb5_init_verbs[] = {
1289         /* DACs */
1290         {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1291         {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1292         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1293         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1294         /* Front mixer */
1295         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1296         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1297         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1298         /* Surround mixer */
1299         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1300         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1301         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1302         /* LFE mixer */
1303         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1304         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1305         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1306         /* HP mixer */
1307         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1308         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1309         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1310         /* Front Pin (0x0c) */
1311         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
1312         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1313         {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1314         /* LFE Pin (0x0e) */
1315         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
1316         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1317         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
1318         /* HP Pin (0x0f) */
1319         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1320         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1321         {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
1322         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1323         /* Front Mic pin: input vref at 80% */
1324         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1325         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1326         /* Line In pin */
1327         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1328         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1329
1330         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
1331         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
1332         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
1333         { }
1334 };
1335
1336 /* Macmini 3,1 */
1337 static const struct hda_verb alc885_macmini3_init_verbs[] = {
1338         /* DACs */
1339         {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1340         {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1341         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1342         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1343         /* Front mixer */
1344         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1345         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1346         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1347         /* Surround mixer */
1348         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1349         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1350         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1351         /* LFE mixer */
1352         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1353         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1354         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1355         /* HP mixer */
1356         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1357         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1358         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1359         /* Front Pin (0x0c) */
1360         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
1361         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1362         {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1363         /* LFE Pin (0x0e) */
1364         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
1365         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1366         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
1367         /* HP Pin (0x0f) */
1368         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1369         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1370         {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
1371         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1372         /* Line In pin */
1373         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1374         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1375
1376         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1377         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1378         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1379         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1380         { }
1381 };
1382
1383
1384 static const struct hda_verb alc885_mba21_init_verbs[] = {
1385         /*Internal and HP Speaker Mixer*/
1386         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1387         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1388         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1389         /*Internal Speaker Pin (0x0c)*/
1390         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
1391         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1392         {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1393         /* HP Pin: output 0 (0x0e) */
1394         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
1395         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1396         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1397         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC_HP_EVENT | AC_USRSP_EN)},
1398         /* Line in (is hp when jack connected)*/
1399         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
1400         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1401
1402         { }
1403  };
1404
1405
1406 /* Macbook Pro rev3 */
1407 static const struct hda_verb alc885_mbp3_init_verbs[] = {
1408         /* Front mixer: unmute input/output amp left and right (volume = 0) */
1409         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1410         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1411         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1412         /* Rear mixer */
1413         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1414         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1415         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1416         /* HP mixer */
1417         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1418         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1419         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1420         /* Front Pin: output 0 (0x0c) */
1421         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1422         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1423         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1424         /* HP Pin: output 0 (0x0e) */
1425         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
1426         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1427         {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
1428         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1429         /* Mic (rear) pin: input vref at 80% */
1430         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1431         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1432         /* Front Mic pin: input vref at 80% */
1433         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1434         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1435         /* Line In pin: use output 1 when in LineOut mode */
1436         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1437         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1438         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1439
1440         /* FIXME: use matrix-type input source selection */
1441         /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
1442         /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
1443         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1444         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1445         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1446         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1447         /* Input mixer2 */
1448         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1449         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1450         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1451         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1452         /* Input mixer3 */
1453         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1454         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1455         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1456         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1457         /* ADC1: mute amp left and right */
1458         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1459         {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1460         /* ADC2: mute amp left and right */
1461         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1462         {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1463         /* ADC3: mute amp left and right */
1464         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1465         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1466
1467         { }
1468 };
1469
1470 /* iMac 9,1 */
1471 static const struct hda_verb alc885_imac91_init_verbs[] = {
1472         /* Internal Speaker Pin (0x0c) */
1473         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
1474         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1475         {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1476         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
1477         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1478         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
1479         /* HP Pin: Rear */
1480         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1481         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1482         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1483         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC_HP_EVENT | AC_USRSP_EN)},
1484         /* Line in Rear */
1485         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
1486         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1487         /* Front Mic pin: input vref at 80% */
1488         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1489         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1490         /* Rear mixer */
1491         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1492         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1493         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1494         /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
1495         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1496         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1497         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1498         /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
1499         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1500         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1501         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1502         {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1503         /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
1504         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1505         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1506         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1507         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1508         /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
1509         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1510         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1511         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1512         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1513         /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
1514         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1515         {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1516         /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
1517         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1518         {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1519         /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
1520         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1521         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1522         { }
1523 };
1524
1525 /* iMac 24 mixer. */
1526 static const struct snd_kcontrol_new alc885_imac24_mixer[] = {
1527         HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1528         HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
1529         { } /* end */
1530 };
1531
1532 /* iMac 24 init verbs. */
1533 static const struct hda_verb alc885_imac24_init_verbs[] = {
1534         /* Internal speakers: output 0 (0x0c) */
1535         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1536         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1537         {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1538         /* Internal speakers: output 0 (0x0c) */
1539         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1540         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1541         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
1542         /* Headphone: output 0 (0x0c) */
1543         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1544         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1545         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1546         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1547         /* Front Mic: input vref at 80% */
1548         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1549         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1550         { }
1551 };
1552
1553 /* Toggle speaker-output according to the hp-jack state */
1554 static void alc885_imac24_setup(struct hda_codec *codec)
1555 {
1556         struct alc_spec *spec = codec->spec;
1557
1558         spec->autocfg.hp_pins[0] = 0x14;
1559         spec->autocfg.speaker_pins[0] = 0x18;
1560         spec->autocfg.speaker_pins[1] = 0x1a;
1561         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1562 }
1563
1564 #define alc885_mb5_setup        alc885_imac24_setup
1565 #define alc885_macmini3_setup   alc885_imac24_setup
1566
1567 /* Macbook Air 2,1 */
1568 static void alc885_mba21_setup(struct hda_codec *codec)
1569 {
1570         struct alc_spec *spec = codec->spec;
1571
1572         spec->autocfg.hp_pins[0] = 0x14;
1573         spec->autocfg.speaker_pins[0] = 0x18;
1574         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1575 }
1576
1577
1578
1579 static void alc885_mbp3_setup(struct hda_codec *codec)
1580 {
1581         struct alc_spec *spec = codec->spec;
1582
1583         spec->autocfg.hp_pins[0] = 0x15;
1584         spec->autocfg.speaker_pins[0] = 0x14;
1585         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1586 }
1587
1588 static void alc885_imac91_setup(struct hda_codec *codec)
1589 {
1590         struct alc_spec *spec = codec->spec;
1591
1592         spec->autocfg.hp_pins[0] = 0x14;
1593         spec->autocfg.speaker_pins[0] = 0x18;
1594         spec->autocfg.speaker_pins[1] = 0x1a;
1595         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1596 }
1597
1598 static const struct hda_verb alc882_targa_verbs[] = {
1599         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1600         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1601
1602         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1603         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1604
1605         {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1606         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
1607         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1608
1609         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1610         { } /* end */
1611 };
1612
1613 /* toggle speaker-output according to the hp-jack state */
1614 static void alc882_targa_automute(struct hda_codec *codec)
1615 {
1616         struct alc_spec *spec = codec->spec;
1617         alc_hp_automute(codec);
1618         snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
1619                                   spec->hp_jack_present ? 1 : 3);
1620 }
1621
1622 static void alc882_targa_setup(struct hda_codec *codec)
1623 {
1624         struct alc_spec *spec = codec->spec;
1625
1626         spec->autocfg.hp_pins[0] = 0x14;
1627         spec->autocfg.speaker_pins[0] = 0x1b;
1628         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1629 }
1630
1631 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
1632 {
1633         if ((res >> 26) == ALC_HP_EVENT)
1634                 alc882_targa_automute(codec);
1635 }
1636
1637 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1638 {
1639         unsigned int gpiostate, gpiomask, gpiodir;
1640
1641         gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1642                                        AC_VERB_GET_GPIO_DATA, 0);
1643
1644         if (!muted)
1645                 gpiostate |= (1 << pin);
1646         else
1647                 gpiostate &= ~(1 << pin);
1648
1649         gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1650                                       AC_VERB_GET_GPIO_MASK, 0);
1651         gpiomask |= (1 << pin);
1652
1653         gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1654                                      AC_VERB_GET_GPIO_DIRECTION, 0);
1655         gpiodir |= (1 << pin);
1656
1657
1658         snd_hda_codec_write(codec, codec->afg, 0,
1659                             AC_VERB_SET_GPIO_MASK, gpiomask);
1660         snd_hda_codec_write(codec, codec->afg, 0,
1661                             AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1662
1663         msleep(1);
1664
1665         snd_hda_codec_write(codec, codec->afg, 0,
1666                             AC_VERB_SET_GPIO_DATA, gpiostate);
1667 }
1668
1669 /* set up GPIO at initialization */
1670 static void alc885_macpro_init_hook(struct hda_codec *codec)
1671 {
1672         alc882_gpio_mute(codec, 0, 0);
1673         alc882_gpio_mute(codec, 1, 0);
1674 }
1675
1676 /* set up GPIO and update auto-muting at initialization */
1677 static void alc885_imac24_init_hook(struct hda_codec *codec)
1678 {
1679         alc885_macpro_init_hook(codec);
1680         alc_hp_automute(codec);
1681 }
1682
1683 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
1684 static const struct hda_verb alc889A_mb31_ch2_init[] = {
1685         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},             /* HP as front */
1686         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
1687         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},    /* Line as input */
1688         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},   /* Line off */
1689         { } /* end */
1690 };
1691
1692 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
1693 static const struct hda_verb alc889A_mb31_ch4_init[] = {
1694         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},             /* HP as front */
1695         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
1696         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},   /* Line as output */
1697         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
1698         { } /* end */
1699 };
1700
1701 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
1702 static const struct hda_verb alc889A_mb31_ch5_init[] = {
1703         {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},             /* HP as rear */
1704         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
1705         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},    /* Line as input */
1706         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},   /* Line off */
1707         { } /* end */
1708 };
1709
1710 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
1711 static const struct hda_verb alc889A_mb31_ch6_init[] = {
1712         {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},             /* HP as front */
1713         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},   /* Subwoofer off */
1714         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},   /* Line as output */
1715         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
1716         { } /* end */
1717 };
1718
1719 static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
1720         { 2, alc889A_mb31_ch2_init },
1721         { 4, alc889A_mb31_ch4_init },
1722         { 5, alc889A_mb31_ch5_init },
1723         { 6, alc889A_mb31_ch6_init },
1724 };
1725
1726 #define alc883_base_mixer       alc882_base_mixer
1727
1728 static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
1729         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1730         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1731         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1732         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1733         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1734         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1735         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1736         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1737         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1738         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1739         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1740         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1741         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1742         { } /* end */
1743 };
1744
1745 static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
1746         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1747         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1748         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1749         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1750         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1751         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1752         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1753         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1754         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1755         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1756         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1757         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1758         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1759         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1760         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1761         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1762         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1763         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1764         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1765         { } /* end */
1766 };
1767
1768 static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
1769         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1770         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1771         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1772         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1773         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1774                               HDA_OUTPUT),
1775         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1776         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1777         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1778         HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
1779         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1780         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1781         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1782         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1783         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1784         HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
1785         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1786         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1787         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
1788         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1789         { } /* end */
1790 };
1791
1792 static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
1793         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1794         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1795         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1796         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1797         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1798                               HDA_OUTPUT),
1799         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1800         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1801         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1802         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1803         HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
1804         HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
1805         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1806         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1807         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1808         HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
1809         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1810         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1811         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
1812         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1813         { } /* end */
1814 };
1815
1816 static const struct snd_kcontrol_new alc883_fivestack_mixer[] = {
1817         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1818         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1819         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1820         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1821         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1822         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1823         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1824         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1825         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1826         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1827         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1828         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1829         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1830         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1831         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1832         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1833         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1834         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1835         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1836         { } /* end */
1837 };
1838
1839 static const struct snd_kcontrol_new alc883_targa_mixer[] = {
1840         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1841         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1842         HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1843         HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1844         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1845         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1846         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1847         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1848         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1849         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1850         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1851         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1852         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1853         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1854         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1855         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1856         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1857         { } /* end */
1858 };
1859
1860 static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
1861         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1862         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1863         HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1864         HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1865         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1866         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1867         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1868         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1869         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1870         HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1871         HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
1872         HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1873         { } /* end */
1874 };
1875
1876 static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
1877         HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1878         HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1879         HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1880         HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
1881         HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1882         { } /* end */
1883 };
1884
1885 static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
1886         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1887         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1888         HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1889         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1890         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1891         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1892         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1893         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1894         { } /* end */
1895 };
1896
1897 static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
1898         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1899         HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1900         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1901         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1902         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1903         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1904         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1905         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1906         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1907         { } /* end */
1908 };
1909
1910 static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
1911         /* Output mixers */
1912         HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1913         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
1914         HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
1915         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
1916         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
1917                 HDA_OUTPUT),
1918         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
1919         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
1920         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
1921         /* Output switches */
1922         HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
1923         HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
1924         HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
1925         /* Boost mixers */
1926         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
1927         HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
1928         /* Input mixers */
1929         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
1930         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
1931         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1932         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1933         { } /* end */
1934 };
1935
1936 static const struct hda_bind_ctls alc883_bind_cap_vol = {
1937         .ops = &snd_hda_bind_vol,
1938         .values = {
1939                 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
1940                 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
1941                 0
1942         },
1943 };
1944
1945 static const struct hda_bind_ctls alc883_bind_cap_switch = {
1946         .ops = &snd_hda_bind_sw,
1947         .values = {
1948                 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
1949                 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
1950                 0
1951         },
1952 };
1953
1954 static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
1955         {
1956                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1957                 .name = "Channel Mode",
1958                 .info = alc_ch_mode_info,
1959                 .get = alc_ch_mode_get,
1960                 .put = alc_ch_mode_put,
1961         },
1962         { } /* end */
1963 };
1964
1965 static const struct hda_verb alc883_targa_verbs[] = {
1966         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1967         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1968
1969         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1970         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1971
1972 /* Connect Line-Out side jack (SPDIF) to Side */
1973         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1974         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1975         {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1976 /* Connect Mic jack to CLFE */
1977         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1978         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1979         {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1980 /* Connect Line-in jack to Surround */
1981         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1982         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1983         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1984 /* Connect HP out jack to Front */
1985         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1986         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1987         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1988
1989         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1990
1991         { } /* end */
1992 };
1993
1994 /* toggle speaker-output according to the hp-jack state */
1995 #define alc883_targa_init_hook          alc882_targa_init_hook
1996 #define alc883_targa_unsol_event        alc882_targa_unsol_event
1997
1998 /* toggle speaker-output according to the hp-jack state */
1999 static void alc883_acer_aspire_setup(struct hda_codec *codec)
2000 {
2001         struct alc_spec *spec = codec->spec;
2002
2003         spec->autocfg.hp_pins[0] = 0x14;
2004         spec->autocfg.speaker_pins[0] = 0x15;
2005         spec->autocfg.speaker_pins[1] = 0x16;
2006         alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2007 }
2008
2009 static const struct hda_verb alc883_acer_eapd_verbs[] = {
2010         /* HP Pin: output 0 (0x0c) */
2011         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2012         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2013         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2014         /* Front Pin: output 0 (0x0c) */
2015         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2016         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2017         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2018         {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
2019         /* eanable EAPD on medion laptop */
2020         {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2021         {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
2022         /* enable unsolicited event */
2023         {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2024         { }
2025 };
2026
2027 static const struct hda_verb alc889A_mb31_verbs[] = {
2028         /* Init rear pin (used as headphone output) */
2029         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},    /* Apple Headphones */
2030         {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},           /* Connect to front */
2031         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2032         /* Init line pin (used as output in 4ch and 6ch mode) */
2033         {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},           /* Connect to CLFE */
2034         /* Init line 2 pin (used as headphone out by default) */
2035         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},  /* Use as input */
2036         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
2037         { } /* end */
2038 };
2039
2040 /* Mute speakers according to the headphone jack state */
2041 static void alc889A_mb31_automute(struct hda_codec *codec)
2042 {
2043         unsigned int present;
2044
2045         /* Mute only in 2ch or 4ch mode */
2046         if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
2047             == 0x00) {
2048                 present = snd_hda_jack_detect(codec, 0x15);
2049                 snd_hda_codec_amp_stereo(codec, 0x14,  HDA_OUTPUT, 0,
2050                         HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
2051                 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2052                         HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
2053         }
2054 }
2055
2056 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
2057 {
2058         if ((res >> 26) == ALC_HP_EVENT)
2059                 alc889A_mb31_automute(codec);
2060 }
2061
2062 static const hda_nid_t alc883_slave_dig_outs[] = {
2063         ALC1200_DIGOUT_NID, 0,
2064 };
2065
2066 static const hda_nid_t alc1200_slave_dig_outs[] = {
2067         ALC883_DIGOUT_NID, 0,
2068 };
2069
2070 /*
2071  * configuration and preset
2072  */
2073 static const char * const alc882_models[ALC882_MODEL_LAST] = {
2074         [ALC882_3ST_DIG]        = "3stack-dig",
2075         [ALC882_6ST_DIG]        = "6stack-dig",
2076         [ALC882_W2JC]           = "w2jc",
2077         [ALC882_TARGA]          = "targa",
2078         [ALC885_MACPRO]         = "macpro",
2079         [ALC885_MB5]            = "mb5",
2080         [ALC885_MACMINI3]       = "macmini3",
2081         [ALC885_MBA21]          = "mba21",
2082         [ALC885_MBP3]           = "mbp3",
2083         [ALC885_IMAC24]         = "imac24",
2084         [ALC885_IMAC91]         = "imac91",
2085         [ALC883_3ST_2ch_DIG]    = "3stack-2ch-dig",
2086         [ALC883_3ST_6ch_DIG]    = "3stack-6ch-dig",
2087         [ALC883_3ST_6ch]        = "3stack-6ch",
2088         [ALC883_6ST_DIG]        = "alc883-6stack-dig",
2089         [ALC883_TARGA_DIG]      = "targa-dig",
2090         [ALC883_TARGA_2ch_DIG]  = "targa-2ch-dig",
2091         [ALC883_TARGA_8ch_DIG]  = "targa-8ch-dig",
2092         [ALC883_ACER]           = "acer",
2093         [ALC883_ACER_ASPIRE]    = "acer-aspire",
2094         [ALC888_ACER_ASPIRE_4930G]      = "acer-aspire-4930g",
2095         [ALC888_ACER_ASPIRE_6530G]      = "acer-aspire-6530g",
2096         [ALC888_ACER_ASPIRE_8930G]      = "acer-aspire-8930g",
2097         [ALC888_ACER_ASPIRE_7730G]      = "acer-aspire-7730g",
2098         [ALC883_3ST_6ch_INTEL]  = "3stack-6ch-intel",
2099         [ALC889A_INTEL]         = "intel-alc889a",
2100         [ALC889_INTEL]          = "intel-x58",
2101         [ALC889A_MB31]          = "mb31",
2102         [ALC882_AUTO]           = "auto",
2103 };
2104
2105 static const struct snd_pci_quirk alc882_cfg_tbl[] = {
2106         SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
2107
2108         SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
2109         SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
2110         SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
2111         SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
2112         SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
2113         SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
2114         SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2115                 ALC888_ACER_ASPIRE_4930G),
2116         SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2117                 ALC888_ACER_ASPIRE_4930G),
2118         SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2119                 ALC888_ACER_ASPIRE_8930G),
2120         SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2121                 ALC888_ACER_ASPIRE_8930G),
2122         SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
2123         SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
2124         SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2125                 ALC888_ACER_ASPIRE_6530G),
2126         SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2127                 ALC888_ACER_ASPIRE_6530G),
2128         SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2129                 ALC888_ACER_ASPIRE_7730G),
2130         /* default Acer -- disabled as it causes more problems.
2131          *    model=auto should work fine now
2132          */
2133         /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
2134
2135         SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG),
2136         SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
2137
2138         SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
2139         SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
2140         SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
2141         SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
2142         SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
2143
2144         SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
2145         SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
2146         SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
2147         SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
2148
2149         SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
2150         SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
2151         SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
2152         SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8  */
2153         SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
2154         SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
2155         SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
2156         SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
2157         SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
2158         SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
2159         SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
2160         SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
2161         SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
2162         SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
2163         SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
2164         SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
2165         SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
2166         SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
2167         SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
2168         SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
2169         SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
2170         SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
2171         SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
2172         SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
2173         SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
2174         SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
2175         SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
2176         SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
2177         SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
2178         SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
2179         SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
2180
2181         SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
2182         SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
2183         SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
2184         SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
2185
2186         SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
2187         SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
2188         SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
2189         SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
2190         SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
2191         SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
2192
2193         {}
2194 };
2195
2196 /* codec SSID table for Intel Mac */
2197 static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
2198         SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
2199         SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
2200         SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
2201         SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
2202         SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
2203         SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
2204         SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
2205         SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
2206         SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
2207         SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
2208         SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
2209         SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
2210         SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
2211         SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
2212         SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
2213         SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
2214         /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
2215          * so apparently no perfect solution yet
2216          */
2217         SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
2218         SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
2219         SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
2220         {} /* terminator */
2221 };
2222
2223 static const struct alc_config_preset alc882_presets[] = {
2224         [ALC882_3ST_DIG] = {
2225                 .mixers = { alc882_base_mixer },
2226                 .init_verbs = { alc882_base_init_verbs,
2227                                 alc882_adc1_init_verbs },
2228                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2229                 .dac_nids = alc882_dac_nids,
2230                 .dig_out_nid = ALC882_DIGOUT_NID,
2231                 .dig_in_nid = ALC882_DIGIN_NID,
2232                 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
2233                 .channel_mode = alc882_ch_modes,
2234                 .need_dac_fix = 1,
2235                 .input_mux = &alc882_capture_source,
2236         },
2237         [ALC882_6ST_DIG] = {
2238                 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
2239                 .init_verbs = { alc882_base_init_verbs,
2240                                 alc882_adc1_init_verbs },
2241                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2242                 .dac_nids = alc882_dac_nids,
2243                 .dig_out_nid = ALC882_DIGOUT_NID,
2244                 .dig_in_nid = ALC882_DIGIN_NID,
2245                 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
2246                 .channel_mode = alc882_sixstack_modes,
2247                 .input_mux = &alc882_capture_source,
2248         },
2249         [ALC882_W2JC] = {
2250                 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
2251                 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
2252                                 alc882_eapd_verbs, alc880_gpio1_init_verbs },
2253                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2254                 .dac_nids = alc882_dac_nids,
2255                 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2256                 .channel_mode = alc880_threestack_modes,
2257                 .need_dac_fix = 1,
2258                 .input_mux = &alc882_capture_source,
2259                 .dig_out_nid = ALC882_DIGOUT_NID,
2260         },
2261            [ALC885_MBA21] = {
2262                         .mixers = { alc885_mba21_mixer },
2263                         .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
2264                         .num_dacs = 2,
2265                         .dac_nids = alc882_dac_nids,
2266                         .channel_mode = alc885_mba21_ch_modes,
2267                         .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
2268                         .input_mux = &alc882_capture_source,
2269                         .unsol_event = alc_sku_unsol_event,
2270                         .setup = alc885_mba21_setup,
2271                         .init_hook = alc_hp_automute,
2272        },
2273         [ALC885_MBP3] = {
2274                 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
2275                 .init_verbs = { alc885_mbp3_init_verbs,
2276                                 alc880_gpio1_init_verbs },
2277                 .num_dacs = 2,
2278                 .dac_nids = alc882_dac_nids,
2279                 .hp_nid = 0x04,
2280                 .channel_mode = alc885_mbp_4ch_modes,
2281                 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
2282                 .input_mux = &alc882_capture_source,
2283                 .dig_out_nid = ALC882_DIGOUT_NID,
2284                 .dig_in_nid = ALC882_DIGIN_NID,
2285                 .unsol_event = alc_sku_unsol_event,
2286                 .setup = alc885_mbp3_setup,
2287                 .init_hook = alc_hp_automute,
2288         },
2289         [ALC885_MB5] = {
2290                 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
2291                 .init_verbs = { alc885_mb5_init_verbs,
2292                                 alc880_gpio1_init_verbs },
2293                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2294                 .dac_nids = alc882_dac_nids,
2295                 .channel_mode = alc885_mb5_6ch_modes,
2296                 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
2297                 .input_mux = &mb5_capture_source,
2298                 .dig_out_nid = ALC882_DIGOUT_NID,
2299                 .dig_in_nid = ALC882_DIGIN_NID,
2300                 .unsol_event = alc_sku_unsol_event,
2301                 .setup = alc885_mb5_setup,
2302                 .init_hook = alc_hp_automute,
2303         },
2304         [ALC885_MACMINI3] = {
2305                 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
2306                 .init_verbs = { alc885_macmini3_init_verbs,
2307                                 alc880_gpio1_init_verbs },
2308                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2309                 .dac_nids = alc882_dac_nids,
2310                 .channel_mode = alc885_macmini3_6ch_modes,
2311                 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
2312                 .input_mux = &macmini3_capture_source,
2313                 .dig_out_nid = ALC882_DIGOUT_NID,
2314                 .dig_in_nid = ALC882_DIGIN_NID,
2315                 .unsol_event = alc_sku_unsol_event,
2316                 .setup = alc885_macmini3_setup,
2317                 .init_hook = alc_hp_automute,
2318         },
2319         [ALC885_MACPRO] = {
2320                 .mixers = { alc882_macpro_mixer },
2321                 .init_verbs = { alc882_macpro_init_verbs },
2322                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2323                 .dac_nids = alc882_dac_nids,
2324                 .dig_out_nid = ALC882_DIGOUT_NID,
2325                 .dig_in_nid = ALC882_DIGIN_NID,
2326                 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
2327                 .channel_mode = alc882_ch_modes,
2328                 .input_mux = &alc882_capture_source,
2329                 .init_hook = alc885_macpro_init_hook,
2330         },
2331         [ALC885_IMAC24] = {
2332                 .mixers = { alc885_imac24_mixer },
2333                 .init_verbs = { alc885_imac24_init_verbs },
2334                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2335                 .dac_nids = alc882_dac_nids,
2336                 .dig_out_nid = ALC882_DIGOUT_NID,
2337                 .dig_in_nid = ALC882_DIGIN_NID,
2338                 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
2339                 .channel_mode = alc882_ch_modes,
2340                 .input_mux = &alc882_capture_source,
2341                 .unsol_event = alc_sku_unsol_event,
2342                 .setup = alc885_imac24_setup,
2343                 .init_hook = alc885_imac24_init_hook,
2344         },
2345         [ALC885_IMAC91] = {
2346                 .mixers = {alc885_imac91_mixer},
2347                 .init_verbs = { alc885_imac91_init_verbs,
2348                                 alc880_gpio1_init_verbs },
2349                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2350                 .dac_nids = alc882_dac_nids,
2351                 .channel_mode = alc885_mba21_ch_modes,
2352                 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
2353                 .input_mux = &alc889A_imac91_capture_source,
2354                 .dig_out_nid = ALC882_DIGOUT_NID,
2355                 .dig_in_nid = ALC882_DIGIN_NID,
2356                 .unsol_event = alc_sku_unsol_event,
2357                 .setup = alc885_imac91_setup,
2358                 .init_hook = alc_hp_automute,
2359         },
2360         [ALC882_TARGA] = {
2361                 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
2362                 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
2363                                 alc880_gpio3_init_verbs, alc882_targa_verbs},
2364                 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2365                 .dac_nids = alc882_dac_nids,
2366                 .dig_out_nid = ALC882_DIGOUT_NID,
2367                 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
2368                 .adc_nids = alc882_adc_nids,
2369                 .capsrc_nids = alc882_capsrc_nids,
2370                 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
2371                 .channel_mode = alc882_3ST_6ch_modes,
2372                 .need_dac_fix = 1,
2373                 .input_mux = &alc882_capture_source,
2374                 .unsol_event = alc_sku_unsol_event,
2375                 .setup = alc882_targa_setup,
2376                 .init_hook = alc882_targa_automute,
2377         },
2378         [ALC883_3ST_2ch_DIG] = {
2379                 .mixers = { alc883_3ST_2ch_mixer },
2380                 .init_verbs = { alc883_init_verbs },
2381                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2382                 .dac_nids = alc883_dac_nids,
2383                 .dig_out_nid = ALC883_DIGOUT_NID,
2384                 .dig_in_nid = ALC883_DIGIN_NID,
2385                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
2386                 .channel_mode = alc883_3ST_2ch_modes,
2387                 .input_mux = &alc883_capture_source,
2388         },
2389         [ALC883_3ST_6ch_DIG] = {
2390                 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
2391                 .init_verbs = { alc883_init_verbs },
2392                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2393                 .dac_nids = alc883_dac_nids,
2394                 .dig_out_nid = ALC883_DIGOUT_NID,
2395                 .dig_in_nid = ALC883_DIGIN_NID,
2396                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
2397                 .channel_mode = alc883_3ST_6ch_modes,
2398                 .need_dac_fix = 1,
2399                 .input_mux = &alc883_capture_source,
2400         },
2401         [ALC883_3ST_6ch] = {
2402                 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
2403                 .init_verbs = { alc883_init_verbs },
2404                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2405                 .dac_nids = alc883_dac_nids,
2406                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
2407                 .channel_mode = alc883_3ST_6ch_modes,
2408                 .need_dac_fix = 1,
2409                 .input_mux = &alc883_capture_source,
2410         },
2411         [ALC883_3ST_6ch_INTEL] = {
2412                 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
2413                 .init_verbs = { alc883_init_verbs },
2414                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2415                 .dac_nids = alc883_dac_nids,
2416                 .dig_out_nid = ALC883_DIGOUT_NID,
2417                 .dig_in_nid = ALC883_DIGIN_NID,
2418                 .slave_dig_outs = alc883_slave_dig_outs,
2419                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
2420                 .channel_mode = alc883_3ST_6ch_intel_modes,
2421                 .need_dac_fix = 1,
2422                 .input_mux = &alc883_3stack_6ch_intel,
2423         },
2424         [ALC889A_INTEL] = {
2425                 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
2426                 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
2427                                 alc_hp15_unsol_verbs },
2428                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2429                 .dac_nids = alc883_dac_nids,
2430                 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
2431                 .adc_nids = alc889_adc_nids,
2432                 .dig_out_nid = ALC883_DIGOUT_NID,
2433                 .dig_in_nid = ALC883_DIGIN_NID,
2434                 .slave_dig_outs = alc883_slave_dig_outs,
2435                 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
2436                 .channel_mode = alc889_8ch_intel_modes,
2437                 .capsrc_nids = alc889_capsrc_nids,
2438                 .input_mux = &alc889_capture_source,
2439                 .setup = alc889_automute_setup,
2440                 .init_hook = alc_hp_automute,
2441                 .unsol_event = alc_sku_unsol_event,
2442                 .need_dac_fix = 1,
2443         },
2444         [ALC889_INTEL] = {
2445                 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
2446                 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
2447                                 alc889_eapd_verbs, alc_hp15_unsol_verbs},
2448                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2449                 .dac_nids = alc883_dac_nids,
2450                 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
2451                 .adc_nids = alc889_adc_nids,
2452                 .dig_out_nid = ALC883_DIGOUT_NID,
2453                 .dig_in_nid = ALC883_DIGIN_NID,
2454                 .slave_dig_outs = alc883_slave_dig_outs,
2455                 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
2456                 .channel_mode = alc889_8ch_intel_modes,
2457                 .capsrc_nids = alc889_capsrc_nids,
2458                 .input_mux = &alc889_capture_source,
2459                 .setup = alc889_automute_setup,
2460                 .init_hook = alc889_intel_init_hook,
2461                 .unsol_event = alc_sku_unsol_event,
2462                 .need_dac_fix = 1,
2463         },
2464         [ALC883_6ST_DIG] = {
2465                 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
2466                 .init_verbs = { alc883_init_verbs },
2467                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2468                 .dac_nids = alc883_dac_nids,
2469                 .dig_out_nid = ALC883_DIGOUT_NID,
2470                 .dig_in_nid = ALC883_DIGIN_NID,
2471                 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
2472                 .channel_mode = alc883_sixstack_modes,
2473                 .input_mux = &alc883_capture_source,
2474         },
2475         [ALC883_TARGA_DIG] = {
2476                 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
2477                 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
2478                                 alc883_targa_verbs},
2479                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2480                 .dac_nids = alc883_dac_nids,
2481                 .dig_out_nid = ALC883_DIGOUT_NID,
2482                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
2483                 .channel_mode = alc883_3ST_6ch_modes,
2484                 .need_dac_fix = 1,
2485                 .input_mux = &alc883_capture_source,
2486                 .unsol_event = alc883_targa_unsol_event,
2487                 .setup = alc882_targa_setup,
2488                 .init_hook = alc882_targa_automute,
2489         },
2490         [ALC883_TARGA_2ch_DIG] = {
2491                 .mixers = { alc883_targa_2ch_mixer},
2492                 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
2493                                 alc883_targa_verbs},
2494                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2495                 .dac_nids = alc883_dac_nids,
2496                 .adc_nids = alc883_adc_nids_alt,
2497                 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
2498                 .capsrc_nids = alc883_capsrc_nids,
2499                 .dig_out_nid = ALC883_DIGOUT_NID,
2500                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
2501                 .channel_mode = alc883_3ST_2ch_modes,
2502                 .input_mux = &alc883_capture_source,
2503                 .unsol_event = alc883_targa_unsol_event,
2504                 .setup = alc882_targa_setup,
2505                 .init_hook = alc882_targa_automute,
2506         },
2507         [ALC883_TARGA_8ch_DIG] = {
2508                 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
2509                             alc883_chmode_mixer },
2510                 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
2511                                 alc883_targa_verbs },
2512                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2513                 .dac_nids = alc883_dac_nids,
2514                 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
2515                 .adc_nids = alc883_adc_nids_rev,
2516                 .capsrc_nids = alc883_capsrc_nids_rev,
2517                 .dig_out_nid = ALC883_DIGOUT_NID,
2518                 .dig_in_nid = ALC883_DIGIN_NID,
2519                 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
2520                 .channel_mode = alc883_4ST_8ch_modes,
2521                 .need_dac_fix = 1,
2522                 .input_mux = &alc883_capture_source,
2523                 .unsol_event = alc883_targa_unsol_event,
2524                 .setup = alc882_targa_setup,
2525                 .init_hook = alc882_targa_automute,
2526         },
2527         [ALC883_ACER] = {
2528                 .mixers = { alc883_base_mixer },
2529                 /* On TravelMate laptops, GPIO 0 enables the internal speaker
2530                  * and the headphone jack.  Turn this on and rely on the
2531                  * standard mute methods whenever the user wants to turn
2532                  * these outputs off.
2533                  */
2534                 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
2535                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2536                 .dac_nids = alc883_dac_nids,
2537                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
2538                 .channel_mode = alc883_3ST_2ch_modes,
2539                 .input_mux = &alc883_capture_source,
2540         },
2541         [ALC883_ACER_ASPIRE] = {
2542                 .mixers = { alc883_acer_aspire_mixer },
2543                 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
2544                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2545                 .dac_nids = alc883_dac_nids,
2546                 .dig_out_nid = ALC883_DIGOUT_NID,
2547                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
2548                 .channel_mode = alc883_3ST_2ch_modes,
2549                 .input_mux = &alc883_capture_source,
2550                 .unsol_event = alc_sku_unsol_event,
2551                 .setup = alc883_acer_aspire_setup,
2552                 .init_hook = alc_hp_automute,
2553         },
2554         [ALC888_ACER_ASPIRE_4930G] = {
2555                 .mixers = { alc888_acer_aspire_4930g_mixer,
2556                                 alc883_chmode_mixer },
2557                 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
2558                                 alc888_acer_aspire_4930g_verbs },
2559                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2560                 .dac_nids = alc883_dac_nids,
2561                 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
2562                 .adc_nids = alc883_adc_nids_rev,
2563                 .capsrc_nids = alc883_capsrc_nids_rev,
2564                 .dig_out_nid = ALC883_DIGOUT_NID,
2565                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
2566                 .channel_mode = alc883_3ST_6ch_modes,
2567                 .need_dac_fix = 1,
2568                 .const_channel_count = 6,
2569                 .num_mux_defs =
2570                         ARRAY_SIZE(alc888_2_capture_sources),
2571                 .input_mux = alc888_2_capture_sources,
2572                 .unsol_event = alc_sku_unsol_event,
2573                 .setup = alc888_acer_aspire_4930g_setup,
2574                 .init_hook = alc_hp_automute,
2575         },
2576         [ALC888_ACER_ASPIRE_6530G] = {
2577                 .mixers = { alc888_acer_aspire_6530_mixer },
2578                 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
2579                                 alc888_acer_aspire_6530g_verbs },
2580                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2581                 .dac_nids = alc883_dac_nids,
2582                 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
2583                 .adc_nids = alc883_adc_nids_rev,
2584                 .capsrc_nids = alc883_capsrc_nids_rev,
2585                 .dig_out_nid = ALC883_DIGOUT_NID,
2586                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
2587                 .channel_mode = alc883_3ST_2ch_modes,
2588                 .num_mux_defs =
2589                         ARRAY_SIZE(alc888_2_capture_sources),
2590                 .input_mux = alc888_acer_aspire_6530_sources,
2591                 .unsol_event = alc_sku_unsol_event,
2592                 .setup = alc888_acer_aspire_6530g_setup,
2593                 .init_hook = alc_hp_automute,
2594         },
2595         [ALC888_ACER_ASPIRE_8930G] = {
2596                 .mixers = { alc889_acer_aspire_8930g_mixer,
2597                                 alc883_chmode_mixer },
2598                 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
2599                                 alc889_acer_aspire_8930g_verbs,
2600                                 alc889_eapd_verbs},
2601                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2602                 .dac_nids = alc883_dac_nids,
2603                 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
2604                 .adc_nids = alc889_adc_nids,
2605                 .capsrc_nids = alc889_capsrc_nids,
2606                 .dig_out_nid = ALC883_DIGOUT_NID,
2607                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
2608                 .channel_mode = alc883_3ST_6ch_modes,
2609                 .need_dac_fix = 1,
2610                 .const_channel_count = 6,
2611                 .num_mux_defs =
2612                         ARRAY_SIZE(alc889_capture_sources),
2613                 .input_mux = alc889_capture_sources,
2614                 .unsol_event = alc_sku_unsol_event,
2615                 .setup = alc889_acer_aspire_8930g_setup,
2616                 .init_hook = alc_hp_automute,
2617 #ifdef CONFIG_SND_HDA_POWER_SAVE
2618                 .power_hook = alc_power_eapd,
2619 #endif
2620         },
2621         [ALC888_ACER_ASPIRE_7730G] = {
2622                 .mixers = { alc883_3ST_6ch_mixer,
2623                                 alc883_chmode_mixer },
2624                 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
2625                                 alc888_acer_aspire_7730G_verbs },
2626                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2627                 .dac_nids = alc883_dac_nids,
2628                 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
2629                 .adc_nids = alc883_adc_nids_rev,
2630                 .capsrc_nids = alc883_capsrc_nids_rev,
2631                 .dig_out_nid = ALC883_DIGOUT_NID,
2632                 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
2633                 .channel_mode = alc883_3ST_6ch_modes,
2634                 .need_dac_fix = 1,
2635                 .const_channel_count = 6,
2636                 .input_mux = &alc883_capture_source,
2637                 .unsol_event = alc_sku_unsol_event,
2638                 .setup = alc888_acer_aspire_7730g_setup,
2639                 .init_hook = alc_hp_automute,
2640         },
2641         [ALC889A_MB31] = {
2642                 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
2643                 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
2644                         alc880_gpio1_init_verbs },
2645                 .adc_nids = alc883_adc_nids,
2646                 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
2647                 .capsrc_nids = alc883_capsrc_nids,
2648                 .dac_nids = alc883_dac_nids,
2649                 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
2650                 .channel_mode = alc889A_mb31_6ch_modes,
2651                 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
2652                 .input_mux = &alc889A_mb31_capture_source,
2653                 .dig_out_nid = ALC883_DIGOUT_NID,
2654                 .unsol_event = alc889A_mb31_unsol_event,
2655                 .init_hook = alc889A_mb31_automute,
2656         },
2657 };
2658
2659