aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/alc882_quirks.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/alc882_quirks.c')
-rw-r--r--sound/pci/hda/alc882_quirks.c874
1 files changed, 0 insertions, 874 deletions
diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c
deleted file mode 100644
index 0f4292688e18..000000000000
--- a/sound/pci/hda/alc882_quirks.c
+++ /dev/null
@@ -1,874 +0,0 @@
1/*
2 * ALC882/ALC883/ALC888/ALC889 quirk models
3 * included by patch_realtek.c
4 */
5
6/* ALC882 models */
7enum {
8 ALC882_AUTO,
9 ALC885_MBA21,
10 ALC885_MBP3,
11 ALC885_MB5,
12 ALC885_MACMINI3,
13 ALC885_IMAC91,
14 ALC889A_MB31,
15 ALC882_MODEL_LAST,
16};
17
18#define ALC882_DIGOUT_NID 0x06
19#define ALC882_DIGIN_NID 0x0a
20#define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
21#define ALC883_DIGIN_NID ALC882_DIGIN_NID
22#define ALC1200_DIGOUT_NID 0x10
23
24
25static const struct hda_channel_mode alc882_ch_modes[1] = {
26 { 8, NULL }
27};
28
29/* DACs */
30static const hda_nid_t alc882_dac_nids[4] = {
31 /* front, rear, clfe, rear_surr */
32 0x02, 0x03, 0x04, 0x05
33};
34#define alc883_dac_nids alc882_dac_nids
35
36/* ADCs */
37static const hda_nid_t alc882_adc_nids[3] = {
38 /* ADC0-2 */
39 0x07, 0x08, 0x09,
40};
41
42static const hda_nid_t alc882_adc_nids_alt[2] = {
43 /* ADC1-2 */
44 0x08, 0x09,
45};
46
47#define alc883_adc_nids alc882_adc_nids_alt
48
49static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
50#define alc883_capsrc_nids alc882_capsrc_nids_alt
51
52/* input MUX */
53/* FIXME: should be a matrix-type input source selection */
54
55static const struct hda_input_mux alc882_capture_source = {
56 .num_items = 4,
57 .items = {
58 { "Mic", 0x0 },
59 { "Front Mic", 0x1 },
60 { "Line", 0x2 },
61 { "CD", 0x4 },
62 },
63};
64
65#define alc883_capture_source alc882_capture_source
66
67static const struct hda_input_mux mb5_capture_source = {
68 .num_items = 3,
69 .items = {
70 { "Mic", 0x1 },
71 { "Line", 0x7 },
72 { "CD", 0x4 },
73 },
74};
75
76static const struct hda_input_mux macmini3_capture_source = {
77 .num_items = 2,
78 .items = {
79 { "Line", 0x2 },
80 { "CD", 0x4 },
81 },
82};
83
84static const struct hda_input_mux alc883_3stack_6ch_intel = {
85 .num_items = 4,
86 .items = {
87 { "Mic", 0x1 },
88 { "Front Mic", 0x0 },
89 { "Line", 0x2 },
90 { "CD", 0x4 },
91 },
92};
93
94static const struct hda_input_mux alc889A_mb31_capture_source = {
95 .num_items = 2,
96 .items = {
97 { "Mic", 0x0 },
98 /* Front Mic (0x01) unused */
99 { "Line", 0x2 },
100 /* Line 2 (0x03) unused */
101 /* CD (0x04) unused? */
102 },
103};
104
105static const struct hda_input_mux alc889A_imac91_capture_source = {
106 .num_items = 2,
107 .items = {
108 { "Mic", 0x01 },
109 { "Line", 0x2 }, /* Not sure! */
110 },
111};
112
113/* Macbook Air 2,1 */
114
115static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
116 { 2, NULL },
117};
118
119/*
120 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
121 */
122
123/*
124 * 2ch mode
125 */
126static const struct hda_verb alc885_mbp_ch2_init[] = {
127 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
128 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
129 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
130 { } /* end */
131};
132
133/*
134 * 4ch mode
135 */
136static const struct hda_verb alc885_mbp_ch4_init[] = {
137 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
138 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
139 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
140 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
141 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
142 { } /* end */
143};
144
145static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
146 { 2, alc885_mbp_ch2_init },
147 { 4, alc885_mbp_ch4_init },
148};
149
150/*
151 * 2ch
152 * Speakers/Woofer/HP = Front
153 * LineIn = Input
154 */
155static const struct hda_verb alc885_mb5_ch2_init[] = {
156 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
157 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
158 { } /* end */
159};
160
161/*
162 * 6ch mode
163 * Speakers/HP = Front
164 * Woofer = LFE
165 * LineIn = Surround
166 */
167static const struct hda_verb alc885_mb5_ch6_init[] = {
168 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
169 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
170 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
171 { } /* end */
172};
173
174static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
175 { 2, alc885_mb5_ch2_init },
176 { 6, alc885_mb5_ch6_init },
177};
178
179#define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
180
181/* Macbook Air 2,1 same control for HP and internal Speaker */
182
183static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
184 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
185 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
186 { }
187};
188
189
190static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
191 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
192 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
193 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
194 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
195 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
196 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
197 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
199 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
200 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
201 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
202 { } /* end */
203};
204
205static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
206 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
207 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
208 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
209 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
210 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
211 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
212 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
213 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
214 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
215 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
217 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
218 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
219 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
220 { } /* end */
221};
222
223static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
225 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
226 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
227 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
228 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
229 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
231 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
232 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
233 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
234 HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
235 { } /* end */
236};
237
238static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
239 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
240 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
241 { } /* end */
242};
243
244
245static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
246 {
247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
248 .name = "Channel Mode",
249 .info = alc_ch_mode_info,
250 .get = alc_ch_mode_get,
251 .put = alc_ch_mode_put,
252 },
253 { } /* end */
254};
255
256static const struct hda_verb alc882_base_init_verbs[] = {
257 /* Front mixer: unmute input/output amp left and right (volume = 0) */
258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
260 /* Rear mixer */
261 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
263 /* CLFE mixer */
264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
266 /* Side mixer */
267 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
268 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
269
270 /* Front Pin: output 0 (0x0c) */
271 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
272 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
273 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
274 /* Rear Pin: output 1 (0x0d) */
275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
277 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
278 /* CLFE Pin: output 2 (0x0e) */
279 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
280 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
281 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
282 /* Side Pin: output 3 (0x0f) */
283 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
284 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
285 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
286 /* Mic (rear) pin: input vref at 80% */
287 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
288 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
289 /* Front Mic pin: input vref at 80% */
290 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
291 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
292 /* Line In pin: input */
293 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
294 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
295 /* Line-2 In: Headphone output (output 0 - 0x0c) */
296 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
297 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
298 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
299 /* CD pin widget for input */
300 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
301
302 /* FIXME: use matrix-type input source selection */
303 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
304 /* Input mixer2 */
305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
306 /* Input mixer3 */
307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
308 /* ADC2: mute amp left and right */
309 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
310 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
311 /* ADC3: mute amp left and right */
312 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
313 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
314
315 { }
316};
317
318#define alc883_init_verbs alc882_base_init_verbs
319
320/* Macbook 5,1 */
321static const struct hda_verb alc885_mb5_init_verbs[] = {
322 /* DACs */
323 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
324 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
325 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
326 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
327 /* Front mixer */
328 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
329 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
331 /* Surround mixer */
332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
333 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
335 /* LFE mixer */
336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
339 /* HP mixer */
340 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
341 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
342 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
343 /* Front Pin (0x0c) */
344 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
345 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
346 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
347 /* LFE Pin (0x0e) */
348 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
349 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
350 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
351 /* HP Pin (0x0f) */
352 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
353 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
354 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
355 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
356 /* Front Mic pin: input vref at 80% */
357 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
358 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
359 /* Line In pin */
360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
361 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
362
363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
366 { }
367};
368
369/* Macmini 3,1 */
370static const struct hda_verb alc885_macmini3_init_verbs[] = {
371 /* DACs */
372 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
373 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
374 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
375 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
376 /* Front mixer */
377 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
378 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
380 /* Surround mixer */
381 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
382 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
383 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
384 /* LFE mixer */
385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
387 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
388 /* HP mixer */
389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
390 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
391 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
392 /* Front Pin (0x0c) */
393 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
394 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
395 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
396 /* LFE Pin (0x0e) */
397 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
398 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
399 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
400 /* HP Pin (0x0f) */
401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
402 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
403 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
404 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
405 /* Line In pin */
406 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
407 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
408
409 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
410 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
411 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
412 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
413 { }
414};
415
416
417static const struct hda_verb alc885_mba21_init_verbs[] = {
418 /*Internal and HP Speaker Mixer*/
419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
421 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
422 /*Internal Speaker Pin (0x0c)*/
423 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
424 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
425 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
426 /* HP Pin: output 0 (0x0e) */
427 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
428 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
429 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
430 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC_HP_EVENT | AC_USRSP_EN)},
431 /* Line in (is hp when jack connected)*/
432 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
433 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
434
435 { }
436 };
437
438
439/* Macbook Pro rev3 */
440static const struct hda_verb alc885_mbp3_init_verbs[] = {
441 /* Front mixer: unmute input/output amp left and right (volume = 0) */
442 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
443 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
444 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
445 /* Rear mixer */
446 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
447 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
448 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
449 /* HP mixer */
450 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
451 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
452 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
453 /* Front Pin: output 0 (0x0c) */
454 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
455 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
456 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
457 /* HP Pin: output 0 (0x0e) */
458 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
459 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
461 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
462 /* Mic (rear) pin: input vref at 80% */
463 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
464 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
465 /* Front Mic pin: input vref at 80% */
466 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
467 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
468 /* Line In pin: use output 1 when in LineOut mode */
469 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
470 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
471 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
472
473 /* FIXME: use matrix-type input source selection */
474 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
475 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
476 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
477 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
478 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
480 /* Input mixer2 */
481 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
482 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
483 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
485 /* Input mixer3 */
486 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
487 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
490 /* ADC1: mute amp left and right */
491 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
492 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
493 /* ADC2: mute amp left and right */
494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
495 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
496 /* ADC3: mute amp left and right */
497 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
498 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
499
500 { }
501};
502
503/* iMac 9,1 */
504static const struct hda_verb alc885_imac91_init_verbs[] = {
505 /* Internal Speaker Pin (0x0c) */
506 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
507 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
508 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
509 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
510 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
511 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
512 /* HP Pin: Rear */
513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
515 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
516 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC_HP_EVENT | AC_USRSP_EN)},
517 /* Line in Rear */
518 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
519 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
520 /* Front Mic pin: input vref at 80% */
521 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
522 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
523 /* Rear mixer */
524 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
526 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
527 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
531 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
536 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
537 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
538 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
540 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
541 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
542 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
544 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
545 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
546 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
548 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
549 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
550 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
551 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
552 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
554 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
555 { }
556};
557
558/* Toggle speaker-output according to the hp-jack state */
559static void alc885_imac24_setup(struct hda_codec *codec)
560{
561 struct alc_spec *spec = codec->spec;
562
563 spec->autocfg.hp_pins[0] = 0x14;
564 spec->autocfg.speaker_pins[0] = 0x18;
565 spec->autocfg.speaker_pins[1] = 0x1a;
566 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
567}
568
569#define alc885_mb5_setup alc885_imac24_setup
570#define alc885_macmini3_setup alc885_imac24_setup
571
572/* Macbook Air 2,1 */
573static void alc885_mba21_setup(struct hda_codec *codec)
574{
575 struct alc_spec *spec = codec->spec;
576
577 spec->autocfg.hp_pins[0] = 0x14;
578 spec->autocfg.speaker_pins[0] = 0x18;
579 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
580}
581
582
583
584static void alc885_mbp3_setup(struct hda_codec *codec)
585{
586 struct alc_spec *spec = codec->spec;
587
588 spec->autocfg.hp_pins[0] = 0x15;
589 spec->autocfg.speaker_pins[0] = 0x14;
590 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
591}
592
593static void alc885_imac91_setup(struct hda_codec *codec)
594{
595 struct alc_spec *spec = codec->spec;
596
597 spec->autocfg.hp_pins[0] = 0x14;
598 spec->autocfg.speaker_pins[0] = 0x18;
599 spec->autocfg.speaker_pins[1] = 0x1a;
600 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
601}
602
603/* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
604static const struct hda_verb alc889A_mb31_ch2_init[] = {
605 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
606 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
607 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
608 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
609 { } /* end */
610};
611
612/* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
613static const struct hda_verb alc889A_mb31_ch4_init[] = {
614 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
615 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
616 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
617 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
618 { } /* end */
619};
620
621/* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
622static const struct hda_verb alc889A_mb31_ch5_init[] = {
623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
624 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
625 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
626 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
627 { } /* end */
628};
629
630/* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
631static const struct hda_verb alc889A_mb31_ch6_init[] = {
632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
633 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
634 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
635 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
636 { } /* end */
637};
638
639static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
640 { 2, alc889A_mb31_ch2_init },
641 { 4, alc889A_mb31_ch4_init },
642 { 5, alc889A_mb31_ch5_init },
643 { 6, alc889A_mb31_ch6_init },
644};
645
646static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
647 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
648 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
649 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
650 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
651 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
652 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
653 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
654 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
656 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
657 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
658 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
659 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
660 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
661 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
662 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
663 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
664 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
665 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
666 { } /* end */
667};
668
669static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
670 /* Output mixers */
671 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
672 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
673 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
674 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
675 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
676 HDA_OUTPUT),
677 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
678 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
679 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
680 /* Output switches */
681 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
682 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
683 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
684 /* Boost mixers */
685 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
686 HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
687 /* Input mixers */
688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
690 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
691 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
692 { } /* end */
693};
694
695static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
696 {
697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
698 .name = "Channel Mode",
699 .info = alc_ch_mode_info,
700 .get = alc_ch_mode_get,
701 .put = alc_ch_mode_put,
702 },
703 { } /* end */
704};
705
706static const struct hda_verb alc889A_mb31_verbs[] = {
707 /* Init rear pin (used as headphone output) */
708 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
709 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
710 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
711 /* Init line pin (used as output in 4ch and 6ch mode) */
712 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
713 /* Init line 2 pin (used as headphone out by default) */
714 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
715 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
716 { } /* end */
717};
718
719/* Mute speakers according to the headphone jack state */
720static void alc889A_mb31_automute(struct hda_codec *codec)
721{
722 unsigned int present;
723
724 /* Mute only in 2ch or 4ch mode */
725 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
726 == 0x00) {
727 present = snd_hda_jack_detect(codec, 0x15);
728 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
729 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
730 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
731 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
732 }
733}
734
735static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
736{
737 if ((res >> 26) == ALC_HP_EVENT)
738 alc889A_mb31_automute(codec);
739}
740
741static void alc882_unsol_event(struct hda_codec *codec, unsigned int res)
742{
743 alc_exec_unsol_event(codec, res >> 26);
744}
745
746/*
747 * configuration and preset
748 */
749static const char * const alc882_models[ALC882_MODEL_LAST] = {
750 [ALC885_MB5] = "mb5",
751 [ALC885_MACMINI3] = "macmini3",
752 [ALC885_MBA21] = "mba21",
753 [ALC885_MBP3] = "mbp3",
754 [ALC885_IMAC91] = "imac91",
755 [ALC889A_MB31] = "mb31",
756 [ALC882_AUTO] = "auto",
757};
758
759/* codec SSID table for Intel Mac */
760static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
761 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
762 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
763 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
764 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
765 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
766 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
767 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
768 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
769 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
770 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
771 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
772 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
773 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
774 * so apparently no perfect solution yet
775 */
776 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
777 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
778 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
779 {} /* terminator */
780};
781
782static const struct alc_config_preset alc882_presets[] = {
783 [ALC885_MBA21] = {
784 .mixers = { alc885_mba21_mixer },
785 .init_verbs = { alc885_mba21_init_verbs, alc_gpio1_init_verbs },
786 .num_dacs = 2,
787 .dac_nids = alc882_dac_nids,
788 .channel_mode = alc885_mba21_ch_modes,
789 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
790 .input_mux = &alc882_capture_source,
791 .unsol_event = alc882_unsol_event,
792 .setup = alc885_mba21_setup,
793 .init_hook = alc_hp_automute,
794 },
795 [ALC885_MBP3] = {
796 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
797 .init_verbs = { alc885_mbp3_init_verbs,
798 alc_gpio1_init_verbs },
799 .num_dacs = 2,
800 .dac_nids = alc882_dac_nids,
801 .hp_nid = 0x04,
802 .channel_mode = alc885_mbp_4ch_modes,
803 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
804 .input_mux = &alc882_capture_source,
805 .dig_out_nid = ALC882_DIGOUT_NID,
806 .dig_in_nid = ALC882_DIGIN_NID,
807 .unsol_event = alc882_unsol_event,
808 .setup = alc885_mbp3_setup,
809 .init_hook = alc_hp_automute,
810 },
811 [ALC885_MB5] = {
812 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
813 .init_verbs = { alc885_mb5_init_verbs,
814 alc_gpio1_init_verbs },
815 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
816 .dac_nids = alc882_dac_nids,
817 .channel_mode = alc885_mb5_6ch_modes,
818 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
819 .input_mux = &mb5_capture_source,
820 .dig_out_nid = ALC882_DIGOUT_NID,
821 .dig_in_nid = ALC882_DIGIN_NID,
822 .unsol_event = alc882_unsol_event,
823 .setup = alc885_mb5_setup,
824 .init_hook = alc_hp_automute,
825 },
826 [ALC885_MACMINI3] = {
827 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
828 .init_verbs = { alc885_macmini3_init_verbs,
829 alc_gpio1_init_verbs },
830 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
831 .dac_nids = alc882_dac_nids,
832 .channel_mode = alc885_macmini3_6ch_modes,
833 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
834 .input_mux = &macmini3_capture_source,
835 .dig_out_nid = ALC882_DIGOUT_NID,
836 .dig_in_nid = ALC882_DIGIN_NID,
837 .unsol_event = alc882_unsol_event,
838 .setup = alc885_macmini3_setup,
839 .init_hook = alc_hp_automute,
840 },
841 [ALC885_IMAC91] = {
842 .mixers = {alc885_imac91_mixer},
843 .init_verbs = { alc885_imac91_init_verbs,
844 alc_gpio1_init_verbs },
845 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
846 .dac_nids = alc882_dac_nids,
847 .channel_mode = alc885_mba21_ch_modes,
848 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
849 .input_mux = &alc889A_imac91_capture_source,
850 .dig_out_nid = ALC882_DIGOUT_NID,
851 .dig_in_nid = ALC882_DIGIN_NID,
852 .unsol_event = alc882_unsol_event,
853 .setup = alc885_imac91_setup,
854 .init_hook = alc_hp_automute,
855 },
856 [ALC889A_MB31] = {
857 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
858 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
859 alc_gpio1_init_verbs },
860 .adc_nids = alc883_adc_nids,
861 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
862 .capsrc_nids = alc883_capsrc_nids,
863 .dac_nids = alc883_dac_nids,
864 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
865 .channel_mode = alc889A_mb31_6ch_modes,
866 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
867 .input_mux = &alc889A_mb31_capture_source,
868 .dig_out_nid = ALC883_DIGOUT_NID,
869 .unsol_event = alc889A_mb31_unsol_event,
870 .init_hook = alc889A_mb31_automute,
871 },
872};
873
874