]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - sound/pci/hda/alc861vd_quirks.c
ALSA: hda - Restore VREF50 setup for ALC861-VD dallas/hp models
[mirror_ubuntu-bionic-kernel.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 /*
163 * generic initialization of ADC, input mixers and output mixers
164 */
165 static 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 */
215 static 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 */
246 static 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 */
290 static 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
299 static 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
307 static 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