aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/alc880_quirks.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-02-20 12:20:42 -0500
committerTakashi Iwai <tiwai@suse.de>2012-02-20 12:20:42 -0500
commit67b6ec3196da235317ff1b9474f17379b78f3294 (patch)
tree316db5a3b4e7f27c188bc27cc21559c3aa426f4c /sound/pci/hda/alc880_quirks.c
parent29e3fdcc84e5da04cb7e6a36fee0a772c91d3b28 (diff)
ALSA: hda/realtek - Drop all ALC880 static quirks
Finally the all static quirks for ALC880 are converted to the auto-parser. Since we are never sure whether the BIOS on so many old machines are really correct, the quirk table entries are copied as they are, but just providing the proper pin-config values accordingly. Since alc880_quirks.c is removed, alc882_quirks.c has to be adjusted slightly to be built again. There might be some compile warnings due to the remaining alc882 quirks, but these shall be killed sooner or later, I don't care it much at this point. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/alc880_quirks.c')
-rw-r--r--sound/pci/hda/alc880_quirks.c808
1 files changed, 0 insertions, 808 deletions
diff --git a/sound/pci/hda/alc880_quirks.c b/sound/pci/hda/alc880_quirks.c
deleted file mode 100644
index 6917d78d4dcd..000000000000
--- a/sound/pci/hda/alc880_quirks.c
+++ /dev/null
@@ -1,808 +0,0 @@
1/*
2 * ALC880 quirk models
3 * included by patch_realtek.c
4 */
5
6/* ALC880 board config type */
7enum {
8 ALC880_AUTO,
9 ALC880_3ST,
10 ALC880_3ST_DIG,
11 ALC880_5ST,
12 ALC880_5ST_DIG,
13 ALC880_6ST,
14 ALC880_6ST_DIG,
15#ifdef CONFIG_SND_DEBUG
16 ALC880_TEST,
17#endif
18 ALC880_MODEL_LAST /* last tag */
19};
20
21/*
22 * ALC880 3-stack model
23 *
24 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
25 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
26 * F-Mic = 0x1b, HP = 0x19
27 */
28
29static const hda_nid_t alc880_dac_nids[4] = {
30 /* front, rear, clfe, rear_surr */
31 0x02, 0x05, 0x04, 0x03
32};
33
34static const hda_nid_t alc880_adc_nids[3] = {
35 /* ADC0-2 */
36 0x07, 0x08, 0x09,
37};
38
39/* The datasheet says the node 0x07 is connected from inputs,
40 * but it shows zero connection in the real implementation on some devices.
41 * Note: this is a 915GAV bug, fixed on 915GLV
42 */
43static const hda_nid_t alc880_adc_nids_alt[2] = {
44 /* ADC1-2 */
45 0x08, 0x09,
46};
47
48#define ALC880_DIGOUT_NID 0x06
49#define ALC880_DIGIN_NID 0x0a
50#define ALC880_PIN_CD_NID 0x1c
51
52static const struct hda_input_mux alc880_capture_source = {
53 .num_items = 4,
54 .items = {
55 { "Mic", 0x0 },
56 { "Front Mic", 0x3 },
57 { "Line", 0x2 },
58 { "CD", 0x4 },
59 },
60};
61
62/* channel source setting (2/6 channel selection for 3-stack) */
63/* 2ch mode */
64static const struct hda_verb alc880_threestack_ch2_init[] = {
65 /* set line-in to input, mute it */
66 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
67 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
68 /* set mic-in to input vref 80%, mute it */
69 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
70 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
71 { } /* end */
72};
73
74/* 6ch mode */
75static const struct hda_verb alc880_threestack_ch6_init[] = {
76 /* set line-in to output, unmute it */
77 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
78 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
79 /* set mic-in to output, unmute it */
80 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
81 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
82 { } /* end */
83};
84
85static const struct hda_channel_mode alc880_threestack_modes[2] = {
86 { 2, alc880_threestack_ch2_init },
87 { 6, alc880_threestack_ch6_init },
88};
89
90static const struct snd_kcontrol_new alc880_three_stack_mixer[] = {
91 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
92 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
93 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
94 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
95 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
96 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
97 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
98 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
99 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
100 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
101 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
102 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
105 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
107 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
108 {
109 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
110 .name = "Channel Mode",
111 .info = alc_ch_mode_info,
112 .get = alc_ch_mode_get,
113 .put = alc_ch_mode_put,
114 },
115 { } /* end */
116};
117
118/*
119 * ALC880 5-stack model
120 *
121 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
122 * Side = 0x02 (0xd)
123 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
124 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
125 */
126
127/* additional mixers to alc880_three_stack_mixer */
128static const struct snd_kcontrol_new alc880_five_stack_mixer[] = {
129 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
130 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
131 { } /* end */
132};
133
134/* channel source setting (6/8 channel selection for 5-stack) */
135/* 6ch mode */
136static const struct hda_verb alc880_fivestack_ch6_init[] = {
137 /* set line-in to input, mute it */
138 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
139 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
140 { } /* end */
141};
142
143/* 8ch mode */
144static const struct hda_verb alc880_fivestack_ch8_init[] = {
145 /* set line-in to output, unmute it */
146 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
147 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
148 { } /* end */
149};
150
151static const struct hda_channel_mode alc880_fivestack_modes[2] = {
152 { 6, alc880_fivestack_ch6_init },
153 { 8, alc880_fivestack_ch8_init },
154};
155
156
157/*
158 * ALC880 6-stack model
159 *
160 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
161 * Side = 0x05 (0x0f)
162 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
163 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
164 */
165
166static const hda_nid_t alc880_6st_dac_nids[4] = {
167 /* front, rear, clfe, rear_surr */
168 0x02, 0x03, 0x04, 0x05
169};
170
171static const struct hda_input_mux alc880_6stack_capture_source = {
172 .num_items = 4,
173 .items = {
174 { "Mic", 0x0 },
175 { "Front Mic", 0x1 },
176 { "Line", 0x2 },
177 { "CD", 0x4 },
178 },
179};
180
181/* fixed 8-channels */
182static const struct hda_channel_mode alc880_sixstack_modes[1] = {
183 { 8, NULL },
184};
185
186static const struct snd_kcontrol_new alc880_six_stack_mixer[] = {
187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
188 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
189 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
190 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
191 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
192 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
193 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
194 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
195 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
196 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
200 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
202 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
205 {
206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
207 .name = "Channel Mode",
208 .info = alc_ch_mode_info,
209 .get = alc_ch_mode_get,
210 .put = alc_ch_mode_put,
211 },
212 { } /* end */
213};
214
215
216static const hda_nid_t alc880_w810_dac_nids[3] = {
217 /* front, rear/surround, clfe */
218 0x02, 0x03, 0x04
219};
220
221/* fixed 2 channels */
222static const struct hda_channel_mode alc880_2_jack_modes[1] = {
223 { 2, NULL }
224};
225
226/*
227 * initialize the codec volumes, etc
228 */
229
230/*
231 * generic initialization of ADC, input mixers and output mixers
232 */
233static const struct hda_verb alc880_volume_init_verbs[] = {
234 /*
235 * Unmute ADC0-2 and set the default input to mic-in
236 */
237 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
239 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
240 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
241 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
242 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
243
244 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
245 * mixer widget
246 * Note: PASD motherboards uses the Line In 2 as the input for front
247 * panel mic (mic 2)
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 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
256 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
257
258 /*
259 * Set up output mixers (0x0c - 0x0f)
260 */
261 /* set vol=0 to output mixers */
262 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
263 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
266 /* set up input amps for analog loopback */
267 /* Amp Indices: DAC = 0, mixer = 1 */
268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
271 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
272 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
273 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
274 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
275 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
276
277 { }
278};
279
280/*
281 * 3-stack pin configuration:
282 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
283 */
284static const struct hda_verb alc880_pin_3stack_init_verbs[] = {
285 /*
286 * preset connection lists of input pins
287 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
288 */
289 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
290 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
291 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
292
293 /*
294 * Set pin mode and muting
295 */
296 /* set front pin widgets 0x14 for output */
297 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
298 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
299 /* Mic1 (rear panel) pin widget for input and vref at 80% */
300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
302 /* Mic2 (as headphone out) for HP output */
303 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
304 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
305 /* Line In pin widget for input */
306 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
307 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
308 /* Line2 (as front mic) pin widget for input and vref at 80% */
309 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
310 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
311 /* CD pin widget for input */
312 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
313
314 { }
315};
316
317/*
318 * 5-stack pin configuration:
319 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
320 * line-in/side = 0x1a, f-mic = 0x1b
321 */
322static const struct hda_verb alc880_pin_5stack_init_verbs[] = {
323 /*
324 * preset connection lists of input pins
325 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
326 */
327 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
328 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
329
330 /*
331 * Set pin mode and muting
332 */
333 /* set pin widgets 0x14-0x17 for output */
334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
335 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
336 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
337 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
338 /* unmute pins for output (no gain on this amp) */
339 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
340 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
341 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
342 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
343
344 /* Mic1 (rear panel) pin widget for input and vref at 80% */
345 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
346 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
347 /* Mic2 (as headphone out) for HP output */
348 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
349 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
350 /* Line In pin widget for input */
351 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
353 /* Line2 (as front mic) pin widget for input and vref at 80% */
354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
355 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
356 /* CD pin widget for input */
357 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
358
359 { }
360};
361
362/*
363 * 6-stack pin configuration:
364 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
365 * f-mic = 0x19, line = 0x1a, HP = 0x1b
366 */
367static const struct hda_verb alc880_pin_6stack_init_verbs[] = {
368 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
369
370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
374 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
375 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
376 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
377 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
378
379 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
380 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
381 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
382 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
383 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
384 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
386 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
387 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
388
389 { }
390};
391
392static const struct hda_verb alc880_beep_init_verbs[] = {
393 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
394 { }
395};
396
397/* Enable GPIO mask and set output */
398#define alc880_gpio1_init_verbs alc_gpio1_init_verbs
399#define alc880_gpio2_init_verbs alc_gpio2_init_verbs
400#define alc880_gpio3_init_verbs alc_gpio3_init_verbs
401
402/*
403 * Test configuration for debugging
404 *
405 * Almost all inputs/outputs are enabled. I/O pins can be configured via
406 * enum controls.
407 */
408#ifdef CONFIG_SND_DEBUG
409static const hda_nid_t alc880_test_dac_nids[4] = {
410 0x02, 0x03, 0x04, 0x05
411};
412
413static const struct hda_input_mux alc880_test_capture_source = {
414 .num_items = 7,
415 .items = {
416 { "In-1", 0x0 },
417 { "In-2", 0x1 },
418 { "In-3", 0x2 },
419 { "In-4", 0x3 },
420 { "CD", 0x4 },
421 { "Front", 0x5 },
422 { "Surround", 0x6 },
423 },
424};
425
426static const struct hda_channel_mode alc880_test_modes[4] = {
427 { 2, NULL },
428 { 4, NULL },
429 { 6, NULL },
430 { 8, NULL },
431};
432
433static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
434 struct snd_ctl_elem_info *uinfo)
435{
436 static const char * const texts[] = {
437 "N/A", "Line Out", "HP Out",
438 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
439 };
440 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
441 uinfo->count = 1;
442 uinfo->value.enumerated.items = 8;
443 if (uinfo->value.enumerated.item >= 8)
444 uinfo->value.enumerated.item = 7;
445 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
446 return 0;
447}
448
449static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
450 struct snd_ctl_elem_value *ucontrol)
451{
452 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
453 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
454 unsigned int pin_ctl, item = 0;
455
456 pin_ctl = snd_hda_codec_read(codec, nid, 0,
457 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
458 if (pin_ctl & AC_PINCTL_OUT_EN) {
459 if (pin_ctl & AC_PINCTL_HP_EN)
460 item = 2;
461 else
462 item = 1;
463 } else if (pin_ctl & AC_PINCTL_IN_EN) {
464 switch (pin_ctl & AC_PINCTL_VREFEN) {
465 case AC_PINCTL_VREF_HIZ: item = 3; break;
466 case AC_PINCTL_VREF_50: item = 4; break;
467 case AC_PINCTL_VREF_GRD: item = 5; break;
468 case AC_PINCTL_VREF_80: item = 6; break;
469 case AC_PINCTL_VREF_100: item = 7; break;
470 }
471 }
472 ucontrol->value.enumerated.item[0] = item;
473 return 0;
474}
475
476static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
477 struct snd_ctl_elem_value *ucontrol)
478{
479 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
480 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
481 static const unsigned int ctls[] = {
482 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
483 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
484 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
485 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
486 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
487 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
488 };
489 unsigned int old_ctl, new_ctl;
490
491 old_ctl = snd_hda_codec_read(codec, nid, 0,
492 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
493 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
494 if (old_ctl != new_ctl) {
495 int val;
496 snd_hda_codec_write_cache(codec, nid, 0,
497 AC_VERB_SET_PIN_WIDGET_CONTROL,
498 new_ctl);
499 val = ucontrol->value.enumerated.item[0] >= 3 ?
500 HDA_AMP_MUTE : 0;
501 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
502 HDA_AMP_MUTE, val);
503 return 1;
504 }
505 return 0;
506}
507
508static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
509 struct snd_ctl_elem_info *uinfo)
510{
511 static const char * const texts[] = {
512 "Front", "Surround", "CLFE", "Side"
513 };
514 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
515 uinfo->count = 1;
516 uinfo->value.enumerated.items = 4;
517 if (uinfo->value.enumerated.item >= 4)
518 uinfo->value.enumerated.item = 3;
519 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
520 return 0;
521}
522
523static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
524 struct snd_ctl_elem_value *ucontrol)
525{
526 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
527 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
528 unsigned int sel;
529
530 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
531 ucontrol->value.enumerated.item[0] = sel & 3;
532 return 0;
533}
534
535static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
536 struct snd_ctl_elem_value *ucontrol)
537{
538 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
539 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
540 unsigned int sel;
541
542 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
543 if (ucontrol->value.enumerated.item[0] != sel) {
544 sel = ucontrol->value.enumerated.item[0] & 3;
545 snd_hda_codec_write_cache(codec, nid, 0,
546 AC_VERB_SET_CONNECT_SEL, sel);
547 return 1;
548 }
549 return 0;
550}
551
552#define PIN_CTL_TEST(xname,nid) { \
553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
554 .name = xname, \
555 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
556 .info = alc_test_pin_ctl_info, \
557 .get = alc_test_pin_ctl_get, \
558 .put = alc_test_pin_ctl_put, \
559 .private_value = nid \
560 }
561
562#define PIN_SRC_TEST(xname,nid) { \
563 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
564 .name = xname, \
565 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
566 .info = alc_test_pin_src_info, \
567 .get = alc_test_pin_src_get, \
568 .put = alc_test_pin_src_put, \
569 .private_value = nid \
570 }
571
572static const struct snd_kcontrol_new alc880_test_mixer[] = {
573 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
574 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
575 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
576 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
578 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
579 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
580 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
581 PIN_CTL_TEST("Front Pin Mode", 0x14),
582 PIN_CTL_TEST("Surround Pin Mode", 0x15),
583 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
584 PIN_CTL_TEST("Side Pin Mode", 0x17),
585 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
586 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
587 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
588 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
589 PIN_SRC_TEST("In-1 Pin Source", 0x18),
590 PIN_SRC_TEST("In-2 Pin Source", 0x19),
591 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
592 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
593 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
594 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
595 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
596 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
597 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
598 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
599 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
600 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
601 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
602 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
603 {
604 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
605 .name = "Channel Mode",
606 .info = alc_ch_mode_info,
607 .get = alc_ch_mode_get,
608 .put = alc_ch_mode_put,
609 },
610 { } /* end */
611};
612
613static const struct hda_verb alc880_test_init_verbs[] = {
614 /* Unmute inputs of 0x0c - 0x0f */
615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
617 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
619 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
620 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
621 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
622 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
623 /* Vol output for 0x0c-0x0f */
624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
627 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
628 /* Set output pins 0x14-0x17 */
629 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
630 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
631 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
632 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
633 /* Unmute output pins 0x14-0x17 */
634 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
636 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
637 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
638 /* Set input pins 0x18-0x1c */
639 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
640 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
641 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
642 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
643 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
644 /* Mute input pins 0x18-0x1b */
645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
648 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
649 /* ADC set up */
650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
651 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
653 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
655 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
656 /* Analog input/passthru */
657 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
658 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
659 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
660 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
661 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
662 { }
663};
664#endif
665
666/*
667 */
668
669static const char * const alc880_models[ALC880_MODEL_LAST] = {
670 [ALC880_3ST] = "3stack",
671 [ALC880_3ST_DIG] = "3stack-digout",
672 [ALC880_5ST] = "5stack",
673 [ALC880_5ST_DIG] = "5stack-digout",
674 [ALC880_6ST] = "6stack",
675 [ALC880_6ST_DIG] = "6stack-digout",
676#ifdef CONFIG_SND_DEBUG
677 [ALC880_TEST] = "test",
678#endif
679 [ALC880_AUTO] = "auto",
680};
681
682static const struct snd_pci_quirk alc880_cfg_tbl[] = {
683 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
684 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
685 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
686 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
687 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
688 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
689 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
690 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
691 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
692
693 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
694 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
695 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
696 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
697 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
698 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
699 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
700 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
701 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
702 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
703 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
704 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
705 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
706 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
707 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
708 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
709 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
710 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
711 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
712 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
713 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
714 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
715 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
716 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
717 /* default Intel */
718 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
719 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
720 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
721 {}
722};
723
724/*
725 * ALC880 codec presets
726 */
727static const struct alc_config_preset alc880_presets[] = {
728 [ALC880_3ST] = {
729 .mixers = { alc880_three_stack_mixer },
730 .init_verbs = { alc880_volume_init_verbs,
731 alc880_pin_3stack_init_verbs },
732 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
733 .dac_nids = alc880_dac_nids,
734 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
735 .channel_mode = alc880_threestack_modes,
736 .need_dac_fix = 1,
737 .input_mux = &alc880_capture_source,
738 },
739 [ALC880_3ST_DIG] = {
740 .mixers = { alc880_three_stack_mixer },
741 .init_verbs = { alc880_volume_init_verbs,
742 alc880_pin_3stack_init_verbs },
743 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
744 .dac_nids = alc880_dac_nids,
745 .dig_out_nid = ALC880_DIGOUT_NID,
746 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
747 .channel_mode = alc880_threestack_modes,
748 .need_dac_fix = 1,
749 .input_mux = &alc880_capture_source,
750 },
751 [ALC880_5ST] = {
752 .mixers = { alc880_three_stack_mixer,
753 alc880_five_stack_mixer},
754 .init_verbs = { alc880_volume_init_verbs,
755 alc880_pin_5stack_init_verbs },
756 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
757 .dac_nids = alc880_dac_nids,
758 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
759 .channel_mode = alc880_fivestack_modes,
760 .input_mux = &alc880_capture_source,
761 },
762 [ALC880_5ST_DIG] = {
763 .mixers = { alc880_three_stack_mixer,
764 alc880_five_stack_mixer },
765 .init_verbs = { alc880_volume_init_verbs,
766 alc880_pin_5stack_init_verbs },
767 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
768 .dac_nids = alc880_dac_nids,
769 .dig_out_nid = ALC880_DIGOUT_NID,
770 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
771 .channel_mode = alc880_fivestack_modes,
772 .input_mux = &alc880_capture_source,
773 },
774 [ALC880_6ST] = {
775 .mixers = { alc880_six_stack_mixer },
776 .init_verbs = { alc880_volume_init_verbs,
777 alc880_pin_6stack_init_verbs },
778 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
779 .dac_nids = alc880_6st_dac_nids,
780 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
781 .channel_mode = alc880_sixstack_modes,
782 .input_mux = &alc880_6stack_capture_source,
783 },
784 [ALC880_6ST_DIG] = {
785 .mixers = { alc880_six_stack_mixer },
786 .init_verbs = { alc880_volume_init_verbs,
787 alc880_pin_6stack_init_verbs },
788 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
789 .dac_nids = alc880_6st_dac_nids,
790 .dig_out_nid = ALC880_DIGOUT_NID,
791 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
792 .channel_mode = alc880_sixstack_modes,
793 .input_mux = &alc880_6stack_capture_source,
794 },
795#ifdef CONFIG_SND_DEBUG
796 [ALC880_TEST] = {
797 .mixers = { alc880_test_mixer },
798 .init_verbs = { alc880_test_init_verbs },
799 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
800 .dac_nids = alc880_test_dac_nids,
801 .dig_out_nid = ALC880_DIGOUT_NID,
802 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
803 .channel_mode = alc880_test_modes,
804 .input_mux = &alc880_test_capture_source,
805 },
806#endif
807};
808