]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - sound/pci/hda/alc861vd_quirks.c
ALSA: hda - Remove ALC861VD Lenovo, Dallas, HP and V1S model quirks
[karo-tx-linux.git] / 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         ALC861VD_3ST,
12         ALC861VD_3ST_DIG,
13         ALC861VD_6ST_DIG,
14         ALC861VD_MODEL_LAST,
15 };
16
17 #define ALC861VD_DIGOUT_NID     0x06
18
19 static 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  */
31 static const hda_nid_t alc660vd_dac_nids[3] = {
32         /* front, rear, clfe, rear_surr */
33         0x02, 0x04, 0x03
34 };
35
36 static const hda_nid_t alc861vd_adc_nids[1] = {
37         /* ADC0 */
38         0x09,
39 };
40
41 static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
42
43 /* input MUX */
44 /* FIXME: should be a matrix-type input source selection */
45 static 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  */
58 static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
59         { 2, NULL }
60 };
61
62 /*
63  * 6ch mode
64  */
65 static 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  */
76 static 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
84 static const struct hda_channel_mode alc861vd_6stack_modes[2] = {
85         { 6, alc861vd_6stack_ch6_init },
86         { 8, alc861vd_6stack_ch8_init },
87 };
88
89 static 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  */
103 static 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
139 static 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 static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
163         HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
164         /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
165         HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
166
167         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
168
169         HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
170         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
171         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
172
173         HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
174         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
175         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
176
177         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
178         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
179
180         { } /* end */
181 };
182
183 /*
184  * generic initialization of ADC, input mixers and output mixers
185  */
186 static const struct hda_verb alc861vd_volume_init_verbs[] = {
187         /*
188          * Unmute ADC0 and set the default input to mic-in
189          */
190         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
191         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
192
193         /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
194          * the analog-loopback mixer widget
195          */
196         /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
197         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
198         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
199         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
200         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
201         {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
202
203         /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
204         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
205         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
206         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
207         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
208
209         /*
210          * Set up output mixers (0x02 - 0x05)
211          */
212         /* set vol=0 to output mixers */
213         {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
214         {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
215         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
216         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
217
218         /* set up input amps for analog loopback */
219         /* Amp Indices: DAC = 0, mixer = 1 */
220         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
221         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
222         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
223         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
224         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
225         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
226         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
227         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
228
229         { }
230 };
231
232 /*
233  * 3-stack pin configuration:
234  * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
235  */
236 static const struct hda_verb alc861vd_3stack_init_verbs[] = {
237         /*
238          * Set pin mode and muting
239          */
240         /* set front pin widgets 0x14 for output */
241         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
242         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
243         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
244
245         /* Mic (rear) pin: input vref at 80% */
246         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
247         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
248         /* Front Mic pin: input vref at 80% */
249         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
250         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
251         /* Line In pin: input */
252         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
253         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
254         /* Line-2 In: Headphone output (output 0 - 0x0c) */
255         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
256         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
257         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
258         /* CD pin widget for input */
259         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
260
261         { }
262 };
263
264 /*
265  * 6-stack pin configuration:
266  */
267 static const struct hda_verb alc861vd_6stack_init_verbs[] = {
268         /*
269          * Set pin mode and muting
270          */
271         /* set front pin widgets 0x14 for output */
272         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
273         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
274         {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
275
276         /* Rear Pin: output 1 (0x0d) */
277         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
278         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
279         {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
280         /* CLFE Pin: output 2 (0x0e) */
281         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
282         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
283         {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
284         /* Side Pin: output 3 (0x0f) */
285         {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
286         {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
287         {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
288
289         /* Mic (rear) pin: input vref at 80% */
290         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
291         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
292         /* Front Mic pin: input vref at 80% */
293         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
294         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
295         /* Line In pin: input */
296         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
297         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
298         /* Line-2 In: Headphone output (output 0 - 0x0c) */
299         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
300         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
301         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
302         /* CD pin widget for input */
303         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
304
305         { }
306 };
307
308 static const struct hda_verb alc861vd_eapd_verbs[] = {
309         {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
310         { }
311 };
312
313 /*
314  * configuration and preset
315  */
316 static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
317         [ALC660VD_3ST]          = "3stack-660",
318         [ALC660VD_3ST_DIG]      = "3stack-660-digout",
319         [ALC861VD_3ST]          = "3stack",
320         [ALC861VD_3ST_DIG]      = "3stack-digout",
321         [ALC861VD_6ST_DIG]      = "6stack-digout",
322         [ALC861VD_AUTO]         = "auto",
323 };
324
325 static const struct snd_pci_quirk alc861vd_cfg_tbl[] = {
326         SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
327         SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
328         SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
329         SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
330         {}
331 };
332
333 static const struct alc_config_preset alc861vd_presets[] = {
334         [ALC660VD_3ST] = {
335                 .mixers = { alc861vd_3st_mixer },
336                 .init_verbs = { alc861vd_volume_init_verbs,
337                                  alc861vd_3stack_init_verbs },
338                 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
339                 .dac_nids = alc660vd_dac_nids,
340                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
341                 .channel_mode = alc861vd_3stack_2ch_modes,
342                 .input_mux = &alc861vd_capture_source,
343         },
344         [ALC660VD_3ST_DIG] = {
345                 .mixers = { alc861vd_3st_mixer },
346                 .init_verbs = { alc861vd_volume_init_verbs,
347                                  alc861vd_3stack_init_verbs },
348                 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
349                 .dac_nids = alc660vd_dac_nids,
350                 .dig_out_nid = ALC861VD_DIGOUT_NID,
351                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
352                 .channel_mode = alc861vd_3stack_2ch_modes,
353                 .input_mux = &alc861vd_capture_source,
354         },
355         [ALC861VD_3ST] = {
356                 .mixers = { alc861vd_3st_mixer },
357                 .init_verbs = { alc861vd_volume_init_verbs,
358                                  alc861vd_3stack_init_verbs },
359                 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
360                 .dac_nids = alc861vd_dac_nids,
361                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
362                 .channel_mode = alc861vd_3stack_2ch_modes,
363                 .input_mux = &alc861vd_capture_source,
364         },
365         [ALC861VD_3ST_DIG] = {
366                 .mixers = { alc861vd_3st_mixer },
367                 .init_verbs = { alc861vd_volume_init_verbs,
368                                  alc861vd_3stack_init_verbs },
369                 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
370                 .dac_nids = alc861vd_dac_nids,
371                 .dig_out_nid = ALC861VD_DIGOUT_NID,
372                 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
373                 .channel_mode = alc861vd_3stack_2ch_modes,
374                 .input_mux = &alc861vd_capture_source,
375         },
376         [ALC861VD_6ST_DIG] = {
377                 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
378                 .init_verbs = { alc861vd_volume_init_verbs,
379                                 alc861vd_6stack_init_verbs },
380                 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
381                 .dac_nids = alc861vd_dac_nids,
382                 .dig_out_nid = ALC861VD_DIGOUT_NID,
383                 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
384                 .channel_mode = alc861vd_6stack_modes,
385                 .input_mux = &alc861vd_capture_source,
386         },
387 };
388