aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-02-16 06:59:55 -0500
committerTakashi Iwai <tiwai@suse.de>2012-02-16 06:59:55 -0500
commitc3c2c9e7ff3e38bd9ff5b721b6ae8634fce42802 (patch)
tree312fe94754dbd44828baf80f27ae72b46567b679 /sound/pci
parentc29b3f6dd7798964d77199af4925be72a3a48349 (diff)
ALSA: hda/realtek - Remove leftover static quirks for ALC260
Now we can clean up all static quirks for ALC260. Also many codes in alc_quirks.c can be ripped off since they have been used only by ALC260 static quirks. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/alc260_quirks.c432
-rw-r--r--sound/pci/hda/alc_quirks.c301
-rw-r--r--sound/pci/hda/patch_realtek.c48
3 files changed, 8 insertions, 773 deletions
diff --git a/sound/pci/hda/alc260_quirks.c b/sound/pci/hda/alc260_quirks.c
deleted file mode 100644
index 305341f892c5..000000000000
--- a/sound/pci/hda/alc260_quirks.c
+++ /dev/null
@@ -1,432 +0,0 @@
1/*
2 * ALC260 quirk models
3 * included by patch_realtek.c
4 */
5
6/* ALC260 models */
7enum {
8 ALC260_AUTO,
9 ALC260_BASIC,
10#ifdef CONFIG_SND_DEBUG
11 ALC260_TEST,
12#endif
13 ALC260_MODEL_LAST /* last tag */
14};
15
16static const hda_nid_t alc260_dac_nids[1] = {
17 /* front */
18 0x02,
19};
20
21static const hda_nid_t alc260_adc_nids[1] = {
22 /* ADC0 */
23 0x04,
24};
25
26static const hda_nid_t alc260_adc_nids_alt[1] = {
27 /* ADC1 */
28 0x05,
29};
30
31/* NIDs used when simultaneous access to both ADCs makes sense. Note that
32 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
33 */
34static const hda_nid_t alc260_dual_adc_nids[2] = {
35 /* ADC0, ADC1 */
36 0x04, 0x05
37};
38
39#define ALC260_DIGOUT_NID 0x03
40#define ALC260_DIGIN_NID 0x06
41
42static const struct hda_input_mux alc260_capture_source = {
43 .num_items = 4,
44 .items = {
45 { "Mic", 0x0 },
46 { "Front Mic", 0x1 },
47 { "Line", 0x2 },
48 { "CD", 0x4 },
49 },
50};
51
52/* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
53 * the Fujitsu S702x, but jacks are marked differently.
54 */
55static const struct hda_input_mux alc260_acer_capture_sources[2] = {
56 {
57 .num_items = 4,
58 .items = {
59 { "Mic", 0x0 },
60 { "Line", 0x2 },
61 { "CD", 0x4 },
62 { "Headphone", 0x5 },
63 },
64 },
65 {
66 .num_items = 5,
67 .items = {
68 { "Mic", 0x0 },
69 { "Line", 0x2 },
70 { "CD", 0x4 },
71 { "Headphone", 0x6 },
72 { "Mixer", 0x5 },
73 },
74 },
75};
76
77/*
78 * This is just place-holder, so there's something for alc_build_pcms to look
79 * at when it calculates the maximum number of channels. ALC260 has no mixer
80 * element which allows changing the channel mode, so the verb list is
81 * never used.
82 */
83static const struct hda_channel_mode alc260_modes[1] = {
84 { 2, NULL },
85};
86
87
88/* Mixer combinations
89 *
90 * basic: base_output + input + pc_beep + capture
91 * fujitsu: fujitsu + capture
92 * acer: acer + capture
93 */
94
95static const struct snd_kcontrol_new alc260_base_output_mixer[] = {
96 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
97 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
98 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
99 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
100 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
101 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
102 { } /* end */
103};
104
105static const struct snd_kcontrol_new alc260_input_mixer[] = {
106 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
107 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
108 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
109 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
111 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
114 { } /* end */
115};
116
117/*
118 * initialization verbs
119 */
120static const struct hda_verb alc260_init_verbs[] = {
121 /* Line In pin widget for input */
122 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
123 /* CD pin widget for input */
124 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
125 /* Mic1 (rear panel) pin widget for input and vref at 80% */
126 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
127 /* Mic2 (front panel) pin widget for input and vref at 80% */
128 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
129 /* LINE-2 is used for line-out in rear */
130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
131 /* select line-out */
132 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
133 /* LINE-OUT pin */
134 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
135 /* enable HP */
136 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
137 /* enable Mono */
138 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
139 /* mute capture amp left and right */
140 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
141 /* set connection select to line in (default select for this ADC) */
142 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
143 /* mute capture amp left and right */
144 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
145 /* set connection select to line in (default select for this ADC) */
146 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
147 /* set vol=0 Line-Out mixer amp left and right */
148 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
149 /* unmute pin widget amp left and right (no gain on this amp) */
150 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
151 /* set vol=0 HP mixer amp left and right */
152 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
153 /* unmute pin widget amp left and right (no gain on this amp) */
154 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
155 /* set vol=0 Mono mixer amp left and right */
156 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
157 /* unmute pin widget amp left and right (no gain on this amp) */
158 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
159 /* unmute LINE-2 out pin */
160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
161 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
162 * Line In 2 = 0x03
163 */
164 /* mute analog inputs */
165 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
168 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
170 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
171 /* mute Front out path */
172 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
173 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
174 /* mute Headphone out path */
175 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
176 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
177 /* mute Mono out path */
178 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
179 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
180 { }
181};
182
183static const struct hda_verb alc260_hp_dc7600_verbs[] = {
184 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
185 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
186 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
187 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
188 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
189 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
190 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
191 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
192 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
193 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
194 {}
195};
196
197/* Test configuration for debugging, modelled after the ALC880 test
198 * configuration.
199 */
200#ifdef CONFIG_SND_DEBUG
201static const hda_nid_t alc260_test_dac_nids[1] = {
202 0x02,
203};
204static const hda_nid_t alc260_test_adc_nids[2] = {
205 0x04, 0x05,
206};
207/* For testing the ALC260, each input MUX needs its own definition since
208 * the signal assignments are different. This assumes that the first ADC
209 * is NID 0x04.
210 */
211static const struct hda_input_mux alc260_test_capture_sources[2] = {
212 {
213 .num_items = 7,
214 .items = {
215 { "MIC1 pin", 0x0 },
216 { "MIC2 pin", 0x1 },
217 { "LINE1 pin", 0x2 },
218 { "LINE2 pin", 0x3 },
219 { "CD pin", 0x4 },
220 { "LINE-OUT pin", 0x5 },
221 { "HP-OUT pin", 0x6 },
222 },
223 },
224 {
225 .num_items = 8,
226 .items = {
227 { "MIC1 pin", 0x0 },
228 { "MIC2 pin", 0x1 },
229 { "LINE1 pin", 0x2 },
230 { "LINE2 pin", 0x3 },
231 { "CD pin", 0x4 },
232 { "Mixer", 0x5 },
233 { "LINE-OUT pin", 0x6 },
234 { "HP-OUT pin", 0x7 },
235 },
236 },
237};
238static const struct snd_kcontrol_new alc260_test_mixer[] = {
239 /* Output driver widgets */
240 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
241 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
242 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
243 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
244 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
245 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
246
247 /* Modes for retasking pin widgets
248 * Note: the ALC260 doesn't seem to act on requests to enable mic
249 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
250 * mention this restriction. At this stage it's not clear whether
251 * this behaviour is intentional or is a hardware bug in chip
252 * revisions available at least up until early 2006. Therefore for
253 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
254 * choices, but if it turns out that the lack of mic bias for these
255 * NIDs is intentional we could change their modes from
256 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
257 */
258 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
259 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
260 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
261 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
262 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
263 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
264
265 /* Loopback mixer controls */
266 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
267 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
268 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
269 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
270 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
271 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
272 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
273 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
274 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
275 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
276 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
277 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
278 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
279 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
280
281 /* Controls for GPIO pins, assuming they are configured as outputs */
282 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
283 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
284 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
285 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
286
287 /* Switches to allow the digital IO pins to be enabled. The datasheet
288 * is ambigious as to which NID is which; testing on laptops which
289 * make this output available should provide clarification.
290 */
291 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
292 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
293
294 /* A switch allowing EAPD to be enabled. Some laptops seem to use
295 * this output to turn on an external amplifier.
296 */
297 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
298 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
299
300 { } /* end */
301};
302static const struct hda_verb alc260_test_init_verbs[] = {
303 /* Enable all GPIOs as outputs with an initial value of 0 */
304 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
305 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
306 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
307
308 /* Enable retasking pins as output, initially without power amp */
309 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
310 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
311 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
313 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
314 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
315
316 /* Disable digital (SPDIF) pins initially, but users can enable
317 * them via a mixer switch. In the case of SPDIF-out, this initverb
318 * payload also sets the generation to 0, output to be in "consumer"
319 * PCM format, copyright asserted, no pre-emphasis and no validity
320 * control.
321 */
322 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
323 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
324
325 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
326 * OUT1 sum bus when acting as an output.
327 */
328 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
329 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
330 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
331 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
332
333 /* Start with output sum widgets muted and their output gains at min */
334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
337 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
340 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
341 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
342 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
343
344 /* Unmute retasking pin widget output buffers since the default
345 * state appears to be output. As the pin mode is changed by the
346 * user the pin mode control will take care of enabling the pin's
347 * input/output buffers as needed.
348 */
349 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
350 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
353 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
354 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
355 /* Also unmute the mono-out pin widget */
356 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
357
358 /* Mute capture amp left and right */
359 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
360 /* Set ADC connection select to match default mixer setting (mic1
361 * pin)
362 */
363 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
364
365 /* Do the same for the second ADC: mute capture input amp and
366 * set ADC connection to mic1 pin
367 */
368 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
369 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
370
371 /* Mute all inputs to mixer widget (even unconnected ones) */
372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
380
381 { }
382};
383#endif
384
385/*
386 * ALC260 configurations
387 */
388static const char * const alc260_models[ALC260_MODEL_LAST] = {
389 [ALC260_BASIC] = "basic",
390#ifdef CONFIG_SND_DEBUG
391 [ALC260_TEST] = "test",
392#endif
393 [ALC260_AUTO] = "auto",
394};
395
396static const struct snd_pci_quirk alc260_cfg_tbl[] = {
397 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
398 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
399 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
400 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
401 {}
402};
403
404static const struct alc_config_preset alc260_presets[] = {
405 [ALC260_BASIC] = {
406 .mixers = { alc260_base_output_mixer,
407 alc260_input_mixer },
408 .init_verbs = { alc260_init_verbs },
409 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
410 .dac_nids = alc260_dac_nids,
411 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
412 .adc_nids = alc260_dual_adc_nids,
413 .num_channel_mode = ARRAY_SIZE(alc260_modes),
414 .channel_mode = alc260_modes,
415 .input_mux = &alc260_capture_source,
416 },
417#ifdef CONFIG_SND_DEBUG
418 [ALC260_TEST] = {
419 .mixers = { alc260_test_mixer },
420 .init_verbs = { alc260_test_init_verbs },
421 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
422 .dac_nids = alc260_test_dac_nids,
423 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
424 .adc_nids = alc260_test_adc_nids,
425 .num_channel_mode = ARRAY_SIZE(alc260_modes),
426 .channel_mode = alc260_modes,
427 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
428 .input_mux = alc260_test_capture_sources,
429 },
430#endif
431};
432
diff --git a/sound/pci/hda/alc_quirks.c b/sound/pci/hda/alc_quirks.c
index a18952ed4311..b344603ac06d 100644
--- a/sound/pci/hda/alc_quirks.c
+++ b/sound/pci/hda/alc_quirks.c
@@ -74,307 +74,6 @@ static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
74 return err; 74 return err;
75} 75}
76 76
77/*
78 * Control the mode of pin widget settings via the mixer. "pc" is used
79 * instead of "%" to avoid consequences of accidentally treating the % as
80 * being part of a format specifier. Maximum allowed length of a value is
81 * 63 characters plus NULL terminator.
82 *
83 * Note: some retasking pin complexes seem to ignore requests for input
84 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
85 * are requested. Therefore order this list so that this behaviour will not
86 * cause problems when mixer clients move through the enum sequentially.
87 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
88 * March 2006.
89 */
90static const char * const alc_pin_mode_names[] = {
91 "Mic 50pc bias", "Mic 80pc bias",
92 "Line in", "Line out", "Headphone out",
93};
94static const unsigned char alc_pin_mode_values[] = {
95 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
96};
97/* The control can present all 5 options, or it can limit the options based
98 * in the pin being assumed to be exclusively an input or an output pin. In
99 * addition, "input" pins may or may not process the mic bias option
100 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
101 * accept requests for bias as of chip versions up to March 2006) and/or
102 * wiring in the computer.
103 */
104#define ALC_PIN_DIR_IN 0x00
105#define ALC_PIN_DIR_OUT 0x01
106#define ALC_PIN_DIR_INOUT 0x02
107#define ALC_PIN_DIR_IN_NOMICBIAS 0x03
108#define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
109
110/* Info about the pin modes supported by the different pin direction modes.
111 * For each direction the minimum and maximum values are given.
112 */
113static const signed char alc_pin_mode_dir_info[5][2] = {
114 { 0, 2 }, /* ALC_PIN_DIR_IN */
115 { 3, 4 }, /* ALC_PIN_DIR_OUT */
116 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
117 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
118 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
119};
120#define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
121#define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
122#define alc_pin_mode_n_items(_dir) \
123 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
124
125static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
126 struct snd_ctl_elem_info *uinfo)
127{
128 unsigned int item_num = uinfo->value.enumerated.item;
129 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
130
131 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
132 uinfo->count = 1;
133 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
134
135 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
136 item_num = alc_pin_mode_min(dir);
137 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
138 return 0;
139}
140
141static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
142 struct snd_ctl_elem_value *ucontrol)
143{
144 unsigned int i;
145 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
146 hda_nid_t nid = kcontrol->private_value & 0xffff;
147 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
148 long *valp = ucontrol->value.integer.value;
149 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
150 AC_VERB_GET_PIN_WIDGET_CONTROL,
151 0x00);
152
153 /* Find enumerated value for current pinctl setting */
154 i = alc_pin_mode_min(dir);
155 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
156 i++;
157 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
158 return 0;
159}
160
161static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
162 struct snd_ctl_elem_value *ucontrol)
163{
164 signed int change;
165 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
166 hda_nid_t nid = kcontrol->private_value & 0xffff;
167 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
168 long val = *ucontrol->value.integer.value;
169 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
170 AC_VERB_GET_PIN_WIDGET_CONTROL,
171 0x00);
172
173 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
174 val = alc_pin_mode_min(dir);
175
176 change = pinctl != alc_pin_mode_values[val];
177 if (change) {
178 /* Set pin mode to that requested */
179 snd_hda_codec_write_cache(codec, nid, 0,
180 AC_VERB_SET_PIN_WIDGET_CONTROL,
181 alc_pin_mode_values[val]);
182
183 /* Also enable the retasking pin's input/output as required
184 * for the requested pin mode. Enum values of 2 or less are
185 * input modes.
186 *
187 * Dynamically switching the input/output buffers probably
188 * reduces noise slightly (particularly on input) so we'll
189 * do it. However, having both input and output buffers
190 * enabled simultaneously doesn't seem to be problematic if
191 * this turns out to be necessary in the future.
192 */
193 if (val <= 2) {
194 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
195 HDA_AMP_MUTE, HDA_AMP_MUTE);
196 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
197 HDA_AMP_MUTE, 0);
198 } else {
199 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
200 HDA_AMP_MUTE, HDA_AMP_MUTE);
201 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
202 HDA_AMP_MUTE, 0);
203 }
204 }
205 return change;
206}
207
208#define ALC_PIN_MODE(xname, nid, dir) \
209 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
210 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
211 .info = alc_pin_mode_info, \
212 .get = alc_pin_mode_get, \
213 .put = alc_pin_mode_put, \
214 .private_value = nid | (dir<<16) }
215
216/* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
217 * together using a mask with more than one bit set. This control is
218 * currently used only by the ALC260 test model. At this stage they are not
219 * needed for any "production" models.
220 */
221#ifdef CONFIG_SND_DEBUG
222#define alc_gpio_data_info snd_ctl_boolean_mono_info
223
224static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
225 struct snd_ctl_elem_value *ucontrol)
226{
227 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
228 hda_nid_t nid = kcontrol->private_value & 0xffff;
229 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
230 long *valp = ucontrol->value.integer.value;
231 unsigned int val = snd_hda_codec_read(codec, nid, 0,
232 AC_VERB_GET_GPIO_DATA, 0x00);
233
234 *valp = (val & mask) != 0;
235 return 0;
236}
237static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
238 struct snd_ctl_elem_value *ucontrol)
239{
240 signed int change;
241 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
242 hda_nid_t nid = kcontrol->private_value & 0xffff;
243 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
244 long val = *ucontrol->value.integer.value;
245 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
246 AC_VERB_GET_GPIO_DATA,
247 0x00);
248
249 /* Set/unset the masked GPIO bit(s) as needed */
250 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
251 if (val == 0)
252 gpio_data &= ~mask;
253 else
254 gpio_data |= mask;
255 snd_hda_codec_write_cache(codec, nid, 0,
256 AC_VERB_SET_GPIO_DATA, gpio_data);
257
258 return change;
259}
260#define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
261 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
262 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
263 .info = alc_gpio_data_info, \
264 .get = alc_gpio_data_get, \
265 .put = alc_gpio_data_put, \
266 .private_value = nid | (mask<<16) }
267#endif /* CONFIG_SND_DEBUG */
268
269/* A switch control to allow the enabling of the digital IO pins on the
270 * ALC260. This is incredibly simplistic; the intention of this control is
271 * to provide something in the test model allowing digital outputs to be
272 * identified if present. If models are found which can utilise these
273 * outputs a more complete mixer control can be devised for those models if
274 * necessary.
275 */
276#ifdef CONFIG_SND_DEBUG
277#define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
278
279static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
280 struct snd_ctl_elem_value *ucontrol)
281{
282 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
283 hda_nid_t nid = kcontrol->private_value & 0xffff;
284 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
285 long *valp = ucontrol->value.integer.value;
286 unsigned int val = snd_hda_codec_read(codec, nid, 0,
287 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
288
289 *valp = (val & mask) != 0;
290 return 0;
291}
292static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
293 struct snd_ctl_elem_value *ucontrol)
294{
295 signed int change;
296 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
297 hda_nid_t nid = kcontrol->private_value & 0xffff;
298 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
299 long val = *ucontrol->value.integer.value;
300 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
301 AC_VERB_GET_DIGI_CONVERT_1,
302 0x00);
303
304 /* Set/unset the masked control bit(s) as needed */
305 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
306 if (val==0)
307 ctrl_data &= ~mask;
308 else
309 ctrl_data |= mask;
310 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
311 ctrl_data);
312
313 return change;
314}
315#define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
316 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
317 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
318 .info = alc_spdif_ctrl_info, \
319 .get = alc_spdif_ctrl_get, \
320 .put = alc_spdif_ctrl_put, \
321 .private_value = nid | (mask<<16) }
322#endif /* CONFIG_SND_DEBUG */
323
324/* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
325 * Again, this is only used in the ALC26x test models to help identify when
326 * the EAPD line must be asserted for features to work.
327 */
328#ifdef CONFIG_SND_DEBUG
329#define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
330
331static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
332 struct snd_ctl_elem_value *ucontrol)
333{
334 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
335 hda_nid_t nid = kcontrol->private_value & 0xffff;
336 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
337 long *valp = ucontrol->value.integer.value;
338 unsigned int val = snd_hda_codec_read(codec, nid, 0,
339 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
340
341 *valp = (val & mask) != 0;
342 return 0;
343}
344
345static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
346 struct snd_ctl_elem_value *ucontrol)
347{
348 int change;
349 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
350 hda_nid_t nid = kcontrol->private_value & 0xffff;
351 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
352 long val = *ucontrol->value.integer.value;
353 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
354 AC_VERB_GET_EAPD_BTLENABLE,
355 0x00);
356
357 /* Set/unset the masked control bit(s) as needed */
358 change = (!val ? 0 : mask) != (ctrl_data & mask);
359 if (!val)
360 ctrl_data &= ~mask;
361 else
362 ctrl_data |= mask;
363 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
364 ctrl_data);
365
366 return change;
367}
368
369#define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
370 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
371 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
372 .info = alc_eapd_ctrl_info, \
373 .get = alc_eapd_ctrl_get, \
374 .put = alc_eapd_ctrl_put, \
375 .private_value = nid | (mask<<16) }
376#endif /* CONFIG_SND_DEBUG */
377
378static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) 77static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
379{ 78{
380 struct alc_spec *spec = codec->spec; 79 struct alc_spec *spec = codec->spec;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 0d81eeb563c7..3ea42069b8ee 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4308,14 +4308,10 @@ static const struct snd_pci_quirk alc260_fixup_tbl[] = {
4308 4308
4309/* 4309/*
4310 */ 4310 */
4311#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4312#include "alc260_quirks.c"
4313#endif
4314
4315static int patch_alc260(struct hda_codec *codec) 4311static int patch_alc260(struct hda_codec *codec)
4316{ 4312{
4317 struct alc_spec *spec; 4313 struct alc_spec *spec;
4318 int err, board_config; 4314 int err;
4319 4315
4320 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4316 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4321 if (spec == NULL) 4317 if (spec == NULL)
@@ -4325,38 +4321,13 @@ static int patch_alc260(struct hda_codec *codec)
4325 4321
4326 spec->mixer_nid = 0x07; 4322 spec->mixer_nid = 0x07;
4327 4323
4328 board_config = alc_board_config(codec, ALC260_MODEL_LAST, 4324 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
4329 alc260_models, alc260_cfg_tbl); 4325 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
4330 if (board_config < 0) {
4331 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4332 codec->chip_name);
4333 board_config = ALC_MODEL_AUTO;
4334 }
4335
4336 if (board_config == ALC_MODEL_AUTO) {
4337 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
4338 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
4339 }
4340
4341 if (board_config == ALC_MODEL_AUTO) {
4342 /* automatic parse from the BIOS config */
4343 err = alc260_parse_auto_config(codec);
4344 if (err < 0)
4345 goto error;
4346#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4347 else if (!err) {
4348 printk(KERN_INFO
4349 "hda_codec: Cannot set up configuration "
4350 "from BIOS. Using base mode...\n");
4351 board_config = ALC260_BASIC;
4352 }
4353#endif
4354 }
4355 4326
4356 if (board_config != ALC_MODEL_AUTO) { 4327 /* automatic parse from the BIOS config */
4357 setup_preset(codec, &alc260_presets[board_config]); 4328 err = alc260_parse_auto_config(codec);
4358 spec->vmaster_nid = 0x08; 4329 if (err < 0)
4359 } 4330 goto error;
4360 4331
4361 if (!spec->no_analog && !spec->adc_nids) { 4332 if (!spec->no_analog && !spec->adc_nids) {
4362 alc_auto_fill_adc_caps(codec); 4333 alc_auto_fill_adc_caps(codec);
@@ -4377,10 +4348,7 @@ static int patch_alc260(struct hda_codec *codec)
4377 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 4348 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
4378 4349
4379 codec->patch_ops = alc_patch_ops; 4350 codec->patch_ops = alc_patch_ops;
4380 if (board_config == ALC_MODEL_AUTO) 4351 spec->init_hook = alc_auto_init_std;
4381 spec->init_hook = alc_auto_init_std;
4382 else
4383 codec->patch_ops.build_controls = __alc_build_controls;
4384 spec->shutup = alc_eapd_shutup; 4352 spec->shutup = alc_eapd_shutup;
4385#ifdef CONFIG_SND_HDA_POWER_SAVE 4353#ifdef CONFIG_SND_HDA_POWER_SAVE
4386 if (!spec->loopback.amplist) 4354 if (!spec->loopback.amplist)