aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt13
-rw-r--r--sound/pci/hda/alc861_quirks.c396
-rw-r--r--sound/pci/hda/alc861vd_quirks.c362
-rw-r--r--sound/pci/hda/patch_realtek.c98
4 files changed, 20 insertions, 849 deletions
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index 2df34442fe28..4161fb0e630f 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -146,20 +146,11 @@ ALC882/883/885/888/889
146 146
147ALC861/660 147ALC861/660
148========== 148==========
149 3stack 3-jack 149 N/A
150 3stack-dig 3-jack with SPDIF I/O
151 6stack-dig 6-jack with SPDIF I/O
152 3stack-660 3-jack (for ALC660)
153 auto auto-config reading BIOS (default)
154 150
155ALC861VD/660VD 151ALC861VD/660VD
156============== 152==============
157 3stack 3-jack 153 N/A
158 3stack-dig 3-jack with SPDIF OUT
159 6stack-dig 6-jack with SPDIF OUT
160 3stack-660 3-jack (for ALC660VD)
161 3stack-660-digout 3-jack with SPDIF OUT (for ALC660VD)
162 auto auto-config reading BIOS (default)
163 154
164CMI9880 155CMI9880
165======= 156=======
diff --git a/sound/pci/hda/alc861_quirks.c b/sound/pci/hda/alc861_quirks.c
deleted file mode 100644
index ab8c7cdff6cf..000000000000
--- a/sound/pci/hda/alc861_quirks.c
+++ /dev/null
@@ -1,396 +0,0 @@
1/*
2 * ALC660/ALC861 quirk models
3 * included by patch_realtek.c
4 */
5
6/* ALC861 models */
7enum {
8 ALC861_AUTO,
9 ALC861_3ST,
10 ALC660_3ST,
11 ALC861_3ST_DIG,
12 ALC861_6ST_DIG,
13 ALC861_ASUS,
14 ALC861_MODEL_LAST,
15};
16
17/*
18 * ALC861 channel source setting (2/6 channel selection for 3-stack)
19 */
20
21/*
22 * set the path ways for 2 channel output
23 * need to set the codec line out and mic 1 pin widgets to inputs
24 */
25static const struct hda_verb alc861_threestack_ch2_init[] = {
26 /* set pin widget 1Ah (line in) for input */
27 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
28 /* set pin widget 18h (mic1/2) for input, for mic also enable
29 * the vref
30 */
31 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
32
33 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
34#if 0
35 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
36 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
37#endif
38 { } /* end */
39};
40/*
41 * 6ch mode
42 * need to set the codec line out and mic 1 pin widgets to outputs
43 */
44static const struct hda_verb alc861_threestack_ch6_init[] = {
45 /* set pin widget 1Ah (line in) for output (Back Surround)*/
46 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
47 /* set pin widget 18h (mic1) for output (CLFE)*/
48 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
49
50 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
51 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
52
53 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
54#if 0
55 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
56 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
57#endif
58 { } /* end */
59};
60
61static const struct hda_channel_mode alc861_threestack_modes[2] = {
62 { 2, alc861_threestack_ch2_init },
63 { 6, alc861_threestack_ch6_init },
64};
65
66/* Set mic1 and line-in as input and unmute the mixer */
67static const struct hda_verb alc861_asus_ch2_init[] = {
68 /* set pin widget 1Ah (line in) for input */
69 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
70 /* set pin widget 18h (mic1/2) for input, for mic also enable
71 * the vref
72 */
73 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
74
75 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
76#if 0
77 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
78 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
79#endif
80 { } /* end */
81};
82/* Set mic1 nad line-in as output and mute mixer */
83static const struct hda_verb alc861_asus_ch6_init[] = {
84 /* set pin widget 1Ah (line in) for output (Back Surround)*/
85 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
86 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
87 /* set pin widget 18h (mic1) for output (CLFE)*/
88 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
89 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
90 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
91 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
92
93 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
94#if 0
95 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
96 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
97#endif
98 { } /* end */
99};
100
101static const struct hda_channel_mode alc861_asus_modes[2] = {
102 { 2, alc861_asus_ch2_init },
103 { 6, alc861_asus_ch6_init },
104};
105
106/* patch-ALC861 */
107
108static const struct snd_kcontrol_new alc861_base_mixer[] = {
109 /* output mixer control */
110 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
111 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
112 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
113 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
114 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
115
116 /*Input mixer control */
117 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
118 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
119 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
120 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
121 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
122 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
124 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
125 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
127
128 { } /* end */
129};
130
131static const struct snd_kcontrol_new alc861_3ST_mixer[] = {
132 /* output mixer control */
133 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
134 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
135 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
136 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
137 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
138
139 /* Input mixer control */
140 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
141 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
142 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
143 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
144 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
145 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
147 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
150
151 {
152 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
153 .name = "Channel Mode",
154 .info = alc_ch_mode_info,
155 .get = alc_ch_mode_get,
156 .put = alc_ch_mode_put,
157 .private_value = ARRAY_SIZE(alc861_threestack_modes),
158 },
159 { } /* end */
160};
161
162/*
163 * generic initialization of ADC, input mixers and output mixers
164 */
165static const struct hda_verb alc861_base_init_verbs[] = {
166 /*
167 * Unmute ADC0 and set the default input to mic-in
168 */
169 /* port-A for surround (rear panel) */
170 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
171 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
172 /* port-B for mic-in (rear panel) with vref */
173 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
174 /* port-C for line-in (rear panel) */
175 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
176 /* port-D for Front */
177 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
178 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
179 /* port-E for HP out (front panel) */
180 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
181 /* route front PCM to HP */
182 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
183 /* port-F for mic-in (front panel) with vref */
184 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
185 /* port-G for CLFE (rear panel) */
186 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
187 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
188 /* port-H for side (rear panel) */
189 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
190 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
191 /* CD-in */
192 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
193 /* route front mic to ADC1*/
194 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
195 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
196
197 /* Unmute DAC0~3 & spdif out*/
198 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
199 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
200 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
201 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
202 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
203
204 /* Unmute Mixer 14 (mic) 1c (Line in)*/
205 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
206 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
207 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
208 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
209
210 /* Unmute Stereo Mixer 15 */
211 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
212 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
213 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
214 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
215
216 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
217 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
218 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
219 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
220 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
221 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
222 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
223 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
224 /* hp used DAC 3 (Front) */
225 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
226 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
227
228 { }
229};
230
231static const struct hda_verb alc861_threestack_init_verbs[] = {
232 /*
233 * Unmute ADC0 and set the default input to mic-in
234 */
235 /* port-A for surround (rear panel) */
236 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
237 /* port-B for mic-in (rear panel) with vref */
238 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
239 /* port-C for line-in (rear panel) */
240 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
241 /* port-D for Front */
242 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
243 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
244 /* port-E for HP out (front panel) */
245 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
246 /* route front PCM to HP */
247 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
248 /* port-F for mic-in (front panel) with vref */
249 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
250 /* port-G for CLFE (rear panel) */
251 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
252 /* port-H for side (rear panel) */
253 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
254 /* CD-in */
255 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
256 /* route front mic to ADC1*/
257 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
258 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
259 /* Unmute DAC0~3 & spdif out*/
260 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
261 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
262 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
263 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
265
266 /* Unmute Mixer 14 (mic) 1c (Line in)*/
267 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
268 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
269 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
270 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
271
272 /* Unmute Stereo Mixer 15 */
273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
274 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
275 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
276 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
277
278 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
279 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
280 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
281 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
282 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
283 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
284 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
285 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
286 /* hp used DAC 3 (Front) */
287 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
288 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
289 { }
290};
291
292#define ALC861_DIGOUT_NID 0x07
293
294static const struct hda_channel_mode alc861_8ch_modes[1] = {
295 { 8, NULL }
296};
297
298static const hda_nid_t alc861_dac_nids[4] = {
299 /* front, surround, clfe, side */
300 0x03, 0x06, 0x05, 0x04
301};
302
303static const hda_nid_t alc660_dac_nids[3] = {
304 /* front, clfe, surround */
305 0x03, 0x05, 0x06
306};
307
308static const hda_nid_t alc861_adc_nids[1] = {
309 /* ADC0-2 */
310 0x08,
311};
312
313static const struct hda_input_mux alc861_capture_source = {
314 .num_items = 5,
315 .items = {
316 { "Mic", 0x0 },
317 { "Front Mic", 0x3 },
318 { "Line", 0x1 },
319 { "CD", 0x4 },
320 { "Mixer", 0x5 },
321 },
322};
323
324/*
325 * configuration and preset
326 */
327static const char * const alc861_models[ALC861_MODEL_LAST] = {
328 [ALC861_3ST] = "3stack",
329 [ALC660_3ST] = "3stack-660",
330 [ALC861_3ST_DIG] = "3stack-dig",
331 [ALC861_6ST_DIG] = "6stack-dig",
332 [ALC861_AUTO] = "auto",
333};
334
335static const struct snd_pci_quirk alc861_cfg_tbl[] = {
336 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
337 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
338 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
339 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
340 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
341 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
342 {}
343};
344
345static const struct alc_config_preset alc861_presets[] = {
346 [ALC861_3ST] = {
347 .mixers = { alc861_3ST_mixer },
348 .init_verbs = { alc861_threestack_init_verbs },
349 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
350 .dac_nids = alc861_dac_nids,
351 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
352 .channel_mode = alc861_threestack_modes,
353 .need_dac_fix = 1,
354 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
355 .adc_nids = alc861_adc_nids,
356 .input_mux = &alc861_capture_source,
357 },
358 [ALC861_3ST_DIG] = {
359 .mixers = { alc861_base_mixer },
360 .init_verbs = { alc861_threestack_init_verbs },
361 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
362 .dac_nids = alc861_dac_nids,
363 .dig_out_nid = ALC861_DIGOUT_NID,
364 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
365 .channel_mode = alc861_threestack_modes,
366 .need_dac_fix = 1,
367 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
368 .adc_nids = alc861_adc_nids,
369 .input_mux = &alc861_capture_source,
370 },
371 [ALC861_6ST_DIG] = {
372 .mixers = { alc861_base_mixer },
373 .init_verbs = { alc861_base_init_verbs },
374 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
375 .dac_nids = alc861_dac_nids,
376 .dig_out_nid = ALC861_DIGOUT_NID,
377 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
378 .channel_mode = alc861_8ch_modes,
379 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
380 .adc_nids = alc861_adc_nids,
381 .input_mux = &alc861_capture_source,
382 },
383 [ALC660_3ST] = {
384 .mixers = { alc861_3ST_mixer },
385 .init_verbs = { alc861_threestack_init_verbs },
386 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
387 .dac_nids = alc660_dac_nids,
388 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
389 .channel_mode = alc861_threestack_modes,
390 .need_dac_fix = 1,
391 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
392 .adc_nids = alc861_adc_nids,
393 .input_mux = &alc861_capture_source,
394 },
395};
396
diff --git a/sound/pci/hda/alc861vd_quirks.c b/sound/pci/hda/alc861vd_quirks.c
deleted file mode 100644
index 9f652254860a..000000000000
--- a/sound/pci/hda/alc861vd_quirks.c
+++ /dev/null
@@ -1,362 +0,0 @@
1/*
2 * ALC660-VD/ALC861-VD quirk models
3 * included by patch_realtek.c
4 */
5
6/* ALC861-VD models */
7enum {
8 ALC861VD_AUTO,
9 ALC660VD_3ST,
10 ALC660VD_3ST_DIG,
11 ALC861VD_3ST,
12 ALC861VD_3ST_DIG,
13 ALC861VD_6ST_DIG,
14 ALC861VD_MODEL_LAST,
15};
16
17#define ALC861VD_DIGOUT_NID 0x06
18
19static const hda_nid_t alc861vd_dac_nids[4] = {
20 /* front, surr, clfe, side surr */
21 0x02, 0x03, 0x04, 0x05
22};
23
24/* dac_nids for ALC660vd are in a different order - according to
25 * Realtek's driver.
26 * This should probably result in a different mixer for 6stack models
27 * of ALC660vd codecs, but for now there is only 3stack mixer
28 * - and it is the same as in 861vd.
29 * adc_nids in ALC660vd are (is) the same as in 861vd
30 */
31static const hda_nid_t alc660vd_dac_nids[3] = {
32 /* front, rear, clfe, rear_surr */
33 0x02, 0x04, 0x03
34};
35
36static const hda_nid_t alc861vd_adc_nids[1] = {
37 /* ADC0 */
38 0x09,
39};
40
41static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
42
43/* input MUX */
44/* FIXME: should be a matrix-type input source selection */
45static const struct hda_input_mux alc861vd_capture_source = {
46 .num_items = 4,
47 .items = {
48 { "Mic", 0x0 },
49 { "Front Mic", 0x1 },
50 { "Line", 0x2 },
51 { "CD", 0x4 },
52 },
53};
54
55/*
56 * 2ch mode
57 */
58static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
59 { 2, NULL }
60};
61
62/*
63 * 6ch mode
64 */
65static const struct hda_verb alc861vd_6stack_ch6_init[] = {
66 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
67 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
68 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
69 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
70 { } /* end */
71};
72
73/*
74 * 8ch mode
75 */
76static const struct hda_verb alc861vd_6stack_ch8_init[] = {
77 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
78 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
79 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
80 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
81 { } /* end */
82};
83
84static const struct hda_channel_mode alc861vd_6stack_modes[2] = {
85 { 6, alc861vd_6stack_ch6_init },
86 { 8, alc861vd_6stack_ch8_init },
87};
88
89static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
90 {
91 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
92 .name = "Channel Mode",
93 .info = alc_ch_mode_info,
94 .get = alc_ch_mode_get,
95 .put = alc_ch_mode_put,
96 },
97 { } /* end */
98};
99
100/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
101 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
102 */
103static const struct snd_kcontrol_new alc861vd_6st_mixer[] = {
104 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
105 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
106
107 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
108 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
109
110 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
111 HDA_OUTPUT),
112 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
113 HDA_OUTPUT),
114 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
115 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
116
117 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
118 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
119
120 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
121
122 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
125
126 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
127 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
128 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
129
130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
132
133 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
134 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
135
136 { } /* end */
137};
138
139static const struct snd_kcontrol_new alc861vd_3st_mixer[] = {
140 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
141 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
142
143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
144
145 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
148
149 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
150 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
151 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
152
153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
155
156 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
157 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
158
159 { } /* end */
160};
161
162/*
163 * generic initialization of ADC, input mixers and output mixers
164 */
165static const struct hda_verb alc861vd_volume_init_verbs[] = {
166 /*
167 * Unmute ADC0 and set the default input to mic-in
168 */
169 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
170 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
171
172 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
173 * the analog-loopback mixer widget
174 */
175 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
177 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
178 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
179 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
180 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
181
182 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
183 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
184 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
185 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
187
188 /*
189 * Set up output mixers (0x02 - 0x05)
190 */
191 /* set vol=0 to output mixers */
192 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
193 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
194 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
195 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
196
197 /* set up input amps for analog loopback */
198 /* Amp Indices: DAC = 0, mixer = 1 */
199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
201 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
202 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
203 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
204 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
205 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
206 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
207
208 { }
209};
210
211/*
212 * 3-stack pin configuration:
213 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
214 */
215static const struct hda_verb alc861vd_3stack_init_verbs[] = {
216 /*
217 * Set pin mode and muting
218 */
219 /* set front pin widgets 0x14 for output */
220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
222 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
223
224 /* Mic (rear) pin: input vref at 80% */
225 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
226 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
227 /* Front Mic pin: input vref at 80% */
228 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
229 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
230 /* Line In pin: input */
231 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
232 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
233 /* Line-2 In: Headphone output (output 0 - 0x0c) */
234 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
235 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
236 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
237 /* CD pin widget for input */
238 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
239
240 { }
241};
242
243/*
244 * 6-stack pin configuration:
245 */
246static const struct hda_verb alc861vd_6stack_init_verbs[] = {
247 /*
248 * Set pin mode and muting
249 */
250 /* set front pin widgets 0x14 for output */
251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
252 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
253 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
254
255 /* Rear Pin: output 1 (0x0d) */
256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
257 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
258 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
259 /* CLFE Pin: output 2 (0x0e) */
260 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
261 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
262 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
263 /* Side Pin: output 3 (0x0f) */
264 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
265 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
266 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
267
268 /* Mic (rear) pin: input vref at 80% */
269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
270 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
271 /* Front Mic pin: input vref at 80% */
272 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
273 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
274 /* Line In pin: input */
275 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
276 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
277 /* Line-2 In: Headphone output (output 0 - 0x0c) */
278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
280 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
281 /* CD pin widget for input */
282 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
283
284 { }
285};
286
287/*
288 * configuration and preset
289 */
290static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
291 [ALC660VD_3ST] = "3stack-660",
292 [ALC660VD_3ST_DIG] = "3stack-660-digout",
293 [ALC861VD_3ST] = "3stack",
294 [ALC861VD_3ST_DIG] = "3stack-digout",
295 [ALC861VD_6ST_DIG] = "6stack-digout",
296 [ALC861VD_AUTO] = "auto",
297};
298
299static const struct snd_pci_quirk alc861vd_cfg_tbl[] = {
300 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
301 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
302 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
303 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
304 {}
305};
306
307static const struct alc_config_preset alc861vd_presets[] = {
308 [ALC660VD_3ST] = {
309 .mixers = { alc861vd_3st_mixer },
310 .init_verbs = { alc861vd_volume_init_verbs,
311 alc861vd_3stack_init_verbs },
312 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
313 .dac_nids = alc660vd_dac_nids,
314 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
315 .channel_mode = alc861vd_3stack_2ch_modes,
316 .input_mux = &alc861vd_capture_source,
317 },
318 [ALC660VD_3ST_DIG] = {
319 .mixers = { alc861vd_3st_mixer },
320 .init_verbs = { alc861vd_volume_init_verbs,
321 alc861vd_3stack_init_verbs },
322 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
323 .dac_nids = alc660vd_dac_nids,
324 .dig_out_nid = ALC861VD_DIGOUT_NID,
325 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
326 .channel_mode = alc861vd_3stack_2ch_modes,
327 .input_mux = &alc861vd_capture_source,
328 },
329 [ALC861VD_3ST] = {
330 .mixers = { alc861vd_3st_mixer },
331 .init_verbs = { alc861vd_volume_init_verbs,
332 alc861vd_3stack_init_verbs },
333 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
334 .dac_nids = alc861vd_dac_nids,
335 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
336 .channel_mode = alc861vd_3stack_2ch_modes,
337 .input_mux = &alc861vd_capture_source,
338 },
339 [ALC861VD_3ST_DIG] = {
340 .mixers = { alc861vd_3st_mixer },
341 .init_verbs = { alc861vd_volume_init_verbs,
342 alc861vd_3stack_init_verbs },
343 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
344 .dac_nids = alc861vd_dac_nids,
345 .dig_out_nid = ALC861VD_DIGOUT_NID,
346 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
347 .channel_mode = alc861vd_3stack_2ch_modes,
348 .input_mux = &alc861vd_capture_source,
349 },
350 [ALC861VD_6ST_DIG] = {
351 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
352 .init_verbs = { alc861vd_volume_init_verbs,
353 alc861vd_6stack_init_verbs },
354 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
355 .dac_nids = alc861vd_dac_nids,
356 .dig_out_nid = ALC861VD_DIGOUT_NID,
357 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
358 .channel_mode = alc861vd_6stack_modes,
359 .input_mux = &alc861vd_capture_source,
360 },
361};
362
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 395e99ce4fbd..429dd27f6482 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4987,14 +4987,9 @@ static const struct snd_pci_quirk alc861_fixup_tbl[] = {
4987 4987
4988/* 4988/*
4989 */ 4989 */
4990#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4991#include "alc861_quirks.c"
4992#endif
4993
4994static int patch_alc861(struct hda_codec *codec) 4990static int patch_alc861(struct hda_codec *codec)
4995{ 4991{
4996 struct alc_spec *spec; 4992 struct alc_spec *spec;
4997 int board_config;
4998 int err; 4993 int err;
4999 4994
5000 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4995 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
@@ -5005,40 +5000,16 @@ static int patch_alc861(struct hda_codec *codec)
5005 5000
5006 spec->mixer_nid = 0x15; 5001 spec->mixer_nid = 0x15;
5007 5002
5008 board_config = alc_board_config(codec, ALC861_MODEL_LAST, 5003 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
5009 alc861_models, alc861_cfg_tbl); 5004 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5010
5011 if (board_config < 0) {
5012 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5013 codec->chip_name);
5014 board_config = ALC_MODEL_AUTO;
5015 }
5016 5005
5017 if (board_config == ALC_MODEL_AUTO) { 5006 /* automatic parse from the BIOS config */
5018 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); 5007 err = alc861_parse_auto_config(codec);
5019 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); 5008 if (err < 0) {
5020 } 5009 alc_free(codec);
5021 5010 return err;
5022 if (board_config == ALC_MODEL_AUTO) {
5023 /* automatic parse from the BIOS config */
5024 err = alc861_parse_auto_config(codec);
5025 if (err < 0) {
5026 alc_free(codec);
5027 return err;
5028 }
5029#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
5030 else if (!err) {
5031 printk(KERN_INFO
5032 "hda_codec: Cannot set up configuration "
5033 "from BIOS. Using base mode...\n");
5034 board_config = ALC861_3ST_DIG;
5035 }
5036#endif
5037 } 5011 }
5038 5012
5039 if (board_config != ALC_MODEL_AUTO)
5040 setup_preset(codec, &alc861_presets[board_config]);
5041
5042 if (!spec->no_analog && !spec->adc_nids) { 5013 if (!spec->no_analog && !spec->adc_nids) {
5043 alc_auto_fill_adc_caps(codec); 5014 alc_auto_fill_adc_caps(codec);
5044 alc_rebuild_imux_for_auto_mic(codec); 5015 alc_rebuild_imux_for_auto_mic(codec);
@@ -5062,13 +5033,9 @@ static int patch_alc861(struct hda_codec *codec)
5062 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 5033 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
5063 5034
5064 codec->patch_ops = alc_patch_ops; 5035 codec->patch_ops = alc_patch_ops;
5065 if (board_config == ALC_MODEL_AUTO) { 5036 spec->init_hook = alc_auto_init_std;
5066 spec->init_hook = alc_auto_init_std;
5067#ifdef CONFIG_SND_HDA_POWER_SAVE
5068 spec->power_hook = alc_power_eapd;
5069#endif
5070 }
5071#ifdef CONFIG_SND_HDA_POWER_SAVE 5037#ifdef CONFIG_SND_HDA_POWER_SAVE
5038 spec->power_hook = alc_power_eapd;
5072 if (!spec->loopback.amplist) 5039 if (!spec->loopback.amplist)
5073 spec->loopback.amplist = alc861_loopbacks; 5040 spec->loopback.amplist = alc861_loopbacks;
5074#endif 5041#endif
@@ -5141,14 +5108,10 @@ static const struct hda_verb alc660vd_eapd_verbs[] = {
5141 5108
5142/* 5109/*
5143 */ 5110 */
5144#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
5145#include "alc861vd_quirks.c"
5146#endif
5147
5148static int patch_alc861vd(struct hda_codec *codec) 5111static int patch_alc861vd(struct hda_codec *codec)
5149{ 5112{
5150 struct alc_spec *spec; 5113 struct alc_spec *spec;
5151 int err, board_config; 5114 int err;
5152 5115
5153 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5116 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5154 if (spec == NULL) 5117 if (spec == NULL)
@@ -5158,40 +5121,16 @@ static int patch_alc861vd(struct hda_codec *codec)
5158 5121
5159 spec->mixer_nid = 0x0b; 5122 spec->mixer_nid = 0x0b;
5160 5123
5161 board_config = alc_board_config(codec, ALC861VD_MODEL_LAST, 5124 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
5162 alc861vd_models, alc861vd_cfg_tbl); 5125 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5163 5126
5164 if (board_config < 0) { 5127 /* automatic parse from the BIOS config */
5165 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", 5128 err = alc861vd_parse_auto_config(codec);
5166 codec->chip_name); 5129 if (err < 0) {
5167 board_config = ALC_MODEL_AUTO; 5130 alc_free(codec);
5168 } 5131 return err;
5169
5170 if (board_config == ALC_MODEL_AUTO) {
5171 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
5172 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5173 }
5174
5175 if (board_config == ALC_MODEL_AUTO) {
5176 /* automatic parse from the BIOS config */
5177 err = alc861vd_parse_auto_config(codec);
5178 if (err < 0) {
5179 alc_free(codec);
5180 return err;
5181 }
5182#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
5183 else if (!err) {
5184 printk(KERN_INFO
5185 "hda_codec: Cannot set up configuration "
5186 "from BIOS. Using base mode...\n");
5187 board_config = ALC861VD_3ST;
5188 }
5189#endif
5190 } 5132 }
5191 5133
5192 if (board_config != ALC_MODEL_AUTO)
5193 setup_preset(codec, &alc861vd_presets[board_config]);
5194
5195 if (codec->vendor_id == 0x10ec0660) { 5134 if (codec->vendor_id == 0x10ec0660) {
5196 /* always turn on EAPD */ 5135 /* always turn on EAPD */
5197 add_verb(spec, alc660vd_eapd_verbs); 5136 add_verb(spec, alc660vd_eapd_verbs);
@@ -5221,8 +5160,7 @@ static int patch_alc861vd(struct hda_codec *codec)
5221 5160
5222 codec->patch_ops = alc_patch_ops; 5161 codec->patch_ops = alc_patch_ops;
5223 5162
5224 if (board_config == ALC_MODEL_AUTO) 5163 spec->init_hook = alc_auto_init_std;
5225 spec->init_hook = alc_auto_init_std;
5226 spec->shutup = alc_eapd_shutup; 5164 spec->shutup = alc_eapd_shutup;
5227#ifdef CONFIG_SND_HDA_POWER_SAVE 5165#ifdef CONFIG_SND_HDA_POWER_SAVE
5228 if (!spec->loopback.amplist) 5166 if (!spec->loopback.amplist)