]> Pileus Git - ~andy/linux/blob - sound/pci/hda/alc861vd_quirks.c
Merge branches 'acpi', 'idle', 'mrst-pmu' and 'pm-tools' into next
[~andy/linux] / sound / pci / hda / alc861vd_quirks.c
1 /*
2  * ALC660-VD/ALC861-VD quirk models
3  * included by patch_realtek.c
4  */
5
6 /* ALC861-VD models */
7 enum {
8         ALC861VD_AUTO,
9         ALC660VD_3ST,
10         ALC660VD_3ST_DIG,
11         ALC660VD_ASUS_V1S,
12         ALC861VD_3ST,
13         ALC861VD_3ST_DIG,
14         ALC861VD_6ST_DIG,
15         ALC861VD_LENOVO,
16         ALC861VD_DALLAS,
17         ALC861VD_HP,
18         ALC861VD_MODEL_LAST,
19 };
20
21 #define ALC861VD_DIGOUT_NID     0x06
22
23 static const hda_nid_t alc861vd_dac_nids[4] = {
24         /* front, surr, clfe, side surr */
25         0x02, 0x03, 0x04, 0x05
26 };
27
28 /* dac_nids for ALC660vd are in a different order - according to
29  * Realtek's driver.
30  * This should probably result in a different mixer for 6stack models
31  * of ALC660vd codecs, but for now there is only 3stack mixer
32  * - and it is the same as in 861vd.
33  * adc_nids in ALC660vd are (is) the same as in 861vd
34  */
35 static const hda_nid_t alc660vd_dac_nids[3] = {
36         /* front, rear, clfe, rear_surr */
37         0x02, 0x04, 0x03
38 };
39
40 static const hda_nid_t alc861vd_adc_nids[1] = {
41         /* ADC0 */
42         0x09,
43 };
44
45 static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
46
47 /* input MUX */
48 /* FIXME: should be a matrix-type input source selection */
49 static const struct hda_input_mux alc861vd_capture_source = {
50         .num_items = 4,
51         .items = {
52                 { "Mic", 0x0 },
53                 { "Front Mic", 0x1 },
54                 { "Line", 0x2 },
55                 { "CD", 0x4 },
56         },
57 };
58
59 static const struct hda_input_mux alc861vd_dallas_capture_source = {
60         .num_items = 2,
61         .items = {
62                 { "Mic", 0x0 },
63                 { "Internal Mic", 0x1 },
64         },
65 };
66
67 static const struct hda_input_mux alc861vd_hp_capture_source = {
68         .num_items = 2,
69         .items = {
70                 { "Front Mic", 0x0 },
71                 { "ATAPI Mic", 0x1 },
72         },
73 };
74
75 /*
76  * 2ch mode
77  */
78 static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
79         { 2, NULL }
80 };
81
82 /*
83  * 6ch mode
84  */
85 static const struct hda_verb alc861vd_6stack_ch6_init[] = {
86         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
87         { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
88         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
89         { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
90         { } /* end */
91 };
92
93 /*
94  * 8ch mode
95  */
96 static const struct hda_verb alc861vd_6stack_ch8_init[] = {
97         { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
98         { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
99         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
100         { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
101         { } /* end */
102 };
103
104 static const struct hda_channel_mode alc861vd_6stack_modes[2] = {
105         { 6, alc861vd_6stack_ch6_init },
106         { 8, alc861vd_6stack_ch8_init },
107 };
108
109 static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
110         {
111                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
112                 .name = "Channel Mode",
113                 .info = alc_ch_mode_info,
114                 .get = alc_ch_mode_get,
115                 .put = alc_ch_mode_put,
116         },
117         { } /* end */
118 };
119
120 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
121  *                 Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
122  */
123 static const struct snd_kcontrol_new alc861vd_6st_mixer[] = {
124         HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
125         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
126
127         HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
128         HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
129
130         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
131                                 HDA_OUTPUT),
132         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
133                                 HDA_OUTPUT),
134         HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
135         HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
136
137         HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
138         HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
139
140         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
141
142         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
143         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
144         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
145
146         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
147         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
148         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
149
150         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
151         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
152
153         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
154         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
155
156         { } /* end */
157 };
158
159 static const struct snd_kcontrol_new alc861vd_3st_mixer[] = {
160         HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
161         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
162
163         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
164
165         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
166         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
167         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
168
169         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
170         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
171         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
172
173         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
174         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
175
176         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
177         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
178
179         { } /* end */
180 };
181
182 static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
183         HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
184         /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
185         HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
186
187         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
188
189         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
190         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
191         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
192
193         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
194         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
195         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
196
197         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
198         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
199
200         { } /* end */
201 };
202
203 /* Pin assignment: Speaker=0x14, HP = 0x15,
204  *                 Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
205  */
206 static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
207         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
208         HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
209         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
210         HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
211         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
212         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
213         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
214         HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
215         HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
216         HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
217         { } /* end */
218 };
219
220 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
221  *                 Front Mic=0x18, ATAPI Mic = 0x19,
222  */
223 static const struct snd_kcontrol_new alc861vd_hp_mixer[] = {
224         HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
225         HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
226         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
227         HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
228         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
229         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
230         HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
231         HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
232
233         { } /* end */
234 };
235
236 /*
237  * generic initialization of ADC, input mixers and output mixers
238  */
239 static const struct hda_verb alc861vd_volume_init_verbs[] = {
240         /*
241          * Unmute ADC0 and set the default input to mic-in
242          */
243         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
244         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
245
246         /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
247          * the analog-loopback mixer widget
248          */
249         /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
250         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
251         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
252         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
253         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
254         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
255
256         /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
257         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
258         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
259         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
260         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
261
262         /*
263          * Set up output mixers (0x02 - 0x05)
264          */
265         /* set vol=0 to output mixers */
266         {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
267         {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
268         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
269         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
270
271         /* set up input amps for analog loopback */
272         /* Amp Indices: DAC = 0, mixer = 1 */
273         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
274         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
275         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
276         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
277         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
278         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
279         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
280         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
281
282         { }
283 };
284
285 /*
286  * 3-stack pin configuration:
287  * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
288  */
289 static const struct hda_verb alc861vd_3stack_init_verbs[] = {
290         /*
291          * Set pin mode and muting
292          */
293         /* set front pin widgets 0x14 for output */
294         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
295         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
296         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
297
298         /* Mic (rear) pin: input vref at 80% */
299         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
300         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
301         /* Front Mic pin: input vref at 80% */
302         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
303         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
304         /* Line In pin: input */
305         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
306         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
307         /* Line-2 In: Headphone output (output 0 - 0x0c) */
308         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
309         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
310         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
311         /* CD pin widget for input */
312         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
313
314         { }
315 };
316
317 /*
318  * 6-stack pin configuration:
319  */
320 static const struct hda_verb alc861vd_6stack_init_verbs[] = {
321         /*
322          * Set pin mode and muting
323          */
324         /* set front pin widgets 0x14 for output */
325         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
326         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
327         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
328
329         /* Rear Pin: output 1 (0x0d) */
330         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
331         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
332         {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
333         /* CLFE Pin: output 2 (0x0e) */
334         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
335         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
336         {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
337         /* Side Pin: output 3 (0x0f) */
338         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
339         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
340         {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
341
342         /* Mic (rear) pin: input vref at 80% */
343         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
344         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
345         /* Front Mic pin: input vref at 80% */
346         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
347         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
348         /* Line In pin: input */
349         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
350         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
351         /* Line-2 In: Headphone output (output 0 - 0x0c) */
352         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
353         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
354         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
355         /* CD pin widget for input */
356         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
357
358         { }
359 };
360
361 static const struct hda_verb alc861vd_eapd_verbs[] = {
362         {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
363         { }
364 };
365
366 static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
367         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
368         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
369         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
370         {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
371         {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT},
372         {}
373 };
374
375 static void alc861vd_lenovo_setup(struct hda_codec *codec)
376 {
377         struct alc_spec *spec = codec->spec;
378         spec->autocfg.hp_pins[0] = 0x1b;
379         spec->autocfg.speaker_pins[0] = 0x14;
380         spec->automute = 1;
381         spec->automute_mode = ALC_AUTOMUTE_AMP;
382 }
383
384 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
385 {
386         alc_hp_automute(codec);
387         alc88x_simple_mic_automute(codec);
388 }
389
390 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
391                                         unsigned int res)
392 {
393         switch (res >> 26) {
394         case ALC_MIC_EVENT:
395                 alc88x_simple_mic_automute(codec);
396                 break;
397         default:
398                 alc_sku_unsol_event(codec, res);
399                 break;
400         }
401 }
402
403 static const struct hda_verb alc861vd_dallas_verbs[] = {
404         {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
405         {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
406         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
407         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
408
409         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
410         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
411         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
412         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
413         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
414         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
415         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
416         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
417
418         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
419         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
420         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
421         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
422         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
423         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
424         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
425         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
426
427         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
428         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
429         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
430         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
431         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
432         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
433         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
434         {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
435
436         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
437         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
438         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
439         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
440
441         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
442         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
443         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
444
445         { } /* end */
446 };
447
448 /* toggle speaker-output according to the hp-jack state */
449 static void alc861vd_dallas_setup(struct hda_codec *codec)
450 {
451         struct alc_spec *spec = codec->spec;
452
453         spec->autocfg.hp_pins[0] = 0x15;
454         spec->autocfg.speaker_pins[0] = 0x14;
455         spec->automute = 1;
456         spec->automute_mode = ALC_AUTOMUTE_AMP;
457 }
458
459 /*
460  * configuration and preset
461  */
462 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
463         [ALC660VD_3ST]          = "3stack-660",
464         [ALC660VD_3ST_DIG]      = "3stack-660-digout",
465         [ALC660VD_ASUS_V1S]     = "asus-v1s",
466         [ALC861VD_3ST]          = "3stack",
467         [ALC861VD_3ST_DIG]      = "3stack-digout",
468         [ALC861VD_6ST_DIG]      = "6stack-digout",
469         [ALC861VD_LENOVO]       = "lenovo",
470         [ALC861VD_DALLAS]       = "dallas",
471         [ALC861VD_HP]           = "hp",
472         [ALC861VD_AUTO]         = "auto",
473 };
474
475 static const struct snd_pci_quirk alc861vd_cfg_tbl[] = {
476         SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
477         SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
478         SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
479         /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
480         SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
481         SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
482         SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
483         SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
484         /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
485         SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
486         SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
487         SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
488         SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
489         SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
490         SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
491         {}
492 };
493
494 static const struct alc_config_preset alc861vd_presets[] = {
495         [ALC660VD_3ST] = {
496                 .mixers = { alc861vd_3st_mixer },
497                 .init_verbs = { alc861vd_volume_init_verbs,
498                                  alc861vd_3stack_init_verbs },
499                 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
500                 .dac_nids = alc660vd_dac_nids,
501                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
502                 .channel_mode = alc861vd_3stack_2ch_modes,
503                 .input_mux = &alc861vd_capture_source,
504         },
505         [ALC660VD_3ST_DIG] = {
506                 .mixers = { alc861vd_3st_mixer },
507                 .init_verbs = { alc861vd_volume_init_verbs,
508                                  alc861vd_3stack_init_verbs },
509                 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
510                 .dac_nids = alc660vd_dac_nids,
511                 .dig_out_nid = ALC861VD_DIGOUT_NID,
512                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
513                 .channel_mode = alc861vd_3stack_2ch_modes,
514                 .input_mux = &alc861vd_capture_source,
515         },
516         [ALC861VD_3ST] = {
517                 .mixers = { alc861vd_3st_mixer },
518                 .init_verbs = { alc861vd_volume_init_verbs,
519                                  alc861vd_3stack_init_verbs },
520                 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
521                 .dac_nids = alc861vd_dac_nids,
522                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
523                 .channel_mode = alc861vd_3stack_2ch_modes,
524                 .input_mux = &alc861vd_capture_source,
525         },
526         [ALC861VD_3ST_DIG] = {
527                 .mixers = { alc861vd_3st_mixer },
528                 .init_verbs = { alc861vd_volume_init_verbs,
529                                  alc861vd_3stack_init_verbs },
530                 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
531                 .dac_nids = alc861vd_dac_nids,
532                 .dig_out_nid = ALC861VD_DIGOUT_NID,
533                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
534                 .channel_mode = alc861vd_3stack_2ch_modes,
535                 .input_mux = &alc861vd_capture_source,
536         },
537         [ALC861VD_6ST_DIG] = {
538                 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
539                 .init_verbs = { alc861vd_volume_init_verbs,
540                                 alc861vd_6stack_init_verbs },
541                 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
542                 .dac_nids = alc861vd_dac_nids,
543                 .dig_out_nid = ALC861VD_DIGOUT_NID,
544                 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
545                 .channel_mode = alc861vd_6stack_modes,
546                 .input_mux = &alc861vd_capture_source,
547         },
548         [ALC861VD_LENOVO] = {
549                 .mixers = { alc861vd_lenovo_mixer },
550                 .init_verbs = { alc861vd_volume_init_verbs,
551                                 alc861vd_3stack_init_verbs,
552                                 alc861vd_eapd_verbs,
553                                 alc861vd_lenovo_unsol_verbs },
554                 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
555                 .dac_nids = alc660vd_dac_nids,
556                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
557                 .channel_mode = alc861vd_3stack_2ch_modes,
558                 .input_mux = &alc861vd_capture_source,
559                 .unsol_event = alc861vd_lenovo_unsol_event,
560                 .setup = alc861vd_lenovo_setup,
561                 .init_hook = alc861vd_lenovo_init_hook,
562         },
563         [ALC861VD_DALLAS] = {
564                 .mixers = { alc861vd_dallas_mixer },
565                 .init_verbs = { alc861vd_dallas_verbs },
566                 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
567                 .dac_nids = alc861vd_dac_nids,
568                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
569                 .channel_mode = alc861vd_3stack_2ch_modes,
570                 .input_mux = &alc861vd_dallas_capture_source,
571                 .unsol_event = alc_sku_unsol_event,
572                 .setup = alc861vd_dallas_setup,
573                 .init_hook = alc_hp_automute,
574         },
575         [ALC861VD_HP] = {
576                 .mixers = { alc861vd_hp_mixer },
577                 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
578                 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
579                 .dac_nids = alc861vd_dac_nids,
580                 .dig_out_nid = ALC861VD_DIGOUT_NID,
581                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
582                 .channel_mode = alc861vd_3stack_2ch_modes,
583                 .input_mux = &alc861vd_hp_capture_source,
584                 .unsol_event = alc_sku_unsol_event,
585                 .setup = alc861vd_dallas_setup,
586                 .init_hook = alc_hp_automute,
587         },
588         [ALC660VD_ASUS_V1S] = {
589                 .mixers = { alc861vd_lenovo_mixer },
590                 .init_verbs = { alc861vd_volume_init_verbs,
591                                 alc861vd_3stack_init_verbs,
592                                 alc861vd_eapd_verbs,
593                                 alc861vd_lenovo_unsol_verbs },
594                 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
595                 .dac_nids = alc660vd_dac_nids,
596                 .dig_out_nid = ALC861VD_DIGOUT_NID,
597                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
598                 .channel_mode = alc861vd_3stack_2ch_modes,
599                 .input_mux = &alc861vd_capture_source,
600                 .unsol_event = alc861vd_lenovo_unsol_event,
601                 .setup = alc861vd_lenovo_setup,
602                 .init_hook = alc861vd_lenovo_init_hook,
603         },
604 };
605