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