aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/alc882_quirks.c874
-rw-r--r--sound/pci/hda/alc_quirks.c167
-rw-r--r--sound/pci/hda/patch_realtek.c143
3 files changed, 92 insertions, 1092 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
diff --git a/sound/pci/hda/alc_quirks.c b/sound/pci/hda/alc_quirks.c
deleted file mode 100644
index a63a517780d6..000000000000
--- a/sound/pci/hda/alc_quirks.c
+++ /dev/null
@@ -1,167 +0,0 @@
1/*
2 * Common codes for Realtek codec quirks
3 * included by patch_realtek.c
4 */
5
6/*
7 * configuration template - to be copied to the spec instance
8 */
9struct alc_config_preset {
10 const struct snd_kcontrol_new *mixers[5]; /* should be identical size
11 * with spec
12 */
13 const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
14 const struct hda_verb *init_verbs[5];
15 unsigned int num_dacs;
16 const hda_nid_t *dac_nids;
17 hda_nid_t dig_out_nid; /* optional */
18 hda_nid_t hp_nid; /* optional */
19 const hda_nid_t *slave_dig_outs;
20 unsigned int num_adc_nids;
21 const hda_nid_t *adc_nids;
22 const hda_nid_t *capsrc_nids;
23 hda_nid_t dig_in_nid;
24 unsigned int num_channel_mode;
25 const struct hda_channel_mode *channel_mode;
26 int need_dac_fix;
27 int const_channel_count;
28 unsigned int num_mux_defs;
29 const struct hda_input_mux *input_mux;
30 void (*unsol_event)(struct hda_codec *, unsigned int);
31 void (*setup)(struct hda_codec *);
32 void (*init_hook)(struct hda_codec *);
33#ifdef CONFIG_SND_HDA_POWER_SAVE
34 const struct hda_amp_list *loopbacks;
35 void (*power_hook)(struct hda_codec *codec);
36#endif
37};
38
39/*
40 * channel mode setting
41 */
42static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
43 struct snd_ctl_elem_info *uinfo)
44{
45 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
46 struct alc_spec *spec = codec->spec;
47 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
48 spec->num_channel_mode);
49}
50
51static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
52 struct snd_ctl_elem_value *ucontrol)
53{
54 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
55 struct alc_spec *spec = codec->spec;
56 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
57 spec->num_channel_mode,
58 spec->ext_channel_count);
59}
60
61static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
62 struct snd_ctl_elem_value *ucontrol)
63{
64 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
65 struct alc_spec *spec = codec->spec;
66 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
67 spec->num_channel_mode,
68 &spec->ext_channel_count);
69 if (err >= 0 && !spec->const_channel_count) {
70 spec->multiout.max_channels = spec->ext_channel_count;
71 if (spec->need_dac_fix)
72 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
73 }
74 return err;
75}
76
77static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
78{
79 struct alc_spec *spec = codec->spec;
80 struct auto_pin_cfg *cfg = &spec->autocfg;
81
82 if (!cfg->line_outs) {
83 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
84 cfg->line_out_pins[cfg->line_outs])
85 cfg->line_outs++;
86 }
87 if (!cfg->speaker_outs) {
88 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
89 cfg->speaker_pins[cfg->speaker_outs])
90 cfg->speaker_outs++;
91 }
92 if (!cfg->hp_outs) {
93 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
94 cfg->hp_pins[cfg->hp_outs])
95 cfg->hp_outs++;
96 }
97}
98
99/*
100 * set up from the preset table
101 */
102static void setup_preset(struct hda_codec *codec,
103 const struct alc_config_preset *preset)
104{
105 struct alc_spec *spec = codec->spec;
106 int i;
107
108 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
109 add_mixer(spec, preset->mixers[i]);
110 spec->cap_mixer = preset->cap_mixer;
111 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
112 i++)
113 add_verb(spec, preset->init_verbs[i]);
114
115 spec->channel_mode = preset->channel_mode;
116 spec->num_channel_mode = preset->num_channel_mode;
117 spec->need_dac_fix = preset->need_dac_fix;
118 spec->const_channel_count = preset->const_channel_count;
119
120 if (preset->const_channel_count)
121 spec->multiout.max_channels = preset->const_channel_count;
122 else
123 spec->multiout.max_channels = spec->channel_mode[0].channels;
124 spec->ext_channel_count = spec->channel_mode[0].channels;
125
126 spec->multiout.num_dacs = preset->num_dacs;
127 spec->multiout.dac_nids = preset->dac_nids;
128 spec->multiout.dig_out_nid = preset->dig_out_nid;
129 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
130 spec->multiout.hp_nid = preset->hp_nid;
131
132 spec->num_mux_defs = preset->num_mux_defs;
133 if (!spec->num_mux_defs)
134 spec->num_mux_defs = 1;
135 spec->input_mux = preset->input_mux;
136
137 spec->num_adc_nids = preset->num_adc_nids;
138 spec->adc_nids = preset->adc_nids;
139 spec->capsrc_nids = preset->capsrc_nids;
140 spec->dig_in_nid = preset->dig_in_nid;
141
142 spec->unsol_event = preset->unsol_event;
143 spec->init_hook = preset->init_hook;
144#ifdef CONFIG_SND_HDA_POWER_SAVE
145 spec->power_hook = preset->power_hook;
146 spec->loopback.amplist = preset->loopbacks;
147#endif
148
149 if (preset->setup)
150 preset->setup(codec);
151
152 alc_fixup_autocfg_pin_nums(codec);
153}
154
155static void alc_simple_setup_automute(struct alc_spec *spec, int mode)
156{
157 int lo_pin = spec->autocfg.line_out_pins[0];
158
159 if (lo_pin == spec->autocfg.speaker_pins[0] ||
160 lo_pin == spec->autocfg.hp_pins[0])
161 lo_pin = 0;
162 spec->automute_mode = mode;
163 spec->detect_hp = !!spec->autocfg.hp_pins[0];
164 spec->detect_lo = !!lo_pin;
165 spec->automute_lo = spec->automute_lo_possible = !!lo_pin;
166 spec->automute_speaker = spec->automute_speaker_possible = !!spec->autocfg.speaker_pins[0];
167}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 3c6f5b5161f0..c5216b58d218 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4808,21 +4808,6 @@ static const struct alc_model_fixup alc880_fixup_models[] = {
4808 4808
4809 4809
4810/* 4810/*
4811 * board setups
4812 */
4813#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4814#define alc_board_config \
4815 snd_hda_check_board_config
4816#define alc_board_codec_sid_config \
4817 snd_hda_check_board_codec_sid_config
4818#include "alc_quirks.c"
4819#else
4820#define alc_board_config(codec, nums, models, tbl) -1
4821#define alc_board_codec_sid_config(codec, nums, models, tbl) -1
4822#define setup_preset(codec, x) /* NOP */
4823#endif
4824
4825/*
4826 * OK, here we have finally the patch for ALC880 4811 * OK, here we have finally the patch for ALC880
4827 */ 4812 */
4828static int patch_alc880(struct hda_codec *codec) 4813static int patch_alc880(struct hda_codec *codec)
@@ -5091,6 +5076,8 @@ enum {
5091 ALC882_FIXUP_EAPD, 5076 ALC882_FIXUP_EAPD,
5092 ALC883_FIXUP_EAPD, 5077 ALC883_FIXUP_EAPD,
5093 ALC883_FIXUP_ACER_EAPD, 5078 ALC883_FIXUP_ACER_EAPD,
5079 ALC882_FIXUP_GPIO1,
5080 ALC882_FIXUP_GPIO2,
5094 ALC882_FIXUP_GPIO3, 5081 ALC882_FIXUP_GPIO3,
5095 ALC889_FIXUP_COEF, 5082 ALC889_FIXUP_COEF,
5096 ALC882_FIXUP_ASUS_W2JC, 5083 ALC882_FIXUP_ASUS_W2JC,
@@ -5099,6 +5086,8 @@ enum {
5099 ALC882_FIXUP_ASPIRE_8930G_VERBS, 5086 ALC882_FIXUP_ASPIRE_8930G_VERBS,
5100 ALC885_FIXUP_MACPRO_GPIO, 5087 ALC885_FIXUP_MACPRO_GPIO,
5101 ALC889_FIXUP_DAC_ROUTE, 5088 ALC889_FIXUP_DAC_ROUTE,
5089 ALC889_FIXUP_MBP_VREF,
5090 ALC889_FIXUP_IMAC91_VREF,
5102}; 5091};
5103 5092
5104static void alc889_fixup_coef(struct hda_codec *codec, 5093static void alc889_fixup_coef(struct hda_codec *codec,
@@ -5169,6 +5158,51 @@ static void alc889_fixup_dac_route(struct hda_codec *codec,
5169 } 5158 }
5170} 5159}
5171 5160
5161/* Set VREF on HP pin */
5162static void alc889_fixup_mbp_vref(struct hda_codec *codec,
5163 const struct alc_fixup *fix, int action)
5164{
5165 struct alc_spec *spec = codec->spec;
5166 static hda_nid_t nids[2] = { 0x14, 0x15 };
5167 int i;
5168
5169 if (action != ALC_FIXUP_ACT_INIT)
5170 return;
5171 for (i = 0; i < ARRAY_SIZE(nids); i++) {
5172 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
5173 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
5174 continue;
5175 val = snd_hda_codec_read(codec, nids[i], 0,
5176 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
5177 val |= AC_PINCTL_VREF_80;
5178 snd_hda_codec_write(codec, nids[i], 0,
5179 AC_VERB_SET_PIN_WIDGET_CONTROL, val);
5180 spec->keep_vref_in_automute = 1;
5181 break;
5182 }
5183}
5184
5185/* Set VREF on speaker pins on imac91 */
5186static void alc889_fixup_imac91_vref(struct hda_codec *codec,
5187 const struct alc_fixup *fix, int action)
5188{
5189 struct alc_spec *spec = codec->spec;
5190 static hda_nid_t nids[2] = { 0x18, 0x1a };
5191 int i;
5192
5193 if (action != ALC_FIXUP_ACT_INIT)
5194 return;
5195 for (i = 0; i < ARRAY_SIZE(nids); i++) {
5196 unsigned int val;
5197 val = snd_hda_codec_read(codec, nids[i], 0,
5198 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
5199 val |= AC_PINCTL_VREF_50;
5200 snd_hda_codec_write(codec, nids[i], 0,
5201 AC_VERB_SET_PIN_WIDGET_CONTROL, val);
5202 }
5203 spec->keep_vref_in_automute = 1;
5204}
5205
5172static const struct alc_fixup alc882_fixups[] = { 5206static const struct alc_fixup alc882_fixups[] = {
5173 [ALC882_FIXUP_ABIT_AW9D_MAX] = { 5207 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
5174 .type = ALC_FIXUP_PINS, 5208 .type = ALC_FIXUP_PINS,
@@ -5247,6 +5281,14 @@ static const struct alc_fixup alc882_fixups[] = {
5247 { } 5281 { }
5248 } 5282 }
5249 }, 5283 },
5284 [ALC882_FIXUP_GPIO1] = {
5285 .type = ALC_FIXUP_VERBS,
5286 .v.verbs = alc_gpio1_init_verbs,
5287 },
5288 [ALC882_FIXUP_GPIO2] = {
5289 .type = ALC_FIXUP_VERBS,
5290 .v.verbs = alc_gpio2_init_verbs,
5291 },
5250 [ALC882_FIXUP_GPIO3] = { 5292 [ALC882_FIXUP_GPIO3] = {
5251 .type = ALC_FIXUP_VERBS, 5293 .type = ALC_FIXUP_VERBS,
5252 .v.verbs = alc_gpio3_init_verbs, 5294 .v.verbs = alc_gpio3_init_verbs,
@@ -5320,6 +5362,18 @@ static const struct alc_fixup alc882_fixups[] = {
5320 .type = ALC_FIXUP_FUNC, 5362 .type = ALC_FIXUP_FUNC,
5321 .v.func = alc889_fixup_dac_route, 5363 .v.func = alc889_fixup_dac_route,
5322 }, 5364 },
5365 [ALC889_FIXUP_MBP_VREF] = {
5366 .type = ALC_FIXUP_FUNC,
5367 .v.func = alc889_fixup_mbp_vref,
5368 .chained = true,
5369 .chain_id = ALC882_FIXUP_GPIO1,
5370 },
5371 [ALC889_FIXUP_IMAC91_VREF] = {
5372 .type = ALC_FIXUP_FUNC,
5373 .v.func = alc889_fixup_imac91_vref,
5374 .chained = true,
5375 .chain_id = ALC882_FIXUP_GPIO1,
5376 },
5323}; 5377};
5324 5378
5325static const struct snd_pci_quirk alc882_fixup_tbl[] = { 5379static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -5353,11 +5407,26 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5353 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), 5407 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
5354 5408
5355 /* All Apple entries are in codec SSIDs */ 5409 /* All Apple entries are in codec SSIDs */
5410 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
5411 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
5412 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5356 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO), 5413 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO),
5357 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), 5414 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
5358 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), 5415 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
5416 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
5417 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
5359 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), 5418 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
5419 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBP_VREF),
5420 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBP_VREF),
5421 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
5422 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
5360 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), 5423 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
5424 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
5425 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
5426 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
5427 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
5428 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
5429 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
5361 5430
5362 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), 5431 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
5363 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), 5432 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
@@ -5382,14 +5451,10 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
5382 5451
5383/* 5452/*
5384 */ 5453 */
5385#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
5386#include "alc882_quirks.c"
5387#endif
5388
5389static int patch_alc882(struct hda_codec *codec) 5454static int patch_alc882(struct hda_codec *codec)
5390{ 5455{
5391 struct alc_spec *spec; 5456 struct alc_spec *spec;
5392 int err, board_config; 5457 int err;
5393 5458
5394 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5459 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5395 if (spec == NULL) 5460 if (spec == NULL)
@@ -5413,36 +5478,15 @@ static int patch_alc882(struct hda_codec *codec)
5413 if (err < 0) 5478 if (err < 0)
5414 goto error; 5479 goto error;
5415 5480
5416 board_config = alc_board_config(codec, ALC882_MODEL_LAST, 5481 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
5417 alc882_models, NULL); 5482 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5418 if (board_config < 0)
5419 board_config = alc_board_codec_sid_config(codec,
5420 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
5421
5422 if (board_config < 0) {
5423 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5424 codec->chip_name);
5425 board_config = ALC_MODEL_AUTO;
5426 }
5427
5428 if (board_config == ALC_MODEL_AUTO) {
5429 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
5430 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5431 }
5432 5483
5433 alc_auto_parse_customize_define(codec); 5484 alc_auto_parse_customize_define(codec);
5434 5485
5435 if (board_config == ALC_MODEL_AUTO) { 5486 /* automatic parse from the BIOS config */
5436 /* automatic parse from the BIOS config */ 5487 err = alc882_parse_auto_config(codec);
5437 err = alc882_parse_auto_config(codec); 5488 if (err < 0)
5438 if (err < 0) 5489 goto error;
5439 goto error;
5440 }
5441
5442 if (board_config != ALC_MODEL_AUTO) {
5443 setup_preset(codec, &alc882_presets[board_config]);
5444 spec->vmaster_nid = 0x0c;
5445 }
5446 5490
5447 if (!spec->no_analog && !spec->adc_nids) { 5491 if (!spec->no_analog && !spec->adc_nids) {
5448 alc_auto_fill_adc_caps(codec); 5492 alc_auto_fill_adc_caps(codec);
@@ -5461,10 +5505,7 @@ static int patch_alc882(struct hda_codec *codec)
5461 } 5505 }
5462 5506
5463 codec->patch_ops = alc_patch_ops; 5507 codec->patch_ops = alc_patch_ops;
5464 if (board_config == ALC_MODEL_AUTO) 5508 spec->init_hook = alc_auto_init_std;
5465 spec->init_hook = alc_auto_init_std;
5466 else
5467 codec->patch_ops.build_controls = __alc_build_controls;
5468 5509
5469#ifdef CONFIG_SND_HDA_POWER_SAVE 5510#ifdef CONFIG_SND_HDA_POWER_SAVE
5470 if (!spec->loopback.amplist) 5511 if (!spec->loopback.amplist)