ALSA: hda - Remove ALC662 ASUS eeepc-ep20 model quirk
[pandora-kernel.git] / sound / pci / hda / alc662_quirks.c
1 /*
2  * ALC662/ALC663/ALC665/ALC670 quirk models
3  * included by patch_realtek.c
4  */
5
6 /* ALC662 models */
7 enum {
8         ALC662_AUTO,
9         ALC662_3ST_2ch_DIG,
10         ALC662_3ST_6ch_DIG,
11         ALC662_3ST_6ch,
12         ALC662_5ST_DIG,
13         ALC662_MODEL_LAST,
14 };
15
16 #define ALC662_DIGOUT_NID       0x06
17 #define ALC662_DIGIN_NID        0x0a
18
19 static const hda_nid_t alc662_dac_nids[3] = {
20         /* front, rear, clfe */
21         0x02, 0x03, 0x04
22 };
23
24 static const hda_nid_t alc272_dac_nids[2] = {
25         0x02, 0x03
26 };
27
28 static const hda_nid_t alc662_adc_nids[2] = {
29         /* ADC1-2 */
30         0x09, 0x08
31 };
32
33 static const hda_nid_t alc272_adc_nids[1] = {
34         /* ADC1-2 */
35         0x08,
36 };
37
38 static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
39 static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
40
41
42 /* input MUX */
43 /* FIXME: should be a matrix-type input source selection */
44 static const struct hda_input_mux alc662_capture_source = {
45         .num_items = 4,
46         .items = {
47                 { "Mic", 0x0 },
48                 { "Front Mic", 0x1 },
49                 { "Line", 0x2 },
50                 { "CD", 0x4 },
51         },
52 };
53
54 static const struct hda_input_mux alc662_lenovo_101e_capture_source = {
55         .num_items = 2,
56         .items = {
57                 { "Mic", 0x1 },
58                 { "Line", 0x2 },
59         },
60 };
61
62 static const struct hda_input_mux alc663_capture_source = {
63         .num_items = 3,
64         .items = {
65                 { "Mic", 0x0 },
66                 { "Front Mic", 0x1 },
67                 { "Line", 0x2 },
68         },
69 };
70
71 /*
72  * 2ch mode
73  */
74 static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
75         { 2, NULL }
76 };
77
78 /*
79  * 2ch mode
80  */
81 static const struct hda_verb alc662_3ST_ch2_init[] = {
82         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
83         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
84         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
85         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
86         { } /* end */
87 };
88
89 /*
90  * 6ch mode
91  */
92 static const struct hda_verb alc662_3ST_ch6_init[] = {
93         { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
94         { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
95         { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
96         { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
97         { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
98         { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
99         { } /* end */
100 };
101
102 static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
103         { 2, alc662_3ST_ch2_init },
104         { 6, alc662_3ST_ch6_init },
105 };
106
107 /*
108  * 2ch mode
109  */
110 static const struct hda_verb alc662_sixstack_ch6_init[] = {
111         { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
112         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
113         { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
114         { } /* end */
115 };
116
117 /*
118  * 6ch mode
119  */
120 static const struct hda_verb alc662_sixstack_ch8_init[] = {
121         { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
122         { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
123         { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
124         { } /* end */
125 };
126
127 static const struct hda_channel_mode alc662_5stack_modes[2] = {
128         { 2, alc662_sixstack_ch6_init },
129         { 6, alc662_sixstack_ch8_init },
130 };
131
132 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
133  *                 Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
134  */
135
136 static const struct snd_kcontrol_new alc662_base_mixer[] = {
137         /* output mixer control */
138         HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
139         HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
140         HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
141         HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
142         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
143         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
144         HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
145         HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
146         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
147
148         /*Input mixer control */
149         HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
150         HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
151         HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
152         HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
153         HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
154         HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
155         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
156         HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
157         { } /* end */
158 };
159
160 static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
161         HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
162         HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
163         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
164         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
165         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
166         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
167         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
168         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
169         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
170         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
171         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
172         { } /* end */
173 };
174
175 static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
176         HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
177         HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
178         HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
179         HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
180         HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
181         HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
182         HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
183         HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
184         HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
185         HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
186         HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
187         HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
188         HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
189         HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
190         HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
191         HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
192         HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
193         { } /* end */
194 };
195
196 static const struct snd_kcontrol_new alc662_chmode_mixer[] = {
197         {
198                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
199                 .name = "Channel Mode",
200                 .info = alc_ch_mode_info,
201                 .get = alc_ch_mode_get,
202                 .put = alc_ch_mode_put,
203         },
204         { } /* end */
205 };
206
207 static const struct hda_verb alc662_init_verbs[] = {
208         /* ADC: mute amp left and right */
209         {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
210         {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
211
212         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
213         {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
214         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
215         {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
216         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
217         {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
218
219         /* Front Pin: output 0 (0x0c) */
220         {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
221         {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
222
223         /* Rear Pin: output 1 (0x0d) */
224         {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
225         {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
226
227         /* CLFE Pin: output 2 (0x0e) */
228         {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
229         {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
230
231         /* Mic (rear) pin: input vref at 80% */
232         {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
233         {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
234         /* Front Mic pin: input vref at 80% */
235         {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
236         {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
237         /* Line In pin: input */
238         {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
239         {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
240         /* Line-2 In: Headphone output (output 0 - 0x0c) */
241         {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
242         {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
243         {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
244         /* CD pin widget for input */
245         {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
246
247         /* FIXME: use matrix-type input source selection */
248         /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
249         /* Input mixer */
250         {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
251         {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
252
253         { }
254 };
255
256 static const struct hda_verb alc662_eapd_init_verbs[] = {
257         /* always trun on EAPD */
258         {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
259         {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
260         { }
261 };
262
263 /*
264  * configuration and preset
265  */
266 static const char * const alc662_models[ALC662_MODEL_LAST] = {
267         [ALC662_3ST_2ch_DIG]    = "3stack-dig",
268         [ALC662_3ST_6ch_DIG]    = "3stack-6ch-dig",
269         [ALC662_3ST_6ch]        = "3stack-6ch",
270         [ALC662_5ST_DIG]        = "5stack-dig",
271         [ALC662_AUTO]           = "auto",
272 };
273
274 static const struct snd_pci_quirk alc662_cfg_tbl[] = {
275         SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
276         SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
277                       ALC662_3ST_6ch_DIG),
278         SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
279                       ALC662_3ST_6ch_DIG),
280         SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
281         SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
282                                         ALC662_3ST_6ch_DIG),
283         {}
284 };
285
286 static const struct alc_config_preset alc662_presets[] = {
287         [ALC662_3ST_2ch_DIG] = {
288                 .mixers = { alc662_3ST_2ch_mixer },
289                 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
290                 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
291                 .dac_nids = alc662_dac_nids,
292                 .dig_out_nid = ALC662_DIGOUT_NID,
293                 .dig_in_nid = ALC662_DIGIN_NID,
294                 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
295                 .channel_mode = alc662_3ST_2ch_modes,
296                 .input_mux = &alc662_capture_source,
297         },
298         [ALC662_3ST_6ch_DIG] = {
299                 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
300                 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
301                 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
302                 .dac_nids = alc662_dac_nids,
303                 .dig_out_nid = ALC662_DIGOUT_NID,
304                 .dig_in_nid = ALC662_DIGIN_NID,
305                 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
306                 .channel_mode = alc662_3ST_6ch_modes,
307                 .need_dac_fix = 1,
308                 .input_mux = &alc662_capture_source,
309         },
310         [ALC662_3ST_6ch] = {
311                 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
312                 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
313                 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
314                 .dac_nids = alc662_dac_nids,
315                 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
316                 .channel_mode = alc662_3ST_6ch_modes,
317                 .need_dac_fix = 1,
318                 .input_mux = &alc662_capture_source,
319         },
320         [ALC662_5ST_DIG] = {
321                 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
322                 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
323                 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
324                 .dac_nids = alc662_dac_nids,
325                 .dig_out_nid = ALC662_DIGOUT_NID,
326                 .dig_in_nid = ALC662_DIGIN_NID,
327                 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
328                 .channel_mode = alc662_5stack_modes,
329                 .input_mux = &alc662_capture_source,
330         },
331 };