ALSA: hda - Fix wrong gpio_dir & gpio_mask hint setups for IDT/STAC codecs
[pandora-kernel.git] / sound / pci / hda / alc260_quirks.c
1 /*
2  * ALC260 quirk models
3  * included by patch_realtek.c
4  */
5
6 /* ALC260 models */
7 enum {
8         ALC260_AUTO,
9         ALC260_BASIC,
10         ALC260_FUJITSU_S702X,
11         ALC260_ACER,
12         ALC260_WILL,
13         ALC260_REPLACER_672V,
14         ALC260_FAVORIT100,
15 #ifdef CONFIG_SND_DEBUG
16         ALC260_TEST,
17 #endif
18         ALC260_MODEL_LAST /* last tag */
19 };
20
21 static const hda_nid_t alc260_dac_nids[1] = {
22         /* front */
23         0x02,
24 };
25
26 static const hda_nid_t alc260_adc_nids[1] = {
27         /* ADC0 */
28         0x04,
29 };
30
31 static const hda_nid_t alc260_adc_nids_alt[1] = {
32         /* ADC1 */
33         0x05,
34 };
35
36 /* NIDs used when simultaneous access to both ADCs makes sense.  Note that
37  * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
38  */
39 static const hda_nid_t alc260_dual_adc_nids[2] = {
40         /* ADC0, ADC1 */
41         0x04, 0x05
42 };
43
44 #define ALC260_DIGOUT_NID       0x03
45 #define ALC260_DIGIN_NID        0x06
46
47 static const struct hda_input_mux alc260_capture_source = {
48         .num_items = 4,
49         .items = {
50                 { "Mic", 0x0 },
51                 { "Front Mic", 0x1 },
52                 { "Line", 0x2 },
53                 { "CD", 0x4 },
54         },
55 };
56
57 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
58  * headphone jack and the internal CD lines since these are the only pins at
59  * which audio can appear.  For flexibility, also allow the option of
60  * recording the mixer output on the second ADC (ADC0 doesn't have a
61  * connection to the mixer output).
62  */
63 static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
64         {
65                 .num_items = 3,
66                 .items = {
67                         { "Mic/Line", 0x0 },
68                         { "CD", 0x4 },
69                         { "Headphone", 0x2 },
70                 },
71         },
72         {
73                 .num_items = 4,
74                 .items = {
75                         { "Mic/Line", 0x0 },
76                         { "CD", 0x4 },
77                         { "Headphone", 0x2 },
78                         { "Mixer", 0x5 },
79                 },
80         },
81
82 };
83
84 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
85  * the Fujitsu S702x, but jacks are marked differently.
86  */
87 static const struct hda_input_mux alc260_acer_capture_sources[2] = {
88         {
89                 .num_items = 4,
90                 .items = {
91                         { "Mic", 0x0 },
92                         { "Line", 0x2 },
93                         { "CD", 0x4 },
94                         { "Headphone", 0x5 },
95                 },
96         },
97         {
98                 .num_items = 5,
99                 .items = {
100                         { "Mic", 0x0 },
101                         { "Line", 0x2 },
102                         { "CD", 0x4 },
103                         { "Headphone", 0x6 },
104                         { "Mixer", 0x5 },
105                 },
106         },
107 };
108
109 /* Maxdata Favorit 100XS */
110 static const struct hda_input_mux alc260_favorit100_capture_sources[2] = {
111         {
112                 .num_items = 2,
113                 .items = {
114                         { "Line/Mic", 0x0 },
115                         { "CD", 0x4 },
116                 },
117         },
118         {
119                 .num_items = 3,
120                 .items = {
121                         { "Line/Mic", 0x0 },
122                         { "CD", 0x4 },
123                         { "Mixer", 0x5 },
124                 },
125         },
126 };
127
128 /*
129  * This is just place-holder, so there's something for alc_build_pcms to look
130  * at when it calculates the maximum number of channels. ALC260 has no mixer
131  * element which allows changing the channel mode, so the verb list is
132  * never used.
133  */
134 static const struct hda_channel_mode alc260_modes[1] = {
135         { 2, NULL },
136 };
137
138
139 /* Mixer combinations
140  *
141  * basic: base_output + input + pc_beep + capture
142  * fujitsu: fujitsu + capture
143  * acer: acer + capture
144  */
145
146 static const struct snd_kcontrol_new alc260_base_output_mixer[] = {
147         HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
148         HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
149         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
150         HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
151         HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
152         HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
153         { } /* end */
154 };
155
156 static const struct snd_kcontrol_new alc260_input_mixer[] = {
157         HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
158         HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
159         HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
160         HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
161         HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
162         HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
163         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
164         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
165         { } /* end */
166 };
167
168 /* Fujitsu S702x series laptops.  ALC260 pin usage: Mic/Line jack = 0x12,
169  * HP jack = 0x14, CD audio =  0x16, internal speaker = 0x10.
170  */
171 static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
172         HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
173         HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
174         ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
175         HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
176         HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
177         HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
178         HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
179         ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
180         HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
181         HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
182         { } /* end */
183 };
184
185 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks.  Note that current
186  * versions of the ALC260 don't act on requests to enable mic bias from NID
187  * 0x0f (used to drive the headphone jack in these laptops).  The ALC260
188  * datasheet doesn't mention this restriction.  At this stage it's not clear
189  * whether this behaviour is intentional or is a hardware bug in chip
190  * revisions available in early 2006.  Therefore for now allow the
191  * "Headphone Jack Mode" control to span all choices, but if it turns out
192  * that the lack of mic bias for this NID is intentional we could change the
193  * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
194  *
195  * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
196  * don't appear to make the mic bias available from the "line" jack, even
197  * though the NID used for this jack (0x14) can supply it.  The theory is
198  * that perhaps Acer have included blocking capacitors between the ALC260
199  * and the output jack.  If this turns out to be the case for all such
200  * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
201  * to ALC_PIN_DIR_INOUT_NOMICBIAS.
202  *
203  * The C20x Tablet series have a mono internal speaker which is controlled
204  * via the chip's Mono sum widget and pin complex, so include the necessary
205  * controls for such models.  On models without a "mono speaker" the control
206  * won't do anything.
207  */
208 static const struct snd_kcontrol_new alc260_acer_mixer[] = {
209         HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
210         HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
211         ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
212         HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
213                               HDA_OUTPUT),
214         HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
215                            HDA_INPUT),
216         HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
217         HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
218         HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
219         HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
220         ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
221         HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
222         HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
223         ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
224         { } /* end */
225 };
226
227 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
228  */
229 static const struct snd_kcontrol_new alc260_favorit100_mixer[] = {
230         HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
231         HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
232         ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
233         HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
234         HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
235         ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
236         { } /* end */
237 };
238
239 /* Packard bell V7900  ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
240  * Line In jack = 0x14, CD audio =  0x16, pc beep = 0x17.
241  */
242 static const struct snd_kcontrol_new alc260_will_mixer[] = {
243         HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
244         HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
245         HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
246         HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
247         ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
248         HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
249         HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
250         ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
251         HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
252         HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
253         { } /* end */
254 };
255
256 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
257  * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
258  */
259 static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
260         HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
261         HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
262         HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
263         HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
264         ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
265         HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
266         HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
267         HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
268         HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
269         ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
270         { } /* end */
271 };
272
273 /*
274  * initialization verbs
275  */
276 static const struct hda_verb alc260_init_verbs[] = {
277         /* Line In pin widget for input */
278         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
279         /* CD pin widget for input */
280         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
281         /* Mic1 (rear panel) pin widget for input and vref at 80% */
282         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
283         /* Mic2 (front panel) pin widget for input and vref at 80% */
284         {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
285         /* LINE-2 is used for line-out in rear */
286         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
287         /* select line-out */
288         {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
289         /* LINE-OUT pin */
290         {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
291         /* enable HP */
292         {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
293         /* enable Mono */
294         {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
295         /* mute capture amp left and right */
296         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
297         /* set connection select to line in (default select for this ADC) */
298         {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
299         /* mute capture amp left and right */
300         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
301         /* set connection select to line in (default select for this ADC) */
302         {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
303         /* set vol=0 Line-Out mixer amp left and right */
304         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
305         /* unmute pin widget amp left and right (no gain on this amp) */
306         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
307         /* set vol=0 HP mixer amp left and right */
308         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
309         /* unmute pin widget amp left and right (no gain on this amp) */
310         {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
311         /* set vol=0 Mono mixer amp left and right */
312         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
313         /* unmute pin widget amp left and right (no gain on this amp) */
314         {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
315         /* unmute LINE-2 out pin */
316         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
317         /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
318          * Line In 2 = 0x03
319          */
320         /* mute analog inputs */
321         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
322         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
323         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
324         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
325         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
326         /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
327         /* mute Front out path */
328         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
329         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
330         /* mute Headphone out path */
331         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
332         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
333         /* mute Mono out path */
334         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
335         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
336         { }
337 };
338
339 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
340  * laptops.  ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
341  * audio = 0x16, internal speaker = 0x10.
342  */
343 static const struct hda_verb alc260_fujitsu_init_verbs[] = {
344         /* Disable all GPIOs */
345         {0x01, AC_VERB_SET_GPIO_MASK, 0},
346         /* Internal speaker is connected to headphone pin */
347         {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
348         /* Headphone/Line-out jack connects to Line1 pin; make it an output */
349         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
350         /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
351         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
352         /* Ensure all other unused pins are disabled and muted. */
353         {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
354         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
355         {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
356         {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
357         {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
358         {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
359         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
360         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
361
362         /* Disable digital (SPDIF) pins */
363         {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
364         {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
365
366         /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
367          * when acting as an output.
368          */
369         {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
370
371         /* Start with output sum widgets muted and their output gains at min */
372         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
373         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
374         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
375         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
376         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
377         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
378         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
379         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
380         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
381
382         /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
383         {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
384         /* Unmute Line1 pin widget output buffer since it starts as an output.
385          * If the pin mode is changed by the user the pin mode control will
386          * take care of enabling the pin's input/output buffers as needed.
387          * Therefore there's no need to enable the input buffer at this
388          * stage.
389          */
390         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
391         /* Unmute input buffer of pin widget used for Line-in (no equiv
392          * mixer ctrl)
393          */
394         {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
395
396         /* Mute capture amp left and right */
397         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
398         /* Set ADC connection select to match default mixer setting - line
399          * in (on mic1 pin)
400          */
401         {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
402
403         /* Do the same for the second ADC: mute capture input amp and
404          * set ADC connection to line in (on mic1 pin)
405          */
406         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
407         {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
408
409         /* Mute all inputs to mixer widget (even unconnected ones) */
410         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
411         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
412         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
413         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
414         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
415         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
416         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
417         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
418
419         { }
420 };
421
422 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
423  * similar laptops (adapted from Fujitsu init verbs).
424  */
425 static const struct hda_verb alc260_acer_init_verbs[] = {
426         /* On TravelMate laptops, GPIO 0 enables the internal speaker and
427          * the headphone jack.  Turn this on and rely on the standard mute
428          * methods whenever the user wants to turn these outputs off.
429          */
430         {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
431         {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
432         {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
433         /* Internal speaker/Headphone jack is connected to Line-out pin */
434         {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
435         /* Internal microphone/Mic jack is connected to Mic1 pin */
436         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
437         /* Line In jack is connected to Line1 pin */
438         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
439         /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
440         {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
441         /* Ensure all other unused pins are disabled and muted. */
442         {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
443         {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
444         {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
445         {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
446         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
447         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
448         /* Disable digital (SPDIF) pins */
449         {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
450         {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
451
452         /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
453          * bus when acting as outputs.
454          */
455         {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
456         {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
457
458         /* Start with output sum widgets muted and their output gains at min */
459         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
460         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
461         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
462         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
463         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
464         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
465         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
466         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
467         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
468
469         /* Unmute Line-out pin widget amp left and right
470          * (no equiv mixer ctrl)
471          */
472         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
473         /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
474         {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
475         /* Unmute Mic1 and Line1 pin widget input buffers since they start as
476          * inputs. If the pin mode is changed by the user the pin mode control
477          * will take care of enabling the pin's input/output buffers as needed.
478          * Therefore there's no need to enable the input buffer at this
479          * stage.
480          */
481         {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
482         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
483
484         /* Mute capture amp left and right */
485         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
486         /* Set ADC connection select to match default mixer setting - mic
487          * (on mic1 pin)
488          */
489         {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
490
491         /* Do similar with the second ADC: mute capture input amp and
492          * set ADC connection to mic to match ALSA's default state.
493          */
494         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
495         {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
496
497         /* Mute all inputs to mixer widget (even unconnected ones) */
498         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
499         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
500         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
501         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
502         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
503         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
504         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
505         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
506
507         { }
508 };
509
510 /* Initialisation sequence for Maxdata Favorit 100XS
511  * (adapted from Acer init verbs).
512  */
513 static const struct hda_verb alc260_favorit100_init_verbs[] = {
514         /* GPIO 0 enables the output jack.
515          * Turn this on and rely on the standard mute
516          * methods whenever the user wants to turn these outputs off.
517          */
518         {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
519         {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
520         {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
521         /* Line/Mic input jack is connected to Mic1 pin */
522         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
523         /* Ensure all other unused pins are disabled and muted. */
524         {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
525         {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
526         {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
527         {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
528         {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
529         {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
530         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
531         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
532         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
533         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
534         /* Disable digital (SPDIF) pins */
535         {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
536         {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
537
538         /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
539          * bus when acting as outputs.
540          */
541         {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
542         {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
543
544         /* Start with output sum widgets muted and their output gains at min */
545         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
546         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
547         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
548         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
549         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
550         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
551         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
552         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
553         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
554
555         /* Unmute Line-out pin widget amp left and right
556          * (no equiv mixer ctrl)
557          */
558         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
559         /* Unmute Mic1 and Line1 pin widget input buffers since they start as
560          * inputs. If the pin mode is changed by the user the pin mode control
561          * will take care of enabling the pin's input/output buffers as needed.
562          * Therefore there's no need to enable the input buffer at this
563          * stage.
564          */
565         {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
566
567         /* Mute capture amp left and right */
568         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
569         /* Set ADC connection select to match default mixer setting - mic
570          * (on mic1 pin)
571          */
572         {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
573
574         /* Do similar with the second ADC: mute capture input amp and
575          * set ADC connection to mic to match ALSA's default state.
576          */
577         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
578         {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
579
580         /* Mute all inputs to mixer widget (even unconnected ones) */
581         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
582         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
583         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
584         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
585         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
586         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
587         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
588         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
589
590         { }
591 };
592
593 static const struct hda_verb alc260_will_verbs[] = {
594         {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
595         {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
596         {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
597         {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
598         {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
599         {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
600         {}
601 };
602
603 static const struct hda_verb alc260_replacer_672v_verbs[] = {
604         {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
605         {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
606         {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
607
608         {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
609         {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
610         {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
611
612         {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
613         {}
614 };
615
616 /* toggle speaker-output according to the hp-jack state */
617 static void alc260_replacer_672v_automute(struct hda_codec *codec)
618 {
619         unsigned int present;
620
621         /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
622         present = snd_hda_jack_detect(codec, 0x0f);
623         if (present) {
624                 snd_hda_codec_write_cache(codec, 0x01, 0,
625                                           AC_VERB_SET_GPIO_DATA, 1);
626                 snd_hda_codec_write_cache(codec, 0x0f, 0,
627                                           AC_VERB_SET_PIN_WIDGET_CONTROL,
628                                           PIN_HP);
629         } else {
630                 snd_hda_codec_write_cache(codec, 0x01, 0,
631                                           AC_VERB_SET_GPIO_DATA, 0);
632                 snd_hda_codec_write_cache(codec, 0x0f, 0,
633                                           AC_VERB_SET_PIN_WIDGET_CONTROL,
634                                           PIN_OUT);
635         }
636 }
637
638 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
639                                        unsigned int res)
640 {
641         if ((res >> 26) == ALC_HP_EVENT)
642                 alc260_replacer_672v_automute(codec);
643 }
644
645 static const struct hda_verb alc260_hp_dc7600_verbs[] = {
646         {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
647         {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
648         {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
649         {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
650         {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
651         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
652         {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
653         {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
654         {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
655         {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
656         {}
657 };
658
659 /* Test configuration for debugging, modelled after the ALC880 test
660  * configuration.
661  */
662 #ifdef CONFIG_SND_DEBUG
663 static const hda_nid_t alc260_test_dac_nids[1] = {
664         0x02,
665 };
666 static const hda_nid_t alc260_test_adc_nids[2] = {
667         0x04, 0x05,
668 };
669 /* For testing the ALC260, each input MUX needs its own definition since
670  * the signal assignments are different.  This assumes that the first ADC
671  * is NID 0x04.
672  */
673 static const struct hda_input_mux alc260_test_capture_sources[2] = {
674         {
675                 .num_items = 7,
676                 .items = {
677                         { "MIC1 pin", 0x0 },
678                         { "MIC2 pin", 0x1 },
679                         { "LINE1 pin", 0x2 },
680                         { "LINE2 pin", 0x3 },
681                         { "CD pin", 0x4 },
682                         { "LINE-OUT pin", 0x5 },
683                         { "HP-OUT pin", 0x6 },
684                 },
685         },
686         {
687                 .num_items = 8,
688                 .items = {
689                         { "MIC1 pin", 0x0 },
690                         { "MIC2 pin", 0x1 },
691                         { "LINE1 pin", 0x2 },
692                         { "LINE2 pin", 0x3 },
693                         { "CD pin", 0x4 },
694                         { "Mixer", 0x5 },
695                         { "LINE-OUT pin", 0x6 },
696                         { "HP-OUT pin", 0x7 },
697                 },
698         },
699 };
700 static const struct snd_kcontrol_new alc260_test_mixer[] = {
701         /* Output driver widgets */
702         HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
703         HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
704         HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
705         HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
706         HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
707         HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
708
709         /* Modes for retasking pin widgets
710          * Note: the ALC260 doesn't seem to act on requests to enable mic
711          * bias from NIDs 0x0f and 0x10.  The ALC260 datasheet doesn't
712          * mention this restriction.  At this stage it's not clear whether
713          * this behaviour is intentional or is a hardware bug in chip
714          * revisions available at least up until early 2006.  Therefore for
715          * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
716          * choices, but if it turns out that the lack of mic bias for these
717          * NIDs is intentional we could change their modes from
718          * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
719          */
720         ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
721         ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
722         ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
723         ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
724         ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
725         ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
726
727         /* Loopback mixer controls */
728         HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
729         HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
730         HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
731         HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
732         HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
733         HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
734         HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
735         HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
736         HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
737         HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
738         HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
739         HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
740         HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
741         HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
742
743         /* Controls for GPIO pins, assuming they are configured as outputs */
744         ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
745         ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
746         ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
747         ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
748
749         /* Switches to allow the digital IO pins to be enabled.  The datasheet
750          * is ambigious as to which NID is which; testing on laptops which
751          * make this output available should provide clarification.
752          */
753         ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
754         ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
755
756         /* A switch allowing EAPD to be enabled.  Some laptops seem to use
757          * this output to turn on an external amplifier.
758          */
759         ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
760         ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
761
762         { } /* end */
763 };
764 static const struct hda_verb alc260_test_init_verbs[] = {
765         /* Enable all GPIOs as outputs with an initial value of 0 */
766         {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
767         {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
768         {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
769
770         /* Enable retasking pins as output, initially without power amp */
771         {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
772         {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
773         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
774         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
775         {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
776         {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
777
778         /* Disable digital (SPDIF) pins initially, but users can enable
779          * them via a mixer switch.  In the case of SPDIF-out, this initverb
780          * payload also sets the generation to 0, output to be in "consumer"
781          * PCM format, copyright asserted, no pre-emphasis and no validity
782          * control.
783          */
784         {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
785         {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
786
787         /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
788          * OUT1 sum bus when acting as an output.
789          */
790         {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
791         {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
792         {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
793         {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
794
795         /* Start with output sum widgets muted and their output gains at min */
796         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
797         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
798         {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
799         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
800         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
801         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
802         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
803         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
804         {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
805
806         /* Unmute retasking pin widget output buffers since the default
807          * state appears to be output.  As the pin mode is changed by the
808          * user the pin mode control will take care of enabling the pin's
809          * input/output buffers as needed.
810          */
811         {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
812         {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
813         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
814         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
815         {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
816         {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
817         /* Also unmute the mono-out pin widget */
818         {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
819
820         /* Mute capture amp left and right */
821         {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
822         /* Set ADC connection select to match default mixer setting (mic1
823          * pin)
824          */
825         {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
826
827         /* Do the same for the second ADC: mute capture input amp and
828          * set ADC connection to mic1 pin
829          */
830         {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
831         {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
832
833         /* Mute all inputs to mixer widget (even unconnected ones) */
834         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
835         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
836         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
837         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
838         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
839         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
840         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
841         {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
842
843         { }
844 };
845 #endif
846
847 /*
848  * ALC260 configurations
849  */
850 static const char * const alc260_models[ALC260_MODEL_LAST] = {
851         [ALC260_BASIC]          = "basic",
852         [ALC260_FUJITSU_S702X]  = "fujitsu",
853         [ALC260_ACER]           = "acer",
854         [ALC260_WILL]           = "will",
855         [ALC260_REPLACER_672V]  = "replacer",
856         [ALC260_FAVORIT100]     = "favorit100",
857 #ifdef CONFIG_SND_DEBUG
858         [ALC260_TEST]           = "test",
859 #endif
860         [ALC260_AUTO]           = "auto",
861 };
862
863 static const struct snd_pci_quirk alc260_cfg_tbl[] = {
864         SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
865         SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
866         SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
867         SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
868         SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
869         SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
870         SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
871         SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
872         SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
873         SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
874         SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
875         {}
876 };
877
878 static const struct alc_config_preset alc260_presets[] = {
879         [ALC260_BASIC] = {
880                 .mixers = { alc260_base_output_mixer,
881                             alc260_input_mixer },
882                 .init_verbs = { alc260_init_verbs },
883                 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
884                 .dac_nids = alc260_dac_nids,
885                 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
886                 .adc_nids = alc260_dual_adc_nids,
887                 .num_channel_mode = ARRAY_SIZE(alc260_modes),
888                 .channel_mode = alc260_modes,
889                 .input_mux = &alc260_capture_source,
890         },
891         [ALC260_FUJITSU_S702X] = {
892                 .mixers = { alc260_fujitsu_mixer },
893                 .init_verbs = { alc260_fujitsu_init_verbs },
894                 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
895                 .dac_nids = alc260_dac_nids,
896                 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
897                 .adc_nids = alc260_dual_adc_nids,
898                 .num_channel_mode = ARRAY_SIZE(alc260_modes),
899                 .channel_mode = alc260_modes,
900                 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
901                 .input_mux = alc260_fujitsu_capture_sources,
902         },
903         [ALC260_ACER] = {
904                 .mixers = { alc260_acer_mixer },
905                 .init_verbs = { alc260_acer_init_verbs },
906                 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
907                 .dac_nids = alc260_dac_nids,
908                 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
909                 .adc_nids = alc260_dual_adc_nids,
910                 .num_channel_mode = ARRAY_SIZE(alc260_modes),
911                 .channel_mode = alc260_modes,
912                 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
913                 .input_mux = alc260_acer_capture_sources,
914         },
915         [ALC260_FAVORIT100] = {
916                 .mixers = { alc260_favorit100_mixer },
917                 .init_verbs = { alc260_favorit100_init_verbs },
918                 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
919                 .dac_nids = alc260_dac_nids,
920                 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
921                 .adc_nids = alc260_dual_adc_nids,
922                 .num_channel_mode = ARRAY_SIZE(alc260_modes),
923                 .channel_mode = alc260_modes,
924                 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
925                 .input_mux = alc260_favorit100_capture_sources,
926         },
927         [ALC260_WILL] = {
928                 .mixers = { alc260_will_mixer },
929                 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
930                 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
931                 .dac_nids = alc260_dac_nids,
932                 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
933                 .adc_nids = alc260_adc_nids,
934                 .dig_out_nid = ALC260_DIGOUT_NID,
935                 .num_channel_mode = ARRAY_SIZE(alc260_modes),
936                 .channel_mode = alc260_modes,
937                 .input_mux = &alc260_capture_source,
938         },
939         [ALC260_REPLACER_672V] = {
940                 .mixers = { alc260_replacer_672v_mixer },
941                 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
942                 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
943                 .dac_nids = alc260_dac_nids,
944                 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
945                 .adc_nids = alc260_adc_nids,
946                 .dig_out_nid = ALC260_DIGOUT_NID,
947                 .num_channel_mode = ARRAY_SIZE(alc260_modes),
948                 .channel_mode = alc260_modes,
949                 .input_mux = &alc260_capture_source,
950                 .unsol_event = alc260_replacer_672v_unsol_event,
951                 .init_hook = alc260_replacer_672v_automute,
952         },
953 #ifdef CONFIG_SND_DEBUG
954         [ALC260_TEST] = {
955                 .mixers = { alc260_test_mixer },
956                 .init_verbs = { alc260_test_init_verbs },
957                 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
958                 .dac_nids = alc260_test_dac_nids,
959                 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
960                 .adc_nids = alc260_test_adc_nids,
961                 .num_channel_mode = ARRAY_SIZE(alc260_modes),
962                 .channel_mode = alc260_modes,
963                 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
964                 .input_mux = alc260_test_capture_sources,
965         },
966 #endif
967 };
968