Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Universal Interface for Intel High Definition Audio Codec | |
3 | * | |
4 | * HD audio interface patch for ALC 260/880/882 codecs | |
5 | * | |
df694daa KY |
6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
7 | * PeiSen Hou <pshou@realtek.com.tw> | |
1da177e4 | 8 | * Takashi Iwai <tiwai@suse.de> |
7cf51e48 | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
1da177e4 LT |
10 | * |
11 | * This driver is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License as published by | |
13 | * the Free Software Foundation; either version 2 of the License, or | |
14 | * (at your option) any later version. | |
15 | * | |
16 | * This driver is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | * GNU General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU General Public License | |
22 | * along with this program; if not, write to the Free Software | |
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 | */ | |
25 | ||
26 | #include <sound/driver.h> | |
27 | #include <linux/init.h> | |
28 | #include <linux/delay.h> | |
29 | #include <linux/slab.h> | |
30 | #include <linux/pci.h> | |
31 | #include <sound/core.h> | |
32 | #include "hda_codec.h" | |
33 | #include "hda_local.h" | |
34 | ||
ccc656ce KY |
35 | #define ALC880_FRONT_EVENT 0x01 |
36 | #define ALC880_DCVOL_EVENT 0x02 | |
37 | #define ALC880_HP_EVENT 0x04 | |
38 | #define ALC880_MIC_EVENT 0x08 | |
1da177e4 LT |
39 | |
40 | /* ALC880 board config type */ | |
41 | enum { | |
1da177e4 LT |
42 | ALC880_3ST, |
43 | ALC880_3ST_DIG, | |
44 | ALC880_5ST, | |
45 | ALC880_5ST_DIG, | |
46 | ALC880_W810, | |
dfc0ff62 | 47 | ALC880_Z71V, |
b6482d48 | 48 | ALC880_6ST, |
16ded525 TI |
49 | ALC880_6ST_DIG, |
50 | ALC880_F1734, | |
51 | ALC880_ASUS, | |
52 | ALC880_ASUS_DIG, | |
53 | ALC880_ASUS_W1V, | |
df694daa | 54 | ALC880_ASUS_DIG2, |
16ded525 | 55 | ALC880_UNIWILL_DIG, |
ccc656ce KY |
56 | ALC880_UNIWILL, |
57 | ALC880_UNIWILL_P53, | |
df694daa KY |
58 | ALC880_CLEVO, |
59 | ALC880_TCL_S700, | |
ae6b813a | 60 | ALC880_LG, |
d681518a | 61 | ALC880_LG_LW, |
e9edcee0 TI |
62 | #ifdef CONFIG_SND_DEBUG |
63 | ALC880_TEST, | |
64 | #endif | |
df694daa | 65 | ALC880_AUTO, |
16ded525 TI |
66 | ALC880_MODEL_LAST /* last tag */ |
67 | }; | |
68 | ||
69 | /* ALC260 models */ | |
70 | enum { | |
71 | ALC260_BASIC, | |
72 | ALC260_HP, | |
df694daa KY |
73 | ALC260_HP_3013, |
74 | ALC260_FUJITSU_S702X, | |
0bfc90e9 | 75 | ALC260_ACER, |
7cf51e48 JW |
76 | #ifdef CONFIG_SND_DEBUG |
77 | ALC260_TEST, | |
78 | #endif | |
df694daa | 79 | ALC260_AUTO, |
16ded525 | 80 | ALC260_MODEL_LAST /* last tag */ |
1da177e4 LT |
81 | }; |
82 | ||
df694daa KY |
83 | /* ALC262 models */ |
84 | enum { | |
85 | ALC262_BASIC, | |
ccc656ce KY |
86 | ALC262_HIPPO, |
87 | ALC262_HIPPO_1, | |
834be88d | 88 | ALC262_FUJITSU, |
9c7f852e | 89 | ALC262_HP_BPC, |
304dcaac | 90 | ALC262_BENQ_ED8, |
df694daa KY |
91 | ALC262_AUTO, |
92 | ALC262_MODEL_LAST /* last tag */ | |
93 | }; | |
94 | ||
95 | /* ALC861 models */ | |
96 | enum { | |
97 | ALC861_3ST, | |
9c7f852e | 98 | ALC660_3ST, |
df694daa KY |
99 | ALC861_3ST_DIG, |
100 | ALC861_6ST_DIG, | |
22309c3e | 101 | ALC861_UNIWILL_M31, |
a53d1aec | 102 | ALC861_TOSHIBA, |
7cdbff94 | 103 | ALC861_ASUS, |
56bb0cab | 104 | ALC861_ASUS_LAPTOP, |
df694daa KY |
105 | ALC861_AUTO, |
106 | ALC861_MODEL_LAST, | |
107 | }; | |
108 | ||
109 | /* ALC882 models */ | |
110 | enum { | |
111 | ALC882_3ST_DIG, | |
112 | ALC882_6ST_DIG, | |
4b146cb0 | 113 | ALC882_ARIMA, |
df694daa | 114 | ALC882_AUTO, |
9102cd1c | 115 | ALC885_MACPRO, |
df694daa KY |
116 | ALC882_MODEL_LAST, |
117 | }; | |
118 | ||
9c7f852e TI |
119 | /* ALC883 models */ |
120 | enum { | |
121 | ALC883_3ST_2ch_DIG, | |
122 | ALC883_3ST_6ch_DIG, | |
123 | ALC883_3ST_6ch, | |
124 | ALC883_6ST_DIG, | |
ccc656ce KY |
125 | ALC883_TARGA_DIG, |
126 | ALC883_TARGA_2ch_DIG, | |
9c7f852e | 127 | ALC888_DEMO_BOARD, |
bab282b9 | 128 | ALC883_ACER, |
c07584c8 | 129 | ALC883_MEDION, |
b373bdeb | 130 | ALC883_LAPTOP_EAPD, |
9c7f852e TI |
131 | ALC883_AUTO, |
132 | ALC883_MODEL_LAST, | |
133 | }; | |
134 | ||
df694daa KY |
135 | /* for GPIO Poll */ |
136 | #define GPIO_MASK 0x03 | |
137 | ||
1da177e4 LT |
138 | struct alc_spec { |
139 | /* codec parameterization */ | |
df694daa | 140 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
1da177e4 LT |
141 | unsigned int num_mixers; |
142 | ||
df694daa | 143 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
9c7f852e TI |
144 | * don't forget NULL |
145 | * termination! | |
e9edcee0 TI |
146 | */ |
147 | unsigned int num_init_verbs; | |
1da177e4 | 148 | |
16ded525 | 149 | char *stream_name_analog; /* analog PCM stream */ |
1da177e4 LT |
150 | struct hda_pcm_stream *stream_analog_playback; |
151 | struct hda_pcm_stream *stream_analog_capture; | |
152 | ||
16ded525 | 153 | char *stream_name_digital; /* digital PCM stream */ |
1da177e4 LT |
154 | struct hda_pcm_stream *stream_digital_playback; |
155 | struct hda_pcm_stream *stream_digital_capture; | |
156 | ||
157 | /* playback */ | |
16ded525 TI |
158 | struct hda_multi_out multiout; /* playback set-up |
159 | * max_channels, dacs must be set | |
160 | * dig_out_nid and hp_nid are optional | |
161 | */ | |
1da177e4 LT |
162 | |
163 | /* capture */ | |
164 | unsigned int num_adc_nids; | |
165 | hda_nid_t *adc_nids; | |
16ded525 | 166 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
1da177e4 LT |
167 | |
168 | /* capture source */ | |
a1e8d2da | 169 | unsigned int num_mux_defs; |
1da177e4 LT |
170 | const struct hda_input_mux *input_mux; |
171 | unsigned int cur_mux[3]; | |
172 | ||
173 | /* channel model */ | |
d2a6d7dc | 174 | const struct hda_channel_mode *channel_mode; |
1da177e4 | 175 | int num_channel_mode; |
4e195a7b | 176 | int need_dac_fix; |
1da177e4 LT |
177 | |
178 | /* PCM information */ | |
4c5186ed | 179 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
41e41f1f | 180 | |
e9edcee0 TI |
181 | /* dynamic controls, init_verbs and input_mux */ |
182 | struct auto_pin_cfg autocfg; | |
183 | unsigned int num_kctl_alloc, num_kctl_used; | |
c8b6bf9b | 184 | struct snd_kcontrol_new *kctl_alloc; |
e9edcee0 | 185 | struct hda_input_mux private_imux; |
df694daa | 186 | hda_nid_t private_dac_nids[5]; |
834be88d | 187 | |
ae6b813a TI |
188 | /* hooks */ |
189 | void (*init_hook)(struct hda_codec *codec); | |
190 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
191 | ||
834be88d TI |
192 | /* for pin sensing */ |
193 | unsigned int sense_updated: 1; | |
194 | unsigned int jack_present: 1; | |
df694daa KY |
195 | }; |
196 | ||
197 | /* | |
198 | * configuration template - to be copied to the spec instance | |
199 | */ | |
200 | struct alc_config_preset { | |
9c7f852e TI |
201 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
202 | * with spec | |
203 | */ | |
df694daa KY |
204 | const struct hda_verb *init_verbs[5]; |
205 | unsigned int num_dacs; | |
206 | hda_nid_t *dac_nids; | |
207 | hda_nid_t dig_out_nid; /* optional */ | |
208 | hda_nid_t hp_nid; /* optional */ | |
209 | unsigned int num_adc_nids; | |
210 | hda_nid_t *adc_nids; | |
211 | hda_nid_t dig_in_nid; | |
212 | unsigned int num_channel_mode; | |
213 | const struct hda_channel_mode *channel_mode; | |
4e195a7b | 214 | int need_dac_fix; |
a1e8d2da | 215 | unsigned int num_mux_defs; |
df694daa | 216 | const struct hda_input_mux *input_mux; |
ae6b813a TI |
217 | void (*unsol_event)(struct hda_codec *, unsigned int); |
218 | void (*init_hook)(struct hda_codec *); | |
1da177e4 LT |
219 | }; |
220 | ||
1da177e4 LT |
221 | |
222 | /* | |
223 | * input MUX handling | |
224 | */ | |
9c7f852e TI |
225 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
226 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
227 | { |
228 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
229 | struct alc_spec *spec = codec->spec; | |
a1e8d2da JW |
230 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
231 | if (mux_idx >= spec->num_mux_defs) | |
232 | mux_idx = 0; | |
233 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | |
1da177e4 LT |
234 | } |
235 | ||
9c7f852e TI |
236 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
237 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
238 | { |
239 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
240 | struct alc_spec *spec = codec->spec; | |
241 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
242 | ||
243 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
244 | return 0; | |
245 | } | |
246 | ||
9c7f852e TI |
247 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
248 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
249 | { |
250 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
251 | struct alc_spec *spec = codec->spec; | |
252 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
a1e8d2da JW |
253 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
254 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, | |
9c7f852e TI |
255 | spec->adc_nids[adc_idx], |
256 | &spec->cur_mux[adc_idx]); | |
1da177e4 LT |
257 | } |
258 | ||
e9edcee0 | 259 | |
1da177e4 LT |
260 | /* |
261 | * channel mode setting | |
262 | */ | |
9c7f852e TI |
263 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
264 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
265 | { |
266 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
267 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc TI |
268 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
269 | spec->num_channel_mode); | |
1da177e4 LT |
270 | } |
271 | ||
9c7f852e TI |
272 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
273 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
274 | { |
275 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
276 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc | 277 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
9c7f852e TI |
278 | spec->num_channel_mode, |
279 | spec->multiout.max_channels); | |
1da177e4 LT |
280 | } |
281 | ||
9c7f852e TI |
282 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
283 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
284 | { |
285 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
286 | struct alc_spec *spec = codec->spec; | |
4e195a7b TI |
287 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
288 | spec->num_channel_mode, | |
289 | &spec->multiout.max_channels); | |
bd2033f2 | 290 | if (err >= 0 && spec->need_dac_fix) |
4e195a7b TI |
291 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
292 | return err; | |
1da177e4 LT |
293 | } |
294 | ||
a9430dd8 | 295 | /* |
4c5186ed JW |
296 | * Control the mode of pin widget settings via the mixer. "pc" is used |
297 | * instead of "%" to avoid consequences of accidently treating the % as | |
298 | * being part of a format specifier. Maximum allowed length of a value is | |
299 | * 63 characters plus NULL terminator. | |
7cf51e48 JW |
300 | * |
301 | * Note: some retasking pin complexes seem to ignore requests for input | |
302 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
303 | * are requested. Therefore order this list so that this behaviour will not | |
304 | * cause problems when mixer clients move through the enum sequentially. | |
a1e8d2da JW |
305 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
306 | * March 2006. | |
4c5186ed JW |
307 | */ |
308 | static char *alc_pin_mode_names[] = { | |
7cf51e48 JW |
309 | "Mic 50pc bias", "Mic 80pc bias", |
310 | "Line in", "Line out", "Headphone out", | |
4c5186ed JW |
311 | }; |
312 | static unsigned char alc_pin_mode_values[] = { | |
7cf51e48 | 313 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
4c5186ed JW |
314 | }; |
315 | /* The control can present all 5 options, or it can limit the options based | |
a1e8d2da JW |
316 | * in the pin being assumed to be exclusively an input or an output pin. In |
317 | * addition, "input" pins may or may not process the mic bias option | |
318 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
319 | * accept requests for bias as of chip versions up to March 2006) and/or | |
320 | * wiring in the computer. | |
a9430dd8 | 321 | */ |
a1e8d2da JW |
322 | #define ALC_PIN_DIR_IN 0x00 |
323 | #define ALC_PIN_DIR_OUT 0x01 | |
324 | #define ALC_PIN_DIR_INOUT 0x02 | |
325 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
326 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
4c5186ed | 327 | |
a1e8d2da | 328 | /* Info about the pin modes supported by the different pin direction modes. |
4c5186ed JW |
329 | * For each direction the minimum and maximum values are given. |
330 | */ | |
a1e8d2da | 331 | static signed char alc_pin_mode_dir_info[5][2] = { |
4c5186ed JW |
332 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
333 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
334 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
a1e8d2da JW |
335 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
336 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
4c5186ed JW |
337 | }; |
338 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
339 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
340 | #define alc_pin_mode_n_items(_dir) \ | |
341 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
342 | ||
9c7f852e TI |
343 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
344 | struct snd_ctl_elem_info *uinfo) | |
a9430dd8 | 345 | { |
4c5186ed JW |
346 | unsigned int item_num = uinfo->value.enumerated.item; |
347 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
348 | ||
349 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
a9430dd8 | 350 | uinfo->count = 1; |
4c5186ed JW |
351 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
352 | ||
353 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
354 | item_num = alc_pin_mode_min(dir); | |
355 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
a9430dd8 JW |
356 | return 0; |
357 | } | |
358 | ||
9c7f852e TI |
359 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
360 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 361 | { |
4c5186ed | 362 | unsigned int i; |
a9430dd8 JW |
363 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
364 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed | 365 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
a9430dd8 | 366 | long *valp = ucontrol->value.integer.value; |
9c7f852e TI |
367 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
368 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
369 | 0x00); | |
a9430dd8 | 370 | |
4c5186ed JW |
371 | /* Find enumerated value for current pinctl setting */ |
372 | i = alc_pin_mode_min(dir); | |
9c7f852e | 373 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
4c5186ed | 374 | i++; |
9c7f852e | 375 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
a9430dd8 JW |
376 | return 0; |
377 | } | |
378 | ||
9c7f852e TI |
379 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
380 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 381 | { |
4c5186ed | 382 | signed int change; |
a9430dd8 JW |
383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
384 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed JW |
385 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
386 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
387 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
388 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
389 | 0x00); | |
a9430dd8 | 390 | |
9c7f852e | 391 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
4c5186ed JW |
392 | val = alc_pin_mode_min(dir); |
393 | ||
394 | change = pinctl != alc_pin_mode_values[val]; | |
cdcd9268 JW |
395 | if (change) { |
396 | /* Set pin mode to that requested */ | |
a9430dd8 | 397 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL, |
9c7f852e | 398 | alc_pin_mode_values[val]); |
cdcd9268 JW |
399 | |
400 | /* Also enable the retasking pin's input/output as required | |
401 | * for the requested pin mode. Enum values of 2 or less are | |
402 | * input modes. | |
403 | * | |
404 | * Dynamically switching the input/output buffers probably | |
a1e8d2da JW |
405 | * reduces noise slightly (particularly on input) so we'll |
406 | * do it. However, having both input and output buffers | |
407 | * enabled simultaneously doesn't seem to be problematic if | |
408 | * this turns out to be necessary in the future. | |
cdcd9268 JW |
409 | */ |
410 | if (val <= 2) { | |
9c7f852e TI |
411 | snd_hda_codec_write(codec, nid, 0, |
412 | AC_VERB_SET_AMP_GAIN_MUTE, | |
413 | AMP_OUT_MUTE); | |
414 | snd_hda_codec_write(codec, nid, 0, | |
415 | AC_VERB_SET_AMP_GAIN_MUTE, | |
416 | AMP_IN_UNMUTE(0)); | |
cdcd9268 | 417 | } else { |
9c7f852e TI |
418 | snd_hda_codec_write(codec, nid, 0, |
419 | AC_VERB_SET_AMP_GAIN_MUTE, | |
420 | AMP_IN_MUTE(0)); | |
421 | snd_hda_codec_write(codec, nid, 0, | |
422 | AC_VERB_SET_AMP_GAIN_MUTE, | |
423 | AMP_OUT_UNMUTE); | |
cdcd9268 JW |
424 | } |
425 | } | |
a9430dd8 JW |
426 | return change; |
427 | } | |
428 | ||
4c5186ed | 429 | #define ALC_PIN_MODE(xname, nid, dir) \ |
a9430dd8 | 430 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
4c5186ed JW |
431 | .info = alc_pin_mode_info, \ |
432 | .get = alc_pin_mode_get, \ | |
433 | .put = alc_pin_mode_put, \ | |
434 | .private_value = nid | (dir<<16) } | |
df694daa | 435 | |
5c8f858d JW |
436 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
437 | * together using a mask with more than one bit set. This control is | |
438 | * currently used only by the ALC260 test model. At this stage they are not | |
439 | * needed for any "production" models. | |
440 | */ | |
441 | #ifdef CONFIG_SND_DEBUG | |
9c7f852e TI |
442 | static int alc_gpio_data_info(struct snd_kcontrol *kcontrol, |
443 | struct snd_ctl_elem_info *uinfo) | |
5c8f858d JW |
444 | { |
445 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | |
446 | uinfo->count = 1; | |
447 | uinfo->value.integer.min = 0; | |
448 | uinfo->value.integer.max = 1; | |
449 | return 0; | |
450 | } | |
9c7f852e TI |
451 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
452 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
453 | { |
454 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
455 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
456 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
457 | long *valp = ucontrol->value.integer.value; | |
9c7f852e TI |
458 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
459 | AC_VERB_GET_GPIO_DATA, 0x00); | |
5c8f858d JW |
460 | |
461 | *valp = (val & mask) != 0; | |
462 | return 0; | |
463 | } | |
9c7f852e TI |
464 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
465 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
466 | { |
467 | signed int change; | |
468 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
469 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
470 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
471 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
472 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
473 | AC_VERB_GET_GPIO_DATA, | |
474 | 0x00); | |
5c8f858d JW |
475 | |
476 | /* Set/unset the masked GPIO bit(s) as needed */ | |
9c7f852e TI |
477 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
478 | if (val == 0) | |
5c8f858d JW |
479 | gpio_data &= ~mask; |
480 | else | |
481 | gpio_data |= mask; | |
9c7f852e | 482 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_GPIO_DATA, gpio_data); |
5c8f858d JW |
483 | |
484 | return change; | |
485 | } | |
486 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
487 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
488 | .info = alc_gpio_data_info, \ | |
489 | .get = alc_gpio_data_get, \ | |
490 | .put = alc_gpio_data_put, \ | |
491 | .private_value = nid | (mask<<16) } | |
492 | #endif /* CONFIG_SND_DEBUG */ | |
493 | ||
92621f13 JW |
494 | /* A switch control to allow the enabling of the digital IO pins on the |
495 | * ALC260. This is incredibly simplistic; the intention of this control is | |
496 | * to provide something in the test model allowing digital outputs to be | |
497 | * identified if present. If models are found which can utilise these | |
498 | * outputs a more complete mixer control can be devised for those models if | |
499 | * necessary. | |
500 | */ | |
501 | #ifdef CONFIG_SND_DEBUG | |
9c7f852e TI |
502 | static int alc_spdif_ctrl_info(struct snd_kcontrol *kcontrol, |
503 | struct snd_ctl_elem_info *uinfo) | |
92621f13 JW |
504 | { |
505 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | |
506 | uinfo->count = 1; | |
507 | uinfo->value.integer.min = 0; | |
508 | uinfo->value.integer.max = 1; | |
509 | return 0; | |
510 | } | |
9c7f852e TI |
511 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
512 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
513 | { |
514 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
515 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
516 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
517 | long *valp = ucontrol->value.integer.value; | |
9c7f852e TI |
518 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
519 | AC_VERB_GET_DIGI_CONVERT, 0x00); | |
92621f13 JW |
520 | |
521 | *valp = (val & mask) != 0; | |
522 | return 0; | |
523 | } | |
9c7f852e TI |
524 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
525 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
526 | { |
527 | signed int change; | |
528 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
529 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
530 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
531 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
532 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
533 | AC_VERB_GET_DIGI_CONVERT, | |
534 | 0x00); | |
92621f13 JW |
535 | |
536 | /* Set/unset the masked control bit(s) as needed */ | |
9c7f852e | 537 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
92621f13 JW |
538 | if (val==0) |
539 | ctrl_data &= ~mask; | |
540 | else | |
541 | ctrl_data |= mask; | |
9c7f852e TI |
542 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
543 | ctrl_data); | |
92621f13 JW |
544 | |
545 | return change; | |
546 | } | |
547 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
548 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
549 | .info = alc_spdif_ctrl_info, \ | |
550 | .get = alc_spdif_ctrl_get, \ | |
551 | .put = alc_spdif_ctrl_put, \ | |
552 | .private_value = nid | (mask<<16) } | |
553 | #endif /* CONFIG_SND_DEBUG */ | |
554 | ||
df694daa KY |
555 | /* |
556 | * set up from the preset table | |
557 | */ | |
9c7f852e TI |
558 | static void setup_preset(struct alc_spec *spec, |
559 | const struct alc_config_preset *preset) | |
df694daa KY |
560 | { |
561 | int i; | |
562 | ||
563 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
564 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; | |
9c7f852e TI |
565 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
566 | i++) | |
567 | spec->init_verbs[spec->num_init_verbs++] = | |
568 | preset->init_verbs[i]; | |
df694daa KY |
569 | |
570 | spec->channel_mode = preset->channel_mode; | |
571 | spec->num_channel_mode = preset->num_channel_mode; | |
4e195a7b | 572 | spec->need_dac_fix = preset->need_dac_fix; |
df694daa KY |
573 | |
574 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
575 | ||
576 | spec->multiout.num_dacs = preset->num_dacs; | |
577 | spec->multiout.dac_nids = preset->dac_nids; | |
578 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
579 | spec->multiout.hp_nid = preset->hp_nid; | |
580 | ||
a1e8d2da JW |
581 | spec->num_mux_defs = preset->num_mux_defs; |
582 | if (! spec->num_mux_defs) | |
583 | spec->num_mux_defs = 1; | |
df694daa KY |
584 | spec->input_mux = preset->input_mux; |
585 | ||
586 | spec->num_adc_nids = preset->num_adc_nids; | |
587 | spec->adc_nids = preset->adc_nids; | |
588 | spec->dig_in_nid = preset->dig_in_nid; | |
ae6b813a TI |
589 | |
590 | spec->unsol_event = preset->unsol_event; | |
591 | spec->init_hook = preset->init_hook; | |
df694daa KY |
592 | } |
593 | ||
1da177e4 | 594 | /* |
e9edcee0 TI |
595 | * ALC880 3-stack model |
596 | * | |
597 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
9c7f852e TI |
598 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
599 | * F-Mic = 0x1b, HP = 0x19 | |
1da177e4 LT |
600 | */ |
601 | ||
e9edcee0 TI |
602 | static hda_nid_t alc880_dac_nids[4] = { |
603 | /* front, rear, clfe, rear_surr */ | |
604 | 0x02, 0x05, 0x04, 0x03 | |
605 | }; | |
606 | ||
607 | static hda_nid_t alc880_adc_nids[3] = { | |
608 | /* ADC0-2 */ | |
609 | 0x07, 0x08, 0x09, | |
610 | }; | |
611 | ||
612 | /* The datasheet says the node 0x07 is connected from inputs, | |
613 | * but it shows zero connection in the real implementation on some devices. | |
df694daa | 614 | * Note: this is a 915GAV bug, fixed on 915GLV |
1da177e4 | 615 | */ |
e9edcee0 TI |
616 | static hda_nid_t alc880_adc_nids_alt[2] = { |
617 | /* ADC1-2 */ | |
618 | 0x08, 0x09, | |
619 | }; | |
620 | ||
621 | #define ALC880_DIGOUT_NID 0x06 | |
622 | #define ALC880_DIGIN_NID 0x0a | |
623 | ||
624 | static struct hda_input_mux alc880_capture_source = { | |
625 | .num_items = 4, | |
626 | .items = { | |
627 | { "Mic", 0x0 }, | |
628 | { "Front Mic", 0x3 }, | |
629 | { "Line", 0x2 }, | |
630 | { "CD", 0x4 }, | |
631 | }, | |
632 | }; | |
633 | ||
634 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
635 | /* 2ch mode */ | |
636 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
637 | /* set line-in to input, mute it */ | |
638 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
639 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
640 | /* set mic-in to input vref 80%, mute it */ | |
641 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
642 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
643 | { } /* end */ | |
644 | }; | |
645 | ||
646 | /* 6ch mode */ | |
647 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
648 | /* set line-in to output, unmute it */ | |
649 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
650 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
651 | /* set mic-in to output, unmute it */ | |
652 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
653 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
654 | { } /* end */ | |
655 | }; | |
656 | ||
d2a6d7dc | 657 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
e9edcee0 TI |
658 | { 2, alc880_threestack_ch2_init }, |
659 | { 6, alc880_threestack_ch6_init }, | |
660 | }; | |
661 | ||
c8b6bf9b | 662 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
05acb863 | 663 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 664 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 665 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 666 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
05acb863 TI |
667 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
668 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
669 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
670 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1da177e4 LT |
671 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
672 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
673 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
674 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
675 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
676 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
677 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
678 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
679 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
680 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
e9edcee0 TI |
681 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
682 | { | |
683 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
684 | .name = "Channel Mode", | |
df694daa KY |
685 | .info = alc_ch_mode_info, |
686 | .get = alc_ch_mode_get, | |
687 | .put = alc_ch_mode_put, | |
e9edcee0 TI |
688 | }, |
689 | { } /* end */ | |
690 | }; | |
691 | ||
692 | /* capture mixer elements */ | |
c8b6bf9b | 693 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
e9edcee0 TI |
694 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
695 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
696 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), | |
697 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), | |
698 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), | |
699 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), | |
1da177e4 LT |
700 | { |
701 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
702 | /* The multiple "Capture Source" controls confuse alsamixer | |
703 | * So call somewhat different.. | |
704 | * FIXME: the controls appear in the "playback" view! | |
705 | */ | |
706 | /* .name = "Capture Source", */ | |
707 | .name = "Input Source", | |
e9edcee0 | 708 | .count = 3, |
1da177e4 LT |
709 | .info = alc_mux_enum_info, |
710 | .get = alc_mux_enum_get, | |
711 | .put = alc_mux_enum_put, | |
712 | }, | |
1da177e4 LT |
713 | { } /* end */ |
714 | }; | |
715 | ||
e9edcee0 | 716 | /* capture mixer elements (in case NID 0x07 not available) */ |
c8b6bf9b | 717 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
71fe7b82 TI |
718 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
719 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
720 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
721 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
1da177e4 LT |
722 | { |
723 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
724 | /* The multiple "Capture Source" controls confuse alsamixer | |
725 | * So call somewhat different.. | |
726 | * FIXME: the controls appear in the "playback" view! | |
727 | */ | |
728 | /* .name = "Capture Source", */ | |
729 | .name = "Input Source", | |
730 | .count = 2, | |
731 | .info = alc_mux_enum_info, | |
732 | .get = alc_mux_enum_get, | |
733 | .put = alc_mux_enum_put, | |
734 | }, | |
1da177e4 LT |
735 | { } /* end */ |
736 | }; | |
737 | ||
e9edcee0 TI |
738 | |
739 | ||
740 | /* | |
741 | * ALC880 5-stack model | |
742 | * | |
9c7f852e TI |
743 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
744 | * Side = 0x02 (0xd) | |
e9edcee0 TI |
745 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
746 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
747 | */ | |
748 | ||
749 | /* additional mixers to alc880_three_stack_mixer */ | |
c8b6bf9b | 750 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
e9edcee0 | 751 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 752 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
1da177e4 LT |
753 | { } /* end */ |
754 | }; | |
755 | ||
e9edcee0 TI |
756 | /* channel source setting (6/8 channel selection for 5-stack) */ |
757 | /* 6ch mode */ | |
758 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
759 | /* set line-in to input, mute it */ | |
760 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
761 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
dfc0ff62 TI |
762 | { } /* end */ |
763 | }; | |
764 | ||
e9edcee0 TI |
765 | /* 8ch mode */ |
766 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
767 | /* set line-in to output, unmute it */ | |
768 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
769 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
770 | { } /* end */ | |
771 | }; | |
772 | ||
d2a6d7dc | 773 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
e9edcee0 TI |
774 | { 6, alc880_fivestack_ch6_init }, |
775 | { 8, alc880_fivestack_ch8_init }, | |
776 | }; | |
777 | ||
778 | ||
779 | /* | |
780 | * ALC880 6-stack model | |
781 | * | |
9c7f852e TI |
782 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
783 | * Side = 0x05 (0x0f) | |
e9edcee0 TI |
784 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
785 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
786 | */ | |
787 | ||
788 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
789 | /* front, rear, clfe, rear_surr */ | |
790 | 0x02, 0x03, 0x04, 0x05 | |
791 | }; | |
792 | ||
793 | static struct hda_input_mux alc880_6stack_capture_source = { | |
794 | .num_items = 4, | |
795 | .items = { | |
796 | { "Mic", 0x0 }, | |
797 | { "Front Mic", 0x1 }, | |
798 | { "Line", 0x2 }, | |
799 | { "CD", 0x4 }, | |
800 | }, | |
801 | }; | |
802 | ||
803 | /* fixed 8-channels */ | |
d2a6d7dc | 804 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
e9edcee0 TI |
805 | { 8, NULL }, |
806 | }; | |
807 | ||
c8b6bf9b | 808 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
16ded525 | 809 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 810 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 811 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 812 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
813 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
814 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
815 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
816 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 | 817 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 818 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
16ded525 TI |
819 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
820 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
821 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
822 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
823 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
824 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
825 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
826 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
827 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
828 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
16ded525 TI |
829 | { |
830 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
831 | .name = "Channel Mode", | |
df694daa KY |
832 | .info = alc_ch_mode_info, |
833 | .get = alc_ch_mode_get, | |
834 | .put = alc_ch_mode_put, | |
16ded525 TI |
835 | }, |
836 | { } /* end */ | |
837 | }; | |
838 | ||
e9edcee0 TI |
839 | |
840 | /* | |
841 | * ALC880 W810 model | |
842 | * | |
843 | * W810 has rear IO for: | |
844 | * Front (DAC 02) | |
845 | * Surround (DAC 03) | |
846 | * Center/LFE (DAC 04) | |
847 | * Digital out (06) | |
848 | * | |
849 | * The system also has a pair of internal speakers, and a headphone jack. | |
850 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
851 | * | |
852 | * There is a variable resistor to control the speaker or headphone | |
853 | * volume. This is a hardware-only device without a software API. | |
854 | * | |
855 | * Plugging headphones in will disable the internal speakers. This is | |
856 | * implemented in hardware, not via the driver using jack sense. In | |
857 | * a similar fashion, plugging into the rear socket marked "front" will | |
858 | * disable both the speakers and headphones. | |
859 | * | |
860 | * For input, there's a microphone jack, and an "audio in" jack. | |
861 | * These may not do anything useful with this driver yet, because I | |
862 | * haven't setup any initialization verbs for these yet... | |
863 | */ | |
864 | ||
865 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
866 | /* front, rear/surround, clfe */ | |
867 | 0x02, 0x03, 0x04 | |
16ded525 TI |
868 | }; |
869 | ||
e9edcee0 | 870 | /* fixed 6 channels */ |
d2a6d7dc | 871 | static struct hda_channel_mode alc880_w810_modes[1] = { |
e9edcee0 TI |
872 | { 6, NULL } |
873 | }; | |
874 | ||
875 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
c8b6bf9b | 876 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
16ded525 | 877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 878 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 879 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 880 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
881 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
882 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
883 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
884 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
e9edcee0 TI |
885 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
886 | { } /* end */ | |
887 | }; | |
888 | ||
889 | ||
890 | /* | |
891 | * Z710V model | |
892 | * | |
893 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
9c7f852e TI |
894 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
895 | * Line = 0x1a | |
e9edcee0 TI |
896 | */ |
897 | ||
898 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
899 | 0x02 | |
900 | }; | |
901 | #define ALC880_Z71V_HP_DAC 0x03 | |
902 | ||
903 | /* fixed 2 channels */ | |
d2a6d7dc | 904 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
e9edcee0 TI |
905 | { 2, NULL } |
906 | }; | |
907 | ||
c8b6bf9b | 908 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
e9edcee0 | 909 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 910 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
e9edcee0 | 911 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 912 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
913 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
914 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16ded525 TI |
915 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
916 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
917 | { } /* end */ |
918 | }; | |
919 | ||
e9edcee0 TI |
920 | |
921 | /* FIXME! */ | |
922 | /* | |
923 | * ALC880 F1734 model | |
924 | * | |
925 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
926 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
927 | */ | |
928 | ||
929 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
930 | 0x03 | |
931 | }; | |
932 | #define ALC880_F1734_HP_DAC 0x02 | |
933 | ||
c8b6bf9b | 934 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
e9edcee0 | 935 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 936 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
e9edcee0 | 937 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 938 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
e9edcee0 TI |
939 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
940 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
942 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
943 | { } /* end */ | |
944 | }; | |
945 | ||
946 | ||
947 | /* FIXME! */ | |
948 | /* | |
949 | * ALC880 ASUS model | |
950 | * | |
951 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
952 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
953 | * Mic = 0x18, Line = 0x1a | |
954 | */ | |
955 | ||
956 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
957 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
958 | ||
c8b6bf9b | 959 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
16ded525 | 960 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 961 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 962 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 963 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
964 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
965 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
966 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
967 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 TI |
968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
969 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
970 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
971 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16ded525 TI |
972 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
974 | { |
975 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
976 | .name = "Channel Mode", | |
df694daa KY |
977 | .info = alc_ch_mode_info, |
978 | .get = alc_ch_mode_get, | |
979 | .put = alc_ch_mode_put, | |
16ded525 TI |
980 | }, |
981 | { } /* end */ | |
982 | }; | |
e9edcee0 TI |
983 | |
984 | /* FIXME! */ | |
985 | /* | |
986 | * ALC880 ASUS W1V model | |
987 | * | |
988 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
989 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
990 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
991 | */ | |
992 | ||
993 | /* additional mixers to alc880_asus_mixer */ | |
c8b6bf9b | 994 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
e9edcee0 TI |
995 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
996 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
997 | { } /* end */ | |
998 | }; | |
999 | ||
3c10a9d9 | 1000 | /* additional mixers to alc880_asus_mixer */ |
c8b6bf9b | 1001 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
3c10a9d9 TI |
1002 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
1003 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1004 | { } /* end */ | |
1005 | }; | |
e9edcee0 | 1006 | |
df694daa KY |
1007 | /* TCL S700 */ |
1008 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
1009 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1010 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
1011 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
1012 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
1013 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
1014 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
1015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
1016 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
1017 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
1018 | { | |
1019 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1020 | /* The multiple "Capture Source" controls confuse alsamixer | |
1021 | * So call somewhat different.. | |
1022 | * FIXME: the controls appear in the "playback" view! | |
1023 | */ | |
1024 | /* .name = "Capture Source", */ | |
1025 | .name = "Input Source", | |
1026 | .count = 1, | |
1027 | .info = alc_mux_enum_info, | |
1028 | .get = alc_mux_enum_get, | |
1029 | .put = alc_mux_enum_put, | |
1030 | }, | |
1031 | { } /* end */ | |
1032 | }; | |
1033 | ||
ccc656ce KY |
1034 | /* Uniwill */ |
1035 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
1036 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1037 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1038 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1039 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
1040 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
1041 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1042 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1043 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1044 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1045 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1046 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1047 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1048 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1049 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1050 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1051 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1052 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1053 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1054 | { | |
1055 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1056 | .name = "Channel Mode", | |
1057 | .info = alc_ch_mode_info, | |
1058 | .get = alc_ch_mode_get, | |
1059 | .put = alc_ch_mode_put, | |
1060 | }, | |
1061 | { } /* end */ | |
1062 | }; | |
1063 | ||
1064 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { | |
1065 | HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1066 | HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1067 | HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1068 | HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
1069 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1070 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1071 | { } /* end */ | |
1072 | }; | |
1073 | ||
1da177e4 | 1074 | /* |
e9edcee0 | 1075 | * build control elements |
1da177e4 LT |
1076 | */ |
1077 | static int alc_build_controls(struct hda_codec *codec) | |
1078 | { | |
1079 | struct alc_spec *spec = codec->spec; | |
1080 | int err; | |
1081 | int i; | |
1082 | ||
1083 | for (i = 0; i < spec->num_mixers; i++) { | |
1084 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
1085 | if (err < 0) | |
1086 | return err; | |
1087 | } | |
1088 | ||
1089 | if (spec->multiout.dig_out_nid) { | |
9c7f852e TI |
1090 | err = snd_hda_create_spdif_out_ctls(codec, |
1091 | spec->multiout.dig_out_nid); | |
1da177e4 LT |
1092 | if (err < 0) |
1093 | return err; | |
1094 | } | |
1095 | if (spec->dig_in_nid) { | |
1096 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
1097 | if (err < 0) | |
1098 | return err; | |
1099 | } | |
1100 | return 0; | |
1101 | } | |
1102 | ||
e9edcee0 | 1103 | |
1da177e4 LT |
1104 | /* |
1105 | * initialize the codec volumes, etc | |
1106 | */ | |
1107 | ||
e9edcee0 TI |
1108 | /* |
1109 | * generic initialization of ADC, input mixers and output mixers | |
1110 | */ | |
1111 | static struct hda_verb alc880_volume_init_verbs[] = { | |
1112 | /* | |
1113 | * Unmute ADC0-2 and set the default input to mic-in | |
1114 | */ | |
71fe7b82 | 1115 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1116 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 1117 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1118 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 1119 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1120 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 1121 | |
e9edcee0 TI |
1122 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
1123 | * mixer widget | |
9c7f852e TI |
1124 | * Note: PASD motherboards uses the Line In 2 as the input for front |
1125 | * panel mic (mic 2) | |
1da177e4 | 1126 | */ |
e9edcee0 | 1127 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
16ded525 | 1128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
e9edcee0 TI |
1129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
1130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
1131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
1132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
1da177e4 | 1133 | |
e9edcee0 TI |
1134 | /* |
1135 | * Set up output mixers (0x0c - 0x0f) | |
1da177e4 | 1136 | */ |
e9edcee0 TI |
1137 | /* set vol=0 to output mixers */ |
1138 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1139 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1140 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1141 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1142 | /* set up input amps for analog loopback */ | |
1143 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
05acb863 TI |
1144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1145 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1146 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1147 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1149 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1150 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1151 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
1152 | |
1153 | { } | |
1154 | }; | |
1155 | ||
e9edcee0 TI |
1156 | /* |
1157 | * 3-stack pin configuration: | |
1158 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
1159 | */ | |
1160 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
1161 | /* | |
1162 | * preset connection lists of input pins | |
1163 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1164 | */ | |
1165 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
1166 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1167 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
1168 | ||
1169 | /* | |
1170 | * Set pin mode and muting | |
1171 | */ | |
1172 | /* set front pin widgets 0x14 for output */ | |
05acb863 | 1173 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
1174 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1175 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1176 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1177 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1178 | /* Mic2 (as headphone out) for HP output */ | |
1179 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1180 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1da177e4 | 1181 | /* Line In pin widget for input */ |
05acb863 | 1182 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
1183 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1184 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
1185 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1186 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1da177e4 | 1187 | /* CD pin widget for input */ |
05acb863 | 1188 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 1189 | |
e9edcee0 TI |
1190 | { } |
1191 | }; | |
1da177e4 | 1192 | |
e9edcee0 TI |
1193 | /* |
1194 | * 5-stack pin configuration: | |
1195 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
1196 | * line-in/side = 0x1a, f-mic = 0x1b | |
1197 | */ | |
1198 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
1199 | /* | |
1200 | * preset connection lists of input pins | |
1201 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1da177e4 | 1202 | */ |
e9edcee0 TI |
1203 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
1204 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
1da177e4 | 1205 | |
e9edcee0 TI |
1206 | /* |
1207 | * Set pin mode and muting | |
1da177e4 | 1208 | */ |
e9edcee0 TI |
1209 | /* set pin widgets 0x14-0x17 for output */ |
1210 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1212 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1213 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1214 | /* unmute pins for output (no gain on this amp) */ | |
1215 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1216 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1217 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1218 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1219 | ||
1220 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1221 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1222 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1223 | /* Mic2 (as headphone out) for HP output */ | |
1224 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1225 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1226 | /* Line In pin widget for input */ | |
1227 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1228 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1229 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
1230 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1231 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1232 | /* CD pin widget for input */ | |
1233 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1da177e4 LT |
1234 | |
1235 | { } | |
1236 | }; | |
1237 | ||
e9edcee0 TI |
1238 | /* |
1239 | * W810 pin configuration: | |
1240 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
1241 | */ | |
1242 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
1243 | /* hphone/speaker input selector: front DAC */ | |
1244 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
1da177e4 | 1245 | |
05acb863 | 1246 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1247 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1248 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1250 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1251 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 1252 | |
e9edcee0 | 1253 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
05acb863 | 1254 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1da177e4 | 1255 | |
1da177e4 LT |
1256 | { } |
1257 | }; | |
1258 | ||
e9edcee0 TI |
1259 | /* |
1260 | * Z71V pin configuration: | |
1261 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
1262 | */ | |
1263 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
05acb863 | 1264 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1265 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1266 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 1267 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
dfc0ff62 | 1268 | |
16ded525 | 1269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1270 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 | 1271 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1272 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 TI |
1273 | |
1274 | { } | |
1275 | }; | |
1276 | ||
e9edcee0 TI |
1277 | /* |
1278 | * 6-stack pin configuration: | |
9c7f852e TI |
1279 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
1280 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
e9edcee0 TI |
1281 | */ |
1282 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
1283 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1284 | ||
16ded525 | 1285 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1286 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1287 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1288 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1289 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1290 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1291 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
1292 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1293 | ||
16ded525 | 1294 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1295 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1296 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1297 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1298 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 | 1299 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1300 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 1301 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 TI |
1302 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1303 | ||
e9edcee0 TI |
1304 | { } |
1305 | }; | |
1306 | ||
ccc656ce KY |
1307 | /* |
1308 | * Uniwill pin configuration: | |
1309 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
1310 | * line = 0x1a | |
1311 | */ | |
1312 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
1313 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1314 | ||
1315 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1316 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1317 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1318 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1319 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1320 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1321 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1322 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1325 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1326 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1327 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1328 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1329 | ||
1330 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1331 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1332 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1333 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1334 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1335 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1336 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
1337 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
1338 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1339 | ||
1340 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
1341 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
1342 | ||
1343 | { } | |
1344 | }; | |
1345 | ||
1346 | /* | |
1347 | * Uniwill P53 | |
1348 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, | |
1349 | */ | |
1350 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
1351 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1352 | ||
1353 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1354 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1355 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1356 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1357 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1358 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1359 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1360 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1361 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1362 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1363 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1364 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1365 | ||
1366 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1367 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1368 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1369 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1370 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1371 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1372 | ||
1373 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
1374 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
1375 | ||
1376 | { } | |
1377 | }; | |
1378 | ||
1379 | /* toggle speaker-output according to the hp-jack state */ | |
1380 | static void alc880_uniwill_automute(struct hda_codec *codec) | |
1381 | { | |
1382 | unsigned int present; | |
1383 | ||
1384 | present = snd_hda_codec_read(codec, 0x14, 0, | |
1385 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
1386 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, | |
1387 | 0x80, present ? 0x80 : 0); | |
1388 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, | |
1389 | 0x80, present ? 0x80 : 0); | |
1390 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0, | |
1391 | 0x80, present ? 0x80 : 0); | |
1392 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, | |
1393 | 0x80, present ? 0x80 : 0); | |
1394 | ||
1395 | present = snd_hda_codec_read(codec, 0x18, 0, | |
1396 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
1397 | snd_hda_codec_write(codec, 0x0b, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
1398 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
1399 | } | |
1400 | ||
1401 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
1402 | unsigned int res) | |
1403 | { | |
1404 | /* Looks like the unsol event is incompatible with the standard | |
1405 | * definition. 4bit tag is placed at 28 bit! | |
1406 | */ | |
1407 | if ((res >> 28) == ALC880_HP_EVENT || | |
1408 | (res >> 28) == ALC880_MIC_EVENT) | |
1409 | alc880_uniwill_automute(codec); | |
1410 | } | |
1411 | ||
1412 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) | |
1413 | { | |
1414 | unsigned int present; | |
1415 | ||
1416 | present = snd_hda_codec_read(codec, 0x14, 0, | |
1417 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
1418 | ||
1419 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, | |
1420 | 0x80, present ? 0x80 : 0); | |
1421 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0, | |
1422 | 0x80, present ? 0x80 : 0); | |
1423 | } | |
1424 | ||
1425 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
1426 | { | |
1427 | unsigned int present; | |
1428 | ||
1429 | present = snd_hda_codec_read(codec, 0x21, 0, | |
1430 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; | |
1431 | ||
1432 | snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, | |
1433 | 0x7f, present); | |
1434 | snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, | |
1435 | 0x7f, present); | |
1436 | ||
1437 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, | |
1438 | 0x7f, present); | |
1439 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, | |
1440 | 0x7f, present); | |
1441 | ||
1442 | } | |
1443 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, | |
1444 | unsigned int res) | |
1445 | { | |
1446 | /* Looks like the unsol event is incompatible with the standard | |
1447 | * definition. 4bit tag is placed at 28 bit! | |
1448 | */ | |
1449 | if ((res >> 28) == ALC880_HP_EVENT) | |
1450 | alc880_uniwill_p53_hp_automute(codec); | |
1451 | if ((res >> 28) == ALC880_DCVOL_EVENT) | |
1452 | alc880_uniwill_p53_dcvol_automute(codec); | |
1453 | } | |
1454 | ||
e9edcee0 TI |
1455 | /* FIXME! */ |
1456 | /* | |
1457 | * F1734 pin configuration: | |
1458 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
1459 | */ | |
1460 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
16ded525 TI |
1461 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
1462 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1463 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1464 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1465 | ||
e9edcee0 | 1466 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
16ded525 | 1467 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
e9edcee0 | 1468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16ded525 | 1469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1470 | |
e9edcee0 TI |
1471 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1472 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16ded525 | 1473 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1474 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1475 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1476 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1477 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1478 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1479 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
dfc0ff62 TI |
1480 | |
1481 | { } | |
1482 | }; | |
1483 | ||
e9edcee0 TI |
1484 | /* FIXME! */ |
1485 | /* | |
1486 | * ASUS pin configuration: | |
1487 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
1488 | */ | |
1489 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
16ded525 TI |
1490 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
1491 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1492 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1493 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1494 | ||
1495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
e9edcee0 | 1496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1497 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1498 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1499 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1500 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1501 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
1502 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1503 | ||
1504 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1506 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1507 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1508 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16ded525 | 1510 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1511 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 TI |
1512 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1513 | ||
e9edcee0 TI |
1514 | { } |
1515 | }; | |
16ded525 | 1516 | |
e9edcee0 TI |
1517 | /* Enable GPIO mask and set output */ |
1518 | static struct hda_verb alc880_gpio1_init_verbs[] = { | |
1519 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
1520 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
1521 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
df694daa KY |
1522 | |
1523 | { } | |
e9edcee0 | 1524 | }; |
16ded525 | 1525 | |
e9edcee0 TI |
1526 | /* Enable GPIO mask and set output */ |
1527 | static struct hda_verb alc880_gpio2_init_verbs[] = { | |
1528 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
1529 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
1530 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
df694daa KY |
1531 | |
1532 | { } | |
1533 | }; | |
1534 | ||
1535 | /* Clevo m520g init */ | |
1536 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
1537 | /* headphone output */ | |
1538 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1539 | /* line-out */ | |
1540 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1541 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1542 | /* Line-in */ | |
1543 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1544 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1545 | /* CD */ | |
1546 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1547 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1548 | /* Mic1 (rear panel) */ | |
1549 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1550 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1551 | /* Mic2 (front panel) */ | |
1552 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1553 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1554 | /* headphone */ | |
1555 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1556 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1557 | /* change to EAPD mode */ | |
1558 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
1559 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
1560 | ||
1561 | { } | |
16ded525 TI |
1562 | }; |
1563 | ||
df694daa | 1564 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
4b146cb0 TI |
1565 | /* change to EAPD mode */ |
1566 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
1567 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
1568 | ||
df694daa KY |
1569 | /* Headphone output */ |
1570 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1571 | /* Front output*/ | |
1572 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1573 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1574 | ||
1575 | /* Line In pin widget for input */ | |
1576 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1577 | /* CD pin widget for input */ | |
1578 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1579 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1580 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1581 | ||
1582 | /* change to EAPD mode */ | |
1583 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
1584 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
1585 | ||
1586 | { } | |
1587 | }; | |
16ded525 | 1588 | |
e9edcee0 | 1589 | /* |
ae6b813a TI |
1590 | * LG m1 express dual |
1591 | * | |
1592 | * Pin assignment: | |
1593 | * Rear Line-In/Out (blue): 0x14 | |
1594 | * Build-in Mic-In: 0x15 | |
1595 | * Speaker-out: 0x17 | |
1596 | * HP-Out (green): 0x1b | |
1597 | * Mic-In/Out (red): 0x19 | |
1598 | * SPDIF-Out: 0x1e | |
1599 | */ | |
1600 | ||
1601 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
1602 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
1603 | 0x05, 0x02, 0x03 | |
1604 | }; | |
1605 | ||
1606 | /* seems analog CD is not working */ | |
1607 | static struct hda_input_mux alc880_lg_capture_source = { | |
1608 | .num_items = 3, | |
1609 | .items = { | |
1610 | { "Mic", 0x1 }, | |
1611 | { "Line", 0x5 }, | |
1612 | { "Internal Mic", 0x6 }, | |
1613 | }, | |
1614 | }; | |
1615 | ||
1616 | /* 2,4,6 channel modes */ | |
1617 | static struct hda_verb alc880_lg_ch2_init[] = { | |
1618 | /* set line-in and mic-in to input */ | |
1619 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1620 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1621 | { } | |
1622 | }; | |
1623 | ||
1624 | static struct hda_verb alc880_lg_ch4_init[] = { | |
1625 | /* set line-in to out and mic-in to input */ | |
1626 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
1627 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1628 | { } | |
1629 | }; | |
1630 | ||
1631 | static struct hda_verb alc880_lg_ch6_init[] = { | |
1632 | /* set line-in and mic-in to output */ | |
1633 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
1634 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
1635 | { } | |
1636 | }; | |
1637 | ||
1638 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
1639 | { 2, alc880_lg_ch2_init }, | |
1640 | { 4, alc880_lg_ch4_init }, | |
1641 | { 6, alc880_lg_ch6_init }, | |
1642 | }; | |
1643 | ||
1644 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
1645 | /* FIXME: it's not really "master" but front channels */ | |
1646 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
1647 | HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), | |
1648 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1649 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
1650 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
1651 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
1652 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
1653 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
1654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1656 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
1657 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
1658 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
1659 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
1660 | { | |
1661 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1662 | .name = "Channel Mode", | |
1663 | .info = alc_ch_mode_info, | |
1664 | .get = alc_ch_mode_get, | |
1665 | .put = alc_ch_mode_put, | |
1666 | }, | |
1667 | { } /* end */ | |
1668 | }; | |
1669 | ||
1670 | static struct hda_verb alc880_lg_init_verbs[] = { | |
1671 | /* set capture source to mic-in */ | |
1672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
1673 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
1674 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
1675 | /* mute all amp mixer inputs */ | |
1676 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
1677 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, | |
1678 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, | |
1679 | /* line-in to input */ | |
1680 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1681 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1682 | /* built-in mic */ | |
1683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1685 | /* speaker-out */ | |
1686 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1687 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1688 | /* mic-in to input */ | |
1689 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1690 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1691 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1692 | /* HP-out */ | |
1693 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1694 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1695 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1696 | /* jack sense */ | |
1697 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, | |
1698 | { } | |
1699 | }; | |
1700 | ||
1701 | /* toggle speaker-output according to the hp-jack state */ | |
1702 | static void alc880_lg_automute(struct hda_codec *codec) | |
1703 | { | |
1704 | unsigned int present; | |
1705 | ||
1706 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
1707 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
1708 | snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, | |
1709 | 0x80, present ? 0x80 : 0); | |
1710 | snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0, | |
1711 | 0x80, present ? 0x80 : 0); | |
1712 | } | |
1713 | ||
1714 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) | |
1715 | { | |
1716 | /* Looks like the unsol event is incompatible with the standard | |
1717 | * definition. 4bit tag is placed at 28 bit! | |
1718 | */ | |
1719 | if ((res >> 28) == 0x01) | |
1720 | alc880_lg_automute(codec); | |
1721 | } | |
1722 | ||
d681518a TI |
1723 | /* |
1724 | * LG LW20 | |
1725 | * | |
1726 | * Pin assignment: | |
1727 | * Speaker-out: 0x14 | |
1728 | * Mic-In: 0x18 | |
1729 | * Built-in Mic-In: 0x19 (?) | |
1730 | * HP-Out: 0x1b | |
1731 | * SPDIF-Out: 0x1e | |
1732 | */ | |
1733 | ||
1734 | /* seems analog CD is not working */ | |
1735 | static struct hda_input_mux alc880_lg_lw_capture_source = { | |
1736 | .num_items = 2, | |
1737 | .items = { | |
1738 | { "Mic", 0x0 }, | |
1739 | { "Internal Mic", 0x1 }, | |
1740 | }, | |
1741 | }; | |
1742 | ||
1743 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { | |
1744 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1745 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
1746 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1747 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1748 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
1749 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
1750 | { } /* end */ | |
1751 | }; | |
1752 | ||
1753 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
1754 | /* set capture source to mic-in */ | |
1755 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1756 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1757 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, | |
1759 | /* speaker-out */ | |
1760 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1761 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1762 | /* HP-out */ | |
1763 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1764 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1765 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1766 | /* mic-in to input */ | |
1767 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1768 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1769 | /* built-in mic */ | |
1770 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1771 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1772 | /* jack sense */ | |
1773 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, | |
1774 | { } | |
1775 | }; | |
1776 | ||
1777 | /* toggle speaker-output according to the hp-jack state */ | |
1778 | static void alc880_lg_lw_automute(struct hda_codec *codec) | |
1779 | { | |
1780 | unsigned int present; | |
1781 | ||
1782 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
1783 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
1784 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
1785 | 0x80, present ? 0x80 : 0); | |
1786 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
1787 | 0x80, present ? 0x80 : 0); | |
1788 | } | |
1789 | ||
1790 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) | |
1791 | { | |
1792 | /* Looks like the unsol event is incompatible with the standard | |
1793 | * definition. 4bit tag is placed at 28 bit! | |
1794 | */ | |
1795 | if ((res >> 28) == 0x01) | |
1796 | alc880_lg_lw_automute(codec); | |
1797 | } | |
1798 | ||
ae6b813a TI |
1799 | /* |
1800 | * Common callbacks | |
e9edcee0 TI |
1801 | */ |
1802 | ||
1da177e4 LT |
1803 | static int alc_init(struct hda_codec *codec) |
1804 | { | |
1805 | struct alc_spec *spec = codec->spec; | |
e9edcee0 TI |
1806 | unsigned int i; |
1807 | ||
1808 | for (i = 0; i < spec->num_init_verbs; i++) | |
1809 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
ae6b813a TI |
1810 | |
1811 | if (spec->init_hook) | |
1812 | spec->init_hook(codec); | |
1813 | ||
1da177e4 LT |
1814 | return 0; |
1815 | } | |
1816 | ||
ae6b813a TI |
1817 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
1818 | { | |
1819 | struct alc_spec *spec = codec->spec; | |
1820 | ||
1821 | if (spec->unsol_event) | |
1822 | spec->unsol_event(codec, res); | |
1823 | } | |
1824 | ||
1da177e4 LT |
1825 | #ifdef CONFIG_PM |
1826 | /* | |
1827 | * resume | |
1828 | */ | |
1829 | static int alc_resume(struct hda_codec *codec) | |
1830 | { | |
1831 | struct alc_spec *spec = codec->spec; | |
1832 | int i; | |
1833 | ||
1834 | alc_init(codec); | |
e9edcee0 | 1835 | for (i = 0; i < spec->num_mixers; i++) |
1da177e4 | 1836 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
1da177e4 LT |
1837 | if (spec->multiout.dig_out_nid) |
1838 | snd_hda_resume_spdif_out(codec); | |
1839 | if (spec->dig_in_nid) | |
1840 | snd_hda_resume_spdif_in(codec); | |
1841 | ||
1842 | return 0; | |
1843 | } | |
1844 | #endif | |
1845 | ||
1846 | /* | |
1847 | * Analog playback callbacks | |
1848 | */ | |
1849 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
1850 | struct hda_codec *codec, | |
c8b6bf9b | 1851 | struct snd_pcm_substream *substream) |
1da177e4 LT |
1852 | { |
1853 | struct alc_spec *spec = codec->spec; | |
1854 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); | |
1855 | } | |
1856 | ||
1857 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
1858 | struct hda_codec *codec, | |
1859 | unsigned int stream_tag, | |
1860 | unsigned int format, | |
c8b6bf9b | 1861 | struct snd_pcm_substream *substream) |
1da177e4 LT |
1862 | { |
1863 | struct alc_spec *spec = codec->spec; | |
9c7f852e TI |
1864 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
1865 | stream_tag, format, substream); | |
1da177e4 LT |
1866 | } |
1867 | ||
1868 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
1869 | struct hda_codec *codec, | |
c8b6bf9b | 1870 | struct snd_pcm_substream *substream) |
1da177e4 LT |
1871 | { |
1872 | struct alc_spec *spec = codec->spec; | |
1873 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
1874 | } | |
1875 | ||
1876 | /* | |
1877 | * Digital out | |
1878 | */ | |
1879 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
1880 | struct hda_codec *codec, | |
c8b6bf9b | 1881 | struct snd_pcm_substream *substream) |
1da177e4 LT |
1882 | { |
1883 | struct alc_spec *spec = codec->spec; | |
1884 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
1885 | } | |
1886 | ||
1887 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | |
1888 | struct hda_codec *codec, | |
c8b6bf9b | 1889 | struct snd_pcm_substream *substream) |
1da177e4 LT |
1890 | { |
1891 | struct alc_spec *spec = codec->spec; | |
1892 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
1893 | } | |
1894 | ||
1895 | /* | |
1896 | * Analog capture | |
1897 | */ | |
1898 | static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
1899 | struct hda_codec *codec, | |
1900 | unsigned int stream_tag, | |
1901 | unsigned int format, | |
c8b6bf9b | 1902 | struct snd_pcm_substream *substream) |
1da177e4 LT |
1903 | { |
1904 | struct alc_spec *spec = codec->spec; | |
1905 | ||
1906 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], | |
1907 | stream_tag, 0, format); | |
1908 | return 0; | |
1909 | } | |
1910 | ||
1911 | static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
1912 | struct hda_codec *codec, | |
c8b6bf9b | 1913 | struct snd_pcm_substream *substream) |
1da177e4 LT |
1914 | { |
1915 | struct alc_spec *spec = codec->spec; | |
1916 | ||
9c7f852e TI |
1917 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
1918 | 0, 0, 0); | |
1da177e4 LT |
1919 | return 0; |
1920 | } | |
1921 | ||
1922 | ||
1923 | /* | |
1924 | */ | |
1925 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
1926 | .substreams = 1, | |
1927 | .channels_min = 2, | |
1928 | .channels_max = 8, | |
e9edcee0 | 1929 | /* NID is set in alc_build_pcms */ |
1da177e4 LT |
1930 | .ops = { |
1931 | .open = alc880_playback_pcm_open, | |
1932 | .prepare = alc880_playback_pcm_prepare, | |
1933 | .cleanup = alc880_playback_pcm_cleanup | |
1934 | }, | |
1935 | }; | |
1936 | ||
1937 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
1938 | .substreams = 2, | |
1939 | .channels_min = 2, | |
1940 | .channels_max = 2, | |
e9edcee0 | 1941 | /* NID is set in alc_build_pcms */ |
1da177e4 LT |
1942 | .ops = { |
1943 | .prepare = alc880_capture_pcm_prepare, | |
1944 | .cleanup = alc880_capture_pcm_cleanup | |
1945 | }, | |
1946 | }; | |
1947 | ||
1948 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
1949 | .substreams = 1, | |
1950 | .channels_min = 2, | |
1951 | .channels_max = 2, | |
1952 | /* NID is set in alc_build_pcms */ | |
1953 | .ops = { | |
1954 | .open = alc880_dig_playback_pcm_open, | |
1955 | .close = alc880_dig_playback_pcm_close | |
1956 | }, | |
1957 | }; | |
1958 | ||
1959 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
1960 | .substreams = 1, | |
1961 | .channels_min = 2, | |
1962 | .channels_max = 2, | |
1963 | /* NID is set in alc_build_pcms */ | |
1964 | }; | |
1965 | ||
4c5186ed JW |
1966 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
1967 | static struct hda_pcm_stream alc_pcm_null_playback = { | |
1968 | .substreams = 0, | |
1969 | .channels_min = 0, | |
1970 | .channels_max = 0, | |
1971 | }; | |
1972 | ||
1da177e4 LT |
1973 | static int alc_build_pcms(struct hda_codec *codec) |
1974 | { | |
1975 | struct alc_spec *spec = codec->spec; | |
1976 | struct hda_pcm *info = spec->pcm_rec; | |
1977 | int i; | |
1978 | ||
1979 | codec->num_pcms = 1; | |
1980 | codec->pcm_info = info; | |
1981 | ||
1982 | info->name = spec->stream_name_analog; | |
4a471b7d TI |
1983 | if (spec->stream_analog_playback) { |
1984 | snd_assert(spec->multiout.dac_nids, return -EINVAL); | |
1985 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); | |
1986 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
1987 | } | |
1988 | if (spec->stream_analog_capture) { | |
1989 | snd_assert(spec->adc_nids, return -EINVAL); | |
1990 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | |
1991 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
1992 | } | |
1993 | ||
1994 | if (spec->channel_mode) { | |
1995 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
1996 | for (i = 0; i < spec->num_channel_mode; i++) { | |
1997 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
1998 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
1999 | } | |
1da177e4 LT |
2000 | } |
2001 | } | |
2002 | ||
e08a007d | 2003 | /* SPDIF for stream index #1 */ |
1da177e4 | 2004 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
e08a007d | 2005 | codec->num_pcms = 2; |
c06134d7 | 2006 | info = spec->pcm_rec + 1; |
1da177e4 | 2007 | info->name = spec->stream_name_digital; |
4a471b7d TI |
2008 | if (spec->multiout.dig_out_nid && |
2009 | spec->stream_digital_playback) { | |
1da177e4 LT |
2010 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
2011 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
2012 | } | |
4a471b7d TI |
2013 | if (spec->dig_in_nid && |
2014 | spec->stream_digital_capture) { | |
1da177e4 LT |
2015 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
2016 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
2017 | } | |
2018 | } | |
2019 | ||
e08a007d TI |
2020 | /* If the use of more than one ADC is requested for the current |
2021 | * model, configure a second analog capture-only PCM. | |
2022 | */ | |
2023 | /* Additional Analaog capture for index #2 */ | |
2024 | if (spec->num_adc_nids > 1 && spec->stream_analog_capture && | |
2025 | spec->adc_nids) { | |
2026 | codec->num_pcms = 3; | |
c06134d7 | 2027 | info = spec->pcm_rec + 2; |
e08a007d TI |
2028 | info->name = spec->stream_name_analog; |
2029 | /* No playback stream for second PCM */ | |
2030 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; | |
2031 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
2032 | if (spec->stream_analog_capture) { | |
2033 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | |
2034 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; | |
2035 | } | |
2036 | } | |
2037 | ||
1da177e4 LT |
2038 | return 0; |
2039 | } | |
2040 | ||
2041 | static void alc_free(struct hda_codec *codec) | |
2042 | { | |
e9edcee0 TI |
2043 | struct alc_spec *spec = codec->spec; |
2044 | unsigned int i; | |
2045 | ||
2046 | if (! spec) | |
2047 | return; | |
2048 | ||
2049 | if (spec->kctl_alloc) { | |
2050 | for (i = 0; i < spec->num_kctl_used; i++) | |
2051 | kfree(spec->kctl_alloc[i].name); | |
2052 | kfree(spec->kctl_alloc); | |
2053 | } | |
2054 | kfree(spec); | |
1da177e4 LT |
2055 | } |
2056 | ||
2057 | /* | |
2058 | */ | |
2059 | static struct hda_codec_ops alc_patch_ops = { | |
2060 | .build_controls = alc_build_controls, | |
2061 | .build_pcms = alc_build_pcms, | |
2062 | .init = alc_init, | |
2063 | .free = alc_free, | |
ae6b813a | 2064 | .unsol_event = alc_unsol_event, |
1da177e4 LT |
2065 | #ifdef CONFIG_PM |
2066 | .resume = alc_resume, | |
2067 | #endif | |
2068 | }; | |
2069 | ||
2fa522be TI |
2070 | |
2071 | /* | |
2072 | * Test configuration for debugging | |
2073 | * | |
2074 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
2075 | * enum controls. | |
2076 | */ | |
2077 | #ifdef CONFIG_SND_DEBUG | |
2078 | static hda_nid_t alc880_test_dac_nids[4] = { | |
2079 | 0x02, 0x03, 0x04, 0x05 | |
2080 | }; | |
2081 | ||
2082 | static struct hda_input_mux alc880_test_capture_source = { | |
ae6b813a | 2083 | .num_items = 7, |
2fa522be TI |
2084 | .items = { |
2085 | { "In-1", 0x0 }, | |
2086 | { "In-2", 0x1 }, | |
2087 | { "In-3", 0x2 }, | |
2088 | { "In-4", 0x3 }, | |
2089 | { "CD", 0x4 }, | |
ae6b813a TI |
2090 | { "Front", 0x5 }, |
2091 | { "Surround", 0x6 }, | |
2fa522be TI |
2092 | }, |
2093 | }; | |
2094 | ||
d2a6d7dc | 2095 | static struct hda_channel_mode alc880_test_modes[4] = { |
2fa522be | 2096 | { 2, NULL }, |
fd2c326d | 2097 | { 4, NULL }, |
2fa522be | 2098 | { 6, NULL }, |
fd2c326d | 2099 | { 8, NULL }, |
2fa522be TI |
2100 | }; |
2101 | ||
9c7f852e TI |
2102 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
2103 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
2104 | { |
2105 | static char *texts[] = { | |
2106 | "N/A", "Line Out", "HP Out", | |
2107 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
2108 | }; | |
2109 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
2110 | uinfo->count = 1; | |
2111 | uinfo->value.enumerated.items = 8; | |
2112 | if (uinfo->value.enumerated.item >= 8) | |
2113 | uinfo->value.enumerated.item = 7; | |
2114 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
2115 | return 0; | |
2116 | } | |
2117 | ||
9c7f852e TI |
2118 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
2119 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2120 | { |
2121 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2122 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2123 | unsigned int pin_ctl, item = 0; | |
2124 | ||
2125 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
2126 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
2127 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
2128 | if (pin_ctl & AC_PINCTL_HP_EN) | |
2129 | item = 2; | |
2130 | else | |
2131 | item = 1; | |
2132 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
2133 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
2134 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
2135 | case AC_PINCTL_VREF_50: item = 4; break; | |
2136 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
2137 | case AC_PINCTL_VREF_80: item = 6; break; | |
2138 | case AC_PINCTL_VREF_100: item = 7; break; | |
2139 | } | |
2140 | } | |
2141 | ucontrol->value.enumerated.item[0] = item; | |
2142 | return 0; | |
2143 | } | |
2144 | ||
9c7f852e TI |
2145 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
2146 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2147 | { |
2148 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2149 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2150 | static unsigned int ctls[] = { | |
2151 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
2152 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
2153 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
2154 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
2155 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
2156 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
2157 | }; | |
2158 | unsigned int old_ctl, new_ctl; | |
2159 | ||
2160 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
2161 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
2162 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
2163 | if (old_ctl != new_ctl) { | |
9c7f852e TI |
2164 | snd_hda_codec_write(codec, nid, 0, |
2165 | AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl); | |
2fa522be | 2166 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
9c7f852e TI |
2167 | (ucontrol->value.enumerated.item[0] >= 3 ? |
2168 | 0xb080 : 0xb000)); | |
2fa522be TI |
2169 | return 1; |
2170 | } | |
2171 | return 0; | |
2172 | } | |
2173 | ||
9c7f852e TI |
2174 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
2175 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
2176 | { |
2177 | static char *texts[] = { | |
2178 | "Front", "Surround", "CLFE", "Side" | |
2179 | }; | |
2180 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
2181 | uinfo->count = 1; | |
2182 | uinfo->value.enumerated.items = 4; | |
2183 | if (uinfo->value.enumerated.item >= 4) | |
2184 | uinfo->value.enumerated.item = 3; | |
2185 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
2186 | return 0; | |
2187 | } | |
2188 | ||
9c7f852e TI |
2189 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
2190 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2191 | { |
2192 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2193 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2194 | unsigned int sel; | |
2195 | ||
2196 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
2197 | ucontrol->value.enumerated.item[0] = sel & 3; | |
2198 | return 0; | |
2199 | } | |
2200 | ||
9c7f852e TI |
2201 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
2202 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2203 | { |
2204 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2205 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2206 | unsigned int sel; | |
2207 | ||
2208 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
2209 | if (ucontrol->value.enumerated.item[0] != sel) { | |
2210 | sel = ucontrol->value.enumerated.item[0] & 3; | |
2211 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel); | |
2212 | return 1; | |
2213 | } | |
2214 | return 0; | |
2215 | } | |
2216 | ||
2217 | #define PIN_CTL_TEST(xname,nid) { \ | |
2218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2219 | .name = xname, \ | |
2220 | .info = alc_test_pin_ctl_info, \ | |
2221 | .get = alc_test_pin_ctl_get, \ | |
2222 | .put = alc_test_pin_ctl_put, \ | |
2223 | .private_value = nid \ | |
2224 | } | |
2225 | ||
2226 | #define PIN_SRC_TEST(xname,nid) { \ | |
2227 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2228 | .name = xname, \ | |
2229 | .info = alc_test_pin_src_info, \ | |
2230 | .get = alc_test_pin_src_get, \ | |
2231 | .put = alc_test_pin_src_put, \ | |
2232 | .private_value = nid \ | |
2233 | } | |
2234 | ||
c8b6bf9b | 2235 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
05acb863 TI |
2236 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2237 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2238 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
2239 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
985be54b TI |
2240 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
2241 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2242 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
2243 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2fa522be TI |
2244 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
2245 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
2246 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
2247 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
2248 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
2249 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
2250 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
2251 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
2252 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
2253 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
2254 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
2255 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
2256 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2257 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2258 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2259 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2260 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
2261 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
2262 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
2263 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
2264 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
2265 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
2fa522be TI |
2266 | { |
2267 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2268 | .name = "Channel Mode", | |
df694daa KY |
2269 | .info = alc_ch_mode_info, |
2270 | .get = alc_ch_mode_get, | |
2271 | .put = alc_ch_mode_put, | |
2fa522be TI |
2272 | }, |
2273 | { } /* end */ | |
2274 | }; | |
2275 | ||
2276 | static struct hda_verb alc880_test_init_verbs[] = { | |
2277 | /* Unmute inputs of 0x0c - 0x0f */ | |
05acb863 TI |
2278 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
2279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2280 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2281 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2282 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2283 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2284 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2285 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2fa522be | 2286 | /* Vol output for 0x0c-0x0f */ |
05acb863 TI |
2287 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
2288 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2289 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2290 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2fa522be | 2291 | /* Set output pins 0x14-0x17 */ |
05acb863 TI |
2292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
2293 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2294 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2295 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2fa522be | 2296 | /* Unmute output pins 0x14-0x17 */ |
05acb863 TI |
2297 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2298 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2299 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2300 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2fa522be | 2301 | /* Set input pins 0x18-0x1c */ |
16ded525 TI |
2302 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
2303 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
05acb863 TI |
2304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
2305 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2306 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2fa522be | 2307 | /* Mute input pins 0x18-0x1b */ |
05acb863 TI |
2308 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2309 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2310 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2311 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
71fe7b82 | 2312 | /* ADC set up */ |
05acb863 | 2313 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 2314 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 2315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 2316 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 2317 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 2318 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
2319 | /* Analog input/passthru */ |
2320 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2321 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2322 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
2323 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
2324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2fa522be TI |
2325 | { } |
2326 | }; | |
2327 | #endif | |
2328 | ||
1da177e4 LT |
2329 | /* |
2330 | */ | |
2331 | ||
f5fcc13c TI |
2332 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
2333 | [ALC880_3ST] = "3stack", | |
2334 | [ALC880_TCL_S700] = "tcl", | |
2335 | [ALC880_3ST_DIG] = "3stack-digout", | |
2336 | [ALC880_CLEVO] = "clevo", | |
2337 | [ALC880_5ST] = "5stack", | |
2338 | [ALC880_5ST_DIG] = "5stack-digout", | |
2339 | [ALC880_W810] = "w810", | |
2340 | [ALC880_Z71V] = "z71v", | |
2341 | [ALC880_6ST] = "6stack", | |
2342 | [ALC880_6ST_DIG] = "6stack-digout", | |
2343 | [ALC880_ASUS] = "asus", | |
2344 | [ALC880_ASUS_W1V] = "asus-w1v", | |
2345 | [ALC880_ASUS_DIG] = "asus-dig", | |
2346 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
2347 | [ALC880_UNIWILL_DIG] = "uniwill", | |
2348 | [ALC880_F1734] = "F1734", | |
2349 | [ALC880_LG] = "lg", | |
2350 | [ALC880_LG_LW] = "lg-lw", | |
2fa522be | 2351 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 2352 | [ALC880_TEST] = "test", |
2fa522be | 2353 | #endif |
f5fcc13c TI |
2354 | [ALC880_AUTO] = "auto", |
2355 | }; | |
2356 | ||
2357 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
2358 | /* Broken BIOS configuration */ | |
2359 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), | |
2360 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
2361 | ||
2362 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), | |
2363 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
4dc53e28 | 2364 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
f5fcc13c TI |
2365 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
2366 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
2367 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
2368 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
2369 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
2370 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
2371 | ||
2372 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), | |
2373 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
2374 | ||
2375 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), | |
2376 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
2377 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
2378 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
2379 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
2380 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
2381 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
2382 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
2383 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
2384 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
2385 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_5ST), | |
2386 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), | |
2387 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
2388 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
2389 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), | |
2390 | ||
2391 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), | |
2392 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), | |
2393 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), | |
2394 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
2395 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
2396 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), | |
2397 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
2398 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), | |
2399 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), | |
2400 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), | |
2401 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), | |
2402 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | |
2403 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
2404 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), | |
2405 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
2406 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
2407 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
2408 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), | |
2409 | ||
2410 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), | |
2411 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), | |
2412 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
2413 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), | |
2414 | ||
2415 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), | |
2416 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), | |
2417 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), | |
2418 | ||
2419 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), | |
2420 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
2421 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), | |
2422 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), | |
2423 | ||
2424 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
2425 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), | |
2426 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), | |
2427 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), | |
2428 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
2429 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), | |
2430 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), | |
2431 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
2432 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
2433 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
2434 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), | |
2fa522be | 2435 | |
1da177e4 LT |
2436 | {} |
2437 | }; | |
2438 | ||
16ded525 | 2439 | /* |
df694daa | 2440 | * ALC880 codec presets |
16ded525 | 2441 | */ |
16ded525 TI |
2442 | static struct alc_config_preset alc880_presets[] = { |
2443 | [ALC880_3ST] = { | |
e9edcee0 TI |
2444 | .mixers = { alc880_three_stack_mixer }, |
2445 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, | |
16ded525 | 2446 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 | 2447 | .dac_nids = alc880_dac_nids, |
16ded525 TI |
2448 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
2449 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 2450 | .need_dac_fix = 1, |
16ded525 TI |
2451 | .input_mux = &alc880_capture_source, |
2452 | }, | |
2453 | [ALC880_3ST_DIG] = { | |
e9edcee0 TI |
2454 | .mixers = { alc880_three_stack_mixer }, |
2455 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, | |
16ded525 | 2456 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 TI |
2457 | .dac_nids = alc880_dac_nids, |
2458 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
2459 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
2460 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 2461 | .need_dac_fix = 1, |
16ded525 TI |
2462 | .input_mux = &alc880_capture_source, |
2463 | }, | |
df694daa KY |
2464 | [ALC880_TCL_S700] = { |
2465 | .mixers = { alc880_tcl_s700_mixer }, | |
2466 | .init_verbs = { alc880_volume_init_verbs, | |
2467 | alc880_pin_tcl_S700_init_verbs, | |
2468 | alc880_gpio2_init_verbs }, | |
2469 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
2470 | .dac_nids = alc880_dac_nids, | |
2471 | .hp_nid = 0x03, | |
2472 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
2473 | .channel_mode = alc880_2_jack_modes, | |
2474 | .input_mux = &alc880_capture_source, | |
2475 | }, | |
16ded525 | 2476 | [ALC880_5ST] = { |
e9edcee0 TI |
2477 | .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer}, |
2478 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
2479 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
2480 | .dac_nids = alc880_dac_nids, | |
16ded525 TI |
2481 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
2482 | .channel_mode = alc880_fivestack_modes, | |
2483 | .input_mux = &alc880_capture_source, | |
2484 | }, | |
2485 | [ALC880_5ST_DIG] = { | |
e9edcee0 TI |
2486 | .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer }, |
2487 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
2488 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
2489 | .dac_nids = alc880_dac_nids, | |
2490 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
2491 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
2492 | .channel_mode = alc880_fivestack_modes, | |
2493 | .input_mux = &alc880_capture_source, | |
2494 | }, | |
b6482d48 TI |
2495 | [ALC880_6ST] = { |
2496 | .mixers = { alc880_six_stack_mixer }, | |
2497 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, | |
2498 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | |
2499 | .dac_nids = alc880_6st_dac_nids, | |
2500 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
2501 | .channel_mode = alc880_sixstack_modes, | |
2502 | .input_mux = &alc880_6stack_capture_source, | |
2503 | }, | |
16ded525 | 2504 | [ALC880_6ST_DIG] = { |
e9edcee0 TI |
2505 | .mixers = { alc880_six_stack_mixer }, |
2506 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, | |
16ded525 TI |
2507 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
2508 | .dac_nids = alc880_6st_dac_nids, | |
2509 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
2510 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
2511 | .channel_mode = alc880_sixstack_modes, | |
2512 | .input_mux = &alc880_6stack_capture_source, | |
2513 | }, | |
2514 | [ALC880_W810] = { | |
e9edcee0 | 2515 | .mixers = { alc880_w810_base_mixer }, |
b0af0de5 TI |
2516 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs, |
2517 | alc880_gpio2_init_verbs }, | |
16ded525 TI |
2518 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
2519 | .dac_nids = alc880_w810_dac_nids, | |
2520 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
2521 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
2522 | .channel_mode = alc880_w810_modes, | |
2523 | .input_mux = &alc880_capture_source, | |
2524 | }, | |
2525 | [ALC880_Z71V] = { | |
e9edcee0 | 2526 | .mixers = { alc880_z71v_mixer }, |
b0af0de5 | 2527 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs }, |
16ded525 TI |
2528 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
2529 | .dac_nids = alc880_z71v_dac_nids, | |
2530 | .dig_out_nid = ALC880_DIGOUT_NID, | |
2531 | .hp_nid = 0x03, | |
e9edcee0 TI |
2532 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
2533 | .channel_mode = alc880_2_jack_modes, | |
16ded525 TI |
2534 | .input_mux = &alc880_capture_source, |
2535 | }, | |
2536 | [ALC880_F1734] = { | |
e9edcee0 TI |
2537 | .mixers = { alc880_f1734_mixer }, |
2538 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_f1734_init_verbs }, | |
2539 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), | |
2540 | .dac_nids = alc880_f1734_dac_nids, | |
2541 | .hp_nid = 0x02, | |
2542 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
2543 | .channel_mode = alc880_2_jack_modes, | |
16ded525 TI |
2544 | .input_mux = &alc880_capture_source, |
2545 | }, | |
2546 | [ALC880_ASUS] = { | |
e9edcee0 TI |
2547 | .mixers = { alc880_asus_mixer }, |
2548 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, | |
2549 | alc880_gpio1_init_verbs }, | |
2550 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
2551 | .dac_nids = alc880_asus_dac_nids, | |
2552 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
2553 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 2554 | .need_dac_fix = 1, |
16ded525 TI |
2555 | .input_mux = &alc880_capture_source, |
2556 | }, | |
2557 | [ALC880_ASUS_DIG] = { | |
e9edcee0 TI |
2558 | .mixers = { alc880_asus_mixer }, |
2559 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, | |
2560 | alc880_gpio1_init_verbs }, | |
2561 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
2562 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 2563 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
2564 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
2565 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 2566 | .need_dac_fix = 1, |
16ded525 TI |
2567 | .input_mux = &alc880_capture_source, |
2568 | }, | |
df694daa KY |
2569 | [ALC880_ASUS_DIG2] = { |
2570 | .mixers = { alc880_asus_mixer }, | |
2571 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, | |
2572 | alc880_gpio2_init_verbs }, /* use GPIO2 */ | |
2573 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
2574 | .dac_nids = alc880_asus_dac_nids, | |
2575 | .dig_out_nid = ALC880_DIGOUT_NID, | |
2576 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
2577 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 2578 | .need_dac_fix = 1, |
df694daa KY |
2579 | .input_mux = &alc880_capture_source, |
2580 | }, | |
16ded525 | 2581 | [ALC880_ASUS_W1V] = { |
e9edcee0 TI |
2582 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
2583 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, | |
2584 | alc880_gpio1_init_verbs }, | |
2585 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
2586 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 2587 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
2588 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
2589 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 2590 | .need_dac_fix = 1, |
16ded525 TI |
2591 | .input_mux = &alc880_capture_source, |
2592 | }, | |
2593 | [ALC880_UNIWILL_DIG] = { | |
3c10a9d9 | 2594 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
ccc656ce KY |
2595 | .init_verbs = { alc880_volume_init_verbs, |
2596 | alc880_pin_asus_init_verbs }, | |
e9edcee0 TI |
2597 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
2598 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 2599 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
2600 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
2601 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 2602 | .need_dac_fix = 1, |
16ded525 TI |
2603 | .input_mux = &alc880_capture_source, |
2604 | }, | |
ccc656ce KY |
2605 | [ALC880_UNIWILL] = { |
2606 | .mixers = { alc880_uniwill_mixer }, | |
2607 | .init_verbs = { alc880_volume_init_verbs, | |
2608 | alc880_uniwill_init_verbs }, | |
2609 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
2610 | .dac_nids = alc880_asus_dac_nids, | |
2611 | .dig_out_nid = ALC880_DIGOUT_NID, | |
2612 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
2613 | .channel_mode = alc880_threestack_modes, | |
2614 | .need_dac_fix = 1, | |
2615 | .input_mux = &alc880_capture_source, | |
2616 | .unsol_event = alc880_uniwill_unsol_event, | |
2617 | .init_hook = alc880_uniwill_automute, | |
2618 | }, | |
2619 | [ALC880_UNIWILL_P53] = { | |
2620 | .mixers = { alc880_uniwill_p53_mixer }, | |
2621 | .init_verbs = { alc880_volume_init_verbs, | |
2622 | alc880_uniwill_p53_init_verbs }, | |
2623 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
2624 | .dac_nids = alc880_asus_dac_nids, | |
2625 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
2626 | .channel_mode = alc880_w810_modes, | |
2627 | .input_mux = &alc880_capture_source, | |
2628 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
2629 | .init_hook = alc880_uniwill_p53_hp_automute, | |
2630 | }, | |
df694daa KY |
2631 | [ALC880_CLEVO] = { |
2632 | .mixers = { alc880_three_stack_mixer }, | |
2633 | .init_verbs = { alc880_volume_init_verbs, | |
2634 | alc880_pin_clevo_init_verbs }, | |
2635 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
2636 | .dac_nids = alc880_dac_nids, | |
2637 | .hp_nid = 0x03, | |
2638 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
2639 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 2640 | .need_dac_fix = 1, |
df694daa KY |
2641 | .input_mux = &alc880_capture_source, |
2642 | }, | |
ae6b813a TI |
2643 | [ALC880_LG] = { |
2644 | .mixers = { alc880_lg_mixer }, | |
2645 | .init_verbs = { alc880_volume_init_verbs, | |
2646 | alc880_lg_init_verbs }, | |
2647 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
2648 | .dac_nids = alc880_lg_dac_nids, | |
2649 | .dig_out_nid = ALC880_DIGOUT_NID, | |
2650 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
2651 | .channel_mode = alc880_lg_ch_modes, | |
4e195a7b | 2652 | .need_dac_fix = 1, |
ae6b813a TI |
2653 | .input_mux = &alc880_lg_capture_source, |
2654 | .unsol_event = alc880_lg_unsol_event, | |
2655 | .init_hook = alc880_lg_automute, | |
2656 | }, | |
d681518a TI |
2657 | [ALC880_LG_LW] = { |
2658 | .mixers = { alc880_lg_lw_mixer }, | |
2659 | .init_verbs = { alc880_volume_init_verbs, | |
2660 | alc880_lg_lw_init_verbs }, | |
2661 | .num_dacs = 1, | |
2662 | .dac_nids = alc880_dac_nids, | |
2663 | .dig_out_nid = ALC880_DIGOUT_NID, | |
2664 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
2665 | .channel_mode = alc880_2_jack_modes, | |
2666 | .input_mux = &alc880_lg_lw_capture_source, | |
2667 | .unsol_event = alc880_lg_lw_unsol_event, | |
2668 | .init_hook = alc880_lg_lw_automute, | |
2669 | }, | |
16ded525 TI |
2670 | #ifdef CONFIG_SND_DEBUG |
2671 | [ALC880_TEST] = { | |
e9edcee0 TI |
2672 | .mixers = { alc880_test_mixer }, |
2673 | .init_verbs = { alc880_test_init_verbs }, | |
16ded525 TI |
2674 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
2675 | .dac_nids = alc880_test_dac_nids, | |
2676 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
2677 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
2678 | .channel_mode = alc880_test_modes, | |
2679 | .input_mux = &alc880_test_capture_source, | |
2680 | }, | |
2681 | #endif | |
2682 | }; | |
2683 | ||
e9edcee0 TI |
2684 | /* |
2685 | * Automatic parse of I/O pins from the BIOS configuration | |
2686 | */ | |
2687 | ||
2688 | #define NUM_CONTROL_ALLOC 32 | |
2689 | #define NUM_VERB_ALLOC 32 | |
2690 | ||
2691 | enum { | |
2692 | ALC_CTL_WIDGET_VOL, | |
2693 | ALC_CTL_WIDGET_MUTE, | |
2694 | ALC_CTL_BIND_MUTE, | |
2695 | }; | |
c8b6bf9b | 2696 | static struct snd_kcontrol_new alc880_control_templates[] = { |
e9edcee0 TI |
2697 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
2698 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
985be54b | 2699 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
e9edcee0 TI |
2700 | }; |
2701 | ||
2702 | /* add dynamic controls */ | |
2703 | static int add_control(struct alc_spec *spec, int type, const char *name, unsigned long val) | |
2704 | { | |
c8b6bf9b | 2705 | struct snd_kcontrol_new *knew; |
e9edcee0 TI |
2706 | |
2707 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { | |
2708 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; | |
2709 | ||
2710 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ | |
2711 | if (! knew) | |
2712 | return -ENOMEM; | |
2713 | if (spec->kctl_alloc) { | |
2714 | memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); | |
2715 | kfree(spec->kctl_alloc); | |
2716 | } | |
2717 | spec->kctl_alloc = knew; | |
2718 | spec->num_kctl_alloc = num; | |
2719 | } | |
2720 | ||
2721 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | |
2722 | *knew = alc880_control_templates[type]; | |
543537bd | 2723 | knew->name = kstrdup(name, GFP_KERNEL); |
e9edcee0 TI |
2724 | if (! knew->name) |
2725 | return -ENOMEM; | |
2726 | knew->private_value = val; | |
2727 | spec->num_kctl_used++; | |
2728 | return 0; | |
2729 | } | |
2730 | ||
2731 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) | |
2732 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
2733 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
2734 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
2735 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) | |
2736 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) | |
2737 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | |
2738 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
2739 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
2740 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
2741 | #define ALC880_PIN_CD_NID 0x1c | |
2742 | ||
2743 | /* fill in the dac_nids table from the parsed pin configuration */ | |
2744 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pin_cfg *cfg) | |
2745 | { | |
2746 | hda_nid_t nid; | |
2747 | int assigned[4]; | |
2748 | int i, j; | |
2749 | ||
2750 | memset(assigned, 0, sizeof(assigned)); | |
b0af0de5 | 2751 | spec->multiout.dac_nids = spec->private_dac_nids; |
e9edcee0 TI |
2752 | |
2753 | /* check the pins hardwired to audio widget */ | |
2754 | for (i = 0; i < cfg->line_outs; i++) { | |
2755 | nid = cfg->line_out_pins[i]; | |
2756 | if (alc880_is_fixed_pin(nid)) { | |
2757 | int idx = alc880_fixed_pin_idx(nid); | |
5014f193 | 2758 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
e9edcee0 TI |
2759 | assigned[idx] = 1; |
2760 | } | |
2761 | } | |
2762 | /* left pins can be connect to any audio widget */ | |
2763 | for (i = 0; i < cfg->line_outs; i++) { | |
2764 | nid = cfg->line_out_pins[i]; | |
2765 | if (alc880_is_fixed_pin(nid)) | |
2766 | continue; | |
2767 | /* search for an empty channel */ | |
2768 | for (j = 0; j < cfg->line_outs; j++) { | |
2769 | if (! assigned[j]) { | |
2770 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(j); | |
2771 | assigned[j] = 1; | |
2772 | break; | |
2773 | } | |
2774 | } | |
2775 | } | |
2776 | spec->multiout.num_dacs = cfg->line_outs; | |
2777 | return 0; | |
2778 | } | |
2779 | ||
2780 | /* add playback controls from the parsed DAC table */ | |
df694daa KY |
2781 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
2782 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
2783 | { |
2784 | char name[32]; | |
2785 | static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; | |
2786 | hda_nid_t nid; | |
2787 | int i, err; | |
2788 | ||
2789 | for (i = 0; i < cfg->line_outs; i++) { | |
2790 | if (! spec->multiout.dac_nids[i]) | |
2791 | continue; | |
2792 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
2793 | if (i == 2) { | |
2794 | /* Center/LFE */ | |
2795 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Center Playback Volume", | |
2796 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) | |
2797 | return err; | |
2798 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "LFE Playback Volume", | |
2799 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) | |
2800 | return err; | |
2801 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Center Playback Switch", | |
2802 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, HDA_INPUT))) < 0) | |
2803 | return err; | |
2804 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "LFE Playback Switch", | |
2805 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, HDA_INPUT))) < 0) | |
2806 | return err; | |
2807 | } else { | |
2808 | sprintf(name, "%s Playback Volume", chname[i]); | |
2809 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
2810 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | |
2811 | return err; | |
2812 | sprintf(name, "%s Playback Switch", chname[i]); | |
2813 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, | |
2814 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) | |
2815 | return err; | |
2816 | } | |
2817 | } | |
e9edcee0 TI |
2818 | return 0; |
2819 | } | |
2820 | ||
8d88bc3d TI |
2821 | /* add playback controls for speaker and HP outputs */ |
2822 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
2823 | const char *pfx) | |
e9edcee0 TI |
2824 | { |
2825 | hda_nid_t nid; | |
2826 | int err; | |
8d88bc3d | 2827 | char name[32]; |
e9edcee0 TI |
2828 | |
2829 | if (! pin) | |
2830 | return 0; | |
2831 | ||
2832 | if (alc880_is_fixed_pin(pin)) { | |
2833 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
82bc955f TI |
2834 | /* specify the DAC as the extra output */ |
2835 | if (! spec->multiout.hp_nid) | |
e9edcee0 | 2836 | spec->multiout.hp_nid = nid; |
82bc955f TI |
2837 | else |
2838 | spec->multiout.extra_out_nid[0] = nid; | |
e9edcee0 TI |
2839 | /* control HP volume/switch on the output mixer amp */ |
2840 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
8d88bc3d TI |
2841 | sprintf(name, "%s Playback Volume", pfx); |
2842 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
e9edcee0 TI |
2843 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) |
2844 | return err; | |
8d88bc3d TI |
2845 | sprintf(name, "%s Playback Switch", pfx); |
2846 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, | |
e9edcee0 TI |
2847 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) |
2848 | return err; | |
2849 | } else if (alc880_is_multi_pin(pin)) { | |
2850 | /* set manual connection */ | |
e9edcee0 | 2851 | /* we have only a switch on HP-out PIN */ |
8d88bc3d TI |
2852 | sprintf(name, "%s Playback Switch", pfx); |
2853 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
e9edcee0 TI |
2854 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT))) < 0) |
2855 | return err; | |
2856 | } | |
2857 | return 0; | |
2858 | } | |
2859 | ||
2860 | /* create input playback/capture controls for the given pin */ | |
df694daa KY |
2861 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, const char *ctlname, |
2862 | int idx, hda_nid_t mix_nid) | |
e9edcee0 TI |
2863 | { |
2864 | char name[32]; | |
df694daa | 2865 | int err; |
e9edcee0 TI |
2866 | |
2867 | sprintf(name, "%s Playback Volume", ctlname); | |
e9edcee0 | 2868 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
df694daa | 2869 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT))) < 0) |
e9edcee0 TI |
2870 | return err; |
2871 | sprintf(name, "%s Playback Switch", ctlname); | |
2872 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
df694daa | 2873 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT))) < 0) |
e9edcee0 TI |
2874 | return err; |
2875 | return 0; | |
2876 | } | |
2877 | ||
2878 | /* create playback/capture controls for input pins */ | |
df694daa KY |
2879 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
2880 | const struct auto_pin_cfg *cfg) | |
e9edcee0 | 2881 | { |
e9edcee0 | 2882 | struct hda_input_mux *imux = &spec->private_imux; |
df694daa | 2883 | int i, err, idx; |
e9edcee0 TI |
2884 | |
2885 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
2886 | if (alc880_is_input_pin(cfg->input_pins[i])) { | |
df694daa | 2887 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
4a471b7d TI |
2888 | err = new_analog_input(spec, cfg->input_pins[i], |
2889 | auto_pin_cfg_labels[i], | |
df694daa | 2890 | idx, 0x0b); |
e9edcee0 TI |
2891 | if (err < 0) |
2892 | return err; | |
4a471b7d | 2893 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
e9edcee0 TI |
2894 | imux->items[imux->num_items].index = alc880_input_pin_idx(cfg->input_pins[i]); |
2895 | imux->num_items++; | |
2896 | } | |
2897 | } | |
2898 | return 0; | |
2899 | } | |
2900 | ||
df694daa KY |
2901 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
2902 | hda_nid_t nid, int pin_type, | |
e9edcee0 TI |
2903 | int dac_idx) |
2904 | { | |
2905 | /* set as output */ | |
2906 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | |
2907 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | |
2908 | /* need the manual connection? */ | |
2909 | if (alc880_is_multi_pin(nid)) { | |
2910 | struct alc_spec *spec = codec->spec; | |
2911 | int idx = alc880_multi_pin_idx(nid); | |
2912 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
2913 | AC_VERB_SET_CONNECT_SEL, | |
2914 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
2915 | } | |
2916 | } | |
2917 | ||
2918 | static void alc880_auto_init_multi_out(struct hda_codec *codec) | |
2919 | { | |
2920 | struct alc_spec *spec = codec->spec; | |
2921 | int i; | |
2922 | ||
2923 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
2924 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
2925 | alc880_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); | |
2926 | } | |
2927 | } | |
2928 | ||
8d88bc3d | 2929 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
e9edcee0 TI |
2930 | { |
2931 | struct alc_spec *spec = codec->spec; | |
2932 | hda_nid_t pin; | |
2933 | ||
82bc955f | 2934 | pin = spec->autocfg.speaker_pins[0]; |
8d88bc3d TI |
2935 | if (pin) /* connect to front */ |
2936 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
eb06ed8f | 2937 | pin = spec->autocfg.hp_pins[0]; |
e9edcee0 TI |
2938 | if (pin) /* connect to front */ |
2939 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
2940 | } | |
2941 | ||
2942 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
2943 | { | |
2944 | struct alc_spec *spec = codec->spec; | |
2945 | int i; | |
2946 | ||
2947 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
2948 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
2949 | if (alc880_is_input_pin(nid)) { | |
2950 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
2951 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); | |
2952 | if (nid != ALC880_PIN_CD_NID) | |
2953 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
2954 | AMP_OUT_MUTE); | |
2955 | } | |
2956 | } | |
2957 | } | |
2958 | ||
2959 | /* parse the BIOS configuration and set up the alc_spec */ | |
2960 | /* return 1 if successful, 0 if the proper config is not found, or a negative error code */ | |
2961 | static int alc880_parse_auto_config(struct hda_codec *codec) | |
2962 | { | |
2963 | struct alc_spec *spec = codec->spec; | |
2964 | int err; | |
df694daa | 2965 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
e9edcee0 | 2966 | |
df694daa KY |
2967 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
2968 | alc880_ignore)) < 0) | |
e9edcee0 | 2969 | return err; |
82bc955f | 2970 | if (! spec->autocfg.line_outs) |
e9edcee0 | 2971 | return 0; /* can't find valid BIOS pin config */ |
df694daa KY |
2972 | |
2973 | if ((err = alc880_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || | |
2974 | (err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || | |
82bc955f TI |
2975 | (err = alc880_auto_create_extra_out(spec, |
2976 | spec->autocfg.speaker_pins[0], | |
8d88bc3d | 2977 | "Speaker")) < 0 || |
eb06ed8f | 2978 | (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
8d88bc3d | 2979 | "Headphone")) < 0 || |
e9edcee0 TI |
2980 | (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
2981 | return err; | |
2982 | ||
2983 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
2984 | ||
2985 | if (spec->autocfg.dig_out_pin) | |
2986 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | |
2987 | if (spec->autocfg.dig_in_pin) | |
2988 | spec->dig_in_nid = ALC880_DIGIN_NID; | |
2989 | ||
2990 | if (spec->kctl_alloc) | |
2991 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
2992 | ||
2993 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; | |
2994 | ||
a1e8d2da | 2995 | spec->num_mux_defs = 1; |
e9edcee0 TI |
2996 | spec->input_mux = &spec->private_imux; |
2997 | ||
2998 | return 1; | |
2999 | } | |
3000 | ||
ae6b813a TI |
3001 | /* additional initialization for auto-configuration model */ |
3002 | static void alc880_auto_init(struct hda_codec *codec) | |
e9edcee0 | 3003 | { |
e9edcee0 | 3004 | alc880_auto_init_multi_out(codec); |
8d88bc3d | 3005 | alc880_auto_init_extra_out(codec); |
e9edcee0 | 3006 | alc880_auto_init_analog_input(codec); |
e9edcee0 TI |
3007 | } |
3008 | ||
3009 | /* | |
3010 | * OK, here we have finally the patch for ALC880 | |
3011 | */ | |
3012 | ||
1da177e4 LT |
3013 | static int patch_alc880(struct hda_codec *codec) |
3014 | { | |
3015 | struct alc_spec *spec; | |
3016 | int board_config; | |
df694daa | 3017 | int err; |
1da177e4 | 3018 | |
e560d8d8 | 3019 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
3020 | if (spec == NULL) |
3021 | return -ENOMEM; | |
3022 | ||
3023 | codec->spec = spec; | |
3024 | ||
f5fcc13c TI |
3025 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
3026 | alc880_models, | |
3027 | alc880_cfg_tbl); | |
3028 | if (board_config < 0) { | |
9c7f852e TI |
3029 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
3030 | "trying auto-probe from BIOS...\n"); | |
e9edcee0 | 3031 | board_config = ALC880_AUTO; |
1da177e4 | 3032 | } |
1da177e4 | 3033 | |
e9edcee0 TI |
3034 | if (board_config == ALC880_AUTO) { |
3035 | /* automatic parse from the BIOS config */ | |
3036 | err = alc880_parse_auto_config(codec); | |
3037 | if (err < 0) { | |
3038 | alc_free(codec); | |
3039 | return err; | |
3040 | } else if (! err) { | |
9c7f852e TI |
3041 | printk(KERN_INFO |
3042 | "hda_codec: Cannot set up configuration " | |
3043 | "from BIOS. Using 3-stack mode...\n"); | |
e9edcee0 TI |
3044 | board_config = ALC880_3ST; |
3045 | } | |
1da177e4 LT |
3046 | } |
3047 | ||
df694daa KY |
3048 | if (board_config != ALC880_AUTO) |
3049 | setup_preset(spec, &alc880_presets[board_config]); | |
1da177e4 LT |
3050 | |
3051 | spec->stream_name_analog = "ALC880 Analog"; | |
3052 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | |
3053 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
3054 | ||
3055 | spec->stream_name_digital = "ALC880 Digital"; | |
3056 | spec->stream_digital_playback = &alc880_pcm_digital_playback; | |
3057 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
3058 | ||
e9edcee0 TI |
3059 | if (! spec->adc_nids && spec->input_mux) { |
3060 | /* check whether NID 0x07 is valid */ | |
54d17403 | 3061 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
e9edcee0 TI |
3062 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
3063 | if (wcap != AC_WID_AUD_IN) { | |
3064 | spec->adc_nids = alc880_adc_nids_alt; | |
3065 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
3066 | spec->mixers[spec->num_mixers] = alc880_capture_alt_mixer; | |
3067 | spec->num_mixers++; | |
3068 | } else { | |
3069 | spec->adc_nids = alc880_adc_nids; | |
3070 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
3071 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; | |
3072 | spec->num_mixers++; | |
3073 | } | |
3074 | } | |
1da177e4 LT |
3075 | |
3076 | codec->patch_ops = alc_patch_ops; | |
e9edcee0 | 3077 | if (board_config == ALC880_AUTO) |
ae6b813a | 3078 | spec->init_hook = alc880_auto_init; |
1da177e4 LT |
3079 | |
3080 | return 0; | |
3081 | } | |
3082 | ||
e9edcee0 | 3083 | |
1da177e4 LT |
3084 | /* |
3085 | * ALC260 support | |
3086 | */ | |
3087 | ||
e9edcee0 TI |
3088 | static hda_nid_t alc260_dac_nids[1] = { |
3089 | /* front */ | |
3090 | 0x02, | |
3091 | }; | |
3092 | ||
3093 | static hda_nid_t alc260_adc_nids[1] = { | |
3094 | /* ADC0 */ | |
3095 | 0x04, | |
3096 | }; | |
3097 | ||
df694daa | 3098 | static hda_nid_t alc260_adc_nids_alt[1] = { |
e9edcee0 TI |
3099 | /* ADC1 */ |
3100 | 0x05, | |
3101 | }; | |
3102 | ||
df694daa KY |
3103 | static hda_nid_t alc260_hp_adc_nids[2] = { |
3104 | /* ADC1, 0 */ | |
3105 | 0x05, 0x04 | |
3106 | }; | |
3107 | ||
d57fdac0 JW |
3108 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
3109 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
3110 | */ | |
3111 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
4c5186ed JW |
3112 | /* ADC0, ADC1 */ |
3113 | 0x04, 0x05 | |
3114 | }; | |
3115 | ||
e9edcee0 TI |
3116 | #define ALC260_DIGOUT_NID 0x03 |
3117 | #define ALC260_DIGIN_NID 0x06 | |
3118 | ||
3119 | static struct hda_input_mux alc260_capture_source = { | |
3120 | .num_items = 4, | |
3121 | .items = { | |
3122 | { "Mic", 0x0 }, | |
3123 | { "Front Mic", 0x1 }, | |
3124 | { "Line", 0x2 }, | |
3125 | { "CD", 0x4 }, | |
3126 | }, | |
3127 | }; | |
3128 | ||
17e7aec6 | 3129 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
a1e8d2da JW |
3130 | * headphone jack and the internal CD lines since these are the only pins at |
3131 | * which audio can appear. For flexibility, also allow the option of | |
3132 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
3133 | * connection to the mixer output). | |
a9430dd8 | 3134 | */ |
a1e8d2da JW |
3135 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
3136 | { | |
3137 | .num_items = 3, | |
3138 | .items = { | |
3139 | { "Mic/Line", 0x0 }, | |
3140 | { "CD", 0x4 }, | |
3141 | { "Headphone", 0x2 }, | |
3142 | }, | |
a9430dd8 | 3143 | }, |
a1e8d2da JW |
3144 | { |
3145 | .num_items = 4, | |
3146 | .items = { | |
3147 | { "Mic/Line", 0x0 }, | |
3148 | { "CD", 0x4 }, | |
3149 | { "Headphone", 0x2 }, | |
3150 | { "Mixer", 0x5 }, | |
3151 | }, | |
3152 | }, | |
3153 | ||
a9430dd8 JW |
3154 | }; |
3155 | ||
a1e8d2da JW |
3156 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
3157 | * the Fujitsu S702x, but jacks are marked differently. | |
0bfc90e9 | 3158 | */ |
a1e8d2da JW |
3159 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
3160 | { | |
3161 | .num_items = 4, | |
3162 | .items = { | |
3163 | { "Mic", 0x0 }, | |
3164 | { "Line", 0x2 }, | |
3165 | { "CD", 0x4 }, | |
3166 | { "Headphone", 0x5 }, | |
3167 | }, | |
3168 | }, | |
3169 | { | |
3170 | .num_items = 5, | |
3171 | .items = { | |
3172 | { "Mic", 0x0 }, | |
3173 | { "Line", 0x2 }, | |
3174 | { "CD", 0x4 }, | |
3175 | { "Headphone", 0x6 }, | |
3176 | { "Mixer", 0x5 }, | |
3177 | }, | |
0bfc90e9 JW |
3178 | }, |
3179 | }; | |
1da177e4 LT |
3180 | /* |
3181 | * This is just place-holder, so there's something for alc_build_pcms to look | |
3182 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
3183 | * element which allows changing the channel mode, so the verb list is | |
3184 | * never used. | |
3185 | */ | |
d2a6d7dc | 3186 | static struct hda_channel_mode alc260_modes[1] = { |
1da177e4 LT |
3187 | { 2, NULL }, |
3188 | }; | |
3189 | ||
df694daa KY |
3190 | |
3191 | /* Mixer combinations | |
3192 | * | |
3193 | * basic: base_output + input + pc_beep + capture | |
3194 | * HP: base_output + input + capture_alt | |
3195 | * HP_3013: hp_3013 + input + capture | |
3196 | * fujitsu: fujitsu + capture | |
0bfc90e9 | 3197 | * acer: acer + capture |
df694daa KY |
3198 | */ |
3199 | ||
3200 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
05acb863 | 3201 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 3202 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
05acb863 | 3203 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
985be54b | 3204 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
05acb863 | 3205 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
985be54b | 3206 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
1da177e4 | 3207 | { } /* end */ |
df694daa | 3208 | }; |
1da177e4 | 3209 | |
df694daa | 3210 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
16ded525 TI |
3211 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
3212 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
3213 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
3214 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
3215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
3216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
3217 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
3218 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
df694daa KY |
3219 | { } /* end */ |
3220 | }; | |
3221 | ||
3222 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { | |
3223 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), | |
3224 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), | |
3225 | { } /* end */ | |
3226 | }; | |
3227 | ||
3228 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | |
3229 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
3230 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
3231 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
3232 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
3233 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
3234 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
3235 | HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
3236 | HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
16ded525 TI |
3237 | { } /* end */ |
3238 | }; | |
3239 | ||
a1e8d2da JW |
3240 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
3241 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | |
3242 | */ | |
c8b6bf9b | 3243 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
a9430dd8 | 3244 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 3245 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
4c5186ed | 3246 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
a9430dd8 JW |
3247 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
3248 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
3249 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
3250 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4c5186ed | 3251 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
a9430dd8 JW |
3252 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
3253 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
3254 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
985be54b | 3255 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
df694daa KY |
3256 | { } /* end */ |
3257 | }; | |
3258 | ||
a1e8d2da JW |
3259 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
3260 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
3261 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
3262 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
3263 | * whether this behaviour is intentional or is a hardware bug in chip | |
3264 | * revisions available in early 2006. Therefore for now allow the | |
3265 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
3266 | * that the lack of mic bias for this NID is intentional we could change the | |
3267 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
3268 | * | |
3269 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
3270 | * don't appear to make the mic bias available from the "line" jack, even | |
3271 | * though the NID used for this jack (0x14) can supply it. The theory is | |
3272 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
3273 | * and the output jack. If this turns out to be the case for all such | |
3274 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
3275 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
bd869485 JW |
3276 | * |
3277 | * The C20x Tablet series have a mono internal speaker which is controlled | |
3278 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
3279 | * controls for such models. On models without a "mono speaker" the control | |
3280 | * won't do anything. | |
a1e8d2da | 3281 | */ |
0bfc90e9 JW |
3282 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
3283 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
3284 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
a1e8d2da | 3285 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
bd869485 JW |
3286 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
3287 | HDA_OUTPUT), | |
3288 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, | |
3289 | HDA_INPUT), | |
0bfc90e9 JW |
3290 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
3291 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
3292 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
3293 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
3294 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
3295 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
3296 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
3297 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
3298 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
3299 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
3300 | { } /* end */ | |
3301 | }; | |
3302 | ||
df694daa KY |
3303 | /* capture mixer elements */ |
3304 | static struct snd_kcontrol_new alc260_capture_mixer[] = { | |
a9430dd8 JW |
3305 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
3306 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), | |
df694daa KY |
3307 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
3308 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), | |
a9430dd8 JW |
3309 | { |
3310 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
df694daa KY |
3311 | /* The multiple "Capture Source" controls confuse alsamixer |
3312 | * So call somewhat different.. | |
3313 | * FIXME: the controls appear in the "playback" view! | |
3314 | */ | |
3315 | /* .name = "Capture Source", */ | |
3316 | .name = "Input Source", | |
3317 | .count = 2, | |
3318 | .info = alc_mux_enum_info, | |
3319 | .get = alc_mux_enum_get, | |
3320 | .put = alc_mux_enum_put, | |
3321 | }, | |
3322 | { } /* end */ | |
3323 | }; | |
3324 | ||
3325 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { | |
3326 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), | |
3327 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), | |
3328 | { | |
3329 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3330 | /* The multiple "Capture Source" controls confuse alsamixer | |
3331 | * So call somewhat different.. | |
3332 | * FIXME: the controls appear in the "playback" view! | |
3333 | */ | |
3334 | /* .name = "Capture Source", */ | |
3335 | .name = "Input Source", | |
3336 | .count = 1, | |
a9430dd8 JW |
3337 | .info = alc_mux_enum_info, |
3338 | .get = alc_mux_enum_get, | |
3339 | .put = alc_mux_enum_put, | |
3340 | }, | |
3341 | { } /* end */ | |
3342 | }; | |
3343 | ||
df694daa KY |
3344 | /* |
3345 | * initialization verbs | |
3346 | */ | |
1da177e4 LT |
3347 | static struct hda_verb alc260_init_verbs[] = { |
3348 | /* Line In pin widget for input */ | |
05acb863 | 3349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 3350 | /* CD pin widget for input */ |
05acb863 | 3351 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 3352 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
16ded525 | 3353 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 3354 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
16ded525 | 3355 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 3356 | /* LINE-2 is used for line-out in rear */ |
05acb863 | 3357 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 3358 | /* select line-out */ |
fd56f2db | 3359 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 | 3360 | /* LINE-OUT pin */ |
05acb863 | 3361 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 3362 | /* enable HP */ |
05acb863 | 3363 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1da177e4 | 3364 | /* enable Mono */ |
05acb863 TI |
3365 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
3366 | /* mute capture amp left and right */ | |
16ded525 | 3367 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 LT |
3368 | /* set connection select to line in (default select for this ADC) */ |
3369 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16ded525 TI |
3370 | /* mute capture amp left and right */ |
3371 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3372 | /* set connection select to line in (default select for this ADC) */ | |
3373 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
05acb863 TI |
3374 | /* set vol=0 Line-Out mixer amp left and right */ |
3375 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3376 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
3377 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3378 | /* set vol=0 HP mixer amp left and right */ | |
3379 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3380 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
3381 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3382 | /* set vol=0 Mono mixer amp left and right */ | |
3383 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3384 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
3385 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3386 | /* unmute LINE-2 out pin */ | |
3387 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1da177e4 | 3388 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ |
05acb863 | 3389 | /* mute CD */ |
16ded525 | 3390 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
05acb863 | 3391 | /* mute Line In */ |
16ded525 | 3392 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
05acb863 | 3393 | /* mute Mic */ |
16ded525 | 3394 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 3395 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
05acb863 TI |
3396 | /* mute Front out path */ |
3397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3398 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3399 | /* mute Headphone out path */ | |
3400 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3401 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3402 | /* mute Mono out path */ | |
3403 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3404 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
3405 | { } |
3406 | }; | |
3407 | ||
474167d6 | 3408 | #if 0 /* should be identical with alc260_init_verbs? */ |
df694daa KY |
3409 | static struct hda_verb alc260_hp_init_verbs[] = { |
3410 | /* Headphone and output */ | |
3411 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
3412 | /* mono output */ | |
3413 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
3414 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3415 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
3416 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
3417 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
3418 | /* Line In pin widget for input */ | |
3419 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
3420 | /* Line-2 pin widget for output */ | |
3421 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
3422 | /* CD pin widget for input */ | |
3423 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
3424 | /* unmute amp left and right */ | |
3425 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
3426 | /* set connection select to line in (default select for this ADC) */ | |
3427 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
3428 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
3429 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
3430 | /* mute pin widget amp left and right (no gain on this amp) */ | |
3431 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
3432 | /* unmute HP mixer amp left and right (volume = 0) */ | |
3433 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
3434 | /* mute pin widget amp left and right (no gain on this amp) */ | |
3435 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
3436 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ | |
3437 | /* unmute CD */ | |
3438 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
3439 | /* unmute Line In */ | |
3440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
3441 | /* unmute Mic */ | |
3442 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3443 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
3444 | /* Unmute Front out path */ | |
3445 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3447 | /* Unmute Headphone out path */ | |
3448 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3449 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3450 | /* Unmute Mono out path */ | |
3451 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3452 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3453 | { } | |
3454 | }; | |
474167d6 | 3455 | #endif |
df694daa KY |
3456 | |
3457 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
3458 | /* Line out and output */ | |
3459 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
3460 | /* mono output */ | |
3461 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
3462 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3463 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
3464 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
3465 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
3466 | /* Line In pin widget for input */ | |
3467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
3468 | /* Headphone pin widget for output */ | |
3469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
3470 | /* CD pin widget for input */ | |
3471 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
3472 | /* unmute amp left and right */ | |
3473 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
3474 | /* set connection select to line in (default select for this ADC) */ | |
3475 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
3476 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
3477 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
3478 | /* mute pin widget amp left and right (no gain on this amp) */ | |
3479 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
3480 | /* unmute HP mixer amp left and right (volume = 0) */ | |
3481 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
3482 | /* mute pin widget amp left and right (no gain on this amp) */ | |
3483 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
3484 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ | |
3485 | /* unmute CD */ | |
3486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
3487 | /* unmute Line In */ | |
3488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
3489 | /* unmute Mic */ | |
3490 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3491 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | |
3492 | /* Unmute Front out path */ | |
3493 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3494 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3495 | /* Unmute Headphone out path */ | |
3496 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3497 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3498 | /* Unmute Mono out path */ | |
3499 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3500 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3501 | { } | |
3502 | }; | |
3503 | ||
a9430dd8 | 3504 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
a1e8d2da JW |
3505 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
3506 | * audio = 0x16, internal speaker = 0x10. | |
a9430dd8 JW |
3507 | */ |
3508 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
3509 | /* Disable all GPIOs */ | |
3510 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
3511 | /* Internal speaker is connected to headphone pin */ | |
3512 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3513 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
3514 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
f7ace40d JW |
3515 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
3516 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3517 | /* Ensure all other unused pins are disabled and muted. */ | |
3518 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
3519 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a9430dd8 | 3520 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d | 3521 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
a9430dd8 | 3522 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d JW |
3523 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3524 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
3525 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3526 | ||
3527 | /* Disable digital (SPDIF) pins */ | |
3528 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
3529 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
a9430dd8 | 3530 | |
f7ace40d JW |
3531 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
3532 | * when acting as an output. | |
3533 | */ | |
3534 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4c5186ed | 3535 | |
f7ace40d | 3536 | /* Start with output sum widgets muted and their output gains at min */ |
8b33a5aa TI |
3537 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3538 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3539 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3540 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3541 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3542 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3543 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3544 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3545 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a9430dd8 | 3546 | |
f7ace40d JW |
3547 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
3548 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3549 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
3550 | * If the pin mode is changed by the user the pin mode control will | |
3551 | * take care of enabling the pin's input/output buffers as needed. | |
3552 | * Therefore there's no need to enable the input buffer at this | |
3553 | * stage. | |
cdcd9268 | 3554 | */ |
f7ace40d | 3555 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
cdcd9268 JW |
3556 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
3557 | * mixer ctrl) | |
3558 | */ | |
f7ace40d JW |
3559 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3560 | ||
3561 | /* Mute capture amp left and right */ | |
3562 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3563 | /* Set ADC connection select to match default mixer setting - line | |
3564 | * in (on mic1 pin) | |
3565 | */ | |
3566 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3567 | ||
3568 | /* Do the same for the second ADC: mute capture input amp and | |
3569 | * set ADC connection to line in (on mic1 pin) | |
3570 | */ | |
3571 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3572 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3573 | ||
3574 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
3575 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
3576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
3577 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
3578 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
3579 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
3580 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
3581 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
3582 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4a471b7d TI |
3583 | |
3584 | { } | |
a9430dd8 JW |
3585 | }; |
3586 | ||
0bfc90e9 JW |
3587 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
3588 | * similar laptops (adapted from Fujitsu init verbs). | |
3589 | */ | |
3590 | static struct hda_verb alc260_acer_init_verbs[] = { | |
3591 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
3592 | * the headphone jack. Turn this on and rely on the standard mute | |
3593 | * methods whenever the user wants to turn these outputs off. | |
3594 | */ | |
3595 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
3596 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
3597 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
3598 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
3599 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3600 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
3601 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
3602 | /* Line In jack is connected to Line1 pin */ | |
3603 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
bd869485 JW |
3604 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
3605 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
0bfc90e9 JW |
3606 | /* Ensure all other unused pins are disabled and muted. */ |
3607 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
3608 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
0bfc90e9 JW |
3609 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
3610 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3611 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
3612 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3613 | /* Disable digital (SPDIF) pins */ | |
3614 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
3615 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
3616 | ||
3617 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
3618 | * bus when acting as outputs. | |
3619 | */ | |
3620 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
3621 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
3622 | ||
3623 | /* Start with output sum widgets muted and their output gains at min */ | |
3624 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3625 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3626 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3627 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3628 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3629 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3630 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3631 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3632 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3633 | ||
3634 | /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */ | |
3635 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
bd869485 JW |
3636 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
3637 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
0bfc90e9 JW |
3638 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
3639 | * inputs. If the pin mode is changed by the user the pin mode control | |
3640 | * will take care of enabling the pin's input/output buffers as needed. | |
3641 | * Therefore there's no need to enable the input buffer at this | |
3642 | * stage. | |
3643 | */ | |
3644 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3645 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3646 | ||
3647 | /* Mute capture amp left and right */ | |
3648 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3649 | /* Set ADC connection select to match default mixer setting - mic | |
3650 | * (on mic1 pin) | |
3651 | */ | |
3652 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3653 | ||
3654 | /* Do similar with the second ADC: mute capture input amp and | |
a1e8d2da | 3655 | * set ADC connection to mic to match ALSA's default state. |
0bfc90e9 JW |
3656 | */ |
3657 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a1e8d2da | 3658 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
0bfc90e9 JW |
3659 | |
3660 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
3661 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
3662 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
3663 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
3664 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
3665 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
3666 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
3667 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
3668 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
3669 | ||
3670 | { } | |
3671 | }; | |
3672 | ||
7cf51e48 JW |
3673 | /* Test configuration for debugging, modelled after the ALC880 test |
3674 | * configuration. | |
3675 | */ | |
3676 | #ifdef CONFIG_SND_DEBUG | |
3677 | static hda_nid_t alc260_test_dac_nids[1] = { | |
3678 | 0x02, | |
3679 | }; | |
3680 | static hda_nid_t alc260_test_adc_nids[2] = { | |
3681 | 0x04, 0x05, | |
3682 | }; | |
a1e8d2da JW |
3683 | /* For testing the ALC260, each input MUX needs its own definition since |
3684 | * the signal assignments are different. This assumes that the first ADC | |
3685 | * is NID 0x04. | |
17e7aec6 | 3686 | */ |
a1e8d2da JW |
3687 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
3688 | { | |
3689 | .num_items = 7, | |
3690 | .items = { | |
3691 | { "MIC1 pin", 0x0 }, | |
3692 | { "MIC2 pin", 0x1 }, | |
3693 | { "LINE1 pin", 0x2 }, | |
3694 | { "LINE2 pin", 0x3 }, | |
3695 | { "CD pin", 0x4 }, | |
3696 | { "LINE-OUT pin", 0x5 }, | |
3697 | { "HP-OUT pin", 0x6 }, | |
3698 | }, | |
3699 | }, | |
3700 | { | |
3701 | .num_items = 8, | |
3702 | .items = { | |
3703 | { "MIC1 pin", 0x0 }, | |
3704 | { "MIC2 pin", 0x1 }, | |
3705 | { "LINE1 pin", 0x2 }, | |
3706 | { "LINE2 pin", 0x3 }, | |
3707 | { "CD pin", 0x4 }, | |
3708 | { "Mixer", 0x5 }, | |
3709 | { "LINE-OUT pin", 0x6 }, | |
3710 | { "HP-OUT pin", 0x7 }, | |
3711 | }, | |
7cf51e48 JW |
3712 | }, |
3713 | }; | |
3714 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
3715 | /* Output driver widgets */ | |
3716 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
3717 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
3718 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
3719 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
3720 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
3721 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
3722 | ||
a1e8d2da JW |
3723 | /* Modes for retasking pin widgets |
3724 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
3725 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
3726 | * mention this restriction. At this stage it's not clear whether | |
3727 | * this behaviour is intentional or is a hardware bug in chip | |
3728 | * revisions available at least up until early 2006. Therefore for | |
3729 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
3730 | * choices, but if it turns out that the lack of mic bias for these | |
3731 | * NIDs is intentional we could change their modes from | |
3732 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
3733 | */ | |
7cf51e48 JW |
3734 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
3735 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
3736 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
3737 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
3738 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
3739 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
3740 | ||
3741 | /* Loopback mixer controls */ | |
3742 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
3743 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
3744 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
3745 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
3746 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
3747 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
3748 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
3749 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
3750 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
3751 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
3752 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
3753 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
3754 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | |
3755 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
3756 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
3757 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
5c8f858d JW |
3758 | |
3759 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
3760 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
3761 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
3762 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
3763 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
3764 | ||
92621f13 JW |
3765 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
3766 | * is ambigious as to which NID is which; testing on laptops which | |
3767 | * make this output available should provide clarification. | |
3768 | */ | |
3769 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
3770 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
3771 | ||
7cf51e48 JW |
3772 | { } /* end */ |
3773 | }; | |
3774 | static struct hda_verb alc260_test_init_verbs[] = { | |
5c8f858d JW |
3775 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
3776 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
3777 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
3778 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
3779 | ||
7cf51e48 JW |
3780 | /* Enable retasking pins as output, initially without power amp */ |
3781 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3782 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3783 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3784 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3785 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3786 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3787 | ||
92621f13 JW |
3788 | /* Disable digital (SPDIF) pins initially, but users can enable |
3789 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
3790 | * payload also sets the generation to 0, output to be in "consumer" | |
3791 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
3792 | * control. | |
3793 | */ | |
7cf51e48 JW |
3794 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
3795 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
3796 | ||
f7ace40d | 3797 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
7cf51e48 JW |
3798 | * OUT1 sum bus when acting as an output. |
3799 | */ | |
3800 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
3801 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
3802 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
3803 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
3804 | ||
3805 | /* Start with output sum widgets muted and their output gains at min */ | |
3806 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3807 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3808 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3809 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3810 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3811 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3812 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3813 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3814 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3815 | ||
cdcd9268 JW |
3816 | /* Unmute retasking pin widget output buffers since the default |
3817 | * state appears to be output. As the pin mode is changed by the | |
3818 | * user the pin mode control will take care of enabling the pin's | |
3819 | * input/output buffers as needed. | |
3820 | */ | |
7cf51e48 JW |
3821 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3822 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3823 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3824 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3825 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3826 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3827 | /* Also unmute the mono-out pin widget */ | |
3828 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3829 | ||
7cf51e48 JW |
3830 | /* Mute capture amp left and right */ |
3831 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
f7ace40d JW |
3832 | /* Set ADC connection select to match default mixer setting (mic1 |
3833 | * pin) | |
7cf51e48 JW |
3834 | */ |
3835 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3836 | ||
3837 | /* Do the same for the second ADC: mute capture input amp and | |
f7ace40d | 3838 | * set ADC connection to mic1 pin |
7cf51e48 JW |
3839 | */ |
3840 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3841 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3842 | ||
3843 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
3844 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
3845 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
3846 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
3847 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
3848 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
3849 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
3850 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
3851 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
3852 | ||
3853 | { } | |
3854 | }; | |
3855 | #endif | |
3856 | ||
1da177e4 LT |
3857 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
3858 | .substreams = 1, | |
3859 | .channels_min = 2, | |
3860 | .channels_max = 2, | |
1da177e4 LT |
3861 | }; |
3862 | ||
3863 | static struct hda_pcm_stream alc260_pcm_analog_capture = { | |
3864 | .substreams = 1, | |
3865 | .channels_min = 2, | |
3866 | .channels_max = 2, | |
1da177e4 LT |
3867 | }; |
3868 | ||
a3bcba38 TI |
3869 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
3870 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
3871 | ||
df694daa KY |
3872 | /* |
3873 | * for BIOS auto-configuration | |
3874 | */ | |
16ded525 | 3875 | |
df694daa KY |
3876 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
3877 | const char *pfx) | |
3878 | { | |
3879 | hda_nid_t nid_vol; | |
3880 | unsigned long vol_val, sw_val; | |
3881 | char name[32]; | |
3882 | int err; | |
3883 | ||
3884 | if (nid >= 0x0f && nid < 0x11) { | |
3885 | nid_vol = nid - 0x7; | |
3886 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
3887 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
3888 | } else if (nid == 0x11) { | |
3889 | nid_vol = nid - 0x7; | |
3890 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
3891 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
3892 | } else if (nid >= 0x12 && nid <= 0x15) { | |
3893 | nid_vol = 0x08; | |
3894 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
3895 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
3896 | } else | |
3897 | return 0; /* N/A */ | |
3898 | ||
3899 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | |
3900 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val)) < 0) | |
3901 | return err; | |
3902 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | |
3903 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val)) < 0) | |
3904 | return err; | |
3905 | return 1; | |
3906 | } | |
3907 | ||
3908 | /* add playback controls from the parsed DAC table */ | |
3909 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
3910 | const struct auto_pin_cfg *cfg) | |
3911 | { | |
3912 | hda_nid_t nid; | |
3913 | int err; | |
3914 | ||
3915 | spec->multiout.num_dacs = 1; | |
3916 | spec->multiout.dac_nids = spec->private_dac_nids; | |
3917 | spec->multiout.dac_nids[0] = 0x02; | |
3918 | ||
3919 | nid = cfg->line_out_pins[0]; | |
3920 | if (nid) { | |
3921 | err = alc260_add_playback_controls(spec, nid, "Front"); | |
3922 | if (err < 0) | |
3923 | return err; | |
3924 | } | |
3925 | ||
82bc955f | 3926 | nid = cfg->speaker_pins[0]; |
df694daa KY |
3927 | if (nid) { |
3928 | err = alc260_add_playback_controls(spec, nid, "Speaker"); | |
3929 | if (err < 0) | |
3930 | return err; | |
3931 | } | |
3932 | ||
eb06ed8f | 3933 | nid = cfg->hp_pins[0]; |
df694daa KY |
3934 | if (nid) { |
3935 | err = alc260_add_playback_controls(spec, nid, "Headphone"); | |
3936 | if (err < 0) | |
3937 | return err; | |
3938 | } | |
3939 | return 0; | |
3940 | } | |
3941 | ||
3942 | /* create playback/capture controls for input pins */ | |
3943 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, | |
3944 | const struct auto_pin_cfg *cfg) | |
3945 | { | |
df694daa KY |
3946 | struct hda_input_mux *imux = &spec->private_imux; |
3947 | int i, err, idx; | |
3948 | ||
3949 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
3950 | if (cfg->input_pins[i] >= 0x12) { | |
3951 | idx = cfg->input_pins[i] - 0x12; | |
4a471b7d TI |
3952 | err = new_analog_input(spec, cfg->input_pins[i], |
3953 | auto_pin_cfg_labels[i], idx, 0x07); | |
df694daa KY |
3954 | if (err < 0) |
3955 | return err; | |
4a471b7d | 3956 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
df694daa KY |
3957 | imux->items[imux->num_items].index = idx; |
3958 | imux->num_items++; | |
3959 | } | |
3960 | if ((cfg->input_pins[i] >= 0x0f) && (cfg->input_pins[i] <= 0x10)){ | |
3961 | idx = cfg->input_pins[i] - 0x09; | |
4a471b7d TI |
3962 | err = new_analog_input(spec, cfg->input_pins[i], |
3963 | auto_pin_cfg_labels[i], idx, 0x07); | |
df694daa KY |
3964 | if (err < 0) |
3965 | return err; | |
4a471b7d | 3966 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
df694daa KY |
3967 | imux->items[imux->num_items].index = idx; |
3968 | imux->num_items++; | |
3969 | } | |
3970 | } | |
3971 | return 0; | |
3972 | } | |
3973 | ||
3974 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
3975 | hda_nid_t nid, int pin_type, | |
3976 | int sel_idx) | |
3977 | { | |
3978 | /* set as output */ | |
3979 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | |
3980 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | |
3981 | /* need the manual connection? */ | |
3982 | if (nid >= 0x12) { | |
3983 | int idx = nid - 0x12; | |
3984 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
3985 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
3986 | ||
3987 | } | |
3988 | } | |
3989 | ||
3990 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
3991 | { | |
3992 | struct alc_spec *spec = codec->spec; | |
3993 | hda_nid_t nid; | |
3994 | ||
3995 | nid = spec->autocfg.line_out_pins[0]; | |
3996 | if (nid) | |
3997 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
3998 | ||
82bc955f | 3999 | nid = spec->autocfg.speaker_pins[0]; |
df694daa KY |
4000 | if (nid) |
4001 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
4002 | ||
eb06ed8f | 4003 | nid = spec->autocfg.hp_pins[0]; |
df694daa KY |
4004 | if (nid) |
4005 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
4006 | } | |
4007 | ||
4008 | #define ALC260_PIN_CD_NID 0x16 | |
4009 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
4010 | { | |
4011 | struct alc_spec *spec = codec->spec; | |
4012 | int i; | |
4013 | ||
4014 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
4015 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
4016 | if (nid >= 0x12) { | |
4017 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4018 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); | |
4019 | if (nid != ALC260_PIN_CD_NID) | |
4020 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
4021 | AMP_OUT_MUTE); | |
4022 | } | |
4023 | } | |
4024 | } | |
4025 | ||
4026 | /* | |
4027 | * generic initialization of ADC, input mixers and output mixers | |
4028 | */ | |
4029 | static struct hda_verb alc260_volume_init_verbs[] = { | |
4030 | /* | |
4031 | * Unmute ADC0-1 and set the default input to mic-in | |
4032 | */ | |
4033 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4034 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4035 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4036 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4037 | ||
4038 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
4039 | * mixer widget | |
4040 | * Note: PASD motherboards uses the Line In 2 as the input for front panel | |
4041 | * mic (mic 2) | |
4042 | */ | |
4043 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
4044 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4046 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
4047 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
4048 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
4049 | ||
4050 | /* | |
4051 | * Set up output mixers (0x08 - 0x0a) | |
4052 | */ | |
4053 | /* set vol=0 to output mixers */ | |
4054 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4055 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4056 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4057 | /* set up input amps for analog loopback */ | |
4058 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
4059 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4060 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4061 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4062 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4063 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4064 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4065 | ||
4066 | { } | |
4067 | }; | |
4068 | ||
4069 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
4070 | { | |
4071 | struct alc_spec *spec = codec->spec; | |
4072 | unsigned int wcap; | |
4073 | int err; | |
4074 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
4075 | ||
4076 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
4077 | alc260_ignore)) < 0) | |
4078 | return err; | |
4a471b7d TI |
4079 | if ((err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0) |
4080 | return err; | |
4081 | if (! spec->kctl_alloc) | |
df694daa | 4082 | return 0; /* can't find valid BIOS pin config */ |
4a471b7d | 4083 | if ((err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
df694daa KY |
4084 | return err; |
4085 | ||
4086 | spec->multiout.max_channels = 2; | |
4087 | ||
4088 | if (spec->autocfg.dig_out_pin) | |
4089 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | |
4090 | if (spec->kctl_alloc) | |
4091 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
4092 | ||
4093 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; | |
4094 | ||
a1e8d2da | 4095 | spec->num_mux_defs = 1; |
df694daa KY |
4096 | spec->input_mux = &spec->private_imux; |
4097 | ||
4098 | /* check whether NID 0x04 is valid */ | |
4a471b7d | 4099 | wcap = get_wcaps(codec, 0x04); |
df694daa KY |
4100 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
4101 | if (wcap != AC_WID_AUD_IN) { | |
4102 | spec->adc_nids = alc260_adc_nids_alt; | |
4103 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
4104 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; | |
df694daa KY |
4105 | } else { |
4106 | spec->adc_nids = alc260_adc_nids; | |
4107 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
4108 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; | |
df694daa | 4109 | } |
4a471b7d | 4110 | spec->num_mixers++; |
df694daa KY |
4111 | |
4112 | return 1; | |
4113 | } | |
4114 | ||
ae6b813a TI |
4115 | /* additional initialization for auto-configuration model */ |
4116 | static void alc260_auto_init(struct hda_codec *codec) | |
df694daa | 4117 | { |
df694daa KY |
4118 | alc260_auto_init_multi_out(codec); |
4119 | alc260_auto_init_analog_input(codec); | |
df694daa KY |
4120 | } |
4121 | ||
4122 | /* | |
4123 | * ALC260 configurations | |
4124 | */ | |
f5fcc13c TI |
4125 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
4126 | [ALC260_BASIC] = "basic", | |
4127 | [ALC260_HP] = "hp", | |
4128 | [ALC260_HP_3013] = "hp-3013", | |
4129 | [ALC260_FUJITSU_S702X] = "fujitsu", | |
4130 | [ALC260_ACER] = "acer", | |
7cf51e48 | 4131 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 4132 | [ALC260_TEST] = "test", |
7cf51e48 | 4133 | #endif |
f5fcc13c TI |
4134 | [ALC260_AUTO] = "auto", |
4135 | }; | |
4136 | ||
4137 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
bd869485 | 4138 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
f5fcc13c TI |
4139 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
4140 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | |
4141 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), | |
4142 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), | |
4143 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | |
4144 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
4145 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
4146 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
4147 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
4148 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
4149 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
4150 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
4151 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
df694daa KY |
4152 | {} |
4153 | }; | |
4154 | ||
4155 | static struct alc_config_preset alc260_presets[] = { | |
4156 | [ALC260_BASIC] = { | |
4157 | .mixers = { alc260_base_output_mixer, | |
4158 | alc260_input_mixer, | |
4159 | alc260_pc_beep_mixer, | |
4160 | alc260_capture_mixer }, | |
4161 | .init_verbs = { alc260_init_verbs }, | |
4162 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
4163 | .dac_nids = alc260_dac_nids, | |
4164 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
4165 | .adc_nids = alc260_adc_nids, | |
4166 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
4167 | .channel_mode = alc260_modes, | |
4168 | .input_mux = &alc260_capture_source, | |
4169 | }, | |
4170 | [ALC260_HP] = { | |
4171 | .mixers = { alc260_base_output_mixer, | |
4172 | alc260_input_mixer, | |
4173 | alc260_capture_alt_mixer }, | |
474167d6 | 4174 | .init_verbs = { alc260_init_verbs }, |
df694daa KY |
4175 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
4176 | .dac_nids = alc260_dac_nids, | |
4177 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | |
4178 | .adc_nids = alc260_hp_adc_nids, | |
4179 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
4180 | .channel_mode = alc260_modes, | |
4181 | .input_mux = &alc260_capture_source, | |
4182 | }, | |
4183 | [ALC260_HP_3013] = { | |
4184 | .mixers = { alc260_hp_3013_mixer, | |
4185 | alc260_input_mixer, | |
4186 | alc260_capture_alt_mixer }, | |
4187 | .init_verbs = { alc260_hp_3013_init_verbs }, | |
4188 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
4189 | .dac_nids = alc260_dac_nids, | |
4190 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | |
4191 | .adc_nids = alc260_hp_adc_nids, | |
4192 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
4193 | .channel_mode = alc260_modes, | |
4194 | .input_mux = &alc260_capture_source, | |
4195 | }, | |
4196 | [ALC260_FUJITSU_S702X] = { | |
4197 | .mixers = { alc260_fujitsu_mixer, | |
4198 | alc260_capture_mixer }, | |
4199 | .init_verbs = { alc260_fujitsu_init_verbs }, | |
4200 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
4201 | .dac_nids = alc260_dac_nids, | |
d57fdac0 JW |
4202 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
4203 | .adc_nids = alc260_dual_adc_nids, | |
df694daa KY |
4204 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
4205 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
4206 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
4207 | .input_mux = alc260_fujitsu_capture_sources, | |
df694daa | 4208 | }, |
0bfc90e9 JW |
4209 | [ALC260_ACER] = { |
4210 | .mixers = { alc260_acer_mixer, | |
4211 | alc260_capture_mixer }, | |
4212 | .init_verbs = { alc260_acer_init_verbs }, | |
4213 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
4214 | .dac_nids = alc260_dac_nids, | |
4215 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
4216 | .adc_nids = alc260_dual_adc_nids, | |
4217 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
4218 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
4219 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
4220 | .input_mux = alc260_acer_capture_sources, | |
0bfc90e9 | 4221 | }, |
7cf51e48 JW |
4222 | #ifdef CONFIG_SND_DEBUG |
4223 | [ALC260_TEST] = { | |
4224 | .mixers = { alc260_test_mixer, | |
4225 | alc260_capture_mixer }, | |
4226 | .init_verbs = { alc260_test_init_verbs }, | |
4227 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
4228 | .dac_nids = alc260_test_dac_nids, | |
4229 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
4230 | .adc_nids = alc260_test_adc_nids, | |
4231 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
4232 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
4233 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
4234 | .input_mux = alc260_test_capture_sources, | |
7cf51e48 JW |
4235 | }, |
4236 | #endif | |
df694daa KY |
4237 | }; |
4238 | ||
4239 | static int patch_alc260(struct hda_codec *codec) | |
1da177e4 LT |
4240 | { |
4241 | struct alc_spec *spec; | |
df694daa | 4242 | int err, board_config; |
1da177e4 | 4243 | |
e560d8d8 | 4244 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
4245 | if (spec == NULL) |
4246 | return -ENOMEM; | |
4247 | ||
4248 | codec->spec = spec; | |
4249 | ||
f5fcc13c TI |
4250 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
4251 | alc260_models, | |
4252 | alc260_cfg_tbl); | |
4253 | if (board_config < 0) { | |
9c7f852e TI |
4254 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
4255 | "trying auto-probe from BIOS...\n"); | |
df694daa | 4256 | board_config = ALC260_AUTO; |
16ded525 | 4257 | } |
1da177e4 | 4258 | |
df694daa KY |
4259 | if (board_config == ALC260_AUTO) { |
4260 | /* automatic parse from the BIOS config */ | |
4261 | err = alc260_parse_auto_config(codec); | |
4262 | if (err < 0) { | |
4263 | alc_free(codec); | |
4264 | return err; | |
4265 | } else if (! err) { | |
9c7f852e TI |
4266 | printk(KERN_INFO |
4267 | "hda_codec: Cannot set up configuration " | |
4268 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
4269 | board_config = ALC260_BASIC; |
4270 | } | |
a9430dd8 | 4271 | } |
e9edcee0 | 4272 | |
df694daa KY |
4273 | if (board_config != ALC260_AUTO) |
4274 | setup_preset(spec, &alc260_presets[board_config]); | |
1da177e4 LT |
4275 | |
4276 | spec->stream_name_analog = "ALC260 Analog"; | |
4277 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | |
4278 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
4279 | ||
a3bcba38 TI |
4280 | spec->stream_name_digital = "ALC260 Digital"; |
4281 | spec->stream_digital_playback = &alc260_pcm_digital_playback; | |
4282 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
4283 | ||
1da177e4 | 4284 | codec->patch_ops = alc_patch_ops; |
df694daa | 4285 | if (board_config == ALC260_AUTO) |
ae6b813a | 4286 | spec->init_hook = alc260_auto_init; |
1da177e4 LT |
4287 | |
4288 | return 0; | |
4289 | } | |
4290 | ||
e9edcee0 | 4291 | |
1da177e4 LT |
4292 | /* |
4293 | * ALC882 support | |
4294 | * | |
4295 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
4296 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
4297 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
4298 | * 6-channel independent captures. | |
4299 | * | |
4300 | * In addition, an independent DAC for the multi-playback (not used in this | |
4301 | * driver yet). | |
4302 | */ | |
df694daa KY |
4303 | #define ALC882_DIGOUT_NID 0x06 |
4304 | #define ALC882_DIGIN_NID 0x0a | |
1da177e4 | 4305 | |
d2a6d7dc | 4306 | static struct hda_channel_mode alc882_ch_modes[1] = { |
1da177e4 LT |
4307 | { 8, NULL } |
4308 | }; | |
4309 | ||
4310 | static hda_nid_t alc882_dac_nids[4] = { | |
4311 | /* front, rear, clfe, rear_surr */ | |
4312 | 0x02, 0x03, 0x04, 0x05 | |
4313 | }; | |
4314 | ||
df694daa KY |
4315 | /* identical with ALC880 */ |
4316 | #define alc882_adc_nids alc880_adc_nids | |
4317 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
1da177e4 LT |
4318 | |
4319 | /* input MUX */ | |
4320 | /* FIXME: should be a matrix-type input source selection */ | |
4321 | ||
4322 | static struct hda_input_mux alc882_capture_source = { | |
4323 | .num_items = 4, | |
4324 | .items = { | |
4325 | { "Mic", 0x0 }, | |
4326 | { "Front Mic", 0x1 }, | |
4327 | { "Line", 0x2 }, | |
4328 | { "CD", 0x4 }, | |
4329 | }, | |
4330 | }; | |
1da177e4 LT |
4331 | #define alc882_mux_enum_info alc_mux_enum_info |
4332 | #define alc882_mux_enum_get alc_mux_enum_get | |
4333 | ||
c8b6bf9b | 4334 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1da177e4 LT |
4335 | { |
4336 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4337 | struct alc_spec *spec = codec->spec; | |
4338 | const struct hda_input_mux *imux = spec->input_mux; | |
4339 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
4340 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; | |
4341 | hda_nid_t nid = capture_mixers[adc_idx]; | |
4342 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
4343 | unsigned int i, idx; | |
4344 | ||
4345 | idx = ucontrol->value.enumerated.item[0]; | |
4346 | if (idx >= imux->num_items) | |
4347 | idx = imux->num_items - 1; | |
4348 | if (*cur_val == idx && ! codec->in_resume) | |
4349 | return 0; | |
4350 | for (i = 0; i < imux->num_items; i++) { | |
4351 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; | |
4352 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
4353 | v | (imux->items[i].index << 8)); | |
4354 | } | |
4355 | *cur_val = idx; | |
4356 | return 1; | |
4357 | } | |
4358 | ||
df694daa KY |
4359 | /* |
4360 | * 6ch mode | |
4361 | */ | |
4362 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
4363 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
4364 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
4365 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
4366 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
4367 | { } /* end */ | |
4368 | }; | |
4369 | ||
4370 | /* | |
4371 | * 8ch mode | |
4372 | */ | |
4373 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
4374 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
4375 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
4376 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
4377 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
4378 | { } /* end */ | |
4379 | }; | |
4380 | ||
4381 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
4382 | { 6, alc882_sixstack_ch6_init }, | |
4383 | { 8, alc882_sixstack_ch8_init }, | |
4384 | }; | |
4385 | ||
1da177e4 LT |
4386 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
4387 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
4388 | */ | |
c8b6bf9b | 4389 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
05acb863 | 4390 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 4391 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 4392 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 4393 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
05acb863 TI |
4394 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
4395 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
4396 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
4397 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
05acb863 | 4398 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 4399 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1da177e4 LT |
4400 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
4401 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
4402 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
4403 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
4404 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
4405 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4406 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4407 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
4408 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
4409 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
4410 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1da177e4 LT |
4411 | { } /* end */ |
4412 | }; | |
4413 | ||
df694daa KY |
4414 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
4415 | { | |
4416 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4417 | .name = "Channel Mode", | |
4418 | .info = alc_ch_mode_info, | |
4419 | .get = alc_ch_mode_get, | |
4420 | .put = alc_ch_mode_put, | |
4421 | }, | |
4422 | { } /* end */ | |
4423 | }; | |
4424 | ||
1da177e4 LT |
4425 | static struct hda_verb alc882_init_verbs[] = { |
4426 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
05acb863 TI |
4427 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
4428 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4429 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 4430 | /* Rear mixer */ |
05acb863 TI |
4431 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
4432 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4433 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 4434 | /* CLFE mixer */ |
05acb863 TI |
4435 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
4436 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4437 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 4438 | /* Side mixer */ |
05acb863 TI |
4439 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
4440 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4441 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 4442 | |
e9edcee0 | 4443 | /* Front Pin: output 0 (0x0c) */ |
05acb863 | 4444 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 4445 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 4446 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 4447 | /* Rear Pin: output 1 (0x0d) */ |
05acb863 | 4448 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 4449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 4450 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
e9edcee0 | 4451 | /* CLFE Pin: output 2 (0x0e) */ |
05acb863 | 4452 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 4453 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 4454 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
e9edcee0 | 4455 | /* Side Pin: output 3 (0x0f) */ |
05acb863 | 4456 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 4457 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 4458 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
e9edcee0 | 4459 | /* Mic (rear) pin: input vref at 80% */ |
16ded525 | 4460 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
4461 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4462 | /* Front Mic pin: input vref at 80% */ | |
16ded525 | 4463 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
4464 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4465 | /* Line In pin: input */ | |
05acb863 | 4466 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
4467 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4468 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
4469 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4470 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4471 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1da177e4 | 4472 | /* CD pin widget for input */ |
05acb863 | 4473 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 LT |
4474 | |
4475 | /* FIXME: use matrix-type input source selection */ | |
4476 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
4477 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
05acb863 TI |
4478 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4479 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4480 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4481 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 4482 | /* Input mixer2 */ |
05acb863 TI |
4483 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4484 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4485 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4486 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 4487 | /* Input mixer3 */ |
05acb863 TI |
4488 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4489 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4490 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4491 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
4492 | /* ADC1: mute amp left and right */ | |
4493 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 4494 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
4495 | /* ADC2: mute amp left and right */ |
4496 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 4497 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
4498 | /* ADC3: mute amp left and right */ |
4499 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 4500 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 LT |
4501 | |
4502 | { } | |
4503 | }; | |
4504 | ||
4b146cb0 TI |
4505 | static struct hda_verb alc882_eapd_verbs[] = { |
4506 | /* change to EAPD mode */ | |
4507 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
b373bdeb | 4508 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
4b146cb0 TI |
4509 | { } |
4510 | }; | |
4511 | ||
9102cd1c TD |
4512 | /* Mac Pro test */ |
4513 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
4514 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
4515 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
4516 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
4517 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
4518 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
4519 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
4520 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
4521 | { } /* end */ | |
4522 | }; | |
4523 | ||
4524 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
4525 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
4526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4529 | /* Front Pin: output 0 (0x0c) */ | |
4530 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4531 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4532 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4533 | /* Front Mic pin: input vref at 80% */ | |
4534 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
4535 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4536 | /* Speaker: output */ | |
4537 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4538 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4539 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
4540 | /* Headphone output (output 0 - 0x0c) */ | |
4541 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4542 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4543 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4544 | ||
4545 | /* FIXME: use matrix-type input source selection */ | |
4546 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
4547 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
4548 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4549 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4550 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4551 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
4552 | /* Input mixer2 */ | |
4553 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4554 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4555 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4556 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
4557 | /* Input mixer3 */ | |
4558 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4559 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4560 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4561 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
4562 | /* ADC1: mute amp left and right */ | |
4563 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4564 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4565 | /* ADC2: mute amp left and right */ | |
4566 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4567 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4568 | /* ADC3: mute amp left and right */ | |
4569 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4570 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4571 | ||
4572 | { } | |
4573 | }; | |
4574 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | |
4575 | { | |
4576 | unsigned int gpiostate, gpiomask, gpiodir; | |
4577 | ||
4578 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
4579 | AC_VERB_GET_GPIO_DATA, 0); | |
4580 | ||
4581 | if (!muted) | |
4582 | gpiostate |= (1 << pin); | |
4583 | else | |
4584 | gpiostate &= ~(1 << pin); | |
4585 | ||
4586 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
4587 | AC_VERB_GET_GPIO_MASK, 0); | |
4588 | gpiomask |= (1 << pin); | |
4589 | ||
4590 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
4591 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
4592 | gpiodir |= (1 << pin); | |
4593 | ||
4594 | ||
4595 | snd_hda_codec_write(codec, codec->afg, 0, | |
4596 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
4597 | snd_hda_codec_write(codec, codec->afg, 0, | |
4598 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
4599 | ||
4600 | msleep(1); | |
4601 | ||
4602 | snd_hda_codec_write(codec, codec->afg, 0, | |
4603 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
4604 | } | |
4605 | ||
df694daa KY |
4606 | /* |
4607 | * generic initialization of ADC, input mixers and output mixers | |
4608 | */ | |
4609 | static struct hda_verb alc882_auto_init_verbs[] = { | |
4610 | /* | |
4611 | * Unmute ADC0-2 and set the default input to mic-in | |
4612 | */ | |
4613 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4614 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4615 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4616 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4617 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4618 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1da177e4 | 4619 | |
df694daa KY |
4620 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
4621 | * mixer widget | |
4622 | * Note: PASD motherboards uses the Line In 2 as the input for front panel | |
4623 | * mic (mic 2) | |
4624 | */ | |
4625 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
4626 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4627 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4628 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
4629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
4630 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
e9edcee0 | 4631 | |
df694daa KY |
4632 | /* |
4633 | * Set up output mixers (0x0c - 0x0f) | |
4634 | */ | |
4635 | /* set vol=0 to output mixers */ | |
4636 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4637 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4638 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4639 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4640 | /* set up input amps for analog loopback */ | |
4641 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
4642 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4643 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4644 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4645 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4646 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4647 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4648 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4649 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4650 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4651 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4652 | ||
4653 | /* FIXME: use matrix-type input source selection */ | |
4654 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
4655 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
4656 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4657 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
4658 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
4659 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
4660 | /* Input mixer2 */ | |
4661 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4662 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
4663 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
4664 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
4665 | /* Input mixer3 */ | |
4666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
4668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
4669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
4670 | ||
4671 | { } | |
4672 | }; | |
4673 | ||
4674 | /* capture mixer elements */ | |
4675 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { | |
4676 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
4677 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
4678 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
4679 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
4680 | { | |
4681 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4682 | /* The multiple "Capture Source" controls confuse alsamixer | |
4683 | * So call somewhat different.. | |
4684 | * FIXME: the controls appear in the "playback" view! | |
4685 | */ | |
4686 | /* .name = "Capture Source", */ | |
4687 | .name = "Input Source", | |
4688 | .count = 2, | |
4689 | .info = alc882_mux_enum_info, | |
4690 | .get = alc882_mux_enum_get, | |
4691 | .put = alc882_mux_enum_put, | |
4692 | }, | |
4693 | { } /* end */ | |
4694 | }; | |
4695 | ||
4696 | static struct snd_kcontrol_new alc882_capture_mixer[] = { | |
4697 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
4698 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
4699 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), | |
4700 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), | |
4701 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), | |
4702 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), | |
4703 | { | |
4704 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4705 | /* The multiple "Capture Source" controls confuse alsamixer | |
4706 | * So call somewhat different.. | |
4707 | * FIXME: the controls appear in the "playback" view! | |
4708 | */ | |
4709 | /* .name = "Capture Source", */ | |
4710 | .name = "Input Source", | |
4711 | .count = 3, | |
4712 | .info = alc882_mux_enum_info, | |
4713 | .get = alc882_mux_enum_get, | |
4714 | .put = alc882_mux_enum_put, | |
4715 | }, | |
4716 | { } /* end */ | |
4717 | }; | |
4718 | ||
4719 | /* pcm configuration: identiacal with ALC880 */ | |
4720 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | |
4721 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
4722 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
4723 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
4724 | ||
4725 | /* | |
4726 | * configuration and preset | |
4727 | */ | |
f5fcc13c TI |
4728 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
4729 | [ALC882_3ST_DIG] = "3stack-dig", | |
4730 | [ALC882_6ST_DIG] = "6stack-dig", | |
4731 | [ALC882_ARIMA] = "arima", | |
9102cd1c | 4732 | [ALC885_MACPRO] = "macpro", |
f5fcc13c TI |
4733 | [ALC882_AUTO] = "auto", |
4734 | }; | |
4735 | ||
4736 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | |
4737 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
4738 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), | |
4739 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | |
4740 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), | |
7b9470d8 | 4741 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
df694daa KY |
4742 | {} |
4743 | }; | |
4744 | ||
4745 | static struct alc_config_preset alc882_presets[] = { | |
4746 | [ALC882_3ST_DIG] = { | |
4747 | .mixers = { alc882_base_mixer }, | |
4748 | .init_verbs = { alc882_init_verbs }, | |
4749 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
4750 | .dac_nids = alc882_dac_nids, | |
4751 | .dig_out_nid = ALC882_DIGOUT_NID, | |
df694daa KY |
4752 | .dig_in_nid = ALC882_DIGIN_NID, |
4753 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
4754 | .channel_mode = alc882_ch_modes, | |
4e195a7b | 4755 | .need_dac_fix = 1, |
df694daa KY |
4756 | .input_mux = &alc882_capture_source, |
4757 | }, | |
4758 | [ALC882_6ST_DIG] = { | |
4759 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
4760 | .init_verbs = { alc882_init_verbs }, | |
4761 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
4762 | .dac_nids = alc882_dac_nids, | |
4763 | .dig_out_nid = ALC882_DIGOUT_NID, | |
df694daa KY |
4764 | .dig_in_nid = ALC882_DIGIN_NID, |
4765 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
4766 | .channel_mode = alc882_sixstack_modes, | |
4767 | .input_mux = &alc882_capture_source, | |
4768 | }, | |
4b146cb0 TI |
4769 | [ALC882_ARIMA] = { |
4770 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
4771 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, | |
4772 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
4773 | .dac_nids = alc882_dac_nids, | |
4774 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
4775 | .channel_mode = alc882_sixstack_modes, | |
4776 | .input_mux = &alc882_capture_source, | |
4777 | }, | |
9102cd1c TD |
4778 | [ALC885_MACPRO] = { |
4779 | .mixers = { alc882_macpro_mixer }, | |
4780 | .init_verbs = { alc882_macpro_init_verbs }, | |
4781 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
4782 | .dac_nids = alc882_dac_nids, | |
4783 | .dig_out_nid = ALC882_DIGOUT_NID, | |
4784 | .dig_in_nid = ALC882_DIGIN_NID, | |
4785 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
4786 | .channel_mode = alc882_ch_modes, | |
4787 | .input_mux = &alc882_capture_source, | |
4788 | }, | |
df694daa KY |
4789 | }; |
4790 | ||
4791 | ||
4792 | /* | |
4793 | * BIOS auto configuration | |
4794 | */ | |
4795 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |
4796 | hda_nid_t nid, int pin_type, | |
4797 | int dac_idx) | |
4798 | { | |
4799 | /* set as output */ | |
4800 | struct alc_spec *spec = codec->spec; | |
4801 | int idx; | |
4802 | ||
4803 | if (spec->multiout.dac_nids[dac_idx] == 0x25) | |
4804 | idx = 4; | |
4805 | else | |
4806 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
4807 | ||
4808 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | |
4809 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | |
4810 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
4811 | ||
4812 | } | |
4813 | ||
4814 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | |
4815 | { | |
4816 | struct alc_spec *spec = codec->spec; | |
4817 | int i; | |
4818 | ||
4819 | for (i = 0; i <= HDA_SIDE; i++) { | |
4820 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
4821 | if (nid) | |
4822 | alc882_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); | |
4823 | } | |
4824 | } | |
4825 | ||
4826 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | |
4827 | { | |
4828 | struct alc_spec *spec = codec->spec; | |
4829 | hda_nid_t pin; | |
4830 | ||
eb06ed8f | 4831 | pin = spec->autocfg.hp_pins[0]; |
df694daa KY |
4832 | if (pin) /* connect to front */ |
4833 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); /* use dac 0 */ | |
4834 | } | |
4835 | ||
4836 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) | |
4837 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID | |
4838 | ||
4839 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | |
4840 | { | |
4841 | struct alc_spec *spec = codec->spec; | |
4842 | int i; | |
4843 | ||
4844 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
4845 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
4846 | if (alc882_is_input_pin(nid)) { | |
4847 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4848 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); | |
4849 | if (nid != ALC882_PIN_CD_NID) | |
4850 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
4851 | AMP_OUT_MUTE); | |
4852 | } | |
4853 | } | |
4854 | } | |
4855 | ||
4856 | /* almost identical with ALC880 parser... */ | |
4857 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
4858 | { | |
4859 | struct alc_spec *spec = codec->spec; | |
4860 | int err = alc880_parse_auto_config(codec); | |
4861 | ||
4862 | if (err < 0) | |
4863 | return err; | |
c5f2ea08 TI |
4864 | else if (err > 0) |
4865 | /* hack - override the init verbs */ | |
4866 | spec->init_verbs[0] = alc882_auto_init_verbs; | |
4867 | return err; | |
df694daa KY |
4868 | } |
4869 | ||
ae6b813a TI |
4870 | /* additional initialization for auto-configuration model */ |
4871 | static void alc882_auto_init(struct hda_codec *codec) | |
df694daa | 4872 | { |
df694daa KY |
4873 | alc882_auto_init_multi_out(codec); |
4874 | alc882_auto_init_hp_out(codec); | |
4875 | alc882_auto_init_analog_input(codec); | |
df694daa KY |
4876 | } |
4877 | ||
df694daa KY |
4878 | static int patch_alc882(struct hda_codec *codec) |
4879 | { | |
4880 | struct alc_spec *spec; | |
4881 | int err, board_config; | |
4882 | ||
4883 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
4884 | if (spec == NULL) | |
4885 | return -ENOMEM; | |
4886 | ||
4887 | codec->spec = spec; | |
4888 | ||
f5fcc13c TI |
4889 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
4890 | alc882_models, | |
4891 | alc882_cfg_tbl); | |
df694daa KY |
4892 | |
4893 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
9c7f852e TI |
4894 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
4895 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
4896 | board_config = ALC882_AUTO; |
4897 | } | |
4898 | ||
4899 | if (board_config == ALC882_AUTO) { | |
4900 | /* automatic parse from the BIOS config */ | |
4901 | err = alc882_parse_auto_config(codec); | |
4902 | if (err < 0) { | |
4903 | alc_free(codec); | |
4904 | return err; | |
4905 | } else if (! err) { | |
9c7f852e TI |
4906 | printk(KERN_INFO |
4907 | "hda_codec: Cannot set up configuration " | |
4908 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
4909 | board_config = ALC882_3ST_DIG; |
4910 | } | |
4911 | } | |
4912 | ||
4913 | if (board_config != ALC882_AUTO) | |
4914 | setup_preset(spec, &alc882_presets[board_config]); | |
1da177e4 | 4915 | |
9102cd1c TD |
4916 | if (board_config == ALC885_MACPRO) { |
4917 | alc882_gpio_mute(codec, 0, 0); | |
4918 | alc882_gpio_mute(codec, 1, 0); | |
4919 | } | |
4920 | ||
1da177e4 | 4921 | spec->stream_name_analog = "ALC882 Analog"; |
df694daa KY |
4922 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
4923 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
1da177e4 LT |
4924 | |
4925 | spec->stream_name_digital = "ALC882 Digital"; | |
df694daa KY |
4926 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
4927 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
1da177e4 | 4928 | |
df694daa KY |
4929 | if (! spec->adc_nids && spec->input_mux) { |
4930 | /* check whether NID 0x07 is valid */ | |
4a471b7d | 4931 | unsigned int wcap = get_wcaps(codec, 0x07); |
df694daa KY |
4932 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
4933 | if (wcap != AC_WID_AUD_IN) { | |
4934 | spec->adc_nids = alc882_adc_nids_alt; | |
4935 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); | |
4936 | spec->mixers[spec->num_mixers] = alc882_capture_alt_mixer; | |
4937 | spec->num_mixers++; | |
4938 | } else { | |
4939 | spec->adc_nids = alc882_adc_nids; | |
4940 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); | |
4941 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; | |
4942 | spec->num_mixers++; | |
4943 | } | |
4944 | } | |
1da177e4 LT |
4945 | |
4946 | codec->patch_ops = alc_patch_ops; | |
df694daa | 4947 | if (board_config == ALC882_AUTO) |
ae6b813a | 4948 | spec->init_hook = alc882_auto_init; |
df694daa KY |
4949 | |
4950 | return 0; | |
4951 | } | |
4952 | ||
4953 | /* | |
9c7f852e TI |
4954 | * ALC883 support |
4955 | * | |
4956 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible | |
4957 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
4958 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
4959 | * 6-channel independent captures. | |
4960 | * | |
4961 | * In addition, an independent DAC for the multi-playback (not used in this | |
4962 | * driver yet). | |
df694daa | 4963 | */ |
9c7f852e TI |
4964 | #define ALC883_DIGOUT_NID 0x06 |
4965 | #define ALC883_DIGIN_NID 0x0a | |
df694daa | 4966 | |
9c7f852e TI |
4967 | static hda_nid_t alc883_dac_nids[4] = { |
4968 | /* front, rear, clfe, rear_surr */ | |
4969 | 0x02, 0x04, 0x03, 0x05 | |
4970 | }; | |
df694daa | 4971 | |
9c7f852e TI |
4972 | static hda_nid_t alc883_adc_nids[2] = { |
4973 | /* ADC1-2 */ | |
4974 | 0x08, 0x09, | |
4975 | }; | |
4976 | /* input MUX */ | |
4977 | /* FIXME: should be a matrix-type input source selection */ | |
df694daa | 4978 | |
9c7f852e TI |
4979 | static struct hda_input_mux alc883_capture_source = { |
4980 | .num_items = 4, | |
4981 | .items = { | |
4982 | { "Mic", 0x0 }, | |
4983 | { "Front Mic", 0x1 }, | |
4984 | { "Line", 0x2 }, | |
4985 | { "CD", 0x4 }, | |
4986 | }, | |
4987 | }; | |
4988 | #define alc883_mux_enum_info alc_mux_enum_info | |
4989 | #define alc883_mux_enum_get alc_mux_enum_get | |
df694daa | 4990 | |
9c7f852e TI |
4991 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
4992 | struct snd_ctl_elem_value *ucontrol) | |
4993 | { | |
4994 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4995 | struct alc_spec *spec = codec->spec; | |
4996 | const struct hda_input_mux *imux = spec->input_mux; | |
4997 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
4998 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; | |
4999 | hda_nid_t nid = capture_mixers[adc_idx]; | |
5000 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
5001 | unsigned int i, idx; | |
5002 | ||
5003 | idx = ucontrol->value.enumerated.item[0]; | |
5004 | if (idx >= imux->num_items) | |
5005 | idx = imux->num_items - 1; | |
5006 | if (*cur_val == idx && ! codec->in_resume) | |
5007 | return 0; | |
5008 | for (i = 0; i < imux->num_items; i++) { | |
5009 | unsigned int v = (i == idx) ? 0x7000 : 0x7080; | |
5010 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
5011 | v | (imux->items[i].index << 8)); | |
5012 | } | |
5013 | *cur_val = idx; | |
5014 | return 1; | |
5015 | } | |
5016 | /* | |
5017 | * 2ch mode | |
5018 | */ | |
5019 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
5020 | { 2, NULL } | |
5021 | }; | |
5022 | ||
5023 | /* | |
5024 | * 2ch mode | |
5025 | */ | |
5026 | static struct hda_verb alc883_3ST_ch2_init[] = { | |
5027 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
5028 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
5029 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
5030 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
5031 | { } /* end */ | |
5032 | }; | |
5033 | ||
5034 | /* | |
5035 | * 6ch mode | |
5036 | */ | |
5037 | static struct hda_verb alc883_3ST_ch6_init[] = { | |
5038 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5039 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
5040 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
5041 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5042 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
5043 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
5044 | { } /* end */ | |
5045 | }; | |
5046 | ||
5047 | static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { | |
5048 | { 2, alc883_3ST_ch2_init }, | |
5049 | { 6, alc883_3ST_ch6_init }, | |
5050 | }; | |
5051 | ||
5052 | /* | |
5053 | * 6ch mode | |
5054 | */ | |
5055 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
5056 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
5057 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5058 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5059 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5060 | { } /* end */ | |
5061 | }; | |
5062 | ||
5063 | /* | |
5064 | * 8ch mode | |
5065 | */ | |
5066 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
5067 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5068 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5069 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5070 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5071 | { } /* end */ | |
5072 | }; | |
5073 | ||
5074 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
5075 | { 6, alc883_sixstack_ch6_init }, | |
5076 | { 8, alc883_sixstack_ch8_init }, | |
5077 | }; | |
5078 | ||
b373bdeb AN |
5079 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
5080 | /* eanable EAPD on medion laptop */ | |
5081 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
5082 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
5083 | { } | |
5084 | }; | |
5085 | ||
9c7f852e TI |
5086 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
5087 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
5088 | */ | |
5089 | ||
5090 | static struct snd_kcontrol_new alc883_base_mixer[] = { | |
df694daa | 5091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9c7f852e TI |
5092 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
5093 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
5094 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
5095 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
5096 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
5097 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
5098 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
5099 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
5100 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
5101 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
df694daa KY |
5102 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
5103 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5104 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5105 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5106 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5107 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9c7f852e TI |
5108 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
5109 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
5110 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5111 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5112 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
5113 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
5114 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
5115 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
5116 | { | |
5117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5118 | /* .name = "Capture Source", */ | |
5119 | .name = "Input Source", | |
5120 | .count = 2, | |
5121 | .info = alc883_mux_enum_info, | |
5122 | .get = alc883_mux_enum_get, | |
5123 | .put = alc883_mux_enum_put, | |
5124 | }, | |
df694daa | 5125 | { } /* end */ |
834be88d TI |
5126 | }; |
5127 | ||
9c7f852e TI |
5128 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
5129 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5130 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5131 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5132 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5133 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5134 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5135 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5138 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
5139 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
5140 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5141 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5142 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
5143 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
5144 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
5145 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
5146 | { | |
5147 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5148 | /* .name = "Capture Source", */ | |
5149 | .name = "Input Source", | |
5150 | .count = 2, | |
5151 | .info = alc883_mux_enum_info, | |
5152 | .get = alc883_mux_enum_get, | |
5153 | .put = alc883_mux_enum_put, | |
5154 | }, | |
5155 | { } /* end */ | |
5156 | }; | |
df694daa | 5157 | |
9c7f852e TI |
5158 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
5159 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5160 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5161 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
5162 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
5163 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
5164 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
5165 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
5166 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
5167 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5168 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5169 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5170 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5171 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5172 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5173 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5174 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
5175 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
5176 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5177 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5178 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
5179 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
5180 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
5181 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
5182 | { | |
5183 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5184 | /* .name = "Capture Source", */ | |
5185 | .name = "Input Source", | |
5186 | .count = 2, | |
5187 | .info = alc883_mux_enum_info, | |
5188 | .get = alc883_mux_enum_get, | |
5189 | .put = alc883_mux_enum_put, | |
5190 | }, | |
5191 | { } /* end */ | |
5192 | }; | |
5193 | ||
d1d985f0 | 5194 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
c07584c8 TD |
5195 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
5196 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
5197 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
5198 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5199 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
5200 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
5201 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), | |
5202 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
5203 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5204 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5205 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5206 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5207 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5208 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5209 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5210 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
5211 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
5212 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5213 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5214 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
5215 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
5216 | ||
5217 | { | |
5218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5219 | /* .name = "Capture Source", */ | |
5220 | .name = "Input Source", | |
5221 | .count = 1, | |
5222 | .info = alc883_mux_enum_info, | |
5223 | .get = alc883_mux_enum_get, | |
5224 | .put = alc883_mux_enum_put, | |
5225 | }, | |
5226 | { } /* end */ | |
5227 | }; | |
5228 | ||
ccc656ce KY |
5229 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
5230 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5231 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
5232 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5233 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
5234 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
5235 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
5236 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
5237 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
5238 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
5239 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5240 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5241 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5242 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5245 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
5246 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
5247 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
5248 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
5249 | { | |
5250 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5251 | /* .name = "Capture Source", */ | |
5252 | .name = "Input Source", | |
5253 | .count = 2, | |
5254 | .info = alc883_mux_enum_info, | |
5255 | .get = alc883_mux_enum_get, | |
5256 | .put = alc883_mux_enum_put, | |
5257 | }, | |
5258 | { } /* end */ | |
5259 | }; | |
5260 | ||
5261 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { | |
5262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5263 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
5264 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5265 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5266 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5267 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5268 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5269 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
5270 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
5271 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
5272 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
5273 | { | |
5274 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5275 | /* .name = "Capture Source", */ | |
5276 | .name = "Input Source", | |
5277 | .count = 2, | |
5278 | .info = alc883_mux_enum_info, | |
5279 | .get = alc883_mux_enum_get, | |
5280 | .put = alc883_mux_enum_put, | |
5281 | }, | |
5282 | { } /* end */ | |
5283 | }; | |
5284 | ||
9c7f852e TI |
5285 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
5286 | { | |
5287 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5288 | .name = "Channel Mode", | |
5289 | .info = alc_ch_mode_info, | |
5290 | .get = alc_ch_mode_get, | |
5291 | .put = alc_ch_mode_put, | |
5292 | }, | |
5293 | { } /* end */ | |
5294 | }; | |
5295 | ||
5296 | static struct hda_verb alc883_init_verbs[] = { | |
5297 | /* ADC1: mute amp left and right */ | |
5298 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
df694daa | 5299 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9c7f852e TI |
5300 | /* ADC2: mute amp left and right */ |
5301 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
df694daa | 5302 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9c7f852e TI |
5303 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
5304 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5307 | /* Rear mixer */ | |
5308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5311 | /* CLFE mixer */ | |
5312 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5313 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5314 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5315 | /* Side mixer */ | |
5316 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5317 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5318 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
df694daa | 5319 | |
df694daa KY |
5320 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5321 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5322 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
5323 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
5324 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
5325 | ||
9c7f852e TI |
5326 | /* Front Pin: output 0 (0x0c) */ |
5327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5328 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5329 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5330 | /* Rear Pin: output 1 (0x0d) */ | |
5331 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5332 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5333 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
5334 | /* CLFE Pin: output 2 (0x0e) */ | |
5335 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5336 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5337 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5338 | /* Side Pin: output 3 (0x0f) */ | |
5339 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5340 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5341 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
5342 | /* Mic (rear) pin: input vref at 80% */ | |
5343 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5344 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5345 | /* Front Mic pin: input vref at 80% */ | |
5346 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5347 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5348 | /* Line In pin: input */ | |
5349 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5350 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5351 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
5352 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5353 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5354 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5355 | /* CD pin widget for input */ | |
5356 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5357 | ||
5358 | /* FIXME: use matrix-type input source selection */ | |
5359 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5360 | /* Input mixer2 */ | |
5361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
5364 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
5365 | /* Input mixer3 */ | |
5366 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5368 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
5369 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
5370 | { } | |
5371 | }; | |
5372 | ||
ccc656ce KY |
5373 | static struct hda_verb alc883_tagra_verbs[] = { |
5374 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5375 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5376 | ||
5377 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5378 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5379 | ||
5380 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
5381 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
5382 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
5383 | ||
5384 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
5385 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
5386 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
5387 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
5388 | ||
5389 | { } /* end */ | |
5390 | }; | |
5391 | ||
5392 | /* toggle speaker-output according to the hp-jack state */ | |
5393 | static void alc883_tagra_automute(struct hda_codec *codec) | |
5394 | { | |
5395 | unsigned int present; | |
5396 | ||
5397 | present = snd_hda_codec_read(codec, 0x14, 0, | |
5398 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
5399 | snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, | |
5400 | 0x80, present ? 0x80 : 0); | |
5401 | snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, | |
5402 | 0x80, present ? 0x80 : 0); | |
5403 | snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3); | |
5404 | } | |
5405 | ||
5406 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) | |
5407 | { | |
5408 | if ((res >> 26) == ALC880_HP_EVENT) | |
5409 | alc883_tagra_automute(codec); | |
5410 | } | |
5411 | ||
9c7f852e TI |
5412 | /* |
5413 | * generic initialization of ADC, input mixers and output mixers | |
5414 | */ | |
5415 | static struct hda_verb alc883_auto_init_verbs[] = { | |
5416 | /* | |
5417 | * Unmute ADC0-2 and set the default input to mic-in | |
5418 | */ | |
5419 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5420 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5421 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5422 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5423 | ||
5424 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
5425 | * mixer widget | |
5426 | * Note: PASD motherboards uses the Line In 2 as the input for front panel | |
5427 | * mic (mic 2) | |
5428 | */ | |
5429 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
5430 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5431 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5432 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
5433 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
5434 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
5435 | ||
5436 | /* | |
5437 | * Set up output mixers (0x0c - 0x0f) | |
5438 | */ | |
5439 | /* set vol=0 to output mixers */ | |
5440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5441 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5442 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5443 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5444 | /* set up input amps for analog loopback */ | |
5445 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
5446 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5447 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5448 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5449 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5450 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5451 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5452 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5453 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5454 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5455 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5456 | ||
5457 | /* FIXME: use matrix-type input source selection */ | |
5458 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5459 | /* Input mixer1 */ | |
5460 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5461 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5462 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
5463 | //{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
5464 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
5465 | /* Input mixer2 */ | |
5466 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5467 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5468 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
5469 | //{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
5470 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
5471 | ||
5472 | { } | |
5473 | }; | |
5474 | ||
5475 | /* capture mixer elements */ | |
5476 | static struct snd_kcontrol_new alc883_capture_mixer[] = { | |
5477 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
5478 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
5479 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
5480 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
5481 | { | |
5482 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5483 | /* The multiple "Capture Source" controls confuse alsamixer | |
5484 | * So call somewhat different.. | |
5485 | * FIXME: the controls appear in the "playback" view! | |
5486 | */ | |
5487 | /* .name = "Capture Source", */ | |
5488 | .name = "Input Source", | |
5489 | .count = 2, | |
5490 | .info = alc882_mux_enum_info, | |
5491 | .get = alc882_mux_enum_get, | |
5492 | .put = alc882_mux_enum_put, | |
5493 | }, | |
5494 | { } /* end */ | |
5495 | }; | |
5496 | ||
5497 | /* pcm configuration: identiacal with ALC880 */ | |
5498 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback | |
5499 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture | |
5500 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback | |
5501 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture | |
5502 | ||
5503 | /* | |
5504 | * configuration and preset | |
5505 | */ | |
f5fcc13c TI |
5506 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
5507 | [ALC883_3ST_2ch_DIG] = "3stack-dig", | |
5508 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | |
5509 | [ALC883_3ST_6ch] = "3stack-6ch", | |
5510 | [ALC883_6ST_DIG] = "6stack-dig", | |
5511 | [ALC883_TARGA_DIG] = "targa-dig", | |
5512 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
5513 | [ALC888_DEMO_BOARD] = "6stack-dig-demo", | |
5514 | [ALC883_ACER] = "acer", | |
5515 | [ALC883_MEDION] = "medion", | |
5516 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | |
5517 | [ALC883_AUTO] = "auto", | |
5518 | }; | |
5519 | ||
5520 | static struct snd_pci_quirk alc883_cfg_tbl[] = { | |
5521 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), | |
5522 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | |
5523 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), | |
5524 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), | |
5525 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | |
5526 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
5527 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | |
5528 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), | |
5529 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | |
5530 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | |
5531 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), | |
5532 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
5533 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | |
5534 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
5535 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
5536 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | |
5537 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), | |
5538 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | |
5539 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
5540 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), | |
9c7f852e TI |
5541 | {} |
5542 | }; | |
5543 | ||
5544 | static struct alc_config_preset alc883_presets[] = { | |
5545 | [ALC883_3ST_2ch_DIG] = { | |
5546 | .mixers = { alc883_3ST_2ch_mixer }, | |
5547 | .init_verbs = { alc883_init_verbs }, | |
5548 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5549 | .dac_nids = alc883_dac_nids, | |
5550 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5551 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5552 | .adc_nids = alc883_adc_nids, | |
5553 | .dig_in_nid = ALC883_DIGIN_NID, | |
5554 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
5555 | .channel_mode = alc883_3ST_2ch_modes, | |
5556 | .input_mux = &alc883_capture_source, | |
5557 | }, | |
5558 | [ALC883_3ST_6ch_DIG] = { | |
5559 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
5560 | .init_verbs = { alc883_init_verbs }, | |
5561 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5562 | .dac_nids = alc883_dac_nids, | |
5563 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5564 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5565 | .adc_nids = alc883_adc_nids, | |
5566 | .dig_in_nid = ALC883_DIGIN_NID, | |
5567 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
5568 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 5569 | .need_dac_fix = 1, |
9c7f852e TI |
5570 | .input_mux = &alc883_capture_source, |
5571 | }, | |
5572 | [ALC883_3ST_6ch] = { | |
5573 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
5574 | .init_verbs = { alc883_init_verbs }, | |
5575 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5576 | .dac_nids = alc883_dac_nids, | |
5577 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5578 | .adc_nids = alc883_adc_nids, | |
5579 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
5580 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 5581 | .need_dac_fix = 1, |
9c7f852e TI |
5582 | .input_mux = &alc883_capture_source, |
5583 | }, | |
5584 | [ALC883_6ST_DIG] = { | |
5585 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
5586 | .init_verbs = { alc883_init_verbs }, | |
5587 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5588 | .dac_nids = alc883_dac_nids, | |
5589 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5590 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5591 | .adc_nids = alc883_adc_nids, | |
5592 | .dig_in_nid = ALC883_DIGIN_NID, | |
5593 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
5594 | .channel_mode = alc883_sixstack_modes, | |
5595 | .input_mux = &alc883_capture_source, | |
5596 | }, | |
ccc656ce KY |
5597 | [ALC883_TARGA_DIG] = { |
5598 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, | |
5599 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, | |
5600 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5601 | .dac_nids = alc883_dac_nids, | |
5602 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5603 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5604 | .adc_nids = alc883_adc_nids, | |
5605 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
5606 | .channel_mode = alc883_3ST_6ch_modes, | |
5607 | .need_dac_fix = 1, | |
5608 | .input_mux = &alc883_capture_source, | |
5609 | .unsol_event = alc883_tagra_unsol_event, | |
5610 | .init_hook = alc883_tagra_automute, | |
5611 | }, | |
5612 | [ALC883_TARGA_2ch_DIG] = { | |
5613 | .mixers = { alc883_tagra_2ch_mixer}, | |
5614 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, | |
5615 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5616 | .dac_nids = alc883_dac_nids, | |
5617 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5618 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5619 | .adc_nids = alc883_adc_nids, | |
5620 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
5621 | .channel_mode = alc883_3ST_2ch_modes, | |
5622 | .input_mux = &alc883_capture_source, | |
5623 | .unsol_event = alc883_tagra_unsol_event, | |
5624 | .init_hook = alc883_tagra_automute, | |
5625 | }, | |
9c7f852e TI |
5626 | [ALC888_DEMO_BOARD] = { |
5627 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
5628 | .init_verbs = { alc883_init_verbs }, | |
5629 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5630 | .dac_nids = alc883_dac_nids, | |
5631 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5632 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5633 | .adc_nids = alc883_adc_nids, | |
5634 | .dig_in_nid = ALC883_DIGIN_NID, | |
5635 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
5636 | .channel_mode = alc883_sixstack_modes, | |
5637 | .input_mux = &alc883_capture_source, | |
5638 | }, | |
bab282b9 VA |
5639 | [ALC883_ACER] = { |
5640 | .mixers = { alc883_base_mixer, | |
5641 | alc883_chmode_mixer }, | |
5642 | /* On TravelMate laptops, GPIO 0 enables the internal speaker | |
5643 | * and the headphone jack. Turn this on and rely on the | |
5644 | * standard mute methods whenever the user wants to turn | |
5645 | * these outputs off. | |
5646 | */ | |
5647 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
5648 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5649 | .dac_nids = alc883_dac_nids, | |
5650 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5651 | .adc_nids = alc883_adc_nids, | |
5652 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
5653 | .channel_mode = alc883_3ST_2ch_modes, | |
5654 | .input_mux = &alc883_capture_source, | |
5655 | }, | |
c07584c8 TD |
5656 | [ALC883_MEDION] = { |
5657 | .mixers = { alc883_fivestack_mixer, | |
5658 | alc883_chmode_mixer }, | |
5659 | .init_verbs = { alc883_init_verbs, | |
b373bdeb | 5660 | alc883_medion_eapd_verbs }, |
c07584c8 TD |
5661 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
5662 | .dac_nids = alc883_dac_nids, | |
5663 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5664 | .adc_nids = alc883_adc_nids, | |
5665 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
5666 | .channel_mode = alc883_sixstack_modes, | |
5667 | .input_mux = &alc883_capture_source, | |
b373bdeb AN |
5668 | }, |
5669 | [ALC883_LAPTOP_EAPD] = { | |
5670 | .mixers = { alc883_base_mixer, | |
5671 | alc883_chmode_mixer }, | |
5672 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | |
5673 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
5674 | .dac_nids = alc883_dac_nids, | |
5675 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
5676 | .adc_nids = alc883_adc_nids, | |
5677 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
5678 | .channel_mode = alc883_3ST_2ch_modes, | |
5679 | .input_mux = &alc883_capture_source, | |
5680 | }, | |
9c7f852e TI |
5681 | }; |
5682 | ||
5683 | ||
5684 | /* | |
5685 | * BIOS auto configuration | |
5686 | */ | |
5687 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | |
5688 | hda_nid_t nid, int pin_type, | |
5689 | int dac_idx) | |
5690 | { | |
5691 | /* set as output */ | |
5692 | struct alc_spec *spec = codec->spec; | |
5693 | int idx; | |
5694 | ||
5695 | if (spec->multiout.dac_nids[dac_idx] == 0x25) | |
5696 | idx = 4; | |
5697 | else | |
5698 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
5699 | ||
5700 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5701 | pin_type); | |
5702 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
5703 | AMP_OUT_UNMUTE); | |
5704 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
5705 | ||
5706 | } | |
5707 | ||
5708 | static void alc883_auto_init_multi_out(struct hda_codec *codec) | |
5709 | { | |
5710 | struct alc_spec *spec = codec->spec; | |
5711 | int i; | |
5712 | ||
5713 | for (i = 0; i <= HDA_SIDE; i++) { | |
5714 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
5715 | if (nid) | |
5716 | alc883_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); | |
5717 | } | |
5718 | } | |
5719 | ||
5720 | static void alc883_auto_init_hp_out(struct hda_codec *codec) | |
5721 | { | |
5722 | struct alc_spec *spec = codec->spec; | |
5723 | hda_nid_t pin; | |
5724 | ||
eb06ed8f | 5725 | pin = spec->autocfg.hp_pins[0]; |
9c7f852e TI |
5726 | if (pin) /* connect to front */ |
5727 | /* use dac 0 */ | |
5728 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
5729 | } | |
5730 | ||
5731 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) | |
5732 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID | |
5733 | ||
5734 | static void alc883_auto_init_analog_input(struct hda_codec *codec) | |
5735 | { | |
5736 | struct alc_spec *spec = codec->spec; | |
5737 | int i; | |
5738 | ||
5739 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
5740 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
5741 | if (alc883_is_input_pin(nid)) { | |
5742 | snd_hda_codec_write(codec, nid, 0, | |
5743 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5744 | (i <= AUTO_PIN_FRONT_MIC ? | |
5745 | PIN_VREF80 : PIN_IN)); | |
5746 | if (nid != ALC883_PIN_CD_NID) | |
5747 | snd_hda_codec_write(codec, nid, 0, | |
5748 | AC_VERB_SET_AMP_GAIN_MUTE, | |
5749 | AMP_OUT_MUTE); | |
5750 | } | |
5751 | } | |
5752 | } | |
5753 | ||
5754 | /* almost identical with ALC880 parser... */ | |
5755 | static int alc883_parse_auto_config(struct hda_codec *codec) | |
5756 | { | |
5757 | struct alc_spec *spec = codec->spec; | |
5758 | int err = alc880_parse_auto_config(codec); | |
5759 | ||
5760 | if (err < 0) | |
5761 | return err; | |
5762 | else if (err > 0) | |
5763 | /* hack - override the init verbs */ | |
5764 | spec->init_verbs[0] = alc883_auto_init_verbs; | |
5765 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; | |
5766 | spec->num_mixers++; | |
5767 | return err; | |
5768 | } | |
5769 | ||
5770 | /* additional initialization for auto-configuration model */ | |
5771 | static void alc883_auto_init(struct hda_codec *codec) | |
5772 | { | |
5773 | alc883_auto_init_multi_out(codec); | |
5774 | alc883_auto_init_hp_out(codec); | |
5775 | alc883_auto_init_analog_input(codec); | |
5776 | } | |
5777 | ||
5778 | static int patch_alc883(struct hda_codec *codec) | |
5779 | { | |
5780 | struct alc_spec *spec; | |
5781 | int err, board_config; | |
5782 | ||
5783 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
5784 | if (spec == NULL) | |
5785 | return -ENOMEM; | |
5786 | ||
5787 | codec->spec = spec; | |
5788 | ||
f5fcc13c TI |
5789 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
5790 | alc883_models, | |
5791 | alc883_cfg_tbl); | |
5792 | if (board_config < 0) { | |
9c7f852e TI |
5793 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
5794 | "trying auto-probe from BIOS...\n"); | |
5795 | board_config = ALC883_AUTO; | |
5796 | } | |
5797 | ||
5798 | if (board_config == ALC883_AUTO) { | |
5799 | /* automatic parse from the BIOS config */ | |
5800 | err = alc883_parse_auto_config(codec); | |
5801 | if (err < 0) { | |
5802 | alc_free(codec); | |
5803 | return err; | |
5804 | } else if (! err) { | |
5805 | printk(KERN_INFO | |
5806 | "hda_codec: Cannot set up configuration " | |
5807 | "from BIOS. Using base mode...\n"); | |
5808 | board_config = ALC883_3ST_2ch_DIG; | |
5809 | } | |
5810 | } | |
5811 | ||
5812 | if (board_config != ALC883_AUTO) | |
5813 | setup_preset(spec, &alc883_presets[board_config]); | |
5814 | ||
5815 | spec->stream_name_analog = "ALC883 Analog"; | |
5816 | spec->stream_analog_playback = &alc883_pcm_analog_playback; | |
5817 | spec->stream_analog_capture = &alc883_pcm_analog_capture; | |
5818 | ||
5819 | spec->stream_name_digital = "ALC883 Digital"; | |
5820 | spec->stream_digital_playback = &alc883_pcm_digital_playback; | |
5821 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | |
5822 | ||
4b146cb0 TI |
5823 | if (! spec->adc_nids && spec->input_mux) { |
5824 | spec->adc_nids = alc883_adc_nids; | |
5825 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | |
5826 | } | |
9c7f852e TI |
5827 | |
5828 | codec->patch_ops = alc_patch_ops; | |
5829 | if (board_config == ALC883_AUTO) | |
5830 | spec->init_hook = alc883_auto_init; | |
5831 | ||
5832 | return 0; | |
5833 | } | |
5834 | ||
5835 | /* | |
5836 | * ALC262 support | |
5837 | */ | |
5838 | ||
5839 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
5840 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
5841 | ||
5842 | #define alc262_dac_nids alc260_dac_nids | |
5843 | #define alc262_adc_nids alc882_adc_nids | |
5844 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
5845 | ||
5846 | #define alc262_modes alc260_modes | |
5847 | #define alc262_capture_source alc882_capture_source | |
5848 | ||
5849 | static struct snd_kcontrol_new alc262_base_mixer[] = { | |
5850 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5851 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
5852 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5853 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5854 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5855 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5856 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5858 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
5859 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
5860 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5861 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ | |
5862 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), | |
5863 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5864 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
5865 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
5866 | { } /* end */ | |
5867 | }; | |
5868 | ||
ccc656ce KY |
5869 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
5870 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5871 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
5872 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5873 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5874 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5875 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5878 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
5879 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
5880 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5881 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ | |
5882 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ | |
5883 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5884 | { } /* end */ | |
5885 | }; | |
5886 | ||
9c7f852e TI |
5887 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
5888 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5889 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5890 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5891 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
5892 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
5893 | ||
5894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5896 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
5897 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
5898 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5899 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5900 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5901 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5902 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5903 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5904 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
5905 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
5906 | { } /* end */ | |
5907 | }; | |
5908 | ||
5909 | #define alc262_capture_mixer alc882_capture_mixer | |
5910 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
5911 | ||
5912 | /* | |
5913 | * generic initialization of ADC, input mixers and output mixers | |
5914 | */ | |
5915 | static struct hda_verb alc262_init_verbs[] = { | |
5916 | /* | |
5917 | * Unmute ADC0-2 and set the default input to mic-in | |
5918 | */ | |
5919 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5921 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5922 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5923 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5924 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5925 | ||
5926 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
5927 | * mixer widget | |
5928 | * Note: PASD motherboards uses the Line In 2 as the input for front panel | |
5929 | * mic (mic 2) | |
5930 | */ | |
5931 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
5932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
5935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
5936 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
5937 | ||
5938 | /* | |
df694daa KY |
5939 | * Set up output mixers (0x0c - 0x0e) |
5940 | */ | |
5941 | /* set vol=0 to output mixers */ | |
5942 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5943 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5944 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5945 | /* set up input amps for analog loopback */ | |
5946 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
5947 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5948 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5949 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5950 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5951 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5952 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5953 | ||
5954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5955 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
5956 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5957 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5958 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5959 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5960 | ||
5961 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5962 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5963 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5964 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5965 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5966 | ||
5967 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5968 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
5969 | ||
5970 | /* FIXME: use matrix-type input source selection */ | |
5971 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5972 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
5973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
5975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
5976 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
5977 | /* Input mixer2 */ | |
5978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
5980 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
5981 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
5982 | /* Input mixer3 */ | |
5983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
5985 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
5986 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
5987 | ||
5988 | { } | |
5989 | }; | |
1da177e4 | 5990 | |
ccc656ce KY |
5991 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
5992 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5994 | {} | |
5995 | }; | |
5996 | ||
5997 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | |
5998 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
5999 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6000 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6001 | ||
6002 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6003 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6004 | {} | |
6005 | }; | |
6006 | ||
6007 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
6008 | static void alc262_hippo_automute(struct hda_codec *codec, int force) | |
6009 | { | |
6010 | struct alc_spec *spec = codec->spec; | |
6011 | unsigned int mute; | |
6012 | ||
6013 | if (force || ! spec->sense_updated) { | |
6014 | unsigned int present; | |
6015 | /* need to execute and sync at first */ | |
6016 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); | |
6017 | present = snd_hda_codec_read(codec, 0x15, 0, | |
6018 | AC_VERB_GET_PIN_SENSE, 0); | |
6019 | spec->jack_present = (present & 0x80000000) != 0; | |
6020 | spec->sense_updated = 1; | |
6021 | } | |
6022 | if (spec->jack_present) { | |
6023 | /* mute internal speaker */ | |
6024 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
6025 | 0x80, 0x80); | |
6026 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
6027 | 0x80, 0x80); | |
6028 | } else { | |
6029 | /* unmute internal speaker if necessary */ | |
6030 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); | |
6031 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
6032 | 0x80, mute & 0x80); | |
6033 | mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0); | |
6034 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
6035 | 0x80, mute & 0x80); | |
6036 | } | |
6037 | } | |
6038 | ||
6039 | /* unsolicited event for HP jack sensing */ | |
6040 | static void alc262_hippo_unsol_event(struct hda_codec *codec, | |
6041 | unsigned int res) | |
6042 | { | |
6043 | if ((res >> 26) != ALC880_HP_EVENT) | |
6044 | return; | |
6045 | alc262_hippo_automute(codec, 1); | |
6046 | } | |
6047 | ||
6048 | static void alc262_hippo1_automute(struct hda_codec *codec, int force) | |
6049 | { | |
6050 | struct alc_spec *spec = codec->spec; | |
6051 | unsigned int mute; | |
6052 | ||
6053 | if (force || ! spec->sense_updated) { | |
6054 | unsigned int present; | |
6055 | /* need to execute and sync at first */ | |
6056 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
6057 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
6058 | AC_VERB_GET_PIN_SENSE, 0); | |
6059 | spec->jack_present = (present & 0x80000000) != 0; | |
6060 | spec->sense_updated = 1; | |
6061 | } | |
6062 | if (spec->jack_present) { | |
6063 | /* mute internal speaker */ | |
6064 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
6065 | 0x80, 0x80); | |
6066 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
6067 | 0x80, 0x80); | |
6068 | } else { | |
6069 | /* unmute internal speaker if necessary */ | |
6070 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
6071 | snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
6072 | 0x80, mute & 0x80); | |
6073 | mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0); | |
6074 | snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
6075 | 0x80, mute & 0x80); | |
6076 | } | |
6077 | } | |
6078 | ||
6079 | /* unsolicited event for HP jack sensing */ | |
6080 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, | |
6081 | unsigned int res) | |
6082 | { | |
6083 | if ((res >> 26) != ALC880_HP_EVENT) | |
6084 | return; | |
6085 | alc262_hippo1_automute(codec, 1); | |
6086 | } | |
6087 | ||
834be88d TI |
6088 | /* |
6089 | * fujitsu model | |
6090 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker | |
6091 | */ | |
6092 | ||
6093 | #define ALC_HP_EVENT 0x37 | |
6094 | ||
6095 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
6096 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
6097 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6098 | {} | |
6099 | }; | |
6100 | ||
6101 | static struct hda_input_mux alc262_fujitsu_capture_source = { | |
6102 | .num_items = 2, | |
6103 | .items = { | |
6104 | { "Mic", 0x0 }, | |
6105 | { "CD", 0x4 }, | |
6106 | }, | |
6107 | }; | |
6108 | ||
9c7f852e TI |
6109 | static struct hda_input_mux alc262_HP_capture_source = { |
6110 | .num_items = 5, | |
6111 | .items = { | |
6112 | { "Mic", 0x0 }, | |
6113 | { "Front Mic", 0x3 }, | |
6114 | { "Line", 0x2 }, | |
6115 | { "CD", 0x4 }, | |
6116 | { "AUX IN", 0x6 }, | |
6117 | }, | |
6118 | }; | |
6119 | ||
834be88d TI |
6120 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
6121 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) | |
6122 | { | |
6123 | struct alc_spec *spec = codec->spec; | |
6124 | unsigned int mute; | |
6125 | ||
6126 | if (force || ! spec->sense_updated) { | |
6127 | unsigned int present; | |
6128 | /* need to execute and sync at first */ | |
6129 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); | |
6130 | present = snd_hda_codec_read(codec, 0x14, 0, | |
6131 | AC_VERB_GET_PIN_SENSE, 0); | |
6132 | spec->jack_present = (present & 0x80000000) != 0; | |
6133 | spec->sense_updated = 1; | |
6134 | } | |
6135 | if (spec->jack_present) { | |
6136 | /* mute internal speaker */ | |
6137 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, | |
6138 | 0x80, 0x80); | |
6139 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, | |
6140 | 0x80, 0x80); | |
6141 | } else { | |
6142 | /* unmute internal speaker if necessary */ | |
6143 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
6144 | snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, | |
6145 | 0x80, mute & 0x80); | |
6146 | mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0); | |
6147 | snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, | |
6148 | 0x80, mute & 0x80); | |
6149 | } | |
6150 | } | |
6151 | ||
6152 | /* unsolicited event for HP jack sensing */ | |
6153 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
6154 | unsigned int res) | |
6155 | { | |
6156 | if ((res >> 26) != ALC_HP_EVENT) | |
6157 | return; | |
6158 | alc262_fujitsu_automute(codec, 1); | |
6159 | } | |
6160 | ||
6161 | /* bind volumes of both NID 0x0c and 0x0d */ | |
6162 | static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol, | |
6163 | struct snd_ctl_elem_value *ucontrol) | |
6164 | { | |
6165 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
6166 | long *valp = ucontrol->value.integer.value; | |
6167 | int change; | |
6168 | ||
6169 | change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, | |
6170 | 0x7f, valp[0] & 0x7f); | |
6171 | change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, | |
6172 | 0x7f, valp[1] & 0x7f); | |
6173 | snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, | |
6174 | 0x7f, valp[0] & 0x7f); | |
6175 | snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, | |
6176 | 0x7f, valp[1] & 0x7f); | |
6177 | return change; | |
6178 | } | |
6179 | ||
6180 | /* bind hp and internal speaker mute (with plug check) */ | |
6181 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
6182 | struct snd_ctl_elem_value *ucontrol) | |
6183 | { | |
6184 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
6185 | long *valp = ucontrol->value.integer.value; | |
6186 | int change; | |
6187 | ||
6188 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
6189 | 0x80, valp[0] ? 0 : 0x80); | |
6190 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
6191 | 0x80, valp[1] ? 0 : 0x80); | |
6192 | if (change || codec->in_resume) | |
6193 | alc262_fujitsu_automute(codec, codec->in_resume); | |
6194 | return change; | |
6195 | } | |
6196 | ||
6197 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
6198 | { | |
6199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6200 | .name = "Master Playback Volume", | |
6201 | .info = snd_hda_mixer_amp_volume_info, | |
6202 | .get = snd_hda_mixer_amp_volume_get, | |
6203 | .put = alc262_fujitsu_master_vol_put, | |
c2566524 | 6204 | .tlv = { .c = snd_hda_mixer_amp_tlv }, |
834be88d TI |
6205 | .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
6206 | }, | |
6207 | { | |
6208 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6209 | .name = "Master Playback Switch", | |
6210 | .info = snd_hda_mixer_amp_switch_info, | |
6211 | .get = snd_hda_mixer_amp_switch_get, | |
6212 | .put = alc262_fujitsu_master_sw_put, | |
6213 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
6214 | }, | |
6215 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
6216 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
6217 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
6218 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
6219 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6220 | { } /* end */ | |
6221 | }; | |
6222 | ||
304dcaac TI |
6223 | /* additional init verbs for Benq laptops */ |
6224 | static struct hda_verb alc262_EAPD_verbs[] = { | |
6225 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6226 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
6227 | {} | |
6228 | }; | |
6229 | ||
df694daa KY |
6230 | /* add playback controls from the parsed DAC table */ |
6231 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) | |
6232 | { | |
6233 | hda_nid_t nid; | |
6234 | int err; | |
6235 | ||
6236 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
6237 | spec->multiout.dac_nids = spec->private_dac_nids; | |
6238 | spec->multiout.dac_nids[0] = 2; | |
6239 | ||
6240 | nid = cfg->line_out_pins[0]; | |
6241 | if (nid) { | |
6242 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Front Playback Volume", | |
6243 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT))) < 0) | |
6244 | return err; | |
6245 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Front Playback Switch", | |
6246 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | |
6247 | return err; | |
6248 | } | |
6249 | ||
82bc955f | 6250 | nid = cfg->speaker_pins[0]; |
df694daa KY |
6251 | if (nid) { |
6252 | if (nid == 0x16) { | |
6253 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Speaker Playback Volume", | |
6254 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) | |
6255 | return err; | |
6256 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", | |
6257 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) | |
6258 | return err; | |
6259 | } else { | |
df694daa KY |
6260 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", |
6261 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | |
6262 | return err; | |
6263 | } | |
6264 | } | |
eb06ed8f | 6265 | nid = cfg->hp_pins[0]; |
df694daa KY |
6266 | if (nid) { |
6267 | /* spec->multiout.hp_nid = 2; */ | |
6268 | if (nid == 0x16) { | |
6269 | if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Headphone Playback Volume", | |
6270 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) | |
6271 | return err; | |
6272 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", | |
6273 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) | |
6274 | return err; | |
6275 | } else { | |
df694daa KY |
6276 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", |
6277 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | |
6278 | return err; | |
6279 | } | |
6280 | } | |
6281 | return 0; | |
6282 | } | |
6283 | ||
6284 | /* identical with ALC880 */ | |
6285 | #define alc262_auto_create_analog_input_ctls alc880_auto_create_analog_input_ctls | |
6286 | ||
6287 | /* | |
6288 | * generic initialization of ADC, input mixers and output mixers | |
6289 | */ | |
6290 | static struct hda_verb alc262_volume_init_verbs[] = { | |
6291 | /* | |
6292 | * Unmute ADC0-2 and set the default input to mic-in | |
6293 | */ | |
6294 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6295 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6296 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6297 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6298 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6299 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6300 | ||
6301 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
6302 | * mixer widget | |
6303 | * Note: PASD motherboards uses the Line In 2 as the input for front panel | |
6304 | * mic (mic 2) | |
6305 | */ | |
6306 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
6307 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
6310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
6311 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
6312 | ||
6313 | /* | |
6314 | * Set up output mixers (0x0c - 0x0f) | |
6315 | */ | |
6316 | /* set vol=0 to output mixers */ | |
6317 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6318 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6320 | ||
6321 | /* set up input amps for analog loopback */ | |
6322 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6325 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6326 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6327 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6328 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6329 | ||
6330 | /* FIXME: use matrix-type input source selection */ | |
6331 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
6332 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
6333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6334 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6335 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6336 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6337 | /* Input mixer2 */ | |
6338 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6339 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6340 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6341 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6342 | /* Input mixer3 */ | |
6343 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6344 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6345 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6346 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6347 | ||
6348 | { } | |
6349 | }; | |
6350 | ||
9c7f852e TI |
6351 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
6352 | /* | |
6353 | * Unmute ADC0-2 and set the default input to mic-in | |
6354 | */ | |
6355 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6356 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6357 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6358 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6359 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6360 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6361 | ||
6362 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
6363 | * mixer widget | |
6364 | * Note: PASD motherboards uses the Line In 2 as the input for front panel | |
6365 | * mic (mic 2) | |
6366 | */ | |
6367 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
6368 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
6371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
6372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
6373 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
6374 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, | |
6375 | ||
6376 | /* | |
6377 | * Set up output mixers (0x0c - 0x0e) | |
6378 | */ | |
6379 | /* set vol=0 to output mixers */ | |
6380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6381 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6382 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6383 | ||
6384 | /* set up input amps for analog loopback */ | |
6385 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6387 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6388 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6389 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6390 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6391 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6392 | ||
6393 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
6394 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6395 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6396 | ||
6397 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6398 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6399 | ||
6400 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6401 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6402 | ||
6403 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6404 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6405 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6406 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6407 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6408 | ||
6409 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
6410 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
6411 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
6412 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
6413 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
6414 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
6415 | ||
6416 | ||
6417 | /* FIXME: use matrix-type input source selection */ | |
6418 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
6419 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
6420 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6421 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
6422 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
6423 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
6424 | /* Input mixer2 */ | |
6425 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6426 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
6427 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
6428 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
6429 | /* Input mixer3 */ | |
6430 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6431 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
6432 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
6433 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
6434 | ||
6435 | { } | |
6436 | }; | |
6437 | ||
df694daa KY |
6438 | /* pcm configuration: identiacal with ALC880 */ |
6439 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback | |
6440 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
6441 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
6442 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
6443 | ||
6444 | /* | |
6445 | * BIOS auto configuration | |
6446 | */ | |
6447 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
6448 | { | |
6449 | struct alc_spec *spec = codec->spec; | |
6450 | int err; | |
6451 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
6452 | ||
6453 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
6454 | alc262_ignore)) < 0) | |
6455 | return err; | |
82bc955f | 6456 | if (! spec->autocfg.line_outs) |
df694daa KY |
6457 | return 0; /* can't find valid BIOS pin config */ |
6458 | if ((err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || | |
6459 | (err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) | |
6460 | return err; | |
6461 | ||
6462 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
6463 | ||
6464 | if (spec->autocfg.dig_out_pin) | |
6465 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; | |
6466 | if (spec->autocfg.dig_in_pin) | |
6467 | spec->dig_in_nid = ALC262_DIGIN_NID; | |
6468 | ||
6469 | if (spec->kctl_alloc) | |
6470 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
6471 | ||
6472 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; | |
a1e8d2da | 6473 | spec->num_mux_defs = 1; |
df694daa KY |
6474 | spec->input_mux = &spec->private_imux; |
6475 | ||
6476 | return 1; | |
6477 | } | |
6478 | ||
6479 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
6480 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
6481 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
6482 | ||
6483 | ||
6484 | /* init callback for auto-configuration model -- overriding the default init */ | |
ae6b813a | 6485 | static void alc262_auto_init(struct hda_codec *codec) |
df694daa | 6486 | { |
df694daa KY |
6487 | alc262_auto_init_multi_out(codec); |
6488 | alc262_auto_init_hp_out(codec); | |
6489 | alc262_auto_init_analog_input(codec); | |
df694daa KY |
6490 | } |
6491 | ||
6492 | /* | |
6493 | * configuration and preset | |
6494 | */ | |
f5fcc13c TI |
6495 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
6496 | [ALC262_BASIC] = "basic", | |
6497 | [ALC262_HIPPO] = "hippo", | |
6498 | [ALC262_HIPPO_1] = "hippo_1", | |
6499 | [ALC262_FUJITSU] = "fujitsu", | |
6500 | [ALC262_HP_BPC] = "hp-bpc", | |
6501 | [ALC262_BENQ_ED8] = "benq", | |
6502 | [ALC262_AUTO] = "auto", | |
6503 | }; | |
6504 | ||
6505 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
6506 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
6507 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), | |
6508 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), | |
6509 | SND_PCI_QUIRK(0x103c, 0x2801, "HP q954", ALC262_HP_BPC), | |
6510 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
6511 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
6512 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), | |
6513 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | |
6514 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
6515 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), | |
df694daa KY |
6516 | {} |
6517 | }; | |
6518 | ||
6519 | static struct alc_config_preset alc262_presets[] = { | |
6520 | [ALC262_BASIC] = { | |
6521 | .mixers = { alc262_base_mixer }, | |
6522 | .init_verbs = { alc262_init_verbs }, | |
6523 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
6524 | .dac_nids = alc262_dac_nids, | |
6525 | .hp_nid = 0x03, | |
6526 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
6527 | .channel_mode = alc262_modes, | |
a3bcba38 | 6528 | .input_mux = &alc262_capture_source, |
df694daa | 6529 | }, |
ccc656ce KY |
6530 | [ALC262_HIPPO] = { |
6531 | .mixers = { alc262_base_mixer }, | |
6532 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, | |
6533 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
6534 | .dac_nids = alc262_dac_nids, | |
6535 | .hp_nid = 0x03, | |
6536 | .dig_out_nid = ALC262_DIGOUT_NID, | |
6537 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
6538 | .channel_mode = alc262_modes, | |
6539 | .input_mux = &alc262_capture_source, | |
6540 | .unsol_event = alc262_hippo_unsol_event, | |
6541 | }, | |
6542 | [ALC262_HIPPO_1] = { | |
6543 | .mixers = { alc262_hippo1_mixer }, | |
6544 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
6545 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
6546 | .dac_nids = alc262_dac_nids, | |
6547 | .hp_nid = 0x02, | |
6548 | .dig_out_nid = ALC262_DIGOUT_NID, | |
6549 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
6550 | .channel_mode = alc262_modes, | |
6551 | .input_mux = &alc262_capture_source, | |
6552 | .unsol_event = alc262_hippo1_unsol_event, | |
6553 | }, | |
834be88d TI |
6554 | [ALC262_FUJITSU] = { |
6555 | .mixers = { alc262_fujitsu_mixer }, | |
6556 | .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, | |
6557 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
6558 | .dac_nids = alc262_dac_nids, | |
6559 | .hp_nid = 0x03, | |
6560 | .dig_out_nid = ALC262_DIGOUT_NID, | |
6561 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
6562 | .channel_mode = alc262_modes, | |
6563 | .input_mux = &alc262_fujitsu_capture_source, | |
ae6b813a | 6564 | .unsol_event = alc262_fujitsu_unsol_event, |
834be88d | 6565 | }, |
9c7f852e TI |
6566 | [ALC262_HP_BPC] = { |
6567 | .mixers = { alc262_HP_BPC_mixer }, | |
6568 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
6569 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
6570 | .dac_nids = alc262_dac_nids, | |
6571 | .hp_nid = 0x03, | |
6572 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
6573 | .channel_mode = alc262_modes, | |
6574 | .input_mux = &alc262_HP_capture_source, | |
6575 | }, | |
304dcaac TI |
6576 | [ALC262_BENQ_ED8] = { |
6577 | .mixers = { alc262_base_mixer }, | |
6578 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
6579 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
6580 | .dac_nids = alc262_dac_nids, | |
6581 | .hp_nid = 0x03, | |
6582 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
6583 | .channel_mode = alc262_modes, | |
6584 | .input_mux = &alc262_capture_source, | |
6585 | }, | |
df694daa KY |
6586 | }; |
6587 | ||
6588 | static int patch_alc262(struct hda_codec *codec) | |
6589 | { | |
6590 | struct alc_spec *spec; | |
6591 | int board_config; | |
6592 | int err; | |
6593 | ||
dc041e0b | 6594 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
6595 | if (spec == NULL) |
6596 | return -ENOMEM; | |
6597 | ||
6598 | codec->spec = spec; | |
6599 | #if 0 | |
6600 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is under-run */ | |
6601 | { | |
6602 | int tmp; | |
6603 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
6604 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
6605 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
6606 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
6607 | } | |
6608 | #endif | |
6609 | ||
f5fcc13c TI |
6610 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
6611 | alc262_models, | |
6612 | alc262_cfg_tbl); | |
9c7f852e | 6613 | |
f5fcc13c | 6614 | if (board_config < 0) { |
9c7f852e TI |
6615 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
6616 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
6617 | board_config = ALC262_AUTO; |
6618 | } | |
6619 | ||
6620 | if (board_config == ALC262_AUTO) { | |
6621 | /* automatic parse from the BIOS config */ | |
6622 | err = alc262_parse_auto_config(codec); | |
6623 | if (err < 0) { | |
6624 | alc_free(codec); | |
6625 | return err; | |
6626 | } else if (! err) { | |
9c7f852e TI |
6627 | printk(KERN_INFO |
6628 | "hda_codec: Cannot set up configuration " | |
6629 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
6630 | board_config = ALC262_BASIC; |
6631 | } | |
6632 | } | |
6633 | ||
6634 | if (board_config != ALC262_AUTO) | |
6635 | setup_preset(spec, &alc262_presets[board_config]); | |
6636 | ||
6637 | spec->stream_name_analog = "ALC262 Analog"; | |
6638 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | |
6639 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
6640 | ||
6641 | spec->stream_name_digital = "ALC262 Digital"; | |
6642 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | |
6643 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
6644 | ||
6645 | if (! spec->adc_nids && spec->input_mux) { | |
6646 | /* check whether NID 0x07 is valid */ | |
4a471b7d TI |
6647 | unsigned int wcap = get_wcaps(codec, 0x07); |
6648 | ||
df694daa KY |
6649 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
6650 | if (wcap != AC_WID_AUD_IN) { | |
6651 | spec->adc_nids = alc262_adc_nids_alt; | |
6652 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); | |
6653 | spec->mixers[spec->num_mixers] = alc262_capture_alt_mixer; | |
6654 | spec->num_mixers++; | |
6655 | } else { | |
6656 | spec->adc_nids = alc262_adc_nids; | |
6657 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); | |
6658 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; | |
6659 | spec->num_mixers++; | |
6660 | } | |
6661 | } | |
6662 | ||
6663 | codec->patch_ops = alc_patch_ops; | |
6664 | if (board_config == ALC262_AUTO) | |
ae6b813a | 6665 | spec->init_hook = alc262_auto_init; |
834be88d | 6666 | |
df694daa KY |
6667 | return 0; |
6668 | } | |
6669 | ||
df694daa KY |
6670 | /* |
6671 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
6672 | */ | |
6673 | ||
6674 | /* | |
6675 | * set the path ways for 2 channel output | |
6676 | * need to set the codec line out and mic 1 pin widgets to inputs | |
6677 | */ | |
6678 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
6679 | /* set pin widget 1Ah (line in) for input */ | |
6680 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
6681 | /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */ | |
6682 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
6683 | ||
9c7f852e TI |
6684 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
6685 | #if 0 | |
6686 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
6687 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
6688 | #endif | |
df694daa KY |
6689 | { } /* end */ |
6690 | }; | |
6691 | /* | |
6692 | * 6ch mode | |
6693 | * need to set the codec line out and mic 1 pin widgets to outputs | |
6694 | */ | |
6695 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
6696 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
6697 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6698 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
6699 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6700 | ||
6701 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
9c7f852e | 6702 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa | 6703 | |
9c7f852e TI |
6704 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
6705 | #if 0 | |
6706 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
6707 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
6708 | #endif | |
df694daa KY |
6709 | { } /* end */ |
6710 | }; | |
6711 | ||
6712 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
6713 | { 2, alc861_threestack_ch2_init }, | |
6714 | { 6, alc861_threestack_ch6_init }, | |
6715 | }; | |
22309c3e TI |
6716 | /* Set mic1 as input and unmute the mixer */ |
6717 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
6718 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
6719 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
6720 | { } /* end */ | |
6721 | }; | |
6722 | /* Set mic1 as output and mute mixer */ | |
6723 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
6724 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6725 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
6726 | { } /* end */ | |
6727 | }; | |
6728 | ||
6729 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
6730 | { 2, alc861_uniwill_m31_ch2_init }, | |
6731 | { 4, alc861_uniwill_m31_ch4_init }, | |
6732 | }; | |
df694daa | 6733 | |
7cdbff94 MD |
6734 | /* Set mic1 and line-in as input and unmute the mixer */ |
6735 | static struct hda_verb alc861_asus_ch2_init[] = { | |
6736 | /* set pin widget 1Ah (line in) for input */ | |
6737 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
6738 | /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */ | |
6739 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
6740 | ||
6741 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
6742 | #if 0 | |
6743 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
6744 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
6745 | #endif | |
6746 | { } /* end */ | |
6747 | }; | |
6748 | /* Set mic1 nad line-in as output and mute mixer */ | |
6749 | static struct hda_verb alc861_asus_ch6_init[] = { | |
6750 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
6751 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6752 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
6753 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
6754 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6755 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
6756 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
6757 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
6758 | ||
6759 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
6760 | #if 0 | |
6761 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
6762 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
6763 | #endif | |
6764 | { } /* end */ | |
6765 | }; | |
6766 | ||
6767 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
6768 | { 2, alc861_asus_ch2_init }, | |
6769 | { 6, alc861_asus_ch6_init }, | |
6770 | }; | |
6771 | ||
df694daa KY |
6772 | /* patch-ALC861 */ |
6773 | ||
6774 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
6775 | /* output mixer control */ | |
6776 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
6777 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
6778 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
6779 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
6780 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
6781 | ||
6782 | /*Input mixer control */ | |
6783 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
6784 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
6785 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
6786 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
6787 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
6788 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
6789 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
6790 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
6791 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
6792 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
6793 | ||
6794 | /* Capture mixer control */ | |
6795 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6796 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6797 | { | |
6798 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6799 | .name = "Capture Source", | |
6800 | .count = 1, | |
6801 | .info = alc_mux_enum_info, | |
6802 | .get = alc_mux_enum_get, | |
6803 | .put = alc_mux_enum_put, | |
6804 | }, | |
6805 | { } /* end */ | |
6806 | }; | |
6807 | ||
6808 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
6809 | /* output mixer control */ | |
6810 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
6811 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
6812 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
6813 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
6814 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
6815 | ||
6816 | /* Input mixer control */ | |
6817 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
6818 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
6819 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
6820 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
6821 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
6822 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
6823 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
6824 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
6825 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
6826 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
6827 | ||
6828 | /* Capture mixer control */ | |
6829 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6830 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6831 | { | |
6832 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6833 | .name = "Capture Source", | |
6834 | .count = 1, | |
6835 | .info = alc_mux_enum_info, | |
6836 | .get = alc_mux_enum_get, | |
6837 | .put = alc_mux_enum_put, | |
6838 | }, | |
6839 | { | |
6840 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6841 | .name = "Channel Mode", | |
6842 | .info = alc_ch_mode_info, | |
6843 | .get = alc_ch_mode_get, | |
6844 | .put = alc_ch_mode_put, | |
6845 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
6846 | }, | |
6847 | { } /* end */ | |
a53d1aec TD |
6848 | }; |
6849 | ||
d1d985f0 | 6850 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
a53d1aec TD |
6851 | /* output mixer control */ |
6852 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
6853 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
6854 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
6855 | ||
6856 | /*Capture mixer control */ | |
6857 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6858 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6859 | { | |
6860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6861 | .name = "Capture Source", | |
6862 | .count = 1, | |
6863 | .info = alc_mux_enum_info, | |
6864 | .get = alc_mux_enum_get, | |
6865 | .put = alc_mux_enum_put, | |
6866 | }, | |
6867 | ||
6868 | { } /* end */ | |
6869 | }; | |
6870 | ||
22309c3e TI |
6871 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
6872 | /* output mixer control */ | |
6873 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
6874 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
6875 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
6876 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
6877 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
6878 | ||
6879 | /* Input mixer control */ | |
6880 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
6881 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
6882 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
6883 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
6884 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
6885 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
6886 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
6887 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
6888 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
6889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
6890 | ||
6891 | /* Capture mixer control */ | |
6892 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6893 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6894 | { | |
6895 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6896 | .name = "Capture Source", | |
6897 | .count = 1, | |
6898 | .info = alc_mux_enum_info, | |
6899 | .get = alc_mux_enum_get, | |
6900 | .put = alc_mux_enum_put, | |
6901 | }, | |
6902 | { | |
6903 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6904 | .name = "Channel Mode", | |
6905 | .info = alc_ch_mode_info, | |
6906 | .get = alc_ch_mode_get, | |
6907 | .put = alc_ch_mode_put, | |
6908 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
6909 | }, | |
6910 | { } /* end */ | |
6911 | }; | |
7cdbff94 MD |
6912 | |
6913 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
6914 | /* output mixer control */ | |
6915 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
6916 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
6917 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
6918 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
6919 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
6920 | ||
6921 | /* Input mixer control */ | |
6922 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
6923 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
6924 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
6925 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
6926 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
6927 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
6928 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
6929 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
6930 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
6931 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), /* was HDA_INPUT (why?) */ | |
6932 | ||
6933 | /* Capture mixer control */ | |
6934 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6935 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6936 | { | |
6937 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6938 | .name = "Capture Source", | |
6939 | .count = 1, | |
6940 | .info = alc_mux_enum_info, | |
6941 | .get = alc_mux_enum_get, | |
6942 | .put = alc_mux_enum_put, | |
6943 | }, | |
6944 | { | |
6945 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6946 | .name = "Channel Mode", | |
6947 | .info = alc_ch_mode_info, | |
6948 | .get = alc_ch_mode_get, | |
6949 | .put = alc_ch_mode_put, | |
6950 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
6951 | }, | |
6952 | { } | |
56bb0cab TI |
6953 | }; |
6954 | ||
6955 | /* additional mixer */ | |
d1d985f0 | 6956 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
56bb0cab TI |
6957 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
6958 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
6959 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), | |
6960 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), | |
6961 | { } | |
6962 | }; | |
7cdbff94 | 6963 | |
df694daa KY |
6964 | /* |
6965 | * generic initialization of ADC, input mixers and output mixers | |
6966 | */ | |
6967 | static struct hda_verb alc861_base_init_verbs[] = { | |
6968 | /* | |
6969 | * Unmute ADC0 and set the default input to mic-in | |
6970 | */ | |
6971 | /* port-A for surround (rear panel) */ | |
6972 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6973 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
6974 | /* port-B for mic-in (rear panel) with vref */ | |
6975 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
6976 | /* port-C for line-in (rear panel) */ | |
6977 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
6978 | /* port-D for Front */ | |
6979 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6980 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
6981 | /* port-E for HP out (front panel) */ | |
6982 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
6983 | /* route front PCM to HP */ | |
9dece1d7 | 6984 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
6985 | /* port-F for mic-in (front panel) with vref */ |
6986 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
6987 | /* port-G for CLFE (rear panel) */ | |
6988 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6989 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
6990 | /* port-H for side (rear panel) */ | |
6991 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
6992 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
6993 | /* CD-in */ | |
6994 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
6995 | /* route front mic to ADC1*/ | |
6996 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6997 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6998 | ||
6999 | /* Unmute DAC0~3 & spdif out*/ | |
7000 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7001 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7002 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7003 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7005 | ||
7006 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
7007 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7008 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7009 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7010 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7011 | ||
7012 | /* Unmute Stereo Mixer 15 */ | |
7013 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7014 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7015 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7016 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step | |
7017 | ||
7018 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7019 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7020 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7021 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7022 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7023 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7024 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7025 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7026 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) | |
7027 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7028 | ||
7029 | { } | |
7030 | }; | |
7031 | ||
7032 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
7033 | /* | |
7034 | * Unmute ADC0 and set the default input to mic-in | |
7035 | */ | |
7036 | /* port-A for surround (rear panel) */ | |
7037 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7038 | /* port-B for mic-in (rear panel) with vref */ | |
7039 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7040 | /* port-C for line-in (rear panel) */ | |
7041 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
7042 | /* port-D for Front */ | |
7043 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
7044 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7045 | /* port-E for HP out (front panel) */ | |
7046 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
7047 | /* route front PCM to HP */ | |
9dece1d7 | 7048 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
7049 | /* port-F for mic-in (front panel) with vref */ |
7050 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7051 | /* port-G for CLFE (rear panel) */ | |
7052 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7053 | /* port-H for side (rear panel) */ | |
7054 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7055 | /* CD-in */ | |
7056 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
7057 | /* route front mic to ADC1*/ | |
7058 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7059 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7060 | /* Unmute DAC0~3 & spdif out*/ | |
7061 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7062 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7063 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7064 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7065 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7066 | ||
7067 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
7068 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7069 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7070 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7071 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7072 | ||
7073 | /* Unmute Stereo Mixer 15 */ | |
7074 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7076 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7077 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step | |
7078 | ||
7079 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7080 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7081 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7082 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7083 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7084 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7085 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7086 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7087 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) | |
7088 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7089 | { } | |
7090 | }; | |
22309c3e TI |
7091 | |
7092 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
7093 | /* | |
7094 | * Unmute ADC0 and set the default input to mic-in | |
7095 | */ | |
7096 | /* port-A for surround (rear panel) */ | |
7097 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7098 | /* port-B for mic-in (rear panel) with vref */ | |
7099 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7100 | /* port-C for line-in (rear panel) */ | |
7101 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
7102 | /* port-D for Front */ | |
7103 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
7104 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7105 | /* port-E for HP out (front panel) */ | |
7106 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, // this has to be set to VREF80 | |
7107 | /* route front PCM to HP */ | |
9dece1d7 | 7108 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
22309c3e TI |
7109 | /* port-F for mic-in (front panel) with vref */ |
7110 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7111 | /* port-G for CLFE (rear panel) */ | |
7112 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7113 | /* port-H for side (rear panel) */ | |
7114 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7115 | /* CD-in */ | |
7116 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
7117 | /* route front mic to ADC1*/ | |
7118 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7119 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7120 | /* Unmute DAC0~3 & spdif out*/ | |
7121 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7122 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7123 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7124 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7126 | ||
7127 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
7128 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7129 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7130 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7131 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7132 | ||
7133 | /* Unmute Stereo Mixer 15 */ | |
7134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7135 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7136 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7137 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step | |
7138 | ||
7139 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7140 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7141 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7142 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7143 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7144 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7145 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7146 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7147 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) | |
7148 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7149 | { } | |
7150 | }; | |
7151 | ||
7cdbff94 MD |
7152 | static struct hda_verb alc861_asus_init_verbs[] = { |
7153 | /* | |
7154 | * Unmute ADC0 and set the default input to mic-in | |
7155 | */ | |
7156 | /* port-A for surround (rear panel) | according to codec#0 this is the HP jack*/ | |
7157 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ | |
7158 | /* route front PCM to HP */ | |
7159 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7160 | /* port-B for mic-in (rear panel) with vref */ | |
7161 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7162 | /* port-C for line-in (rear panel) */ | |
7163 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
7164 | /* port-D for Front */ | |
7165 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
7166 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7167 | /* port-E for HP out (front panel) */ | |
7168 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, /* this has to be set to VREF80 */ | |
7169 | /* route front PCM to HP */ | |
9dece1d7 | 7170 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7cdbff94 MD |
7171 | /* port-F for mic-in (front panel) with vref */ |
7172 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7173 | /* port-G for CLFE (rear panel) */ | |
7174 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
7175 | /* port-H for side (rear panel) */ | |
7176 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
7177 | /* CD-in */ | |
7178 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
7179 | /* route front mic to ADC1*/ | |
7180 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7181 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7182 | /* Unmute DAC0~3 & spdif out*/ | |
7183 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7184 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7185 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7186 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7187 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7188 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
7189 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7190 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7191 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7192 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7193 | ||
7194 | /* Unmute Stereo Mixer 15 */ | |
7195 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7196 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7197 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7198 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, /* Output 0~12 step */ | |
7199 | ||
7200 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7201 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7202 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7203 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7204 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7205 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7206 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7207 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7208 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, /* hp used DAC 3 (Front) */ | |
7209 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7210 | { } | |
7211 | }; | |
7212 | ||
56bb0cab TI |
7213 | /* additional init verbs for ASUS laptops */ |
7214 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
7215 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
7216 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
7217 | { } | |
7218 | }; | |
7cdbff94 | 7219 | |
df694daa KY |
7220 | /* |
7221 | * generic initialization of ADC, input mixers and output mixers | |
7222 | */ | |
7223 | static struct hda_verb alc861_auto_init_verbs[] = { | |
7224 | /* | |
7225 | * Unmute ADC0 and set the default input to mic-in | |
7226 | */ | |
7227 | // {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7228 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7229 | ||
7230 | /* Unmute DAC0~3 & spdif out*/ | |
7231 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7232 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7233 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7234 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7235 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7236 | ||
7237 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
7238 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7239 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7240 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7241 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7242 | ||
7243 | /* Unmute Stereo Mixer 15 */ | |
7244 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7245 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7246 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
7248 | ||
7249 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7250 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7251 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7252 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7253 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7254 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7255 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7256 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7257 | ||
7258 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7259 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7260 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7261 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7262 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7263 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7264 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7265 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7266 | ||
7267 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, // set Mic 1 | |
7268 | ||
7269 | { } | |
7270 | }; | |
7271 | ||
a53d1aec TD |
7272 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
7273 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
7274 | ||
7275 | { } | |
7276 | }; | |
7277 | ||
7278 | /* toggle speaker-output according to the hp-jack state */ | |
7279 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
7280 | { | |
7281 | unsigned int present; | |
7282 | ||
7283 | present = snd_hda_codec_read(codec, 0x0f, 0, | |
7284 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7285 | snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, | |
7286 | 0x80, present ? 0x80 : 0); | |
7287 | snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, | |
7288 | 0x80, present ? 0x80 : 0); | |
7289 | snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3, | |
7290 | 0x80, present ? 0 : 0x80); | |
7291 | snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3, | |
7292 | 0x80, present ? 0 : 0x80); | |
7293 | } | |
7294 | ||
7295 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
7296 | unsigned int res) | |
7297 | { | |
7298 | /* Looks like the unsol event is incompatible with the standard | |
7299 | * definition. 6bit tag is placed at 26 bit! | |
7300 | */ | |
7301 | if ((res >> 26) == ALC880_HP_EVENT) | |
7302 | alc861_toshiba_automute(codec); | |
7303 | } | |
7304 | ||
df694daa KY |
7305 | /* pcm configuration: identiacal with ALC880 */ |
7306 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback | |
7307 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
7308 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
7309 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
7310 | ||
7311 | ||
7312 | #define ALC861_DIGOUT_NID 0x07 | |
7313 | ||
7314 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
7315 | { 8, NULL } | |
7316 | }; | |
7317 | ||
7318 | static hda_nid_t alc861_dac_nids[4] = { | |
7319 | /* front, surround, clfe, side */ | |
7320 | 0x03, 0x06, 0x05, 0x04 | |
7321 | }; | |
7322 | ||
9c7f852e TI |
7323 | static hda_nid_t alc660_dac_nids[3] = { |
7324 | /* front, clfe, surround */ | |
7325 | 0x03, 0x05, 0x06 | |
7326 | }; | |
7327 | ||
df694daa KY |
7328 | static hda_nid_t alc861_adc_nids[1] = { |
7329 | /* ADC0-2 */ | |
7330 | 0x08, | |
7331 | }; | |
7332 | ||
7333 | static struct hda_input_mux alc861_capture_source = { | |
7334 | .num_items = 5, | |
7335 | .items = { | |
7336 | { "Mic", 0x0 }, | |
7337 | { "Front Mic", 0x3 }, | |
7338 | { "Line", 0x1 }, | |
7339 | { "CD", 0x4 }, | |
7340 | { "Mixer", 0x5 }, | |
7341 | }, | |
7342 | }; | |
7343 | ||
7344 | /* fill in the dac_nids table from the parsed pin configuration */ | |
7345 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pin_cfg *cfg) | |
7346 | { | |
7347 | int i; | |
7348 | hda_nid_t nid; | |
7349 | ||
7350 | spec->multiout.dac_nids = spec->private_dac_nids; | |
7351 | for (i = 0; i < cfg->line_outs; i++) { | |
7352 | nid = cfg->line_out_pins[i]; | |
7353 | if (nid) { | |
7354 | if (i >= ARRAY_SIZE(alc861_dac_nids)) | |
7355 | continue; | |
7356 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; | |
7357 | } | |
7358 | } | |
7359 | spec->multiout.num_dacs = cfg->line_outs; | |
7360 | return 0; | |
7361 | } | |
7362 | ||
7363 | /* add playback controls from the parsed DAC table */ | |
7364 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, | |
7365 | const struct auto_pin_cfg *cfg) | |
7366 | { | |
7367 | char name[32]; | |
7368 | static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; | |
7369 | hda_nid_t nid; | |
7370 | int i, idx, err; | |
7371 | ||
7372 | for (i = 0; i < cfg->line_outs; i++) { | |
7373 | nid = spec->multiout.dac_nids[i]; | |
7374 | if (! nid) | |
7375 | continue; | |
7376 | if (nid == 0x05) { | |
7377 | /* Center/LFE */ | |
7378 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Center Playback Switch", | |
7379 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) | |
7380 | return err; | |
7381 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "LFE Playback Switch", | |
7382 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) | |
7383 | return err; | |
7384 | } else { | |
7385 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; idx++) | |
7386 | if (nid == alc861_dac_nids[idx]) | |
7387 | break; | |
7388 | sprintf(name, "%s Playback Switch", chname[idx]); | |
7389 | if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, | |
7390 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | |
7391 | return err; | |
7392 | } | |
7393 | } | |
7394 | return 0; | |
7395 | } | |
7396 | ||
7397 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | |
7398 | { | |
7399 | int err; | |
7400 | hda_nid_t nid; | |
7401 | ||
7402 | if (! pin) | |
7403 | return 0; | |
7404 | ||
7405 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
7406 | nid = 0x03; | |
7407 | if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", | |
7408 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | |
7409 | return err; | |
7410 | spec->multiout.hp_nid = nid; | |
7411 | } | |
7412 | return 0; | |
7413 | } | |
7414 | ||
7415 | /* create playback/capture controls for input pins */ | |
7416 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) | |
7417 | { | |
df694daa KY |
7418 | struct hda_input_mux *imux = &spec->private_imux; |
7419 | int i, err, idx, idx1; | |
7420 | ||
7421 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
7422 | switch(cfg->input_pins[i]) { | |
7423 | case 0x0c: | |
7424 | idx1 = 1; | |
7425 | idx = 2; // Line In | |
7426 | break; | |
7427 | case 0x0f: | |
7428 | idx1 = 2; | |
7429 | idx = 2; // Line In | |
7430 | break; | |
7431 | case 0x0d: | |
7432 | idx1 = 0; | |
7433 | idx = 1; // Mic In | |
7434 | break; | |
7435 | case 0x10: | |
7436 | idx1 = 3; | |
7437 | idx = 1; // Mic In | |
7438 | break; | |
7439 | case 0x11: | |
7440 | idx1 = 4; | |
7441 | idx = 0; // CD | |
7442 | break; | |
7443 | default: | |
7444 | continue; | |
7445 | } | |
7446 | ||
4a471b7d TI |
7447 | err = new_analog_input(spec, cfg->input_pins[i], |
7448 | auto_pin_cfg_labels[i], idx, 0x15); | |
df694daa KY |
7449 | if (err < 0) |
7450 | return err; | |
7451 | ||
4a471b7d | 7452 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
df694daa KY |
7453 | imux->items[imux->num_items].index = idx1; |
7454 | imux->num_items++; | |
7455 | } | |
7456 | return 0; | |
7457 | } | |
7458 | ||
7459 | static struct snd_kcontrol_new alc861_capture_mixer[] = { | |
7460 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7461 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7462 | ||
7463 | { | |
7464 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7465 | /* The multiple "Capture Source" controls confuse alsamixer | |
7466 | * So call somewhat different.. | |
7467 | *FIXME: the controls appear in the "playback" view! | |
7468 | */ | |
7469 | /* .name = "Capture Source", */ | |
7470 | .name = "Input Source", | |
7471 | .count = 1, | |
7472 | .info = alc_mux_enum_info, | |
7473 | .get = alc_mux_enum_get, | |
7474 | .put = alc_mux_enum_put, | |
7475 | }, | |
7476 | { } /* end */ | |
7477 | }; | |
7478 | ||
7479 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, hda_nid_t nid, | |
7480 | int pin_type, int dac_idx) | |
7481 | { | |
7482 | /* set as output */ | |
7483 | ||
7484 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | |
7485 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | |
7486 | ||
7487 | } | |
7488 | ||
7489 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
7490 | { | |
7491 | struct alc_spec *spec = codec->spec; | |
7492 | int i; | |
7493 | ||
7494 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
7495 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
7496 | if (nid) | |
7497 | alc861_auto_set_output_and_unmute(codec, nid, PIN_OUT, spec->multiout.dac_nids[i]); | |
7498 | } | |
7499 | } | |
7500 | ||
7501 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
7502 | { | |
7503 | struct alc_spec *spec = codec->spec; | |
7504 | hda_nid_t pin; | |
7505 | ||
eb06ed8f | 7506 | pin = spec->autocfg.hp_pins[0]; |
df694daa KY |
7507 | if (pin) /* connect to front */ |
7508 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, spec->multiout.dac_nids[0]); | |
7509 | } | |
7510 | ||
7511 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
7512 | { | |
7513 | struct alc_spec *spec = codec->spec; | |
7514 | int i; | |
7515 | ||
7516 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
7517 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
7518 | if ((nid>=0x0c) && (nid <=0x11)) { | |
7519 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
7520 | i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); | |
7521 | } | |
7522 | } | |
7523 | } | |
7524 | ||
7525 | /* parse the BIOS configuration and set up the alc_spec */ | |
7526 | /* return 1 if successful, 0 if the proper config is not found, or a negative error code */ | |
7527 | static int alc861_parse_auto_config(struct hda_codec *codec) | |
7528 | { | |
7529 | struct alc_spec *spec = codec->spec; | |
7530 | int err; | |
7531 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
7532 | ||
7533 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
7534 | alc861_ignore)) < 0) | |
7535 | return err; | |
82bc955f | 7536 | if (! spec->autocfg.line_outs) |
df694daa KY |
7537 | return 0; /* can't find valid BIOS pin config */ |
7538 | ||
7539 | if ((err = alc861_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || | |
7540 | (err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || | |
eb06ed8f | 7541 | (err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0])) < 0 || |
df694daa KY |
7542 | (err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) |
7543 | return err; | |
7544 | ||
7545 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
7546 | ||
7547 | if (spec->autocfg.dig_out_pin) | |
7548 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; | |
7549 | ||
7550 | if (spec->kctl_alloc) | |
7551 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
7552 | ||
7553 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; | |
7554 | ||
a1e8d2da | 7555 | spec->num_mux_defs = 1; |
df694daa KY |
7556 | spec->input_mux = &spec->private_imux; |
7557 | ||
7558 | spec->adc_nids = alc861_adc_nids; | |
7559 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
7560 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; | |
7561 | spec->num_mixers++; | |
7562 | ||
7563 | return 1; | |
7564 | } | |
7565 | ||
ae6b813a TI |
7566 | /* additional initialization for auto-configuration model */ |
7567 | static void alc861_auto_init(struct hda_codec *codec) | |
df694daa | 7568 | { |
df694daa KY |
7569 | alc861_auto_init_multi_out(codec); |
7570 | alc861_auto_init_hp_out(codec); | |
7571 | alc861_auto_init_analog_input(codec); | |
df694daa KY |
7572 | } |
7573 | ||
7574 | ||
7575 | /* | |
7576 | * configuration and preset | |
7577 | */ | |
f5fcc13c TI |
7578 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
7579 | [ALC861_3ST] = "3stack", | |
7580 | [ALC660_3ST] = "3stack-660", | |
7581 | [ALC861_3ST_DIG] = "3stack-dig", | |
7582 | [ALC861_6ST_DIG] = "6stack-dig", | |
7583 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
7584 | [ALC861_TOSHIBA] = "toshiba", | |
7585 | [ALC861_ASUS] = "asus", | |
7586 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
7587 | [ALC861_AUTO] = "auto", | |
7588 | }; | |
7589 | ||
7590 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
7591 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
7592 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
7593 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
7594 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660_3ST), | |
7595 | SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), | |
7596 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), | |
7597 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), | |
df694daa KY |
7598 | {} |
7599 | }; | |
7600 | ||
7601 | static struct alc_config_preset alc861_presets[] = { | |
7602 | [ALC861_3ST] = { | |
7603 | .mixers = { alc861_3ST_mixer }, | |
7604 | .init_verbs = { alc861_threestack_init_verbs }, | |
7605 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
7606 | .dac_nids = alc861_dac_nids, | |
7607 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
7608 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 7609 | .need_dac_fix = 1, |
df694daa KY |
7610 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
7611 | .adc_nids = alc861_adc_nids, | |
7612 | .input_mux = &alc861_capture_source, | |
7613 | }, | |
7614 | [ALC861_3ST_DIG] = { | |
7615 | .mixers = { alc861_base_mixer }, | |
7616 | .init_verbs = { alc861_threestack_init_verbs }, | |
7617 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
7618 | .dac_nids = alc861_dac_nids, | |
7619 | .dig_out_nid = ALC861_DIGOUT_NID, | |
7620 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
7621 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 7622 | .need_dac_fix = 1, |
df694daa KY |
7623 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
7624 | .adc_nids = alc861_adc_nids, | |
7625 | .input_mux = &alc861_capture_source, | |
7626 | }, | |
7627 | [ALC861_6ST_DIG] = { | |
7628 | .mixers = { alc861_base_mixer }, | |
7629 | .init_verbs = { alc861_base_init_verbs }, | |
7630 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
7631 | .dac_nids = alc861_dac_nids, | |
7632 | .dig_out_nid = ALC861_DIGOUT_NID, | |
7633 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
7634 | .channel_mode = alc861_8ch_modes, | |
7635 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
7636 | .adc_nids = alc861_adc_nids, | |
7637 | .input_mux = &alc861_capture_source, | |
7638 | }, | |
9c7f852e TI |
7639 | [ALC660_3ST] = { |
7640 | .mixers = { alc861_3ST_mixer }, | |
7641 | .init_verbs = { alc861_threestack_init_verbs }, | |
7642 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
7643 | .dac_nids = alc660_dac_nids, | |
7644 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
7645 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 7646 | .need_dac_fix = 1, |
9c7f852e TI |
7647 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
7648 | .adc_nids = alc861_adc_nids, | |
7649 | .input_mux = &alc861_capture_source, | |
7650 | }, | |
22309c3e TI |
7651 | [ALC861_UNIWILL_M31] = { |
7652 | .mixers = { alc861_uniwill_m31_mixer }, | |
7653 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
7654 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
7655 | .dac_nids = alc861_dac_nids, | |
7656 | .dig_out_nid = ALC861_DIGOUT_NID, | |
7657 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
7658 | .channel_mode = alc861_uniwill_m31_modes, | |
7659 | .need_dac_fix = 1, | |
7660 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
7661 | .adc_nids = alc861_adc_nids, | |
7662 | .input_mux = &alc861_capture_source, | |
7663 | }, | |
a53d1aec TD |
7664 | [ALC861_TOSHIBA] = { |
7665 | .mixers = { alc861_toshiba_mixer }, | |
7666 | .init_verbs = { alc861_base_init_verbs, alc861_toshiba_init_verbs }, | |
7667 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
7668 | .dac_nids = alc861_dac_nids, | |
7669 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
7670 | .channel_mode = alc883_3ST_2ch_modes, | |
7671 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
7672 | .adc_nids = alc861_adc_nids, | |
7673 | .input_mux = &alc861_capture_source, | |
7674 | .unsol_event = alc861_toshiba_unsol_event, | |
7675 | .init_hook = alc861_toshiba_automute, | |
7676 | }, | |
7cdbff94 MD |
7677 | [ALC861_ASUS] = { |
7678 | .mixers = { alc861_asus_mixer }, | |
7679 | .init_verbs = { alc861_asus_init_verbs }, | |
7680 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
7681 | .dac_nids = alc861_dac_nids, | |
7682 | .dig_out_nid = ALC861_DIGOUT_NID, | |
7683 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
7684 | .channel_mode = alc861_asus_modes, | |
7685 | .need_dac_fix = 1, | |
7686 | .hp_nid = 0x06, | |
7687 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
7688 | .adc_nids = alc861_adc_nids, | |
7689 | .input_mux = &alc861_capture_source, | |
7690 | }, | |
56bb0cab TI |
7691 | [ALC861_ASUS_LAPTOP] = { |
7692 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
7693 | .init_verbs = { alc861_asus_init_verbs, | |
7694 | alc861_asus_laptop_init_verbs }, | |
7695 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
7696 | .dac_nids = alc861_dac_nids, | |
7697 | .dig_out_nid = ALC861_DIGOUT_NID, | |
7698 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
7699 | .channel_mode = alc883_3ST_2ch_modes, | |
7700 | .need_dac_fix = 1, | |
7701 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
7702 | .adc_nids = alc861_adc_nids, | |
7703 | .input_mux = &alc861_capture_source, | |
7704 | }, | |
7705 | }; | |
df694daa KY |
7706 | |
7707 | ||
7708 | static int patch_alc861(struct hda_codec *codec) | |
7709 | { | |
7710 | struct alc_spec *spec; | |
7711 | int board_config; | |
7712 | int err; | |
7713 | ||
dc041e0b | 7714 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
7715 | if (spec == NULL) |
7716 | return -ENOMEM; | |
7717 | ||
7718 | codec->spec = spec; | |
7719 | ||
f5fcc13c TI |
7720 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
7721 | alc861_models, | |
7722 | alc861_cfg_tbl); | |
9c7f852e | 7723 | |
f5fcc13c | 7724 | if (board_config < 0) { |
9c7f852e TI |
7725 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
7726 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
7727 | board_config = ALC861_AUTO; |
7728 | } | |
7729 | ||
7730 | if (board_config == ALC861_AUTO) { | |
7731 | /* automatic parse from the BIOS config */ | |
7732 | err = alc861_parse_auto_config(codec); | |
7733 | if (err < 0) { | |
7734 | alc_free(codec); | |
7735 | return err; | |
7736 | } else if (! err) { | |
9c7f852e TI |
7737 | printk(KERN_INFO |
7738 | "hda_codec: Cannot set up configuration " | |
7739 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
7740 | board_config = ALC861_3ST_DIG; |
7741 | } | |
7742 | } | |
7743 | ||
7744 | if (board_config != ALC861_AUTO) | |
7745 | setup_preset(spec, &alc861_presets[board_config]); | |
7746 | ||
7747 | spec->stream_name_analog = "ALC861 Analog"; | |
7748 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | |
7749 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
7750 | ||
7751 | spec->stream_name_digital = "ALC861 Digital"; | |
7752 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | |
7753 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
7754 | ||
7755 | codec->patch_ops = alc_patch_ops; | |
7756 | if (board_config == ALC861_AUTO) | |
ae6b813a | 7757 | spec->init_hook = alc861_auto_init; |
df694daa | 7758 | |
1da177e4 LT |
7759 | return 0; |
7760 | } | |
7761 | ||
7762 | /* | |
7763 | * patch entries | |
7764 | */ | |
7765 | struct hda_codec_preset snd_hda_preset_realtek[] = { | |
7766 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | |
df694daa | 7767 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
1da177e4 LT |
7768 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
7769 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | |
9c7f852e | 7770 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
df694daa | 7771 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
9c7f852e TI |
7772 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
7773 | { .id = 0x10ec0861, .rev = 0x100300, .name = "ALC861", | |
7774 | .patch = patch_alc861 }, | |
ccc656ce | 7775 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
9c7f852e | 7776 | .patch = patch_alc861 }, |
ccc656ce | 7777 | { .id = 0x10ec0660, .name = "ALC660", .patch = patch_alc861 }, |
1da177e4 LT |
7778 | {} /* terminator */ |
7779 | }; |