]>
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 | ||
1da177e4 LT |
26 | #include <linux/init.h> |
27 | #include <linux/delay.h> | |
28 | #include <linux/slab.h> | |
29 | #include <linux/pci.h> | |
30 | #include <sound/core.h> | |
31 | #include "hda_codec.h" | |
32 | #include "hda_local.h" | |
3c9a3203 | 33 | #include "hda_patch.h" |
1da177e4 | 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, |
2cf9f0fc | 55 | ALC880_FUJITSU, |
16ded525 | 56 | ALC880_UNIWILL_DIG, |
ccc656ce KY |
57 | ALC880_UNIWILL, |
58 | ALC880_UNIWILL_P53, | |
df694daa KY |
59 | ALC880_CLEVO, |
60 | ALC880_TCL_S700, | |
ae6b813a | 61 | ALC880_LG, |
d681518a | 62 | ALC880_LG_LW, |
df99cd33 | 63 | ALC880_MEDION_RIM, |
e9edcee0 TI |
64 | #ifdef CONFIG_SND_DEBUG |
65 | ALC880_TEST, | |
66 | #endif | |
df694daa | 67 | ALC880_AUTO, |
16ded525 TI |
68 | ALC880_MODEL_LAST /* last tag */ |
69 | }; | |
70 | ||
71 | /* ALC260 models */ | |
72 | enum { | |
73 | ALC260_BASIC, | |
74 | ALC260_HP, | |
df694daa KY |
75 | ALC260_HP_3013, |
76 | ALC260_FUJITSU_S702X, | |
0bfc90e9 | 77 | ALC260_ACER, |
bc9f98a9 KY |
78 | ALC260_WILL, |
79 | ALC260_REPLACER_672V, | |
7cf51e48 JW |
80 | #ifdef CONFIG_SND_DEBUG |
81 | ALC260_TEST, | |
82 | #endif | |
df694daa | 83 | ALC260_AUTO, |
16ded525 | 84 | ALC260_MODEL_LAST /* last tag */ |
1da177e4 LT |
85 | }; |
86 | ||
df694daa KY |
87 | /* ALC262 models */ |
88 | enum { | |
89 | ALC262_BASIC, | |
ccc656ce KY |
90 | ALC262_HIPPO, |
91 | ALC262_HIPPO_1, | |
834be88d | 92 | ALC262_FUJITSU, |
9c7f852e | 93 | ALC262_HP_BPC, |
cd7509a4 KY |
94 | ALC262_HP_BPC_D7000_WL, |
95 | ALC262_HP_BPC_D7000_WF, | |
66d2a9d6 | 96 | ALC262_HP_TC_T5735, |
8c427226 | 97 | ALC262_HP_RP5700, |
304dcaac | 98 | ALC262_BENQ_ED8, |
272a527c | 99 | ALC262_SONY_ASSAMD, |
83c34218 | 100 | ALC262_BENQ_T31, |
f651b50b | 101 | ALC262_ULTRA, |
0e31daf7 | 102 | ALC262_LENOVO_3000, |
df694daa KY |
103 | ALC262_AUTO, |
104 | ALC262_MODEL_LAST /* last tag */ | |
105 | }; | |
106 | ||
a361d84b KY |
107 | /* ALC268 models */ |
108 | enum { | |
eb5a6621 | 109 | ALC267_QUANTA_IL1, |
a361d84b | 110 | ALC268_3ST, |
d1a991a6 | 111 | ALC268_TOSHIBA, |
d273809e | 112 | ALC268_ACER, |
3866f0b0 | 113 | ALC268_DELL, |
f12462c5 | 114 | ALC268_ZEPTO, |
86c53bd2 JW |
115 | #ifdef CONFIG_SND_DEBUG |
116 | ALC268_TEST, | |
117 | #endif | |
a361d84b KY |
118 | ALC268_AUTO, |
119 | ALC268_MODEL_LAST /* last tag */ | |
120 | }; | |
121 | ||
f6a92248 KY |
122 | /* ALC269 models */ |
123 | enum { | |
124 | ALC269_BASIC, | |
125 | ALC269_AUTO, | |
126 | ALC269_MODEL_LAST /* last tag */ | |
127 | }; | |
128 | ||
df694daa KY |
129 | /* ALC861 models */ |
130 | enum { | |
131 | ALC861_3ST, | |
9c7f852e | 132 | ALC660_3ST, |
df694daa KY |
133 | ALC861_3ST_DIG, |
134 | ALC861_6ST_DIG, | |
22309c3e | 135 | ALC861_UNIWILL_M31, |
a53d1aec | 136 | ALC861_TOSHIBA, |
7cdbff94 | 137 | ALC861_ASUS, |
56bb0cab | 138 | ALC861_ASUS_LAPTOP, |
df694daa KY |
139 | ALC861_AUTO, |
140 | ALC861_MODEL_LAST, | |
141 | }; | |
142 | ||
f32610ed JS |
143 | /* ALC861-VD models */ |
144 | enum { | |
145 | ALC660VD_3ST, | |
6963f84c | 146 | ALC660VD_3ST_DIG, |
f32610ed JS |
147 | ALC861VD_3ST, |
148 | ALC861VD_3ST_DIG, | |
149 | ALC861VD_6ST_DIG, | |
bdd148a3 | 150 | ALC861VD_LENOVO, |
272a527c | 151 | ALC861VD_DALLAS, |
d1a991a6 | 152 | ALC861VD_HP, |
f32610ed JS |
153 | ALC861VD_AUTO, |
154 | ALC861VD_MODEL_LAST, | |
155 | }; | |
156 | ||
bc9f98a9 KY |
157 | /* ALC662 models */ |
158 | enum { | |
159 | ALC662_3ST_2ch_DIG, | |
160 | ALC662_3ST_6ch_DIG, | |
161 | ALC662_3ST_6ch, | |
162 | ALC662_5ST_DIG, | |
163 | ALC662_LENOVO_101E, | |
291702f0 | 164 | ALC662_ASUS_EEEPC_P701, |
8c427226 | 165 | ALC662_ASUS_EEEPC_EP20, |
6dda9f4a KY |
166 | ALC663_ASUS_M51VA, |
167 | ALC663_ASUS_G71V, | |
168 | ALC663_ASUS_H13, | |
169 | ALC663_ASUS_G50V, | |
bc9f98a9 KY |
170 | ALC662_AUTO, |
171 | ALC662_MODEL_LAST, | |
172 | }; | |
173 | ||
df694daa KY |
174 | /* ALC882 models */ |
175 | enum { | |
176 | ALC882_3ST_DIG, | |
177 | ALC882_6ST_DIG, | |
4b146cb0 | 178 | ALC882_ARIMA, |
bdd148a3 | 179 | ALC882_W2JC, |
272a527c KY |
180 | ALC882_TARGA, |
181 | ALC882_ASUS_A7J, | |
914759b7 | 182 | ALC882_ASUS_A7M, |
9102cd1c | 183 | ALC885_MACPRO, |
87350ad0 | 184 | ALC885_MBP3, |
c54728d8 | 185 | ALC885_IMAC24, |
272a527c | 186 | ALC882_AUTO, |
df694daa KY |
187 | ALC882_MODEL_LAST, |
188 | }; | |
189 | ||
9c7f852e TI |
190 | /* ALC883 models */ |
191 | enum { | |
192 | ALC883_3ST_2ch_DIG, | |
193 | ALC883_3ST_6ch_DIG, | |
194 | ALC883_3ST_6ch, | |
195 | ALC883_6ST_DIG, | |
ccc656ce KY |
196 | ALC883_TARGA_DIG, |
197 | ALC883_TARGA_2ch_DIG, | |
bab282b9 | 198 | ALC883_ACER, |
2880a867 | 199 | ALC883_ACER_ASPIRE, |
c07584c8 | 200 | ALC883_MEDION, |
272a527c | 201 | ALC883_MEDION_MD2, |
b373bdeb | 202 | ALC883_LAPTOP_EAPD, |
bc9f98a9 | 203 | ALC883_LENOVO_101E_2ch, |
272a527c | 204 | ALC883_LENOVO_NB0763, |
189609ae KY |
205 | ALC888_LENOVO_MS7195_DIG, |
206 | ALC883_HAIER_W66, | |
4723c022 | 207 | ALC888_3ST_HP, |
5795b9e6 | 208 | ALC888_6ST_DELL, |
a8848bd6 | 209 | ALC883_MITAC, |
0c4cc443 | 210 | ALC883_CLEVO_M720, |
fb97dc67 | 211 | ALC883_FUJITSU_PI2515, |
17bba1b7 | 212 | ALC883_3ST_6ch_INTEL, |
9c7f852e TI |
213 | ALC883_AUTO, |
214 | ALC883_MODEL_LAST, | |
215 | }; | |
216 | ||
df694daa KY |
217 | /* for GPIO Poll */ |
218 | #define GPIO_MASK 0x03 | |
219 | ||
1da177e4 LT |
220 | struct alc_spec { |
221 | /* codec parameterization */ | |
df694daa | 222 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
1da177e4 LT |
223 | unsigned int num_mixers; |
224 | ||
df694daa | 225 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
9c7f852e TI |
226 | * don't forget NULL |
227 | * termination! | |
e9edcee0 TI |
228 | */ |
229 | unsigned int num_init_verbs; | |
1da177e4 | 230 | |
16ded525 | 231 | char *stream_name_analog; /* analog PCM stream */ |
1da177e4 LT |
232 | struct hda_pcm_stream *stream_analog_playback; |
233 | struct hda_pcm_stream *stream_analog_capture; | |
6330079f TI |
234 | struct hda_pcm_stream *stream_analog_alt_playback; |
235 | struct hda_pcm_stream *stream_analog_alt_capture; | |
1da177e4 | 236 | |
f12ab1e0 | 237 | char *stream_name_digital; /* digital PCM stream */ |
1da177e4 LT |
238 | struct hda_pcm_stream *stream_digital_playback; |
239 | struct hda_pcm_stream *stream_digital_capture; | |
240 | ||
241 | /* playback */ | |
16ded525 TI |
242 | struct hda_multi_out multiout; /* playback set-up |
243 | * max_channels, dacs must be set | |
244 | * dig_out_nid and hp_nid are optional | |
245 | */ | |
6330079f | 246 | hda_nid_t alt_dac_nid; |
1da177e4 LT |
247 | |
248 | /* capture */ | |
249 | unsigned int num_adc_nids; | |
250 | hda_nid_t *adc_nids; | |
e1406348 | 251 | hda_nid_t *capsrc_nids; |
16ded525 | 252 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
1da177e4 LT |
253 | |
254 | /* capture source */ | |
a1e8d2da | 255 | unsigned int num_mux_defs; |
1da177e4 LT |
256 | const struct hda_input_mux *input_mux; |
257 | unsigned int cur_mux[3]; | |
258 | ||
259 | /* channel model */ | |
d2a6d7dc | 260 | const struct hda_channel_mode *channel_mode; |
1da177e4 | 261 | int num_channel_mode; |
4e195a7b | 262 | int need_dac_fix; |
1da177e4 LT |
263 | |
264 | /* PCM information */ | |
4c5186ed | 265 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
41e41f1f | 266 | |
e9edcee0 TI |
267 | /* dynamic controls, init_verbs and input_mux */ |
268 | struct auto_pin_cfg autocfg; | |
269 | unsigned int num_kctl_alloc, num_kctl_used; | |
c8b6bf9b | 270 | struct snd_kcontrol_new *kctl_alloc; |
e9edcee0 | 271 | struct hda_input_mux private_imux; |
41923e44 | 272 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
834be88d | 273 | |
ae6b813a TI |
274 | /* hooks */ |
275 | void (*init_hook)(struct hda_codec *codec); | |
276 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
277 | ||
834be88d TI |
278 | /* for pin sensing */ |
279 | unsigned int sense_updated: 1; | |
280 | unsigned int jack_present: 1; | |
bec15c3a | 281 | unsigned int master_sw: 1; |
cb53c626 | 282 | |
2134ea4f TI |
283 | /* for virtual master */ |
284 | hda_nid_t vmaster_nid; | |
cb53c626 TI |
285 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
286 | struct hda_loopback_check loopback; | |
287 | #endif | |
df694daa KY |
288 | }; |
289 | ||
290 | /* | |
291 | * configuration template - to be copied to the spec instance | |
292 | */ | |
293 | struct alc_config_preset { | |
9c7f852e TI |
294 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
295 | * with spec | |
296 | */ | |
df694daa KY |
297 | const struct hda_verb *init_verbs[5]; |
298 | unsigned int num_dacs; | |
299 | hda_nid_t *dac_nids; | |
300 | hda_nid_t dig_out_nid; /* optional */ | |
301 | hda_nid_t hp_nid; /* optional */ | |
302 | unsigned int num_adc_nids; | |
303 | hda_nid_t *adc_nids; | |
e1406348 | 304 | hda_nid_t *capsrc_nids; |
df694daa KY |
305 | hda_nid_t dig_in_nid; |
306 | unsigned int num_channel_mode; | |
307 | const struct hda_channel_mode *channel_mode; | |
4e195a7b | 308 | int need_dac_fix; |
a1e8d2da | 309 | unsigned int num_mux_defs; |
df694daa | 310 | const struct hda_input_mux *input_mux; |
ae6b813a TI |
311 | void (*unsol_event)(struct hda_codec *, unsigned int); |
312 | void (*init_hook)(struct hda_codec *); | |
cb53c626 TI |
313 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
314 | struct hda_amp_list *loopbacks; | |
315 | #endif | |
1da177e4 LT |
316 | }; |
317 | ||
1da177e4 LT |
318 | |
319 | /* | |
320 | * input MUX handling | |
321 | */ | |
9c7f852e TI |
322 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
323 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
324 | { |
325 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
326 | struct alc_spec *spec = codec->spec; | |
a1e8d2da JW |
327 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
328 | if (mux_idx >= spec->num_mux_defs) | |
329 | mux_idx = 0; | |
330 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | |
1da177e4 LT |
331 | } |
332 | ||
9c7f852e TI |
333 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
334 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
335 | { |
336 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
337 | struct alc_spec *spec = codec->spec; | |
338 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
339 | ||
340 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
341 | return 0; | |
342 | } | |
343 | ||
9c7f852e TI |
344 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
345 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
346 | { |
347 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
348 | struct alc_spec *spec = codec->spec; | |
349 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
a1e8d2da | 350 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
e1406348 TI |
351 | hda_nid_t nid = spec->capsrc_nids ? |
352 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
a1e8d2da | 353 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
e1406348 | 354 | nid, &spec->cur_mux[adc_idx]); |
1da177e4 LT |
355 | } |
356 | ||
e9edcee0 | 357 | |
1da177e4 LT |
358 | /* |
359 | * channel mode setting | |
360 | */ | |
9c7f852e TI |
361 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
362 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
363 | { |
364 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
365 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc TI |
366 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
367 | spec->num_channel_mode); | |
1da177e4 LT |
368 | } |
369 | ||
9c7f852e TI |
370 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
371 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
372 | { |
373 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
374 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc | 375 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
9c7f852e TI |
376 | spec->num_channel_mode, |
377 | spec->multiout.max_channels); | |
1da177e4 LT |
378 | } |
379 | ||
9c7f852e TI |
380 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
381 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
382 | { |
383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
384 | struct alc_spec *spec = codec->spec; | |
4e195a7b TI |
385 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
386 | spec->num_channel_mode, | |
387 | &spec->multiout.max_channels); | |
bd2033f2 | 388 | if (err >= 0 && spec->need_dac_fix) |
4e195a7b TI |
389 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
390 | return err; | |
1da177e4 LT |
391 | } |
392 | ||
a9430dd8 | 393 | /* |
4c5186ed JW |
394 | * Control the mode of pin widget settings via the mixer. "pc" is used |
395 | * instead of "%" to avoid consequences of accidently treating the % as | |
396 | * being part of a format specifier. Maximum allowed length of a value is | |
397 | * 63 characters plus NULL terminator. | |
7cf51e48 JW |
398 | * |
399 | * Note: some retasking pin complexes seem to ignore requests for input | |
400 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
401 | * are requested. Therefore order this list so that this behaviour will not | |
402 | * cause problems when mixer clients move through the enum sequentially. | |
a1e8d2da JW |
403 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
404 | * March 2006. | |
4c5186ed JW |
405 | */ |
406 | static char *alc_pin_mode_names[] = { | |
7cf51e48 JW |
407 | "Mic 50pc bias", "Mic 80pc bias", |
408 | "Line in", "Line out", "Headphone out", | |
4c5186ed JW |
409 | }; |
410 | static unsigned char alc_pin_mode_values[] = { | |
7cf51e48 | 411 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
4c5186ed JW |
412 | }; |
413 | /* The control can present all 5 options, or it can limit the options based | |
a1e8d2da JW |
414 | * in the pin being assumed to be exclusively an input or an output pin. In |
415 | * addition, "input" pins may or may not process the mic bias option | |
416 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
417 | * accept requests for bias as of chip versions up to March 2006) and/or | |
418 | * wiring in the computer. | |
a9430dd8 | 419 | */ |
a1e8d2da JW |
420 | #define ALC_PIN_DIR_IN 0x00 |
421 | #define ALC_PIN_DIR_OUT 0x01 | |
422 | #define ALC_PIN_DIR_INOUT 0x02 | |
423 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
424 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
4c5186ed | 425 | |
a1e8d2da | 426 | /* Info about the pin modes supported by the different pin direction modes. |
4c5186ed JW |
427 | * For each direction the minimum and maximum values are given. |
428 | */ | |
a1e8d2da | 429 | static signed char alc_pin_mode_dir_info[5][2] = { |
4c5186ed JW |
430 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
431 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
432 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
a1e8d2da JW |
433 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
434 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
4c5186ed JW |
435 | }; |
436 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
437 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
438 | #define alc_pin_mode_n_items(_dir) \ | |
439 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
440 | ||
9c7f852e TI |
441 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
442 | struct snd_ctl_elem_info *uinfo) | |
a9430dd8 | 443 | { |
4c5186ed JW |
444 | unsigned int item_num = uinfo->value.enumerated.item; |
445 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
446 | ||
447 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
a9430dd8 | 448 | uinfo->count = 1; |
4c5186ed JW |
449 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
450 | ||
451 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
452 | item_num = alc_pin_mode_min(dir); | |
453 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
a9430dd8 JW |
454 | return 0; |
455 | } | |
456 | ||
9c7f852e TI |
457 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
458 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 459 | { |
4c5186ed | 460 | unsigned int i; |
a9430dd8 JW |
461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
462 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed | 463 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
a9430dd8 | 464 | long *valp = ucontrol->value.integer.value; |
9c7f852e TI |
465 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
466 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
467 | 0x00); | |
a9430dd8 | 468 | |
4c5186ed JW |
469 | /* Find enumerated value for current pinctl setting */ |
470 | i = alc_pin_mode_min(dir); | |
9c7f852e | 471 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
4c5186ed | 472 | i++; |
9c7f852e | 473 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
a9430dd8 JW |
474 | return 0; |
475 | } | |
476 | ||
9c7f852e TI |
477 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
478 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 479 | { |
4c5186ed | 480 | signed int change; |
a9430dd8 JW |
481 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
482 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed JW |
483 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
484 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
485 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
486 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
487 | 0x00); | |
a9430dd8 | 488 | |
f12ab1e0 | 489 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
4c5186ed JW |
490 | val = alc_pin_mode_min(dir); |
491 | ||
492 | change = pinctl != alc_pin_mode_values[val]; | |
cdcd9268 JW |
493 | if (change) { |
494 | /* Set pin mode to that requested */ | |
82beb8fd TI |
495 | snd_hda_codec_write_cache(codec, nid, 0, |
496 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
497 | alc_pin_mode_values[val]); | |
cdcd9268 JW |
498 | |
499 | /* Also enable the retasking pin's input/output as required | |
500 | * for the requested pin mode. Enum values of 2 or less are | |
501 | * input modes. | |
502 | * | |
503 | * Dynamically switching the input/output buffers probably | |
a1e8d2da JW |
504 | * reduces noise slightly (particularly on input) so we'll |
505 | * do it. However, having both input and output buffers | |
506 | * enabled simultaneously doesn't seem to be problematic if | |
507 | * this turns out to be necessary in the future. | |
cdcd9268 JW |
508 | */ |
509 | if (val <= 2) { | |
47fd830a TI |
510 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
511 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
512 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
513 | HDA_AMP_MUTE, 0); | |
cdcd9268 | 514 | } else { |
47fd830a TI |
515 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
516 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
517 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
518 | HDA_AMP_MUTE, 0); | |
cdcd9268 JW |
519 | } |
520 | } | |
a9430dd8 JW |
521 | return change; |
522 | } | |
523 | ||
4c5186ed | 524 | #define ALC_PIN_MODE(xname, nid, dir) \ |
a9430dd8 | 525 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
4c5186ed JW |
526 | .info = alc_pin_mode_info, \ |
527 | .get = alc_pin_mode_get, \ | |
528 | .put = alc_pin_mode_put, \ | |
529 | .private_value = nid | (dir<<16) } | |
df694daa | 530 | |
5c8f858d JW |
531 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
532 | * together using a mask with more than one bit set. This control is | |
533 | * currently used only by the ALC260 test model. At this stage they are not | |
534 | * needed for any "production" models. | |
535 | */ | |
536 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 537 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
f12ab1e0 | 538 | |
9c7f852e TI |
539 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
540 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
541 | { |
542 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
543 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
544 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
545 | long *valp = ucontrol->value.integer.value; | |
9c7f852e TI |
546 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
547 | AC_VERB_GET_GPIO_DATA, 0x00); | |
5c8f858d JW |
548 | |
549 | *valp = (val & mask) != 0; | |
550 | return 0; | |
551 | } | |
9c7f852e TI |
552 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
553 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
554 | { |
555 | signed int change; | |
556 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
557 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
558 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
559 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
560 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
561 | AC_VERB_GET_GPIO_DATA, | |
562 | 0x00); | |
5c8f858d JW |
563 | |
564 | /* Set/unset the masked GPIO bit(s) as needed */ | |
9c7f852e TI |
565 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
566 | if (val == 0) | |
5c8f858d JW |
567 | gpio_data &= ~mask; |
568 | else | |
569 | gpio_data |= mask; | |
82beb8fd TI |
570 | snd_hda_codec_write_cache(codec, nid, 0, |
571 | AC_VERB_SET_GPIO_DATA, gpio_data); | |
5c8f858d JW |
572 | |
573 | return change; | |
574 | } | |
575 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
576 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
577 | .info = alc_gpio_data_info, \ | |
578 | .get = alc_gpio_data_get, \ | |
579 | .put = alc_gpio_data_put, \ | |
580 | .private_value = nid | (mask<<16) } | |
581 | #endif /* CONFIG_SND_DEBUG */ | |
582 | ||
92621f13 JW |
583 | /* A switch control to allow the enabling of the digital IO pins on the |
584 | * ALC260. This is incredibly simplistic; the intention of this control is | |
585 | * to provide something in the test model allowing digital outputs to be | |
586 | * identified if present. If models are found which can utilise these | |
587 | * outputs a more complete mixer control can be devised for those models if | |
588 | * necessary. | |
589 | */ | |
590 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 591 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
f12ab1e0 | 592 | |
9c7f852e TI |
593 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
594 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
595 | { |
596 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
597 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
598 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
599 | long *valp = ucontrol->value.integer.value; | |
9c7f852e | 600 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 601 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
92621f13 JW |
602 | |
603 | *valp = (val & mask) != 0; | |
604 | return 0; | |
605 | } | |
9c7f852e TI |
606 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
607 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
608 | { |
609 | signed int change; | |
610 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
611 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
612 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
613 | long val = *ucontrol->value.integer.value; | |
9c7f852e | 614 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 615 | AC_VERB_GET_DIGI_CONVERT_1, |
9c7f852e | 616 | 0x00); |
92621f13 JW |
617 | |
618 | /* Set/unset the masked control bit(s) as needed */ | |
9c7f852e | 619 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
92621f13 JW |
620 | if (val==0) |
621 | ctrl_data &= ~mask; | |
622 | else | |
623 | ctrl_data |= mask; | |
82beb8fd TI |
624 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
625 | ctrl_data); | |
92621f13 JW |
626 | |
627 | return change; | |
628 | } | |
629 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
630 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
631 | .info = alc_spdif_ctrl_info, \ | |
632 | .get = alc_spdif_ctrl_get, \ | |
633 | .put = alc_spdif_ctrl_put, \ | |
634 | .private_value = nid | (mask<<16) } | |
635 | #endif /* CONFIG_SND_DEBUG */ | |
636 | ||
f8225f6d JW |
637 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
638 | * Again, this is only used in the ALC26x test models to help identify when | |
639 | * the EAPD line must be asserted for features to work. | |
640 | */ | |
641 | #ifdef CONFIG_SND_DEBUG | |
642 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | |
643 | ||
644 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | |
645 | struct snd_ctl_elem_value *ucontrol) | |
646 | { | |
647 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
648 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
649 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
650 | long *valp = ucontrol->value.integer.value; | |
651 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
652 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | |
653 | ||
654 | *valp = (val & mask) != 0; | |
655 | return 0; | |
656 | } | |
657 | ||
658 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |
659 | struct snd_ctl_elem_value *ucontrol) | |
660 | { | |
661 | int change; | |
662 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
663 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
664 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
665 | long val = *ucontrol->value.integer.value; | |
666 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
667 | AC_VERB_GET_EAPD_BTLENABLE, | |
668 | 0x00); | |
669 | ||
670 | /* Set/unset the masked control bit(s) as needed */ | |
671 | change = (!val ? 0 : mask) != (ctrl_data & mask); | |
672 | if (!val) | |
673 | ctrl_data &= ~mask; | |
674 | else | |
675 | ctrl_data |= mask; | |
676 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
677 | ctrl_data); | |
678 | ||
679 | return change; | |
680 | } | |
681 | ||
682 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | |
683 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
684 | .info = alc_eapd_ctrl_info, \ | |
685 | .get = alc_eapd_ctrl_get, \ | |
686 | .put = alc_eapd_ctrl_put, \ | |
687 | .private_value = nid | (mask<<16) } | |
688 | #endif /* CONFIG_SND_DEBUG */ | |
689 | ||
df694daa KY |
690 | /* |
691 | * set up from the preset table | |
692 | */ | |
9c7f852e TI |
693 | static void setup_preset(struct alc_spec *spec, |
694 | const struct alc_config_preset *preset) | |
df694daa KY |
695 | { |
696 | int i; | |
697 | ||
698 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
699 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; | |
9c7f852e TI |
700 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
701 | i++) | |
702 | spec->init_verbs[spec->num_init_verbs++] = | |
703 | preset->init_verbs[i]; | |
df694daa KY |
704 | |
705 | spec->channel_mode = preset->channel_mode; | |
706 | spec->num_channel_mode = preset->num_channel_mode; | |
4e195a7b | 707 | spec->need_dac_fix = preset->need_dac_fix; |
df694daa KY |
708 | |
709 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
710 | ||
711 | spec->multiout.num_dacs = preset->num_dacs; | |
712 | spec->multiout.dac_nids = preset->dac_nids; | |
713 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
714 | spec->multiout.hp_nid = preset->hp_nid; | |
715 | ||
a1e8d2da | 716 | spec->num_mux_defs = preset->num_mux_defs; |
f12ab1e0 | 717 | if (!spec->num_mux_defs) |
a1e8d2da | 718 | spec->num_mux_defs = 1; |
df694daa KY |
719 | spec->input_mux = preset->input_mux; |
720 | ||
721 | spec->num_adc_nids = preset->num_adc_nids; | |
722 | spec->adc_nids = preset->adc_nids; | |
e1406348 | 723 | spec->capsrc_nids = preset->capsrc_nids; |
df694daa | 724 | spec->dig_in_nid = preset->dig_in_nid; |
ae6b813a TI |
725 | |
726 | spec->unsol_event = preset->unsol_event; | |
727 | spec->init_hook = preset->init_hook; | |
cb53c626 TI |
728 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
729 | spec->loopback.amplist = preset->loopbacks; | |
730 | #endif | |
df694daa KY |
731 | } |
732 | ||
bc9f98a9 KY |
733 | /* Enable GPIO mask and set output */ |
734 | static struct hda_verb alc_gpio1_init_verbs[] = { | |
735 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
736 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
737 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
738 | { } | |
739 | }; | |
740 | ||
741 | static struct hda_verb alc_gpio2_init_verbs[] = { | |
742 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
743 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
744 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
745 | { } | |
746 | }; | |
747 | ||
bdd148a3 KY |
748 | static struct hda_verb alc_gpio3_init_verbs[] = { |
749 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
750 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
751 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
752 | { } | |
753 | }; | |
754 | ||
c9b58006 KY |
755 | static void alc_sku_automute(struct hda_codec *codec) |
756 | { | |
757 | struct alc_spec *spec = codec->spec; | |
c9b58006 KY |
758 | unsigned int present; |
759 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; | |
760 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; | |
761 | ||
762 | /* need to execute and sync at first */ | |
763 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); | |
764 | present = snd_hda_codec_read(codec, hp_nid, 0, | |
765 | AC_VERB_GET_PIN_SENSE, 0); | |
766 | spec->jack_present = (present & 0x80000000) != 0; | |
f6c7e546 TI |
767 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
768 | spec->jack_present ? 0 : PIN_OUT); | |
c9b58006 KY |
769 | } |
770 | ||
771 | /* unsolicited event for HP jack sensing */ | |
772 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |
773 | { | |
774 | if (codec->vendor_id == 0x10ec0880) | |
775 | res >>= 28; | |
776 | else | |
777 | res >>= 26; | |
778 | if (res != ALC880_HP_EVENT) | |
779 | return; | |
780 | ||
781 | alc_sku_automute(codec); | |
782 | } | |
783 | ||
f9423e7a KY |
784 | /* additional initialization for ALC888 variants */ |
785 | static void alc888_coef_init(struct hda_codec *codec) | |
786 | { | |
787 | unsigned int tmp; | |
788 | ||
789 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | |
790 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
791 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
792 | if ((tmp & 0xf0) == 2) | |
793 | /* alc888S-VC */ | |
794 | snd_hda_codec_read(codec, 0x20, 0, | |
795 | AC_VERB_SET_PROC_COEF, 0x830); | |
796 | else | |
797 | /* alc888-VB */ | |
798 | snd_hda_codec_read(codec, 0x20, 0, | |
799 | AC_VERB_SET_PROC_COEF, 0x3030); | |
800 | } | |
801 | ||
bc9f98a9 KY |
802 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
803 | * 31 ~ 16 : Manufacture ID | |
804 | * 15 ~ 8 : SKU ID | |
805 | * 7 ~ 0 : Assembly ID | |
806 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
807 | */ | |
808 | static void alc_subsystem_id(struct hda_codec *codec, | |
809 | unsigned int porta, unsigned int porte, | |
810 | unsigned int portd) | |
811 | { | |
c9b58006 KY |
812 | unsigned int ass, tmp, i; |
813 | unsigned nid; | |
814 | struct alc_spec *spec = codec->spec; | |
bc9f98a9 | 815 | |
c9b58006 KY |
816 | ass = codec->subsystem_id & 0xffff; |
817 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
818 | goto do_sku; | |
819 | ||
820 | /* | |
821 | * 31~30 : port conetcivity | |
822 | * 29~21 : reserve | |
823 | * 20 : PCBEEP input | |
824 | * 19~16 : Check sum (15:1) | |
825 | * 15~1 : Custom | |
826 | * 0 : override | |
827 | */ | |
828 | nid = 0x1d; | |
829 | if (codec->vendor_id == 0x10ec0260) | |
830 | nid = 0x17; | |
831 | ass = snd_hda_codec_read(codec, nid, 0, | |
832 | AC_VERB_GET_CONFIG_DEFAULT, 0); | |
833 | if (!(ass & 1) && !(ass & 0x100000)) | |
834 | return; | |
835 | if ((ass >> 30) != 1) /* no physical connection */ | |
bc9f98a9 KY |
836 | return; |
837 | ||
c9b58006 KY |
838 | /* check sum */ |
839 | tmp = 0; | |
840 | for (i = 1; i < 16; i++) { | |
8c427226 | 841 | if ((ass >> i) & 1) |
c9b58006 KY |
842 | tmp++; |
843 | } | |
844 | if (((ass >> 16) & 0xf) != tmp) | |
845 | return; | |
846 | do_sku: | |
847 | /* | |
848 | * 0 : override | |
849 | * 1 : Swap Jack | |
850 | * 2 : 0 --> Desktop, 1 --> Laptop | |
851 | * 3~5 : External Amplifier control | |
852 | * 7~6 : Reserved | |
853 | */ | |
bc9f98a9 KY |
854 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
855 | switch (tmp) { | |
856 | case 1: | |
857 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); | |
858 | break; | |
859 | case 3: | |
860 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); | |
861 | break; | |
bdd148a3 KY |
862 | case 7: |
863 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); | |
864 | break; | |
c9b58006 | 865 | case 5: /* set EAPD output high */ |
bdd148a3 | 866 | switch (codec->vendor_id) { |
c9b58006 KY |
867 | case 0x10ec0260: |
868 | snd_hda_codec_write(codec, 0x0f, 0, | |
869 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
870 | snd_hda_codec_write(codec, 0x10, 0, | |
871 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
872 | break; | |
873 | case 0x10ec0262: | |
bdd148a3 KY |
874 | case 0x10ec0267: |
875 | case 0x10ec0268: | |
c9b58006 | 876 | case 0x10ec0269: |
f9423e7a KY |
877 | case 0x10ec0660: |
878 | case 0x10ec0662: | |
879 | case 0x10ec0663: | |
c9b58006 | 880 | case 0x10ec0862: |
20a3a05d | 881 | case 0x10ec0889: |
bdd148a3 KY |
882 | snd_hda_codec_write(codec, 0x14, 0, |
883 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
884 | snd_hda_codec_write(codec, 0x15, 0, | |
885 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
c9b58006 | 886 | break; |
bdd148a3 | 887 | } |
c9b58006 KY |
888 | switch (codec->vendor_id) { |
889 | case 0x10ec0260: | |
890 | snd_hda_codec_write(codec, 0x1a, 0, | |
891 | AC_VERB_SET_COEF_INDEX, 7); | |
892 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | |
893 | AC_VERB_GET_PROC_COEF, 0); | |
894 | snd_hda_codec_write(codec, 0x1a, 0, | |
895 | AC_VERB_SET_COEF_INDEX, 7); | |
896 | snd_hda_codec_write(codec, 0x1a, 0, | |
897 | AC_VERB_SET_PROC_COEF, | |
898 | tmp | 0x2010); | |
899 | break; | |
900 | case 0x10ec0262: | |
901 | case 0x10ec0880: | |
902 | case 0x10ec0882: | |
903 | case 0x10ec0883: | |
904 | case 0x10ec0885: | |
20a3a05d | 905 | case 0x10ec0889: |
c9b58006 KY |
906 | snd_hda_codec_write(codec, 0x20, 0, |
907 | AC_VERB_SET_COEF_INDEX, 7); | |
908 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
909 | AC_VERB_GET_PROC_COEF, 0); | |
910 | snd_hda_codec_write(codec, 0x20, 0, | |
911 | AC_VERB_SET_COEF_INDEX, 7); | |
912 | snd_hda_codec_write(codec, 0x20, 0, | |
913 | AC_VERB_SET_PROC_COEF, | |
914 | tmp | 0x2010); | |
915 | break; | |
f9423e7a KY |
916 | case 0x10ec0888: |
917 | alc888_coef_init(codec); | |
918 | break; | |
c9b58006 KY |
919 | case 0x10ec0267: |
920 | case 0x10ec0268: | |
921 | snd_hda_codec_write(codec, 0x20, 0, | |
922 | AC_VERB_SET_COEF_INDEX, 7); | |
923 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
924 | AC_VERB_GET_PROC_COEF, 0); | |
925 | snd_hda_codec_write(codec, 0x20, 0, | |
926 | AC_VERB_SET_COEF_INDEX, 7); | |
927 | snd_hda_codec_write(codec, 0x20, 0, | |
928 | AC_VERB_SET_PROC_COEF, | |
929 | tmp | 0x3000); | |
930 | break; | |
bc9f98a9 | 931 | } |
c9b58006 | 932 | default: |
bc9f98a9 KY |
933 | break; |
934 | } | |
c9b58006 | 935 | |
8c427226 | 936 | /* is laptop or Desktop and enable the function "Mute internal speaker |
c9b58006 KY |
937 | * when the external headphone out jack is plugged" |
938 | */ | |
8c427226 | 939 | if (!(ass & 0x8000)) |
c9b58006 KY |
940 | return; |
941 | /* | |
942 | * 10~8 : Jack location | |
943 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
944 | * 14~13: Resvered | |
945 | * 15 : 1 --> enable the function "Mute internal speaker | |
946 | * when the external headphone out jack is plugged" | |
947 | */ | |
948 | if (!spec->autocfg.speaker_pins[0]) { | |
8c427226 | 949 | if (spec->autocfg.line_out_pins[0]) |
c9b58006 | 950 | spec->autocfg.speaker_pins[0] = |
8c427226 | 951 | spec->autocfg.line_out_pins[0]; |
c9b58006 KY |
952 | else |
953 | return; | |
954 | } | |
955 | ||
956 | if (!spec->autocfg.hp_pins[0]) { | |
957 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | |
958 | if (tmp == 0) | |
959 | spec->autocfg.hp_pins[0] = porta; | |
960 | else if (tmp == 1) | |
961 | spec->autocfg.hp_pins[0] = porte; | |
962 | else if (tmp == 2) | |
963 | spec->autocfg.hp_pins[0] = portd; | |
964 | else | |
965 | return; | |
966 | } | |
967 | ||
968 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, | |
969 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
970 | AC_USRSP_EN | ALC880_HP_EVENT); | |
971 | spec->unsol_event = alc_sku_unsol_event; | |
bc9f98a9 KY |
972 | } |
973 | ||
f95474ec TI |
974 | /* |
975 | * Fix-up pin default configurations | |
976 | */ | |
977 | ||
978 | struct alc_pincfg { | |
979 | hda_nid_t nid; | |
980 | u32 val; | |
981 | }; | |
982 | ||
983 | static void alc_fix_pincfg(struct hda_codec *codec, | |
984 | const struct snd_pci_quirk *quirk, | |
985 | const struct alc_pincfg **pinfix) | |
986 | { | |
987 | const struct alc_pincfg *cfg; | |
988 | ||
989 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
990 | if (!quirk) | |
991 | return; | |
992 | ||
993 | cfg = pinfix[quirk->value]; | |
994 | for (; cfg->nid; cfg++) { | |
995 | int i; | |
996 | u32 val = cfg->val; | |
997 | for (i = 0; i < 4; i++) { | |
998 | snd_hda_codec_write(codec, cfg->nid, 0, | |
999 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, | |
1000 | val & 0xff); | |
1001 | val >>= 8; | |
1002 | } | |
1003 | } | |
1004 | } | |
1005 | ||
1da177e4 | 1006 | /* |
e9edcee0 TI |
1007 | * ALC880 3-stack model |
1008 | * | |
1009 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
9c7f852e TI |
1010 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
1011 | * F-Mic = 0x1b, HP = 0x19 | |
1da177e4 LT |
1012 | */ |
1013 | ||
e9edcee0 TI |
1014 | static hda_nid_t alc880_dac_nids[4] = { |
1015 | /* front, rear, clfe, rear_surr */ | |
1016 | 0x02, 0x05, 0x04, 0x03 | |
1017 | }; | |
1018 | ||
1019 | static hda_nid_t alc880_adc_nids[3] = { | |
1020 | /* ADC0-2 */ | |
1021 | 0x07, 0x08, 0x09, | |
1022 | }; | |
1023 | ||
1024 | /* The datasheet says the node 0x07 is connected from inputs, | |
1025 | * but it shows zero connection in the real implementation on some devices. | |
df694daa | 1026 | * Note: this is a 915GAV bug, fixed on 915GLV |
1da177e4 | 1027 | */ |
e9edcee0 TI |
1028 | static hda_nid_t alc880_adc_nids_alt[2] = { |
1029 | /* ADC1-2 */ | |
1030 | 0x08, 0x09, | |
1031 | }; | |
1032 | ||
1033 | #define ALC880_DIGOUT_NID 0x06 | |
1034 | #define ALC880_DIGIN_NID 0x0a | |
1035 | ||
1036 | static struct hda_input_mux alc880_capture_source = { | |
1037 | .num_items = 4, | |
1038 | .items = { | |
1039 | { "Mic", 0x0 }, | |
1040 | { "Front Mic", 0x3 }, | |
1041 | { "Line", 0x2 }, | |
1042 | { "CD", 0x4 }, | |
1043 | }, | |
1044 | }; | |
1045 | ||
1046 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
1047 | /* 2ch mode */ | |
1048 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
1049 | /* set line-in to input, mute it */ | |
1050 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1051 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1052 | /* set mic-in to input vref 80%, mute it */ | |
1053 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1054 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1055 | { } /* end */ | |
1056 | }; | |
1057 | ||
1058 | /* 6ch mode */ | |
1059 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
1060 | /* set line-in to output, unmute it */ | |
1061 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1062 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1063 | /* set mic-in to output, unmute it */ | |
1064 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1065 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1066 | { } /* end */ | |
1067 | }; | |
1068 | ||
d2a6d7dc | 1069 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
e9edcee0 TI |
1070 | { 2, alc880_threestack_ch2_init }, |
1071 | { 6, alc880_threestack_ch6_init }, | |
1072 | }; | |
1073 | ||
c8b6bf9b | 1074 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
05acb863 | 1075 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1076 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 1077 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 1078 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
05acb863 TI |
1079 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1080 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1081 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1082 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1da177e4 LT |
1083 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1084 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1085 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1086 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1087 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1088 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1089 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
1090 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
1091 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1092 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
e9edcee0 TI |
1093 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
1094 | { | |
1095 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1096 | .name = "Channel Mode", | |
df694daa KY |
1097 | .info = alc_ch_mode_info, |
1098 | .get = alc_ch_mode_get, | |
1099 | .put = alc_ch_mode_put, | |
e9edcee0 TI |
1100 | }, |
1101 | { } /* end */ | |
1102 | }; | |
1103 | ||
1104 | /* capture mixer elements */ | |
c8b6bf9b | 1105 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
e9edcee0 TI |
1106 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
1107 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
1108 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), | |
1109 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), | |
1110 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), | |
1111 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), | |
1da177e4 LT |
1112 | { |
1113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1114 | /* The multiple "Capture Source" controls confuse alsamixer | |
1115 | * So call somewhat different.. | |
1da177e4 LT |
1116 | */ |
1117 | /* .name = "Capture Source", */ | |
1118 | .name = "Input Source", | |
e9edcee0 | 1119 | .count = 3, |
1da177e4 LT |
1120 | .info = alc_mux_enum_info, |
1121 | .get = alc_mux_enum_get, | |
1122 | .put = alc_mux_enum_put, | |
1123 | }, | |
1da177e4 LT |
1124 | { } /* end */ |
1125 | }; | |
1126 | ||
e9edcee0 | 1127 | /* capture mixer elements (in case NID 0x07 not available) */ |
c8b6bf9b | 1128 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
71fe7b82 TI |
1129 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
1130 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
1131 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
1132 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
1da177e4 LT |
1133 | { |
1134 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1135 | /* The multiple "Capture Source" controls confuse alsamixer | |
1136 | * So call somewhat different.. | |
1da177e4 LT |
1137 | */ |
1138 | /* .name = "Capture Source", */ | |
1139 | .name = "Input Source", | |
1140 | .count = 2, | |
1141 | .info = alc_mux_enum_info, | |
1142 | .get = alc_mux_enum_get, | |
1143 | .put = alc_mux_enum_put, | |
1144 | }, | |
1da177e4 LT |
1145 | { } /* end */ |
1146 | }; | |
1147 | ||
e9edcee0 TI |
1148 | |
1149 | ||
1150 | /* | |
1151 | * ALC880 5-stack model | |
1152 | * | |
9c7f852e TI |
1153 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
1154 | * Side = 0x02 (0xd) | |
e9edcee0 TI |
1155 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
1156 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
1157 | */ | |
1158 | ||
1159 | /* additional mixers to alc880_three_stack_mixer */ | |
c8b6bf9b | 1160 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
e9edcee0 | 1161 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1162 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
1da177e4 LT |
1163 | { } /* end */ |
1164 | }; | |
1165 | ||
e9edcee0 TI |
1166 | /* channel source setting (6/8 channel selection for 5-stack) */ |
1167 | /* 6ch mode */ | |
1168 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
1169 | /* set line-in to input, mute it */ | |
1170 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1171 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
dfc0ff62 TI |
1172 | { } /* end */ |
1173 | }; | |
1174 | ||
e9edcee0 TI |
1175 | /* 8ch mode */ |
1176 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
1177 | /* set line-in to output, unmute it */ | |
1178 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1179 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1180 | { } /* end */ | |
1181 | }; | |
1182 | ||
d2a6d7dc | 1183 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
e9edcee0 TI |
1184 | { 6, alc880_fivestack_ch6_init }, |
1185 | { 8, alc880_fivestack_ch8_init }, | |
1186 | }; | |
1187 | ||
1188 | ||
1189 | /* | |
1190 | * ALC880 6-stack model | |
1191 | * | |
9c7f852e TI |
1192 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
1193 | * Side = 0x05 (0x0f) | |
e9edcee0 TI |
1194 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
1195 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
1196 | */ | |
1197 | ||
1198 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
1199 | /* front, rear, clfe, rear_surr */ | |
1200 | 0x02, 0x03, 0x04, 0x05 | |
f12ab1e0 | 1201 | }; |
e9edcee0 TI |
1202 | |
1203 | static struct hda_input_mux alc880_6stack_capture_source = { | |
1204 | .num_items = 4, | |
1205 | .items = { | |
1206 | { "Mic", 0x0 }, | |
1207 | { "Front Mic", 0x1 }, | |
1208 | { "Line", 0x2 }, | |
1209 | { "CD", 0x4 }, | |
1210 | }, | |
1211 | }; | |
1212 | ||
1213 | /* fixed 8-channels */ | |
d2a6d7dc | 1214 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
e9edcee0 TI |
1215 | { 8, NULL }, |
1216 | }; | |
1217 | ||
c8b6bf9b | 1218 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
16ded525 | 1219 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1220 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1221 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1222 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1223 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1224 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1225 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1226 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 | 1227 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 1228 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
16ded525 TI |
1229 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1230 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1231 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1232 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1233 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1234 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1235 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1236 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1237 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1238 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
16ded525 TI |
1239 | { |
1240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1241 | .name = "Channel Mode", | |
df694daa KY |
1242 | .info = alc_ch_mode_info, |
1243 | .get = alc_ch_mode_get, | |
1244 | .put = alc_ch_mode_put, | |
16ded525 TI |
1245 | }, |
1246 | { } /* end */ | |
1247 | }; | |
1248 | ||
e9edcee0 TI |
1249 | |
1250 | /* | |
1251 | * ALC880 W810 model | |
1252 | * | |
1253 | * W810 has rear IO for: | |
1254 | * Front (DAC 02) | |
1255 | * Surround (DAC 03) | |
1256 | * Center/LFE (DAC 04) | |
1257 | * Digital out (06) | |
1258 | * | |
1259 | * The system also has a pair of internal speakers, and a headphone jack. | |
1260 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
1261 | * | |
1262 | * There is a variable resistor to control the speaker or headphone | |
1263 | * volume. This is a hardware-only device without a software API. | |
1264 | * | |
1265 | * Plugging headphones in will disable the internal speakers. This is | |
1266 | * implemented in hardware, not via the driver using jack sense. In | |
1267 | * a similar fashion, plugging into the rear socket marked "front" will | |
1268 | * disable both the speakers and headphones. | |
1269 | * | |
1270 | * For input, there's a microphone jack, and an "audio in" jack. | |
1271 | * These may not do anything useful with this driver yet, because I | |
1272 | * haven't setup any initialization verbs for these yet... | |
1273 | */ | |
1274 | ||
1275 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
1276 | /* front, rear/surround, clfe */ | |
1277 | 0x02, 0x03, 0x04 | |
16ded525 TI |
1278 | }; |
1279 | ||
e9edcee0 | 1280 | /* fixed 6 channels */ |
d2a6d7dc | 1281 | static struct hda_channel_mode alc880_w810_modes[1] = { |
e9edcee0 TI |
1282 | { 6, NULL } |
1283 | }; | |
1284 | ||
1285 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
c8b6bf9b | 1286 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
16ded525 | 1287 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1288 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1289 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1290 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1291 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1292 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1293 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1294 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
e9edcee0 TI |
1295 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
1296 | { } /* end */ | |
1297 | }; | |
1298 | ||
1299 | ||
1300 | /* | |
1301 | * Z710V model | |
1302 | * | |
1303 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
9c7f852e TI |
1304 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
1305 | * Line = 0x1a | |
e9edcee0 TI |
1306 | */ |
1307 | ||
1308 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
1309 | 0x02 | |
1310 | }; | |
1311 | #define ALC880_Z71V_HP_DAC 0x03 | |
1312 | ||
1313 | /* fixed 2 channels */ | |
d2a6d7dc | 1314 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
e9edcee0 TI |
1315 | { 2, NULL } |
1316 | }; | |
1317 | ||
c8b6bf9b | 1318 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
e9edcee0 | 1319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1320 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
e9edcee0 | 1321 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1322 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16ded525 TI |
1325 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1326 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
1327 | { } /* end */ |
1328 | }; | |
1329 | ||
e9edcee0 | 1330 | |
e9edcee0 TI |
1331 | /* |
1332 | * ALC880 F1734 model | |
1333 | * | |
1334 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
1335 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
1336 | */ | |
1337 | ||
1338 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
1339 | 0x03 | |
1340 | }; | |
1341 | #define ALC880_F1734_HP_DAC 0x02 | |
1342 | ||
c8b6bf9b | 1343 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
e9edcee0 | 1344 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1345 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
2134ea4f TI |
1346 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
1347 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
e9edcee0 TI |
1348 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1349 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
937b4160 TI |
1350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
1351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e9edcee0 TI |
1352 | { } /* end */ |
1353 | }; | |
1354 | ||
937b4160 TI |
1355 | static struct hda_input_mux alc880_f1734_capture_source = { |
1356 | .num_items = 2, | |
1357 | .items = { | |
1358 | { "Mic", 0x1 }, | |
1359 | { "CD", 0x4 }, | |
1360 | }, | |
1361 | }; | |
1362 | ||
e9edcee0 | 1363 | |
e9edcee0 TI |
1364 | /* |
1365 | * ALC880 ASUS model | |
1366 | * | |
1367 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
1368 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
1369 | * Mic = 0x18, Line = 0x1a | |
1370 | */ | |
1371 | ||
1372 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
1373 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
1374 | ||
c8b6bf9b | 1375 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
16ded525 | 1376 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1377 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1378 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1379 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1380 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1381 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1382 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1383 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 TI |
1384 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1385 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1386 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1387 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16ded525 TI |
1388 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1389 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
1390 | { |
1391 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1392 | .name = "Channel Mode", | |
df694daa KY |
1393 | .info = alc_ch_mode_info, |
1394 | .get = alc_ch_mode_get, | |
1395 | .put = alc_ch_mode_put, | |
16ded525 TI |
1396 | }, |
1397 | { } /* end */ | |
1398 | }; | |
e9edcee0 | 1399 | |
e9edcee0 TI |
1400 | /* |
1401 | * ALC880 ASUS W1V model | |
1402 | * | |
1403 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
1404 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
1405 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
1406 | */ | |
1407 | ||
1408 | /* additional mixers to alc880_asus_mixer */ | |
c8b6bf9b | 1409 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
e9edcee0 TI |
1410 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
1411 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
1412 | { } /* end */ | |
1413 | }; | |
1414 | ||
3c10a9d9 | 1415 | /* additional mixers to alc880_asus_mixer */ |
c8b6bf9b | 1416 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
3c10a9d9 TI |
1417 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
1418 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1419 | { } /* end */ | |
1420 | }; | |
e9edcee0 | 1421 | |
df694daa KY |
1422 | /* TCL S700 */ |
1423 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
1424 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1425 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
1426 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
1427 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
1428 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
1429 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
1430 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
1431 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
1432 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
1433 | { | |
1434 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1435 | /* The multiple "Capture Source" controls confuse alsamixer | |
1436 | * So call somewhat different.. | |
df694daa KY |
1437 | */ |
1438 | /* .name = "Capture Source", */ | |
1439 | .name = "Input Source", | |
1440 | .count = 1, | |
1441 | .info = alc_mux_enum_info, | |
1442 | .get = alc_mux_enum_get, | |
1443 | .put = alc_mux_enum_put, | |
1444 | }, | |
1445 | { } /* end */ | |
1446 | }; | |
1447 | ||
ccc656ce KY |
1448 | /* Uniwill */ |
1449 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2134ea4f TI |
1450 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
1451 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1452 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1453 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
1454 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1455 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1456 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1457 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1458 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1459 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1460 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1461 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1464 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1465 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1466 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1467 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1468 | { | |
1469 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1470 | .name = "Channel Mode", | |
1471 | .info = alc_ch_mode_info, | |
1472 | .get = alc_ch_mode_get, | |
1473 | .put = alc_ch_mode_put, | |
1474 | }, | |
1475 | { } /* end */ | |
1476 | }; | |
1477 | ||
2cf9f0fc TD |
1478 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
1479 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1480 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1481 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1482 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
1483 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1484 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1485 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1486 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1487 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1488 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1489 | { } /* end */ | |
1490 | }; | |
1491 | ||
ccc656ce | 1492 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
2134ea4f TI |
1493 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
1494 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1495 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1496 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
1497 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1498 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1499 | { } /* end */ | |
1500 | }; | |
1501 | ||
2134ea4f TI |
1502 | /* |
1503 | * virtual master controls | |
1504 | */ | |
1505 | ||
1506 | /* | |
1507 | * slave controls for virtual master | |
1508 | */ | |
1509 | static const char *alc_slave_vols[] = { | |
1510 | "Front Playback Volume", | |
1511 | "Surround Playback Volume", | |
1512 | "Center Playback Volume", | |
1513 | "LFE Playback Volume", | |
1514 | "Side Playback Volume", | |
1515 | "Headphone Playback Volume", | |
1516 | "Speaker Playback Volume", | |
1517 | "Mono Playback Volume", | |
2134ea4f TI |
1518 | "Line-Out Playback Volume", |
1519 | NULL, | |
1520 | }; | |
1521 | ||
1522 | static const char *alc_slave_sws[] = { | |
1523 | "Front Playback Switch", | |
1524 | "Surround Playback Switch", | |
1525 | "Center Playback Switch", | |
1526 | "LFE Playback Switch", | |
1527 | "Side Playback Switch", | |
1528 | "Headphone Playback Switch", | |
1529 | "Speaker Playback Switch", | |
1530 | "Mono Playback Switch", | |
edb54a55 | 1531 | "IEC958 Playback Switch", |
2134ea4f TI |
1532 | NULL, |
1533 | }; | |
1534 | ||
1da177e4 | 1535 | /* |
e9edcee0 | 1536 | * build control elements |
1da177e4 LT |
1537 | */ |
1538 | static int alc_build_controls(struct hda_codec *codec) | |
1539 | { | |
1540 | struct alc_spec *spec = codec->spec; | |
1541 | int err; | |
1542 | int i; | |
1543 | ||
1544 | for (i = 0; i < spec->num_mixers; i++) { | |
1545 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
1546 | if (err < 0) | |
1547 | return err; | |
1548 | } | |
1549 | ||
1550 | if (spec->multiout.dig_out_nid) { | |
9c7f852e TI |
1551 | err = snd_hda_create_spdif_out_ctls(codec, |
1552 | spec->multiout.dig_out_nid); | |
1da177e4 LT |
1553 | if (err < 0) |
1554 | return err; | |
9a08160b TI |
1555 | err = snd_hda_create_spdif_share_sw(codec, |
1556 | &spec->multiout); | |
1557 | if (err < 0) | |
1558 | return err; | |
1559 | spec->multiout.share_spdif = 1; | |
1da177e4 LT |
1560 | } |
1561 | if (spec->dig_in_nid) { | |
1562 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
1563 | if (err < 0) | |
1564 | return err; | |
1565 | } | |
2134ea4f TI |
1566 | |
1567 | /* if we have no master control, let's create it */ | |
1568 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
1c82ed1b | 1569 | unsigned int vmaster_tlv[4]; |
2134ea4f | 1570 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
1c82ed1b | 1571 | HDA_OUTPUT, vmaster_tlv); |
2134ea4f | 1572 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1c82ed1b | 1573 | vmaster_tlv, alc_slave_vols); |
2134ea4f TI |
1574 | if (err < 0) |
1575 | return err; | |
1576 | } | |
1577 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
1578 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | |
1579 | NULL, alc_slave_sws); | |
1580 | if (err < 0) | |
1581 | return err; | |
1582 | } | |
1583 | ||
1da177e4 LT |
1584 | return 0; |
1585 | } | |
1586 | ||
e9edcee0 | 1587 | |
1da177e4 LT |
1588 | /* |
1589 | * initialize the codec volumes, etc | |
1590 | */ | |
1591 | ||
e9edcee0 TI |
1592 | /* |
1593 | * generic initialization of ADC, input mixers and output mixers | |
1594 | */ | |
1595 | static struct hda_verb alc880_volume_init_verbs[] = { | |
1596 | /* | |
1597 | * Unmute ADC0-2 and set the default input to mic-in | |
1598 | */ | |
71fe7b82 | 1599 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1600 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 1601 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1602 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 1603 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1604 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 1605 | |
e9edcee0 TI |
1606 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
1607 | * mixer widget | |
9c7f852e TI |
1608 | * Note: PASD motherboards uses the Line In 2 as the input for front |
1609 | * panel mic (mic 2) | |
1da177e4 | 1610 | */ |
e9edcee0 | 1611 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
cb53c626 TI |
1612 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1613 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1614 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
1615 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
1616 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1617 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
1618 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
1da177e4 | 1619 | |
e9edcee0 TI |
1620 | /* |
1621 | * Set up output mixers (0x0c - 0x0f) | |
1da177e4 | 1622 | */ |
e9edcee0 TI |
1623 | /* set vol=0 to output mixers */ |
1624 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1625 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1626 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1627 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1628 | /* set up input amps for analog loopback */ | |
1629 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
05acb863 TI |
1630 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1631 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1632 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1633 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1634 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1635 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1636 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1637 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
1638 | |
1639 | { } | |
1640 | }; | |
1641 | ||
e9edcee0 TI |
1642 | /* |
1643 | * 3-stack pin configuration: | |
1644 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
1645 | */ | |
1646 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
1647 | /* | |
1648 | * preset connection lists of input pins | |
1649 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1650 | */ | |
1651 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
1652 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1653 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
1654 | ||
1655 | /* | |
1656 | * Set pin mode and muting | |
1657 | */ | |
1658 | /* set front pin widgets 0x14 for output */ | |
05acb863 | 1659 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
1660 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1661 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1662 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1663 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1664 | /* Mic2 (as headphone out) for HP output */ | |
1665 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1666 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1da177e4 | 1667 | /* Line In pin widget for input */ |
05acb863 | 1668 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
1669 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1670 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
1671 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1672 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1da177e4 | 1673 | /* CD pin widget for input */ |
05acb863 | 1674 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 1675 | |
e9edcee0 TI |
1676 | { } |
1677 | }; | |
1da177e4 | 1678 | |
e9edcee0 TI |
1679 | /* |
1680 | * 5-stack pin configuration: | |
1681 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
1682 | * line-in/side = 0x1a, f-mic = 0x1b | |
1683 | */ | |
1684 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
1685 | /* | |
1686 | * preset connection lists of input pins | |
1687 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1da177e4 | 1688 | */ |
e9edcee0 TI |
1689 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
1690 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
1da177e4 | 1691 | |
e9edcee0 TI |
1692 | /* |
1693 | * Set pin mode and muting | |
1da177e4 | 1694 | */ |
e9edcee0 TI |
1695 | /* set pin widgets 0x14-0x17 for output */ |
1696 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1697 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1698 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1699 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1700 | /* unmute pins for output (no gain on this amp) */ | |
1701 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1702 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1703 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1704 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1705 | ||
1706 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1707 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1708 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1709 | /* Mic2 (as headphone out) for HP output */ | |
1710 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1711 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1712 | /* Line In pin widget for input */ | |
1713 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1714 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1715 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
1716 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1717 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1718 | /* CD pin widget for input */ | |
1719 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1da177e4 LT |
1720 | |
1721 | { } | |
1722 | }; | |
1723 | ||
e9edcee0 TI |
1724 | /* |
1725 | * W810 pin configuration: | |
1726 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
1727 | */ | |
1728 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
1729 | /* hphone/speaker input selector: front DAC */ | |
1730 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
1da177e4 | 1731 | |
05acb863 | 1732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1733 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1734 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1735 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1736 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1737 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 1738 | |
e9edcee0 | 1739 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
05acb863 | 1740 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1da177e4 | 1741 | |
1da177e4 LT |
1742 | { } |
1743 | }; | |
1744 | ||
e9edcee0 TI |
1745 | /* |
1746 | * Z71V pin configuration: | |
1747 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
1748 | */ | |
1749 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
05acb863 | 1750 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1751 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1752 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 1753 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
dfc0ff62 | 1754 | |
16ded525 | 1755 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1756 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 | 1757 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1758 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 TI |
1759 | |
1760 | { } | |
1761 | }; | |
1762 | ||
e9edcee0 TI |
1763 | /* |
1764 | * 6-stack pin configuration: | |
9c7f852e TI |
1765 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
1766 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
e9edcee0 TI |
1767 | */ |
1768 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
1769 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1770 | ||
16ded525 | 1771 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1773 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1775 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1776 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1777 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
1778 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1779 | ||
16ded525 | 1780 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1781 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1782 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1783 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1784 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 | 1785 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1786 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 1787 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 TI |
1788 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1789 | ||
e9edcee0 TI |
1790 | { } |
1791 | }; | |
1792 | ||
ccc656ce KY |
1793 | /* |
1794 | * Uniwill pin configuration: | |
1795 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
1796 | * line = 0x1a | |
1797 | */ | |
1798 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
1799 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1800 | ||
1801 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1802 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1803 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1804 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1805 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1806 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1807 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1808 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1809 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1811 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1812 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1813 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1814 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1815 | ||
1816 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1820 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1821 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1822 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
1823 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
1824 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1825 | ||
1826 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
1827 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
1828 | ||
1829 | { } | |
1830 | }; | |
1831 | ||
1832 | /* | |
1833 | * Uniwill P53 | |
1834 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, | |
1835 | */ | |
1836 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
1837 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1838 | ||
1839 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1840 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1841 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1842 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1843 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1844 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1848 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1849 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1850 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1851 | ||
1852 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1853 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1854 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1855 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1856 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1857 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1858 | ||
1859 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
1860 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
1861 | ||
1862 | { } | |
1863 | }; | |
1864 | ||
2cf9f0fc TD |
1865 | static struct hda_verb alc880_beep_init_verbs[] = { |
1866 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
1867 | { } | |
1868 | }; | |
1869 | ||
ccc656ce | 1870 | /* toggle speaker-output according to the hp-jack state */ |
458a4fab | 1871 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
ccc656ce KY |
1872 | { |
1873 | unsigned int present; | |
f12ab1e0 | 1874 | unsigned char bits; |
ccc656ce KY |
1875 | |
1876 | present = snd_hda_codec_read(codec, 0x14, 0, | |
1877 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
1878 | bits = present ? HDA_AMP_MUTE : 0; |
1879 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
1880 | HDA_AMP_MUTE, bits); | |
1881 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
1882 | HDA_AMP_MUTE, bits); | |
458a4fab TI |
1883 | } |
1884 | ||
1885 | /* auto-toggle front mic */ | |
1886 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |
1887 | { | |
1888 | unsigned int present; | |
1889 | unsigned char bits; | |
ccc656ce KY |
1890 | |
1891 | present = snd_hda_codec_read(codec, 0x18, 0, | |
1892 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
1893 | bits = present ? HDA_AMP_MUTE : 0; |
1894 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
458a4fab TI |
1895 | } |
1896 | ||
1897 | static void alc880_uniwill_automute(struct hda_codec *codec) | |
1898 | { | |
1899 | alc880_uniwill_hp_automute(codec); | |
1900 | alc880_uniwill_mic_automute(codec); | |
ccc656ce KY |
1901 | } |
1902 | ||
1903 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
1904 | unsigned int res) | |
1905 | { | |
1906 | /* Looks like the unsol event is incompatible with the standard | |
1907 | * definition. 4bit tag is placed at 28 bit! | |
1908 | */ | |
458a4fab TI |
1909 | switch (res >> 28) { |
1910 | case ALC880_HP_EVENT: | |
1911 | alc880_uniwill_hp_automute(codec); | |
1912 | break; | |
1913 | case ALC880_MIC_EVENT: | |
1914 | alc880_uniwill_mic_automute(codec); | |
1915 | break; | |
1916 | } | |
ccc656ce KY |
1917 | } |
1918 | ||
1919 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) | |
1920 | { | |
1921 | unsigned int present; | |
f12ab1e0 | 1922 | unsigned char bits; |
ccc656ce KY |
1923 | |
1924 | present = snd_hda_codec_read(codec, 0x14, 0, | |
1925 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a | 1926 | bits = present ? HDA_AMP_MUTE : 0; |
64654c2f | 1927 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
ccc656ce KY |
1928 | } |
1929 | ||
1930 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
1931 | { | |
1932 | unsigned int present; | |
1933 | ||
1934 | present = snd_hda_codec_read(codec, 0x21, 0, | |
47fd830a TI |
1935 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
1936 | present &= HDA_AMP_VOLMASK; | |
1937 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
1938 | HDA_AMP_VOLMASK, present); | |
1939 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
1940 | HDA_AMP_VOLMASK, present); | |
ccc656ce | 1941 | } |
47fd830a | 1942 | |
ccc656ce KY |
1943 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
1944 | unsigned int res) | |
1945 | { | |
1946 | /* Looks like the unsol event is incompatible with the standard | |
1947 | * definition. 4bit tag is placed at 28 bit! | |
1948 | */ | |
1949 | if ((res >> 28) == ALC880_HP_EVENT) | |
1950 | alc880_uniwill_p53_hp_automute(codec); | |
f12ab1e0 | 1951 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
ccc656ce KY |
1952 | alc880_uniwill_p53_dcvol_automute(codec); |
1953 | } | |
1954 | ||
e9edcee0 TI |
1955 | /* |
1956 | * F1734 pin configuration: | |
1957 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
1958 | */ | |
1959 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
ee7a9c7c | 1960 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
16ded525 TI |
1961 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
1962 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1963 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1964 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1965 | ||
e9edcee0 | 1966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
16ded525 | 1967 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
e9edcee0 | 1968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16ded525 | 1969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1970 | |
e9edcee0 TI |
1971 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1972 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
ee7a9c7c | 1973 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
e9edcee0 | 1974 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1975 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1976 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1977 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1978 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1979 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
dfc0ff62 | 1980 | |
937b4160 TI |
1981 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
1982 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
1983 | ||
dfc0ff62 TI |
1984 | { } |
1985 | }; | |
1986 | ||
e9edcee0 TI |
1987 | /* |
1988 | * ASUS pin configuration: | |
1989 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
1990 | */ | |
1991 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
16ded525 TI |
1992 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
1993 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1994 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1995 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1996 | ||
1997 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
e9edcee0 | 1998 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1999 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2000 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2001 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2002 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2003 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
2004 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2005 | ||
2006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2007 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2008 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2009 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2010 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2011 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16ded525 | 2012 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2013 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 TI |
2014 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
2015 | ||
e9edcee0 TI |
2016 | { } |
2017 | }; | |
16ded525 | 2018 | |
e9edcee0 | 2019 | /* Enable GPIO mask and set output */ |
bc9f98a9 KY |
2020 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
2021 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
df694daa KY |
2022 | |
2023 | /* Clevo m520g init */ | |
2024 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
2025 | /* headphone output */ | |
2026 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2027 | /* line-out */ | |
2028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2029 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2030 | /* Line-in */ | |
2031 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2032 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2033 | /* CD */ | |
2034 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2035 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2036 | /* Mic1 (rear panel) */ | |
2037 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2038 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2039 | /* Mic2 (front panel) */ | |
2040 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2041 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2042 | /* headphone */ | |
2043 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2044 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2045 | /* change to EAPD mode */ | |
2046 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2047 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2048 | ||
2049 | { } | |
16ded525 TI |
2050 | }; |
2051 | ||
df694daa | 2052 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
4b146cb0 TI |
2053 | /* change to EAPD mode */ |
2054 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2055 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2056 | ||
df694daa KY |
2057 | /* Headphone output */ |
2058 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2059 | /* Front output*/ | |
2060 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2061 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2062 | ||
2063 | /* Line In pin widget for input */ | |
2064 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2065 | /* CD pin widget for input */ | |
2066 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2067 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2069 | ||
2070 | /* change to EAPD mode */ | |
2071 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2072 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
2073 | ||
2074 | { } | |
2075 | }; | |
16ded525 | 2076 | |
e9edcee0 | 2077 | /* |
ae6b813a TI |
2078 | * LG m1 express dual |
2079 | * | |
2080 | * Pin assignment: | |
2081 | * Rear Line-In/Out (blue): 0x14 | |
2082 | * Build-in Mic-In: 0x15 | |
2083 | * Speaker-out: 0x17 | |
2084 | * HP-Out (green): 0x1b | |
2085 | * Mic-In/Out (red): 0x19 | |
2086 | * SPDIF-Out: 0x1e | |
2087 | */ | |
2088 | ||
2089 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
2090 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
2091 | 0x05, 0x02, 0x03 | |
2092 | }; | |
2093 | ||
2094 | /* seems analog CD is not working */ | |
2095 | static struct hda_input_mux alc880_lg_capture_source = { | |
2096 | .num_items = 3, | |
2097 | .items = { | |
2098 | { "Mic", 0x1 }, | |
2099 | { "Line", 0x5 }, | |
2100 | { "Internal Mic", 0x6 }, | |
2101 | }, | |
2102 | }; | |
2103 | ||
2104 | /* 2,4,6 channel modes */ | |
2105 | static struct hda_verb alc880_lg_ch2_init[] = { | |
2106 | /* set line-in and mic-in to input */ | |
2107 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2108 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2109 | { } | |
2110 | }; | |
2111 | ||
2112 | static struct hda_verb alc880_lg_ch4_init[] = { | |
2113 | /* set line-in to out and mic-in to input */ | |
2114 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2115 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2116 | { } | |
2117 | }; | |
2118 | ||
2119 | static struct hda_verb alc880_lg_ch6_init[] = { | |
2120 | /* set line-in and mic-in to output */ | |
2121 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2122 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2123 | { } | |
2124 | }; | |
2125 | ||
2126 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
2127 | { 2, alc880_lg_ch2_init }, | |
2128 | { 4, alc880_lg_ch4_init }, | |
2129 | { 6, alc880_lg_ch6_init }, | |
2130 | }; | |
2131 | ||
2132 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
2134ea4f TI |
2133 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
2134 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
ae6b813a TI |
2135 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2136 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
2137 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
2138 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
2139 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
2140 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
2141 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2142 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2143 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
2144 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
2145 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
2146 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
2147 | { | |
2148 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2149 | .name = "Channel Mode", | |
2150 | .info = alc_ch_mode_info, | |
2151 | .get = alc_ch_mode_get, | |
2152 | .put = alc_ch_mode_put, | |
2153 | }, | |
2154 | { } /* end */ | |
2155 | }; | |
2156 | ||
2157 | static struct hda_verb alc880_lg_init_verbs[] = { | |
2158 | /* set capture source to mic-in */ | |
2159 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2160 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2161 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2162 | /* mute all amp mixer inputs */ | |
2163 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
cb53c626 TI |
2164 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
2165 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
ae6b813a TI |
2166 | /* line-in to input */ |
2167 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2168 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2169 | /* built-in mic */ | |
2170 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2171 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2172 | /* speaker-out */ | |
2173 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2174 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2175 | /* mic-in to input */ | |
2176 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2177 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2178 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2179 | /* HP-out */ | |
2180 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
2181 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2182 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2183 | /* jack sense */ | |
2184 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, | |
2185 | { } | |
2186 | }; | |
2187 | ||
2188 | /* toggle speaker-output according to the hp-jack state */ | |
2189 | static void alc880_lg_automute(struct hda_codec *codec) | |
2190 | { | |
2191 | unsigned int present; | |
f12ab1e0 | 2192 | unsigned char bits; |
ae6b813a TI |
2193 | |
2194 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
2195 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2196 | bits = present ? HDA_AMP_MUTE : 0; |
2197 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
2198 | HDA_AMP_MUTE, bits); | |
ae6b813a TI |
2199 | } |
2200 | ||
2201 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) | |
2202 | { | |
2203 | /* Looks like the unsol event is incompatible with the standard | |
2204 | * definition. 4bit tag is placed at 28 bit! | |
2205 | */ | |
2206 | if ((res >> 28) == 0x01) | |
2207 | alc880_lg_automute(codec); | |
2208 | } | |
2209 | ||
d681518a TI |
2210 | /* |
2211 | * LG LW20 | |
2212 | * | |
2213 | * Pin assignment: | |
2214 | * Speaker-out: 0x14 | |
2215 | * Mic-In: 0x18 | |
e4f41da9 CM |
2216 | * Built-in Mic-In: 0x19 |
2217 | * Line-In: 0x1b | |
2218 | * HP-Out: 0x1a | |
d681518a TI |
2219 | * SPDIF-Out: 0x1e |
2220 | */ | |
2221 | ||
d681518a | 2222 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
e4f41da9 | 2223 | .num_items = 3, |
d681518a TI |
2224 | .items = { |
2225 | { "Mic", 0x0 }, | |
2226 | { "Internal Mic", 0x1 }, | |
e4f41da9 | 2227 | { "Line In", 0x2 }, |
d681518a TI |
2228 | }, |
2229 | }; | |
2230 | ||
0a8c5da3 CM |
2231 | #define alc880_lg_lw_modes alc880_threestack_modes |
2232 | ||
d681518a | 2233 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
0a8c5da3 CM |
2234 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2235 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2236 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2237 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
2238 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2239 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2240 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2241 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2242 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2243 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d681518a TI |
2244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2246 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
2247 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
0a8c5da3 CM |
2248 | { |
2249 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2250 | .name = "Channel Mode", | |
2251 | .info = alc_ch_mode_info, | |
2252 | .get = alc_ch_mode_get, | |
2253 | .put = alc_ch_mode_put, | |
2254 | }, | |
d681518a TI |
2255 | { } /* end */ |
2256 | }; | |
2257 | ||
2258 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
0a8c5da3 CM |
2259 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
2260 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
2261 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
2262 | ||
d681518a TI |
2263 | /* set capture source to mic-in */ |
2264 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2266 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
cb53c626 | 2267 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
d681518a TI |
2268 | /* speaker-out */ |
2269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2271 | /* HP-out */ | |
d681518a TI |
2272 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
2273 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2274 | /* mic-in to input */ | |
2275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2276 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2277 | /* built-in mic */ | |
2278 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2279 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2280 | /* jack sense */ | |
2281 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, | |
2282 | { } | |
2283 | }; | |
2284 | ||
2285 | /* toggle speaker-output according to the hp-jack state */ | |
2286 | static void alc880_lg_lw_automute(struct hda_codec *codec) | |
2287 | { | |
2288 | unsigned int present; | |
f12ab1e0 | 2289 | unsigned char bits; |
d681518a TI |
2290 | |
2291 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
2292 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2293 | bits = present ? HDA_AMP_MUTE : 0; |
2294 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
2295 | HDA_AMP_MUTE, bits); | |
d681518a TI |
2296 | } |
2297 | ||
2298 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) | |
2299 | { | |
2300 | /* Looks like the unsol event is incompatible with the standard | |
2301 | * definition. 4bit tag is placed at 28 bit! | |
2302 | */ | |
2303 | if ((res >> 28) == 0x01) | |
2304 | alc880_lg_lw_automute(codec); | |
2305 | } | |
2306 | ||
df99cd33 TI |
2307 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
2308 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2309 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
2310 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2311 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2312 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2313 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2314 | { } /* end */ | |
2315 | }; | |
2316 | ||
2317 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
2318 | .num_items = 2, | |
2319 | .items = { | |
2320 | { "Mic", 0x0 }, | |
2321 | { "Internal Mic", 0x1 }, | |
2322 | }, | |
2323 | }; | |
2324 | ||
2325 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
2326 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2327 | ||
2328 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2329 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2330 | ||
2331 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2332 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2333 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2334 | /* Mic2 (as headphone out) for HP output */ | |
2335 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2336 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2337 | /* Internal Speaker */ | |
2338 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2339 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2340 | ||
2341 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2342 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2343 | ||
2344 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
2345 | { } | |
2346 | }; | |
2347 | ||
2348 | /* toggle speaker-output according to the hp-jack state */ | |
2349 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
2350 | { | |
2351 | unsigned int present; | |
2352 | unsigned char bits; | |
2353 | ||
2354 | present = snd_hda_codec_read(codec, 0x14, 0, | |
2355 | AC_VERB_GET_PIN_SENSE, 0) | |
2356 | & AC_PINSENSE_PRESENCE; | |
2357 | bits = present ? HDA_AMP_MUTE : 0; | |
2358 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
2359 | HDA_AMP_MUTE, bits); | |
2360 | if (present) | |
2361 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | |
2362 | else | |
2363 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
2364 | } | |
2365 | ||
2366 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
2367 | unsigned int res) | |
2368 | { | |
2369 | /* Looks like the unsol event is incompatible with the standard | |
2370 | * definition. 4bit tag is placed at 28 bit! | |
2371 | */ | |
2372 | if ((res >> 28) == ALC880_HP_EVENT) | |
2373 | alc880_medion_rim_automute(codec); | |
2374 | } | |
2375 | ||
cb53c626 TI |
2376 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2377 | static struct hda_amp_list alc880_loopbacks[] = { | |
2378 | { 0x0b, HDA_INPUT, 0 }, | |
2379 | { 0x0b, HDA_INPUT, 1 }, | |
2380 | { 0x0b, HDA_INPUT, 2 }, | |
2381 | { 0x0b, HDA_INPUT, 3 }, | |
2382 | { 0x0b, HDA_INPUT, 4 }, | |
2383 | { } /* end */ | |
2384 | }; | |
2385 | ||
2386 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
2387 | { 0x0b, HDA_INPUT, 1 }, | |
2388 | { 0x0b, HDA_INPUT, 6 }, | |
2389 | { 0x0b, HDA_INPUT, 7 }, | |
2390 | { } /* end */ | |
2391 | }; | |
2392 | #endif | |
2393 | ||
ae6b813a TI |
2394 | /* |
2395 | * Common callbacks | |
e9edcee0 TI |
2396 | */ |
2397 | ||
1da177e4 LT |
2398 | static int alc_init(struct hda_codec *codec) |
2399 | { | |
2400 | struct alc_spec *spec = codec->spec; | |
e9edcee0 TI |
2401 | unsigned int i; |
2402 | ||
2403 | for (i = 0; i < spec->num_init_verbs; i++) | |
2404 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
ae6b813a TI |
2405 | |
2406 | if (spec->init_hook) | |
2407 | spec->init_hook(codec); | |
2408 | ||
1da177e4 LT |
2409 | return 0; |
2410 | } | |
2411 | ||
ae6b813a TI |
2412 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
2413 | { | |
2414 | struct alc_spec *spec = codec->spec; | |
2415 | ||
2416 | if (spec->unsol_event) | |
2417 | spec->unsol_event(codec, res); | |
2418 | } | |
2419 | ||
cb53c626 TI |
2420 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2421 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
2422 | { | |
2423 | struct alc_spec *spec = codec->spec; | |
2424 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
2425 | } | |
2426 | #endif | |
2427 | ||
1da177e4 LT |
2428 | /* |
2429 | * Analog playback callbacks | |
2430 | */ | |
2431 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
2432 | struct hda_codec *codec, | |
c8b6bf9b | 2433 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2434 | { |
2435 | struct alc_spec *spec = codec->spec; | |
9a08160b TI |
2436 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
2437 | hinfo); | |
1da177e4 LT |
2438 | } |
2439 | ||
2440 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
2441 | struct hda_codec *codec, | |
2442 | unsigned int stream_tag, | |
2443 | unsigned int format, | |
c8b6bf9b | 2444 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2445 | { |
2446 | struct alc_spec *spec = codec->spec; | |
9c7f852e TI |
2447 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
2448 | stream_tag, format, substream); | |
1da177e4 LT |
2449 | } |
2450 | ||
2451 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
2452 | struct hda_codec *codec, | |
c8b6bf9b | 2453 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2454 | { |
2455 | struct alc_spec *spec = codec->spec; | |
2456 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
2457 | } | |
2458 | ||
2459 | /* | |
2460 | * Digital out | |
2461 | */ | |
2462 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
2463 | struct hda_codec *codec, | |
c8b6bf9b | 2464 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2465 | { |
2466 | struct alc_spec *spec = codec->spec; | |
2467 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
2468 | } | |
2469 | ||
6b97eb45 TI |
2470 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
2471 | struct hda_codec *codec, | |
2472 | unsigned int stream_tag, | |
2473 | unsigned int format, | |
2474 | struct snd_pcm_substream *substream) | |
2475 | { | |
2476 | struct alc_spec *spec = codec->spec; | |
2477 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
2478 | stream_tag, format, substream); | |
2479 | } | |
2480 | ||
1da177e4 LT |
2481 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
2482 | struct hda_codec *codec, | |
c8b6bf9b | 2483 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2484 | { |
2485 | struct alc_spec *spec = codec->spec; | |
2486 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
2487 | } | |
2488 | ||
2489 | /* | |
2490 | * Analog capture | |
2491 | */ | |
6330079f | 2492 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
1da177e4 LT |
2493 | struct hda_codec *codec, |
2494 | unsigned int stream_tag, | |
2495 | unsigned int format, | |
c8b6bf9b | 2496 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2497 | { |
2498 | struct alc_spec *spec = codec->spec; | |
2499 | ||
6330079f | 2500 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
1da177e4 LT |
2501 | stream_tag, 0, format); |
2502 | return 0; | |
2503 | } | |
2504 | ||
6330079f | 2505 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
1da177e4 | 2506 | struct hda_codec *codec, |
c8b6bf9b | 2507 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2508 | { |
2509 | struct alc_spec *spec = codec->spec; | |
2510 | ||
888afa15 TI |
2511 | snd_hda_codec_cleanup_stream(codec, |
2512 | spec->adc_nids[substream->number + 1]); | |
1da177e4 LT |
2513 | return 0; |
2514 | } | |
2515 | ||
2516 | ||
2517 | /* | |
2518 | */ | |
2519 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
2520 | .substreams = 1, | |
2521 | .channels_min = 2, | |
2522 | .channels_max = 8, | |
e9edcee0 | 2523 | /* NID is set in alc_build_pcms */ |
1da177e4 LT |
2524 | .ops = { |
2525 | .open = alc880_playback_pcm_open, | |
2526 | .prepare = alc880_playback_pcm_prepare, | |
2527 | .cleanup = alc880_playback_pcm_cleanup | |
2528 | }, | |
2529 | }; | |
2530 | ||
2531 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
6330079f TI |
2532 | .substreams = 1, |
2533 | .channels_min = 2, | |
2534 | .channels_max = 2, | |
2535 | /* NID is set in alc_build_pcms */ | |
2536 | }; | |
2537 | ||
2538 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
2539 | .substreams = 1, | |
2540 | .channels_min = 2, | |
2541 | .channels_max = 2, | |
2542 | /* NID is set in alc_build_pcms */ | |
2543 | }; | |
2544 | ||
2545 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
2546 | .substreams = 2, /* can be overridden */ | |
1da177e4 LT |
2547 | .channels_min = 2, |
2548 | .channels_max = 2, | |
e9edcee0 | 2549 | /* NID is set in alc_build_pcms */ |
1da177e4 | 2550 | .ops = { |
6330079f TI |
2551 | .prepare = alc880_alt_capture_pcm_prepare, |
2552 | .cleanup = alc880_alt_capture_pcm_cleanup | |
1da177e4 LT |
2553 | }, |
2554 | }; | |
2555 | ||
2556 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
2557 | .substreams = 1, | |
2558 | .channels_min = 2, | |
2559 | .channels_max = 2, | |
2560 | /* NID is set in alc_build_pcms */ | |
2561 | .ops = { | |
2562 | .open = alc880_dig_playback_pcm_open, | |
6b97eb45 TI |
2563 | .close = alc880_dig_playback_pcm_close, |
2564 | .prepare = alc880_dig_playback_pcm_prepare | |
1da177e4 LT |
2565 | }, |
2566 | }; | |
2567 | ||
2568 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
2569 | .substreams = 1, | |
2570 | .channels_min = 2, | |
2571 | .channels_max = 2, | |
2572 | /* NID is set in alc_build_pcms */ | |
2573 | }; | |
2574 | ||
4c5186ed | 2575 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
6330079f | 2576 | static struct hda_pcm_stream alc_pcm_null_stream = { |
4c5186ed JW |
2577 | .substreams = 0, |
2578 | .channels_min = 0, | |
2579 | .channels_max = 0, | |
2580 | }; | |
2581 | ||
1da177e4 LT |
2582 | static int alc_build_pcms(struct hda_codec *codec) |
2583 | { | |
2584 | struct alc_spec *spec = codec->spec; | |
2585 | struct hda_pcm *info = spec->pcm_rec; | |
2586 | int i; | |
2587 | ||
2588 | codec->num_pcms = 1; | |
2589 | codec->pcm_info = info; | |
2590 | ||
2591 | info->name = spec->stream_name_analog; | |
4a471b7d TI |
2592 | if (spec->stream_analog_playback) { |
2593 | snd_assert(spec->multiout.dac_nids, return -EINVAL); | |
2594 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); | |
2595 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
2596 | } | |
2597 | if (spec->stream_analog_capture) { | |
2598 | snd_assert(spec->adc_nids, return -EINVAL); | |
2599 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | |
2600 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
2601 | } | |
2602 | ||
2603 | if (spec->channel_mode) { | |
2604 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
2605 | for (i = 0; i < spec->num_channel_mode; i++) { | |
2606 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
2607 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
2608 | } | |
1da177e4 LT |
2609 | } |
2610 | } | |
2611 | ||
e08a007d | 2612 | /* SPDIF for stream index #1 */ |
1da177e4 | 2613 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
e08a007d | 2614 | codec->num_pcms = 2; |
c06134d7 | 2615 | info = spec->pcm_rec + 1; |
1da177e4 | 2616 | info->name = spec->stream_name_digital; |
7ba72ba1 | 2617 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
4a471b7d TI |
2618 | if (spec->multiout.dig_out_nid && |
2619 | spec->stream_digital_playback) { | |
1da177e4 LT |
2620 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
2621 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
2622 | } | |
4a471b7d TI |
2623 | if (spec->dig_in_nid && |
2624 | spec->stream_digital_capture) { | |
1da177e4 LT |
2625 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
2626 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
2627 | } | |
2628 | } | |
2629 | ||
e08a007d TI |
2630 | /* If the use of more than one ADC is requested for the current |
2631 | * model, configure a second analog capture-only PCM. | |
2632 | */ | |
2633 | /* Additional Analaog capture for index #2 */ | |
6330079f TI |
2634 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
2635 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
e08a007d | 2636 | codec->num_pcms = 3; |
c06134d7 | 2637 | info = spec->pcm_rec + 2; |
e08a007d | 2638 | info->name = spec->stream_name_analog; |
6330079f TI |
2639 | if (spec->alt_dac_nid) { |
2640 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
2641 | *spec->stream_analog_alt_playback; | |
2642 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
2643 | spec->alt_dac_nid; | |
2644 | } else { | |
2645 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
2646 | alc_pcm_null_stream; | |
2647 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
2648 | } | |
2649 | if (spec->num_adc_nids > 1) { | |
2650 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
2651 | *spec->stream_analog_alt_capture; | |
2652 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
2653 | spec->adc_nids[1]; | |
2654 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
2655 | spec->num_adc_nids - 1; | |
2656 | } else { | |
2657 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
2658 | alc_pcm_null_stream; | |
2659 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
e08a007d TI |
2660 | } |
2661 | } | |
2662 | ||
1da177e4 LT |
2663 | return 0; |
2664 | } | |
2665 | ||
2666 | static void alc_free(struct hda_codec *codec) | |
2667 | { | |
e9edcee0 TI |
2668 | struct alc_spec *spec = codec->spec; |
2669 | unsigned int i; | |
2670 | ||
f12ab1e0 | 2671 | if (!spec) |
e9edcee0 TI |
2672 | return; |
2673 | ||
2674 | if (spec->kctl_alloc) { | |
2675 | for (i = 0; i < spec->num_kctl_used; i++) | |
2676 | kfree(spec->kctl_alloc[i].name); | |
2677 | kfree(spec->kctl_alloc); | |
2678 | } | |
2679 | kfree(spec); | |
7943a8ab | 2680 | codec->spec = NULL; /* to be sure */ |
1da177e4 LT |
2681 | } |
2682 | ||
2683 | /* | |
2684 | */ | |
2685 | static struct hda_codec_ops alc_patch_ops = { | |
2686 | .build_controls = alc_build_controls, | |
2687 | .build_pcms = alc_build_pcms, | |
2688 | .init = alc_init, | |
2689 | .free = alc_free, | |
ae6b813a | 2690 | .unsol_event = alc_unsol_event, |
cb53c626 TI |
2691 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2692 | .check_power_status = alc_check_power_status, | |
2693 | #endif | |
1da177e4 LT |
2694 | }; |
2695 | ||
2fa522be TI |
2696 | |
2697 | /* | |
2698 | * Test configuration for debugging | |
2699 | * | |
2700 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
2701 | * enum controls. | |
2702 | */ | |
2703 | #ifdef CONFIG_SND_DEBUG | |
2704 | static hda_nid_t alc880_test_dac_nids[4] = { | |
2705 | 0x02, 0x03, 0x04, 0x05 | |
2706 | }; | |
2707 | ||
2708 | static struct hda_input_mux alc880_test_capture_source = { | |
ae6b813a | 2709 | .num_items = 7, |
2fa522be TI |
2710 | .items = { |
2711 | { "In-1", 0x0 }, | |
2712 | { "In-2", 0x1 }, | |
2713 | { "In-3", 0x2 }, | |
2714 | { "In-4", 0x3 }, | |
2715 | { "CD", 0x4 }, | |
ae6b813a TI |
2716 | { "Front", 0x5 }, |
2717 | { "Surround", 0x6 }, | |
2fa522be TI |
2718 | }, |
2719 | }; | |
2720 | ||
d2a6d7dc | 2721 | static struct hda_channel_mode alc880_test_modes[4] = { |
2fa522be | 2722 | { 2, NULL }, |
fd2c326d | 2723 | { 4, NULL }, |
2fa522be | 2724 | { 6, NULL }, |
fd2c326d | 2725 | { 8, NULL }, |
2fa522be TI |
2726 | }; |
2727 | ||
9c7f852e TI |
2728 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
2729 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
2730 | { |
2731 | static char *texts[] = { | |
2732 | "N/A", "Line Out", "HP Out", | |
2733 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
2734 | }; | |
2735 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
2736 | uinfo->count = 1; | |
2737 | uinfo->value.enumerated.items = 8; | |
2738 | if (uinfo->value.enumerated.item >= 8) | |
2739 | uinfo->value.enumerated.item = 7; | |
2740 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
2741 | return 0; | |
2742 | } | |
2743 | ||
9c7f852e TI |
2744 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
2745 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2746 | { |
2747 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2748 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2749 | unsigned int pin_ctl, item = 0; | |
2750 | ||
2751 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
2752 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
2753 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
2754 | if (pin_ctl & AC_PINCTL_HP_EN) | |
2755 | item = 2; | |
2756 | else | |
2757 | item = 1; | |
2758 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
2759 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
2760 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
2761 | case AC_PINCTL_VREF_50: item = 4; break; | |
2762 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
2763 | case AC_PINCTL_VREF_80: item = 6; break; | |
2764 | case AC_PINCTL_VREF_100: item = 7; break; | |
2765 | } | |
2766 | } | |
2767 | ucontrol->value.enumerated.item[0] = item; | |
2768 | return 0; | |
2769 | } | |
2770 | ||
9c7f852e TI |
2771 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
2772 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2773 | { |
2774 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2775 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2776 | static unsigned int ctls[] = { | |
2777 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
2778 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
2779 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
2780 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
2781 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
2782 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
2783 | }; | |
2784 | unsigned int old_ctl, new_ctl; | |
2785 | ||
2786 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
2787 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
2788 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
2789 | if (old_ctl != new_ctl) { | |
82beb8fd TI |
2790 | int val; |
2791 | snd_hda_codec_write_cache(codec, nid, 0, | |
2792 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
2793 | new_ctl); | |
47fd830a TI |
2794 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
2795 | HDA_AMP_MUTE : 0; | |
2796 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
2797 | HDA_AMP_MUTE, val); | |
2fa522be TI |
2798 | return 1; |
2799 | } | |
2800 | return 0; | |
2801 | } | |
2802 | ||
9c7f852e TI |
2803 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
2804 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
2805 | { |
2806 | static char *texts[] = { | |
2807 | "Front", "Surround", "CLFE", "Side" | |
2808 | }; | |
2809 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
2810 | uinfo->count = 1; | |
2811 | uinfo->value.enumerated.items = 4; | |
2812 | if (uinfo->value.enumerated.item >= 4) | |
2813 | uinfo->value.enumerated.item = 3; | |
2814 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
2815 | return 0; | |
2816 | } | |
2817 | ||
9c7f852e TI |
2818 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
2819 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2820 | { |
2821 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2822 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2823 | unsigned int sel; | |
2824 | ||
2825 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
2826 | ucontrol->value.enumerated.item[0] = sel & 3; | |
2827 | return 0; | |
2828 | } | |
2829 | ||
9c7f852e TI |
2830 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
2831 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2832 | { |
2833 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2834 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2835 | unsigned int sel; | |
2836 | ||
2837 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
2838 | if (ucontrol->value.enumerated.item[0] != sel) { | |
2839 | sel = ucontrol->value.enumerated.item[0] & 3; | |
82beb8fd TI |
2840 | snd_hda_codec_write_cache(codec, nid, 0, |
2841 | AC_VERB_SET_CONNECT_SEL, sel); | |
2fa522be TI |
2842 | return 1; |
2843 | } | |
2844 | return 0; | |
2845 | } | |
2846 | ||
2847 | #define PIN_CTL_TEST(xname,nid) { \ | |
2848 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2849 | .name = xname, \ | |
2850 | .info = alc_test_pin_ctl_info, \ | |
2851 | .get = alc_test_pin_ctl_get, \ | |
2852 | .put = alc_test_pin_ctl_put, \ | |
2853 | .private_value = nid \ | |
2854 | } | |
2855 | ||
2856 | #define PIN_SRC_TEST(xname,nid) { \ | |
2857 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2858 | .name = xname, \ | |
2859 | .info = alc_test_pin_src_info, \ | |
2860 | .get = alc_test_pin_src_get, \ | |
2861 | .put = alc_test_pin_src_put, \ | |
2862 | .private_value = nid \ | |
2863 | } | |
2864 | ||
c8b6bf9b | 2865 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
05acb863 TI |
2866 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2867 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2868 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
2869 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
985be54b TI |
2870 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
2871 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2872 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
2873 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2fa522be TI |
2874 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
2875 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
2876 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
2877 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
2878 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
2879 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
2880 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
2881 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
2882 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
2883 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
2884 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
2885 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
2886 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2887 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2888 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2889 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2890 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
2891 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
2892 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
2893 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
2894 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
2895 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
2fa522be TI |
2896 | { |
2897 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2898 | .name = "Channel Mode", | |
df694daa KY |
2899 | .info = alc_ch_mode_info, |
2900 | .get = alc_ch_mode_get, | |
2901 | .put = alc_ch_mode_put, | |
2fa522be TI |
2902 | }, |
2903 | { } /* end */ | |
2904 | }; | |
2905 | ||
2906 | static struct hda_verb alc880_test_init_verbs[] = { | |
2907 | /* Unmute inputs of 0x0c - 0x0f */ | |
05acb863 TI |
2908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
2909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2911 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2912 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2913 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2914 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2915 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2fa522be | 2916 | /* Vol output for 0x0c-0x0f */ |
05acb863 TI |
2917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
2918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2920 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2fa522be | 2921 | /* Set output pins 0x14-0x17 */ |
05acb863 TI |
2922 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
2923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2924 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2925 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2fa522be | 2926 | /* Unmute output pins 0x14-0x17 */ |
05acb863 TI |
2927 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2929 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2930 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2fa522be | 2931 | /* Set input pins 0x18-0x1c */ |
16ded525 TI |
2932 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
2933 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
05acb863 TI |
2934 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
2935 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2936 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2fa522be | 2937 | /* Mute input pins 0x18-0x1b */ |
05acb863 TI |
2938 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2939 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2940 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
71fe7b82 | 2942 | /* ADC set up */ |
05acb863 | 2943 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 2944 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 2945 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 2946 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 2947 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 2948 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
2949 | /* Analog input/passthru */ |
2950 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
2951 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2952 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
2953 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
2954 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2fa522be TI |
2955 | { } |
2956 | }; | |
2957 | #endif | |
2958 | ||
1da177e4 LT |
2959 | /* |
2960 | */ | |
2961 | ||
f5fcc13c TI |
2962 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
2963 | [ALC880_3ST] = "3stack", | |
2964 | [ALC880_TCL_S700] = "tcl", | |
2965 | [ALC880_3ST_DIG] = "3stack-digout", | |
2966 | [ALC880_CLEVO] = "clevo", | |
2967 | [ALC880_5ST] = "5stack", | |
2968 | [ALC880_5ST_DIG] = "5stack-digout", | |
2969 | [ALC880_W810] = "w810", | |
2970 | [ALC880_Z71V] = "z71v", | |
2971 | [ALC880_6ST] = "6stack", | |
2972 | [ALC880_6ST_DIG] = "6stack-digout", | |
2973 | [ALC880_ASUS] = "asus", | |
2974 | [ALC880_ASUS_W1V] = "asus-w1v", | |
2975 | [ALC880_ASUS_DIG] = "asus-dig", | |
2976 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
2977 | [ALC880_UNIWILL_DIG] = "uniwill", | |
2cf9f0fc TD |
2978 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
2979 | [ALC880_FUJITSU] = "fujitsu", | |
f5fcc13c TI |
2980 | [ALC880_F1734] = "F1734", |
2981 | [ALC880_LG] = "lg", | |
2982 | [ALC880_LG_LW] = "lg-lw", | |
df99cd33 | 2983 | [ALC880_MEDION_RIM] = "medion", |
2fa522be | 2984 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 2985 | [ALC880_TEST] = "test", |
2fa522be | 2986 | #endif |
f5fcc13c TI |
2987 | [ALC880_AUTO] = "auto", |
2988 | }; | |
2989 | ||
2990 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
ac3e3741 | 2991 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
f5fcc13c TI |
2992 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
2993 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
2994 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
2995 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
2996 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
2997 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
2998 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
2999 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
f5fcc13c TI |
3000 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
3001 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
f5fcc13c TI |
3002 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
3003 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
3004 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
3005 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
3006 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
3007 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
3008 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
3009 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
3010 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
3011 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
186c3117 | 3012 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
f5fcc13c TI |
3013 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
3014 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
3015 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
ac3e3741 | 3016 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
f5fcc13c | 3017 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
ac3e3741 TI |
3018 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
3019 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
3020 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
3021 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
3022 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
3023 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
3024 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
3025 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
ac3e3741 TI |
3026 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
3027 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
f5fcc13c | 3028 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
ac3e3741 | 3029 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
f5fcc13c | 3030 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
ac3e3741 | 3031 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
f5fcc13c TI |
3032 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
3033 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
ac3e3741 | 3034 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
df99cd33 | 3035 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
ac3e3741 | 3036 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
f5fcc13c | 3037 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
f5fcc13c | 3038 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
ac3e3741 | 3039 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
2cf9f0fc | 3040 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
ac3e3741 | 3041 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
f5fcc13c TI |
3042 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
3043 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
f5fcc13c | 3044 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
ac3e3741 TI |
3045 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
3046 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
3047 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
3048 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
f5fcc13c TI |
3049 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
3050 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 | 3051 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
f5fcc13c | 3052 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
ac3e3741 TI |
3053 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
3054 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
f5fcc13c TI |
3055 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
3056 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
3057 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 TI |
3058 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
3059 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | |
3060 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
1da177e4 LT |
3061 | {} |
3062 | }; | |
3063 | ||
16ded525 | 3064 | /* |
df694daa | 3065 | * ALC880 codec presets |
16ded525 | 3066 | */ |
16ded525 TI |
3067 | static struct alc_config_preset alc880_presets[] = { |
3068 | [ALC880_3ST] = { | |
e9edcee0 | 3069 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
3070 | .init_verbs = { alc880_volume_init_verbs, |
3071 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 3072 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 | 3073 | .dac_nids = alc880_dac_nids, |
16ded525 TI |
3074 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
3075 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3076 | .need_dac_fix = 1, |
16ded525 TI |
3077 | .input_mux = &alc880_capture_source, |
3078 | }, | |
3079 | [ALC880_3ST_DIG] = { | |
e9edcee0 | 3080 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
3081 | .init_verbs = { alc880_volume_init_verbs, |
3082 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 3083 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 TI |
3084 | .dac_nids = alc880_dac_nids, |
3085 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3086 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
3087 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3088 | .need_dac_fix = 1, |
16ded525 TI |
3089 | .input_mux = &alc880_capture_source, |
3090 | }, | |
df694daa KY |
3091 | [ALC880_TCL_S700] = { |
3092 | .mixers = { alc880_tcl_s700_mixer }, | |
3093 | .init_verbs = { alc880_volume_init_verbs, | |
3094 | alc880_pin_tcl_S700_init_verbs, | |
3095 | alc880_gpio2_init_verbs }, | |
3096 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3097 | .dac_nids = alc880_dac_nids, | |
3098 | .hp_nid = 0x03, | |
3099 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3100 | .channel_mode = alc880_2_jack_modes, | |
3101 | .input_mux = &alc880_capture_source, | |
3102 | }, | |
16ded525 | 3103 | [ALC880_5ST] = { |
f12ab1e0 TI |
3104 | .mixers = { alc880_three_stack_mixer, |
3105 | alc880_five_stack_mixer}, | |
3106 | .init_verbs = { alc880_volume_init_verbs, | |
3107 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
3108 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
3109 | .dac_nids = alc880_dac_nids, | |
16ded525 TI |
3110 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
3111 | .channel_mode = alc880_fivestack_modes, | |
3112 | .input_mux = &alc880_capture_source, | |
3113 | }, | |
3114 | [ALC880_5ST_DIG] = { | |
f12ab1e0 TI |
3115 | .mixers = { alc880_three_stack_mixer, |
3116 | alc880_five_stack_mixer }, | |
3117 | .init_verbs = { alc880_volume_init_verbs, | |
3118 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
3119 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
3120 | .dac_nids = alc880_dac_nids, | |
3121 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3122 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
3123 | .channel_mode = alc880_fivestack_modes, | |
3124 | .input_mux = &alc880_capture_source, | |
3125 | }, | |
b6482d48 TI |
3126 | [ALC880_6ST] = { |
3127 | .mixers = { alc880_six_stack_mixer }, | |
f12ab1e0 TI |
3128 | .init_verbs = { alc880_volume_init_verbs, |
3129 | alc880_pin_6stack_init_verbs }, | |
b6482d48 TI |
3130 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
3131 | .dac_nids = alc880_6st_dac_nids, | |
3132 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
3133 | .channel_mode = alc880_sixstack_modes, | |
3134 | .input_mux = &alc880_6stack_capture_source, | |
3135 | }, | |
16ded525 | 3136 | [ALC880_6ST_DIG] = { |
e9edcee0 | 3137 | .mixers = { alc880_six_stack_mixer }, |
f12ab1e0 TI |
3138 | .init_verbs = { alc880_volume_init_verbs, |
3139 | alc880_pin_6stack_init_verbs }, | |
16ded525 TI |
3140 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
3141 | .dac_nids = alc880_6st_dac_nids, | |
3142 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3143 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
3144 | .channel_mode = alc880_sixstack_modes, | |
3145 | .input_mux = &alc880_6stack_capture_source, | |
3146 | }, | |
3147 | [ALC880_W810] = { | |
e9edcee0 | 3148 | .mixers = { alc880_w810_base_mixer }, |
f12ab1e0 TI |
3149 | .init_verbs = { alc880_volume_init_verbs, |
3150 | alc880_pin_w810_init_verbs, | |
b0af0de5 | 3151 | alc880_gpio2_init_verbs }, |
16ded525 TI |
3152 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
3153 | .dac_nids = alc880_w810_dac_nids, | |
3154 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3155 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
3156 | .channel_mode = alc880_w810_modes, | |
3157 | .input_mux = &alc880_capture_source, | |
3158 | }, | |
3159 | [ALC880_Z71V] = { | |
e9edcee0 | 3160 | .mixers = { alc880_z71v_mixer }, |
f12ab1e0 TI |
3161 | .init_verbs = { alc880_volume_init_verbs, |
3162 | alc880_pin_z71v_init_verbs }, | |
16ded525 TI |
3163 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
3164 | .dac_nids = alc880_z71v_dac_nids, | |
3165 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3166 | .hp_nid = 0x03, | |
e9edcee0 TI |
3167 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
3168 | .channel_mode = alc880_2_jack_modes, | |
16ded525 TI |
3169 | .input_mux = &alc880_capture_source, |
3170 | }, | |
3171 | [ALC880_F1734] = { | |
e9edcee0 | 3172 | .mixers = { alc880_f1734_mixer }, |
f12ab1e0 TI |
3173 | .init_verbs = { alc880_volume_init_verbs, |
3174 | alc880_pin_f1734_init_verbs }, | |
e9edcee0 TI |
3175 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
3176 | .dac_nids = alc880_f1734_dac_nids, | |
3177 | .hp_nid = 0x02, | |
3178 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3179 | .channel_mode = alc880_2_jack_modes, | |
937b4160 TI |
3180 | .input_mux = &alc880_f1734_capture_source, |
3181 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3182 | .init_hook = alc880_uniwill_p53_hp_automute, | |
16ded525 TI |
3183 | }, |
3184 | [ALC880_ASUS] = { | |
e9edcee0 | 3185 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
3186 | .init_verbs = { alc880_volume_init_verbs, |
3187 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3188 | alc880_gpio1_init_verbs }, |
3189 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3190 | .dac_nids = alc880_asus_dac_nids, | |
3191 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
3192 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3193 | .need_dac_fix = 1, |
16ded525 TI |
3194 | .input_mux = &alc880_capture_source, |
3195 | }, | |
3196 | [ALC880_ASUS_DIG] = { | |
e9edcee0 | 3197 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
3198 | .init_verbs = { alc880_volume_init_verbs, |
3199 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3200 | alc880_gpio1_init_verbs }, |
3201 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3202 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3203 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3204 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3205 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3206 | .need_dac_fix = 1, |
16ded525 TI |
3207 | .input_mux = &alc880_capture_source, |
3208 | }, | |
df694daa KY |
3209 | [ALC880_ASUS_DIG2] = { |
3210 | .mixers = { alc880_asus_mixer }, | |
f12ab1e0 TI |
3211 | .init_verbs = { alc880_volume_init_verbs, |
3212 | alc880_pin_asus_init_verbs, | |
df694daa KY |
3213 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
3214 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3215 | .dac_nids = alc880_asus_dac_nids, | |
3216 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3217 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
3218 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3219 | .need_dac_fix = 1, |
df694daa KY |
3220 | .input_mux = &alc880_capture_source, |
3221 | }, | |
16ded525 | 3222 | [ALC880_ASUS_W1V] = { |
e9edcee0 | 3223 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
f12ab1e0 TI |
3224 | .init_verbs = { alc880_volume_init_verbs, |
3225 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3226 | alc880_gpio1_init_verbs }, |
3227 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3228 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3229 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3230 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3231 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3232 | .need_dac_fix = 1, |
16ded525 TI |
3233 | .input_mux = &alc880_capture_source, |
3234 | }, | |
3235 | [ALC880_UNIWILL_DIG] = { | |
3c10a9d9 | 3236 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
ccc656ce KY |
3237 | .init_verbs = { alc880_volume_init_verbs, |
3238 | alc880_pin_asus_init_verbs }, | |
e9edcee0 TI |
3239 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
3240 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3241 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3242 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3243 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3244 | .need_dac_fix = 1, |
16ded525 TI |
3245 | .input_mux = &alc880_capture_source, |
3246 | }, | |
ccc656ce KY |
3247 | [ALC880_UNIWILL] = { |
3248 | .mixers = { alc880_uniwill_mixer }, | |
3249 | .init_verbs = { alc880_volume_init_verbs, | |
3250 | alc880_uniwill_init_verbs }, | |
3251 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3252 | .dac_nids = alc880_asus_dac_nids, | |
3253 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3254 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
3255 | .channel_mode = alc880_threestack_modes, | |
3256 | .need_dac_fix = 1, | |
3257 | .input_mux = &alc880_capture_source, | |
3258 | .unsol_event = alc880_uniwill_unsol_event, | |
3259 | .init_hook = alc880_uniwill_automute, | |
3260 | }, | |
3261 | [ALC880_UNIWILL_P53] = { | |
3262 | .mixers = { alc880_uniwill_p53_mixer }, | |
3263 | .init_verbs = { alc880_volume_init_verbs, | |
3264 | alc880_uniwill_p53_init_verbs }, | |
3265 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3266 | .dac_nids = alc880_asus_dac_nids, | |
3267 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
2cf9f0fc TD |
3268 | .channel_mode = alc880_threestack_modes, |
3269 | .input_mux = &alc880_capture_source, | |
3270 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3271 | .init_hook = alc880_uniwill_p53_hp_automute, | |
3272 | }, | |
3273 | [ALC880_FUJITSU] = { | |
f12ab1e0 | 3274 | .mixers = { alc880_fujitsu_mixer, |
2cf9f0fc TD |
3275 | alc880_pcbeep_mixer, }, |
3276 | .init_verbs = { alc880_volume_init_verbs, | |
3277 | alc880_uniwill_p53_init_verbs, | |
3278 | alc880_beep_init_verbs }, | |
3279 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3280 | .dac_nids = alc880_dac_nids, | |
d53d7d9e | 3281 | .dig_out_nid = ALC880_DIGOUT_NID, |
2cf9f0fc TD |
3282 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
3283 | .channel_mode = alc880_2_jack_modes, | |
ccc656ce KY |
3284 | .input_mux = &alc880_capture_source, |
3285 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3286 | .init_hook = alc880_uniwill_p53_hp_automute, | |
3287 | }, | |
df694daa KY |
3288 | [ALC880_CLEVO] = { |
3289 | .mixers = { alc880_three_stack_mixer }, | |
3290 | .init_verbs = { alc880_volume_init_verbs, | |
3291 | alc880_pin_clevo_init_verbs }, | |
3292 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3293 | .dac_nids = alc880_dac_nids, | |
3294 | .hp_nid = 0x03, | |
3295 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
3296 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3297 | .need_dac_fix = 1, |
df694daa KY |
3298 | .input_mux = &alc880_capture_source, |
3299 | }, | |
ae6b813a TI |
3300 | [ALC880_LG] = { |
3301 | .mixers = { alc880_lg_mixer }, | |
3302 | .init_verbs = { alc880_volume_init_verbs, | |
3303 | alc880_lg_init_verbs }, | |
3304 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
3305 | .dac_nids = alc880_lg_dac_nids, | |
3306 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3307 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
3308 | .channel_mode = alc880_lg_ch_modes, | |
4e195a7b | 3309 | .need_dac_fix = 1, |
ae6b813a TI |
3310 | .input_mux = &alc880_lg_capture_source, |
3311 | .unsol_event = alc880_lg_unsol_event, | |
3312 | .init_hook = alc880_lg_automute, | |
cb53c626 TI |
3313 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3314 | .loopbacks = alc880_lg_loopbacks, | |
3315 | #endif | |
ae6b813a | 3316 | }, |
d681518a TI |
3317 | [ALC880_LG_LW] = { |
3318 | .mixers = { alc880_lg_lw_mixer }, | |
3319 | .init_verbs = { alc880_volume_init_verbs, | |
3320 | alc880_lg_lw_init_verbs }, | |
0a8c5da3 | 3321 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
d681518a TI |
3322 | .dac_nids = alc880_dac_nids, |
3323 | .dig_out_nid = ALC880_DIGOUT_NID, | |
0a8c5da3 CM |
3324 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
3325 | .channel_mode = alc880_lg_lw_modes, | |
d681518a TI |
3326 | .input_mux = &alc880_lg_lw_capture_source, |
3327 | .unsol_event = alc880_lg_lw_unsol_event, | |
3328 | .init_hook = alc880_lg_lw_automute, | |
3329 | }, | |
df99cd33 TI |
3330 | [ALC880_MEDION_RIM] = { |
3331 | .mixers = { alc880_medion_rim_mixer }, | |
3332 | .init_verbs = { alc880_volume_init_verbs, | |
3333 | alc880_medion_rim_init_verbs, | |
3334 | alc_gpio2_init_verbs }, | |
3335 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3336 | .dac_nids = alc880_dac_nids, | |
3337 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3338 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3339 | .channel_mode = alc880_2_jack_modes, | |
3340 | .input_mux = &alc880_medion_rim_capture_source, | |
3341 | .unsol_event = alc880_medion_rim_unsol_event, | |
3342 | .init_hook = alc880_medion_rim_automute, | |
3343 | }, | |
16ded525 TI |
3344 | #ifdef CONFIG_SND_DEBUG |
3345 | [ALC880_TEST] = { | |
e9edcee0 TI |
3346 | .mixers = { alc880_test_mixer }, |
3347 | .init_verbs = { alc880_test_init_verbs }, | |
16ded525 TI |
3348 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
3349 | .dac_nids = alc880_test_dac_nids, | |
3350 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3351 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
3352 | .channel_mode = alc880_test_modes, | |
3353 | .input_mux = &alc880_test_capture_source, | |
3354 | }, | |
3355 | #endif | |
3356 | }; | |
3357 | ||
e9edcee0 TI |
3358 | /* |
3359 | * Automatic parse of I/O pins from the BIOS configuration | |
3360 | */ | |
3361 | ||
3362 | #define NUM_CONTROL_ALLOC 32 | |
3363 | #define NUM_VERB_ALLOC 32 | |
3364 | ||
3365 | enum { | |
3366 | ALC_CTL_WIDGET_VOL, | |
3367 | ALC_CTL_WIDGET_MUTE, | |
3368 | ALC_CTL_BIND_MUTE, | |
3369 | }; | |
c8b6bf9b | 3370 | static struct snd_kcontrol_new alc880_control_templates[] = { |
e9edcee0 TI |
3371 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
3372 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
985be54b | 3373 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
e9edcee0 TI |
3374 | }; |
3375 | ||
3376 | /* add dynamic controls */ | |
f12ab1e0 TI |
3377 | static int add_control(struct alc_spec *spec, int type, const char *name, |
3378 | unsigned long val) | |
e9edcee0 | 3379 | { |
c8b6bf9b | 3380 | struct snd_kcontrol_new *knew; |
e9edcee0 TI |
3381 | |
3382 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { | |
3383 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; | |
3384 | ||
f12ab1e0 TI |
3385 | /* array + terminator */ |
3386 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); | |
3387 | if (!knew) | |
e9edcee0 TI |
3388 | return -ENOMEM; |
3389 | if (spec->kctl_alloc) { | |
f12ab1e0 TI |
3390 | memcpy(knew, spec->kctl_alloc, |
3391 | sizeof(*knew) * spec->num_kctl_alloc); | |
e9edcee0 TI |
3392 | kfree(spec->kctl_alloc); |
3393 | } | |
3394 | spec->kctl_alloc = knew; | |
3395 | spec->num_kctl_alloc = num; | |
3396 | } | |
3397 | ||
3398 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | |
3399 | *knew = alc880_control_templates[type]; | |
543537bd | 3400 | knew->name = kstrdup(name, GFP_KERNEL); |
f12ab1e0 | 3401 | if (!knew->name) |
e9edcee0 TI |
3402 | return -ENOMEM; |
3403 | knew->private_value = val; | |
3404 | spec->num_kctl_used++; | |
3405 | return 0; | |
3406 | } | |
3407 | ||
3408 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) | |
3409 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
3410 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
3411 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
3412 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) | |
3413 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) | |
3414 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | |
3415 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
3416 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
3417 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
3418 | #define ALC880_PIN_CD_NID 0x1c | |
3419 | ||
3420 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
3421 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
3422 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
3423 | { |
3424 | hda_nid_t nid; | |
3425 | int assigned[4]; | |
3426 | int i, j; | |
3427 | ||
3428 | memset(assigned, 0, sizeof(assigned)); | |
b0af0de5 | 3429 | spec->multiout.dac_nids = spec->private_dac_nids; |
e9edcee0 TI |
3430 | |
3431 | /* check the pins hardwired to audio widget */ | |
3432 | for (i = 0; i < cfg->line_outs; i++) { | |
3433 | nid = cfg->line_out_pins[i]; | |
3434 | if (alc880_is_fixed_pin(nid)) { | |
3435 | int idx = alc880_fixed_pin_idx(nid); | |
5014f193 | 3436 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
e9edcee0 TI |
3437 | assigned[idx] = 1; |
3438 | } | |
3439 | } | |
3440 | /* left pins can be connect to any audio widget */ | |
3441 | for (i = 0; i < cfg->line_outs; i++) { | |
3442 | nid = cfg->line_out_pins[i]; | |
3443 | if (alc880_is_fixed_pin(nid)) | |
3444 | continue; | |
3445 | /* search for an empty channel */ | |
3446 | for (j = 0; j < cfg->line_outs; j++) { | |
f12ab1e0 TI |
3447 | if (!assigned[j]) { |
3448 | spec->multiout.dac_nids[i] = | |
3449 | alc880_idx_to_dac(j); | |
e9edcee0 TI |
3450 | assigned[j] = 1; |
3451 | break; | |
3452 | } | |
3453 | } | |
3454 | } | |
3455 | spec->multiout.num_dacs = cfg->line_outs; | |
3456 | return 0; | |
3457 | } | |
3458 | ||
3459 | /* add playback controls from the parsed DAC table */ | |
df694daa KY |
3460 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
3461 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
3462 | { |
3463 | char name[32]; | |
f12ab1e0 TI |
3464 | static const char *chname[4] = { |
3465 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
3466 | }; | |
e9edcee0 TI |
3467 | hda_nid_t nid; |
3468 | int i, err; | |
3469 | ||
3470 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 3471 | if (!spec->multiout.dac_nids[i]) |
e9edcee0 TI |
3472 | continue; |
3473 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
3474 | if (i == 2) { | |
3475 | /* Center/LFE */ | |
f12ab1e0 TI |
3476 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
3477 | "Center Playback Volume", | |
3478 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
3479 | HDA_OUTPUT)); | |
3480 | if (err < 0) | |
e9edcee0 | 3481 | return err; |
f12ab1e0 TI |
3482 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
3483 | "LFE Playback Volume", | |
3484 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
3485 | HDA_OUTPUT)); | |
3486 | if (err < 0) | |
e9edcee0 | 3487 | return err; |
f12ab1e0 TI |
3488 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
3489 | "Center Playback Switch", | |
3490 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | |
3491 | HDA_INPUT)); | |
3492 | if (err < 0) | |
e9edcee0 | 3493 | return err; |
f12ab1e0 TI |
3494 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
3495 | "LFE Playback Switch", | |
3496 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | |
3497 | HDA_INPUT)); | |
3498 | if (err < 0) | |
e9edcee0 TI |
3499 | return err; |
3500 | } else { | |
3501 | sprintf(name, "%s Playback Volume", chname[i]); | |
f12ab1e0 TI |
3502 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3503 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
3504 | HDA_OUTPUT)); | |
3505 | if (err < 0) | |
e9edcee0 TI |
3506 | return err; |
3507 | sprintf(name, "%s Playback Switch", chname[i]); | |
f12ab1e0 TI |
3508 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
3509 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | |
3510 | HDA_INPUT)); | |
3511 | if (err < 0) | |
e9edcee0 TI |
3512 | return err; |
3513 | } | |
3514 | } | |
e9edcee0 TI |
3515 | return 0; |
3516 | } | |
3517 | ||
8d88bc3d TI |
3518 | /* add playback controls for speaker and HP outputs */ |
3519 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
3520 | const char *pfx) | |
e9edcee0 TI |
3521 | { |
3522 | hda_nid_t nid; | |
3523 | int err; | |
8d88bc3d | 3524 | char name[32]; |
e9edcee0 | 3525 | |
f12ab1e0 | 3526 | if (!pin) |
e9edcee0 TI |
3527 | return 0; |
3528 | ||
3529 | if (alc880_is_fixed_pin(pin)) { | |
3530 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
82bc955f | 3531 | /* specify the DAC as the extra output */ |
f12ab1e0 | 3532 | if (!spec->multiout.hp_nid) |
e9edcee0 | 3533 | spec->multiout.hp_nid = nid; |
82bc955f TI |
3534 | else |
3535 | spec->multiout.extra_out_nid[0] = nid; | |
e9edcee0 TI |
3536 | /* control HP volume/switch on the output mixer amp */ |
3537 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
8d88bc3d | 3538 | sprintf(name, "%s Playback Volume", pfx); |
f12ab1e0 TI |
3539 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3540 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
3541 | if (err < 0) | |
e9edcee0 | 3542 | return err; |
8d88bc3d | 3543 | sprintf(name, "%s Playback Switch", pfx); |
f12ab1e0 TI |
3544 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
3545 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
3546 | if (err < 0) | |
e9edcee0 TI |
3547 | return err; |
3548 | } else if (alc880_is_multi_pin(pin)) { | |
3549 | /* set manual connection */ | |
e9edcee0 | 3550 | /* we have only a switch on HP-out PIN */ |
8d88bc3d | 3551 | sprintf(name, "%s Playback Switch", pfx); |
f12ab1e0 TI |
3552 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
3553 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
3554 | if (err < 0) | |
e9edcee0 TI |
3555 | return err; |
3556 | } | |
3557 | return 0; | |
3558 | } | |
3559 | ||
3560 | /* create input playback/capture controls for the given pin */ | |
f12ab1e0 TI |
3561 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
3562 | const char *ctlname, | |
df694daa | 3563 | int idx, hda_nid_t mix_nid) |
e9edcee0 TI |
3564 | { |
3565 | char name[32]; | |
df694daa | 3566 | int err; |
e9edcee0 TI |
3567 | |
3568 | sprintf(name, "%s Playback Volume", ctlname); | |
f12ab1e0 TI |
3569 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3570 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
3571 | if (err < 0) | |
e9edcee0 TI |
3572 | return err; |
3573 | sprintf(name, "%s Playback Switch", ctlname); | |
f12ab1e0 TI |
3574 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
3575 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
3576 | if (err < 0) | |
e9edcee0 TI |
3577 | return err; |
3578 | return 0; | |
3579 | } | |
3580 | ||
3581 | /* create playback/capture controls for input pins */ | |
df694daa KY |
3582 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
3583 | const struct auto_pin_cfg *cfg) | |
e9edcee0 | 3584 | { |
e9edcee0 | 3585 | struct hda_input_mux *imux = &spec->private_imux; |
df694daa | 3586 | int i, err, idx; |
e9edcee0 TI |
3587 | |
3588 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
3589 | if (alc880_is_input_pin(cfg->input_pins[i])) { | |
df694daa | 3590 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
4a471b7d TI |
3591 | err = new_analog_input(spec, cfg->input_pins[i], |
3592 | auto_pin_cfg_labels[i], | |
df694daa | 3593 | idx, 0x0b); |
e9edcee0 TI |
3594 | if (err < 0) |
3595 | return err; | |
f12ab1e0 TI |
3596 | imux->items[imux->num_items].label = |
3597 | auto_pin_cfg_labels[i]; | |
3598 | imux->items[imux->num_items].index = | |
3599 | alc880_input_pin_idx(cfg->input_pins[i]); | |
e9edcee0 TI |
3600 | imux->num_items++; |
3601 | } | |
3602 | } | |
3603 | return 0; | |
3604 | } | |
3605 | ||
f6c7e546 TI |
3606 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
3607 | unsigned int pin_type) | |
3608 | { | |
3609 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3610 | pin_type); | |
3611 | /* unmute pin */ | |
d260cdf6 TI |
3612 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
3613 | AMP_OUT_UNMUTE); | |
f6c7e546 TI |
3614 | } |
3615 | ||
df694daa KY |
3616 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
3617 | hda_nid_t nid, int pin_type, | |
e9edcee0 TI |
3618 | int dac_idx) |
3619 | { | |
f6c7e546 | 3620 | alc_set_pin_output(codec, nid, pin_type); |
e9edcee0 TI |
3621 | /* need the manual connection? */ |
3622 | if (alc880_is_multi_pin(nid)) { | |
3623 | struct alc_spec *spec = codec->spec; | |
3624 | int idx = alc880_multi_pin_idx(nid); | |
3625 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
3626 | AC_VERB_SET_CONNECT_SEL, | |
3627 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
3628 | } | |
3629 | } | |
3630 | ||
baba8ee9 TI |
3631 | static int get_pin_type(int line_out_type) |
3632 | { | |
3633 | if (line_out_type == AUTO_PIN_HP_OUT) | |
3634 | return PIN_HP; | |
3635 | else | |
3636 | return PIN_OUT; | |
3637 | } | |
3638 | ||
e9edcee0 TI |
3639 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
3640 | { | |
3641 | struct alc_spec *spec = codec->spec; | |
3642 | int i; | |
bc9f98a9 KY |
3643 | |
3644 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); | |
e9edcee0 TI |
3645 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
3646 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 TI |
3647 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
3648 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
e9edcee0 TI |
3649 | } |
3650 | } | |
3651 | ||
8d88bc3d | 3652 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
e9edcee0 TI |
3653 | { |
3654 | struct alc_spec *spec = codec->spec; | |
3655 | hda_nid_t pin; | |
3656 | ||
82bc955f | 3657 | pin = spec->autocfg.speaker_pins[0]; |
8d88bc3d TI |
3658 | if (pin) /* connect to front */ |
3659 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
eb06ed8f | 3660 | pin = spec->autocfg.hp_pins[0]; |
e9edcee0 TI |
3661 | if (pin) /* connect to front */ |
3662 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
3663 | } | |
3664 | ||
3665 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
3666 | { | |
3667 | struct alc_spec *spec = codec->spec; | |
3668 | int i; | |
3669 | ||
3670 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
3671 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
3672 | if (alc880_is_input_pin(nid)) { | |
f12ab1e0 TI |
3673 | snd_hda_codec_write(codec, nid, 0, |
3674 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3675 | i <= AUTO_PIN_FRONT_MIC ? | |
3676 | PIN_VREF80 : PIN_IN); | |
e9edcee0 | 3677 | if (nid != ALC880_PIN_CD_NID) |
f12ab1e0 TI |
3678 | snd_hda_codec_write(codec, nid, 0, |
3679 | AC_VERB_SET_AMP_GAIN_MUTE, | |
e9edcee0 TI |
3680 | AMP_OUT_MUTE); |
3681 | } | |
3682 | } | |
3683 | } | |
3684 | ||
3685 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
3686 | /* return 1 if successful, 0 if the proper config is not found, |
3687 | * or a negative error code | |
3688 | */ | |
e9edcee0 TI |
3689 | static int alc880_parse_auto_config(struct hda_codec *codec) |
3690 | { | |
3691 | struct alc_spec *spec = codec->spec; | |
3692 | int err; | |
df694daa | 3693 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
e9edcee0 | 3694 | |
f12ab1e0 TI |
3695 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
3696 | alc880_ignore); | |
3697 | if (err < 0) | |
e9edcee0 | 3698 | return err; |
f12ab1e0 | 3699 | if (!spec->autocfg.line_outs) |
e9edcee0 | 3700 | return 0; /* can't find valid BIOS pin config */ |
df694daa | 3701 | |
f12ab1e0 TI |
3702 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
3703 | if (err < 0) | |
3704 | return err; | |
3705 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
3706 | if (err < 0) | |
3707 | return err; | |
3708 | err = alc880_auto_create_extra_out(spec, | |
3709 | spec->autocfg.speaker_pins[0], | |
3710 | "Speaker"); | |
3711 | if (err < 0) | |
3712 | return err; | |
3713 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
3714 | "Headphone"); | |
3715 | if (err < 0) | |
3716 | return err; | |
3717 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
3718 | if (err < 0) | |
e9edcee0 TI |
3719 | return err; |
3720 | ||
3721 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
3722 | ||
3723 | if (spec->autocfg.dig_out_pin) | |
3724 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | |
3725 | if (spec->autocfg.dig_in_pin) | |
3726 | spec->dig_in_nid = ALC880_DIGIN_NID; | |
3727 | ||
3728 | if (spec->kctl_alloc) | |
3729 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
3730 | ||
3731 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; | |
3732 | ||
a1e8d2da | 3733 | spec->num_mux_defs = 1; |
e9edcee0 TI |
3734 | spec->input_mux = &spec->private_imux; |
3735 | ||
3736 | return 1; | |
3737 | } | |
3738 | ||
ae6b813a TI |
3739 | /* additional initialization for auto-configuration model */ |
3740 | static void alc880_auto_init(struct hda_codec *codec) | |
e9edcee0 | 3741 | { |
f6c7e546 | 3742 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 3743 | alc880_auto_init_multi_out(codec); |
8d88bc3d | 3744 | alc880_auto_init_extra_out(codec); |
e9edcee0 | 3745 | alc880_auto_init_analog_input(codec); |
f6c7e546 TI |
3746 | if (spec->unsol_event) |
3747 | alc_sku_automute(codec); | |
e9edcee0 TI |
3748 | } |
3749 | ||
3750 | /* | |
3751 | * OK, here we have finally the patch for ALC880 | |
3752 | */ | |
3753 | ||
1da177e4 LT |
3754 | static int patch_alc880(struct hda_codec *codec) |
3755 | { | |
3756 | struct alc_spec *spec; | |
3757 | int board_config; | |
df694daa | 3758 | int err; |
1da177e4 | 3759 | |
e560d8d8 | 3760 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
3761 | if (spec == NULL) |
3762 | return -ENOMEM; | |
3763 | ||
3764 | codec->spec = spec; | |
3765 | ||
f5fcc13c TI |
3766 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
3767 | alc880_models, | |
3768 | alc880_cfg_tbl); | |
3769 | if (board_config < 0) { | |
9c7f852e TI |
3770 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
3771 | "trying auto-probe from BIOS...\n"); | |
e9edcee0 | 3772 | board_config = ALC880_AUTO; |
1da177e4 | 3773 | } |
1da177e4 | 3774 | |
e9edcee0 TI |
3775 | if (board_config == ALC880_AUTO) { |
3776 | /* automatic parse from the BIOS config */ | |
3777 | err = alc880_parse_auto_config(codec); | |
3778 | if (err < 0) { | |
3779 | alc_free(codec); | |
3780 | return err; | |
f12ab1e0 | 3781 | } else if (!err) { |
9c7f852e TI |
3782 | printk(KERN_INFO |
3783 | "hda_codec: Cannot set up configuration " | |
3784 | "from BIOS. Using 3-stack mode...\n"); | |
e9edcee0 TI |
3785 | board_config = ALC880_3ST; |
3786 | } | |
1da177e4 LT |
3787 | } |
3788 | ||
df694daa KY |
3789 | if (board_config != ALC880_AUTO) |
3790 | setup_preset(spec, &alc880_presets[board_config]); | |
1da177e4 LT |
3791 | |
3792 | spec->stream_name_analog = "ALC880 Analog"; | |
3793 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | |
3794 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
6330079f | 3795 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
1da177e4 LT |
3796 | |
3797 | spec->stream_name_digital = "ALC880 Digital"; | |
3798 | spec->stream_digital_playback = &alc880_pcm_digital_playback; | |
3799 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
3800 | ||
f12ab1e0 | 3801 | if (!spec->adc_nids && spec->input_mux) { |
e9edcee0 | 3802 | /* check whether NID 0x07 is valid */ |
54d17403 | 3803 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
f12ab1e0 TI |
3804 | /* get type */ |
3805 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
e9edcee0 TI |
3806 | if (wcap != AC_WID_AUD_IN) { |
3807 | spec->adc_nids = alc880_adc_nids_alt; | |
3808 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
f12ab1e0 TI |
3809 | spec->mixers[spec->num_mixers] = |
3810 | alc880_capture_alt_mixer; | |
e9edcee0 TI |
3811 | spec->num_mixers++; |
3812 | } else { | |
3813 | spec->adc_nids = alc880_adc_nids; | |
3814 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
3815 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; | |
3816 | spec->num_mixers++; | |
3817 | } | |
3818 | } | |
1da177e4 | 3819 | |
2134ea4f TI |
3820 | spec->vmaster_nid = 0x0c; |
3821 | ||
1da177e4 | 3822 | codec->patch_ops = alc_patch_ops; |
e9edcee0 | 3823 | if (board_config == ALC880_AUTO) |
ae6b813a | 3824 | spec->init_hook = alc880_auto_init; |
cb53c626 TI |
3825 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3826 | if (!spec->loopback.amplist) | |
3827 | spec->loopback.amplist = alc880_loopbacks; | |
3828 | #endif | |
1da177e4 LT |
3829 | |
3830 | return 0; | |
3831 | } | |
3832 | ||
e9edcee0 | 3833 | |
1da177e4 LT |
3834 | /* |
3835 | * ALC260 support | |
3836 | */ | |
3837 | ||
e9edcee0 TI |
3838 | static hda_nid_t alc260_dac_nids[1] = { |
3839 | /* front */ | |
3840 | 0x02, | |
3841 | }; | |
3842 | ||
3843 | static hda_nid_t alc260_adc_nids[1] = { | |
3844 | /* ADC0 */ | |
3845 | 0x04, | |
3846 | }; | |
3847 | ||
df694daa | 3848 | static hda_nid_t alc260_adc_nids_alt[1] = { |
e9edcee0 TI |
3849 | /* ADC1 */ |
3850 | 0x05, | |
3851 | }; | |
3852 | ||
df694daa KY |
3853 | static hda_nid_t alc260_hp_adc_nids[2] = { |
3854 | /* ADC1, 0 */ | |
3855 | 0x05, 0x04 | |
3856 | }; | |
3857 | ||
d57fdac0 JW |
3858 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
3859 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
3860 | */ | |
3861 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
4c5186ed JW |
3862 | /* ADC0, ADC1 */ |
3863 | 0x04, 0x05 | |
3864 | }; | |
3865 | ||
e9edcee0 TI |
3866 | #define ALC260_DIGOUT_NID 0x03 |
3867 | #define ALC260_DIGIN_NID 0x06 | |
3868 | ||
3869 | static struct hda_input_mux alc260_capture_source = { | |
3870 | .num_items = 4, | |
3871 | .items = { | |
3872 | { "Mic", 0x0 }, | |
3873 | { "Front Mic", 0x1 }, | |
3874 | { "Line", 0x2 }, | |
3875 | { "CD", 0x4 }, | |
3876 | }, | |
3877 | }; | |
3878 | ||
17e7aec6 | 3879 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
a1e8d2da JW |
3880 | * headphone jack and the internal CD lines since these are the only pins at |
3881 | * which audio can appear. For flexibility, also allow the option of | |
3882 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
3883 | * connection to the mixer output). | |
a9430dd8 | 3884 | */ |
a1e8d2da JW |
3885 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
3886 | { | |
3887 | .num_items = 3, | |
3888 | .items = { | |
3889 | { "Mic/Line", 0x0 }, | |
3890 | { "CD", 0x4 }, | |
3891 | { "Headphone", 0x2 }, | |
3892 | }, | |
a9430dd8 | 3893 | }, |
a1e8d2da JW |
3894 | { |
3895 | .num_items = 4, | |
3896 | .items = { | |
3897 | { "Mic/Line", 0x0 }, | |
3898 | { "CD", 0x4 }, | |
3899 | { "Headphone", 0x2 }, | |
3900 | { "Mixer", 0x5 }, | |
3901 | }, | |
3902 | }, | |
3903 | ||
a9430dd8 JW |
3904 | }; |
3905 | ||
a1e8d2da JW |
3906 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
3907 | * the Fujitsu S702x, but jacks are marked differently. | |
0bfc90e9 | 3908 | */ |
a1e8d2da JW |
3909 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
3910 | { | |
3911 | .num_items = 4, | |
3912 | .items = { | |
3913 | { "Mic", 0x0 }, | |
3914 | { "Line", 0x2 }, | |
3915 | { "CD", 0x4 }, | |
3916 | { "Headphone", 0x5 }, | |
3917 | }, | |
3918 | }, | |
3919 | { | |
3920 | .num_items = 5, | |
3921 | .items = { | |
3922 | { "Mic", 0x0 }, | |
3923 | { "Line", 0x2 }, | |
3924 | { "CD", 0x4 }, | |
3925 | { "Headphone", 0x6 }, | |
3926 | { "Mixer", 0x5 }, | |
3927 | }, | |
0bfc90e9 JW |
3928 | }, |
3929 | }; | |
1da177e4 LT |
3930 | /* |
3931 | * This is just place-holder, so there's something for alc_build_pcms to look | |
3932 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
3933 | * element which allows changing the channel mode, so the verb list is | |
3934 | * never used. | |
3935 | */ | |
d2a6d7dc | 3936 | static struct hda_channel_mode alc260_modes[1] = { |
1da177e4 LT |
3937 | { 2, NULL }, |
3938 | }; | |
3939 | ||
df694daa KY |
3940 | |
3941 | /* Mixer combinations | |
3942 | * | |
3943 | * basic: base_output + input + pc_beep + capture | |
3944 | * HP: base_output + input + capture_alt | |
3945 | * HP_3013: hp_3013 + input + capture | |
3946 | * fujitsu: fujitsu + capture | |
0bfc90e9 | 3947 | * acer: acer + capture |
df694daa KY |
3948 | */ |
3949 | ||
3950 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
05acb863 | 3951 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 3952 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
05acb863 | 3953 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
985be54b | 3954 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
05acb863 | 3955 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
985be54b | 3956 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
1da177e4 | 3957 | { } /* end */ |
f12ab1e0 | 3958 | }; |
1da177e4 | 3959 | |
df694daa | 3960 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
16ded525 TI |
3961 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
3962 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
3963 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
3964 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
3965 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
3966 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
3967 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
3968 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
df694daa KY |
3969 | { } /* end */ |
3970 | }; | |
3971 | ||
3972 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { | |
3973 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), | |
3974 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), | |
3975 | { } /* end */ | |
3976 | }; | |
3977 | ||
bec15c3a TI |
3978 | /* update HP, line and mono out pins according to the master switch */ |
3979 | static void alc260_hp_master_update(struct hda_codec *codec, | |
3980 | hda_nid_t hp, hda_nid_t line, | |
3981 | hda_nid_t mono) | |
3982 | { | |
3983 | struct alc_spec *spec = codec->spec; | |
3984 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
3985 | /* change HP and line-out pins */ | |
3986 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3987 | val); | |
3988 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3989 | val); | |
3990 | /* mono (speaker) depending on the HP jack sense */ | |
3991 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
3992 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3993 | val); | |
3994 | } | |
3995 | ||
3996 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
3997 | struct snd_ctl_elem_value *ucontrol) | |
3998 | { | |
3999 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4000 | struct alc_spec *spec = codec->spec; | |
4001 | *ucontrol->value.integer.value = spec->master_sw; | |
4002 | return 0; | |
4003 | } | |
4004 | ||
4005 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
4006 | struct snd_ctl_elem_value *ucontrol) | |
4007 | { | |
4008 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4009 | struct alc_spec *spec = codec->spec; | |
4010 | int val = !!*ucontrol->value.integer.value; | |
4011 | hda_nid_t hp, line, mono; | |
4012 | ||
4013 | if (val == spec->master_sw) | |
4014 | return 0; | |
4015 | spec->master_sw = val; | |
4016 | hp = (kcontrol->private_value >> 16) & 0xff; | |
4017 | line = (kcontrol->private_value >> 8) & 0xff; | |
4018 | mono = kcontrol->private_value & 0xff; | |
4019 | alc260_hp_master_update(codec, hp, line, mono); | |
4020 | return 1; | |
4021 | } | |
4022 | ||
4023 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
4024 | { | |
4025 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4026 | .name = "Master Playback Switch", | |
4027 | .info = snd_ctl_boolean_mono_info, | |
4028 | .get = alc260_hp_master_sw_get, | |
4029 | .put = alc260_hp_master_sw_put, | |
4030 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
4031 | }, | |
4032 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4033 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
4034 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
4035 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
4036 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
4037 | HDA_OUTPUT), | |
4038 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
4039 | { } /* end */ | |
4040 | }; | |
4041 | ||
4042 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
4043 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4044 | {}, | |
4045 | }; | |
4046 | ||
4047 | static void alc260_hp_automute(struct hda_codec *codec) | |
4048 | { | |
4049 | struct alc_spec *spec = codec->spec; | |
4050 | unsigned int present; | |
4051 | ||
4052 | present = snd_hda_codec_read(codec, 0x10, 0, | |
4053 | AC_VERB_GET_PIN_SENSE, 0); | |
4054 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
4055 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); | |
4056 | } | |
4057 | ||
4058 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
4059 | { | |
4060 | if ((res >> 26) == ALC880_HP_EVENT) | |
4061 | alc260_hp_automute(codec); | |
4062 | } | |
4063 | ||
df694daa | 4064 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
bec15c3a TI |
4065 | { |
4066 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4067 | .name = "Master Playback Switch", | |
4068 | .info = snd_ctl_boolean_mono_info, | |
4069 | .get = alc260_hp_master_sw_get, | |
4070 | .put = alc260_hp_master_sw_put, | |
4071 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 | |
4072 | }, | |
df694daa KY |
4073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
4074 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
4075 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
4076 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
4077 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4078 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
4079 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
4080 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
16ded525 TI |
4081 | { } /* end */ |
4082 | }; | |
4083 | ||
bec15c3a TI |
4084 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
4085 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4086 | {}, | |
4087 | }; | |
4088 | ||
4089 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
4090 | { | |
4091 | struct alc_spec *spec = codec->spec; | |
4092 | unsigned int present; | |
4093 | ||
4094 | present = snd_hda_codec_read(codec, 0x15, 0, | |
4095 | AC_VERB_GET_PIN_SENSE, 0); | |
4096 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
4097 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); | |
4098 | } | |
4099 | ||
4100 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
4101 | unsigned int res) | |
4102 | { | |
4103 | if ((res >> 26) == ALC880_HP_EVENT) | |
4104 | alc260_hp_3013_automute(codec); | |
4105 | } | |
4106 | ||
a1e8d2da JW |
4107 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
4108 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | |
4109 | */ | |
c8b6bf9b | 4110 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
a9430dd8 | 4111 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 4112 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
4c5186ed | 4113 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
a9430dd8 JW |
4114 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4115 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4116 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4117 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4c5186ed | 4118 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
a9430dd8 JW |
4119 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
4120 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
31bffaa9 TI |
4121 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
4122 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
df694daa KY |
4123 | { } /* end */ |
4124 | }; | |
4125 | ||
a1e8d2da JW |
4126 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
4127 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
4128 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
4129 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
4130 | * whether this behaviour is intentional or is a hardware bug in chip | |
4131 | * revisions available in early 2006. Therefore for now allow the | |
4132 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
4133 | * that the lack of mic bias for this NID is intentional we could change the | |
4134 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
4135 | * | |
4136 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
4137 | * don't appear to make the mic bias available from the "line" jack, even | |
4138 | * though the NID used for this jack (0x14) can supply it. The theory is | |
4139 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
4140 | * and the output jack. If this turns out to be the case for all such | |
4141 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
4142 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
bd869485 JW |
4143 | * |
4144 | * The C20x Tablet series have a mono internal speaker which is controlled | |
4145 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
4146 | * controls for such models. On models without a "mono speaker" the control | |
4147 | * won't do anything. | |
a1e8d2da | 4148 | */ |
0bfc90e9 JW |
4149 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
4150 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4151 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
a1e8d2da | 4152 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
31bffaa9 | 4153 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
bd869485 | 4154 | HDA_OUTPUT), |
31bffaa9 | 4155 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
bd869485 | 4156 | HDA_INPUT), |
0bfc90e9 JW |
4157 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4158 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4159 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4160 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4161 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4162 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4163 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4164 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4165 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4166 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4167 | { } /* end */ | |
4168 | }; | |
4169 | ||
bc9f98a9 KY |
4170 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
4171 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
4172 | */ | |
4173 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
4174 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4175 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
4176 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4177 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4178 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4179 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4180 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4181 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4182 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
4183 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4184 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4185 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4186 | { } /* end */ | |
4187 | }; | |
4188 | ||
4189 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
4190 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
4191 | */ | |
4192 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
4193 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4194 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
4195 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4196 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4197 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4198 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
4199 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
4200 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4201 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4202 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4203 | { } /* end */ | |
4204 | }; | |
4205 | ||
df694daa KY |
4206 | /* capture mixer elements */ |
4207 | static struct snd_kcontrol_new alc260_capture_mixer[] = { | |
a9430dd8 JW |
4208 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
4209 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), | |
df694daa KY |
4210 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
4211 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), | |
a9430dd8 JW |
4212 | { |
4213 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
df694daa KY |
4214 | /* The multiple "Capture Source" controls confuse alsamixer |
4215 | * So call somewhat different.. | |
df694daa KY |
4216 | */ |
4217 | /* .name = "Capture Source", */ | |
4218 | .name = "Input Source", | |
4219 | .count = 2, | |
4220 | .info = alc_mux_enum_info, | |
4221 | .get = alc_mux_enum_get, | |
4222 | .put = alc_mux_enum_put, | |
4223 | }, | |
4224 | { } /* end */ | |
4225 | }; | |
4226 | ||
4227 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { | |
4228 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), | |
4229 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), | |
4230 | { | |
4231 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4232 | /* The multiple "Capture Source" controls confuse alsamixer | |
4233 | * So call somewhat different.. | |
df694daa KY |
4234 | */ |
4235 | /* .name = "Capture Source", */ | |
4236 | .name = "Input Source", | |
4237 | .count = 1, | |
a9430dd8 JW |
4238 | .info = alc_mux_enum_info, |
4239 | .get = alc_mux_enum_get, | |
4240 | .put = alc_mux_enum_put, | |
4241 | }, | |
4242 | { } /* end */ | |
4243 | }; | |
4244 | ||
df694daa KY |
4245 | /* |
4246 | * initialization verbs | |
4247 | */ | |
1da177e4 LT |
4248 | static struct hda_verb alc260_init_verbs[] = { |
4249 | /* Line In pin widget for input */ | |
05acb863 | 4250 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 4251 | /* CD pin widget for input */ |
05acb863 | 4252 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 4253 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
16ded525 | 4254 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 4255 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
16ded525 | 4256 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 4257 | /* LINE-2 is used for line-out in rear */ |
05acb863 | 4258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 4259 | /* select line-out */ |
fd56f2db | 4260 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 | 4261 | /* LINE-OUT pin */ |
05acb863 | 4262 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 4263 | /* enable HP */ |
05acb863 | 4264 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1da177e4 | 4265 | /* enable Mono */ |
05acb863 TI |
4266 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
4267 | /* mute capture amp left and right */ | |
16ded525 | 4268 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 LT |
4269 | /* set connection select to line in (default select for this ADC) */ |
4270 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16ded525 TI |
4271 | /* mute capture amp left and right */ |
4272 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4273 | /* set connection select to line in (default select for this ADC) */ | |
4274 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
05acb863 TI |
4275 | /* set vol=0 Line-Out mixer amp left and right */ |
4276 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4277 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4278 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4279 | /* set vol=0 HP mixer amp left and right */ | |
4280 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4281 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4282 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4283 | /* set vol=0 Mono mixer amp left and right */ | |
4284 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4285 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4286 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4287 | /* unmute LINE-2 out pin */ | |
4288 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f12ab1e0 TI |
4289 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4290 | * Line In 2 = 0x03 | |
4291 | */ | |
cb53c626 TI |
4292 | /* mute analog inputs */ |
4293 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4294 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4295 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4296 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4297 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 4298 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
05acb863 TI |
4299 | /* mute Front out path */ |
4300 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4301 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4302 | /* mute Headphone out path */ | |
4303 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4304 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4305 | /* mute Mono out path */ | |
4306 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4307 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
4308 | { } |
4309 | }; | |
4310 | ||
474167d6 | 4311 | #if 0 /* should be identical with alc260_init_verbs? */ |
df694daa KY |
4312 | static struct hda_verb alc260_hp_init_verbs[] = { |
4313 | /* Headphone and output */ | |
4314 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
4315 | /* mono output */ | |
4316 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4317 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
4318 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4319 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
4320 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4321 | /* Line In pin widget for input */ | |
4322 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4323 | /* Line-2 pin widget for output */ | |
4324 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4325 | /* CD pin widget for input */ | |
4326 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4327 | /* unmute amp left and right */ | |
4328 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
4329 | /* set connection select to line in (default select for this ADC) */ | |
4330 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
4331 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
4332 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4333 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4334 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
4335 | /* unmute HP mixer amp left and right (volume = 0) */ | |
4336 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4337 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4338 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
4339 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4340 | * Line In 2 = 0x03 | |
4341 | */ | |
cb53c626 TI |
4342 | /* mute analog inputs */ |
4343 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4344 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4345 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4346 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4347 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
4348 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
4349 | /* Unmute Front out path */ | |
4350 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4351 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4352 | /* Unmute Headphone out path */ | |
4353 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4354 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4355 | /* Unmute Mono out path */ | |
4356 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4357 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4358 | { } | |
4359 | }; | |
474167d6 | 4360 | #endif |
df694daa KY |
4361 | |
4362 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
4363 | /* Line out and output */ | |
4364 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4365 | /* mono output */ | |
4366 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4367 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
4368 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4369 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
4370 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4371 | /* Line In pin widget for input */ | |
4372 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4373 | /* Headphone pin widget for output */ | |
4374 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
4375 | /* CD pin widget for input */ | |
4376 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4377 | /* unmute amp left and right */ | |
4378 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
4379 | /* set connection select to line in (default select for this ADC) */ | |
4380 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
4381 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
4382 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4383 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4384 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
4385 | /* unmute HP mixer amp left and right (volume = 0) */ | |
4386 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4387 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4388 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
4389 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4390 | * Line In 2 = 0x03 | |
4391 | */ | |
cb53c626 TI |
4392 | /* mute analog inputs */ |
4393 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4394 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4395 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
4398 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
4399 | /* Unmute Front out path */ | |
4400 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4401 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4402 | /* Unmute Headphone out path */ | |
4403 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4404 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4405 | /* Unmute Mono out path */ | |
4406 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4407 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4408 | { } | |
4409 | }; | |
4410 | ||
a9430dd8 | 4411 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
a1e8d2da JW |
4412 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
4413 | * audio = 0x16, internal speaker = 0x10. | |
a9430dd8 JW |
4414 | */ |
4415 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
4416 | /* Disable all GPIOs */ | |
4417 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
4418 | /* Internal speaker is connected to headphone pin */ | |
4419 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4420 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
4421 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
f7ace40d JW |
4422 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
4423 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4424 | /* Ensure all other unused pins are disabled and muted. */ | |
4425 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4426 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a9430dd8 | 4427 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d | 4428 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
a9430dd8 | 4429 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d JW |
4430 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
4431 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4432 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4433 | ||
4434 | /* Disable digital (SPDIF) pins */ | |
4435 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4436 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
a9430dd8 | 4437 | |
f7ace40d JW |
4438 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
4439 | * when acting as an output. | |
4440 | */ | |
4441 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4c5186ed | 4442 | |
f7ace40d | 4443 | /* Start with output sum widgets muted and their output gains at min */ |
8b33a5aa TI |
4444 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
4445 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4447 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4448 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4449 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4450 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4451 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4452 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a9430dd8 | 4453 | |
f7ace40d JW |
4454 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
4455 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4456 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
4457 | * If the pin mode is changed by the user the pin mode control will | |
4458 | * take care of enabling the pin's input/output buffers as needed. | |
4459 | * Therefore there's no need to enable the input buffer at this | |
4460 | * stage. | |
cdcd9268 | 4461 | */ |
f7ace40d | 4462 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
cdcd9268 JW |
4463 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
4464 | * mixer ctrl) | |
4465 | */ | |
f7ace40d JW |
4466 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4467 | ||
4468 | /* Mute capture amp left and right */ | |
4469 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4470 | /* Set ADC connection select to match default mixer setting - line | |
4471 | * in (on mic1 pin) | |
4472 | */ | |
4473 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4474 | ||
4475 | /* Do the same for the second ADC: mute capture input amp and | |
4476 | * set ADC connection to line in (on mic1 pin) | |
4477 | */ | |
4478 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4479 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4480 | ||
4481 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
4482 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
4483 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
4484 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
4485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
4486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
4487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
4488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
4489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4a471b7d TI |
4490 | |
4491 | { } | |
a9430dd8 JW |
4492 | }; |
4493 | ||
0bfc90e9 JW |
4494 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
4495 | * similar laptops (adapted from Fujitsu init verbs). | |
4496 | */ | |
4497 | static struct hda_verb alc260_acer_init_verbs[] = { | |
4498 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
4499 | * the headphone jack. Turn this on and rely on the standard mute | |
4500 | * methods whenever the user wants to turn these outputs off. | |
4501 | */ | |
4502 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
4503 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
4504 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
4505 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
4506 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4507 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
4508 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
4509 | /* Line In jack is connected to Line1 pin */ | |
4510 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
bd869485 JW |
4511 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
4512 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
0bfc90e9 JW |
4513 | /* Ensure all other unused pins are disabled and muted. */ |
4514 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4515 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
0bfc90e9 JW |
4516 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
4517 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4518 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4519 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4520 | /* Disable digital (SPDIF) pins */ | |
4521 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4522 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4523 | ||
4524 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
4525 | * bus when acting as outputs. | |
4526 | */ | |
4527 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
4528 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4529 | ||
4530 | /* Start with output sum widgets muted and their output gains at min */ | |
4531 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4532 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4533 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4535 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4536 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4537 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4538 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4539 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4540 | ||
f12ab1e0 TI |
4541 | /* Unmute Line-out pin widget amp left and right |
4542 | * (no equiv mixer ctrl) | |
4543 | */ | |
0bfc90e9 | 4544 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
bd869485 JW |
4545 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
4546 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
0bfc90e9 JW |
4547 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
4548 | * inputs. If the pin mode is changed by the user the pin mode control | |
4549 | * will take care of enabling the pin's input/output buffers as needed. | |
4550 | * Therefore there's no need to enable the input buffer at this | |
4551 | * stage. | |
4552 | */ | |
4553 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4555 | ||
4556 | /* Mute capture amp left and right */ | |
4557 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4558 | /* Set ADC connection select to match default mixer setting - mic | |
4559 | * (on mic1 pin) | |
4560 | */ | |
4561 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4562 | ||
4563 | /* Do similar with the second ADC: mute capture input amp and | |
a1e8d2da | 4564 | * set ADC connection to mic to match ALSA's default state. |
0bfc90e9 JW |
4565 | */ |
4566 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a1e8d2da | 4567 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
0bfc90e9 JW |
4568 | |
4569 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
4570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
4571 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
4572 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
4573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
4574 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
4575 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
4576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
4577 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4578 | ||
4579 | { } | |
4580 | }; | |
4581 | ||
bc9f98a9 KY |
4582 | static struct hda_verb alc260_will_verbs[] = { |
4583 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4584 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4585 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4586 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
4587 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
4588 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
4589 | {} | |
4590 | }; | |
4591 | ||
4592 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
4593 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
4594 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
4595 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
4596 | ||
4597 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
4598 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
4599 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
4600 | ||
4601 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4602 | {} | |
4603 | }; | |
4604 | ||
4605 | /* toggle speaker-output according to the hp-jack state */ | |
4606 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
4607 | { | |
4608 | unsigned int present; | |
4609 | ||
4610 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
4611 | present = snd_hda_codec_read(codec, 0x0f, 0, | |
4612 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
4613 | if (present) { | |
82beb8fd TI |
4614 | snd_hda_codec_write_cache(codec, 0x01, 0, |
4615 | AC_VERB_SET_GPIO_DATA, 1); | |
4616 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
4617 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4618 | PIN_HP); | |
bc9f98a9 | 4619 | } else { |
82beb8fd TI |
4620 | snd_hda_codec_write_cache(codec, 0x01, 0, |
4621 | AC_VERB_SET_GPIO_DATA, 0); | |
4622 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
4623 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4624 | PIN_OUT); | |
bc9f98a9 KY |
4625 | } |
4626 | } | |
4627 | ||
4628 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
4629 | unsigned int res) | |
4630 | { | |
4631 | if ((res >> 26) == ALC880_HP_EVENT) | |
4632 | alc260_replacer_672v_automute(codec); | |
4633 | } | |
4634 | ||
7cf51e48 JW |
4635 | /* Test configuration for debugging, modelled after the ALC880 test |
4636 | * configuration. | |
4637 | */ | |
4638 | #ifdef CONFIG_SND_DEBUG | |
4639 | static hda_nid_t alc260_test_dac_nids[1] = { | |
4640 | 0x02, | |
4641 | }; | |
4642 | static hda_nid_t alc260_test_adc_nids[2] = { | |
4643 | 0x04, 0x05, | |
4644 | }; | |
a1e8d2da JW |
4645 | /* For testing the ALC260, each input MUX needs its own definition since |
4646 | * the signal assignments are different. This assumes that the first ADC | |
4647 | * is NID 0x04. | |
17e7aec6 | 4648 | */ |
a1e8d2da JW |
4649 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
4650 | { | |
4651 | .num_items = 7, | |
4652 | .items = { | |
4653 | { "MIC1 pin", 0x0 }, | |
4654 | { "MIC2 pin", 0x1 }, | |
4655 | { "LINE1 pin", 0x2 }, | |
4656 | { "LINE2 pin", 0x3 }, | |
4657 | { "CD pin", 0x4 }, | |
4658 | { "LINE-OUT pin", 0x5 }, | |
4659 | { "HP-OUT pin", 0x6 }, | |
4660 | }, | |
4661 | }, | |
4662 | { | |
4663 | .num_items = 8, | |
4664 | .items = { | |
4665 | { "MIC1 pin", 0x0 }, | |
4666 | { "MIC2 pin", 0x1 }, | |
4667 | { "LINE1 pin", 0x2 }, | |
4668 | { "LINE2 pin", 0x3 }, | |
4669 | { "CD pin", 0x4 }, | |
4670 | { "Mixer", 0x5 }, | |
4671 | { "LINE-OUT pin", 0x6 }, | |
4672 | { "HP-OUT pin", 0x7 }, | |
4673 | }, | |
7cf51e48 JW |
4674 | }, |
4675 | }; | |
4676 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
4677 | /* Output driver widgets */ | |
4678 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
4679 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
4680 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
4681 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
4682 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4683 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
4684 | ||
a1e8d2da JW |
4685 | /* Modes for retasking pin widgets |
4686 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
4687 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
4688 | * mention this restriction. At this stage it's not clear whether | |
4689 | * this behaviour is intentional or is a hardware bug in chip | |
4690 | * revisions available at least up until early 2006. Therefore for | |
4691 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
4692 | * choices, but if it turns out that the lack of mic bias for these | |
4693 | * NIDs is intentional we could change their modes from | |
4694 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
4695 | */ | |
7cf51e48 JW |
4696 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
4697 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
4698 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
4699 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
4700 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
4701 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
4702 | ||
4703 | /* Loopback mixer controls */ | |
4704 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
4705 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
4706 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
4707 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
4708 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4709 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4710 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
4711 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
4712 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
4713 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4714 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4715 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4716 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | |
4717 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
4718 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
4719 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
5c8f858d JW |
4720 | |
4721 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
4722 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
4723 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
4724 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
4725 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
4726 | ||
92621f13 JW |
4727 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
4728 | * is ambigious as to which NID is which; testing on laptops which | |
4729 | * make this output available should provide clarification. | |
4730 | */ | |
4731 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
4732 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
4733 | ||
f8225f6d JW |
4734 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
4735 | * this output to turn on an external amplifier. | |
4736 | */ | |
4737 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
4738 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
4739 | ||
7cf51e48 JW |
4740 | { } /* end */ |
4741 | }; | |
4742 | static struct hda_verb alc260_test_init_verbs[] = { | |
5c8f858d JW |
4743 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
4744 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
4745 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
4746 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
4747 | ||
7cf51e48 JW |
4748 | /* Enable retasking pins as output, initially without power amp */ |
4749 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4750 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4751 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4752 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4753 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4754 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4755 | ||
92621f13 JW |
4756 | /* Disable digital (SPDIF) pins initially, but users can enable |
4757 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
4758 | * payload also sets the generation to 0, output to be in "consumer" | |
4759 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
4760 | * control. | |
4761 | */ | |
7cf51e48 JW |
4762 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4763 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4764 | ||
f7ace40d | 4765 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
7cf51e48 JW |
4766 | * OUT1 sum bus when acting as an output. |
4767 | */ | |
4768 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
4769 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
4770 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4771 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
4772 | ||
4773 | /* Start with output sum widgets muted and their output gains at min */ | |
4774 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4775 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4776 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4777 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4778 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4779 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4780 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4781 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4782 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4783 | ||
cdcd9268 JW |
4784 | /* Unmute retasking pin widget output buffers since the default |
4785 | * state appears to be output. As the pin mode is changed by the | |
4786 | * user the pin mode control will take care of enabling the pin's | |
4787 | * input/output buffers as needed. | |
4788 | */ | |
7cf51e48 JW |
4789 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
4790 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4792 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4793 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4794 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4795 | /* Also unmute the mono-out pin widget */ | |
4796 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4797 | ||
7cf51e48 JW |
4798 | /* Mute capture amp left and right */ |
4799 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
f7ace40d JW |
4800 | /* Set ADC connection select to match default mixer setting (mic1 |
4801 | * pin) | |
7cf51e48 JW |
4802 | */ |
4803 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4804 | ||
4805 | /* Do the same for the second ADC: mute capture input amp and | |
f7ace40d | 4806 | * set ADC connection to mic1 pin |
7cf51e48 JW |
4807 | */ |
4808 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4809 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4810 | ||
4811 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
4812 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
4813 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
4814 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
4815 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
4816 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
4817 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
4818 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
4819 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4820 | ||
4821 | { } | |
4822 | }; | |
4823 | #endif | |
4824 | ||
6330079f TI |
4825 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
4826 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
1da177e4 | 4827 | |
a3bcba38 TI |
4828 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
4829 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
4830 | ||
df694daa KY |
4831 | /* |
4832 | * for BIOS auto-configuration | |
4833 | */ | |
16ded525 | 4834 | |
df694daa KY |
4835 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
4836 | const char *pfx) | |
4837 | { | |
4838 | hda_nid_t nid_vol; | |
4839 | unsigned long vol_val, sw_val; | |
4840 | char name[32]; | |
4841 | int err; | |
4842 | ||
4843 | if (nid >= 0x0f && nid < 0x11) { | |
4844 | nid_vol = nid - 0x7; | |
4845 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
4846 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
4847 | } else if (nid == 0x11) { | |
4848 | nid_vol = nid - 0x7; | |
4849 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
4850 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
4851 | } else if (nid >= 0x12 && nid <= 0x15) { | |
4852 | nid_vol = 0x08; | |
4853 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
4854 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
4855 | } else | |
4856 | return 0; /* N/A */ | |
4857 | ||
4858 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | |
f12ab1e0 TI |
4859 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
4860 | if (err < 0) | |
df694daa KY |
4861 | return err; |
4862 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | |
f12ab1e0 TI |
4863 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
4864 | if (err < 0) | |
df694daa KY |
4865 | return err; |
4866 | return 1; | |
4867 | } | |
4868 | ||
4869 | /* add playback controls from the parsed DAC table */ | |
4870 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
4871 | const struct auto_pin_cfg *cfg) | |
4872 | { | |
4873 | hda_nid_t nid; | |
4874 | int err; | |
4875 | ||
4876 | spec->multiout.num_dacs = 1; | |
4877 | spec->multiout.dac_nids = spec->private_dac_nids; | |
4878 | spec->multiout.dac_nids[0] = 0x02; | |
4879 | ||
4880 | nid = cfg->line_out_pins[0]; | |
4881 | if (nid) { | |
4882 | err = alc260_add_playback_controls(spec, nid, "Front"); | |
4883 | if (err < 0) | |
4884 | return err; | |
4885 | } | |
4886 | ||
82bc955f | 4887 | nid = cfg->speaker_pins[0]; |
df694daa KY |
4888 | if (nid) { |
4889 | err = alc260_add_playback_controls(spec, nid, "Speaker"); | |
4890 | if (err < 0) | |
4891 | return err; | |
4892 | } | |
4893 | ||
eb06ed8f | 4894 | nid = cfg->hp_pins[0]; |
df694daa KY |
4895 | if (nid) { |
4896 | err = alc260_add_playback_controls(spec, nid, "Headphone"); | |
4897 | if (err < 0) | |
4898 | return err; | |
4899 | } | |
f12ab1e0 | 4900 | return 0; |
df694daa KY |
4901 | } |
4902 | ||
4903 | /* create playback/capture controls for input pins */ | |
4904 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, | |
4905 | const struct auto_pin_cfg *cfg) | |
4906 | { | |
df694daa KY |
4907 | struct hda_input_mux *imux = &spec->private_imux; |
4908 | int i, err, idx; | |
4909 | ||
4910 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
4911 | if (cfg->input_pins[i] >= 0x12) { | |
4912 | idx = cfg->input_pins[i] - 0x12; | |
4a471b7d | 4913 | err = new_analog_input(spec, cfg->input_pins[i], |
f12ab1e0 TI |
4914 | auto_pin_cfg_labels[i], idx, |
4915 | 0x07); | |
df694daa KY |
4916 | if (err < 0) |
4917 | return err; | |
f12ab1e0 TI |
4918 | imux->items[imux->num_items].label = |
4919 | auto_pin_cfg_labels[i]; | |
df694daa KY |
4920 | imux->items[imux->num_items].index = idx; |
4921 | imux->num_items++; | |
4922 | } | |
f12ab1e0 | 4923 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
df694daa | 4924 | idx = cfg->input_pins[i] - 0x09; |
4a471b7d | 4925 | err = new_analog_input(spec, cfg->input_pins[i], |
f12ab1e0 TI |
4926 | auto_pin_cfg_labels[i], idx, |
4927 | 0x07); | |
df694daa KY |
4928 | if (err < 0) |
4929 | return err; | |
f12ab1e0 TI |
4930 | imux->items[imux->num_items].label = |
4931 | auto_pin_cfg_labels[i]; | |
df694daa KY |
4932 | imux->items[imux->num_items].index = idx; |
4933 | imux->num_items++; | |
4934 | } | |
4935 | } | |
4936 | return 0; | |
4937 | } | |
4938 | ||
4939 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
4940 | hda_nid_t nid, int pin_type, | |
4941 | int sel_idx) | |
4942 | { | |
f6c7e546 | 4943 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
4944 | /* need the manual connection? */ |
4945 | if (nid >= 0x12) { | |
4946 | int idx = nid - 0x12; | |
4947 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
4948 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
df694daa KY |
4949 | } |
4950 | } | |
4951 | ||
4952 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
4953 | { | |
4954 | struct alc_spec *spec = codec->spec; | |
4955 | hda_nid_t nid; | |
4956 | ||
bc9f98a9 | 4957 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
f12ab1e0 | 4958 | nid = spec->autocfg.line_out_pins[0]; |
baba8ee9 TI |
4959 | if (nid) { |
4960 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
4961 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
4962 | } | |
df694daa | 4963 | |
82bc955f | 4964 | nid = spec->autocfg.speaker_pins[0]; |
df694daa KY |
4965 | if (nid) |
4966 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
4967 | ||
eb06ed8f | 4968 | nid = spec->autocfg.hp_pins[0]; |
df694daa | 4969 | if (nid) |
baba8ee9 | 4970 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
f12ab1e0 | 4971 | } |
df694daa KY |
4972 | |
4973 | #define ALC260_PIN_CD_NID 0x16 | |
4974 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
4975 | { | |
4976 | struct alc_spec *spec = codec->spec; | |
4977 | int i; | |
4978 | ||
4979 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
4980 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
4981 | if (nid >= 0x12) { | |
f12ab1e0 TI |
4982 | snd_hda_codec_write(codec, nid, 0, |
4983 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4984 | i <= AUTO_PIN_FRONT_MIC ? | |
4985 | PIN_VREF80 : PIN_IN); | |
df694daa | 4986 | if (nid != ALC260_PIN_CD_NID) |
f12ab1e0 TI |
4987 | snd_hda_codec_write(codec, nid, 0, |
4988 | AC_VERB_SET_AMP_GAIN_MUTE, | |
df694daa KY |
4989 | AMP_OUT_MUTE); |
4990 | } | |
4991 | } | |
4992 | } | |
4993 | ||
4994 | /* | |
4995 | * generic initialization of ADC, input mixers and output mixers | |
4996 | */ | |
4997 | static struct hda_verb alc260_volume_init_verbs[] = { | |
4998 | /* | |
4999 | * Unmute ADC0-1 and set the default input to mic-in | |
5000 | */ | |
5001 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5002 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5003 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5004 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5005 | ||
5006 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
5007 | * mixer widget | |
f12ab1e0 TI |
5008 | * Note: PASD motherboards uses the Line In 2 as the input for |
5009 | * front panel mic (mic 2) | |
df694daa KY |
5010 | */ |
5011 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
5012 | /* mute analog inputs */ |
5013 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5014 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5015 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5016 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
5018 | |
5019 | /* | |
5020 | * Set up output mixers (0x08 - 0x0a) | |
5021 | */ | |
5022 | /* set vol=0 to output mixers */ | |
5023 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5024 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5025 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5026 | /* set up input amps for analog loopback */ | |
5027 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
5028 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5029 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5030 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5031 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5032 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5033 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5034 | ||
5035 | { } | |
5036 | }; | |
5037 | ||
5038 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
5039 | { | |
5040 | struct alc_spec *spec = codec->spec; | |
5041 | unsigned int wcap; | |
5042 | int err; | |
5043 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
5044 | ||
f12ab1e0 TI |
5045 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
5046 | alc260_ignore); | |
5047 | if (err < 0) | |
df694daa | 5048 | return err; |
f12ab1e0 TI |
5049 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
5050 | if (err < 0) | |
4a471b7d | 5051 | return err; |
f12ab1e0 | 5052 | if (!spec->kctl_alloc) |
df694daa | 5053 | return 0; /* can't find valid BIOS pin config */ |
f12ab1e0 TI |
5054 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
5055 | if (err < 0) | |
df694daa KY |
5056 | return err; |
5057 | ||
5058 | spec->multiout.max_channels = 2; | |
5059 | ||
5060 | if (spec->autocfg.dig_out_pin) | |
5061 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | |
5062 | if (spec->kctl_alloc) | |
5063 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
5064 | ||
5065 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; | |
5066 | ||
a1e8d2da | 5067 | spec->num_mux_defs = 1; |
df694daa KY |
5068 | spec->input_mux = &spec->private_imux; |
5069 | ||
5070 | /* check whether NID 0x04 is valid */ | |
4a471b7d | 5071 | wcap = get_wcaps(codec, 0x04); |
df694daa | 5072 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
67ebcb03 | 5073 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
df694daa KY |
5074 | spec->adc_nids = alc260_adc_nids_alt; |
5075 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
5076 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; | |
df694daa KY |
5077 | } else { |
5078 | spec->adc_nids = alc260_adc_nids; | |
5079 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
5080 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; | |
df694daa | 5081 | } |
4a471b7d | 5082 | spec->num_mixers++; |
df694daa KY |
5083 | |
5084 | return 1; | |
5085 | } | |
5086 | ||
ae6b813a TI |
5087 | /* additional initialization for auto-configuration model */ |
5088 | static void alc260_auto_init(struct hda_codec *codec) | |
df694daa | 5089 | { |
f6c7e546 | 5090 | struct alc_spec *spec = codec->spec; |
df694daa KY |
5091 | alc260_auto_init_multi_out(codec); |
5092 | alc260_auto_init_analog_input(codec); | |
f6c7e546 TI |
5093 | if (spec->unsol_event) |
5094 | alc_sku_automute(codec); | |
df694daa KY |
5095 | } |
5096 | ||
cb53c626 TI |
5097 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5098 | static struct hda_amp_list alc260_loopbacks[] = { | |
5099 | { 0x07, HDA_INPUT, 0 }, | |
5100 | { 0x07, HDA_INPUT, 1 }, | |
5101 | { 0x07, HDA_INPUT, 2 }, | |
5102 | { 0x07, HDA_INPUT, 3 }, | |
5103 | { 0x07, HDA_INPUT, 4 }, | |
5104 | { } /* end */ | |
5105 | }; | |
5106 | #endif | |
5107 | ||
df694daa KY |
5108 | /* |
5109 | * ALC260 configurations | |
5110 | */ | |
f5fcc13c TI |
5111 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
5112 | [ALC260_BASIC] = "basic", | |
5113 | [ALC260_HP] = "hp", | |
5114 | [ALC260_HP_3013] = "hp-3013", | |
5115 | [ALC260_FUJITSU_S702X] = "fujitsu", | |
5116 | [ALC260_ACER] = "acer", | |
bc9f98a9 KY |
5117 | [ALC260_WILL] = "will", |
5118 | [ALC260_REPLACER_672V] = "replacer", | |
7cf51e48 | 5119 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 5120 | [ALC260_TEST] = "test", |
7cf51e48 | 5121 | #endif |
f5fcc13c TI |
5122 | [ALC260_AUTO] = "auto", |
5123 | }; | |
5124 | ||
5125 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
bd869485 | 5126 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
f5fcc13c | 5127 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
9720b718 | 5128 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
a8a5d067 | 5129 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
f5fcc13c TI |
5130 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
5131 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), | |
5132 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), | |
5133 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | |
5134 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
5135 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
5136 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
5137 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
5138 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
5139 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
5140 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
5141 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
bc9f98a9 | 5142 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
ac3e3741 | 5143 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
df694daa KY |
5144 | {} |
5145 | }; | |
5146 | ||
5147 | static struct alc_config_preset alc260_presets[] = { | |
5148 | [ALC260_BASIC] = { | |
5149 | .mixers = { alc260_base_output_mixer, | |
5150 | alc260_input_mixer, | |
5151 | alc260_pc_beep_mixer, | |
5152 | alc260_capture_mixer }, | |
5153 | .init_verbs = { alc260_init_verbs }, | |
5154 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5155 | .dac_nids = alc260_dac_nids, | |
5156 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
5157 | .adc_nids = alc260_adc_nids, | |
5158 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5159 | .channel_mode = alc260_modes, | |
5160 | .input_mux = &alc260_capture_source, | |
5161 | }, | |
5162 | [ALC260_HP] = { | |
bec15c3a | 5163 | .mixers = { alc260_hp_output_mixer, |
df694daa KY |
5164 | alc260_input_mixer, |
5165 | alc260_capture_alt_mixer }, | |
bec15c3a TI |
5166 | .init_verbs = { alc260_init_verbs, |
5167 | alc260_hp_unsol_verbs }, | |
df694daa KY |
5168 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
5169 | .dac_nids = alc260_dac_nids, | |
5170 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | |
5171 | .adc_nids = alc260_hp_adc_nids, | |
5172 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5173 | .channel_mode = alc260_modes, | |
5174 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
5175 | .unsol_event = alc260_hp_unsol_event, |
5176 | .init_hook = alc260_hp_automute, | |
df694daa KY |
5177 | }, |
5178 | [ALC260_HP_3013] = { | |
5179 | .mixers = { alc260_hp_3013_mixer, | |
5180 | alc260_input_mixer, | |
5181 | alc260_capture_alt_mixer }, | |
bec15c3a TI |
5182 | .init_verbs = { alc260_hp_3013_init_verbs, |
5183 | alc260_hp_3013_unsol_verbs }, | |
df694daa KY |
5184 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
5185 | .dac_nids = alc260_dac_nids, | |
5186 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | |
5187 | .adc_nids = alc260_hp_adc_nids, | |
5188 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5189 | .channel_mode = alc260_modes, | |
5190 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
5191 | .unsol_event = alc260_hp_3013_unsol_event, |
5192 | .init_hook = alc260_hp_3013_automute, | |
df694daa KY |
5193 | }, |
5194 | [ALC260_FUJITSU_S702X] = { | |
5195 | .mixers = { alc260_fujitsu_mixer, | |
5196 | alc260_capture_mixer }, | |
5197 | .init_verbs = { alc260_fujitsu_init_verbs }, | |
5198 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5199 | .dac_nids = alc260_dac_nids, | |
d57fdac0 JW |
5200 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
5201 | .adc_nids = alc260_dual_adc_nids, | |
df694daa KY |
5202 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
5203 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5204 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
5205 | .input_mux = alc260_fujitsu_capture_sources, | |
df694daa | 5206 | }, |
0bfc90e9 JW |
5207 | [ALC260_ACER] = { |
5208 | .mixers = { alc260_acer_mixer, | |
5209 | alc260_capture_mixer }, | |
5210 | .init_verbs = { alc260_acer_init_verbs }, | |
5211 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5212 | .dac_nids = alc260_dac_nids, | |
5213 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
5214 | .adc_nids = alc260_dual_adc_nids, | |
5215 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5216 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5217 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
5218 | .input_mux = alc260_acer_capture_sources, | |
0bfc90e9 | 5219 | }, |
bc9f98a9 KY |
5220 | [ALC260_WILL] = { |
5221 | .mixers = { alc260_will_mixer, | |
5222 | alc260_capture_mixer }, | |
5223 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, | |
5224 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5225 | .dac_nids = alc260_dac_nids, | |
5226 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
5227 | .adc_nids = alc260_adc_nids, | |
5228 | .dig_out_nid = ALC260_DIGOUT_NID, | |
5229 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5230 | .channel_mode = alc260_modes, | |
5231 | .input_mux = &alc260_capture_source, | |
5232 | }, | |
5233 | [ALC260_REPLACER_672V] = { | |
5234 | .mixers = { alc260_replacer_672v_mixer, | |
5235 | alc260_capture_mixer }, | |
5236 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, | |
5237 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5238 | .dac_nids = alc260_dac_nids, | |
5239 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
5240 | .adc_nids = alc260_adc_nids, | |
5241 | .dig_out_nid = ALC260_DIGOUT_NID, | |
5242 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5243 | .channel_mode = alc260_modes, | |
5244 | .input_mux = &alc260_capture_source, | |
5245 | .unsol_event = alc260_replacer_672v_unsol_event, | |
5246 | .init_hook = alc260_replacer_672v_automute, | |
5247 | }, | |
7cf51e48 JW |
5248 | #ifdef CONFIG_SND_DEBUG |
5249 | [ALC260_TEST] = { | |
5250 | .mixers = { alc260_test_mixer, | |
5251 | alc260_capture_mixer }, | |
5252 | .init_verbs = { alc260_test_init_verbs }, | |
5253 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
5254 | .dac_nids = alc260_test_dac_nids, | |
5255 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
5256 | .adc_nids = alc260_test_adc_nids, | |
5257 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5258 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5259 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
5260 | .input_mux = alc260_test_capture_sources, | |
7cf51e48 JW |
5261 | }, |
5262 | #endif | |
df694daa KY |
5263 | }; |
5264 | ||
5265 | static int patch_alc260(struct hda_codec *codec) | |
1da177e4 LT |
5266 | { |
5267 | struct alc_spec *spec; | |
df694daa | 5268 | int err, board_config; |
1da177e4 | 5269 | |
e560d8d8 | 5270 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
5271 | if (spec == NULL) |
5272 | return -ENOMEM; | |
5273 | ||
5274 | codec->spec = spec; | |
5275 | ||
f5fcc13c TI |
5276 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
5277 | alc260_models, | |
5278 | alc260_cfg_tbl); | |
5279 | if (board_config < 0) { | |
9c7f852e TI |
5280 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
5281 | "trying auto-probe from BIOS...\n"); | |
df694daa | 5282 | board_config = ALC260_AUTO; |
16ded525 | 5283 | } |
1da177e4 | 5284 | |
df694daa KY |
5285 | if (board_config == ALC260_AUTO) { |
5286 | /* automatic parse from the BIOS config */ | |
5287 | err = alc260_parse_auto_config(codec); | |
5288 | if (err < 0) { | |
5289 | alc_free(codec); | |
5290 | return err; | |
f12ab1e0 | 5291 | } else if (!err) { |
9c7f852e TI |
5292 | printk(KERN_INFO |
5293 | "hda_codec: Cannot set up configuration " | |
5294 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
5295 | board_config = ALC260_BASIC; |
5296 | } | |
a9430dd8 | 5297 | } |
e9edcee0 | 5298 | |
df694daa KY |
5299 | if (board_config != ALC260_AUTO) |
5300 | setup_preset(spec, &alc260_presets[board_config]); | |
1da177e4 LT |
5301 | |
5302 | spec->stream_name_analog = "ALC260 Analog"; | |
5303 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | |
5304 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
5305 | ||
a3bcba38 TI |
5306 | spec->stream_name_digital = "ALC260 Digital"; |
5307 | spec->stream_digital_playback = &alc260_pcm_digital_playback; | |
5308 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
5309 | ||
2134ea4f TI |
5310 | spec->vmaster_nid = 0x08; |
5311 | ||
1da177e4 | 5312 | codec->patch_ops = alc_patch_ops; |
df694daa | 5313 | if (board_config == ALC260_AUTO) |
ae6b813a | 5314 | spec->init_hook = alc260_auto_init; |
cb53c626 TI |
5315 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5316 | if (!spec->loopback.amplist) | |
5317 | spec->loopback.amplist = alc260_loopbacks; | |
5318 | #endif | |
1da177e4 LT |
5319 | |
5320 | return 0; | |
5321 | } | |
5322 | ||
e9edcee0 | 5323 | |
1da177e4 LT |
5324 | /* |
5325 | * ALC882 support | |
5326 | * | |
5327 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
5328 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
5329 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
5330 | * 6-channel independent captures. | |
5331 | * | |
5332 | * In addition, an independent DAC for the multi-playback (not used in this | |
5333 | * driver yet). | |
5334 | */ | |
df694daa KY |
5335 | #define ALC882_DIGOUT_NID 0x06 |
5336 | #define ALC882_DIGIN_NID 0x0a | |
1da177e4 | 5337 | |
d2a6d7dc | 5338 | static struct hda_channel_mode alc882_ch_modes[1] = { |
1da177e4 LT |
5339 | { 8, NULL } |
5340 | }; | |
5341 | ||
5342 | static hda_nid_t alc882_dac_nids[4] = { | |
5343 | /* front, rear, clfe, rear_surr */ | |
5344 | 0x02, 0x03, 0x04, 0x05 | |
5345 | }; | |
5346 | ||
df694daa KY |
5347 | /* identical with ALC880 */ |
5348 | #define alc882_adc_nids alc880_adc_nids | |
5349 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
1da177e4 | 5350 | |
e1406348 TI |
5351 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
5352 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
5353 | ||
1da177e4 LT |
5354 | /* input MUX */ |
5355 | /* FIXME: should be a matrix-type input source selection */ | |
5356 | ||
5357 | static struct hda_input_mux alc882_capture_source = { | |
5358 | .num_items = 4, | |
5359 | .items = { | |
5360 | { "Mic", 0x0 }, | |
5361 | { "Front Mic", 0x1 }, | |
5362 | { "Line", 0x2 }, | |
5363 | { "CD", 0x4 }, | |
5364 | }, | |
5365 | }; | |
1da177e4 LT |
5366 | #define alc882_mux_enum_info alc_mux_enum_info |
5367 | #define alc882_mux_enum_get alc_mux_enum_get | |
5368 | ||
f12ab1e0 TI |
5369 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
5370 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
5371 | { |
5372 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5373 | struct alc_spec *spec = codec->spec; | |
5374 | const struct hda_input_mux *imux = spec->input_mux; | |
5375 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
88c71a99 TI |
5376 | hda_nid_t nid = spec->capsrc_nids ? |
5377 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
1da177e4 LT |
5378 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
5379 | unsigned int i, idx; | |
5380 | ||
5381 | idx = ucontrol->value.enumerated.item[0]; | |
5382 | if (idx >= imux->num_items) | |
5383 | idx = imux->num_items - 1; | |
82beb8fd | 5384 | if (*cur_val == idx) |
1da177e4 LT |
5385 | return 0; |
5386 | for (i = 0; i < imux->num_items; i++) { | |
47fd830a TI |
5387 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
5388 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | |
82beb8fd | 5389 | imux->items[i].index, |
47fd830a | 5390 | HDA_AMP_MUTE, v); |
1da177e4 LT |
5391 | } |
5392 | *cur_val = idx; | |
5393 | return 1; | |
5394 | } | |
5395 | ||
272a527c KY |
5396 | /* |
5397 | * 2ch mode | |
5398 | */ | |
5399 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
5400 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
5401 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
5402 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
5403 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
5404 | { } /* end */ | |
5405 | }; | |
5406 | ||
5407 | /* | |
5408 | * 6ch mode | |
5409 | */ | |
5410 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
5411 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5412 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
5413 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
5414 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5415 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
5416 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
5417 | { } /* end */ | |
5418 | }; | |
5419 | ||
5420 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { | |
5421 | { 2, alc882_3ST_ch2_init }, | |
5422 | { 6, alc882_3ST_ch6_init }, | |
5423 | }; | |
5424 | ||
df694daa KY |
5425 | /* |
5426 | * 6ch mode | |
5427 | */ | |
5428 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
5429 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
5430 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5431 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5432 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5433 | { } /* end */ | |
5434 | }; | |
5435 | ||
5436 | /* | |
5437 | * 8ch mode | |
5438 | */ | |
5439 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
5440 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5441 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5442 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5443 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5444 | { } /* end */ | |
5445 | }; | |
5446 | ||
5447 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
5448 | { 6, alc882_sixstack_ch6_init }, | |
5449 | { 8, alc882_sixstack_ch8_init }, | |
5450 | }; | |
5451 | ||
87350ad0 TI |
5452 | /* |
5453 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic | |
5454 | */ | |
5455 | ||
5456 | /* | |
5457 | * 2ch mode | |
5458 | */ | |
5459 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
5460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
5461 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5462 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5463 | { } /* end */ | |
5464 | }; | |
5465 | ||
5466 | /* | |
5467 | * 6ch mode | |
5468 | */ | |
5469 | static struct hda_verb alc885_mbp_ch6_init[] = { | |
5470 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5471 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5472 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
5473 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5474 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5475 | { } /* end */ | |
5476 | }; | |
5477 | ||
5478 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { | |
5479 | { 2, alc885_mbp_ch2_init }, | |
5480 | { 6, alc885_mbp_ch6_init }, | |
5481 | }; | |
5482 | ||
5483 | ||
1da177e4 LT |
5484 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
5485 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
5486 | */ | |
c8b6bf9b | 5487 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
05acb863 | 5488 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 5489 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 5490 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 5491 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
05acb863 TI |
5492 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
5493 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
5494 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
5495 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
05acb863 | 5496 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 5497 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1da177e4 LT |
5498 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
5499 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5500 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5501 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5502 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5503 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 5504 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
1da177e4 LT |
5505 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
5506 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 5507 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
1da177e4 LT |
5508 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
5509 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5510 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1da177e4 LT |
5511 | { } /* end */ |
5512 | }; | |
5513 | ||
87350ad0 | 5514 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
2134ea4f TI |
5515 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
5516 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
5517 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), | |
5518 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
5519 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5520 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
87350ad0 TI |
5521 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
5522 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
2134ea4f | 5523 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
87350ad0 TI |
5524 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
5525 | { } /* end */ | |
5526 | }; | |
bdd148a3 KY |
5527 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
5528 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5529 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5530 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5531 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5532 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5533 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5534 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5535 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
5536 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5537 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5538 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5539 | { } /* end */ | |
5540 | }; | |
5541 | ||
272a527c KY |
5542 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
5543 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5544 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5545 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5547 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5548 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5549 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 5552 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
5553 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
5554 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
96fe7cc8 | 5555 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
272a527c KY |
5556 | { } /* end */ |
5557 | }; | |
5558 | ||
5559 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
5560 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
5561 | */ | |
5562 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
5563 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5564 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
5565 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5566 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
5567 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5568 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5569 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5570 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5571 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
5572 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
5573 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5574 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 5575 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
5576 | { } /* end */ |
5577 | }; | |
5578 | ||
914759b7 TI |
5579 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
5580 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5581 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5582 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5583 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5584 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5585 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5586 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5587 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5588 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
5589 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5590 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5591 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5592 | { } /* end */ | |
5593 | }; | |
5594 | ||
df694daa KY |
5595 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
5596 | { | |
5597 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5598 | .name = "Channel Mode", | |
5599 | .info = alc_ch_mode_info, | |
5600 | .get = alc_ch_mode_get, | |
5601 | .put = alc_ch_mode_put, | |
5602 | }, | |
5603 | { } /* end */ | |
5604 | }; | |
5605 | ||
1da177e4 LT |
5606 | static struct hda_verb alc882_init_verbs[] = { |
5607 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
05acb863 TI |
5608 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5609 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5610 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5611 | /* Rear mixer */ |
05acb863 TI |
5612 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5613 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5614 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5615 | /* CLFE mixer */ |
05acb863 TI |
5616 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5617 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5618 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5619 | /* Side mixer */ |
05acb863 TI |
5620 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5621 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5622 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5623 | |
e9edcee0 | 5624 | /* Front Pin: output 0 (0x0c) */ |
05acb863 | 5625 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5626 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5627 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 5628 | /* Rear Pin: output 1 (0x0d) */ |
05acb863 | 5629 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5630 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5631 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
e9edcee0 | 5632 | /* CLFE Pin: output 2 (0x0e) */ |
05acb863 | 5633 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5634 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5635 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
e9edcee0 | 5636 | /* Side Pin: output 3 (0x0f) */ |
05acb863 | 5637 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5638 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5639 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
e9edcee0 | 5640 | /* Mic (rear) pin: input vref at 80% */ |
16ded525 | 5641 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
5642 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5643 | /* Front Mic pin: input vref at 80% */ | |
16ded525 | 5644 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
5645 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5646 | /* Line In pin: input */ | |
05acb863 | 5647 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
5648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5649 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
5650 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5651 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5652 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1da177e4 | 5653 | /* CD pin widget for input */ |
05acb863 | 5654 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 LT |
5655 | |
5656 | /* FIXME: use matrix-type input source selection */ | |
5657 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5658 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
05acb863 TI |
5659 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5660 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5661 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 5663 | /* Input mixer2 */ |
05acb863 TI |
5664 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5665 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5666 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5667 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 5668 | /* Input mixer3 */ |
05acb863 TI |
5669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5673 | /* ADC1: mute amp left and right */ | |
5674 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5675 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
5676 | /* ADC2: mute amp left and right */ |
5677 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5678 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
5679 | /* ADC3: mute amp left and right */ |
5680 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5681 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 LT |
5682 | |
5683 | { } | |
5684 | }; | |
5685 | ||
4b146cb0 TI |
5686 | static struct hda_verb alc882_eapd_verbs[] = { |
5687 | /* change to EAPD mode */ | |
5688 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
b373bdeb | 5689 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
f12ab1e0 | 5690 | { } |
4b146cb0 TI |
5691 | }; |
5692 | ||
9102cd1c TD |
5693 | /* Mac Pro test */ |
5694 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
5695 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5696 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
5698 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
5699 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
5700 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5701 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5702 | { } /* end */ | |
5703 | }; | |
5704 | ||
5705 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
5706 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
5707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5708 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5709 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5710 | /* Front Pin: output 0 (0x0c) */ | |
5711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5713 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5714 | /* Front Mic pin: input vref at 80% */ | |
5715 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5716 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5717 | /* Speaker: output */ | |
5718 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5719 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5720 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
5721 | /* Headphone output (output 0 - 0x0c) */ | |
5722 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5723 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5724 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5725 | ||
5726 | /* FIXME: use matrix-type input source selection */ | |
5727 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5728 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
5729 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5730 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5731 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5732 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5733 | /* Input mixer2 */ | |
5734 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5735 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5736 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5737 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5738 | /* Input mixer3 */ | |
5739 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5740 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5741 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5742 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5743 | /* ADC1: mute amp left and right */ | |
5744 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5745 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5746 | /* ADC2: mute amp left and right */ | |
5747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5748 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5749 | /* ADC3: mute amp left and right */ | |
5750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5751 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5752 | ||
5753 | { } | |
5754 | }; | |
f12ab1e0 | 5755 | |
87350ad0 TI |
5756 | /* Macbook Pro rev3 */ |
5757 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
5758 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
5759 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5760 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5762 | /* Rear mixer */ | |
5763 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5764 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5765 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5766 | /* Front Pin: output 0 (0x0c) */ | |
5767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5768 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5769 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5770 | /* HP Pin: output 0 (0x0d) */ | |
5771 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
5772 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5773 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5774 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
5775 | /* Mic (rear) pin: input vref at 80% */ | |
5776 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5777 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5778 | /* Front Mic pin: input vref at 80% */ | |
5779 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5780 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5781 | /* Line In pin: use output 1 when in LineOut mode */ | |
5782 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
5783 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5784 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
5785 | ||
5786 | /* FIXME: use matrix-type input source selection */ | |
5787 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5788 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
5789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5790 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5792 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5793 | /* Input mixer2 */ | |
5794 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5795 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5796 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5798 | /* Input mixer3 */ | |
5799 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5800 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5803 | /* ADC1: mute amp left and right */ | |
5804 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5805 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5806 | /* ADC2: mute amp left and right */ | |
5807 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5808 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5809 | /* ADC3: mute amp left and right */ | |
5810 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5811 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5812 | ||
5813 | { } | |
5814 | }; | |
5815 | ||
c54728d8 NF |
5816 | /* iMac 24 mixer. */ |
5817 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
5818 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
5819 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
5820 | { } /* end */ | |
5821 | }; | |
5822 | ||
5823 | /* iMac 24 init verbs. */ | |
5824 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
5825 | /* Internal speakers: output 0 (0x0c) */ | |
5826 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5827 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5828 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5829 | /* Internal speakers: output 0 (0x0c) */ | |
5830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5832 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5833 | /* Headphone: output 0 (0x0c) */ | |
5834 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5835 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5836 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5837 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
5838 | /* Front Mic: input vref at 80% */ | |
5839 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5840 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5841 | { } | |
5842 | }; | |
5843 | ||
5844 | /* Toggle speaker-output according to the hp-jack state */ | |
5845 | static void alc885_imac24_automute(struct hda_codec *codec) | |
5846 | { | |
5847 | unsigned int present; | |
5848 | ||
5849 | present = snd_hda_codec_read(codec, 0x14, 0, | |
5850 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
5851 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
5852 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
5853 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
5854 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
c54728d8 NF |
5855 | } |
5856 | ||
5857 | /* Processes unsolicited events. */ | |
5858 | static void alc885_imac24_unsol_event(struct hda_codec *codec, | |
5859 | unsigned int res) | |
5860 | { | |
5861 | /* Headphone insertion or removal. */ | |
5862 | if ((res >> 26) == ALC880_HP_EVENT) | |
5863 | alc885_imac24_automute(codec); | |
5864 | } | |
5865 | ||
87350ad0 TI |
5866 | static void alc885_mbp3_automute(struct hda_codec *codec) |
5867 | { | |
5868 | unsigned int present; | |
5869 | ||
5870 | present = snd_hda_codec_read(codec, 0x15, 0, | |
5871 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
5872 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
5873 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
5874 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
5875 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
5876 | ||
5877 | } | |
5878 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, | |
5879 | unsigned int res) | |
5880 | { | |
5881 | /* Headphone insertion or removal. */ | |
5882 | if ((res >> 26) == ALC880_HP_EVENT) | |
5883 | alc885_mbp3_automute(codec); | |
5884 | } | |
5885 | ||
5886 | ||
272a527c KY |
5887 | static struct hda_verb alc882_targa_verbs[] = { |
5888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5889 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5890 | ||
5891 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5892 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5893 | ||
5894 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
5895 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
5896 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
5897 | ||
5898 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
5899 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
5900 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
5901 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
5902 | { } /* end */ | |
5903 | }; | |
5904 | ||
5905 | /* toggle speaker-output according to the hp-jack state */ | |
5906 | static void alc882_targa_automute(struct hda_codec *codec) | |
5907 | { | |
5908 | unsigned int present; | |
5909 | ||
5910 | present = snd_hda_codec_read(codec, 0x14, 0, | |
5911 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
5912 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
5913 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
82beb8fd TI |
5914 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
5915 | present ? 1 : 3); | |
272a527c KY |
5916 | } |
5917 | ||
5918 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
5919 | { | |
5920 | /* Looks like the unsol event is incompatible with the standard | |
5921 | * definition. 4bit tag is placed at 26 bit! | |
5922 | */ | |
5923 | if (((res >> 26) == ALC880_HP_EVENT)) { | |
5924 | alc882_targa_automute(codec); | |
5925 | } | |
5926 | } | |
5927 | ||
5928 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
5929 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5931 | ||
5932 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5933 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5934 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5935 | ||
5936 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
5937 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
5938 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
5939 | ||
5940 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
5941 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
5942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
5943 | { } /* end */ | |
5944 | }; | |
5945 | ||
914759b7 TI |
5946 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
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 | ||
5950 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5951 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5952 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5953 | ||
5954 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
5955 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
5956 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
5957 | ||
5958 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
5959 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
5960 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
5961 | { } /* end */ | |
5962 | }; | |
5963 | ||
9102cd1c TD |
5964 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
5965 | { | |
5966 | unsigned int gpiostate, gpiomask, gpiodir; | |
5967 | ||
5968 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
5969 | AC_VERB_GET_GPIO_DATA, 0); | |
5970 | ||
5971 | if (!muted) | |
5972 | gpiostate |= (1 << pin); | |
5973 | else | |
5974 | gpiostate &= ~(1 << pin); | |
5975 | ||
5976 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
5977 | AC_VERB_GET_GPIO_MASK, 0); | |
5978 | gpiomask |= (1 << pin); | |
5979 | ||
5980 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
5981 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
5982 | gpiodir |= (1 << pin); | |
5983 | ||
5984 | ||
5985 | snd_hda_codec_write(codec, codec->afg, 0, | |
5986 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
5987 | snd_hda_codec_write(codec, codec->afg, 0, | |
5988 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
5989 | ||
5990 | msleep(1); | |
5991 | ||
5992 | snd_hda_codec_write(codec, codec->afg, 0, | |
5993 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
5994 | } | |
5995 | ||
7debbe51 TI |
5996 | /* set up GPIO at initialization */ |
5997 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
5998 | { | |
5999 | alc882_gpio_mute(codec, 0, 0); | |
6000 | alc882_gpio_mute(codec, 1, 0); | |
6001 | } | |
6002 | ||
6003 | /* set up GPIO and update auto-muting at initialization */ | |
6004 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
6005 | { | |
6006 | alc885_macpro_init_hook(codec); | |
6007 | alc885_imac24_automute(codec); | |
6008 | } | |
6009 | ||
df694daa KY |
6010 | /* |
6011 | * generic initialization of ADC, input mixers and output mixers | |
6012 | */ | |
6013 | static struct hda_verb alc882_auto_init_verbs[] = { | |
6014 | /* | |
6015 | * Unmute ADC0-2 and set the default input to mic-in | |
6016 | */ | |
6017 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6018 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6019 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6020 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6021 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6022 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1da177e4 | 6023 | |
cb53c626 | 6024 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 6025 | * mixer widget |
f12ab1e0 TI |
6026 | * Note: PASD motherboards uses the Line In 2 as the input for |
6027 | * front panel mic (mic 2) | |
df694daa KY |
6028 | */ |
6029 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
6030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6031 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6032 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
e9edcee0 | 6035 | |
df694daa KY |
6036 | /* |
6037 | * Set up output mixers (0x0c - 0x0f) | |
6038 | */ | |
6039 | /* set vol=0 to output mixers */ | |
6040 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6043 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6044 | /* set up input amps for analog loopback */ | |
6045 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6049 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6051 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6052 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6053 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6054 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6055 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6056 | ||
6057 | /* FIXME: use matrix-type input source selection */ | |
6058 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
6059 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
6060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6064 | /* Input mixer2 */ | |
6065 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6066 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6067 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6069 | /* Input mixer3 */ | |
6070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6071 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6072 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6074 | ||
6075 | { } | |
6076 | }; | |
6077 | ||
6078 | /* capture mixer elements */ | |
6079 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { | |
6080 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6081 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6082 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
6083 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
6084 | { | |
6085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6086 | /* The multiple "Capture Source" controls confuse alsamixer | |
6087 | * So call somewhat different.. | |
df694daa KY |
6088 | */ |
6089 | /* .name = "Capture Source", */ | |
6090 | .name = "Input Source", | |
6091 | .count = 2, | |
6092 | .info = alc882_mux_enum_info, | |
6093 | .get = alc882_mux_enum_get, | |
6094 | .put = alc882_mux_enum_put, | |
6095 | }, | |
6096 | { } /* end */ | |
6097 | }; | |
6098 | ||
6099 | static struct snd_kcontrol_new alc882_capture_mixer[] = { | |
6100 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
6101 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
6102 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), | |
6103 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), | |
6104 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), | |
6105 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), | |
6106 | { | |
6107 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6108 | /* The multiple "Capture Source" controls confuse alsamixer | |
6109 | * So call somewhat different.. | |
df694daa KY |
6110 | */ |
6111 | /* .name = "Capture Source", */ | |
6112 | .name = "Input Source", | |
6113 | .count = 3, | |
6114 | .info = alc882_mux_enum_info, | |
6115 | .get = alc882_mux_enum_get, | |
6116 | .put = alc882_mux_enum_put, | |
6117 | }, | |
6118 | { } /* end */ | |
6119 | }; | |
6120 | ||
cb53c626 TI |
6121 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6122 | #define alc882_loopbacks alc880_loopbacks | |
6123 | #endif | |
6124 | ||
df694daa KY |
6125 | /* pcm configuration: identiacal with ALC880 */ |
6126 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | |
6127 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
6128 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
6129 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
6130 | ||
6131 | /* | |
6132 | * configuration and preset | |
6133 | */ | |
f5fcc13c TI |
6134 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
6135 | [ALC882_3ST_DIG] = "3stack-dig", | |
6136 | [ALC882_6ST_DIG] = "6stack-dig", | |
6137 | [ALC882_ARIMA] = "arima", | |
bdd148a3 | 6138 | [ALC882_W2JC] = "w2jc", |
0438a00e TI |
6139 | [ALC882_TARGA] = "targa", |
6140 | [ALC882_ASUS_A7J] = "asus-a7j", | |
6141 | [ALC882_ASUS_A7M] = "asus-a7m", | |
9102cd1c | 6142 | [ALC885_MACPRO] = "macpro", |
87350ad0 | 6143 | [ALC885_MBP3] = "mbp3", |
c54728d8 | 6144 | [ALC885_IMAC24] = "imac24", |
f5fcc13c TI |
6145 | [ALC882_AUTO] = "auto", |
6146 | }; | |
6147 | ||
6148 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | |
6149 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
272a527c | 6150 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
ac8842a0 | 6151 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
914759b7 | 6152 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
ac3e3741 | 6153 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
c5d9f1cd | 6154 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
7b9470d8 | 6155 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
ac3e3741 | 6156 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
4444704c | 6157 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
ac3e3741 TI |
6158 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
6159 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | |
6160 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), | |
df694daa KY |
6161 | {} |
6162 | }; | |
6163 | ||
6164 | static struct alc_config_preset alc882_presets[] = { | |
6165 | [ALC882_3ST_DIG] = { | |
6166 | .mixers = { alc882_base_mixer }, | |
6167 | .init_verbs = { alc882_init_verbs }, | |
6168 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6169 | .dac_nids = alc882_dac_nids, | |
6170 | .dig_out_nid = ALC882_DIGOUT_NID, | |
df694daa KY |
6171 | .dig_in_nid = ALC882_DIGIN_NID, |
6172 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6173 | .channel_mode = alc882_ch_modes, | |
4e195a7b | 6174 | .need_dac_fix = 1, |
df694daa KY |
6175 | .input_mux = &alc882_capture_source, |
6176 | }, | |
6177 | [ALC882_6ST_DIG] = { | |
6178 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
6179 | .init_verbs = { alc882_init_verbs }, | |
6180 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6181 | .dac_nids = alc882_dac_nids, | |
6182 | .dig_out_nid = ALC882_DIGOUT_NID, | |
df694daa KY |
6183 | .dig_in_nid = ALC882_DIGIN_NID, |
6184 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
6185 | .channel_mode = alc882_sixstack_modes, | |
6186 | .input_mux = &alc882_capture_source, | |
6187 | }, | |
4b146cb0 TI |
6188 | [ALC882_ARIMA] = { |
6189 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
6190 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, | |
6191 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6192 | .dac_nids = alc882_dac_nids, | |
6193 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
6194 | .channel_mode = alc882_sixstack_modes, | |
6195 | .input_mux = &alc882_capture_source, | |
6196 | }, | |
bdd148a3 KY |
6197 | [ALC882_W2JC] = { |
6198 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
6199 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | |
6200 | alc880_gpio1_init_verbs }, | |
6201 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6202 | .dac_nids = alc882_dac_nids, | |
6203 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
6204 | .channel_mode = alc880_threestack_modes, | |
6205 | .need_dac_fix = 1, | |
6206 | .input_mux = &alc882_capture_source, | |
6207 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6208 | }, | |
87350ad0 TI |
6209 | [ALC885_MBP3] = { |
6210 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
6211 | .init_verbs = { alc885_mbp3_init_verbs, | |
6212 | alc880_gpio1_init_verbs }, | |
6213 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6214 | .dac_nids = alc882_dac_nids, | |
6215 | .channel_mode = alc885_mbp_6ch_modes, | |
6216 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), | |
6217 | .input_mux = &alc882_capture_source, | |
6218 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6219 | .dig_in_nid = ALC882_DIGIN_NID, | |
6220 | .unsol_event = alc885_mbp3_unsol_event, | |
6221 | .init_hook = alc885_mbp3_automute, | |
6222 | }, | |
9102cd1c TD |
6223 | [ALC885_MACPRO] = { |
6224 | .mixers = { alc882_macpro_mixer }, | |
6225 | .init_verbs = { alc882_macpro_init_verbs }, | |
6226 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6227 | .dac_nids = alc882_dac_nids, | |
6228 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6229 | .dig_in_nid = ALC882_DIGIN_NID, | |
6230 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6231 | .channel_mode = alc882_ch_modes, | |
6232 | .input_mux = &alc882_capture_source, | |
7debbe51 | 6233 | .init_hook = alc885_macpro_init_hook, |
9102cd1c | 6234 | }, |
c54728d8 NF |
6235 | [ALC885_IMAC24] = { |
6236 | .mixers = { alc885_imac24_mixer }, | |
6237 | .init_verbs = { alc885_imac24_init_verbs }, | |
6238 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6239 | .dac_nids = alc882_dac_nids, | |
6240 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6241 | .dig_in_nid = ALC882_DIGIN_NID, | |
6242 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6243 | .channel_mode = alc882_ch_modes, | |
6244 | .input_mux = &alc882_capture_source, | |
6245 | .unsol_event = alc885_imac24_unsol_event, | |
7debbe51 | 6246 | .init_hook = alc885_imac24_init_hook, |
c54728d8 | 6247 | }, |
272a527c KY |
6248 | [ALC882_TARGA] = { |
6249 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, | |
6250 | alc882_capture_mixer }, | |
6251 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, | |
6252 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6253 | .dac_nids = alc882_dac_nids, | |
6254 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6255 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
6256 | .adc_nids = alc882_adc_nids, | |
e1406348 | 6257 | .capsrc_nids = alc882_capsrc_nids, |
272a527c KY |
6258 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6259 | .channel_mode = alc882_3ST_6ch_modes, | |
6260 | .need_dac_fix = 1, | |
6261 | .input_mux = &alc882_capture_source, | |
6262 | .unsol_event = alc882_targa_unsol_event, | |
6263 | .init_hook = alc882_targa_automute, | |
6264 | }, | |
6265 | [ALC882_ASUS_A7J] = { | |
6266 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, | |
6267 | alc882_capture_mixer }, | |
6268 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, | |
6269 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6270 | .dac_nids = alc882_dac_nids, | |
6271 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6272 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
6273 | .adc_nids = alc882_adc_nids, | |
e1406348 | 6274 | .capsrc_nids = alc882_capsrc_nids, |
272a527c KY |
6275 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6276 | .channel_mode = alc882_3ST_6ch_modes, | |
6277 | .need_dac_fix = 1, | |
6278 | .input_mux = &alc882_capture_source, | |
6279 | }, | |
914759b7 TI |
6280 | [ALC882_ASUS_A7M] = { |
6281 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
6282 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | |
6283 | alc880_gpio1_init_verbs, | |
6284 | alc882_asus_a7m_verbs }, | |
6285 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6286 | .dac_nids = alc882_dac_nids, | |
6287 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6288 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
6289 | .channel_mode = alc880_threestack_modes, | |
6290 | .need_dac_fix = 1, | |
6291 | .input_mux = &alc882_capture_source, | |
6292 | }, | |
df694daa KY |
6293 | }; |
6294 | ||
6295 | ||
f95474ec TI |
6296 | /* |
6297 | * Pin config fixes | |
6298 | */ | |
6299 | enum { | |
6300 | PINFIX_ABIT_AW9D_MAX | |
6301 | }; | |
6302 | ||
6303 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | |
6304 | { 0x15, 0x01080104 }, /* side */ | |
6305 | { 0x16, 0x01011012 }, /* rear */ | |
6306 | { 0x17, 0x01016011 }, /* clfe */ | |
6307 | { } | |
6308 | }; | |
6309 | ||
6310 | static const struct alc_pincfg *alc882_pin_fixes[] = { | |
6311 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | |
6312 | }; | |
6313 | ||
6314 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | |
6315 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | |
6316 | {} | |
6317 | }; | |
6318 | ||
df694daa KY |
6319 | /* |
6320 | * BIOS auto configuration | |
6321 | */ | |
6322 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |
6323 | hda_nid_t nid, int pin_type, | |
6324 | int dac_idx) | |
6325 | { | |
6326 | /* set as output */ | |
6327 | struct alc_spec *spec = codec->spec; | |
f12ab1e0 TI |
6328 | int idx; |
6329 | ||
f6c7e546 | 6330 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
6331 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
6332 | idx = 4; | |
6333 | else | |
6334 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
df694daa KY |
6335 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
6336 | ||
6337 | } | |
6338 | ||
6339 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | |
6340 | { | |
6341 | struct alc_spec *spec = codec->spec; | |
6342 | int i; | |
6343 | ||
bc9f98a9 | 6344 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
df694daa | 6345 | for (i = 0; i <= HDA_SIDE; i++) { |
f12ab1e0 | 6346 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 6347 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 6348 | if (nid) |
baba8ee9 | 6349 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 6350 | i); |
df694daa KY |
6351 | } |
6352 | } | |
6353 | ||
6354 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | |
6355 | { | |
6356 | struct alc_spec *spec = codec->spec; | |
6357 | hda_nid_t pin; | |
6358 | ||
eb06ed8f | 6359 | pin = spec->autocfg.hp_pins[0]; |
df694daa | 6360 | if (pin) /* connect to front */ |
f12ab1e0 TI |
6361 | /* use dac 0 */ |
6362 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
6363 | pin = spec->autocfg.speaker_pins[0]; |
6364 | if (pin) | |
6365 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
df694daa KY |
6366 | } |
6367 | ||
6368 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) | |
6369 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID | |
6370 | ||
6371 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | |
6372 | { | |
6373 | struct alc_spec *spec = codec->spec; | |
6374 | int i; | |
6375 | ||
6376 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
6377 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
7194cae6 TI |
6378 | unsigned int vref; |
6379 | if (!nid) | |
6380 | continue; | |
6381 | vref = PIN_IN; | |
6382 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { | |
531240ff KY |
6383 | unsigned int pincap; |
6384 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | |
6385 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & | |
7194cae6 TI |
6386 | AC_PINCAP_VREF_80) |
6387 | vref = PIN_VREF80; | |
df694daa | 6388 | } |
7194cae6 TI |
6389 | snd_hda_codec_write(codec, nid, 0, |
6390 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); | |
6391 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | |
6392 | snd_hda_codec_write(codec, nid, 0, | |
6393 | AC_VERB_SET_AMP_GAIN_MUTE, | |
6394 | AMP_OUT_MUTE); | |
df694daa KY |
6395 | } |
6396 | } | |
6397 | ||
776e184e TI |
6398 | /* add mic boosts if needed */ |
6399 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
6400 | { | |
6401 | struct alc_spec *spec = codec->spec; | |
6402 | int err; | |
6403 | hda_nid_t nid; | |
6404 | ||
6405 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | |
ce22e03e | 6406 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
776e184e TI |
6407 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
6408 | "Mic Boost", | |
6409 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
6410 | if (err < 0) | |
6411 | return err; | |
6412 | } | |
6413 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | |
ce22e03e | 6414 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
776e184e TI |
6415 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
6416 | "Front Mic Boost", | |
6417 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
6418 | if (err < 0) | |
6419 | return err; | |
6420 | } | |
6421 | return 0; | |
6422 | } | |
6423 | ||
df694daa KY |
6424 | /* almost identical with ALC880 parser... */ |
6425 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
6426 | { | |
6427 | struct alc_spec *spec = codec->spec; | |
6428 | int err = alc880_parse_auto_config(codec); | |
6429 | ||
6430 | if (err < 0) | |
6431 | return err; | |
776e184e TI |
6432 | else if (!err) |
6433 | return 0; /* no config found */ | |
6434 | ||
6435 | err = alc_auto_add_mic_boost(codec); | |
6436 | if (err < 0) | |
6437 | return err; | |
6438 | ||
6439 | /* hack - override the init verbs */ | |
6440 | spec->init_verbs[0] = alc882_auto_init_verbs; | |
6441 | ||
6442 | return 1; /* config found */ | |
df694daa KY |
6443 | } |
6444 | ||
ae6b813a TI |
6445 | /* additional initialization for auto-configuration model */ |
6446 | static void alc882_auto_init(struct hda_codec *codec) | |
df694daa | 6447 | { |
f6c7e546 | 6448 | struct alc_spec *spec = codec->spec; |
df694daa KY |
6449 | alc882_auto_init_multi_out(codec); |
6450 | alc882_auto_init_hp_out(codec); | |
6451 | alc882_auto_init_analog_input(codec); | |
f6c7e546 TI |
6452 | if (spec->unsol_event) |
6453 | alc_sku_automute(codec); | |
df694daa KY |
6454 | } |
6455 | ||
7943a8ab TI |
6456 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
6457 | ||
df694daa KY |
6458 | static int patch_alc882(struct hda_codec *codec) |
6459 | { | |
6460 | struct alc_spec *spec; | |
6461 | int err, board_config; | |
6462 | ||
6463 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
6464 | if (spec == NULL) | |
6465 | return -ENOMEM; | |
6466 | ||
6467 | codec->spec = spec; | |
6468 | ||
f5fcc13c TI |
6469 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
6470 | alc882_models, | |
6471 | alc882_cfg_tbl); | |
df694daa KY |
6472 | |
6473 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
081d17c4 TD |
6474 | /* Pick up systems that don't supply PCI SSID */ |
6475 | switch (codec->subsystem_id) { | |
6476 | case 0x106b0c00: /* Mac Pro */ | |
6477 | board_config = ALC885_MACPRO; | |
6478 | break; | |
c54728d8 NF |
6479 | case 0x106b1000: /* iMac 24 */ |
6480 | board_config = ALC885_IMAC24; | |
6481 | break; | |
3d5fa2e5 | 6482 | case 0x106b00a1: /* Macbook */ |
87350ad0 TI |
6483 | case 0x106b2c00: /* Macbook Pro rev3 */ |
6484 | board_config = ALC885_MBP3; | |
6485 | break; | |
081d17c4 | 6486 | default: |
7943a8ab TI |
6487 | /* ALC889A is handled better as ALC888-compatible */ |
6488 | if (codec->revision_id == 0x100103) { | |
6489 | alc_free(codec); | |
6490 | return patch_alc883(codec); | |
6491 | } | |
081d17c4 TD |
6492 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
6493 | "trying auto-probe from BIOS...\n"); | |
6494 | board_config = ALC882_AUTO; | |
6495 | } | |
df694daa KY |
6496 | } |
6497 | ||
f95474ec TI |
6498 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
6499 | ||
df694daa KY |
6500 | if (board_config == ALC882_AUTO) { |
6501 | /* automatic parse from the BIOS config */ | |
6502 | err = alc882_parse_auto_config(codec); | |
6503 | if (err < 0) { | |
6504 | alc_free(codec); | |
6505 | return err; | |
f12ab1e0 | 6506 | } else if (!err) { |
9c7f852e TI |
6507 | printk(KERN_INFO |
6508 | "hda_codec: Cannot set up configuration " | |
6509 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
6510 | board_config = ALC882_3ST_DIG; |
6511 | } | |
6512 | } | |
6513 | ||
6514 | if (board_config != ALC882_AUTO) | |
6515 | setup_preset(spec, &alc882_presets[board_config]); | |
1da177e4 | 6516 | |
2f893286 KY |
6517 | if (codec->vendor_id == 0x10ec0885) { |
6518 | spec->stream_name_analog = "ALC885 Analog"; | |
6519 | spec->stream_name_digital = "ALC885 Digital"; | |
6520 | } else { | |
6521 | spec->stream_name_analog = "ALC882 Analog"; | |
6522 | spec->stream_name_digital = "ALC882 Digital"; | |
6523 | } | |
6524 | ||
df694daa KY |
6525 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
6526 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
6330079f TI |
6527 | /* FIXME: setup DAC5 */ |
6528 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
6529 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
1da177e4 | 6530 | |
df694daa KY |
6531 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
6532 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
1da177e4 | 6533 | |
f12ab1e0 | 6534 | if (!spec->adc_nids && spec->input_mux) { |
df694daa | 6535 | /* check whether NID 0x07 is valid */ |
4a471b7d | 6536 | unsigned int wcap = get_wcaps(codec, 0x07); |
f12ab1e0 TI |
6537 | /* get type */ |
6538 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
df694daa KY |
6539 | if (wcap != AC_WID_AUD_IN) { |
6540 | spec->adc_nids = alc882_adc_nids_alt; | |
6541 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); | |
e1406348 | 6542 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
f12ab1e0 TI |
6543 | spec->mixers[spec->num_mixers] = |
6544 | alc882_capture_alt_mixer; | |
df694daa KY |
6545 | spec->num_mixers++; |
6546 | } else { | |
6547 | spec->adc_nids = alc882_adc_nids; | |
6548 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); | |
e1406348 | 6549 | spec->capsrc_nids = alc882_capsrc_nids; |
df694daa KY |
6550 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
6551 | spec->num_mixers++; | |
6552 | } | |
6553 | } | |
1da177e4 | 6554 | |
2134ea4f TI |
6555 | spec->vmaster_nid = 0x0c; |
6556 | ||
1da177e4 | 6557 | codec->patch_ops = alc_patch_ops; |
df694daa | 6558 | if (board_config == ALC882_AUTO) |
ae6b813a | 6559 | spec->init_hook = alc882_auto_init; |
cb53c626 TI |
6560 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6561 | if (!spec->loopback.amplist) | |
6562 | spec->loopback.amplist = alc882_loopbacks; | |
6563 | #endif | |
df694daa KY |
6564 | |
6565 | return 0; | |
6566 | } | |
6567 | ||
6568 | /* | |
9c7f852e TI |
6569 | * ALC883 support |
6570 | * | |
6571 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible | |
6572 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
6573 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
6574 | * 6-channel independent captures. | |
6575 | * | |
6576 | * In addition, an independent DAC for the multi-playback (not used in this | |
6577 | * driver yet). | |
df694daa | 6578 | */ |
9c7f852e TI |
6579 | #define ALC883_DIGOUT_NID 0x06 |
6580 | #define ALC883_DIGIN_NID 0x0a | |
df694daa | 6581 | |
9c7f852e TI |
6582 | static hda_nid_t alc883_dac_nids[4] = { |
6583 | /* front, rear, clfe, rear_surr */ | |
f32a19e3 | 6584 | 0x02, 0x03, 0x04, 0x05 |
9c7f852e | 6585 | }; |
df694daa | 6586 | |
9c7f852e TI |
6587 | static hda_nid_t alc883_adc_nids[2] = { |
6588 | /* ADC1-2 */ | |
6589 | 0x08, 0x09, | |
6590 | }; | |
f12ab1e0 | 6591 | |
e1406348 TI |
6592 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
6593 | ||
9c7f852e TI |
6594 | /* input MUX */ |
6595 | /* FIXME: should be a matrix-type input source selection */ | |
df694daa | 6596 | |
9c7f852e TI |
6597 | static struct hda_input_mux alc883_capture_source = { |
6598 | .num_items = 4, | |
6599 | .items = { | |
6600 | { "Mic", 0x0 }, | |
6601 | { "Front Mic", 0x1 }, | |
6602 | { "Line", 0x2 }, | |
6603 | { "CD", 0x4 }, | |
6604 | }, | |
6605 | }; | |
bc9f98a9 | 6606 | |
17bba1b7 J |
6607 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
6608 | .num_items = 4, | |
6609 | .items = { | |
6610 | { "Mic", 0x1 }, | |
6611 | { "Front Mic", 0x0 }, | |
6612 | { "Line", 0x2 }, | |
6613 | { "CD", 0x4 }, | |
6614 | }, | |
6615 | }; | |
6616 | ||
bc9f98a9 KY |
6617 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
6618 | .num_items = 2, | |
6619 | .items = { | |
6620 | { "Mic", 0x1 }, | |
6621 | { "Line", 0x2 }, | |
6622 | }, | |
6623 | }; | |
6624 | ||
272a527c KY |
6625 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
6626 | .num_items = 4, | |
6627 | .items = { | |
6628 | { "Mic", 0x0 }, | |
6629 | { "iMic", 0x1 }, | |
6630 | { "Line", 0x2 }, | |
6631 | { "CD", 0x4 }, | |
6632 | }, | |
6633 | }; | |
6634 | ||
fb97dc67 J |
6635 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
6636 | .num_items = 2, | |
6637 | .items = { | |
6638 | { "Mic", 0x0 }, | |
6639 | { "Int Mic", 0x1 }, | |
6640 | }, | |
6641 | }; | |
6642 | ||
9c7f852e TI |
6643 | #define alc883_mux_enum_info alc_mux_enum_info |
6644 | #define alc883_mux_enum_get alc_mux_enum_get | |
e1406348 TI |
6645 | /* ALC883 has the ALC882-type input selection */ |
6646 | #define alc883_mux_enum_put alc882_mux_enum_put | |
f12ab1e0 | 6647 | |
9c7f852e TI |
6648 | /* |
6649 | * 2ch mode | |
6650 | */ | |
6651 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
6652 | { 2, NULL } | |
6653 | }; | |
6654 | ||
6655 | /* | |
6656 | * 2ch mode | |
6657 | */ | |
6658 | static struct hda_verb alc883_3ST_ch2_init[] = { | |
6659 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6660 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6661 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6662 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6663 | { } /* end */ | |
6664 | }; | |
6665 | ||
b201131c TD |
6666 | /* |
6667 | * 4ch mode | |
6668 | */ | |
6669 | static struct hda_verb alc883_3ST_ch4_init[] = { | |
6670 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6671 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6672 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6673 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6674 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6675 | { } /* end */ | |
6676 | }; | |
6677 | ||
9c7f852e TI |
6678 | /* |
6679 | * 6ch mode | |
6680 | */ | |
6681 | static struct hda_verb alc883_3ST_ch6_init[] = { | |
6682 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6683 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6684 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6685 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6686 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6687 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6688 | { } /* end */ | |
6689 | }; | |
6690 | ||
b201131c | 6691 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
9c7f852e | 6692 | { 2, alc883_3ST_ch2_init }, |
b201131c | 6693 | { 4, alc883_3ST_ch4_init }, |
9c7f852e TI |
6694 | { 6, alc883_3ST_ch6_init }, |
6695 | }; | |
6696 | ||
17bba1b7 J |
6697 | /* |
6698 | * 2ch mode | |
6699 | */ | |
6700 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
6701 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6702 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6703 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6704 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6705 | { } /* end */ | |
6706 | }; | |
6707 | ||
6708 | /* | |
6709 | * 4ch mode | |
6710 | */ | |
6711 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
6712 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6713 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6714 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6715 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6716 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6717 | { } /* end */ | |
6718 | }; | |
6719 | ||
6720 | /* | |
6721 | * 6ch mode | |
6722 | */ | |
6723 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
6724 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6725 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6726 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6727 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6728 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6729 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6730 | { } /* end */ | |
6731 | }; | |
6732 | ||
6733 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
6734 | { 2, alc883_3ST_ch2_intel_init }, | |
6735 | { 4, alc883_3ST_ch4_intel_init }, | |
6736 | { 6, alc883_3ST_ch6_intel_init }, | |
6737 | }; | |
6738 | ||
9c7f852e TI |
6739 | /* |
6740 | * 6ch mode | |
6741 | */ | |
6742 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
6743 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
6744 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6745 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6746 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6747 | { } /* end */ | |
6748 | }; | |
6749 | ||
6750 | /* | |
6751 | * 8ch mode | |
6752 | */ | |
6753 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
6754 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6755 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6756 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6757 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6758 | { } /* end */ | |
6759 | }; | |
6760 | ||
6761 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
6762 | { 6, alc883_sixstack_ch6_init }, | |
6763 | { 8, alc883_sixstack_ch8_init }, | |
6764 | }; | |
6765 | ||
b373bdeb AN |
6766 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
6767 | /* eanable EAPD on medion laptop */ | |
6768 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6769 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
6770 | { } | |
6771 | }; | |
6772 | ||
9c7f852e TI |
6773 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
6774 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
6775 | */ | |
6776 | ||
6777 | static struct snd_kcontrol_new alc883_base_mixer[] = { | |
df694daa | 6778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9c7f852e TI |
6779 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
6780 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
6781 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
6782 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
6783 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
6784 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
6785 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
6786 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
6787 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
6788 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
df694daa KY |
6789 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
6790 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
6791 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
6792 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
6793 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 6794 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
df694daa | 6795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
9c7f852e | 6796 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
32360416 | 6797 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
6798 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
6799 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
6800 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
6801 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6802 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6803 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
6804 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
6805 | { | |
6806 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6807 | /* .name = "Capture Source", */ | |
6808 | .name = "Input Source", | |
6809 | .count = 2, | |
6810 | .info = alc883_mux_enum_info, | |
6811 | .get = alc883_mux_enum_get, | |
6812 | .put = alc883_mux_enum_put, | |
6813 | }, | |
df694daa | 6814 | { } /* end */ |
834be88d TI |
6815 | }; |
6816 | ||
a8848bd6 AS |
6817 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
6818 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
6819 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
6820 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
6821 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
6822 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
6823 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
6824 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
6825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
6826 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
6827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6828 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
6829 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
6830 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
6831 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6832 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6833 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
6834 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
6835 | { | |
6836 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6837 | /* .name = "Capture Source", */ | |
6838 | .name = "Input Source", | |
6839 | .count = 2, | |
6840 | .info = alc883_mux_enum_info, | |
6841 | .get = alc883_mux_enum_get, | |
6842 | .put = alc883_mux_enum_put, | |
6843 | }, | |
6844 | { } /* end */ | |
6845 | }; | |
6846 | ||
0c4cc443 | 6847 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
368c7a95 J |
6848 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
6849 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
6850 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
6851 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
6852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
6853 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
6854 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6855 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
6856 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
6857 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
6858 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6859 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6860 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
6861 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
6862 | { | |
6863 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6864 | /* .name = "Capture Source", */ | |
6865 | .name = "Input Source", | |
6866 | .count = 2, | |
6867 | .info = alc883_mux_enum_info, | |
6868 | .get = alc883_mux_enum_get, | |
6869 | .put = alc883_mux_enum_put, | |
6870 | }, | |
6871 | { } /* end */ | |
6872 | }; | |
6873 | ||
fb97dc67 J |
6874 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
6875 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
6876 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
6877 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
6878 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
6879 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
6880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
6881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6882 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
6883 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
6884 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
6885 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6886 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6887 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
6888 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
6889 | { | |
6890 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6891 | /* .name = "Capture Source", */ | |
6892 | .name = "Input Source", | |
6893 | .count = 2, | |
6894 | .info = alc883_mux_enum_info, | |
6895 | .get = alc883_mux_enum_get, | |
6896 | .put = alc883_mux_enum_put, | |
6897 | }, | |
6898 | { } /* end */ | |
6899 | }; | |
6900 | ||
9c7f852e TI |
6901 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
6902 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
6903 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
6904 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
6905 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
6906 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
6907 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
6908 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
6909 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 6910 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
6911 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
6912 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 6913 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
6914 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
6915 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
6916 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
6917 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6918 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6919 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
6920 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
6921 | { | |
6922 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6923 | /* .name = "Capture Source", */ | |
6924 | .name = "Input Source", | |
6925 | .count = 2, | |
6926 | .info = alc883_mux_enum_info, | |
6927 | .get = alc883_mux_enum_get, | |
6928 | .put = alc883_mux_enum_put, | |
6929 | }, | |
6930 | { } /* end */ | |
6931 | }; | |
df694daa | 6932 | |
9c7f852e TI |
6933 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
6934 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
6935 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
6936 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
6937 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
6938 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
6939 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
6940 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
6941 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
6942 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
6943 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
6944 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
6945 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
6946 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
6947 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 6948 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
6949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
6950 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 6951 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
6952 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
6953 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
6954 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
6955 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6956 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6957 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
6958 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
6959 | { | |
6960 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
6961 | /* .name = "Capture Source", */ | |
6962 | .name = "Input Source", | |
6963 | .count = 2, | |
6964 | .info = alc883_mux_enum_info, | |
6965 | .get = alc883_mux_enum_get, | |
6966 | .put = alc883_mux_enum_put, | |
6967 | }, | |
6968 | { } /* end */ | |
6969 | }; | |
6970 | ||
17bba1b7 J |
6971 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
6972 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
6973 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
6974 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
6975 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
6976 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
6977 | HDA_OUTPUT), | |
6978 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
6979 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
6980 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
6981 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
6982 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
6983 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
6984 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
6985 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
6986 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
6987 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
6988 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
6989 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
6990 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
6991 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6992 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
6993 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
6994 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
6995 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
6996 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
6997 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
6998 | { | |
6999 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7000 | /* .name = "Capture Source", */ | |
7001 | .name = "Input Source", | |
7002 | .count = 2, | |
7003 | .info = alc883_mux_enum_info, | |
7004 | .get = alc883_mux_enum_get, | |
7005 | .put = alc883_mux_enum_put, | |
7006 | }, | |
7007 | { } /* end */ | |
7008 | }; | |
7009 | ||
d1d985f0 | 7010 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
c07584c8 TD |
7011 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7012 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7013 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7014 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7015 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7016 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7017 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), | |
7018 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
7019 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7020 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7021 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7022 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7023 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7024 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7025 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c07584c8 TD |
7026 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7027 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7028 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
c07584c8 TD |
7029 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7030 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7031 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
7032 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7033 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7034 | ||
7035 | { | |
7036 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7037 | /* .name = "Capture Source", */ | |
7038 | .name = "Input Source", | |
7039 | .count = 1, | |
7040 | .info = alc883_mux_enum_info, | |
7041 | .get = alc883_mux_enum_get, | |
7042 | .put = alc883_mux_enum_put, | |
7043 | }, | |
7044 | { } /* end */ | |
7045 | }; | |
7046 | ||
ccc656ce KY |
7047 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
7048 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7049 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7050 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7051 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7052 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7053 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7054 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7055 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7056 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7057 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7058 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7060 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7061 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7062 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce KY |
7063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7064 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7065 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7066 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7067 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7068 | { | |
7069 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7070 | /* .name = "Capture Source", */ | |
7071 | .name = "Input Source", | |
7072 | .count = 2, | |
7073 | .info = alc883_mux_enum_info, | |
7074 | .get = alc883_mux_enum_get, | |
7075 | .put = alc883_mux_enum_put, | |
7076 | }, | |
7077 | { } /* end */ | |
f12ab1e0 | 7078 | }; |
ccc656ce KY |
7079 | |
7080 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { | |
7081 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7082 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7083 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7084 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7085 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7087 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 7088 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
4383fae0 J |
7089 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7090 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
7091 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce KY |
7092 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
7093 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7094 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7095 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7096 | { | |
7097 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7098 | /* .name = "Capture Source", */ | |
7099 | .name = "Input Source", | |
7100 | .count = 2, | |
7101 | .info = alc883_mux_enum_info, | |
7102 | .get = alc883_mux_enum_get, | |
7103 | .put = alc883_mux_enum_put, | |
7104 | }, | |
7105 | { } /* end */ | |
f12ab1e0 | 7106 | }; |
ccc656ce | 7107 | |
bc9f98a9 KY |
7108 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
7109 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7110 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
86cd9298 TI |
7111 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
7112 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
bc9f98a9 KY |
7113 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
7114 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7115 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7117 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7118 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7119 | { | |
7120 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7121 | /* .name = "Capture Source", */ | |
7122 | .name = "Input Source", | |
7123 | .count = 1, | |
7124 | .info = alc883_mux_enum_info, | |
7125 | .get = alc883_mux_enum_get, | |
7126 | .put = alc883_mux_enum_put, | |
7127 | }, | |
7128 | { } /* end */ | |
f12ab1e0 | 7129 | }; |
bc9f98a9 | 7130 | |
272a527c KY |
7131 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
7132 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7133 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
7134 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7135 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7136 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7137 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7139 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7140 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7141 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7142 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7143 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7144 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7145 | { | |
7146 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7147 | /* .name = "Capture Source", */ | |
7148 | .name = "Input Source", | |
7149 | .count = 2, | |
7150 | .info = alc883_mux_enum_info, | |
7151 | .get = alc883_mux_enum_get, | |
7152 | .put = alc883_mux_enum_put, | |
7153 | }, | |
7154 | { } /* end */ | |
7155 | }; | |
7156 | ||
7157 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |
7158 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7159 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7160 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7161 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7162 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7163 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7164 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7165 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7166 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7167 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7168 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7169 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7170 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7171 | { | |
7172 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7173 | /* .name = "Capture Source", */ | |
7174 | .name = "Input Source", | |
7175 | .count = 2, | |
7176 | .info = alc883_mux_enum_info, | |
7177 | .get = alc883_mux_enum_get, | |
7178 | .put = alc883_mux_enum_put, | |
7179 | }, | |
7180 | { } /* end */ | |
7181 | }; | |
7182 | ||
2880a867 | 7183 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
d1a991a6 KY |
7184 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7185 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2880a867 | 7186 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
2880a867 TD |
7187 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7188 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d1a991a6 KY |
7189 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
7190 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2880a867 TD |
7192 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
7193 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7194 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7195 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7196 | { | |
7197 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7198 | /* .name = "Capture Source", */ | |
7199 | .name = "Input Source", | |
7200 | .count = 2, | |
7201 | .info = alc883_mux_enum_info, | |
7202 | .get = alc883_mux_enum_get, | |
7203 | .put = alc883_mux_enum_put, | |
7204 | }, | |
7205 | { } /* end */ | |
d1a991a6 | 7206 | }; |
2880a867 | 7207 | |
9c7f852e TI |
7208 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
7209 | { | |
7210 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7211 | .name = "Channel Mode", | |
7212 | .info = alc_ch_mode_info, | |
7213 | .get = alc_ch_mode_get, | |
7214 | .put = alc_ch_mode_put, | |
7215 | }, | |
7216 | { } /* end */ | |
7217 | }; | |
7218 | ||
7219 | static struct hda_verb alc883_init_verbs[] = { | |
7220 | /* ADC1: mute amp left and right */ | |
7221 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
df694daa | 7222 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9c7f852e TI |
7223 | /* ADC2: mute amp left and right */ |
7224 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
df694daa | 7225 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9c7f852e TI |
7226 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
7227 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7228 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7229 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7230 | /* Rear mixer */ | |
7231 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7232 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7233 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7234 | /* CLFE mixer */ | |
7235 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7236 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7237 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7238 | /* Side mixer */ | |
7239 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7240 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7241 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
df694daa | 7242 | |
cb53c626 TI |
7243 | /* mute analog input loopbacks */ |
7244 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7246 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7247 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7248 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa | 7249 | |
9c7f852e TI |
7250 | /* Front Pin: output 0 (0x0c) */ |
7251 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7252 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7253 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7254 | /* Rear Pin: output 1 (0x0d) */ | |
7255 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7258 | /* CLFE Pin: output 2 (0x0e) */ | |
7259 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7260 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7261 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7262 | /* Side Pin: output 3 (0x0f) */ | |
7263 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7264 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7265 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7266 | /* Mic (rear) pin: input vref at 80% */ | |
7267 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7268 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7269 | /* Front Mic pin: input vref at 80% */ | |
7270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7271 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7272 | /* Line In pin: input */ | |
7273 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7274 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7275 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
7276 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7277 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7278 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7279 | /* CD pin widget for input */ | |
7280 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7281 | ||
7282 | /* FIXME: use matrix-type input source selection */ | |
7283 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7284 | /* Input mixer2 */ | |
7285 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7286 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7287 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7288 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
7289 | /* Input mixer3 */ | |
7290 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7291 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7292 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7293 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
7294 | { } | |
7295 | }; | |
7296 | ||
a8848bd6 AS |
7297 | /* toggle speaker-output according to the hp-jack state */ |
7298 | static void alc883_mitac_hp_automute(struct hda_codec *codec) | |
7299 | { | |
7300 | unsigned int present; | |
7301 | ||
7302 | present = snd_hda_codec_read(codec, 0x15, 0, | |
7303 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7304 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7305 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7306 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
7307 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7308 | } | |
7309 | ||
7310 | /* auto-toggle front mic */ | |
7311 | /* | |
7312 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | |
7313 | { | |
7314 | unsigned int present; | |
7315 | unsigned char bits; | |
7316 | ||
7317 | present = snd_hda_codec_read(codec, 0x18, 0, | |
7318 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7319 | bits = present ? HDA_AMP_MUTE : 0; | |
7320 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
7321 | } | |
7322 | */ | |
7323 | ||
7324 | static void alc883_mitac_automute(struct hda_codec *codec) | |
7325 | { | |
7326 | alc883_mitac_hp_automute(codec); | |
7327 | /* alc883_mitac_mic_automute(codec); */ | |
7328 | } | |
7329 | ||
7330 | static void alc883_mitac_unsol_event(struct hda_codec *codec, | |
7331 | unsigned int res) | |
7332 | { | |
7333 | switch (res >> 26) { | |
7334 | case ALC880_HP_EVENT: | |
7335 | alc883_mitac_hp_automute(codec); | |
7336 | break; | |
7337 | case ALC880_MIC_EVENT: | |
7338 | /* alc883_mitac_mic_automute(codec); */ | |
7339 | break; | |
7340 | } | |
7341 | } | |
7342 | ||
7343 | static struct hda_verb alc883_mitac_verbs[] = { | |
7344 | /* HP */ | |
7345 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7346 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7347 | /* Subwoofer */ | |
7348 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7349 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7350 | ||
7351 | /* enable unsolicited event */ | |
7352 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7353 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
7354 | ||
7355 | { } /* end */ | |
7356 | }; | |
7357 | ||
0c4cc443 | 7358 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
368c7a95 J |
7359 | /* HP */ |
7360 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7361 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7362 | /* Int speaker */ | |
7363 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7365 | ||
7366 | /* enable unsolicited event */ | |
7367 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
0c4cc443 | 7368 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
368c7a95 J |
7369 | |
7370 | { } /* end */ | |
7371 | }; | |
7372 | ||
fb97dc67 J |
7373 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
7374 | /* HP */ | |
7375 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7377 | /* Subwoofer */ | |
7378 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7380 | ||
7381 | /* enable unsolicited event */ | |
7382 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7383 | ||
7384 | { } /* end */ | |
7385 | }; | |
7386 | ||
ccc656ce KY |
7387 | static struct hda_verb alc883_tagra_verbs[] = { |
7388 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7389 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7390 | ||
7391 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7392 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7393 | ||
7394 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
7395 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
7396 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
7397 | ||
7398 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
f12ab1e0 TI |
7399 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
7400 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
7401 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
ccc656ce KY |
7402 | |
7403 | { } /* end */ | |
7404 | }; | |
7405 | ||
bc9f98a9 KY |
7406 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
7407 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7408 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
7409 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
7410 | { } /* end */ | |
7411 | }; | |
7412 | ||
272a527c KY |
7413 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
7414 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7415 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7416 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7417 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7418 | { } /* end */ | |
7419 | }; | |
7420 | ||
7421 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
7422 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7424 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7425 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
7426 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7427 | { } /* end */ | |
7428 | }; | |
7429 | ||
189609ae KY |
7430 | static struct hda_verb alc883_haier_w66_verbs[] = { |
7431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7433 | ||
7434 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7435 | ||
7436 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7437 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7438 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7439 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7440 | { } /* end */ | |
7441 | }; | |
7442 | ||
4723c022 | 7443 | static struct hda_verb alc888_3st_hp_verbs[] = { |
8341de60 | 7444 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
f32a19e3 HRK |
7445 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
7446 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
8341de60 CM |
7447 | { } |
7448 | }; | |
7449 | ||
5795b9e6 | 7450 | static struct hda_verb alc888_6st_dell_verbs[] = { |
5795b9e6 CM |
7451 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
7452 | { } | |
7453 | }; | |
7454 | ||
4723c022 | 7455 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
8341de60 CM |
7456 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
7457 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7458 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7459 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7460 | { } | |
7461 | }; | |
7462 | ||
4723c022 | 7463 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
8341de60 CM |
7464 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7465 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7466 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7467 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7468 | { } | |
7469 | }; | |
7470 | ||
4723c022 CM |
7471 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
7472 | { 2, alc888_3st_hp_2ch_init }, | |
7473 | { 6, alc888_3st_hp_6ch_init }, | |
8341de60 CM |
7474 | }; |
7475 | ||
272a527c KY |
7476 | /* toggle front-jack and RCA according to the hp-jack state */ |
7477 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
7478 | { | |
7479 | unsigned int present; | |
7480 | ||
7481 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
7482 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7483 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
7484 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7485 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7486 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
7487 | } |
7488 | ||
7489 | /* toggle RCA according to the front-jack state */ | |
7490 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
7491 | { | |
7492 | unsigned int present; | |
7493 | ||
7494 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7495 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7496 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
7497 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c | 7498 | } |
47fd830a | 7499 | |
272a527c KY |
7500 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
7501 | unsigned int res) | |
7502 | { | |
7503 | if ((res >> 26) == ALC880_HP_EVENT) | |
7504 | alc888_lenovo_ms7195_front_automute(codec); | |
7505 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
7506 | alc888_lenovo_ms7195_rca_automute(codec); | |
7507 | } | |
7508 | ||
7509 | static struct hda_verb alc883_medion_md2_verbs[] = { | |
7510 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7511 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7512 | ||
7513 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7514 | ||
7515 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7516 | { } /* end */ | |
7517 | }; | |
7518 | ||
7519 | /* toggle speaker-output according to the hp-jack state */ | |
7520 | static void alc883_medion_md2_automute(struct hda_codec *codec) | |
7521 | { | |
7522 | unsigned int present; | |
7523 | ||
7524 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7525 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7526 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
7527 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
7528 | } |
7529 | ||
7530 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, | |
7531 | unsigned int res) | |
7532 | { | |
7533 | if ((res >> 26) == ALC880_HP_EVENT) | |
7534 | alc883_medion_md2_automute(codec); | |
7535 | } | |
7536 | ||
ccc656ce KY |
7537 | /* toggle speaker-output according to the hp-jack state */ |
7538 | static void alc883_tagra_automute(struct hda_codec *codec) | |
7539 | { | |
7540 | unsigned int present; | |
f12ab1e0 | 7541 | unsigned char bits; |
ccc656ce KY |
7542 | |
7543 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7544 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7545 | bits = present ? HDA_AMP_MUTE : 0; |
7546 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
7547 | HDA_AMP_MUTE, bits); | |
82beb8fd TI |
7548 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
7549 | present ? 1 : 3); | |
ccc656ce KY |
7550 | } |
7551 | ||
7552 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) | |
7553 | { | |
7554 | if ((res >> 26) == ALC880_HP_EVENT) | |
7555 | alc883_tagra_automute(codec); | |
7556 | } | |
7557 | ||
368c7a95 | 7558 | /* toggle speaker-output according to the hp-jack state */ |
0c4cc443 | 7559 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
368c7a95 J |
7560 | { |
7561 | unsigned int present; | |
7562 | unsigned char bits; | |
7563 | ||
7564 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) | |
7565 | & AC_PINSENSE_PRESENCE; | |
7566 | bits = present ? HDA_AMP_MUTE : 0; | |
7567 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7568 | HDA_AMP_MUTE, bits); | |
7569 | } | |
7570 | ||
0c4cc443 HRK |
7571 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
7572 | { | |
7573 | unsigned int present; | |
7574 | ||
7575 | present = snd_hda_codec_read(codec, 0x18, 0, | |
7576 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7577 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
7578 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7579 | } | |
7580 | ||
7581 | static void alc883_clevo_m720_automute(struct hda_codec *codec) | |
7582 | { | |
7583 | alc883_clevo_m720_hp_automute(codec); | |
7584 | alc883_clevo_m720_mic_automute(codec); | |
7585 | } | |
7586 | ||
7587 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
368c7a95 J |
7588 | unsigned int res) |
7589 | { | |
0c4cc443 HRK |
7590 | switch (res >> 26) { |
7591 | case ALC880_HP_EVENT: | |
7592 | alc883_clevo_m720_hp_automute(codec); | |
7593 | break; | |
7594 | case ALC880_MIC_EVENT: | |
7595 | alc883_clevo_m720_mic_automute(codec); | |
7596 | break; | |
7597 | } | |
368c7a95 J |
7598 | } |
7599 | ||
fb97dc67 J |
7600 | /* toggle speaker-output according to the hp-jack state */ |
7601 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) | |
7602 | { | |
7603 | unsigned int present; | |
7604 | unsigned char bits; | |
7605 | ||
7606 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) | |
7607 | & AC_PINSENSE_PRESENCE; | |
7608 | bits = present ? HDA_AMP_MUTE : 0; | |
7609 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7610 | HDA_AMP_MUTE, bits); | |
7611 | } | |
7612 | ||
7613 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, | |
7614 | unsigned int res) | |
7615 | { | |
7616 | if ((res >> 26) == ALC880_HP_EVENT) | |
7617 | alc883_2ch_fujitsu_pi2515_automute(codec); | |
7618 | } | |
7619 | ||
189609ae KY |
7620 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
7621 | { | |
7622 | unsigned int present; | |
7623 | unsigned char bits; | |
7624 | ||
7625 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
7626 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7627 | bits = present ? 0x80 : 0; | |
7628 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7629 | 0x80, bits); | |
7630 | } | |
7631 | ||
7632 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, | |
7633 | unsigned int res) | |
7634 | { | |
7635 | if ((res >> 26) == ALC880_HP_EVENT) | |
7636 | alc883_haier_w66_automute(codec); | |
7637 | } | |
7638 | ||
bc9f98a9 KY |
7639 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
7640 | { | |
7641 | unsigned int present; | |
f12ab1e0 | 7642 | unsigned char bits; |
bc9f98a9 KY |
7643 | |
7644 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7645 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7646 | bits = present ? HDA_AMP_MUTE : 0; |
7647 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7648 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
7649 | } |
7650 | ||
7651 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
7652 | { | |
7653 | unsigned int present; | |
f12ab1e0 | 7654 | unsigned char bits; |
bc9f98a9 KY |
7655 | |
7656 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
7657 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7658 | bits = present ? HDA_AMP_MUTE : 0; |
7659 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7660 | HDA_AMP_MUTE, bits); | |
7661 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7662 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
7663 | } |
7664 | ||
7665 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
7666 | unsigned int res) | |
7667 | { | |
7668 | if ((res >> 26) == ALC880_HP_EVENT) | |
7669 | alc883_lenovo_101e_all_automute(codec); | |
7670 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
7671 | alc883_lenovo_101e_ispeaker_automute(codec); | |
7672 | } | |
7673 | ||
676a9b53 TI |
7674 | /* toggle speaker-output according to the hp-jack state */ |
7675 | static void alc883_acer_aspire_automute(struct hda_codec *codec) | |
7676 | { | |
7677 | unsigned int present; | |
7678 | ||
7679 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7680 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7681 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7682 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7683 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
7684 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7685 | } | |
7686 | ||
7687 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, | |
7688 | unsigned int res) | |
7689 | { | |
7690 | if ((res >> 26) == ALC880_HP_EVENT) | |
7691 | alc883_acer_aspire_automute(codec); | |
7692 | } | |
7693 | ||
d1a991a6 KY |
7694 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
7695 | /* HP Pin: output 0 (0x0c) */ | |
7696 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7697 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7698 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7699 | /* Front Pin: output 0 (0x0c) */ | |
676a9b53 TI |
7700 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
7701 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1a991a6 | 7702 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
d1a991a6 KY |
7703 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
7704 | /* eanable EAPD on medion laptop */ | |
7705 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
7706 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
676a9b53 TI |
7707 | /* enable unsolicited event */ |
7708 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
d1a991a6 KY |
7709 | { } |
7710 | }; | |
7711 | ||
5795b9e6 CM |
7712 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
7713 | { | |
7714 | unsigned int present; | |
7715 | ||
7716 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
7717 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7718 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7719 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7720 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7721 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7722 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
7723 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7724 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
7725 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7726 | } | |
7727 | ||
7728 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, | |
7729 | unsigned int res) | |
7730 | { | |
7731 | switch (res >> 26) { | |
7732 | case ALC880_HP_EVENT: | |
7733 | printk("hp_event\n"); | |
7734 | alc888_6st_dell_front_automute(codec); | |
7735 | break; | |
7736 | } | |
7737 | } | |
7738 | ||
9c7f852e TI |
7739 | /* |
7740 | * generic initialization of ADC, input mixers and output mixers | |
7741 | */ | |
7742 | static struct hda_verb alc883_auto_init_verbs[] = { | |
7743 | /* | |
7744 | * Unmute ADC0-2 and set the default input to mic-in | |
7745 | */ | |
7746 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7748 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7749 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7750 | ||
cb53c626 | 7751 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 7752 | * mixer widget |
f12ab1e0 TI |
7753 | * Note: PASD motherboards uses the Line In 2 as the input for |
7754 | * front panel mic (mic 2) | |
9c7f852e TI |
7755 | */ |
7756 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
7757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
7762 | |
7763 | /* | |
7764 | * Set up output mixers (0x0c - 0x0f) | |
7765 | */ | |
7766 | /* set vol=0 to output mixers */ | |
7767 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7768 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7769 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7770 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7771 | /* set up input amps for analog loopback */ | |
7772 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
7773 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7774 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7775 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7776 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7777 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7778 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7779 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7780 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7781 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7782 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7783 | ||
7784 | /* FIXME: use matrix-type input source selection */ | |
7785 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7786 | /* Input mixer1 */ | |
7787 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7788 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7789 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 7790 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
9c7f852e TI |
7791 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
7792 | /* Input mixer2 */ | |
7793 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7794 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7795 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 7796 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
e3cde64a | 7797 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
9c7f852e TI |
7798 | |
7799 | { } | |
7800 | }; | |
7801 | ||
7802 | /* capture mixer elements */ | |
7803 | static struct snd_kcontrol_new alc883_capture_mixer[] = { | |
7804 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7805 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7806 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7807 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7808 | { | |
7809 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7810 | /* The multiple "Capture Source" controls confuse alsamixer | |
7811 | * So call somewhat different.. | |
9c7f852e TI |
7812 | */ |
7813 | /* .name = "Capture Source", */ | |
7814 | .name = "Input Source", | |
7815 | .count = 2, | |
7816 | .info = alc882_mux_enum_info, | |
7817 | .get = alc882_mux_enum_get, | |
7818 | .put = alc882_mux_enum_put, | |
7819 | }, | |
7820 | { } /* end */ | |
7821 | }; | |
7822 | ||
cb53c626 TI |
7823 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
7824 | #define alc883_loopbacks alc880_loopbacks | |
7825 | #endif | |
7826 | ||
9c7f852e TI |
7827 | /* pcm configuration: identiacal with ALC880 */ |
7828 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback | |
7829 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 7830 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
9c7f852e TI |
7831 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
7832 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture | |
7833 | ||
7834 | /* | |
7835 | * configuration and preset | |
7836 | */ | |
f5fcc13c TI |
7837 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
7838 | [ALC883_3ST_2ch_DIG] = "3stack-dig", | |
7839 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | |
7840 | [ALC883_3ST_6ch] = "3stack-6ch", | |
7841 | [ALC883_6ST_DIG] = "6stack-dig", | |
7842 | [ALC883_TARGA_DIG] = "targa-dig", | |
7843 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
f5fcc13c | 7844 | [ALC883_ACER] = "acer", |
2880a867 | 7845 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
f5fcc13c | 7846 | [ALC883_MEDION] = "medion", |
272a527c | 7847 | [ALC883_MEDION_MD2] = "medion-md2", |
f5fcc13c | 7848 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
bc9f98a9 | 7849 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
272a527c KY |
7850 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
7851 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
189609ae | 7852 | [ALC883_HAIER_W66] = "haier-w66", |
4723c022 | 7853 | [ALC888_3ST_HP] = "3stack-hp", |
5795b9e6 | 7854 | [ALC888_6ST_DELL] = "6stack-dell", |
a8848bd6 | 7855 | [ALC883_MITAC] = "mitac", |
0c4cc443 | 7856 | [ALC883_CLEVO_M720] = "clevo-m720", |
fb97dc67 | 7857 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
17bba1b7 | 7858 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
f5fcc13c TI |
7859 | [ALC883_AUTO] = "auto", |
7860 | }; | |
7861 | ||
7862 | static struct snd_pci_quirk alc883_cfg_tbl[] = { | |
7863 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), | |
ac3e3741 TI |
7864 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
7865 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | |
7866 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
7867 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ | |
5795b9e6 | 7868 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
febe3375 | 7869 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
ac3e3741 TI |
7870 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
7871 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
5d85f8d0 | 7872 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
ac3e3741 | 7873 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
97ec710c | 7874 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
f5fcc13c | 7875 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
ac3e3741 TI |
7876 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
7877 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
7878 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | |
57b14f24 | 7879 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
6f3bf657 | 7880 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
bba8dee7 | 7881 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 7882 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
4383fae0 | 7883 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
dd146a60 | 7884 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
82808236 | 7885 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
f5fcc13c | 7886 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 7887 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
7888 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
7889 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 | 7890 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
64ca1c29 | 7891 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
7892 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
7893 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
7894 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 TI |
7895 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
7896 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
7897 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
86d34b7e | 7898 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
ac3e3741 TI |
7899 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
7900 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
f5fcc13c | 7901 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 7902 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
0c4cc443 HRK |
7903 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
7904 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
ac3e3741 | 7905 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
e60623b4 | 7906 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
f5fcc13c | 7907 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
fb97dc67 | 7908 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
272a527c | 7909 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
272a527c | 7910 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
ac3e3741 TI |
7911 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
7912 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
272a527c | 7913 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
0b167bf4 | 7914 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
189609ae | 7915 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
17bba1b7 J |
7916 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
7917 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
ac3e3741 | 7918 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
9c7f852e TI |
7919 | {} |
7920 | }; | |
7921 | ||
7922 | static struct alc_config_preset alc883_presets[] = { | |
7923 | [ALC883_3ST_2ch_DIG] = { | |
7924 | .mixers = { alc883_3ST_2ch_mixer }, | |
7925 | .init_verbs = { alc883_init_verbs }, | |
7926 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
7927 | .dac_nids = alc883_dac_nids, | |
7928 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
7929 | .dig_in_nid = ALC883_DIGIN_NID, |
7930 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
7931 | .channel_mode = alc883_3ST_2ch_modes, | |
7932 | .input_mux = &alc883_capture_source, | |
7933 | }, | |
7934 | [ALC883_3ST_6ch_DIG] = { | |
7935 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
7936 | .init_verbs = { alc883_init_verbs }, | |
7937 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
7938 | .dac_nids = alc883_dac_nids, | |
7939 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
7940 | .dig_in_nid = ALC883_DIGIN_NID, |
7941 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
7942 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 7943 | .need_dac_fix = 1, |
9c7f852e | 7944 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 7945 | }, |
9c7f852e TI |
7946 | [ALC883_3ST_6ch] = { |
7947 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
7948 | .init_verbs = { alc883_init_verbs }, | |
7949 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
7950 | .dac_nids = alc883_dac_nids, | |
9c7f852e TI |
7951 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7952 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 7953 | .need_dac_fix = 1, |
9c7f852e | 7954 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 7955 | }, |
17bba1b7 J |
7956 | [ALC883_3ST_6ch_INTEL] = { |
7957 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
7958 | .init_verbs = { alc883_init_verbs }, | |
7959 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
7960 | .dac_nids = alc883_dac_nids, | |
7961 | .dig_out_nid = ALC883_DIGOUT_NID, | |
7962 | .dig_in_nid = ALC883_DIGIN_NID, | |
7963 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), | |
7964 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
7965 | .need_dac_fix = 1, | |
7966 | .input_mux = &alc883_3stack_6ch_intel, | |
7967 | }, | |
9c7f852e TI |
7968 | [ALC883_6ST_DIG] = { |
7969 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
7970 | .init_verbs = { alc883_init_verbs }, | |
7971 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
7972 | .dac_nids = alc883_dac_nids, | |
7973 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
7974 | .dig_in_nid = ALC883_DIGIN_NID, |
7975 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
7976 | .channel_mode = alc883_sixstack_modes, | |
7977 | .input_mux = &alc883_capture_source, | |
7978 | }, | |
ccc656ce KY |
7979 | [ALC883_TARGA_DIG] = { |
7980 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, | |
7981 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, | |
7982 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
7983 | .dac_nids = alc883_dac_nids, | |
7984 | .dig_out_nid = ALC883_DIGOUT_NID, | |
ccc656ce KY |
7985 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7986 | .channel_mode = alc883_3ST_6ch_modes, | |
7987 | .need_dac_fix = 1, | |
7988 | .input_mux = &alc883_capture_source, | |
7989 | .unsol_event = alc883_tagra_unsol_event, | |
7990 | .init_hook = alc883_tagra_automute, | |
7991 | }, | |
7992 | [ALC883_TARGA_2ch_DIG] = { | |
7993 | .mixers = { alc883_tagra_2ch_mixer}, | |
7994 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, | |
7995 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
7996 | .dac_nids = alc883_dac_nids, | |
7997 | .dig_out_nid = ALC883_DIGOUT_NID, | |
ccc656ce KY |
7998 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7999 | .channel_mode = alc883_3ST_2ch_modes, | |
8000 | .input_mux = &alc883_capture_source, | |
8001 | .unsol_event = alc883_tagra_unsol_event, | |
8002 | .init_hook = alc883_tagra_automute, | |
8003 | }, | |
bab282b9 | 8004 | [ALC883_ACER] = { |
676a9b53 | 8005 | .mixers = { alc883_base_mixer }, |
bab282b9 VA |
8006 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
8007 | * and the headphone jack. Turn this on and rely on the | |
8008 | * standard mute methods whenever the user wants to turn | |
8009 | * these outputs off. | |
8010 | */ | |
8011 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
8012 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8013 | .dac_nids = alc883_dac_nids, | |
bab282b9 VA |
8014 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8015 | .channel_mode = alc883_3ST_2ch_modes, | |
8016 | .input_mux = &alc883_capture_source, | |
8017 | }, | |
2880a867 | 8018 | [ALC883_ACER_ASPIRE] = { |
676a9b53 | 8019 | .mixers = { alc883_acer_aspire_mixer }, |
d1a991a6 | 8020 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
2880a867 TD |
8021 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8022 | .dac_nids = alc883_dac_nids, | |
8023 | .dig_out_nid = ALC883_DIGOUT_NID, | |
2880a867 TD |
8024 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8025 | .channel_mode = alc883_3ST_2ch_modes, | |
8026 | .input_mux = &alc883_capture_source, | |
676a9b53 TI |
8027 | .unsol_event = alc883_acer_aspire_unsol_event, |
8028 | .init_hook = alc883_acer_aspire_automute, | |
d1a991a6 | 8029 | }, |
c07584c8 TD |
8030 | [ALC883_MEDION] = { |
8031 | .mixers = { alc883_fivestack_mixer, | |
8032 | alc883_chmode_mixer }, | |
8033 | .init_verbs = { alc883_init_verbs, | |
b373bdeb | 8034 | alc883_medion_eapd_verbs }, |
c07584c8 TD |
8035 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8036 | .dac_nids = alc883_dac_nids, | |
c07584c8 TD |
8037 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
8038 | .channel_mode = alc883_sixstack_modes, | |
8039 | .input_mux = &alc883_capture_source, | |
b373bdeb | 8040 | }, |
272a527c KY |
8041 | [ALC883_MEDION_MD2] = { |
8042 | .mixers = { alc883_medion_md2_mixer}, | |
8043 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, | |
8044 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8045 | .dac_nids = alc883_dac_nids, | |
8046 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
8047 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8048 | .channel_mode = alc883_3ST_2ch_modes, | |
8049 | .input_mux = &alc883_capture_source, | |
8050 | .unsol_event = alc883_medion_md2_unsol_event, | |
8051 | .init_hook = alc883_medion_md2_automute, | |
8052 | }, | |
b373bdeb | 8053 | [ALC883_LAPTOP_EAPD] = { |
676a9b53 | 8054 | .mixers = { alc883_base_mixer }, |
b373bdeb AN |
8055 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
8056 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8057 | .dac_nids = alc883_dac_nids, | |
b373bdeb AN |
8058 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8059 | .channel_mode = alc883_3ST_2ch_modes, | |
8060 | .input_mux = &alc883_capture_source, | |
8061 | }, | |
0c4cc443 HRK |
8062 | [ALC883_CLEVO_M720] = { |
8063 | .mixers = { alc883_clevo_m720_mixer }, | |
8064 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
368c7a95 J |
8065 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8066 | .dac_nids = alc883_dac_nids, | |
8067 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8068 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8069 | .channel_mode = alc883_3ST_2ch_modes, | |
8070 | .input_mux = &alc883_capture_source, | |
0c4cc443 HRK |
8071 | .unsol_event = alc883_clevo_m720_unsol_event, |
8072 | .init_hook = alc883_clevo_m720_automute, | |
368c7a95 | 8073 | }, |
bc9f98a9 KY |
8074 | [ALC883_LENOVO_101E_2ch] = { |
8075 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
8076 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
8077 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8078 | .dac_nids = alc883_dac_nids, | |
bc9f98a9 KY |
8079 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8080 | .channel_mode = alc883_3ST_2ch_modes, | |
8081 | .input_mux = &alc883_lenovo_101e_capture_source, | |
8082 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
8083 | .init_hook = alc883_lenovo_101e_all_automute, | |
8084 | }, | |
272a527c KY |
8085 | [ALC883_LENOVO_NB0763] = { |
8086 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
8087 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
8088 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8089 | .dac_nids = alc883_dac_nids, | |
272a527c KY |
8090 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8091 | .channel_mode = alc883_3ST_2ch_modes, | |
8092 | .need_dac_fix = 1, | |
8093 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
8094 | .unsol_event = alc883_medion_md2_unsol_event, | |
8095 | .init_hook = alc883_medion_md2_automute, | |
8096 | }, | |
8097 | [ALC888_LENOVO_MS7195_DIG] = { | |
8098 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8099 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
8100 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8101 | .dac_nids = alc883_dac_nids, | |
8102 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
8103 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
8104 | .channel_mode = alc883_3ST_6ch_modes, | |
8105 | .need_dac_fix = 1, | |
8106 | .input_mux = &alc883_capture_source, | |
8107 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
8108 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
189609ae KY |
8109 | }, |
8110 | [ALC883_HAIER_W66] = { | |
8111 | .mixers = { alc883_tagra_2ch_mixer}, | |
8112 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, | |
8113 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8114 | .dac_nids = alc883_dac_nids, | |
8115 | .dig_out_nid = ALC883_DIGOUT_NID, | |
189609ae KY |
8116 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8117 | .channel_mode = alc883_3ST_2ch_modes, | |
8118 | .input_mux = &alc883_capture_source, | |
8119 | .unsol_event = alc883_haier_w66_unsol_event, | |
8120 | .init_hook = alc883_haier_w66_automute, | |
eea6419e | 8121 | }, |
4723c022 | 8122 | [ALC888_3ST_HP] = { |
eea6419e | 8123 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
4723c022 | 8124 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
8341de60 CM |
8125 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8126 | .dac_nids = alc883_dac_nids, | |
4723c022 CM |
8127 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
8128 | .channel_mode = alc888_3st_hp_modes, | |
8341de60 CM |
8129 | .need_dac_fix = 1, |
8130 | .input_mux = &alc883_capture_source, | |
8131 | }, | |
5795b9e6 | 8132 | [ALC888_6ST_DELL] = { |
f24dbdc6 | 8133 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
5795b9e6 CM |
8134 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
8135 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8136 | .dac_nids = alc883_dac_nids, | |
8137 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5795b9e6 CM |
8138 | .dig_in_nid = ALC883_DIGIN_NID, |
8139 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
8140 | .channel_mode = alc883_sixstack_modes, | |
8141 | .input_mux = &alc883_capture_source, | |
8142 | .unsol_event = alc888_6st_dell_unsol_event, | |
8143 | .init_hook = alc888_6st_dell_front_automute, | |
8144 | }, | |
a8848bd6 AS |
8145 | [ALC883_MITAC] = { |
8146 | .mixers = { alc883_mitac_mixer }, | |
8147 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
8148 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8149 | .dac_nids = alc883_dac_nids, | |
a8848bd6 AS |
8150 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8151 | .channel_mode = alc883_3ST_2ch_modes, | |
8152 | .input_mux = &alc883_capture_source, | |
8153 | .unsol_event = alc883_mitac_unsol_event, | |
8154 | .init_hook = alc883_mitac_automute, | |
8155 | }, | |
fb97dc67 J |
8156 | [ALC883_FUJITSU_PI2515] = { |
8157 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
8158 | .init_verbs = { alc883_init_verbs, | |
8159 | alc883_2ch_fujitsu_pi2515_verbs}, | |
8160 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8161 | .dac_nids = alc883_dac_nids, | |
8162 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8163 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8164 | .channel_mode = alc883_3ST_2ch_modes, | |
8165 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
8166 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, | |
8167 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, | |
8168 | }, | |
9c7f852e TI |
8169 | }; |
8170 | ||
8171 | ||
8172 | /* | |
8173 | * BIOS auto configuration | |
8174 | */ | |
8175 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | |
8176 | hda_nid_t nid, int pin_type, | |
8177 | int dac_idx) | |
8178 | { | |
8179 | /* set as output */ | |
8180 | struct alc_spec *spec = codec->spec; | |
f12ab1e0 TI |
8181 | int idx; |
8182 | ||
f6c7e546 | 8183 | alc_set_pin_output(codec, nid, pin_type); |
9c7f852e TI |
8184 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
8185 | idx = 4; | |
8186 | else | |
8187 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
9c7f852e TI |
8188 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
8189 | ||
8190 | } | |
8191 | ||
8192 | static void alc883_auto_init_multi_out(struct hda_codec *codec) | |
8193 | { | |
8194 | struct alc_spec *spec = codec->spec; | |
8195 | int i; | |
8196 | ||
bc9f98a9 | 8197 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
9c7f852e | 8198 | for (i = 0; i <= HDA_SIDE; i++) { |
f12ab1e0 | 8199 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 8200 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
9c7f852e | 8201 | if (nid) |
baba8ee9 | 8202 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 8203 | i); |
9c7f852e TI |
8204 | } |
8205 | } | |
8206 | ||
8207 | static void alc883_auto_init_hp_out(struct hda_codec *codec) | |
8208 | { | |
8209 | struct alc_spec *spec = codec->spec; | |
8210 | hda_nid_t pin; | |
8211 | ||
eb06ed8f | 8212 | pin = spec->autocfg.hp_pins[0]; |
9c7f852e TI |
8213 | if (pin) /* connect to front */ |
8214 | /* use dac 0 */ | |
8215 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
8216 | pin = spec->autocfg.speaker_pins[0]; |
8217 | if (pin) | |
8218 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
9c7f852e TI |
8219 | } |
8220 | ||
8221 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) | |
8222 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID | |
8223 | ||
8224 | static void alc883_auto_init_analog_input(struct hda_codec *codec) | |
8225 | { | |
8226 | struct alc_spec *spec = codec->spec; | |
8227 | int i; | |
8228 | ||
8229 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
8230 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
8231 | if (alc883_is_input_pin(nid)) { | |
8232 | snd_hda_codec_write(codec, nid, 0, | |
8233 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8234 | (i <= AUTO_PIN_FRONT_MIC ? | |
8235 | PIN_VREF80 : PIN_IN)); | |
8236 | if (nid != ALC883_PIN_CD_NID) | |
8237 | snd_hda_codec_write(codec, nid, 0, | |
8238 | AC_VERB_SET_AMP_GAIN_MUTE, | |
8239 | AMP_OUT_MUTE); | |
8240 | } | |
8241 | } | |
8242 | } | |
8243 | ||
8244 | /* almost identical with ALC880 parser... */ | |
8245 | static int alc883_parse_auto_config(struct hda_codec *codec) | |
8246 | { | |
8247 | struct alc_spec *spec = codec->spec; | |
8248 | int err = alc880_parse_auto_config(codec); | |
8249 | ||
8250 | if (err < 0) | |
8251 | return err; | |
776e184e TI |
8252 | else if (!err) |
8253 | return 0; /* no config found */ | |
8254 | ||
8255 | err = alc_auto_add_mic_boost(codec); | |
8256 | if (err < 0) | |
8257 | return err; | |
8258 | ||
8259 | /* hack - override the init verbs */ | |
8260 | spec->init_verbs[0] = alc883_auto_init_verbs; | |
bc9f98a9 KY |
8261 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
8262 | spec->num_mixers++; | |
776e184e TI |
8263 | |
8264 | return 1; /* config found */ | |
9c7f852e TI |
8265 | } |
8266 | ||
8267 | /* additional initialization for auto-configuration model */ | |
8268 | static void alc883_auto_init(struct hda_codec *codec) | |
8269 | { | |
f6c7e546 | 8270 | struct alc_spec *spec = codec->spec; |
9c7f852e TI |
8271 | alc883_auto_init_multi_out(codec); |
8272 | alc883_auto_init_hp_out(codec); | |
8273 | alc883_auto_init_analog_input(codec); | |
f6c7e546 TI |
8274 | if (spec->unsol_event) |
8275 | alc_sku_automute(codec); | |
9c7f852e TI |
8276 | } |
8277 | ||
8278 | static int patch_alc883(struct hda_codec *codec) | |
8279 | { | |
8280 | struct alc_spec *spec; | |
8281 | int err, board_config; | |
8282 | ||
8283 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
8284 | if (spec == NULL) | |
8285 | return -ENOMEM; | |
8286 | ||
8287 | codec->spec = spec; | |
8288 | ||
f5fcc13c TI |
8289 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
8290 | alc883_models, | |
8291 | alc883_cfg_tbl); | |
8292 | if (board_config < 0) { | |
9c7f852e TI |
8293 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
8294 | "trying auto-probe from BIOS...\n"); | |
8295 | board_config = ALC883_AUTO; | |
8296 | } | |
8297 | ||
8298 | if (board_config == ALC883_AUTO) { | |
8299 | /* automatic parse from the BIOS config */ | |
8300 | err = alc883_parse_auto_config(codec); | |
8301 | if (err < 0) { | |
8302 | alc_free(codec); | |
8303 | return err; | |
f12ab1e0 | 8304 | } else if (!err) { |
9c7f852e TI |
8305 | printk(KERN_INFO |
8306 | "hda_codec: Cannot set up configuration " | |
8307 | "from BIOS. Using base mode...\n"); | |
8308 | board_config = ALC883_3ST_2ch_DIG; | |
8309 | } | |
8310 | } | |
8311 | ||
8312 | if (board_config != ALC883_AUTO) | |
8313 | setup_preset(spec, &alc883_presets[board_config]); | |
8314 | ||
2f893286 KY |
8315 | switch (codec->vendor_id) { |
8316 | case 0x10ec0888: | |
8317 | spec->stream_name_analog = "ALC888 Analog"; | |
8318 | spec->stream_name_digital = "ALC888 Digital"; | |
8319 | break; | |
8320 | case 0x10ec0889: | |
8321 | spec->stream_name_analog = "ALC889 Analog"; | |
8322 | spec->stream_name_digital = "ALC889 Digital"; | |
8323 | break; | |
8324 | default: | |
8325 | spec->stream_name_analog = "ALC883 Analog"; | |
8326 | spec->stream_name_digital = "ALC883 Digital"; | |
8327 | break; | |
8328 | } | |
8329 | ||
9c7f852e TI |
8330 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
8331 | spec->stream_analog_capture = &alc883_pcm_analog_capture; | |
6330079f | 8332 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
9c7f852e | 8333 | |
9c7f852e TI |
8334 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
8335 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | |
8336 | ||
e1406348 TI |
8337 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
8338 | spec->adc_nids = alc883_adc_nids; | |
8339 | spec->capsrc_nids = alc883_capsrc_nids; | |
9c7f852e | 8340 | |
2134ea4f TI |
8341 | spec->vmaster_nid = 0x0c; |
8342 | ||
9c7f852e TI |
8343 | codec->patch_ops = alc_patch_ops; |
8344 | if (board_config == ALC883_AUTO) | |
8345 | spec->init_hook = alc883_auto_init; | |
f9423e7a KY |
8346 | else if (codec->vendor_id == 0x10ec0888) |
8347 | spec->init_hook = alc888_coef_init; | |
8348 | ||
cb53c626 TI |
8349 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
8350 | if (!spec->loopback.amplist) | |
8351 | spec->loopback.amplist = alc883_loopbacks; | |
8352 | #endif | |
9c7f852e TI |
8353 | |
8354 | return 0; | |
8355 | } | |
8356 | ||
8357 | /* | |
8358 | * ALC262 support | |
8359 | */ | |
8360 | ||
8361 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
8362 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
8363 | ||
8364 | #define alc262_dac_nids alc260_dac_nids | |
8365 | #define alc262_adc_nids alc882_adc_nids | |
8366 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
88c71a99 TI |
8367 | #define alc262_capsrc_nids alc882_capsrc_nids |
8368 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
9c7f852e TI |
8369 | |
8370 | #define alc262_modes alc260_modes | |
8371 | #define alc262_capture_source alc882_capture_source | |
8372 | ||
8373 | static struct snd_kcontrol_new alc262_base_mixer[] = { | |
8374 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8375 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8376 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8377 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8378 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8379 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8380 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8381 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8382 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8383 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8384 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 8385 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8386 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
31bffaa9 | 8387 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
9c7f852e TI |
8388 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
8389 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8390 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8391 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
8392 | { } /* end */ | |
8393 | }; | |
8394 | ||
ccc656ce KY |
8395 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
8396 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8397 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8398 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8399 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8400 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8401 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8402 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8403 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8404 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce KY |
8405 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8406 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 8407 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
ccc656ce | 8408 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
31bffaa9 | 8409 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
ccc656ce KY |
8410 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
8411 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8412 | { } /* end */ | |
8413 | }; | |
8414 | ||
ce875f07 TI |
8415 | /* update HP, line and mono-out pins according to the master switch */ |
8416 | static void alc262_hp_master_update(struct hda_codec *codec) | |
8417 | { | |
8418 | struct alc_spec *spec = codec->spec; | |
8419 | int val = spec->master_sw; | |
8420 | ||
8421 | /* HP & line-out */ | |
8422 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
8423 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8424 | val ? PIN_HP : 0); | |
8425 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
8426 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8427 | val ? PIN_HP : 0); | |
8428 | /* mono (speaker) depending on the HP jack sense */ | |
8429 | val = val && !spec->jack_present; | |
8430 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
8431 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8432 | val ? PIN_OUT : 0); | |
8433 | } | |
8434 | ||
8435 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
8436 | { | |
8437 | struct alc_spec *spec = codec->spec; | |
8438 | unsigned int presence; | |
8439 | presence = snd_hda_codec_read(codec, 0x1b, 0, | |
8440 | AC_VERB_GET_PIN_SENSE, 0); | |
8441 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); | |
8442 | alc262_hp_master_update(codec); | |
8443 | } | |
8444 | ||
8445 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
8446 | { | |
8447 | if ((res >> 26) != ALC880_HP_EVENT) | |
8448 | return; | |
8449 | alc262_hp_bpc_automute(codec); | |
8450 | } | |
8451 | ||
8452 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
8453 | { | |
8454 | struct alc_spec *spec = codec->spec; | |
8455 | unsigned int presence; | |
8456 | presence = snd_hda_codec_read(codec, 0x15, 0, | |
8457 | AC_VERB_GET_PIN_SENSE, 0); | |
8458 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); | |
8459 | alc262_hp_master_update(codec); | |
8460 | } | |
8461 | ||
8462 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
8463 | unsigned int res) | |
8464 | { | |
8465 | if ((res >> 26) != ALC880_HP_EVENT) | |
8466 | return; | |
8467 | alc262_hp_wildwest_automute(codec); | |
8468 | } | |
8469 | ||
8470 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
8471 | struct snd_ctl_elem_value *ucontrol) | |
8472 | { | |
8473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
8474 | struct alc_spec *spec = codec->spec; | |
8475 | *ucontrol->value.integer.value = spec->master_sw; | |
8476 | return 0; | |
8477 | } | |
8478 | ||
8479 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
8480 | struct snd_ctl_elem_value *ucontrol) | |
8481 | { | |
8482 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
8483 | struct alc_spec *spec = codec->spec; | |
8484 | int val = !!*ucontrol->value.integer.value; | |
8485 | ||
8486 | if (val == spec->master_sw) | |
8487 | return 0; | |
8488 | spec->master_sw = val; | |
8489 | alc262_hp_master_update(codec); | |
8490 | return 1; | |
8491 | } | |
8492 | ||
9c7f852e | 8493 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
ce875f07 TI |
8494 | { |
8495 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8496 | .name = "Master Playback Switch", | |
8497 | .info = snd_ctl_boolean_mono_info, | |
8498 | .get = alc262_hp_master_sw_get, | |
8499 | .put = alc262_hp_master_sw_put, | |
8500 | }, | |
9c7f852e TI |
8501 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8502 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8503 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
8504 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
8505 | HDA_OUTPUT), | |
8506 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
8507 | HDA_OUTPUT), | |
9c7f852e TI |
8508 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
8509 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8510 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8511 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8512 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 8513 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
8514 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8515 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8516 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8517 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8518 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
8519 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
8520 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
8521 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
8522 | { } /* end */ | |
8523 | }; | |
8524 | ||
cd7509a4 | 8525 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
ce875f07 TI |
8526 | { |
8527 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8528 | .name = "Master Playback Switch", | |
8529 | .info = snd_ctl_boolean_mono_info, | |
8530 | .get = alc262_hp_master_sw_get, | |
8531 | .put = alc262_hp_master_sw_put, | |
8532 | }, | |
cd7509a4 KY |
8533 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8534 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8535 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8536 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
8537 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
8538 | HDA_OUTPUT), | |
8539 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
8540 | HDA_OUTPUT), | |
cd7509a4 KY |
8541 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8542 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
cc69d12d | 8543 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
cd7509a4 KY |
8544 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8545 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
8546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8547 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8548 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
8549 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
8550 | { } /* end */ | |
8551 | }; | |
8552 | ||
8553 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
8554 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8555 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8556 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
cd7509a4 KY |
8557 | { } /* end */ |
8558 | }; | |
8559 | ||
66d2a9d6 KY |
8560 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
8561 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) | |
8562 | { | |
8563 | struct alc_spec *spec = codec->spec; | |
66d2a9d6 KY |
8564 | |
8565 | if (force || !spec->sense_updated) { | |
8566 | unsigned int present; | |
8567 | present = snd_hda_codec_read(codec, 0x15, 0, | |
8568 | AC_VERB_GET_PIN_SENSE, 0); | |
4bb26130 | 8569 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
66d2a9d6 KY |
8570 | spec->sense_updated = 1; |
8571 | } | |
4bb26130 TI |
8572 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
8573 | spec->jack_present ? HDA_AMP_MUTE : 0); | |
66d2a9d6 KY |
8574 | } |
8575 | ||
8576 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, | |
8577 | unsigned int res) | |
8578 | { | |
8579 | if ((res >> 26) != ALC880_HP_EVENT) | |
8580 | return; | |
8581 | alc262_hp_t5735_automute(codec, 1); | |
8582 | } | |
8583 | ||
8584 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) | |
8585 | { | |
8586 | alc262_hp_t5735_automute(codec, 1); | |
8587 | } | |
8588 | ||
8589 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | |
86cd9298 TI |
8590 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8591 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
66d2a9d6 KY |
8592 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
8593 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8595 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8596 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8597 | { } /* end */ | |
8598 | }; | |
8599 | ||
8600 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
8601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8602 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8603 | ||
8604 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8605 | { } | |
8606 | }; | |
8607 | ||
8c427226 | 8608 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
f2f48e18 TI |
8609 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8610 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
8611 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
8612 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
8c427226 KY |
8613 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8614 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
8615 | { } /* end */ | |
8616 | }; | |
8617 | ||
8618 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
8619 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8620 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8621 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8622 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8623 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8624 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8625 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
8626 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
8627 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
8628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
8629 | {} | |
8630 | }; | |
8631 | ||
8632 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
8633 | .num_items = 1, | |
8634 | .items = { | |
8635 | { "Line", 0x1 }, | |
8636 | }, | |
8637 | }; | |
8638 | ||
0724ea2a TI |
8639 | /* bind hp and internal speaker mute (with plug check) */ |
8640 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, | |
8641 | struct snd_ctl_elem_value *ucontrol) | |
8642 | { | |
8643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
8644 | long *valp = ucontrol->value.integer.value; | |
8645 | int change; | |
8646 | ||
8647 | /* change hp mute */ | |
8648 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, | |
8649 | HDA_AMP_MUTE, | |
8650 | valp[0] ? 0 : HDA_AMP_MUTE); | |
8651 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, | |
8652 | HDA_AMP_MUTE, | |
8653 | valp[1] ? 0 : HDA_AMP_MUTE); | |
8654 | if (change) { | |
8655 | /* change speaker according to HP jack state */ | |
8656 | struct alc_spec *spec = codec->spec; | |
8657 | unsigned int mute; | |
8658 | if (spec->jack_present) | |
8659 | mute = HDA_AMP_MUTE; | |
8660 | else | |
8661 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, | |
8662 | HDA_OUTPUT, 0); | |
8663 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8664 | HDA_AMP_MUTE, mute); | |
8665 | } | |
8666 | return change; | |
8667 | } | |
5b31954e | 8668 | |
272a527c | 8669 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
0724ea2a TI |
8670 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8671 | { | |
8672 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8673 | .name = "Master Playback Switch", | |
8674 | .info = snd_hda_mixer_amp_switch_info, | |
8675 | .get = snd_hda_mixer_amp_switch_get, | |
8676 | .put = alc262_sony_master_sw_put, | |
8677 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
8678 | }, | |
272a527c KY |
8679 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
8680 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8681 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
8682 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
8683 | { } /* end */ | |
8684 | }; | |
8685 | ||
83c34218 KY |
8686 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
8687 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8688 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8689 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8692 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
8693 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
8694 | { } /* end */ | |
8695 | }; | |
272a527c | 8696 | |
9c7f852e TI |
8697 | #define alc262_capture_mixer alc882_capture_mixer |
8698 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
8699 | ||
8700 | /* | |
8701 | * generic initialization of ADC, input mixers and output mixers | |
8702 | */ | |
8703 | static struct hda_verb alc262_init_verbs[] = { | |
8704 | /* | |
8705 | * Unmute ADC0-2 and set the default input to mic-in | |
8706 | */ | |
8707 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8708 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8709 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8710 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8711 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8712 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8713 | ||
cb53c626 | 8714 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 8715 | * mixer widget |
f12ab1e0 TI |
8716 | * Note: PASD motherboards uses the Line In 2 as the input for |
8717 | * front panel mic (mic 2) | |
9c7f852e TI |
8718 | */ |
8719 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
8720 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8721 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
8725 | |
8726 | /* | |
df694daa KY |
8727 | * Set up output mixers (0x0c - 0x0e) |
8728 | */ | |
8729 | /* set vol=0 to output mixers */ | |
8730 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8731 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8732 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8733 | /* set up input amps for analog loopback */ | |
8734 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
8735 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8737 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8738 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8739 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8740 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8741 | ||
8742 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
8743 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
8744 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
8745 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
8746 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
8747 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
8748 | ||
8749 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
8750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
8751 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
8752 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
8753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
8754 | ||
8755 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8756 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8757 | ||
8758 | /* FIXME: use matrix-type input source selection */ | |
8759 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8760 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8761 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
8762 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
8763 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
8764 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
8765 | /* Input mixer2 */ | |
8766 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
8767 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
8768 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
8769 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
8770 | /* Input mixer3 */ | |
8771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
8772 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
8773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
f12ab1e0 | 8774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
df694daa KY |
8775 | |
8776 | { } | |
8777 | }; | |
1da177e4 | 8778 | |
ccc656ce KY |
8779 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
8780 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
8781 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8782 | {} | |
8783 | }; | |
8784 | ||
8785 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | |
8786 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
8787 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8788 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
8789 | ||
8790 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
8791 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8792 | {} | |
8793 | }; | |
8794 | ||
272a527c KY |
8795 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
8796 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
8797 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8798 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
8799 | ||
8800 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
8801 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7b1e8795 | 8802 | {} |
272a527c KY |
8803 | }; |
8804 | ||
ccc656ce | 8805 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
5b31954e | 8806 | static void alc262_hippo_automute(struct hda_codec *codec) |
ccc656ce KY |
8807 | { |
8808 | struct alc_spec *spec = codec->spec; | |
8809 | unsigned int mute; | |
5b31954e | 8810 | unsigned int present; |
ccc656ce | 8811 | |
5b31954e TI |
8812 | /* need to execute and sync at first */ |
8813 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); | |
8814 | present = snd_hda_codec_read(codec, 0x15, 0, | |
8815 | AC_VERB_GET_PIN_SENSE, 0); | |
8816 | spec->jack_present = (present & 0x80000000) != 0; | |
ccc656ce KY |
8817 | if (spec->jack_present) { |
8818 | /* mute internal speaker */ | |
47fd830a TI |
8819 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
8820 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
ccc656ce KY |
8821 | } else { |
8822 | /* unmute internal speaker if necessary */ | |
8823 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); | |
47fd830a TI |
8824 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
8825 | HDA_AMP_MUTE, mute); | |
ccc656ce KY |
8826 | } |
8827 | } | |
8828 | ||
8829 | /* unsolicited event for HP jack sensing */ | |
8830 | static void alc262_hippo_unsol_event(struct hda_codec *codec, | |
8831 | unsigned int res) | |
8832 | { | |
8833 | if ((res >> 26) != ALC880_HP_EVENT) | |
8834 | return; | |
5b31954e | 8835 | alc262_hippo_automute(codec); |
ccc656ce KY |
8836 | } |
8837 | ||
5b31954e | 8838 | static void alc262_hippo1_automute(struct hda_codec *codec) |
ccc656ce | 8839 | { |
ccc656ce | 8840 | unsigned int mute; |
5b31954e | 8841 | unsigned int present; |
ccc656ce | 8842 | |
5b31954e TI |
8843 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
8844 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
8845 | AC_VERB_GET_PIN_SENSE, 0); | |
8846 | present = (present & 0x80000000) != 0; | |
8847 | if (present) { | |
ccc656ce | 8848 | /* mute internal speaker */ |
47fd830a TI |
8849 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
8850 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
ccc656ce KY |
8851 | } else { |
8852 | /* unmute internal speaker if necessary */ | |
8853 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
47fd830a TI |
8854 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
8855 | HDA_AMP_MUTE, mute); | |
ccc656ce KY |
8856 | } |
8857 | } | |
8858 | ||
8859 | /* unsolicited event for HP jack sensing */ | |
8860 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, | |
8861 | unsigned int res) | |
8862 | { | |
8863 | if ((res >> 26) != ALC880_HP_EVENT) | |
8864 | return; | |
5b31954e | 8865 | alc262_hippo1_automute(codec); |
ccc656ce KY |
8866 | } |
8867 | ||
834be88d TI |
8868 | /* |
8869 | * fujitsu model | |
5d9fab2d TV |
8870 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
8871 | * 0x1b = port replicator headphone out | |
834be88d TI |
8872 | */ |
8873 | ||
8874 | #define ALC_HP_EVENT 0x37 | |
8875 | ||
8876 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
8877 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
8878 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5d9fab2d TV |
8879 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
8880 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
834be88d TI |
8881 | {} |
8882 | }; | |
8883 | ||
0e31daf7 J |
8884 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
8885 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
8886 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8887 | {} | |
8888 | }; | |
8889 | ||
834be88d | 8890 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
39d3ed38 | 8891 | .num_items = 3, |
834be88d TI |
8892 | .items = { |
8893 | { "Mic", 0x0 }, | |
39d3ed38 | 8894 | { "Int Mic", 0x1 }, |
834be88d TI |
8895 | { "CD", 0x4 }, |
8896 | }, | |
8897 | }; | |
8898 | ||
9c7f852e TI |
8899 | static struct hda_input_mux alc262_HP_capture_source = { |
8900 | .num_items = 5, | |
8901 | .items = { | |
8902 | { "Mic", 0x0 }, | |
accbe498 | 8903 | { "Front Mic", 0x1 }, |
9c7f852e TI |
8904 | { "Line", 0x2 }, |
8905 | { "CD", 0x4 }, | |
8906 | { "AUX IN", 0x6 }, | |
8907 | }, | |
8908 | }; | |
8909 | ||
accbe498 | 8910 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
8911 | .num_items = 4, | |
8912 | .items = { | |
8913 | { "Mic", 0x0 }, | |
8914 | { "Front Mic", 0x2 }, | |
8915 | { "Line", 0x1 }, | |
8916 | { "CD", 0x4 }, | |
8917 | }, | |
8918 | }; | |
8919 | ||
ebc7a406 | 8920 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
834be88d TI |
8921 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
8922 | { | |
8923 | struct alc_spec *spec = codec->spec; | |
8924 | unsigned int mute; | |
8925 | ||
f12ab1e0 | 8926 | if (force || !spec->sense_updated) { |
ebc7a406 | 8927 | unsigned int present; |
834be88d TI |
8928 | /* need to execute and sync at first */ |
8929 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); | |
ebc7a406 TI |
8930 | /* check laptop HP jack */ |
8931 | present = snd_hda_codec_read(codec, 0x14, 0, | |
8932 | AC_VERB_GET_PIN_SENSE, 0); | |
8933 | /* need to execute and sync at first */ | |
8934 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
8935 | /* check docking HP jack */ | |
8936 | present |= snd_hda_codec_read(codec, 0x1b, 0, | |
8937 | AC_VERB_GET_PIN_SENSE, 0); | |
8938 | if (present & AC_PINSENSE_PRESENCE) | |
8939 | spec->jack_present = 1; | |
8940 | else | |
8941 | spec->jack_present = 0; | |
834be88d TI |
8942 | spec->sense_updated = 1; |
8943 | } | |
ebc7a406 TI |
8944 | /* unmute internal speaker only if both HPs are unplugged and |
8945 | * master switch is on | |
8946 | */ | |
8947 | if (spec->jack_present) | |
8948 | mute = HDA_AMP_MUTE; | |
8949 | else | |
834be88d | 8950 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
ebc7a406 TI |
8951 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
8952 | HDA_AMP_MUTE, mute); | |
834be88d TI |
8953 | } |
8954 | ||
8955 | /* unsolicited event for HP jack sensing */ | |
8956 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
8957 | unsigned int res) | |
8958 | { | |
8959 | if ((res >> 26) != ALC_HP_EVENT) | |
8960 | return; | |
8961 | alc262_fujitsu_automute(codec, 1); | |
8962 | } | |
8963 | ||
ebc7a406 TI |
8964 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
8965 | { | |
8966 | alc262_fujitsu_automute(codec, 1); | |
8967 | } | |
8968 | ||
834be88d | 8969 | /* bind volumes of both NID 0x0c and 0x0d */ |
cca3b371 TI |
8970 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
8971 | .ops = &snd_hda_bind_vol, | |
8972 | .values = { | |
8973 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
8974 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
8975 | 0 | |
8976 | }, | |
8977 | }; | |
834be88d | 8978 | |
0e31daf7 J |
8979 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
8980 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
8981 | { | |
8982 | struct alc_spec *spec = codec->spec; | |
8983 | unsigned int mute; | |
8984 | ||
8985 | if (force || !spec->sense_updated) { | |
8986 | unsigned int present_int_hp; | |
8987 | /* need to execute and sync at first */ | |
8988 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
8989 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, | |
8990 | AC_VERB_GET_PIN_SENSE, 0); | |
8991 | spec->jack_present = (present_int_hp & 0x80000000) != 0; | |
8992 | spec->sense_updated = 1; | |
8993 | } | |
8994 | if (spec->jack_present) { | |
8995 | /* mute internal speaker */ | |
8996 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8997 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
8998 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
8999 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
9000 | } else { | |
9001 | /* unmute internal speaker if necessary */ | |
9002 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
9003 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9004 | HDA_AMP_MUTE, mute); | |
9005 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9006 | HDA_AMP_MUTE, mute); | |
9007 | } | |
9008 | } | |
9009 | ||
9010 | /* unsolicited event for HP jack sensing */ | |
9011 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
9012 | unsigned int res) | |
9013 | { | |
9014 | if ((res >> 26) != ALC_HP_EVENT) | |
9015 | return; | |
9016 | alc262_lenovo_3000_automute(codec, 1); | |
9017 | } | |
9018 | ||
834be88d TI |
9019 | /* bind hp and internal speaker mute (with plug check) */ |
9020 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
9021 | struct snd_ctl_elem_value *ucontrol) | |
9022 | { | |
9023 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9024 | long *valp = ucontrol->value.integer.value; | |
9025 | int change; | |
9026 | ||
5d9fab2d TV |
9027 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9028 | HDA_AMP_MUTE, | |
9029 | valp ? 0 : HDA_AMP_MUTE); | |
9030 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
9031 | HDA_AMP_MUTE, | |
9032 | valp ? 0 : HDA_AMP_MUTE); | |
9033 | ||
82beb8fd TI |
9034 | if (change) |
9035 | alc262_fujitsu_automute(codec, 0); | |
834be88d TI |
9036 | return change; |
9037 | } | |
9038 | ||
9039 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
cca3b371 | 9040 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
834be88d TI |
9041 | { |
9042 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9043 | .name = "Master Playback Switch", | |
9044 | .info = snd_hda_mixer_amp_switch_info, | |
9045 | .get = snd_hda_mixer_amp_switch_get, | |
9046 | .put = alc262_fujitsu_master_sw_put, | |
9047 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
9048 | }, | |
9049 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9050 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
06a9c30c TV |
9051 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
9052 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), | |
834be88d TI |
9053 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9054 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9055 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
39d3ed38 TI |
9056 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
9057 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9058 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
834be88d TI |
9059 | { } /* end */ |
9060 | }; | |
9061 | ||
0e31daf7 J |
9062 | /* bind hp and internal speaker mute (with plug check) */ |
9063 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
9064 | struct snd_ctl_elem_value *ucontrol) | |
9065 | { | |
9066 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9067 | long *valp = ucontrol->value.integer.value; | |
9068 | int change; | |
9069 | ||
9070 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
9071 | HDA_AMP_MUTE, | |
9072 | valp ? 0 : HDA_AMP_MUTE); | |
9073 | ||
9074 | if (change) | |
9075 | alc262_lenovo_3000_automute(codec, 0); | |
9076 | return change; | |
9077 | } | |
9078 | ||
9079 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
9080 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
9081 | { | |
9082 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9083 | .name = "Master Playback Switch", | |
9084 | .info = snd_hda_mixer_amp_switch_info, | |
9085 | .get = snd_hda_mixer_amp_switch_get, | |
9086 | .put = alc262_lenovo_3000_master_sw_put, | |
9087 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
9088 | }, | |
9089 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9090 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9091 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9092 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9093 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9094 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
9095 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9096 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9097 | { } /* end */ | |
9098 | }; | |
9099 | ||
304dcaac TI |
9100 | /* additional init verbs for Benq laptops */ |
9101 | static struct hda_verb alc262_EAPD_verbs[] = { | |
9102 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9103 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
9104 | {} | |
9105 | }; | |
9106 | ||
83c34218 KY |
9107 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
9108 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9109 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9110 | ||
9111 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9112 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
9113 | {} | |
9114 | }; | |
9115 | ||
f651b50b TD |
9116 | /* Samsung Q1 Ultra Vista model setup */ |
9117 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
bb9f76cd TI |
9118 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9119 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
f651b50b TD |
9120 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9121 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9122 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
bb9f76cd | 9123 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
f651b50b TD |
9124 | { } /* end */ |
9125 | }; | |
9126 | ||
9127 | static struct hda_verb alc262_ultra_verbs[] = { | |
bb9f76cd TI |
9128 | /* output mixer */ |
9129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9131 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9132 | /* speaker */ | |
9133 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9134 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
9135 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9136 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9137 | /* HP */ | |
f651b50b | 9138 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
bb9f76cd TI |
9139 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
9140 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9141 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9142 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9143 | /* internal mic */ | |
9144 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
9145 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9146 | /* ADC, choose mic */ | |
9147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9148 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9149 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9150 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9151 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9152 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9153 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
9154 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
9155 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
9156 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
f651b50b TD |
9157 | {} |
9158 | }; | |
9159 | ||
f651b50b TD |
9160 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
9161 | static void alc262_ultra_automute(struct hda_codec *codec) | |
9162 | { | |
9163 | struct alc_spec *spec = codec->spec; | |
9164 | unsigned int mute; | |
f651b50b | 9165 | |
bb9f76cd TI |
9166 | mute = 0; |
9167 | /* auto-mute only when HP is used as HP */ | |
9168 | if (!spec->cur_mux[0]) { | |
9169 | unsigned int present; | |
9170 | /* need to execute and sync at first */ | |
9171 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9172 | present = snd_hda_codec_read(codec, 0x15, 0, | |
9173 | AC_VERB_GET_PIN_SENSE, 0); | |
9174 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
9175 | if (spec->jack_present) | |
9176 | mute = HDA_AMP_MUTE; | |
f651b50b | 9177 | } |
bb9f76cd TI |
9178 | /* mute/unmute internal speaker */ |
9179 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9180 | HDA_AMP_MUTE, mute); | |
9181 | /* mute/unmute HP */ | |
9182 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9183 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
f651b50b TD |
9184 | } |
9185 | ||
9186 | /* unsolicited event for HP jack sensing */ | |
9187 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
9188 | unsigned int res) | |
9189 | { | |
9190 | if ((res >> 26) != ALC880_HP_EVENT) | |
9191 | return; | |
9192 | alc262_ultra_automute(codec); | |
9193 | } | |
9194 | ||
bb9f76cd TI |
9195 | static struct hda_input_mux alc262_ultra_capture_source = { |
9196 | .num_items = 2, | |
9197 | .items = { | |
9198 | { "Mic", 0x1 }, | |
9199 | { "Headphone", 0x7 }, | |
9200 | }, | |
9201 | }; | |
9202 | ||
9203 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
9204 | struct snd_ctl_elem_value *ucontrol) | |
9205 | { | |
9206 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9207 | struct alc_spec *spec = codec->spec; | |
9208 | int ret; | |
9209 | ||
9210 | ret = alc882_mux_enum_put(kcontrol, ucontrol); | |
9211 | if (!ret) | |
9212 | return 0; | |
9213 | /* reprogram the HP pin as mic or HP according to the input source */ | |
9214 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
9215 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
9216 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
9217 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
9218 | return ret; | |
9219 | } | |
9220 | ||
9221 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
9222 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
9223 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
9224 | { | |
9225 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9226 | .name = "Capture Source", | |
9227 | .info = alc882_mux_enum_info, | |
9228 | .get = alc882_mux_enum_get, | |
9229 | .put = alc262_ultra_mux_enum_put, | |
9230 | }, | |
9231 | { } /* end */ | |
9232 | }; | |
9233 | ||
df694daa | 9234 | /* add playback controls from the parsed DAC table */ |
f12ab1e0 TI |
9235 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
9236 | const struct auto_pin_cfg *cfg) | |
df694daa KY |
9237 | { |
9238 | hda_nid_t nid; | |
9239 | int err; | |
9240 | ||
9241 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
9242 | spec->multiout.dac_nids = spec->private_dac_nids; | |
9243 | spec->multiout.dac_nids[0] = 2; | |
9244 | ||
9245 | nid = cfg->line_out_pins[0]; | |
9246 | if (nid) { | |
f12ab1e0 TI |
9247 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9248 | "Front Playback Volume", | |
9249 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); | |
9250 | if (err < 0) | |
df694daa | 9251 | return err; |
f12ab1e0 TI |
9252 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9253 | "Front Playback Switch", | |
9254 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
9255 | if (err < 0) | |
df694daa KY |
9256 | return err; |
9257 | } | |
9258 | ||
82bc955f | 9259 | nid = cfg->speaker_pins[0]; |
df694daa KY |
9260 | if (nid) { |
9261 | if (nid == 0x16) { | |
f12ab1e0 TI |
9262 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9263 | "Speaker Playback Volume", | |
9264 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | |
9265 | HDA_OUTPUT)); | |
9266 | if (err < 0) | |
df694daa | 9267 | return err; |
f12ab1e0 TI |
9268 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9269 | "Speaker Playback Switch", | |
9270 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
9271 | HDA_OUTPUT)); | |
9272 | if (err < 0) | |
df694daa KY |
9273 | return err; |
9274 | } else { | |
f12ab1e0 TI |
9275 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9276 | "Speaker Playback Switch", | |
9277 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
9278 | HDA_OUTPUT)); | |
9279 | if (err < 0) | |
df694daa KY |
9280 | return err; |
9281 | } | |
9282 | } | |
eb06ed8f | 9283 | nid = cfg->hp_pins[0]; |
df694daa KY |
9284 | if (nid) { |
9285 | /* spec->multiout.hp_nid = 2; */ | |
9286 | if (nid == 0x16) { | |
f12ab1e0 TI |
9287 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9288 | "Headphone Playback Volume", | |
9289 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | |
9290 | HDA_OUTPUT)); | |
9291 | if (err < 0) | |
df694daa | 9292 | return err; |
f12ab1e0 TI |
9293 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9294 | "Headphone Playback Switch", | |
9295 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
9296 | HDA_OUTPUT)); | |
9297 | if (err < 0) | |
df694daa KY |
9298 | return err; |
9299 | } else { | |
f12ab1e0 TI |
9300 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9301 | "Headphone Playback Switch", | |
9302 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
9303 | HDA_OUTPUT)); | |
9304 | if (err < 0) | |
df694daa KY |
9305 | return err; |
9306 | } | |
9307 | } | |
f12ab1e0 | 9308 | return 0; |
df694daa KY |
9309 | } |
9310 | ||
9311 | /* identical with ALC880 */ | |
f12ab1e0 TI |
9312 | #define alc262_auto_create_analog_input_ctls \ |
9313 | alc880_auto_create_analog_input_ctls | |
df694daa KY |
9314 | |
9315 | /* | |
9316 | * generic initialization of ADC, input mixers and output mixers | |
9317 | */ | |
9318 | static struct hda_verb alc262_volume_init_verbs[] = { | |
9319 | /* | |
9320 | * Unmute ADC0-2 and set the default input to mic-in | |
9321 | */ | |
9322 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9324 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9325 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9326 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9327 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9328 | ||
cb53c626 | 9329 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 9330 | * mixer widget |
f12ab1e0 TI |
9331 | * Note: PASD motherboards uses the Line In 2 as the input for |
9332 | * front panel mic (mic 2) | |
df694daa KY |
9333 | */ |
9334 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
9335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
9336 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9337 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9338 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9339 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
9340 | |
9341 | /* | |
9342 | * Set up output mixers (0x0c - 0x0f) | |
9343 | */ | |
9344 | /* set vol=0 to output mixers */ | |
9345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9346 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9348 | ||
9349 | /* set up input amps for analog loopback */ | |
9350 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
9351 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9352 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9353 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9354 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9355 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9356 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9357 | ||
9358 | /* FIXME: use matrix-type input source selection */ | |
9359 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
9360 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
9361 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9364 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9365 | /* Input mixer2 */ | |
9366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9369 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9370 | /* Input mixer3 */ | |
9371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9374 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9375 | ||
9376 | { } | |
9377 | }; | |
9378 | ||
9c7f852e TI |
9379 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
9380 | /* | |
9381 | * Unmute ADC0-2 and set the default input to mic-in | |
9382 | */ | |
9383 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9385 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9386 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9387 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9388 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9389 | ||
cb53c626 | 9390 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 9391 | * mixer widget |
f12ab1e0 TI |
9392 | * Note: PASD motherboards uses the Line In 2 as the input for |
9393 | * front panel mic (mic 2) | |
9c7f852e TI |
9394 | */ |
9395 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
9396 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
9397 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9398 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9399 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9400 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9401 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
9402 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
9c7f852e TI |
9403 | |
9404 | /* | |
9405 | * Set up output mixers (0x0c - 0x0e) | |
9406 | */ | |
9407 | /* set vol=0 to output mixers */ | |
9408 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9409 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9410 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9411 | ||
9412 | /* set up input amps for analog loopback */ | |
9413 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
9414 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9416 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9417 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9418 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9419 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9420 | ||
ce875f07 | 9421 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
9c7f852e TI |
9422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
9423 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9424 | ||
9425 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9427 | ||
9428 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9429 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9430 | ||
9431 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9432 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9433 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9434 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9435 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9436 | ||
9437 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
9438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9439 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
9441 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9442 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9443 | ||
9444 | ||
9445 | /* FIXME: use matrix-type input source selection */ | |
9446 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
9447 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
9448 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9449 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
9450 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
9451 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
9452 | /* Input mixer2 */ | |
9453 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9454 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
9455 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
9456 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
9457 | /* Input mixer3 */ | |
9458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
9460 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
9461 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
9462 | ||
ce875f07 TI |
9463 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
9464 | ||
9c7f852e TI |
9465 | { } |
9466 | }; | |
9467 | ||
cd7509a4 KY |
9468 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
9469 | /* | |
9470 | * Unmute ADC0-2 and set the default input to mic-in | |
9471 | */ | |
9472 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9473 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9474 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9475 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9476 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9477 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9478 | ||
cb53c626 | 9479 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
cd7509a4 KY |
9480 | * mixer widget |
9481 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
9482 | * panel mic (mic 2) | |
9483 | */ | |
9484 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
9485 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
9486 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9487 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9488 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9489 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9490 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
9491 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
9492 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
cd7509a4 KY |
9493 | /* |
9494 | * Set up output mixers (0x0c - 0x0e) | |
9495 | */ | |
9496 | /* set vol=0 to output mixers */ | |
9497 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9498 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9499 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9500 | ||
9501 | /* set up input amps for analog loopback */ | |
9502 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
9503 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9504 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9505 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9506 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9507 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9508 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9509 | ||
9510 | ||
9511 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
9512 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
9513 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
9514 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
9515 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
9516 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
9517 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
9518 | ||
9519 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9521 | ||
9522 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9523 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9524 | ||
9525 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
9526 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9527 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9528 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
9529 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9530 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9531 | ||
9532 | /* FIXME: use matrix-type input source selection */ | |
9533 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
9534 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
9535 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
9536 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
9537 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
9538 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
9539 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
9540 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
9541 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
9542 | /* Input mixer2 */ | |
9543 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9544 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
9545 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
9546 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
9547 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
9548 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
9549 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
9550 | /* Input mixer3 */ | |
9551 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9552 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
9553 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
9554 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
9555 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
9556 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
9557 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
9558 | ||
ce875f07 TI |
9559 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
9560 | ||
cd7509a4 KY |
9561 | { } |
9562 | }; | |
9563 | ||
cb53c626 TI |
9564 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9565 | #define alc262_loopbacks alc880_loopbacks | |
9566 | #endif | |
9567 | ||
df694daa KY |
9568 | /* pcm configuration: identiacal with ALC880 */ |
9569 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback | |
9570 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
9571 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
9572 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
9573 | ||
9574 | /* | |
9575 | * BIOS auto configuration | |
9576 | */ | |
9577 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
9578 | { | |
9579 | struct alc_spec *spec = codec->spec; | |
9580 | int err; | |
9581 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
9582 | ||
f12ab1e0 TI |
9583 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
9584 | alc262_ignore); | |
9585 | if (err < 0) | |
df694daa | 9586 | return err; |
f12ab1e0 | 9587 | if (!spec->autocfg.line_outs) |
df694daa | 9588 | return 0; /* can't find valid BIOS pin config */ |
f12ab1e0 TI |
9589 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
9590 | if (err < 0) | |
9591 | return err; | |
9592 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
9593 | if (err < 0) | |
df694daa KY |
9594 | return err; |
9595 | ||
9596 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
9597 | ||
9598 | if (spec->autocfg.dig_out_pin) | |
9599 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; | |
9600 | if (spec->autocfg.dig_in_pin) | |
9601 | spec->dig_in_nid = ALC262_DIGIN_NID; | |
9602 | ||
9603 | if (spec->kctl_alloc) | |
9604 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
9605 | ||
9606 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; | |
a1e8d2da | 9607 | spec->num_mux_defs = 1; |
df694daa KY |
9608 | spec->input_mux = &spec->private_imux; |
9609 | ||
776e184e TI |
9610 | err = alc_auto_add_mic_boost(codec); |
9611 | if (err < 0) | |
9612 | return err; | |
9613 | ||
df694daa KY |
9614 | return 1; |
9615 | } | |
9616 | ||
9617 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
9618 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
9619 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
9620 | ||
9621 | ||
9622 | /* init callback for auto-configuration model -- overriding the default init */ | |
ae6b813a | 9623 | static void alc262_auto_init(struct hda_codec *codec) |
df694daa | 9624 | { |
f6c7e546 | 9625 | struct alc_spec *spec = codec->spec; |
df694daa KY |
9626 | alc262_auto_init_multi_out(codec); |
9627 | alc262_auto_init_hp_out(codec); | |
9628 | alc262_auto_init_analog_input(codec); | |
f6c7e546 TI |
9629 | if (spec->unsol_event) |
9630 | alc_sku_automute(codec); | |
df694daa KY |
9631 | } |
9632 | ||
9633 | /* | |
9634 | * configuration and preset | |
9635 | */ | |
f5fcc13c TI |
9636 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
9637 | [ALC262_BASIC] = "basic", | |
9638 | [ALC262_HIPPO] = "hippo", | |
9639 | [ALC262_HIPPO_1] = "hippo_1", | |
9640 | [ALC262_FUJITSU] = "fujitsu", | |
9641 | [ALC262_HP_BPC] = "hp-bpc", | |
cd7509a4 | 9642 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
61dc35de | 9643 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
8c427226 | 9644 | [ALC262_HP_RP5700] = "hp-rp5700", |
f5fcc13c | 9645 | [ALC262_BENQ_ED8] = "benq", |
0f40502e TI |
9646 | [ALC262_BENQ_T31] = "benq-t31", |
9647 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
f651b50b | 9648 | [ALC262_ULTRA] = "ultra", |
0e31daf7 | 9649 | [ALC262_LENOVO_3000] = "lenovo-3000", |
f5fcc13c TI |
9650 | [ALC262_AUTO] = "auto", |
9651 | }; | |
9652 | ||
9653 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
9654 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
9655 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), | |
7d87de2d | 9656 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
ac3e3741 TI |
9657 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
9658 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), | |
7d87de2d | 9659 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
b98f9334 | 9660 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
b98f9334 | 9661 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
b98f9334 | 9662 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
cd7509a4 | 9663 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 9664 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 9665 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 9666 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 9667 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 9668 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 9669 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 9670 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 TI |
9671 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
9672 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
9673 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
66d2a9d6 KY |
9674 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
9675 | ALC262_HP_TC_T5735), | |
8c427226 | 9676 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
ac3e3741 | 9677 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
f5fcc13c | 9678 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
5b31954e | 9679 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
272a527c | 9680 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
ac3e3741 TI |
9681 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
9682 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | |
3f1eeaed | 9683 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
f651b50b | 9684 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
bb9f76cd | 9685 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
0e31daf7 | 9686 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
ac3e3741 TI |
9687 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
9688 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
9689 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
df694daa KY |
9690 | {} |
9691 | }; | |
9692 | ||
9693 | static struct alc_config_preset alc262_presets[] = { | |
9694 | [ALC262_BASIC] = { | |
9695 | .mixers = { alc262_base_mixer }, | |
9696 | .init_verbs = { alc262_init_verbs }, | |
9697 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9698 | .dac_nids = alc262_dac_nids, | |
9699 | .hp_nid = 0x03, | |
9700 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9701 | .channel_mode = alc262_modes, | |
a3bcba38 | 9702 | .input_mux = &alc262_capture_source, |
df694daa | 9703 | }, |
ccc656ce KY |
9704 | [ALC262_HIPPO] = { |
9705 | .mixers = { alc262_base_mixer }, | |
9706 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, | |
9707 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9708 | .dac_nids = alc262_dac_nids, | |
9709 | .hp_nid = 0x03, | |
9710 | .dig_out_nid = ALC262_DIGOUT_NID, | |
9711 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9712 | .channel_mode = alc262_modes, | |
9713 | .input_mux = &alc262_capture_source, | |
9714 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 9715 | .init_hook = alc262_hippo_automute, |
ccc656ce KY |
9716 | }, |
9717 | [ALC262_HIPPO_1] = { | |
9718 | .mixers = { alc262_hippo1_mixer }, | |
9719 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
9720 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9721 | .dac_nids = alc262_dac_nids, | |
9722 | .hp_nid = 0x02, | |
9723 | .dig_out_nid = ALC262_DIGOUT_NID, | |
9724 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9725 | .channel_mode = alc262_modes, | |
9726 | .input_mux = &alc262_capture_source, | |
9727 | .unsol_event = alc262_hippo1_unsol_event, | |
5b31954e | 9728 | .init_hook = alc262_hippo1_automute, |
ccc656ce | 9729 | }, |
834be88d TI |
9730 | [ALC262_FUJITSU] = { |
9731 | .mixers = { alc262_fujitsu_mixer }, | |
39d3ed38 TI |
9732 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
9733 | alc262_fujitsu_unsol_verbs }, | |
834be88d TI |
9734 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
9735 | .dac_nids = alc262_dac_nids, | |
9736 | .hp_nid = 0x03, | |
9737 | .dig_out_nid = ALC262_DIGOUT_NID, | |
9738 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9739 | .channel_mode = alc262_modes, | |
9740 | .input_mux = &alc262_fujitsu_capture_source, | |
ae6b813a | 9741 | .unsol_event = alc262_fujitsu_unsol_event, |
ebc7a406 | 9742 | .init_hook = alc262_fujitsu_init_hook, |
834be88d | 9743 | }, |
9c7f852e TI |
9744 | [ALC262_HP_BPC] = { |
9745 | .mixers = { alc262_HP_BPC_mixer }, | |
9746 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
9747 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9748 | .dac_nids = alc262_dac_nids, | |
9749 | .hp_nid = 0x03, | |
9750 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9751 | .channel_mode = alc262_modes, | |
9752 | .input_mux = &alc262_HP_capture_source, | |
ce875f07 TI |
9753 | .unsol_event = alc262_hp_bpc_unsol_event, |
9754 | .init_hook = alc262_hp_bpc_automute, | |
f12ab1e0 | 9755 | }, |
cd7509a4 KY |
9756 | [ALC262_HP_BPC_D7000_WF] = { |
9757 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
9758 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
9759 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9760 | .dac_nids = alc262_dac_nids, | |
9761 | .hp_nid = 0x03, | |
9762 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9763 | .channel_mode = alc262_modes, | |
accbe498 | 9764 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
9765 | .unsol_event = alc262_hp_wildwest_unsol_event, |
9766 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 9767 | }, |
cd7509a4 KY |
9768 | [ALC262_HP_BPC_D7000_WL] = { |
9769 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
9770 | alc262_HP_BPC_WildWest_option_mixer }, | |
9771 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
9772 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9773 | .dac_nids = alc262_dac_nids, | |
9774 | .hp_nid = 0x03, | |
9775 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9776 | .channel_mode = alc262_modes, | |
accbe498 | 9777 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
9778 | .unsol_event = alc262_hp_wildwest_unsol_event, |
9779 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 9780 | }, |
66d2a9d6 KY |
9781 | [ALC262_HP_TC_T5735] = { |
9782 | .mixers = { alc262_hp_t5735_mixer }, | |
9783 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
9784 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9785 | .dac_nids = alc262_dac_nids, | |
9786 | .hp_nid = 0x03, | |
9787 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9788 | .channel_mode = alc262_modes, | |
9789 | .input_mux = &alc262_capture_source, | |
9790 | .unsol_event = alc262_hp_t5735_unsol_event, | |
9791 | .init_hook = alc262_hp_t5735_init_hook, | |
8c427226 KY |
9792 | }, |
9793 | [ALC262_HP_RP5700] = { | |
9794 | .mixers = { alc262_hp_rp5700_mixer }, | |
9795 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
9796 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9797 | .dac_nids = alc262_dac_nids, | |
9798 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9799 | .channel_mode = alc262_modes, | |
9800 | .input_mux = &alc262_hp_rp5700_capture_source, | |
66d2a9d6 | 9801 | }, |
304dcaac TI |
9802 | [ALC262_BENQ_ED8] = { |
9803 | .mixers = { alc262_base_mixer }, | |
9804 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
9805 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9806 | .dac_nids = alc262_dac_nids, | |
9807 | .hp_nid = 0x03, | |
9808 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9809 | .channel_mode = alc262_modes, | |
9810 | .input_mux = &alc262_capture_source, | |
f12ab1e0 | 9811 | }, |
272a527c KY |
9812 | [ALC262_SONY_ASSAMD] = { |
9813 | .mixers = { alc262_sony_mixer }, | |
9814 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
9815 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9816 | .dac_nids = alc262_dac_nids, | |
9817 | .hp_nid = 0x02, | |
9818 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9819 | .channel_mode = alc262_modes, | |
9820 | .input_mux = &alc262_capture_source, | |
9821 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 9822 | .init_hook = alc262_hippo_automute, |
83c34218 KY |
9823 | }, |
9824 | [ALC262_BENQ_T31] = { | |
9825 | .mixers = { alc262_benq_t31_mixer }, | |
9826 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, | |
9827 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9828 | .dac_nids = alc262_dac_nids, | |
9829 | .hp_nid = 0x03, | |
9830 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9831 | .channel_mode = alc262_modes, | |
9832 | .input_mux = &alc262_capture_source, | |
9833 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 9834 | .init_hook = alc262_hippo_automute, |
272a527c | 9835 | }, |
f651b50b | 9836 | [ALC262_ULTRA] = { |
bb9f76cd TI |
9837 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
9838 | .init_verbs = { alc262_ultra_verbs }, | |
f651b50b TD |
9839 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
9840 | .dac_nids = alc262_dac_nids, | |
f651b50b TD |
9841 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
9842 | .channel_mode = alc262_modes, | |
9843 | .input_mux = &alc262_ultra_capture_source, | |
bb9f76cd TI |
9844 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
9845 | .capsrc_nids = alc262_capsrc_nids, | |
9846 | .num_adc_nids = 1, /* single ADC */ | |
f651b50b TD |
9847 | .unsol_event = alc262_ultra_unsol_event, |
9848 | .init_hook = alc262_ultra_automute, | |
9849 | }, | |
0e31daf7 J |
9850 | [ALC262_LENOVO_3000] = { |
9851 | .mixers = { alc262_lenovo_3000_mixer }, | |
9852 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
9853 | alc262_lenovo_3000_unsol_verbs }, | |
9854 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
9855 | .dac_nids = alc262_dac_nids, | |
9856 | .hp_nid = 0x03, | |
9857 | .dig_out_nid = ALC262_DIGOUT_NID, | |
9858 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
9859 | .channel_mode = alc262_modes, | |
9860 | .input_mux = &alc262_fujitsu_capture_source, | |
9861 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
9862 | }, | |
df694daa KY |
9863 | }; |
9864 | ||
9865 | static int patch_alc262(struct hda_codec *codec) | |
9866 | { | |
9867 | struct alc_spec *spec; | |
9868 | int board_config; | |
9869 | int err; | |
9870 | ||
dc041e0b | 9871 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
9872 | if (spec == NULL) |
9873 | return -ENOMEM; | |
9874 | ||
9875 | codec->spec = spec; | |
9876 | #if 0 | |
f12ab1e0 TI |
9877 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
9878 | * under-run | |
9879 | */ | |
df694daa KY |
9880 | { |
9881 | int tmp; | |
9882 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
9883 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
9884 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
9885 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
9886 | } | |
9887 | #endif | |
9888 | ||
f5fcc13c TI |
9889 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
9890 | alc262_models, | |
9891 | alc262_cfg_tbl); | |
cd7509a4 | 9892 | |
f5fcc13c | 9893 | if (board_config < 0) { |
9c7f852e TI |
9894 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
9895 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
9896 | board_config = ALC262_AUTO; |
9897 | } | |
9898 | ||
9899 | if (board_config == ALC262_AUTO) { | |
9900 | /* automatic parse from the BIOS config */ | |
9901 | err = alc262_parse_auto_config(codec); | |
9902 | if (err < 0) { | |
9903 | alc_free(codec); | |
9904 | return err; | |
f12ab1e0 | 9905 | } else if (!err) { |
9c7f852e TI |
9906 | printk(KERN_INFO |
9907 | "hda_codec: Cannot set up configuration " | |
9908 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
9909 | board_config = ALC262_BASIC; |
9910 | } | |
9911 | } | |
9912 | ||
9913 | if (board_config != ALC262_AUTO) | |
9914 | setup_preset(spec, &alc262_presets[board_config]); | |
9915 | ||
9916 | spec->stream_name_analog = "ALC262 Analog"; | |
9917 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | |
9918 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
9919 | ||
9920 | spec->stream_name_digital = "ALC262 Digital"; | |
9921 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | |
9922 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
9923 | ||
f12ab1e0 | 9924 | if (!spec->adc_nids && spec->input_mux) { |
df694daa | 9925 | /* check whether NID 0x07 is valid */ |
4a471b7d TI |
9926 | unsigned int wcap = get_wcaps(codec, 0x07); |
9927 | ||
f12ab1e0 TI |
9928 | /* get type */ |
9929 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
df694daa KY |
9930 | if (wcap != AC_WID_AUD_IN) { |
9931 | spec->adc_nids = alc262_adc_nids_alt; | |
9932 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); | |
88c71a99 | 9933 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
f12ab1e0 TI |
9934 | spec->mixers[spec->num_mixers] = |
9935 | alc262_capture_alt_mixer; | |
df694daa KY |
9936 | spec->num_mixers++; |
9937 | } else { | |
9938 | spec->adc_nids = alc262_adc_nids; | |
9939 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); | |
88c71a99 | 9940 | spec->capsrc_nids = alc262_capsrc_nids; |
df694daa KY |
9941 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
9942 | spec->num_mixers++; | |
9943 | } | |
9944 | } | |
9945 | ||
2134ea4f TI |
9946 | spec->vmaster_nid = 0x0c; |
9947 | ||
df694daa KY |
9948 | codec->patch_ops = alc_patch_ops; |
9949 | if (board_config == ALC262_AUTO) | |
ae6b813a | 9950 | spec->init_hook = alc262_auto_init; |
cb53c626 TI |
9951 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9952 | if (!spec->loopback.amplist) | |
9953 | spec->loopback.amplist = alc262_loopbacks; | |
9954 | #endif | |
834be88d | 9955 | |
df694daa KY |
9956 | return 0; |
9957 | } | |
9958 | ||
a361d84b KY |
9959 | /* |
9960 | * ALC268 channel source setting (2 channel) | |
9961 | */ | |
9962 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
9963 | #define alc268_modes alc260_modes | |
9964 | ||
9965 | static hda_nid_t alc268_dac_nids[2] = { | |
9966 | /* front, hp */ | |
9967 | 0x02, 0x03 | |
9968 | }; | |
9969 | ||
9970 | static hda_nid_t alc268_adc_nids[2] = { | |
9971 | /* ADC0-1 */ | |
9972 | 0x08, 0x07 | |
9973 | }; | |
9974 | ||
9975 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
9976 | /* ADC0 */ | |
9977 | 0x08 | |
9978 | }; | |
9979 | ||
e1406348 TI |
9980 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
9981 | ||
a361d84b KY |
9982 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
9983 | /* output mixer control */ | |
9984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
9985 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9986 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
9987 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
33bf17ab TI |
9988 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9989 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
9990 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
a361d84b KY |
9991 | { } |
9992 | }; | |
9993 | ||
aef9d318 TI |
9994 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
9995 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
9996 | .ops = &snd_hda_bind_sw, | |
9997 | .values = { | |
9998 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
9999 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
10000 | 0 | |
10001 | }, | |
10002 | }; | |
10003 | ||
10004 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
10005 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
10006 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
10007 | { } | |
10008 | }; | |
10009 | ||
d1a991a6 KY |
10010 | static struct hda_verb alc268_eapd_verbs[] = { |
10011 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
10012 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
10013 | { } | |
10014 | }; | |
10015 | ||
d273809e TI |
10016 | /* Toshiba specific */ |
10017 | #define alc268_toshiba_automute alc262_hippo_automute | |
10018 | ||
10019 | static struct hda_verb alc268_toshiba_verbs[] = { | |
10020 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10021 | { } /* end */ | |
10022 | }; | |
10023 | ||
10024 | /* Acer specific */ | |
889c4395 | 10025 | /* bind volumes of both NID 0x02 and 0x03 */ |
6bc96857 TI |
10026 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
10027 | .ops = &snd_hda_bind_vol, | |
10028 | .values = { | |
10029 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
10030 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
10031 | 0 | |
10032 | }, | |
10033 | }; | |
10034 | ||
889c4395 TI |
10035 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
10036 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
10037 | { | |
10038 | struct alc_spec *spec = codec->spec; | |
10039 | unsigned int mute; | |
10040 | ||
10041 | if (force || !spec->sense_updated) { | |
10042 | unsigned int present; | |
10043 | present = snd_hda_codec_read(codec, 0x14, 0, | |
10044 | AC_VERB_GET_PIN_SENSE, 0); | |
10045 | spec->jack_present = (present & 0x80000000) != 0; | |
10046 | spec->sense_updated = 1; | |
10047 | } | |
10048 | if (spec->jack_present) | |
10049 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
10050 | else /* unmute internal speaker if necessary */ | |
10051 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
10052 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
10053 | HDA_AMP_MUTE, mute); | |
10054 | } | |
10055 | ||
10056 | ||
10057 | /* bind hp and internal speaker mute (with plug check) */ | |
10058 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
10059 | struct snd_ctl_elem_value *ucontrol) | |
10060 | { | |
10061 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10062 | long *valp = ucontrol->value.integer.value; | |
10063 | int change; | |
10064 | ||
10065 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
10066 | HDA_AMP_MUTE, | |
10067 | valp[0] ? 0 : HDA_AMP_MUTE); | |
10068 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
10069 | HDA_AMP_MUTE, | |
10070 | valp[1] ? 0 : HDA_AMP_MUTE); | |
10071 | if (change) | |
10072 | alc268_acer_automute(codec, 0); | |
10073 | return change; | |
10074 | } | |
d273809e TI |
10075 | |
10076 | static struct snd_kcontrol_new alc268_acer_mixer[] = { | |
10077 | /* output mixer control */ | |
10078 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
10079 | { | |
10080 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10081 | .name = "Master Playback Switch", | |
10082 | .info = snd_hda_mixer_amp_switch_info, | |
10083 | .get = snd_hda_mixer_amp_switch_get, | |
10084 | .put = alc268_acer_master_sw_put, | |
10085 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
10086 | }, | |
33bf17ab TI |
10087 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
10088 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
10089 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
d273809e TI |
10090 | { } |
10091 | }; | |
10092 | ||
10093 | static struct hda_verb alc268_acer_verbs[] = { | |
0ccb541c TI |
10094 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
10095 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d273809e TI |
10096 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
10097 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
0ccb541c TI |
10098 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
10099 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
d273809e TI |
10100 | |
10101 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10102 | { } | |
10103 | }; | |
10104 | ||
10105 | /* unsolicited event for HP jack sensing */ | |
10106 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, | |
10107 | unsigned int res) | |
10108 | { | |
889c4395 | 10109 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
10110 | return; |
10111 | alc268_toshiba_automute(codec); | |
10112 | } | |
10113 | ||
10114 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
10115 | unsigned int res) | |
10116 | { | |
889c4395 | 10117 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
10118 | return; |
10119 | alc268_acer_automute(codec, 1); | |
10120 | } | |
10121 | ||
889c4395 TI |
10122 | static void alc268_acer_init_hook(struct hda_codec *codec) |
10123 | { | |
10124 | alc268_acer_automute(codec, 1); | |
10125 | } | |
10126 | ||
3866f0b0 TI |
10127 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
10128 | /* output mixer control */ | |
10129 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
10130 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10131 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
10132 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10133 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10134 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
10135 | { } | |
10136 | }; | |
10137 | ||
10138 | static struct hda_verb alc268_dell_verbs[] = { | |
10139 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10140 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10141 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10142 | { } | |
10143 | }; | |
10144 | ||
10145 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
10146 | static void alc268_dell_automute(struct hda_codec *codec) | |
10147 | { | |
10148 | unsigned int present; | |
10149 | unsigned int mute; | |
10150 | ||
10151 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); | |
10152 | if (present & 0x80000000) | |
10153 | mute = HDA_AMP_MUTE; | |
10154 | else | |
10155 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); | |
10156 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
10157 | HDA_AMP_MUTE, mute); | |
10158 | } | |
10159 | ||
10160 | static void alc268_dell_unsol_event(struct hda_codec *codec, | |
10161 | unsigned int res) | |
10162 | { | |
10163 | if ((res >> 26) != ALC880_HP_EVENT) | |
10164 | return; | |
10165 | alc268_dell_automute(codec); | |
10166 | } | |
10167 | ||
10168 | #define alc268_dell_init_hook alc268_dell_automute | |
10169 | ||
eb5a6621 HRK |
10170 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
10171 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
10172 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10173 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
10174 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10175 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
10176 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
10177 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
10178 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
10179 | { } | |
10180 | }; | |
10181 | ||
10182 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
10183 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10184 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
10185 | { } | |
10186 | }; | |
10187 | ||
10188 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) | |
10189 | { | |
10190 | unsigned int present; | |
10191 | ||
10192 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) | |
10193 | & AC_PINSENSE_PRESENCE; | |
10194 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10195 | present ? 0 : PIN_OUT); | |
10196 | } | |
10197 | ||
10198 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) | |
10199 | { | |
10200 | unsigned int present; | |
10201 | ||
10202 | present = snd_hda_codec_read(codec, 0x18, 0, | |
10203 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
10204 | snd_hda_codec_write(codec, 0x23, 0, | |
10205 | AC_VERB_SET_CONNECT_SEL, | |
10206 | present ? 0x00 : 0x01); | |
10207 | } | |
10208 | ||
10209 | static void alc267_quanta_il1_automute(struct hda_codec *codec) | |
10210 | { | |
10211 | alc267_quanta_il1_hp_automute(codec); | |
10212 | alc267_quanta_il1_mic_automute(codec); | |
10213 | } | |
10214 | ||
10215 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, | |
10216 | unsigned int res) | |
10217 | { | |
10218 | switch (res >> 26) { | |
10219 | case ALC880_HP_EVENT: | |
10220 | alc267_quanta_il1_hp_automute(codec); | |
10221 | break; | |
10222 | case ALC880_MIC_EVENT: | |
10223 | alc267_quanta_il1_mic_automute(codec); | |
10224 | break; | |
10225 | } | |
10226 | } | |
10227 | ||
a361d84b KY |
10228 | /* |
10229 | * generic initialization of ADC, input mixers and output mixers | |
10230 | */ | |
10231 | static struct hda_verb alc268_base_init_verbs[] = { | |
10232 | /* Unmute DAC0-1 and set vol = 0 */ | |
10233 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10234 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10235 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10236 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10237 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10238 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10239 | ||
10240 | /* | |
10241 | * Set up output mixers (0x0c - 0x0e) | |
10242 | */ | |
10243 | /* set vol=0 to output mixers */ | |
10244 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10245 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10246 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10247 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10248 | ||
10249 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10250 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10251 | ||
10252 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
10253 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
10254 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
10255 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10256 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10257 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10258 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10259 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10260 | ||
10261 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10262 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10263 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10264 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10265 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10266 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10267 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
aef9d318 TI |
10268 | |
10269 | /* set PCBEEP vol = 0, mute connections */ | |
10270 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10271 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10272 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b | 10273 | |
a9b3aa8a JZ |
10274 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
10275 | ||
10276 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10277 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
10278 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10279 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
a361d84b | 10280 | |
a361d84b KY |
10281 | { } |
10282 | }; | |
10283 | ||
10284 | /* | |
10285 | * generic initialization of ADC, input mixers and output mixers | |
10286 | */ | |
10287 | static struct hda_verb alc268_volume_init_verbs[] = { | |
10288 | /* set output DAC */ | |
10289 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10290 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10291 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10292 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10293 | ||
10294 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10295 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10296 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10297 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10298 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10299 | ||
10300 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10301 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10302 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10303 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10304 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10305 | ||
10306 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10307 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10308 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10309 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10310 | ||
aef9d318 TI |
10311 | /* set PCBEEP vol = 0, mute connections */ |
10312 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10313 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10314 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b KY |
10315 | |
10316 | { } | |
10317 | }; | |
10318 | ||
10319 | #define alc268_mux_enum_info alc_mux_enum_info | |
10320 | #define alc268_mux_enum_get alc_mux_enum_get | |
e1406348 | 10321 | #define alc268_mux_enum_put alc_mux_enum_put |
a361d84b KY |
10322 | |
10323 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | |
10324 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
10325 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
10326 | { | |
10327 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10328 | /* The multiple "Capture Source" controls confuse alsamixer | |
10329 | * So call somewhat different.. | |
a361d84b KY |
10330 | */ |
10331 | /* .name = "Capture Source", */ | |
10332 | .name = "Input Source", | |
10333 | .count = 1, | |
10334 | .info = alc268_mux_enum_info, | |
10335 | .get = alc268_mux_enum_get, | |
10336 | .put = alc268_mux_enum_put, | |
10337 | }, | |
10338 | { } /* end */ | |
10339 | }; | |
10340 | ||
10341 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
10342 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
10343 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
10344 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
10345 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
10346 | { | |
10347 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10348 | /* The multiple "Capture Source" controls confuse alsamixer | |
10349 | * So call somewhat different.. | |
a361d84b KY |
10350 | */ |
10351 | /* .name = "Capture Source", */ | |
10352 | .name = "Input Source", | |
10353 | .count = 2, | |
10354 | .info = alc268_mux_enum_info, | |
10355 | .get = alc268_mux_enum_get, | |
10356 | .put = alc268_mux_enum_put, | |
10357 | }, | |
10358 | { } /* end */ | |
10359 | }; | |
10360 | ||
10361 | static struct hda_input_mux alc268_capture_source = { | |
10362 | .num_items = 4, | |
10363 | .items = { | |
10364 | { "Mic", 0x0 }, | |
10365 | { "Front Mic", 0x1 }, | |
10366 | { "Line", 0x2 }, | |
10367 | { "CD", 0x3 }, | |
10368 | }, | |
10369 | }; | |
10370 | ||
0ccb541c TI |
10371 | static struct hda_input_mux alc268_acer_capture_source = { |
10372 | .num_items = 3, | |
10373 | .items = { | |
10374 | { "Mic", 0x0 }, | |
10375 | { "Internal Mic", 0x6 }, | |
10376 | { "Line", 0x2 }, | |
10377 | }, | |
10378 | }; | |
10379 | ||
86c53bd2 JW |
10380 | #ifdef CONFIG_SND_DEBUG |
10381 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
86c53bd2 JW |
10382 | /* Volume widgets */ |
10383 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
10384 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
10385 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
10386 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
10387 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
10388 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
10389 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
10390 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
10391 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
10392 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
10393 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
10394 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
10395 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
f0747ee6 TI |
10396 | /* The below appears problematic on some hardwares */ |
10397 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
86c53bd2 JW |
10398 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
10399 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
10400 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
10401 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
10402 | ||
10403 | /* Modes for retasking pin widgets */ | |
10404 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
10405 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
10406 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
10407 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
10408 | ||
10409 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
10410 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
10411 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
10412 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
10413 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
10414 | ||
10415 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
10416 | * The ALC268 does not have an SPDIF input. | |
10417 | */ | |
10418 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
10419 | ||
10420 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
10421 | * this output to turn on an external amplifier. | |
10422 | */ | |
10423 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
10424 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
10425 | ||
10426 | { } /* end */ | |
10427 | }; | |
10428 | #endif | |
10429 | ||
a361d84b KY |
10430 | /* create input playback/capture controls for the given pin */ |
10431 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
10432 | const char *ctlname, int idx) | |
10433 | { | |
10434 | char name[32]; | |
10435 | int err; | |
10436 | ||
10437 | sprintf(name, "%s Playback Volume", ctlname); | |
10438 | if (nid == 0x14) { | |
10439 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
10440 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, | |
10441 | HDA_OUTPUT)); | |
10442 | if (err < 0) | |
10443 | return err; | |
10444 | } else if (nid == 0x15) { | |
10445 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
10446 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, | |
10447 | HDA_OUTPUT)); | |
10448 | if (err < 0) | |
10449 | return err; | |
10450 | } else | |
10451 | return -1; | |
10452 | sprintf(name, "%s Playback Switch", ctlname); | |
10453 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
10454 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
10455 | if (err < 0) | |
10456 | return err; | |
10457 | return 0; | |
10458 | } | |
10459 | ||
10460 | /* add playback controls from the parsed DAC table */ | |
10461 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
10462 | const struct auto_pin_cfg *cfg) | |
10463 | { | |
10464 | hda_nid_t nid; | |
10465 | int err; | |
10466 | ||
10467 | spec->multiout.num_dacs = 2; /* only use one dac */ | |
10468 | spec->multiout.dac_nids = spec->private_dac_nids; | |
10469 | spec->multiout.dac_nids[0] = 2; | |
10470 | spec->multiout.dac_nids[1] = 3; | |
10471 | ||
10472 | nid = cfg->line_out_pins[0]; | |
10473 | if (nid) | |
10474 | alc268_new_analog_output(spec, nid, "Front", 0); | |
10475 | ||
10476 | nid = cfg->speaker_pins[0]; | |
10477 | if (nid == 0x1d) { | |
10478 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
10479 | "Speaker Playback Volume", | |
10480 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
10481 | if (err < 0) | |
10482 | return err; | |
10483 | } | |
10484 | nid = cfg->hp_pins[0]; | |
10485 | if (nid) | |
10486 | alc268_new_analog_output(spec, nid, "Headphone", 0); | |
10487 | ||
10488 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
10489 | if (nid == 0x16) { | |
10490 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
10491 | "Mono Playback Switch", | |
10492 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); | |
10493 | if (err < 0) | |
10494 | return err; | |
10495 | } | |
10496 | return 0; | |
10497 | } | |
10498 | ||
10499 | /* create playback/capture controls for input pins */ | |
10500 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | |
10501 | const struct auto_pin_cfg *cfg) | |
10502 | { | |
10503 | struct hda_input_mux *imux = &spec->private_imux; | |
10504 | int i, idx1; | |
10505 | ||
10506 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
10507 | switch(cfg->input_pins[i]) { | |
10508 | case 0x18: | |
10509 | idx1 = 0; /* Mic 1 */ | |
10510 | break; | |
10511 | case 0x19: | |
10512 | idx1 = 1; /* Mic 2 */ | |
10513 | break; | |
10514 | case 0x1a: | |
10515 | idx1 = 2; /* Line In */ | |
10516 | break; | |
10517 | case 0x1c: | |
10518 | idx1 = 3; /* CD */ | |
10519 | break; | |
7194cae6 TI |
10520 | case 0x12: |
10521 | case 0x13: | |
10522 | idx1 = 6; /* digital mics */ | |
10523 | break; | |
a361d84b KY |
10524 | default: |
10525 | continue; | |
10526 | } | |
10527 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | |
10528 | imux->items[imux->num_items].index = idx1; | |
10529 | imux->num_items++; | |
10530 | } | |
10531 | return 0; | |
10532 | } | |
10533 | ||
10534 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |
10535 | { | |
10536 | struct alc_spec *spec = codec->spec; | |
10537 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
10538 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
10539 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
10540 | unsigned int dac_vol1, dac_vol2; | |
10541 | ||
10542 | if (speaker_nid) { | |
10543 | snd_hda_codec_write(codec, speaker_nid, 0, | |
10544 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
10545 | snd_hda_codec_write(codec, 0x0f, 0, | |
10546 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10547 | AMP_IN_UNMUTE(1)); | |
10548 | snd_hda_codec_write(codec, 0x10, 0, | |
10549 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10550 | AMP_IN_UNMUTE(1)); | |
10551 | } else { | |
10552 | snd_hda_codec_write(codec, 0x0f, 0, | |
10553 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
10554 | snd_hda_codec_write(codec, 0x10, 0, | |
10555 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
10556 | } | |
10557 | ||
10558 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
10559 | if (line_nid == 0x14) | |
10560 | dac_vol2 = AMP_OUT_ZERO; | |
10561 | else if (line_nid == 0x15) | |
10562 | dac_vol1 = AMP_OUT_ZERO; | |
10563 | if (hp_nid == 0x14) | |
10564 | dac_vol2 = AMP_OUT_ZERO; | |
10565 | else if (hp_nid == 0x15) | |
10566 | dac_vol1 = AMP_OUT_ZERO; | |
10567 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
10568 | spec->autocfg.line_out_pins[1] != 0x16 || | |
10569 | spec->autocfg.line_out_pins[2] != 0x16) | |
10570 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
10571 | ||
10572 | snd_hda_codec_write(codec, 0x02, 0, | |
10573 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
10574 | snd_hda_codec_write(codec, 0x03, 0, | |
10575 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
10576 | } | |
10577 | ||
10578 | /* pcm configuration: identiacal with ALC880 */ | |
10579 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback | |
10580 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 10581 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
a361d84b KY |
10582 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
10583 | ||
10584 | /* | |
10585 | * BIOS auto configuration | |
10586 | */ | |
10587 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
10588 | { | |
10589 | struct alc_spec *spec = codec->spec; | |
10590 | int err; | |
10591 | static hda_nid_t alc268_ignore[] = { 0 }; | |
10592 | ||
10593 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
10594 | alc268_ignore); | |
10595 | if (err < 0) | |
10596 | return err; | |
10597 | if (!spec->autocfg.line_outs) | |
10598 | return 0; /* can't find valid BIOS pin config */ | |
10599 | ||
10600 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
10601 | if (err < 0) | |
10602 | return err; | |
10603 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
10604 | if (err < 0) | |
10605 | return err; | |
10606 | ||
10607 | spec->multiout.max_channels = 2; | |
10608 | ||
10609 | /* digital only support output */ | |
10610 | if (spec->autocfg.dig_out_pin) | |
10611 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; | |
10612 | ||
10613 | if (spec->kctl_alloc) | |
10614 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
10615 | ||
aef9d318 TI |
10616 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
10617 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; | |
10618 | ||
a361d84b KY |
10619 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
10620 | spec->num_mux_defs = 1; | |
10621 | spec->input_mux = &spec->private_imux; | |
10622 | ||
776e184e TI |
10623 | err = alc_auto_add_mic_boost(codec); |
10624 | if (err < 0) | |
10625 | return err; | |
10626 | ||
a361d84b KY |
10627 | return 1; |
10628 | } | |
10629 | ||
10630 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out | |
10631 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out | |
10632 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | |
10633 | ||
10634 | /* init callback for auto-configuration model -- overriding the default init */ | |
10635 | static void alc268_auto_init(struct hda_codec *codec) | |
10636 | { | |
f6c7e546 | 10637 | struct alc_spec *spec = codec->spec; |
a361d84b KY |
10638 | alc268_auto_init_multi_out(codec); |
10639 | alc268_auto_init_hp_out(codec); | |
10640 | alc268_auto_init_mono_speaker_out(codec); | |
10641 | alc268_auto_init_analog_input(codec); | |
f6c7e546 TI |
10642 | if (spec->unsol_event) |
10643 | alc_sku_automute(codec); | |
a361d84b KY |
10644 | } |
10645 | ||
10646 | /* | |
10647 | * configuration and preset | |
10648 | */ | |
10649 | static const char *alc268_models[ALC268_MODEL_LAST] = { | |
eb5a6621 | 10650 | [ALC267_QUANTA_IL1] = "quanta-il1", |
a361d84b | 10651 | [ALC268_3ST] = "3stack", |
983f8ae4 | 10652 | [ALC268_TOSHIBA] = "toshiba", |
d273809e | 10653 | [ALC268_ACER] = "acer", |
3866f0b0 | 10654 | [ALC268_DELL] = "dell", |
f12462c5 | 10655 | [ALC268_ZEPTO] = "zepto", |
86c53bd2 JW |
10656 | #ifdef CONFIG_SND_DEBUG |
10657 | [ALC268_TEST] = "test", | |
10658 | #endif | |
a361d84b KY |
10659 | [ALC268_AUTO] = "auto", |
10660 | }; | |
10661 | ||
10662 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
a0b8f7d8 | 10663 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
ac3e3741 | 10664 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
dafc8357 | 10665 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
ac3e3741 | 10666 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
29a52c24 | 10667 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
3866f0b0 | 10668 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
ac3e3741 | 10669 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
a361d84b | 10670 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
d1a991a6 | 10671 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
8e7f00f9 | 10672 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
378bd6a5 | 10673 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
b875bf3a | 10674 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
eb5a6621 | 10675 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
f12462c5 | 10676 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
a361d84b KY |
10677 | {} |
10678 | }; | |
10679 | ||
10680 | static struct alc_config_preset alc268_presets[] = { | |
eb5a6621 HRK |
10681 | [ALC267_QUANTA_IL1] = { |
10682 | .mixers = { alc267_quanta_il1_mixer }, | |
10683 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
10684 | alc267_quanta_il1_verbs }, | |
10685 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
10686 | .dac_nids = alc268_dac_nids, | |
10687 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
10688 | .adc_nids = alc268_adc_nids_alt, | |
10689 | .hp_nid = 0x03, | |
10690 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
10691 | .channel_mode = alc268_modes, | |
10692 | .input_mux = &alc268_capture_source, | |
10693 | .unsol_event = alc267_quanta_il1_unsol_event, | |
10694 | .init_hook = alc267_quanta_il1_automute, | |
10695 | }, | |
a361d84b | 10696 | [ALC268_3ST] = { |
aef9d318 TI |
10697 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
10698 | alc268_beep_mixer }, | |
a361d84b KY |
10699 | .init_verbs = { alc268_base_init_verbs }, |
10700 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
10701 | .dac_nids = alc268_dac_nids, | |
10702 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
10703 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 10704 | .capsrc_nids = alc268_capsrc_nids, |
a361d84b KY |
10705 | .hp_nid = 0x03, |
10706 | .dig_out_nid = ALC268_DIGOUT_NID, | |
10707 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
10708 | .channel_mode = alc268_modes, | |
10709 | .input_mux = &alc268_capture_source, | |
10710 | }, | |
d1a991a6 | 10711 | [ALC268_TOSHIBA] = { |
aef9d318 TI |
10712 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
10713 | alc268_beep_mixer }, | |
d273809e TI |
10714 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
10715 | alc268_toshiba_verbs }, | |
d1a991a6 KY |
10716 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
10717 | .dac_nids = alc268_dac_nids, | |
10718 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
10719 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 10720 | .capsrc_nids = alc268_capsrc_nids, |
d1a991a6 KY |
10721 | .hp_nid = 0x03, |
10722 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
10723 | .channel_mode = alc268_modes, | |
10724 | .input_mux = &alc268_capture_source, | |
d273809e TI |
10725 | .unsol_event = alc268_toshiba_unsol_event, |
10726 | .init_hook = alc268_toshiba_automute, | |
10727 | }, | |
10728 | [ALC268_ACER] = { | |
aef9d318 TI |
10729 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
10730 | alc268_beep_mixer }, | |
d273809e TI |
10731 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
10732 | alc268_acer_verbs }, | |
10733 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
10734 | .dac_nids = alc268_dac_nids, | |
10735 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
10736 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 10737 | .capsrc_nids = alc268_capsrc_nids, |
d273809e TI |
10738 | .hp_nid = 0x02, |
10739 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
10740 | .channel_mode = alc268_modes, | |
0ccb541c | 10741 | .input_mux = &alc268_acer_capture_source, |
d273809e | 10742 | .unsol_event = alc268_acer_unsol_event, |
889c4395 | 10743 | .init_hook = alc268_acer_init_hook, |
d1a991a6 | 10744 | }, |
3866f0b0 | 10745 | [ALC268_DELL] = { |
aef9d318 | 10746 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
3866f0b0 TI |
10747 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
10748 | alc268_dell_verbs }, | |
10749 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
10750 | .dac_nids = alc268_dac_nids, | |
10751 | .hp_nid = 0x02, | |
10752 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
10753 | .channel_mode = alc268_modes, | |
10754 | .unsol_event = alc268_dell_unsol_event, | |
10755 | .init_hook = alc268_dell_init_hook, | |
10756 | .input_mux = &alc268_capture_source, | |
10757 | }, | |
f12462c5 | 10758 | [ALC268_ZEPTO] = { |
aef9d318 TI |
10759 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
10760 | alc268_beep_mixer }, | |
f12462c5 MT |
10761 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
10762 | alc268_toshiba_verbs }, | |
10763 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
10764 | .dac_nids = alc268_dac_nids, | |
10765 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
10766 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 10767 | .capsrc_nids = alc268_capsrc_nids, |
f12462c5 MT |
10768 | .hp_nid = 0x03, |
10769 | .dig_out_nid = ALC268_DIGOUT_NID, | |
10770 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
10771 | .channel_mode = alc268_modes, | |
10772 | .input_mux = &alc268_capture_source, | |
10773 | .unsol_event = alc268_toshiba_unsol_event, | |
10774 | .init_hook = alc268_toshiba_automute | |
10775 | }, | |
86c53bd2 JW |
10776 | #ifdef CONFIG_SND_DEBUG |
10777 | [ALC268_TEST] = { | |
10778 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
10779 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
10780 | alc268_volume_init_verbs }, | |
10781 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
10782 | .dac_nids = alc268_dac_nids, | |
10783 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
10784 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 10785 | .capsrc_nids = alc268_capsrc_nids, |
86c53bd2 JW |
10786 | .hp_nid = 0x03, |
10787 | .dig_out_nid = ALC268_DIGOUT_NID, | |
10788 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
10789 | .channel_mode = alc268_modes, | |
10790 | .input_mux = &alc268_capture_source, | |
10791 | }, | |
10792 | #endif | |
a361d84b KY |
10793 | }; |
10794 | ||
10795 | static int patch_alc268(struct hda_codec *codec) | |
10796 | { | |
10797 | struct alc_spec *spec; | |
10798 | int board_config; | |
10799 | int err; | |
10800 | ||
10801 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | |
10802 | if (spec == NULL) | |
10803 | return -ENOMEM; | |
10804 | ||
10805 | codec->spec = spec; | |
10806 | ||
10807 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
10808 | alc268_models, | |
10809 | alc268_cfg_tbl); | |
10810 | ||
10811 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | |
10812 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " | |
10813 | "trying auto-probe from BIOS...\n"); | |
10814 | board_config = ALC268_AUTO; | |
10815 | } | |
10816 | ||
10817 | if (board_config == ALC268_AUTO) { | |
10818 | /* automatic parse from the BIOS config */ | |
10819 | err = alc268_parse_auto_config(codec); | |
10820 | if (err < 0) { | |
10821 | alc_free(codec); | |
10822 | return err; | |
10823 | } else if (!err) { | |
10824 | printk(KERN_INFO | |
10825 | "hda_codec: Cannot set up configuration " | |
10826 | "from BIOS. Using base mode...\n"); | |
10827 | board_config = ALC268_3ST; | |
10828 | } | |
10829 | } | |
10830 | ||
10831 | if (board_config != ALC268_AUTO) | |
10832 | setup_preset(spec, &alc268_presets[board_config]); | |
10833 | ||
2f893286 KY |
10834 | if (codec->vendor_id == 0x10ec0267) { |
10835 | spec->stream_name_analog = "ALC267 Analog"; | |
10836 | spec->stream_name_digital = "ALC267 Digital"; | |
10837 | } else { | |
10838 | spec->stream_name_analog = "ALC268 Analog"; | |
10839 | spec->stream_name_digital = "ALC268 Digital"; | |
10840 | } | |
10841 | ||
a361d84b KY |
10842 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
10843 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
6330079f | 10844 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
a361d84b | 10845 | |
a361d84b KY |
10846 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
10847 | ||
aef9d318 TI |
10848 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
10849 | /* override the amp caps for beep generator */ | |
10850 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
10851 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | |
10852 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
10853 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
10854 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
10855 | ||
3866f0b0 TI |
10856 | if (!spec->adc_nids && spec->input_mux) { |
10857 | /* check whether NID 0x07 is valid */ | |
10858 | unsigned int wcap = get_wcaps(codec, 0x07); | |
85860c06 | 10859 | int i; |
3866f0b0 TI |
10860 | |
10861 | /* get type */ | |
10862 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
67ebcb03 | 10863 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
3866f0b0 TI |
10864 | spec->adc_nids = alc268_adc_nids_alt; |
10865 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
10866 | spec->mixers[spec->num_mixers] = | |
a361d84b | 10867 | alc268_capture_alt_mixer; |
3866f0b0 TI |
10868 | spec->num_mixers++; |
10869 | } else { | |
10870 | spec->adc_nids = alc268_adc_nids; | |
10871 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
10872 | spec->mixers[spec->num_mixers] = | |
10873 | alc268_capture_mixer; | |
10874 | spec->num_mixers++; | |
a361d84b | 10875 | } |
e1406348 | 10876 | spec->capsrc_nids = alc268_capsrc_nids; |
85860c06 TI |
10877 | /* set default input source */ |
10878 | for (i = 0; i < spec->num_adc_nids; i++) | |
10879 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
10880 | 0, AC_VERB_SET_CONNECT_SEL, | |
10881 | spec->input_mux->items[0].index); | |
a361d84b | 10882 | } |
2134ea4f TI |
10883 | |
10884 | spec->vmaster_nid = 0x02; | |
10885 | ||
a361d84b KY |
10886 | codec->patch_ops = alc_patch_ops; |
10887 | if (board_config == ALC268_AUTO) | |
10888 | spec->init_hook = alc268_auto_init; | |
10889 | ||
10890 | return 0; | |
10891 | } | |
10892 | ||
f6a92248 KY |
10893 | /* |
10894 | * ALC269 channel source setting (2 channel) | |
10895 | */ | |
10896 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
10897 | ||
10898 | #define alc269_dac_nids alc260_dac_nids | |
10899 | ||
10900 | static hda_nid_t alc269_adc_nids[1] = { | |
10901 | /* ADC1 */ | |
10902 | 0x07, | |
10903 | }; | |
10904 | ||
10905 | #define alc269_modes alc260_modes | |
10906 | #define alc269_capture_source alc880_lg_lw_capture_source | |
10907 | ||
10908 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
10909 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
10910 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10911 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10912 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10913 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10914 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
10915 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10916 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
10917 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
10918 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10919 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10920 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
10921 | { } /* end */ | |
10922 | }; | |
10923 | ||
10924 | /* capture mixer elements */ | |
10925 | static struct snd_kcontrol_new alc269_capture_mixer[] = { | |
10926 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
10927 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
10928 | { | |
10929 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10930 | /* The multiple "Capture Source" controls confuse alsamixer | |
10931 | * So call somewhat different.. | |
f6a92248 KY |
10932 | */ |
10933 | /* .name = "Capture Source", */ | |
10934 | .name = "Input Source", | |
10935 | .count = 1, | |
10936 | .info = alc_mux_enum_info, | |
10937 | .get = alc_mux_enum_get, | |
10938 | .put = alc_mux_enum_put, | |
10939 | }, | |
10940 | { } /* end */ | |
10941 | }; | |
10942 | ||
10943 | /* | |
10944 | * generic initialization of ADC, input mixers and output mixers | |
10945 | */ | |
10946 | static struct hda_verb alc269_init_verbs[] = { | |
10947 | /* | |
10948 | * Unmute ADC0 and set the default input to mic-in | |
10949 | */ | |
10950 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10951 | ||
10952 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the | |
10953 | * analog-loopback mixer widget | |
10954 | * Note: PASD motherboards uses the Line In 2 as the input for | |
10955 | * front panel mic (mic 2) | |
10956 | */ | |
10957 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
10958 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
10959 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10960 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
10961 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
10962 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
10963 | ||
10964 | /* | |
10965 | * Set up output mixers (0x0c - 0x0e) | |
10966 | */ | |
10967 | /* set vol=0 to output mixers */ | |
10968 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10969 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10970 | ||
10971 | /* set up input amps for analog loopback */ | |
10972 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
10973 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10974 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10975 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10976 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10977 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10978 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10979 | ||
10980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
10981 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10982 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
10983 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
10984 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
10985 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
10986 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
10987 | ||
10988 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
10989 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
10990 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10991 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10992 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10993 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10994 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10995 | ||
10996 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10997 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10998 | ||
10999 | /* FIXME: use matrix-type input source selection */ | |
11000 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
11001 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11002 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11003 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11004 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11005 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11006 | ||
11007 | /* set EAPD */ | |
11008 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11009 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11010 | { } | |
11011 | }; | |
11012 | ||
11013 | /* add playback controls from the parsed DAC table */ | |
11014 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | |
11015 | const struct auto_pin_cfg *cfg) | |
11016 | { | |
11017 | hda_nid_t nid; | |
11018 | int err; | |
11019 | ||
11020 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
11021 | spec->multiout.dac_nids = spec->private_dac_nids; | |
11022 | spec->multiout.dac_nids[0] = 2; | |
11023 | ||
11024 | nid = cfg->line_out_pins[0]; | |
11025 | if (nid) { | |
11026 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
11027 | "Front Playback Volume", | |
11028 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); | |
11029 | if (err < 0) | |
11030 | return err; | |
11031 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
11032 | "Front Playback Switch", | |
11033 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
11034 | if (err < 0) | |
11035 | return err; | |
11036 | } | |
11037 | ||
11038 | nid = cfg->speaker_pins[0]; | |
11039 | if (nid) { | |
11040 | if (!cfg->line_out_pins[0]) { | |
11041 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
11042 | "Speaker Playback Volume", | |
11043 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | |
11044 | HDA_OUTPUT)); | |
11045 | if (err < 0) | |
11046 | return err; | |
11047 | } | |
11048 | if (nid == 0x16) { | |
11049 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
11050 | "Speaker Playback Switch", | |
11051 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
11052 | HDA_OUTPUT)); | |
11053 | if (err < 0) | |
11054 | return err; | |
11055 | } else { | |
11056 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
11057 | "Speaker Playback Switch", | |
11058 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
11059 | HDA_OUTPUT)); | |
11060 | if (err < 0) | |
11061 | return err; | |
11062 | } | |
11063 | } | |
11064 | nid = cfg->hp_pins[0]; | |
11065 | if (nid) { | |
11066 | /* spec->multiout.hp_nid = 2; */ | |
11067 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { | |
11068 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
11069 | "Headphone Playback Volume", | |
11070 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | |
11071 | HDA_OUTPUT)); | |
11072 | if (err < 0) | |
11073 | return err; | |
11074 | } | |
11075 | if (nid == 0x16) { | |
11076 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
11077 | "Headphone Playback Switch", | |
11078 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
11079 | HDA_OUTPUT)); | |
11080 | if (err < 0) | |
11081 | return err; | |
11082 | } else { | |
11083 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
11084 | "Headphone Playback Switch", | |
11085 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
11086 | HDA_OUTPUT)); | |
11087 | if (err < 0) | |
11088 | return err; | |
11089 | } | |
11090 | } | |
11091 | return 0; | |
11092 | } | |
11093 | ||
11094 | #define alc269_auto_create_analog_input_ctls \ | |
11095 | alc880_auto_create_analog_input_ctls | |
11096 | ||
11097 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
11098 | #define alc269_loopbacks alc880_loopbacks | |
11099 | #endif | |
11100 | ||
11101 | /* pcm configuration: identiacal with ALC880 */ | |
11102 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback | |
11103 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
11104 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
11105 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
11106 | ||
11107 | /* | |
11108 | * BIOS auto configuration | |
11109 | */ | |
11110 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
11111 | { | |
11112 | struct alc_spec *spec = codec->spec; | |
11113 | int err; | |
11114 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | |
11115 | ||
11116 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
11117 | alc269_ignore); | |
11118 | if (err < 0) | |
11119 | return err; | |
11120 | ||
11121 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
11122 | if (err < 0) | |
11123 | return err; | |
11124 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
11125 | if (err < 0) | |
11126 | return err; | |
11127 | ||
11128 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
11129 | ||
11130 | if (spec->autocfg.dig_out_pin) | |
11131 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; | |
11132 | ||
11133 | if (spec->kctl_alloc) | |
11134 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
11135 | ||
11136 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; | |
11137 | spec->num_mux_defs = 1; | |
11138 | spec->input_mux = &spec->private_imux; | |
11139 | ||
11140 | err = alc_auto_add_mic_boost(codec); | |
11141 | if (err < 0) | |
11142 | return err; | |
11143 | ||
11144 | return 1; | |
11145 | } | |
11146 | ||
11147 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out | |
11148 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out | |
11149 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | |
11150 | ||
11151 | ||
11152 | /* init callback for auto-configuration model -- overriding the default init */ | |
11153 | static void alc269_auto_init(struct hda_codec *codec) | |
11154 | { | |
f6c7e546 | 11155 | struct alc_spec *spec = codec->spec; |
f6a92248 KY |
11156 | alc269_auto_init_multi_out(codec); |
11157 | alc269_auto_init_hp_out(codec); | |
11158 | alc269_auto_init_analog_input(codec); | |
f6c7e546 TI |
11159 | if (spec->unsol_event) |
11160 | alc_sku_automute(codec); | |
f6a92248 KY |
11161 | } |
11162 | ||
11163 | /* | |
11164 | * configuration and preset | |
11165 | */ | |
11166 | static const char *alc269_models[ALC269_MODEL_LAST] = { | |
11167 | [ALC269_BASIC] = "basic", | |
11168 | }; | |
11169 | ||
11170 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
11171 | {} | |
11172 | }; | |
11173 | ||
11174 | static struct alc_config_preset alc269_presets[] = { | |
11175 | [ALC269_BASIC] = { | |
11176 | .mixers = { alc269_base_mixer }, | |
11177 | .init_verbs = { alc269_init_verbs }, | |
11178 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
11179 | .dac_nids = alc269_dac_nids, | |
11180 | .hp_nid = 0x03, | |
11181 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
11182 | .channel_mode = alc269_modes, | |
11183 | .input_mux = &alc269_capture_source, | |
11184 | }, | |
11185 | }; | |
11186 | ||
11187 | static int patch_alc269(struct hda_codec *codec) | |
11188 | { | |
11189 | struct alc_spec *spec; | |
11190 | int board_config; | |
11191 | int err; | |
11192 | ||
11193 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
11194 | if (spec == NULL) | |
11195 | return -ENOMEM; | |
11196 | ||
11197 | codec->spec = spec; | |
11198 | ||
11199 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, | |
11200 | alc269_models, | |
11201 | alc269_cfg_tbl); | |
11202 | ||
11203 | if (board_config < 0) { | |
11204 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " | |
11205 | "trying auto-probe from BIOS...\n"); | |
11206 | board_config = ALC269_AUTO; | |
11207 | } | |
11208 | ||
11209 | if (board_config == ALC269_AUTO) { | |
11210 | /* automatic parse from the BIOS config */ | |
11211 | err = alc269_parse_auto_config(codec); | |
11212 | if (err < 0) { | |
11213 | alc_free(codec); | |
11214 | return err; | |
11215 | } else if (!err) { | |
11216 | printk(KERN_INFO | |
11217 | "hda_codec: Cannot set up configuration " | |
11218 | "from BIOS. Using base mode...\n"); | |
11219 | board_config = ALC269_BASIC; | |
11220 | } | |
11221 | } | |
11222 | ||
11223 | if (board_config != ALC269_AUTO) | |
11224 | setup_preset(spec, &alc269_presets[board_config]); | |
11225 | ||
11226 | spec->stream_name_analog = "ALC269 Analog"; | |
11227 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
11228 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
11229 | ||
11230 | spec->stream_name_digital = "ALC269 Digital"; | |
11231 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | |
11232 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
11233 | ||
11234 | spec->adc_nids = alc269_adc_nids; | |
11235 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
11236 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; | |
11237 | spec->num_mixers++; | |
11238 | ||
11239 | codec->patch_ops = alc_patch_ops; | |
11240 | if (board_config == ALC269_AUTO) | |
11241 | spec->init_hook = alc269_auto_init; | |
11242 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
11243 | if (!spec->loopback.amplist) | |
11244 | spec->loopback.amplist = alc269_loopbacks; | |
11245 | #endif | |
11246 | ||
11247 | return 0; | |
11248 | } | |
11249 | ||
df694daa KY |
11250 | /* |
11251 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
11252 | */ | |
11253 | ||
11254 | /* | |
11255 | * set the path ways for 2 channel output | |
11256 | * need to set the codec line out and mic 1 pin widgets to inputs | |
11257 | */ | |
11258 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
11259 | /* set pin widget 1Ah (line in) for input */ | |
11260 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
11261 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
11262 | * the vref | |
11263 | */ | |
df694daa KY |
11264 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
11265 | ||
9c7f852e TI |
11266 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
11267 | #if 0 | |
11268 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
11269 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
11270 | #endif | |
df694daa KY |
11271 | { } /* end */ |
11272 | }; | |
11273 | /* | |
11274 | * 6ch mode | |
11275 | * need to set the codec line out and mic 1 pin widgets to outputs | |
11276 | */ | |
11277 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
11278 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
11279 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11280 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
11281 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11282 | ||
11283 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
9c7f852e | 11284 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa | 11285 | |
9c7f852e TI |
11286 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
11287 | #if 0 | |
11288 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
11289 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
11290 | #endif | |
df694daa KY |
11291 | { } /* end */ |
11292 | }; | |
11293 | ||
11294 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
11295 | { 2, alc861_threestack_ch2_init }, | |
11296 | { 6, alc861_threestack_ch6_init }, | |
11297 | }; | |
22309c3e TI |
11298 | /* Set mic1 as input and unmute the mixer */ |
11299 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
11300 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11301 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
11302 | { } /* end */ | |
11303 | }; | |
11304 | /* Set mic1 as output and mute mixer */ | |
11305 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
11306 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11307 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
11308 | { } /* end */ | |
11309 | }; | |
11310 | ||
11311 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
11312 | { 2, alc861_uniwill_m31_ch2_init }, | |
11313 | { 4, alc861_uniwill_m31_ch4_init }, | |
11314 | }; | |
df694daa | 11315 | |
7cdbff94 MD |
11316 | /* Set mic1 and line-in as input and unmute the mixer */ |
11317 | static struct hda_verb alc861_asus_ch2_init[] = { | |
11318 | /* set pin widget 1Ah (line in) for input */ | |
11319 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
11320 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
11321 | * the vref | |
11322 | */ | |
7cdbff94 MD |
11323 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
11324 | ||
11325 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
11326 | #if 0 | |
11327 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
11328 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
11329 | #endif | |
11330 | { } /* end */ | |
11331 | }; | |
11332 | /* Set mic1 nad line-in as output and mute mixer */ | |
11333 | static struct hda_verb alc861_asus_ch6_init[] = { | |
11334 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
11335 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11336 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
11337 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
11338 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11339 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
11340 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11341 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11342 | ||
11343 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
11344 | #if 0 | |
11345 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
11346 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
11347 | #endif | |
11348 | { } /* end */ | |
11349 | }; | |
11350 | ||
11351 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
11352 | { 2, alc861_asus_ch2_init }, | |
11353 | { 6, alc861_asus_ch6_init }, | |
11354 | }; | |
11355 | ||
df694daa KY |
11356 | /* patch-ALC861 */ |
11357 | ||
11358 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
11359 | /* output mixer control */ | |
11360 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
11361 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
11362 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
11363 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
11364 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
11365 | ||
11366 | /*Input mixer control */ | |
11367 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
11368 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
11369 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
11370 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
11371 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
11372 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
11373 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
11374 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
11375 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
11376 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 11377 | |
df694daa KY |
11378 | /* Capture mixer control */ |
11379 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
11380 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
11381 | { | |
11382 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11383 | .name = "Capture Source", | |
11384 | .count = 1, | |
11385 | .info = alc_mux_enum_info, | |
11386 | .get = alc_mux_enum_get, | |
11387 | .put = alc_mux_enum_put, | |
11388 | }, | |
11389 | { } /* end */ | |
11390 | }; | |
11391 | ||
11392 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
11393 | /* output mixer control */ | |
11394 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
11395 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
11396 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
11397 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
11398 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
11399 | ||
11400 | /* Input mixer control */ | |
11401 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
11402 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
11403 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
11404 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
11405 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
11406 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
11407 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
11408 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
11409 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
11410 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 11411 | |
df694daa KY |
11412 | /* Capture mixer control */ |
11413 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
11414 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
11415 | { | |
11416 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11417 | .name = "Capture Source", | |
11418 | .count = 1, | |
11419 | .info = alc_mux_enum_info, | |
11420 | .get = alc_mux_enum_get, | |
11421 | .put = alc_mux_enum_put, | |
11422 | }, | |
11423 | { | |
11424 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11425 | .name = "Channel Mode", | |
11426 | .info = alc_ch_mode_info, | |
11427 | .get = alc_ch_mode_get, | |
11428 | .put = alc_ch_mode_put, | |
11429 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
11430 | }, | |
11431 | { } /* end */ | |
a53d1aec TD |
11432 | }; |
11433 | ||
d1d985f0 | 11434 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
a53d1aec TD |
11435 | /* output mixer control */ |
11436 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
11437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
11438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
11439 | ||
11440 | /*Capture mixer control */ | |
11441 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
11442 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
11443 | { | |
11444 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11445 | .name = "Capture Source", | |
11446 | .count = 1, | |
11447 | .info = alc_mux_enum_info, | |
11448 | .get = alc_mux_enum_get, | |
11449 | .put = alc_mux_enum_put, | |
11450 | }, | |
11451 | ||
11452 | { } /* end */ | |
f12ab1e0 | 11453 | }; |
a53d1aec | 11454 | |
22309c3e TI |
11455 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
11456 | /* output mixer control */ | |
11457 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
11458 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
11459 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
11460 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
11461 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
11462 | ||
11463 | /* Input mixer control */ | |
11464 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
11465 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
11466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
11467 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
11468 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
11469 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
11470 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
11471 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
11472 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
11473 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 11474 | |
22309c3e TI |
11475 | /* Capture mixer control */ |
11476 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
11477 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
11478 | { | |
11479 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11480 | .name = "Capture Source", | |
11481 | .count = 1, | |
11482 | .info = alc_mux_enum_info, | |
11483 | .get = alc_mux_enum_get, | |
11484 | .put = alc_mux_enum_put, | |
11485 | }, | |
11486 | { | |
11487 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11488 | .name = "Channel Mode", | |
11489 | .info = alc_ch_mode_info, | |
11490 | .get = alc_ch_mode_get, | |
11491 | .put = alc_ch_mode_put, | |
11492 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
11493 | }, | |
11494 | { } /* end */ | |
f12ab1e0 | 11495 | }; |
7cdbff94 MD |
11496 | |
11497 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
11498 | /* output mixer control */ | |
11499 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
11500 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
11501 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
11502 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
11503 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
11504 | ||
11505 | /* Input mixer control */ | |
11506 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
11507 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11508 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
11509 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
11510 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
11511 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
11512 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
11513 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
11514 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
f12ab1e0 TI |
11515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
11516 | ||
7cdbff94 MD |
11517 | /* Capture mixer control */ |
11518 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
11519 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
11520 | { | |
11521 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11522 | .name = "Capture Source", | |
11523 | .count = 1, | |
11524 | .info = alc_mux_enum_info, | |
11525 | .get = alc_mux_enum_get, | |
11526 | .put = alc_mux_enum_put, | |
11527 | }, | |
11528 | { | |
11529 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11530 | .name = "Channel Mode", | |
11531 | .info = alc_ch_mode_info, | |
11532 | .get = alc_ch_mode_get, | |
11533 | .put = alc_ch_mode_put, | |
11534 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
11535 | }, | |
11536 | { } | |
56bb0cab TI |
11537 | }; |
11538 | ||
11539 | /* additional mixer */ | |
d1d985f0 | 11540 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
56bb0cab TI |
11541 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
11542 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
11543 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), | |
11544 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), | |
11545 | { } | |
11546 | }; | |
7cdbff94 | 11547 | |
df694daa KY |
11548 | /* |
11549 | * generic initialization of ADC, input mixers and output mixers | |
11550 | */ | |
11551 | static struct hda_verb alc861_base_init_verbs[] = { | |
11552 | /* | |
11553 | * Unmute ADC0 and set the default input to mic-in | |
11554 | */ | |
11555 | /* port-A for surround (rear panel) */ | |
11556 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11557 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11558 | /* port-B for mic-in (rear panel) with vref */ | |
11559 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11560 | /* port-C for line-in (rear panel) */ | |
11561 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
11562 | /* port-D for Front */ | |
11563 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11564 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11565 | /* port-E for HP out (front panel) */ | |
11566 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
11567 | /* route front PCM to HP */ | |
9dece1d7 | 11568 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
11569 | /* port-F for mic-in (front panel) with vref */ |
11570 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11571 | /* port-G for CLFE (rear panel) */ | |
11572 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11573 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11574 | /* port-H for side (rear panel) */ | |
11575 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11576 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11577 | /* CD-in */ | |
11578 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
11579 | /* route front mic to ADC1*/ | |
11580 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11581 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11582 | ||
11583 | /* Unmute DAC0~3 & spdif out*/ | |
11584 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11585 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11586 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11587 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11588 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11589 | ||
11590 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
11591 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11592 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11593 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11594 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11595 | ||
11596 | /* Unmute Stereo Mixer 15 */ | |
11597 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11598 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11599 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 11600 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
11601 | |
11602 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11603 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11604 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11605 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11606 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11607 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11608 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11609 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
11610 | /* hp used DAC 3 (Front) */ |
11611 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
11612 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
11613 | ||
11614 | { } | |
11615 | }; | |
11616 | ||
11617 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
11618 | /* | |
11619 | * Unmute ADC0 and set the default input to mic-in | |
11620 | */ | |
11621 | /* port-A for surround (rear panel) */ | |
11622 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
11623 | /* port-B for mic-in (rear panel) with vref */ | |
11624 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11625 | /* port-C for line-in (rear panel) */ | |
11626 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
11627 | /* port-D for Front */ | |
11628 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11629 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11630 | /* port-E for HP out (front panel) */ | |
11631 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
11632 | /* route front PCM to HP */ | |
9dece1d7 | 11633 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
11634 | /* port-F for mic-in (front panel) with vref */ |
11635 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11636 | /* port-G for CLFE (rear panel) */ | |
11637 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
11638 | /* port-H for side (rear panel) */ | |
11639 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
11640 | /* CD-in */ | |
11641 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
11642 | /* route front mic to ADC1*/ | |
11643 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11644 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11645 | /* Unmute DAC0~3 & spdif out*/ | |
11646 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11647 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11648 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11649 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11650 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11651 | ||
11652 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
11653 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11654 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11655 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11656 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11657 | ||
11658 | /* Unmute Stereo Mixer 15 */ | |
11659 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11660 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11661 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 11662 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
11663 | |
11664 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11665 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11666 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11667 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11668 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11669 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11670 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11671 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
11672 | /* hp used DAC 3 (Front) */ |
11673 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
11674 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
11675 | { } | |
11676 | }; | |
22309c3e TI |
11677 | |
11678 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
11679 | /* | |
11680 | * Unmute ADC0 and set the default input to mic-in | |
11681 | */ | |
11682 | /* port-A for surround (rear panel) */ | |
11683 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
11684 | /* port-B for mic-in (rear panel) with vref */ | |
11685 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11686 | /* port-C for line-in (rear panel) */ | |
11687 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
11688 | /* port-D for Front */ | |
11689 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11690 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11691 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
11692 | /* this has to be set to VREF80 */ |
11693 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
22309c3e | 11694 | /* route front PCM to HP */ |
9dece1d7 | 11695 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
22309c3e TI |
11696 | /* port-F for mic-in (front panel) with vref */ |
11697 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11698 | /* port-G for CLFE (rear panel) */ | |
11699 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
11700 | /* port-H for side (rear panel) */ | |
11701 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
11702 | /* CD-in */ | |
11703 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
11704 | /* route front mic to ADC1*/ | |
11705 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11706 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11707 | /* Unmute DAC0~3 & spdif out*/ | |
11708 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11709 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11710 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11711 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11713 | ||
11714 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
11715 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11716 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11717 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11718 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11719 | ||
11720 | /* Unmute Stereo Mixer 15 */ | |
11721 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11722 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11723 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 11724 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
22309c3e TI |
11725 | |
11726 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11727 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11728 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11729 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11730 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11731 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11732 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11733 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
11734 | /* hp used DAC 3 (Front) */ |
11735 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
22309c3e TI |
11736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
11737 | { } | |
11738 | }; | |
11739 | ||
7cdbff94 MD |
11740 | static struct hda_verb alc861_asus_init_verbs[] = { |
11741 | /* | |
11742 | * Unmute ADC0 and set the default input to mic-in | |
11743 | */ | |
f12ab1e0 TI |
11744 | /* port-A for surround (rear panel) |
11745 | * according to codec#0 this is the HP jack | |
11746 | */ | |
7cdbff94 MD |
11747 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
11748 | /* route front PCM to HP */ | |
11749 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
11750 | /* port-B for mic-in (rear panel) with vref */ | |
11751 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11752 | /* port-C for line-in (rear panel) */ | |
11753 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
11754 | /* port-D for Front */ | |
11755 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11756 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
11757 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
11758 | /* this has to be set to VREF80 */ |
11759 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7cdbff94 | 11760 | /* route front PCM to HP */ |
9dece1d7 | 11761 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7cdbff94 MD |
11762 | /* port-F for mic-in (front panel) with vref */ |
11763 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
11764 | /* port-G for CLFE (rear panel) */ | |
11765 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11766 | /* port-H for side (rear panel) */ | |
11767 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
11768 | /* CD-in */ | |
11769 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
11770 | /* route front mic to ADC1*/ | |
11771 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11772 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11773 | /* Unmute DAC0~3 & spdif out*/ | |
11774 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11775 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11776 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11777 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11778 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11779 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
11780 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11781 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11782 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11783 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11784 | ||
11785 | /* Unmute Stereo Mixer 15 */ | |
11786 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11787 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11788 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 11789 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
7cdbff94 MD |
11790 | |
11791 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11792 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11793 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11794 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11795 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11796 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11797 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11798 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
11799 | /* hp used DAC 3 (Front) */ |
11800 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7cdbff94 MD |
11801 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
11802 | { } | |
11803 | }; | |
11804 | ||
56bb0cab TI |
11805 | /* additional init verbs for ASUS laptops */ |
11806 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
11807 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
11808 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
11809 | { } | |
11810 | }; | |
7cdbff94 | 11811 | |
df694daa KY |
11812 | /* |
11813 | * generic initialization of ADC, input mixers and output mixers | |
11814 | */ | |
11815 | static struct hda_verb alc861_auto_init_verbs[] = { | |
11816 | /* | |
11817 | * Unmute ADC0 and set the default input to mic-in | |
11818 | */ | |
f12ab1e0 | 11819 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
df694daa KY |
11820 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11821 | ||
11822 | /* Unmute DAC0~3 & spdif out*/ | |
11823 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11824 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11825 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11826 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11827 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11828 | ||
11829 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
11830 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11831 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11832 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11833 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11834 | ||
11835 | /* Unmute Stereo Mixer 15 */ | |
11836 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11837 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11838 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
11839 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
11840 | ||
11841 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11842 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11843 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11844 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11845 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11846 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11847 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11849 | ||
11850 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11851 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
f12ab1e0 TI |
11852 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
11853 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
11854 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
11855 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
f12ab1e0 TI |
11856 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
11857 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa | 11858 | |
f12ab1e0 | 11859 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
df694daa KY |
11860 | |
11861 | { } | |
11862 | }; | |
11863 | ||
a53d1aec TD |
11864 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
11865 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f12ab1e0 | 11866 | |
a53d1aec TD |
11867 | { } |
11868 | }; | |
11869 | ||
11870 | /* toggle speaker-output according to the hp-jack state */ | |
11871 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
11872 | { | |
11873 | unsigned int present; | |
11874 | ||
11875 | present = snd_hda_codec_read(codec, 0x0f, 0, | |
11876 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
11877 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
11878 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
11879 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
11880 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
a53d1aec TD |
11881 | } |
11882 | ||
11883 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
11884 | unsigned int res) | |
11885 | { | |
a53d1aec TD |
11886 | if ((res >> 26) == ALC880_HP_EVENT) |
11887 | alc861_toshiba_automute(codec); | |
11888 | } | |
11889 | ||
df694daa KY |
11890 | /* pcm configuration: identiacal with ALC880 */ |
11891 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback | |
11892 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
11893 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
11894 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
11895 | ||
11896 | ||
11897 | #define ALC861_DIGOUT_NID 0x07 | |
11898 | ||
11899 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
11900 | { 8, NULL } | |
11901 | }; | |
11902 | ||
11903 | static hda_nid_t alc861_dac_nids[4] = { | |
11904 | /* front, surround, clfe, side */ | |
11905 | 0x03, 0x06, 0x05, 0x04 | |
11906 | }; | |
11907 | ||
9c7f852e TI |
11908 | static hda_nid_t alc660_dac_nids[3] = { |
11909 | /* front, clfe, surround */ | |
11910 | 0x03, 0x05, 0x06 | |
11911 | }; | |
11912 | ||
df694daa KY |
11913 | static hda_nid_t alc861_adc_nids[1] = { |
11914 | /* ADC0-2 */ | |
11915 | 0x08, | |
11916 | }; | |
11917 | ||
11918 | static struct hda_input_mux alc861_capture_source = { | |
11919 | .num_items = 5, | |
11920 | .items = { | |
11921 | { "Mic", 0x0 }, | |
11922 | { "Front Mic", 0x3 }, | |
11923 | { "Line", 0x1 }, | |
11924 | { "CD", 0x4 }, | |
11925 | { "Mixer", 0x5 }, | |
11926 | }, | |
11927 | }; | |
11928 | ||
11929 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
11930 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
11931 | const struct auto_pin_cfg *cfg) | |
df694daa KY |
11932 | { |
11933 | int i; | |
11934 | hda_nid_t nid; | |
11935 | ||
11936 | spec->multiout.dac_nids = spec->private_dac_nids; | |
11937 | for (i = 0; i < cfg->line_outs; i++) { | |
11938 | nid = cfg->line_out_pins[i]; | |
11939 | if (nid) { | |
11940 | if (i >= ARRAY_SIZE(alc861_dac_nids)) | |
11941 | continue; | |
11942 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; | |
11943 | } | |
11944 | } | |
11945 | spec->multiout.num_dacs = cfg->line_outs; | |
11946 | return 0; | |
11947 | } | |
11948 | ||
11949 | /* add playback controls from the parsed DAC table */ | |
11950 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, | |
11951 | const struct auto_pin_cfg *cfg) | |
11952 | { | |
11953 | char name[32]; | |
f12ab1e0 TI |
11954 | static const char *chname[4] = { |
11955 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
11956 | }; | |
df694daa KY |
11957 | hda_nid_t nid; |
11958 | int i, idx, err; | |
11959 | ||
11960 | for (i = 0; i < cfg->line_outs; i++) { | |
11961 | nid = spec->multiout.dac_nids[i]; | |
f12ab1e0 | 11962 | if (!nid) |
df694daa KY |
11963 | continue; |
11964 | if (nid == 0x05) { | |
11965 | /* Center/LFE */ | |
f12ab1e0 TI |
11966 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
11967 | "Center Playback Switch", | |
11968 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
11969 | HDA_OUTPUT)); | |
11970 | if (err < 0) | |
df694daa | 11971 | return err; |
f12ab1e0 TI |
11972 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
11973 | "LFE Playback Switch", | |
11974 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
11975 | HDA_OUTPUT)); | |
11976 | if (err < 0) | |
df694daa KY |
11977 | return err; |
11978 | } else { | |
f12ab1e0 TI |
11979 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
11980 | idx++) | |
df694daa KY |
11981 | if (nid == alc861_dac_nids[idx]) |
11982 | break; | |
11983 | sprintf(name, "%s Playback Switch", chname[idx]); | |
f12ab1e0 TI |
11984 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
11985 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
11986 | HDA_OUTPUT)); | |
11987 | if (err < 0) | |
df694daa KY |
11988 | return err; |
11989 | } | |
11990 | } | |
11991 | return 0; | |
11992 | } | |
11993 | ||
11994 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | |
11995 | { | |
11996 | int err; | |
11997 | hda_nid_t nid; | |
11998 | ||
f12ab1e0 | 11999 | if (!pin) |
df694daa KY |
12000 | return 0; |
12001 | ||
12002 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
12003 | nid = 0x03; | |
f12ab1e0 TI |
12004 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
12005 | "Headphone Playback Switch", | |
12006 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
12007 | if (err < 0) | |
df694daa KY |
12008 | return err; |
12009 | spec->multiout.hp_nid = nid; | |
12010 | } | |
12011 | return 0; | |
12012 | } | |
12013 | ||
12014 | /* create playback/capture controls for input pins */ | |
f12ab1e0 TI |
12015 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
12016 | const struct auto_pin_cfg *cfg) | |
df694daa | 12017 | { |
df694daa KY |
12018 | struct hda_input_mux *imux = &spec->private_imux; |
12019 | int i, err, idx, idx1; | |
12020 | ||
12021 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
f12ab1e0 | 12022 | switch (cfg->input_pins[i]) { |
df694daa KY |
12023 | case 0x0c: |
12024 | idx1 = 1; | |
f12ab1e0 | 12025 | idx = 2; /* Line In */ |
df694daa KY |
12026 | break; |
12027 | case 0x0f: | |
12028 | idx1 = 2; | |
f12ab1e0 | 12029 | idx = 2; /* Line In */ |
df694daa KY |
12030 | break; |
12031 | case 0x0d: | |
12032 | idx1 = 0; | |
f12ab1e0 | 12033 | idx = 1; /* Mic In */ |
df694daa | 12034 | break; |
f12ab1e0 | 12035 | case 0x10: |
df694daa | 12036 | idx1 = 3; |
f12ab1e0 | 12037 | idx = 1; /* Mic In */ |
df694daa KY |
12038 | break; |
12039 | case 0x11: | |
12040 | idx1 = 4; | |
f12ab1e0 | 12041 | idx = 0; /* CD */ |
df694daa KY |
12042 | break; |
12043 | default: | |
12044 | continue; | |
12045 | } | |
12046 | ||
4a471b7d TI |
12047 | err = new_analog_input(spec, cfg->input_pins[i], |
12048 | auto_pin_cfg_labels[i], idx, 0x15); | |
df694daa KY |
12049 | if (err < 0) |
12050 | return err; | |
12051 | ||
4a471b7d | 12052 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
df694daa | 12053 | imux->items[imux->num_items].index = idx1; |
f12ab1e0 | 12054 | imux->num_items++; |
df694daa KY |
12055 | } |
12056 | return 0; | |
12057 | } | |
12058 | ||
12059 | static struct snd_kcontrol_new alc861_capture_mixer[] = { | |
12060 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
12061 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
12062 | ||
12063 | { | |
12064 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12065 | /* The multiple "Capture Source" controls confuse alsamixer | |
12066 | * So call somewhat different.. | |
df694daa KY |
12067 | */ |
12068 | /* .name = "Capture Source", */ | |
12069 | .name = "Input Source", | |
12070 | .count = 1, | |
12071 | .info = alc_mux_enum_info, | |
12072 | .get = alc_mux_enum_get, | |
12073 | .put = alc_mux_enum_put, | |
12074 | }, | |
12075 | { } /* end */ | |
12076 | }; | |
12077 | ||
f12ab1e0 TI |
12078 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
12079 | hda_nid_t nid, | |
df694daa KY |
12080 | int pin_type, int dac_idx) |
12081 | { | |
564c5bea JL |
12082 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
12083 | pin_type); | |
12084 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
12085 | AMP_OUT_UNMUTE); | |
df694daa KY |
12086 | } |
12087 | ||
12088 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
12089 | { | |
12090 | struct alc_spec *spec = codec->spec; | |
12091 | int i; | |
12092 | ||
bc9f98a9 | 12093 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
df694daa KY |
12094 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
12095 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 12096 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 12097 | if (nid) |
baba8ee9 | 12098 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 12099 | spec->multiout.dac_nids[i]); |
df694daa KY |
12100 | } |
12101 | } | |
12102 | ||
12103 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
12104 | { | |
12105 | struct alc_spec *spec = codec->spec; | |
12106 | hda_nid_t pin; | |
12107 | ||
eb06ed8f | 12108 | pin = spec->autocfg.hp_pins[0]; |
df694daa | 12109 | if (pin) /* connect to front */ |
f12ab1e0 TI |
12110 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
12111 | spec->multiout.dac_nids[0]); | |
f6c7e546 TI |
12112 | pin = spec->autocfg.speaker_pins[0]; |
12113 | if (pin) | |
12114 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
df694daa KY |
12115 | } |
12116 | ||
12117 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
12118 | { | |
12119 | struct alc_spec *spec = codec->spec; | |
12120 | int i; | |
12121 | ||
12122 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
12123 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
f12ab1e0 TI |
12124 | if (nid >= 0x0c && nid <= 0x11) { |
12125 | snd_hda_codec_write(codec, nid, 0, | |
12126 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
12127 | i <= AUTO_PIN_FRONT_MIC ? | |
12128 | PIN_VREF80 : PIN_IN); | |
df694daa KY |
12129 | } |
12130 | } | |
12131 | } | |
12132 | ||
12133 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
12134 | /* return 1 if successful, 0 if the proper config is not found, |
12135 | * or a negative error code | |
12136 | */ | |
df694daa KY |
12137 | static int alc861_parse_auto_config(struct hda_codec *codec) |
12138 | { | |
12139 | struct alc_spec *spec = codec->spec; | |
12140 | int err; | |
12141 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
12142 | ||
f12ab1e0 TI |
12143 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
12144 | alc861_ignore); | |
12145 | if (err < 0) | |
df694daa | 12146 | return err; |
f12ab1e0 | 12147 | if (!spec->autocfg.line_outs) |
df694daa KY |
12148 | return 0; /* can't find valid BIOS pin config */ |
12149 | ||
f12ab1e0 TI |
12150 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
12151 | if (err < 0) | |
12152 | return err; | |
12153 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
12154 | if (err < 0) | |
12155 | return err; | |
12156 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); | |
12157 | if (err < 0) | |
12158 | return err; | |
12159 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
12160 | if (err < 0) | |
df694daa KY |
12161 | return err; |
12162 | ||
12163 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
12164 | ||
12165 | if (spec->autocfg.dig_out_pin) | |
12166 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; | |
12167 | ||
12168 | if (spec->kctl_alloc) | |
12169 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
12170 | ||
12171 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; | |
12172 | ||
a1e8d2da | 12173 | spec->num_mux_defs = 1; |
df694daa KY |
12174 | spec->input_mux = &spec->private_imux; |
12175 | ||
12176 | spec->adc_nids = alc861_adc_nids; | |
12177 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
12178 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; | |
12179 | spec->num_mixers++; | |
12180 | ||
12181 | return 1; | |
12182 | } | |
12183 | ||
ae6b813a TI |
12184 | /* additional initialization for auto-configuration model */ |
12185 | static void alc861_auto_init(struct hda_codec *codec) | |
df694daa | 12186 | { |
f6c7e546 | 12187 | struct alc_spec *spec = codec->spec; |
df694daa KY |
12188 | alc861_auto_init_multi_out(codec); |
12189 | alc861_auto_init_hp_out(codec); | |
12190 | alc861_auto_init_analog_input(codec); | |
f6c7e546 TI |
12191 | if (spec->unsol_event) |
12192 | alc_sku_automute(codec); | |
df694daa KY |
12193 | } |
12194 | ||
cb53c626 TI |
12195 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12196 | static struct hda_amp_list alc861_loopbacks[] = { | |
12197 | { 0x15, HDA_INPUT, 0 }, | |
12198 | { 0x15, HDA_INPUT, 1 }, | |
12199 | { 0x15, HDA_INPUT, 2 }, | |
12200 | { 0x15, HDA_INPUT, 3 }, | |
12201 | { } /* end */ | |
12202 | }; | |
12203 | #endif | |
12204 | ||
df694daa KY |
12205 | |
12206 | /* | |
12207 | * configuration and preset | |
12208 | */ | |
f5fcc13c TI |
12209 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
12210 | [ALC861_3ST] = "3stack", | |
12211 | [ALC660_3ST] = "3stack-660", | |
12212 | [ALC861_3ST_DIG] = "3stack-dig", | |
12213 | [ALC861_6ST_DIG] = "6stack-dig", | |
12214 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
12215 | [ALC861_TOSHIBA] = "toshiba", | |
12216 | [ALC861_ASUS] = "asus", | |
12217 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
12218 | [ALC861_AUTO] = "auto", | |
12219 | }; | |
12220 | ||
12221 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
687a47bd | 12222 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
f5fcc13c TI |
12223 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
12224 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
12225 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
ac3e3741 | 12226 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
83c34218 | 12227 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
ad5e7737 | 12228 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
341d4eb0 TI |
12229 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
12230 | * Any other models that need this preset? | |
12231 | */ | |
12232 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
ac3e3741 TI |
12233 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
12234 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
4147dab6 | 12235 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
ac3e3741 TI |
12236 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
12237 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
12238 | /* FIXME: the below seems conflict */ | |
12239 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
07e038b3 | 12240 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
f5fcc13c | 12241 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
df694daa KY |
12242 | {} |
12243 | }; | |
12244 | ||
12245 | static struct alc_config_preset alc861_presets[] = { | |
12246 | [ALC861_3ST] = { | |
12247 | .mixers = { alc861_3ST_mixer }, | |
12248 | .init_verbs = { alc861_threestack_init_verbs }, | |
12249 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
12250 | .dac_nids = alc861_dac_nids, | |
12251 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
12252 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 12253 | .need_dac_fix = 1, |
df694daa KY |
12254 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
12255 | .adc_nids = alc861_adc_nids, | |
12256 | .input_mux = &alc861_capture_source, | |
12257 | }, | |
12258 | [ALC861_3ST_DIG] = { | |
12259 | .mixers = { alc861_base_mixer }, | |
12260 | .init_verbs = { alc861_threestack_init_verbs }, | |
12261 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
12262 | .dac_nids = alc861_dac_nids, | |
12263 | .dig_out_nid = ALC861_DIGOUT_NID, | |
12264 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
12265 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 12266 | .need_dac_fix = 1, |
df694daa KY |
12267 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
12268 | .adc_nids = alc861_adc_nids, | |
12269 | .input_mux = &alc861_capture_source, | |
12270 | }, | |
12271 | [ALC861_6ST_DIG] = { | |
12272 | .mixers = { alc861_base_mixer }, | |
12273 | .init_verbs = { alc861_base_init_verbs }, | |
12274 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
12275 | .dac_nids = alc861_dac_nids, | |
12276 | .dig_out_nid = ALC861_DIGOUT_NID, | |
12277 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
12278 | .channel_mode = alc861_8ch_modes, | |
12279 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
12280 | .adc_nids = alc861_adc_nids, | |
12281 | .input_mux = &alc861_capture_source, | |
12282 | }, | |
9c7f852e TI |
12283 | [ALC660_3ST] = { |
12284 | .mixers = { alc861_3ST_mixer }, | |
12285 | .init_verbs = { alc861_threestack_init_verbs }, | |
12286 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
12287 | .dac_nids = alc660_dac_nids, | |
12288 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
12289 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 12290 | .need_dac_fix = 1, |
9c7f852e TI |
12291 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
12292 | .adc_nids = alc861_adc_nids, | |
12293 | .input_mux = &alc861_capture_source, | |
12294 | }, | |
22309c3e TI |
12295 | [ALC861_UNIWILL_M31] = { |
12296 | .mixers = { alc861_uniwill_m31_mixer }, | |
12297 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
12298 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
12299 | .dac_nids = alc861_dac_nids, | |
12300 | .dig_out_nid = ALC861_DIGOUT_NID, | |
12301 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
12302 | .channel_mode = alc861_uniwill_m31_modes, | |
12303 | .need_dac_fix = 1, | |
12304 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
12305 | .adc_nids = alc861_adc_nids, | |
12306 | .input_mux = &alc861_capture_source, | |
12307 | }, | |
a53d1aec TD |
12308 | [ALC861_TOSHIBA] = { |
12309 | .mixers = { alc861_toshiba_mixer }, | |
f12ab1e0 TI |
12310 | .init_verbs = { alc861_base_init_verbs, |
12311 | alc861_toshiba_init_verbs }, | |
a53d1aec TD |
12312 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
12313 | .dac_nids = alc861_dac_nids, | |
12314 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
12315 | .channel_mode = alc883_3ST_2ch_modes, | |
12316 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
12317 | .adc_nids = alc861_adc_nids, | |
12318 | .input_mux = &alc861_capture_source, | |
12319 | .unsol_event = alc861_toshiba_unsol_event, | |
12320 | .init_hook = alc861_toshiba_automute, | |
12321 | }, | |
7cdbff94 MD |
12322 | [ALC861_ASUS] = { |
12323 | .mixers = { alc861_asus_mixer }, | |
12324 | .init_verbs = { alc861_asus_init_verbs }, | |
12325 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
12326 | .dac_nids = alc861_dac_nids, | |
12327 | .dig_out_nid = ALC861_DIGOUT_NID, | |
12328 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
12329 | .channel_mode = alc861_asus_modes, | |
12330 | .need_dac_fix = 1, | |
12331 | .hp_nid = 0x06, | |
12332 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
12333 | .adc_nids = alc861_adc_nids, | |
12334 | .input_mux = &alc861_capture_source, | |
12335 | }, | |
56bb0cab TI |
12336 | [ALC861_ASUS_LAPTOP] = { |
12337 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
12338 | .init_verbs = { alc861_asus_init_verbs, | |
12339 | alc861_asus_laptop_init_verbs }, | |
12340 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
12341 | .dac_nids = alc861_dac_nids, | |
12342 | .dig_out_nid = ALC861_DIGOUT_NID, | |
12343 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
12344 | .channel_mode = alc883_3ST_2ch_modes, | |
12345 | .need_dac_fix = 1, | |
12346 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
12347 | .adc_nids = alc861_adc_nids, | |
12348 | .input_mux = &alc861_capture_source, | |
12349 | }, | |
12350 | }; | |
df694daa KY |
12351 | |
12352 | ||
12353 | static int patch_alc861(struct hda_codec *codec) | |
12354 | { | |
12355 | struct alc_spec *spec; | |
12356 | int board_config; | |
12357 | int err; | |
12358 | ||
dc041e0b | 12359 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
12360 | if (spec == NULL) |
12361 | return -ENOMEM; | |
12362 | ||
f12ab1e0 | 12363 | codec->spec = spec; |
df694daa | 12364 | |
f5fcc13c TI |
12365 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
12366 | alc861_models, | |
12367 | alc861_cfg_tbl); | |
9c7f852e | 12368 | |
f5fcc13c | 12369 | if (board_config < 0) { |
9c7f852e TI |
12370 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
12371 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
12372 | board_config = ALC861_AUTO; |
12373 | } | |
12374 | ||
12375 | if (board_config == ALC861_AUTO) { | |
12376 | /* automatic parse from the BIOS config */ | |
12377 | err = alc861_parse_auto_config(codec); | |
12378 | if (err < 0) { | |
12379 | alc_free(codec); | |
12380 | return err; | |
f12ab1e0 | 12381 | } else if (!err) { |
9c7f852e TI |
12382 | printk(KERN_INFO |
12383 | "hda_codec: Cannot set up configuration " | |
12384 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
12385 | board_config = ALC861_3ST_DIG; |
12386 | } | |
12387 | } | |
12388 | ||
12389 | if (board_config != ALC861_AUTO) | |
12390 | setup_preset(spec, &alc861_presets[board_config]); | |
12391 | ||
12392 | spec->stream_name_analog = "ALC861 Analog"; | |
12393 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | |
12394 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
12395 | ||
12396 | spec->stream_name_digital = "ALC861 Digital"; | |
12397 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | |
12398 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
12399 | ||
2134ea4f TI |
12400 | spec->vmaster_nid = 0x03; |
12401 | ||
df694daa KY |
12402 | codec->patch_ops = alc_patch_ops; |
12403 | if (board_config == ALC861_AUTO) | |
ae6b813a | 12404 | spec->init_hook = alc861_auto_init; |
cb53c626 TI |
12405 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12406 | if (!spec->loopback.amplist) | |
12407 | spec->loopback.amplist = alc861_loopbacks; | |
12408 | #endif | |
df694daa | 12409 | |
1da177e4 LT |
12410 | return 0; |
12411 | } | |
12412 | ||
f32610ed JS |
12413 | /* |
12414 | * ALC861-VD support | |
12415 | * | |
12416 | * Based on ALC882 | |
12417 | * | |
12418 | * In addition, an independent DAC | |
12419 | */ | |
12420 | #define ALC861VD_DIGOUT_NID 0x06 | |
12421 | ||
12422 | static hda_nid_t alc861vd_dac_nids[4] = { | |
12423 | /* front, surr, clfe, side surr */ | |
12424 | 0x02, 0x03, 0x04, 0x05 | |
12425 | }; | |
12426 | ||
12427 | /* dac_nids for ALC660vd are in a different order - according to | |
12428 | * Realtek's driver. | |
12429 | * This should probably tesult in a different mixer for 6stack models | |
12430 | * of ALC660vd codecs, but for now there is only 3stack mixer | |
12431 | * - and it is the same as in 861vd. | |
12432 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
12433 | */ | |
12434 | static hda_nid_t alc660vd_dac_nids[3] = { | |
12435 | /* front, rear, clfe, rear_surr */ | |
12436 | 0x02, 0x04, 0x03 | |
12437 | }; | |
12438 | ||
12439 | static hda_nid_t alc861vd_adc_nids[1] = { | |
12440 | /* ADC0 */ | |
12441 | 0x09, | |
12442 | }; | |
12443 | ||
e1406348 TI |
12444 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
12445 | ||
f32610ed JS |
12446 | /* input MUX */ |
12447 | /* FIXME: should be a matrix-type input source selection */ | |
12448 | static struct hda_input_mux alc861vd_capture_source = { | |
12449 | .num_items = 4, | |
12450 | .items = { | |
12451 | { "Mic", 0x0 }, | |
12452 | { "Front Mic", 0x1 }, | |
12453 | { "Line", 0x2 }, | |
12454 | { "CD", 0x4 }, | |
12455 | }, | |
12456 | }; | |
12457 | ||
272a527c | 12458 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
b419f346 | 12459 | .num_items = 2, |
272a527c | 12460 | .items = { |
b419f346 TD |
12461 | { "Ext Mic", 0x0 }, |
12462 | { "Int Mic", 0x1 }, | |
272a527c KY |
12463 | }, |
12464 | }; | |
12465 | ||
d1a991a6 KY |
12466 | static struct hda_input_mux alc861vd_hp_capture_source = { |
12467 | .num_items = 2, | |
12468 | .items = { | |
12469 | { "Front Mic", 0x0 }, | |
12470 | { "ATAPI Mic", 0x1 }, | |
12471 | }, | |
12472 | }; | |
12473 | ||
f32610ed JS |
12474 | #define alc861vd_mux_enum_info alc_mux_enum_info |
12475 | #define alc861vd_mux_enum_get alc_mux_enum_get | |
e1406348 TI |
12476 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
12477 | #define alc861vd_mux_enum_put alc882_mux_enum_put | |
f32610ed JS |
12478 | |
12479 | /* | |
12480 | * 2ch mode | |
12481 | */ | |
12482 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
12483 | { 2, NULL } | |
12484 | }; | |
12485 | ||
12486 | /* | |
12487 | * 6ch mode | |
12488 | */ | |
12489 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
12490 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12491 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12492 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12493 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12494 | { } /* end */ | |
12495 | }; | |
12496 | ||
12497 | /* | |
12498 | * 8ch mode | |
12499 | */ | |
12500 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
12501 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12502 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12503 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12504 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12505 | { } /* end */ | |
12506 | }; | |
12507 | ||
12508 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
12509 | { 6, alc861vd_6stack_ch6_init }, | |
12510 | { 8, alc861vd_6stack_ch8_init }, | |
12511 | }; | |
12512 | ||
12513 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
12514 | { | |
12515 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12516 | .name = "Channel Mode", | |
12517 | .info = alc_ch_mode_info, | |
12518 | .get = alc_ch_mode_get, | |
12519 | .put = alc_ch_mode_put, | |
12520 | }, | |
12521 | { } /* end */ | |
12522 | }; | |
12523 | ||
12524 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { | |
12525 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
12526 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
12527 | ||
12528 | { | |
12529 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12530 | /* The multiple "Capture Source" controls confuse alsamixer | |
12531 | * So call somewhat different.. | |
f32610ed JS |
12532 | */ |
12533 | /* .name = "Capture Source", */ | |
12534 | .name = "Input Source", | |
12535 | .count = 1, | |
12536 | .info = alc861vd_mux_enum_info, | |
12537 | .get = alc861vd_mux_enum_get, | |
12538 | .put = alc861vd_mux_enum_put, | |
12539 | }, | |
12540 | { } /* end */ | |
12541 | }; | |
12542 | ||
12543 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
12544 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
12545 | */ | |
12546 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
12547 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
12548 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
12549 | ||
12550 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
12551 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
12552 | ||
12553 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
12554 | HDA_OUTPUT), | |
12555 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
12556 | HDA_OUTPUT), | |
12557 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
12558 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
12559 | ||
12560 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
12561 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
12562 | ||
12563 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
12564 | ||
12565 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12566 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
12567 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
12568 | ||
12569 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12570 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
12571 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
12572 | ||
12573 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
12574 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
12575 | ||
12576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
12577 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
12578 | ||
12579 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
12580 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
12581 | ||
12582 | { } /* end */ | |
12583 | }; | |
12584 | ||
12585 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
12586 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
12587 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
12588 | ||
12589 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
12590 | ||
12591 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
12593 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
12594 | ||
12595 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12596 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
12597 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
12598 | ||
12599 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
12600 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
12601 | ||
12602 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
12603 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
12604 | ||
12605 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
12606 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
12607 | ||
12608 | { } /* end */ | |
12609 | }; | |
12610 | ||
bdd148a3 KY |
12611 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
12612 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
12613 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
12614 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12615 | ||
12616 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
12617 | ||
12618 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12619 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
12620 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
12621 | ||
12622 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12623 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
12624 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
12625 | ||
12626 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
12627 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
12628 | ||
12629 | { } /* end */ | |
12630 | }; | |
12631 | ||
b419f346 TD |
12632 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
12633 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
272a527c KY |
12634 | */ |
12635 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
b419f346 TD |
12636 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
12637 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
272a527c KY |
12638 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
12639 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
b419f346 TD |
12640 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
12641 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
12642 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
12643 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
12644 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
12645 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
12646 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), | |
12647 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), | |
272a527c KY |
12648 | { } /* end */ |
12649 | }; | |
12650 | ||
d1a991a6 KY |
12651 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
12652 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
12653 | */ | |
12654 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
12655 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
12656 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
12657 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
12658 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
12659 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
12660 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
12661 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
12662 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
12663 | ||
12664 | { } /* end */ | |
12665 | }; | |
12666 | ||
f32610ed JS |
12667 | /* |
12668 | * generic initialization of ADC, input mixers and output mixers | |
12669 | */ | |
12670 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
12671 | /* | |
12672 | * Unmute ADC0 and set the default input to mic-in | |
12673 | */ | |
12674 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12675 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12676 | ||
12677 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
12678 | * the analog-loopback mixer widget | |
12679 | */ | |
12680 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12681 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12682 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12683 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12684 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12685 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
f32610ed JS |
12686 | |
12687 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
bdd148a3 KY |
12688 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12689 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12690 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f32610ed | 12691 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
f32610ed JS |
12692 | |
12693 | /* | |
12694 | * Set up output mixers (0x02 - 0x05) | |
12695 | */ | |
12696 | /* set vol=0 to output mixers */ | |
12697 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12698 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12699 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12700 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12701 | ||
12702 | /* set up input amps for analog loopback */ | |
12703 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12704 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12705 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12706 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12707 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12708 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12709 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12710 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12711 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12712 | ||
12713 | { } | |
12714 | }; | |
12715 | ||
12716 | /* | |
12717 | * 3-stack pin configuration: | |
12718 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
12719 | */ | |
12720 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
12721 | /* | |
12722 | * Set pin mode and muting | |
12723 | */ | |
12724 | /* set front pin widgets 0x14 for output */ | |
12725 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12726 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12727 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12728 | ||
12729 | /* Mic (rear) pin: input vref at 80% */ | |
12730 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12731 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12732 | /* Front Mic pin: input vref at 80% */ | |
12733 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12734 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12735 | /* Line In pin: input */ | |
12736 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12737 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12738 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
12739 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12740 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12741 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12742 | /* CD pin widget for input */ | |
12743 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12744 | ||
12745 | { } | |
12746 | }; | |
12747 | ||
12748 | /* | |
12749 | * 6-stack pin configuration: | |
12750 | */ | |
12751 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
12752 | /* | |
12753 | * Set pin mode and muting | |
12754 | */ | |
12755 | /* set front pin widgets 0x14 for output */ | |
12756 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12757 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12758 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12759 | ||
12760 | /* Rear Pin: output 1 (0x0d) */ | |
12761 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12762 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12763 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12764 | /* CLFE Pin: output 2 (0x0e) */ | |
12765 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12766 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12767 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
12768 | /* Side Pin: output 3 (0x0f) */ | |
12769 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12770 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12771 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
12772 | ||
12773 | /* Mic (rear) pin: input vref at 80% */ | |
12774 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12775 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12776 | /* Front Mic pin: input vref at 80% */ | |
12777 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12778 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12779 | /* Line In pin: input */ | |
12780 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12781 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12782 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
12783 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12784 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12785 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12786 | /* CD pin widget for input */ | |
12787 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12788 | ||
12789 | { } | |
12790 | }; | |
12791 | ||
bdd148a3 KY |
12792 | static struct hda_verb alc861vd_eapd_verbs[] = { |
12793 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12794 | { } | |
12795 | }; | |
12796 | ||
f9423e7a KY |
12797 | static struct hda_verb alc660vd_eapd_verbs[] = { |
12798 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12799 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12800 | { } | |
12801 | }; | |
12802 | ||
bdd148a3 KY |
12803 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
12804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12805 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12806 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12807 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
12808 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
12809 | {} | |
12810 | }; | |
12811 | ||
12812 | /* toggle speaker-output according to the hp-jack state */ | |
12813 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) | |
12814 | { | |
12815 | unsigned int present; | |
12816 | unsigned char bits; | |
12817 | ||
12818 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
12819 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
12820 | bits = present ? HDA_AMP_MUTE : 0; |
12821 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
12822 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
12823 | } |
12824 | ||
12825 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | |
12826 | { | |
12827 | unsigned int present; | |
12828 | unsigned char bits; | |
12829 | ||
12830 | present = snd_hda_codec_read(codec, 0x18, 0, | |
12831 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
12832 | bits = present ? HDA_AMP_MUTE : 0; |
12833 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
12834 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
12835 | } |
12836 | ||
12837 | static void alc861vd_lenovo_automute(struct hda_codec *codec) | |
12838 | { | |
12839 | alc861vd_lenovo_hp_automute(codec); | |
12840 | alc861vd_lenovo_mic_automute(codec); | |
12841 | } | |
12842 | ||
12843 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
12844 | unsigned int res) | |
12845 | { | |
12846 | switch (res >> 26) { | |
12847 | case ALC880_HP_EVENT: | |
12848 | alc861vd_lenovo_hp_automute(codec); | |
12849 | break; | |
12850 | case ALC880_MIC_EVENT: | |
12851 | alc861vd_lenovo_mic_automute(codec); | |
12852 | break; | |
12853 | } | |
12854 | } | |
12855 | ||
272a527c KY |
12856 | static struct hda_verb alc861vd_dallas_verbs[] = { |
12857 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12858 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12859 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12860 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12861 | ||
12862 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12863 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12864 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12865 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12866 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12867 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12868 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12869 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12870 | ||
12871 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12872 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12875 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12876 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12877 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12878 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12879 | ||
12880 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
12881 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12882 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
12883 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12884 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12885 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12886 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12887 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12888 | ||
12889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12890 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12892 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12893 | ||
12894 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12895 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12896 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
12897 | ||
12898 | { } /* end */ | |
12899 | }; | |
12900 | ||
12901 | /* toggle speaker-output according to the hp-jack state */ | |
12902 | static void alc861vd_dallas_automute(struct hda_codec *codec) | |
12903 | { | |
12904 | unsigned int present; | |
12905 | ||
12906 | present = snd_hda_codec_read(codec, 0x15, 0, | |
12907 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
12908 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
12909 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
12910 | } |
12911 | ||
12912 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) | |
12913 | { | |
12914 | if ((res >> 26) == ALC880_HP_EVENT) | |
12915 | alc861vd_dallas_automute(codec); | |
12916 | } | |
12917 | ||
cb53c626 TI |
12918 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12919 | #define alc861vd_loopbacks alc880_loopbacks | |
12920 | #endif | |
12921 | ||
f32610ed JS |
12922 | /* pcm configuration: identiacal with ALC880 */ |
12923 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback | |
12924 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
12925 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
12926 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
12927 | ||
12928 | /* | |
12929 | * configuration and preset | |
12930 | */ | |
12931 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |
12932 | [ALC660VD_3ST] = "3stack-660", | |
983f8ae4 | 12933 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
f32610ed JS |
12934 | [ALC861VD_3ST] = "3stack", |
12935 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
12936 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
bdd148a3 | 12937 | [ALC861VD_LENOVO] = "lenovo", |
272a527c | 12938 | [ALC861VD_DALLAS] = "dallas", |
983f8ae4 | 12939 | [ALC861VD_HP] = "hp", |
f32610ed JS |
12940 | [ALC861VD_AUTO] = "auto", |
12941 | }; | |
12942 | ||
12943 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
ac3e3741 TI |
12944 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
12945 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
07e038b3 | 12946 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
f32610ed | 12947 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
6963f84c | 12948 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
f32610ed | 12949 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
ac3e3741 | 12950 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
38baf5ad | 12951 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
272a527c | 12952 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
542d7c66 | 12953 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
b419f346 | 12954 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
39c5d41f | 12955 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
ac3e3741 TI |
12956 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
12957 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), | |
625dc0bf | 12958 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
f32610ed JS |
12959 | {} |
12960 | }; | |
12961 | ||
12962 | static struct alc_config_preset alc861vd_presets[] = { | |
12963 | [ALC660VD_3ST] = { | |
12964 | .mixers = { alc861vd_3st_mixer }, | |
12965 | .init_verbs = { alc861vd_volume_init_verbs, | |
12966 | alc861vd_3stack_init_verbs }, | |
12967 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
12968 | .dac_nids = alc660vd_dac_nids, | |
f32610ed JS |
12969 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12970 | .channel_mode = alc861vd_3stack_2ch_modes, | |
12971 | .input_mux = &alc861vd_capture_source, | |
12972 | }, | |
6963f84c MC |
12973 | [ALC660VD_3ST_DIG] = { |
12974 | .mixers = { alc861vd_3st_mixer }, | |
12975 | .init_verbs = { alc861vd_volume_init_verbs, | |
12976 | alc861vd_3stack_init_verbs }, | |
12977 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
12978 | .dac_nids = alc660vd_dac_nids, | |
12979 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
6963f84c MC |
12980 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12981 | .channel_mode = alc861vd_3stack_2ch_modes, | |
12982 | .input_mux = &alc861vd_capture_source, | |
12983 | }, | |
f32610ed JS |
12984 | [ALC861VD_3ST] = { |
12985 | .mixers = { alc861vd_3st_mixer }, | |
12986 | .init_verbs = { alc861vd_volume_init_verbs, | |
12987 | alc861vd_3stack_init_verbs }, | |
12988 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
12989 | .dac_nids = alc861vd_dac_nids, | |
12990 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
12991 | .channel_mode = alc861vd_3stack_2ch_modes, | |
12992 | .input_mux = &alc861vd_capture_source, | |
12993 | }, | |
12994 | [ALC861VD_3ST_DIG] = { | |
12995 | .mixers = { alc861vd_3st_mixer }, | |
12996 | .init_verbs = { alc861vd_volume_init_verbs, | |
12997 | alc861vd_3stack_init_verbs }, | |
12998 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
12999 | .dac_nids = alc861vd_dac_nids, | |
13000 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
13001 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
13002 | .channel_mode = alc861vd_3stack_2ch_modes, | |
13003 | .input_mux = &alc861vd_capture_source, | |
13004 | }, | |
13005 | [ALC861VD_6ST_DIG] = { | |
13006 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
13007 | .init_verbs = { alc861vd_volume_init_verbs, | |
13008 | alc861vd_6stack_init_verbs }, | |
13009 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
13010 | .dac_nids = alc861vd_dac_nids, | |
13011 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
13012 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
13013 | .channel_mode = alc861vd_6stack_modes, | |
13014 | .input_mux = &alc861vd_capture_source, | |
13015 | }, | |
bdd148a3 KY |
13016 | [ALC861VD_LENOVO] = { |
13017 | .mixers = { alc861vd_lenovo_mixer }, | |
13018 | .init_verbs = { alc861vd_volume_init_verbs, | |
13019 | alc861vd_3stack_init_verbs, | |
13020 | alc861vd_eapd_verbs, | |
13021 | alc861vd_lenovo_unsol_verbs }, | |
13022 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
13023 | .dac_nids = alc660vd_dac_nids, | |
bdd148a3 KY |
13024 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
13025 | .channel_mode = alc861vd_3stack_2ch_modes, | |
13026 | .input_mux = &alc861vd_capture_source, | |
13027 | .unsol_event = alc861vd_lenovo_unsol_event, | |
13028 | .init_hook = alc861vd_lenovo_automute, | |
13029 | }, | |
272a527c KY |
13030 | [ALC861VD_DALLAS] = { |
13031 | .mixers = { alc861vd_dallas_mixer }, | |
13032 | .init_verbs = { alc861vd_dallas_verbs }, | |
13033 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
13034 | .dac_nids = alc861vd_dac_nids, | |
272a527c KY |
13035 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
13036 | .channel_mode = alc861vd_3stack_2ch_modes, | |
13037 | .input_mux = &alc861vd_dallas_capture_source, | |
13038 | .unsol_event = alc861vd_dallas_unsol_event, | |
13039 | .init_hook = alc861vd_dallas_automute, | |
d1a991a6 KY |
13040 | }, |
13041 | [ALC861VD_HP] = { | |
13042 | .mixers = { alc861vd_hp_mixer }, | |
13043 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
13044 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
13045 | .dac_nids = alc861vd_dac_nids, | |
d1a991a6 | 13046 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
d1a991a6 KY |
13047 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
13048 | .channel_mode = alc861vd_3stack_2ch_modes, | |
13049 | .input_mux = &alc861vd_hp_capture_source, | |
13050 | .unsol_event = alc861vd_dallas_unsol_event, | |
13051 | .init_hook = alc861vd_dallas_automute, | |
13052 | }, | |
f32610ed JS |
13053 | }; |
13054 | ||
13055 | /* | |
13056 | * BIOS auto configuration | |
13057 | */ | |
13058 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | |
13059 | hda_nid_t nid, int pin_type, int dac_idx) | |
13060 | { | |
f6c7e546 | 13061 | alc_set_pin_output(codec, nid, pin_type); |
f32610ed JS |
13062 | } |
13063 | ||
13064 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
13065 | { | |
13066 | struct alc_spec *spec = codec->spec; | |
13067 | int i; | |
13068 | ||
bc9f98a9 | 13069 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
f32610ed JS |
13070 | for (i = 0; i <= HDA_SIDE; i++) { |
13071 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 13072 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
f32610ed JS |
13073 | if (nid) |
13074 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
baba8ee9 | 13075 | pin_type, i); |
f32610ed JS |
13076 | } |
13077 | } | |
13078 | ||
13079 | ||
13080 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
13081 | { | |
13082 | struct alc_spec *spec = codec->spec; | |
13083 | hda_nid_t pin; | |
13084 | ||
13085 | pin = spec->autocfg.hp_pins[0]; | |
13086 | if (pin) /* connect to front and use dac 0 */ | |
13087 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
13088 | pin = spec->autocfg.speaker_pins[0]; |
13089 | if (pin) | |
13090 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
f32610ed JS |
13091 | } |
13092 | ||
13093 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) | |
13094 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | |
13095 | ||
13096 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
13097 | { | |
13098 | struct alc_spec *spec = codec->spec; | |
13099 | int i; | |
13100 | ||
13101 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
13102 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
13103 | if (alc861vd_is_input_pin(nid)) { | |
13104 | snd_hda_codec_write(codec, nid, 0, | |
13105 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
13106 | i <= AUTO_PIN_FRONT_MIC ? | |
13107 | PIN_VREF80 : PIN_IN); | |
13108 | if (nid != ALC861VD_PIN_CD_NID) | |
13109 | snd_hda_codec_write(codec, nid, 0, | |
13110 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13111 | AMP_OUT_MUTE); | |
13112 | } | |
13113 | } | |
13114 | } | |
13115 | ||
13116 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) | |
13117 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
13118 | ||
13119 | /* add playback controls from the parsed DAC table */ | |
13120 | /* Based on ALC880 version. But ALC861VD has separate, | |
13121 | * different NIDs for mute/unmute switch and volume control */ | |
13122 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
13123 | const struct auto_pin_cfg *cfg) | |
13124 | { | |
13125 | char name[32]; | |
13126 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; | |
13127 | hda_nid_t nid_v, nid_s; | |
13128 | int i, err; | |
13129 | ||
13130 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 13131 | if (!spec->multiout.dac_nids[i]) |
f32610ed JS |
13132 | continue; |
13133 | nid_v = alc861vd_idx_to_mixer_vol( | |
13134 | alc880_dac_to_idx( | |
13135 | spec->multiout.dac_nids[i])); | |
13136 | nid_s = alc861vd_idx_to_mixer_switch( | |
13137 | alc880_dac_to_idx( | |
13138 | spec->multiout.dac_nids[i])); | |
13139 | ||
13140 | if (i == 2) { | |
13141 | /* Center/LFE */ | |
f12ab1e0 TI |
13142 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
13143 | "Center Playback Volume", | |
13144 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, | |
13145 | HDA_OUTPUT)); | |
13146 | if (err < 0) | |
f32610ed | 13147 | return err; |
f12ab1e0 TI |
13148 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
13149 | "LFE Playback Volume", | |
13150 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, | |
13151 | HDA_OUTPUT)); | |
13152 | if (err < 0) | |
f32610ed | 13153 | return err; |
f12ab1e0 TI |
13154 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
13155 | "Center Playback Switch", | |
13156 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, | |
13157 | HDA_INPUT)); | |
13158 | if (err < 0) | |
f32610ed | 13159 | return err; |
f12ab1e0 TI |
13160 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
13161 | "LFE Playback Switch", | |
13162 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, | |
13163 | HDA_INPUT)); | |
13164 | if (err < 0) | |
f32610ed JS |
13165 | return err; |
13166 | } else { | |
13167 | sprintf(name, "%s Playback Volume", chname[i]); | |
f12ab1e0 TI |
13168 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
13169 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | |
13170 | HDA_OUTPUT)); | |
13171 | if (err < 0) | |
f32610ed JS |
13172 | return err; |
13173 | sprintf(name, "%s Playback Switch", chname[i]); | |
f12ab1e0 | 13174 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
bdd148a3 | 13175 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
f12ab1e0 TI |
13176 | HDA_INPUT)); |
13177 | if (err < 0) | |
f32610ed JS |
13178 | return err; |
13179 | } | |
13180 | } | |
13181 | return 0; | |
13182 | } | |
13183 | ||
13184 | /* add playback controls for speaker and HP outputs */ | |
13185 | /* Based on ALC880 version. But ALC861VD has separate, | |
13186 | * different NIDs for mute/unmute switch and volume control */ | |
13187 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
13188 | hda_nid_t pin, const char *pfx) | |
13189 | { | |
13190 | hda_nid_t nid_v, nid_s; | |
13191 | int err; | |
13192 | char name[32]; | |
13193 | ||
f12ab1e0 | 13194 | if (!pin) |
f32610ed JS |
13195 | return 0; |
13196 | ||
13197 | if (alc880_is_fixed_pin(pin)) { | |
13198 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
13199 | /* specify the DAC as the extra output */ | |
f12ab1e0 | 13200 | if (!spec->multiout.hp_nid) |
f32610ed JS |
13201 | spec->multiout.hp_nid = nid_v; |
13202 | else | |
13203 | spec->multiout.extra_out_nid[0] = nid_v; | |
13204 | /* control HP volume/switch on the output mixer amp */ | |
13205 | nid_v = alc861vd_idx_to_mixer_vol( | |
13206 | alc880_fixed_pin_idx(pin)); | |
13207 | nid_s = alc861vd_idx_to_mixer_switch( | |
13208 | alc880_fixed_pin_idx(pin)); | |
13209 | ||
13210 | sprintf(name, "%s Playback Volume", pfx); | |
f12ab1e0 TI |
13211 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
13212 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); | |
13213 | if (err < 0) | |
f32610ed JS |
13214 | return err; |
13215 | sprintf(name, "%s Playback Switch", pfx); | |
f12ab1e0 TI |
13216 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
13217 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); | |
13218 | if (err < 0) | |
f32610ed JS |
13219 | return err; |
13220 | } else if (alc880_is_multi_pin(pin)) { | |
13221 | /* set manual connection */ | |
13222 | /* we have only a switch on HP-out PIN */ | |
13223 | sprintf(name, "%s Playback Switch", pfx); | |
f12ab1e0 TI |
13224 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
13225 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
13226 | if (err < 0) | |
f32610ed JS |
13227 | return err; |
13228 | } | |
13229 | return 0; | |
13230 | } | |
13231 | ||
13232 | /* parse the BIOS configuration and set up the alc_spec | |
13233 | * return 1 if successful, 0 if the proper config is not found, | |
13234 | * or a negative error code | |
13235 | * Based on ALC880 version - had to change it to override | |
13236 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
13237 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
13238 | { | |
13239 | struct alc_spec *spec = codec->spec; | |
13240 | int err; | |
13241 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
13242 | ||
f12ab1e0 TI |
13243 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
13244 | alc861vd_ignore); | |
13245 | if (err < 0) | |
f32610ed | 13246 | return err; |
f12ab1e0 | 13247 | if (!spec->autocfg.line_outs) |
f32610ed JS |
13248 | return 0; /* can't find valid BIOS pin config */ |
13249 | ||
f12ab1e0 TI |
13250 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
13251 | if (err < 0) | |
13252 | return err; | |
13253 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
13254 | if (err < 0) | |
13255 | return err; | |
13256 | err = alc861vd_auto_create_extra_out(spec, | |
13257 | spec->autocfg.speaker_pins[0], | |
13258 | "Speaker"); | |
13259 | if (err < 0) | |
13260 | return err; | |
13261 | err = alc861vd_auto_create_extra_out(spec, | |
13262 | spec->autocfg.hp_pins[0], | |
13263 | "Headphone"); | |
13264 | if (err < 0) | |
13265 | return err; | |
13266 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
13267 | if (err < 0) | |
f32610ed JS |
13268 | return err; |
13269 | ||
13270 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
13271 | ||
13272 | if (spec->autocfg.dig_out_pin) | |
13273 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; | |
13274 | ||
13275 | if (spec->kctl_alloc) | |
13276 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
13277 | ||
13278 | spec->init_verbs[spec->num_init_verbs++] | |
13279 | = alc861vd_volume_init_verbs; | |
13280 | ||
13281 | spec->num_mux_defs = 1; | |
13282 | spec->input_mux = &spec->private_imux; | |
13283 | ||
776e184e TI |
13284 | err = alc_auto_add_mic_boost(codec); |
13285 | if (err < 0) | |
13286 | return err; | |
13287 | ||
f32610ed JS |
13288 | return 1; |
13289 | } | |
13290 | ||
13291 | /* additional initialization for auto-configuration model */ | |
13292 | static void alc861vd_auto_init(struct hda_codec *codec) | |
13293 | { | |
f6c7e546 | 13294 | struct alc_spec *spec = codec->spec; |
f32610ed JS |
13295 | alc861vd_auto_init_multi_out(codec); |
13296 | alc861vd_auto_init_hp_out(codec); | |
13297 | alc861vd_auto_init_analog_input(codec); | |
f6c7e546 TI |
13298 | if (spec->unsol_event) |
13299 | alc_sku_automute(codec); | |
f32610ed JS |
13300 | } |
13301 | ||
13302 | static int patch_alc861vd(struct hda_codec *codec) | |
13303 | { | |
13304 | struct alc_spec *spec; | |
13305 | int err, board_config; | |
13306 | ||
13307 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
13308 | if (spec == NULL) | |
13309 | return -ENOMEM; | |
13310 | ||
13311 | codec->spec = spec; | |
13312 | ||
13313 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
13314 | alc861vd_models, | |
13315 | alc861vd_cfg_tbl); | |
13316 | ||
13317 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
13318 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" | |
13319 | "ALC861VD, trying auto-probe from BIOS...\n"); | |
13320 | board_config = ALC861VD_AUTO; | |
13321 | } | |
13322 | ||
13323 | if (board_config == ALC861VD_AUTO) { | |
13324 | /* automatic parse from the BIOS config */ | |
13325 | err = alc861vd_parse_auto_config(codec); | |
13326 | if (err < 0) { | |
13327 | alc_free(codec); | |
13328 | return err; | |
f12ab1e0 | 13329 | } else if (!err) { |
f32610ed JS |
13330 | printk(KERN_INFO |
13331 | "hda_codec: Cannot set up configuration " | |
13332 | "from BIOS. Using base mode...\n"); | |
13333 | board_config = ALC861VD_3ST; | |
13334 | } | |
13335 | } | |
13336 | ||
13337 | if (board_config != ALC861VD_AUTO) | |
13338 | setup_preset(spec, &alc861vd_presets[board_config]); | |
13339 | ||
2f893286 KY |
13340 | if (codec->vendor_id == 0x10ec0660) { |
13341 | spec->stream_name_analog = "ALC660-VD Analog"; | |
13342 | spec->stream_name_digital = "ALC660-VD Digital"; | |
f9423e7a KY |
13343 | /* always turn on EAPD */ |
13344 | spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; | |
2f893286 KY |
13345 | } else { |
13346 | spec->stream_name_analog = "ALC861VD Analog"; | |
13347 | spec->stream_name_digital = "ALC861VD Digital"; | |
13348 | } | |
13349 | ||
f32610ed JS |
13350 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
13351 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
13352 | ||
f32610ed JS |
13353 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
13354 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
13355 | ||
13356 | spec->adc_nids = alc861vd_adc_nids; | |
13357 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
e1406348 | 13358 | spec->capsrc_nids = alc861vd_capsrc_nids; |
f32610ed JS |
13359 | |
13360 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; | |
13361 | spec->num_mixers++; | |
13362 | ||
2134ea4f TI |
13363 | spec->vmaster_nid = 0x02; |
13364 | ||
f32610ed JS |
13365 | codec->patch_ops = alc_patch_ops; |
13366 | ||
13367 | if (board_config == ALC861VD_AUTO) | |
13368 | spec->init_hook = alc861vd_auto_init; | |
cb53c626 TI |
13369 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
13370 | if (!spec->loopback.amplist) | |
13371 | spec->loopback.amplist = alc861vd_loopbacks; | |
13372 | #endif | |
f32610ed JS |
13373 | |
13374 | return 0; | |
13375 | } | |
13376 | ||
bc9f98a9 KY |
13377 | /* |
13378 | * ALC662 support | |
13379 | * | |
13380 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
13381 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
13382 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
13383 | * 6-channel independent captures. | |
13384 | * | |
13385 | * In addition, an independent DAC for the multi-playback (not used in this | |
13386 | * driver yet). | |
13387 | */ | |
13388 | #define ALC662_DIGOUT_NID 0x06 | |
13389 | #define ALC662_DIGIN_NID 0x0a | |
13390 | ||
13391 | static hda_nid_t alc662_dac_nids[4] = { | |
13392 | /* front, rear, clfe, rear_surr */ | |
13393 | 0x02, 0x03, 0x04 | |
13394 | }; | |
13395 | ||
13396 | static hda_nid_t alc662_adc_nids[1] = { | |
13397 | /* ADC1-2 */ | |
13398 | 0x09, | |
13399 | }; | |
e1406348 | 13400 | |
77a261b7 | 13401 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
e1406348 | 13402 | |
bc9f98a9 KY |
13403 | /* input MUX */ |
13404 | /* FIXME: should be a matrix-type input source selection */ | |
bc9f98a9 KY |
13405 | static struct hda_input_mux alc662_capture_source = { |
13406 | .num_items = 4, | |
13407 | .items = { | |
13408 | { "Mic", 0x0 }, | |
13409 | { "Front Mic", 0x1 }, | |
13410 | { "Line", 0x2 }, | |
13411 | { "CD", 0x4 }, | |
13412 | }, | |
13413 | }; | |
13414 | ||
13415 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
13416 | .num_items = 2, | |
13417 | .items = { | |
13418 | { "Mic", 0x1 }, | |
13419 | { "Line", 0x2 }, | |
13420 | }, | |
13421 | }; | |
291702f0 KY |
13422 | |
13423 | static struct hda_input_mux alc662_eeepc_capture_source = { | |
13424 | .num_items = 2, | |
13425 | .items = { | |
13426 | { "i-Mic", 0x1 }, | |
13427 | { "e-Mic", 0x0 }, | |
13428 | }, | |
13429 | }; | |
13430 | ||
6dda9f4a KY |
13431 | static struct hda_input_mux alc663_capture_source = { |
13432 | .num_items = 3, | |
13433 | .items = { | |
13434 | { "Mic", 0x0 }, | |
13435 | { "Front Mic", 0x1 }, | |
13436 | { "Line", 0x2 }, | |
13437 | }, | |
13438 | }; | |
13439 | ||
13440 | static struct hda_input_mux alc663_m51va_capture_source = { | |
13441 | .num_items = 2, | |
13442 | .items = { | |
13443 | { "Ext-Mic", 0x0 }, | |
13444 | { "D-Mic", 0x9 }, | |
13445 | }, | |
13446 | }; | |
13447 | ||
bc9f98a9 KY |
13448 | #define alc662_mux_enum_info alc_mux_enum_info |
13449 | #define alc662_mux_enum_get alc_mux_enum_get | |
e1406348 | 13450 | #define alc662_mux_enum_put alc882_mux_enum_put |
bc9f98a9 | 13451 | |
bc9f98a9 KY |
13452 | /* |
13453 | * 2ch mode | |
13454 | */ | |
13455 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
13456 | { 2, NULL } | |
13457 | }; | |
13458 | ||
13459 | /* | |
13460 | * 2ch mode | |
13461 | */ | |
13462 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
13463 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
13464 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
13465 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
13466 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
13467 | { } /* end */ | |
13468 | }; | |
13469 | ||
13470 | /* | |
13471 | * 6ch mode | |
13472 | */ | |
13473 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
13474 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13475 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
13476 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
13477 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13478 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
13479 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
13480 | { } /* end */ | |
13481 | }; | |
13482 | ||
13483 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
13484 | { 2, alc662_3ST_ch2_init }, | |
13485 | { 6, alc662_3ST_ch6_init }, | |
13486 | }; | |
13487 | ||
13488 | /* | |
13489 | * 2ch mode | |
13490 | */ | |
13491 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
13492 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
13493 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
13494 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13495 | { } /* end */ | |
13496 | }; | |
13497 | ||
13498 | /* | |
13499 | * 6ch mode | |
13500 | */ | |
13501 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
13502 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13503 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13504 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13505 | { } /* end */ | |
13506 | }; | |
13507 | ||
13508 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
13509 | { 2, alc662_sixstack_ch6_init }, | |
13510 | { 6, alc662_sixstack_ch8_init }, | |
13511 | }; | |
13512 | ||
13513 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
13514 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
13515 | */ | |
13516 | ||
13517 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
13518 | /* output mixer control */ | |
13519 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
7055ad8a | 13520 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 13521 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
7055ad8a | 13522 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
13523 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
13524 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
13525 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
13526 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
13527 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
13528 | ||
13529 | /*Input mixer control */ | |
13530 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
13531 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
13532 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
13533 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
13534 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
13535 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
13536 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
13537 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
bc9f98a9 KY |
13538 | { } /* end */ |
13539 | }; | |
13540 | ||
13541 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
13542 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 13543 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 KY |
13544 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
13545 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
13546 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
13547 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13548 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13549 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13550 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13551 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13552 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13553 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
13554 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
bc9f98a9 KY |
13555 | { } /* end */ |
13556 | }; | |
13557 | ||
13558 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
13559 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 13560 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 13561 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
7055ad8a | 13562 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
13563 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
13564 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
13565 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
13566 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
13567 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
13568 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
13569 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
13570 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13571 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13574 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13575 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13576 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
13577 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
bc9f98a9 KY |
13578 | { } /* end */ |
13579 | }; | |
13580 | ||
13581 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
13582 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13583 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
86cd9298 TI |
13584 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
13585 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
bc9f98a9 KY |
13586 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
13587 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13588 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13589 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13590 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
13591 | { } /* end */ |
13592 | }; | |
13593 | ||
291702f0 | 13594 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
86cd9298 | 13595 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
291702f0 | 13596 | |
b4818494 HRK |
13597 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
13598 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
291702f0 KY |
13599 | |
13600 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | |
13601 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13602 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13603 | ||
13604 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
13605 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13606 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13607 | { } /* end */ | |
13608 | }; | |
13609 | ||
8c427226 | 13610 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
31bffaa9 TI |
13611 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
13612 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8c427226 KY |
13613 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
13614 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), | |
13615 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
13616 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
13617 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), | |
13618 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), | |
86cd9298 | 13619 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8c427226 KY |
13620 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
13621 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13622 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13624 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13625 | { } /* end */ | |
13626 | }; | |
13627 | ||
6dda9f4a KY |
13628 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
13629 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13630 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13631 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
13632 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13633 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13634 | HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), | |
13635 | { } /* end */ | |
13636 | }; | |
13637 | ||
13638 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
13639 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13640 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13641 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13642 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13643 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
13644 | ||
13645 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13646 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13647 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13648 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13649 | { } /* end */ | |
13650 | }; | |
13651 | ||
13652 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
13653 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13654 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13655 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
13656 | ||
13657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13658 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13659 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13660 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13661 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13662 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13663 | { } /* end */ | |
13664 | }; | |
13665 | ||
bc9f98a9 KY |
13666 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
13667 | { | |
13668 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13669 | .name = "Channel Mode", | |
13670 | .info = alc_ch_mode_info, | |
13671 | .get = alc_ch_mode_get, | |
13672 | .put = alc_ch_mode_put, | |
13673 | }, | |
13674 | { } /* end */ | |
13675 | }; | |
13676 | ||
13677 | static struct hda_verb alc662_init_verbs[] = { | |
13678 | /* ADC: mute amp left and right */ | |
13679 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13680 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13681 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
13682 | ||
cb53c626 TI |
13683 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13684 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13685 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
13686 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
13687 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
bc9f98a9 | 13688 | |
b60dd394 KY |
13689 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
13690 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13691 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13692 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13693 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13694 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
13695 | |
13696 | /* Front Pin: output 0 (0x0c) */ | |
13697 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13698 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13699 | ||
13700 | /* Rear Pin: output 1 (0x0d) */ | |
13701 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13702 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13703 | ||
13704 | /* CLFE Pin: output 2 (0x0e) */ | |
13705 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13706 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13707 | ||
13708 | /* Mic (rear) pin: input vref at 80% */ | |
13709 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13710 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13711 | /* Front Mic pin: input vref at 80% */ | |
13712 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13713 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13714 | /* Line In pin: input */ | |
13715 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13716 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13717 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
13718 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13719 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13720 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13721 | /* CD pin widget for input */ | |
13722 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13723 | ||
13724 | /* FIXME: use matrix-type input source selection */ | |
13725 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
13726 | /* Input mixer */ | |
13727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
13730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
291702f0 KY |
13731 | |
13732 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13733 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13734 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
13735 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
6dda9f4a KY |
13736 | |
13737 | /* always trun on EAPD */ | |
13738 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13739 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13740 | ||
bc9f98a9 KY |
13741 | { } |
13742 | }; | |
13743 | ||
13744 | static struct hda_verb alc662_sue_init_verbs[] = { | |
13745 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
13746 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
291702f0 KY |
13747 | {} |
13748 | }; | |
13749 | ||
13750 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
13751 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13752 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
13753 | {} | |
bc9f98a9 KY |
13754 | }; |
13755 | ||
8c427226 KY |
13756 | /* Set Unsolicited Event*/ |
13757 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
13758 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13759 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
13760 | {} | |
13761 | }; | |
13762 | ||
bc9f98a9 KY |
13763 | /* |
13764 | * generic initialization of ADC, input mixers and output mixers | |
13765 | */ | |
13766 | static struct hda_verb alc662_auto_init_verbs[] = { | |
13767 | /* | |
13768 | * Unmute ADC and set the default input to mic-in | |
13769 | */ | |
13770 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13771 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13772 | ||
13773 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
13774 | * mixer widget | |
13775 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
13776 | * panel mic (mic 2) | |
13777 | */ | |
13778 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
13779 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13780 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13781 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
13782 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
13783 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
bc9f98a9 KY |
13784 | |
13785 | /* | |
13786 | * Set up output mixers (0x0c - 0x0f) | |
13787 | */ | |
13788 | /* set vol=0 to output mixers */ | |
13789 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13790 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13791 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13792 | ||
13793 | /* set up input amps for analog loopback */ | |
13794 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
b60dd394 KY |
13795 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
13796 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13797 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13798 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13799 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13800 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
13801 | |
13802 | ||
13803 | /* FIXME: use matrix-type input source selection */ | |
13804 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
13805 | /* Input mixer */ | |
13806 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
d1a991a6 | 13807 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
bc9f98a9 KY |
13808 | { } |
13809 | }; | |
13810 | ||
6dda9f4a KY |
13811 | static struct hda_verb alc663_m51va_init_verbs[] = { |
13812 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13813 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13814 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
13815 | ||
13816 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
13817 | ||
13818 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13819 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
13820 | {} | |
13821 | }; | |
13822 | ||
13823 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
13824 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13825 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
13826 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
13827 | ||
13828 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13829 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13830 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
13831 | ||
13832 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
13833 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
13834 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
13835 | {} | |
13836 | }; | |
13837 | ||
13838 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
13839 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13840 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13841 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
13842 | ||
13843 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13844 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
13845 | {} | |
13846 | }; | |
13847 | ||
bc9f98a9 KY |
13848 | /* capture mixer elements */ |
13849 | static struct snd_kcontrol_new alc662_capture_mixer[] = { | |
13850 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
13851 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
13852 | { | |
13853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13854 | /* The multiple "Capture Source" controls confuse alsamixer | |
13855 | * So call somewhat different.. | |
bc9f98a9 KY |
13856 | */ |
13857 | /* .name = "Capture Source", */ | |
13858 | .name = "Input Source", | |
13859 | .count = 1, | |
6e7939bb HRK |
13860 | .info = alc662_mux_enum_info, |
13861 | .get = alc662_mux_enum_get, | |
13862 | .put = alc662_mux_enum_put, | |
bc9f98a9 KY |
13863 | }, |
13864 | { } /* end */ | |
13865 | }; | |
13866 | ||
13867 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | |
13868 | { | |
13869 | unsigned int present; | |
f12ab1e0 | 13870 | unsigned char bits; |
bc9f98a9 KY |
13871 | |
13872 | present = snd_hda_codec_read(codec, 0x14, 0, | |
13873 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
13874 | bits = present ? HDA_AMP_MUTE : 0; |
13875 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
13876 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
13877 | } |
13878 | ||
13879 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
13880 | { | |
13881 | unsigned int present; | |
f12ab1e0 | 13882 | unsigned char bits; |
bc9f98a9 KY |
13883 | |
13884 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
13885 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
13886 | bits = present ? HDA_AMP_MUTE : 0; |
13887 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
13888 | HDA_AMP_MUTE, bits); | |
13889 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
13890 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
13891 | } |
13892 | ||
13893 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
13894 | unsigned int res) | |
13895 | { | |
13896 | if ((res >> 26) == ALC880_HP_EVENT) | |
13897 | alc662_lenovo_101e_all_automute(codec); | |
13898 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
13899 | alc662_lenovo_101e_ispeaker_automute(codec); | |
13900 | } | |
13901 | ||
291702f0 KY |
13902 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
13903 | { | |
13904 | unsigned int present; | |
13905 | ||
13906 | present = snd_hda_codec_read(codec, 0x18, 0, | |
13907 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
13908 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13909 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
13910 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13911 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
13912 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13913 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
13914 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13915 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
13916 | } | |
13917 | ||
13918 | /* unsolicited event for HP jack sensing */ | |
13919 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
13920 | unsigned int res) | |
13921 | { | |
13922 | if ((res >> 26) == ALC880_HP_EVENT) | |
13923 | alc262_hippo1_automute( codec ); | |
13924 | ||
13925 | if ((res >> 26) == ALC880_MIC_EVENT) | |
13926 | alc662_eeepc_mic_automute(codec); | |
13927 | } | |
13928 | ||
13929 | static void alc662_eeepc_inithook(struct hda_codec *codec) | |
13930 | { | |
13931 | alc262_hippo1_automute( codec ); | |
13932 | alc662_eeepc_mic_automute(codec); | |
13933 | } | |
13934 | ||
8c427226 KY |
13935 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
13936 | { | |
13937 | unsigned int mute; | |
13938 | unsigned int present; | |
13939 | ||
13940 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); | |
13941 | present = snd_hda_codec_read(codec, 0x14, 0, | |
13942 | AC_VERB_GET_PIN_SENSE, 0); | |
13943 | present = (present & 0x80000000) != 0; | |
13944 | if (present) { | |
13945 | /* mute internal speaker */ | |
13946 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
13947 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
13948 | } else { | |
13949 | /* unmute internal speaker if necessary */ | |
13950 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
13951 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
13952 | HDA_AMP_MUTE, mute); | |
13953 | } | |
13954 | } | |
13955 | ||
13956 | /* unsolicited event for HP jack sensing */ | |
13957 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, | |
13958 | unsigned int res) | |
13959 | { | |
13960 | if ((res >> 26) == ALC880_HP_EVENT) | |
13961 | alc662_eeepc_ep20_automute(codec); | |
13962 | } | |
13963 | ||
13964 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) | |
13965 | { | |
13966 | alc662_eeepc_ep20_automute(codec); | |
13967 | } | |
13968 | ||
6dda9f4a KY |
13969 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
13970 | { | |
13971 | unsigned int present; | |
13972 | unsigned char bits; | |
13973 | ||
13974 | present = snd_hda_codec_read(codec, 0x21, 0, | |
13975 | AC_VERB_GET_PIN_SENSE, 0) | |
13976 | & AC_PINSENSE_PRESENCE; | |
13977 | bits = present ? HDA_AMP_MUTE : 0; | |
13978 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
13979 | HDA_AMP_MUTE, bits); | |
13980 | } | |
13981 | ||
13982 | static void alc663_m51va_mic_automute(struct hda_codec *codec) | |
13983 | { | |
13984 | unsigned int present; | |
13985 | ||
13986 | present = snd_hda_codec_read(codec, 0x18, 0, | |
13987 | AC_VERB_GET_PIN_SENSE, 0) | |
13988 | & AC_PINSENSE_PRESENCE; | |
13989 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13990 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
13991 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13992 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
13993 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13994 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | |
13995 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13996 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | |
13997 | } | |
13998 | ||
13999 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | |
14000 | unsigned int res) | |
14001 | { | |
14002 | switch (res >> 26) { | |
14003 | case ALC880_HP_EVENT: | |
14004 | alc663_m51va_speaker_automute(codec); | |
14005 | break; | |
14006 | case ALC880_MIC_EVENT: | |
14007 | alc663_m51va_mic_automute(codec); | |
14008 | break; | |
14009 | } | |
14010 | } | |
14011 | ||
14012 | static void alc663_m51va_inithook(struct hda_codec *codec) | |
14013 | { | |
14014 | alc663_m51va_speaker_automute(codec); | |
14015 | alc663_m51va_mic_automute(codec); | |
14016 | } | |
14017 | ||
14018 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | |
14019 | { | |
14020 | unsigned int present; | |
14021 | unsigned char bits; | |
14022 | ||
14023 | present = snd_hda_codec_read(codec, 0x21, 0, | |
14024 | AC_VERB_GET_PIN_SENSE, 0) | |
14025 | & AC_PINSENSE_PRESENCE; | |
14026 | bits = present ? HDA_AMP_MUTE : 0; | |
14027 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
14028 | HDA_AMP_MUTE, bits); | |
14029 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
14030 | HDA_AMP_MUTE, bits); | |
14031 | } | |
14032 | ||
14033 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
14034 | { | |
14035 | unsigned int present; | |
14036 | unsigned char bits; | |
14037 | ||
14038 | present = snd_hda_codec_read(codec, 0x15, 0, | |
14039 | AC_VERB_GET_PIN_SENSE, 0) | |
14040 | & AC_PINSENSE_PRESENCE; | |
14041 | bits = present ? HDA_AMP_MUTE : 0; | |
14042 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
14043 | HDA_AMP_MUTE, bits); | |
14044 | } | |
14045 | ||
14046 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
14047 | unsigned int res) | |
14048 | { | |
14049 | switch (res >> 26) { | |
14050 | case ALC880_HP_EVENT: | |
14051 | alc663_g71v_hp_automute(codec); | |
14052 | break; | |
14053 | case ALC880_FRONT_EVENT: | |
14054 | alc663_g71v_front_automute(codec); | |
14055 | break; | |
14056 | case ALC880_MIC_EVENT: | |
14057 | alc662_eeepc_mic_automute(codec); | |
14058 | break; | |
14059 | } | |
14060 | } | |
14061 | ||
14062 | static void alc663_g71v_inithook(struct hda_codec *codec) | |
14063 | { | |
14064 | alc663_g71v_front_automute(codec); | |
14065 | alc663_g71v_hp_automute(codec); | |
14066 | alc662_eeepc_mic_automute(codec); | |
14067 | } | |
14068 | ||
14069 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
14070 | unsigned int res) | |
14071 | { | |
14072 | switch (res >> 26) { | |
14073 | case ALC880_HP_EVENT: | |
14074 | alc663_m51va_speaker_automute(codec); | |
14075 | break; | |
14076 | case ALC880_MIC_EVENT: | |
14077 | alc662_eeepc_mic_automute(codec); | |
14078 | break; | |
14079 | } | |
14080 | } | |
14081 | ||
14082 | static void alc663_g50v_inithook(struct hda_codec *codec) | |
14083 | { | |
14084 | alc663_m51va_speaker_automute(codec); | |
14085 | alc662_eeepc_mic_automute(codec); | |
14086 | } | |
14087 | ||
cb53c626 TI |
14088 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14089 | #define alc662_loopbacks alc880_loopbacks | |
14090 | #endif | |
14091 | ||
bc9f98a9 KY |
14092 | |
14093 | /* pcm configuration: identiacal with ALC880 */ | |
14094 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback | |
14095 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
14096 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
14097 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
14098 | ||
14099 | /* | |
14100 | * configuration and preset | |
14101 | */ | |
14102 | static const char *alc662_models[ALC662_MODEL_LAST] = { | |
14103 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
14104 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
14105 | [ALC662_3ST_6ch] = "3stack-6ch", | |
14106 | [ALC662_5ST_DIG] = "6stack-dig", | |
14107 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
b995d76d | 14108 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
8c427226 | 14109 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
6dda9f4a KY |
14110 | [ALC663_ASUS_M51VA] = "m51va", |
14111 | [ALC663_ASUS_G71V] = "g71v", | |
14112 | [ALC663_ASUS_H13] = "h13", | |
14113 | [ALC663_ASUS_G50V] = "g50v", | |
bc9f98a9 KY |
14114 | [ALC662_AUTO] = "auto", |
14115 | }; | |
14116 | ||
14117 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
6dda9f4a KY |
14118 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V), |
14119 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | |
14120 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), | |
3da23cac | 14121 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
291702f0 | 14122 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
8c427226 | 14123 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
ac3e3741 | 14124 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
6dda9f4a KY |
14125 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
14126 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), | |
14127 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), | |
bc9f98a9 KY |
14128 | {} |
14129 | }; | |
14130 | ||
14131 | static struct alc_config_preset alc662_presets[] = { | |
14132 | [ALC662_3ST_2ch_DIG] = { | |
291702f0 | 14133 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
bc9f98a9 KY |
14134 | .init_verbs = { alc662_init_verbs }, |
14135 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14136 | .dac_nids = alc662_dac_nids, | |
14137 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
14138 | .dig_in_nid = ALC662_DIGIN_NID, |
14139 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
14140 | .channel_mode = alc662_3ST_2ch_modes, | |
14141 | .input_mux = &alc662_capture_source, | |
14142 | }, | |
14143 | [ALC662_3ST_6ch_DIG] = { | |
291702f0 KY |
14144 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
14145 | alc662_capture_mixer }, | |
bc9f98a9 KY |
14146 | .init_verbs = { alc662_init_verbs }, |
14147 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14148 | .dac_nids = alc662_dac_nids, | |
14149 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
14150 | .dig_in_nid = ALC662_DIGIN_NID, |
14151 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
14152 | .channel_mode = alc662_3ST_6ch_modes, | |
14153 | .need_dac_fix = 1, | |
14154 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 14155 | }, |
bc9f98a9 | 14156 | [ALC662_3ST_6ch] = { |
291702f0 KY |
14157 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
14158 | alc662_capture_mixer }, | |
bc9f98a9 KY |
14159 | .init_verbs = { alc662_init_verbs }, |
14160 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14161 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
14162 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
14163 | .channel_mode = alc662_3ST_6ch_modes, | |
14164 | .need_dac_fix = 1, | |
14165 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 14166 | }, |
bc9f98a9 | 14167 | [ALC662_5ST_DIG] = { |
291702f0 KY |
14168 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
14169 | alc662_capture_mixer }, | |
bc9f98a9 KY |
14170 | .init_verbs = { alc662_init_verbs }, |
14171 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14172 | .dac_nids = alc662_dac_nids, | |
14173 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
14174 | .dig_in_nid = ALC662_DIGIN_NID, |
14175 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
14176 | .channel_mode = alc662_5stack_modes, | |
14177 | .input_mux = &alc662_capture_source, | |
14178 | }, | |
14179 | [ALC662_LENOVO_101E] = { | |
291702f0 | 14180 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
bc9f98a9 KY |
14181 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
14182 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14183 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
14184 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
14185 | .channel_mode = alc662_3ST_2ch_modes, | |
14186 | .input_mux = &alc662_lenovo_101e_capture_source, | |
14187 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
14188 | .init_hook = alc662_lenovo_101e_all_automute, | |
14189 | }, | |
291702f0 KY |
14190 | [ALC662_ASUS_EEEPC_P701] = { |
14191 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, | |
14192 | .init_verbs = { alc662_init_verbs, | |
14193 | alc662_eeepc_sue_init_verbs }, | |
14194 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14195 | .dac_nids = alc662_dac_nids, | |
291702f0 KY |
14196 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
14197 | .channel_mode = alc662_3ST_2ch_modes, | |
14198 | .input_mux = &alc662_eeepc_capture_source, | |
14199 | .unsol_event = alc662_eeepc_unsol_event, | |
14200 | .init_hook = alc662_eeepc_inithook, | |
14201 | }, | |
8c427226 KY |
14202 | [ALC662_ASUS_EEEPC_EP20] = { |
14203 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, | |
14204 | alc662_chmode_mixer }, | |
14205 | .init_verbs = { alc662_init_verbs, | |
14206 | alc662_eeepc_ep20_sue_init_verbs }, | |
14207 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14208 | .dac_nids = alc662_dac_nids, | |
8c427226 KY |
14209 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
14210 | .channel_mode = alc662_3ST_6ch_modes, | |
14211 | .input_mux = &alc662_lenovo_101e_capture_source, | |
14212 | .unsol_event = alc662_eeepc_ep20_unsol_event, | |
14213 | .init_hook = alc662_eeepc_ep20_inithook, | |
14214 | }, | |
6dda9f4a KY |
14215 | [ALC663_ASUS_M51VA] = { |
14216 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, | |
14217 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
14218 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14219 | .dac_nids = alc662_dac_nids, | |
14220 | .dig_out_nid = ALC662_DIGOUT_NID, | |
14221 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
14222 | .channel_mode = alc662_3ST_2ch_modes, | |
14223 | .input_mux = &alc663_m51va_capture_source, | |
14224 | .unsol_event = alc663_m51va_unsol_event, | |
14225 | .init_hook = alc663_m51va_inithook, | |
14226 | }, | |
14227 | [ALC663_ASUS_G71V] = { | |
14228 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, | |
14229 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, | |
14230 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14231 | .dac_nids = alc662_dac_nids, | |
14232 | .dig_out_nid = ALC662_DIGOUT_NID, | |
14233 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
14234 | .channel_mode = alc662_3ST_2ch_modes, | |
14235 | .input_mux = &alc662_eeepc_capture_source, | |
14236 | .unsol_event = alc663_g71v_unsol_event, | |
14237 | .init_hook = alc663_g71v_inithook, | |
14238 | }, | |
14239 | [ALC663_ASUS_H13] = { | |
14240 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, | |
14241 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
14242 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14243 | .dac_nids = alc662_dac_nids, | |
14244 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
14245 | .channel_mode = alc662_3ST_2ch_modes, | |
14246 | .input_mux = &alc663_m51va_capture_source, | |
14247 | .unsol_event = alc663_m51va_unsol_event, | |
14248 | .init_hook = alc663_m51va_inithook, | |
14249 | }, | |
14250 | [ALC663_ASUS_G50V] = { | |
14251 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, | |
14252 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, | |
14253 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
14254 | .dac_nids = alc662_dac_nids, | |
14255 | .dig_out_nid = ALC662_DIGOUT_NID, | |
14256 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
14257 | .channel_mode = alc662_3ST_6ch_modes, | |
14258 | .input_mux = &alc663_capture_source, | |
14259 | .unsol_event = alc663_g50v_unsol_event, | |
14260 | .init_hook = alc663_g50v_inithook, | |
14261 | }, | |
bc9f98a9 KY |
14262 | }; |
14263 | ||
14264 | ||
14265 | /* | |
14266 | * BIOS auto configuration | |
14267 | */ | |
14268 | ||
14269 | /* add playback controls from the parsed DAC table */ | |
14270 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |
14271 | const struct auto_pin_cfg *cfg) | |
14272 | { | |
14273 | char name[32]; | |
14274 | static const char *chname[4] = { | |
14275 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
14276 | }; | |
14277 | hda_nid_t nid; | |
14278 | int i, err; | |
14279 | ||
14280 | for (i = 0; i < cfg->line_outs; i++) { | |
14281 | if (!spec->multiout.dac_nids[i]) | |
14282 | continue; | |
b60dd394 | 14283 | nid = alc880_idx_to_dac(i); |
bc9f98a9 KY |
14284 | if (i == 2) { |
14285 | /* Center/LFE */ | |
14286 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
14287 | "Center Playback Volume", | |
f12ab1e0 TI |
14288 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
14289 | HDA_OUTPUT)); | |
bc9f98a9 KY |
14290 | if (err < 0) |
14291 | return err; | |
14292 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
14293 | "LFE Playback Volume", | |
f12ab1e0 TI |
14294 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
14295 | HDA_OUTPUT)); | |
bc9f98a9 KY |
14296 | if (err < 0) |
14297 | return err; | |
14298 | err = add_control(spec, ALC_CTL_BIND_MUTE, | |
14299 | "Center Playback Switch", | |
f12ab1e0 TI |
14300 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
14301 | HDA_INPUT)); | |
bc9f98a9 KY |
14302 | if (err < 0) |
14303 | return err; | |
14304 | err = add_control(spec, ALC_CTL_BIND_MUTE, | |
14305 | "LFE Playback Switch", | |
f12ab1e0 TI |
14306 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
14307 | HDA_INPUT)); | |
bc9f98a9 KY |
14308 | if (err < 0) |
14309 | return err; | |
14310 | } else { | |
14311 | sprintf(name, "%s Playback Volume", chname[i]); | |
14312 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
f12ab1e0 TI |
14313 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
14314 | HDA_OUTPUT)); | |
bc9f98a9 KY |
14315 | if (err < 0) |
14316 | return err; | |
14317 | sprintf(name, "%s Playback Switch", chname[i]); | |
14318 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | |
f12ab1e0 TI |
14319 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
14320 | HDA_INPUT)); | |
bc9f98a9 KY |
14321 | if (err < 0) |
14322 | return err; | |
14323 | } | |
14324 | } | |
14325 | return 0; | |
14326 | } | |
14327 | ||
14328 | /* add playback controls for speaker and HP outputs */ | |
14329 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
14330 | const char *pfx) | |
14331 | { | |
14332 | hda_nid_t nid; | |
14333 | int err; | |
14334 | char name[32]; | |
14335 | ||
14336 | if (!pin) | |
14337 | return 0; | |
14338 | ||
14339 | if (alc880_is_fixed_pin(pin)) { | |
14340 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
14341 | /* printk("DAC nid=%x\n",nid); */ | |
14342 | /* specify the DAC as the extra output */ | |
14343 | if (!spec->multiout.hp_nid) | |
14344 | spec->multiout.hp_nid = nid; | |
14345 | else | |
14346 | spec->multiout.extra_out_nid[0] = nid; | |
14347 | /* control HP volume/switch on the output mixer amp */ | |
14348 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
14349 | sprintf(name, "%s Playback Volume", pfx); | |
14350 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
14351 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
14352 | if (err < 0) | |
14353 | return err; | |
14354 | sprintf(name, "%s Playback Switch", pfx); | |
14355 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | |
14356 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
14357 | if (err < 0) | |
14358 | return err; | |
14359 | } else if (alc880_is_multi_pin(pin)) { | |
14360 | /* set manual connection */ | |
14361 | /* we have only a switch on HP-out PIN */ | |
14362 | sprintf(name, "%s Playback Switch", pfx); | |
14363 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
14364 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
14365 | if (err < 0) | |
14366 | return err; | |
14367 | } | |
14368 | return 0; | |
14369 | } | |
14370 | ||
14371 | /* create playback/capture controls for input pins */ | |
14372 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, | |
14373 | const struct auto_pin_cfg *cfg) | |
14374 | { | |
14375 | struct hda_input_mux *imux = &spec->private_imux; | |
14376 | int i, err, idx; | |
14377 | ||
14378 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
14379 | if (alc880_is_input_pin(cfg->input_pins[i])) { | |
14380 | idx = alc880_input_pin_idx(cfg->input_pins[i]); | |
14381 | err = new_analog_input(spec, cfg->input_pins[i], | |
14382 | auto_pin_cfg_labels[i], | |
14383 | idx, 0x0b); | |
14384 | if (err < 0) | |
14385 | return err; | |
14386 | imux->items[imux->num_items].label = | |
14387 | auto_pin_cfg_labels[i]; | |
14388 | imux->items[imux->num_items].index = | |
14389 | alc880_input_pin_idx(cfg->input_pins[i]); | |
14390 | imux->num_items++; | |
14391 | } | |
14392 | } | |
14393 | return 0; | |
14394 | } | |
14395 | ||
14396 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
14397 | hda_nid_t nid, int pin_type, | |
14398 | int dac_idx) | |
14399 | { | |
f6c7e546 | 14400 | alc_set_pin_output(codec, nid, pin_type); |
bc9f98a9 KY |
14401 | /* need the manual connection? */ |
14402 | if (alc880_is_multi_pin(nid)) { | |
14403 | struct alc_spec *spec = codec->spec; | |
14404 | int idx = alc880_multi_pin_idx(nid); | |
14405 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
14406 | AC_VERB_SET_CONNECT_SEL, | |
14407 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
14408 | } | |
14409 | } | |
14410 | ||
14411 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
14412 | { | |
14413 | struct alc_spec *spec = codec->spec; | |
14414 | int i; | |
14415 | ||
8c427226 | 14416 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
bc9f98a9 KY |
14417 | for (i = 0; i <= HDA_SIDE; i++) { |
14418 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 14419 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
bc9f98a9 | 14420 | if (nid) |
baba8ee9 | 14421 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
bc9f98a9 KY |
14422 | i); |
14423 | } | |
14424 | } | |
14425 | ||
14426 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
14427 | { | |
14428 | struct alc_spec *spec = codec->spec; | |
14429 | hda_nid_t pin; | |
14430 | ||
14431 | pin = spec->autocfg.hp_pins[0]; | |
14432 | if (pin) /* connect to front */ | |
14433 | /* use dac 0 */ | |
14434 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
14435 | pin = spec->autocfg.speaker_pins[0]; |
14436 | if (pin) | |
14437 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
bc9f98a9 KY |
14438 | } |
14439 | ||
14440 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) | |
14441 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | |
14442 | ||
14443 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
14444 | { | |
14445 | struct alc_spec *spec = codec->spec; | |
14446 | int i; | |
14447 | ||
14448 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
14449 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
14450 | if (alc662_is_input_pin(nid)) { | |
14451 | snd_hda_codec_write(codec, nid, 0, | |
14452 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14453 | (i <= AUTO_PIN_FRONT_MIC ? | |
14454 | PIN_VREF80 : PIN_IN)); | |
14455 | if (nid != ALC662_PIN_CD_NID) | |
14456 | snd_hda_codec_write(codec, nid, 0, | |
14457 | AC_VERB_SET_AMP_GAIN_MUTE, | |
14458 | AMP_OUT_MUTE); | |
14459 | } | |
14460 | } | |
14461 | } | |
14462 | ||
14463 | static int alc662_parse_auto_config(struct hda_codec *codec) | |
14464 | { | |
14465 | struct alc_spec *spec = codec->spec; | |
14466 | int err; | |
14467 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
14468 | ||
14469 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
14470 | alc662_ignore); | |
14471 | if (err < 0) | |
14472 | return err; | |
14473 | if (!spec->autocfg.line_outs) | |
14474 | return 0; /* can't find valid BIOS pin config */ | |
14475 | ||
f12ab1e0 TI |
14476 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
14477 | if (err < 0) | |
14478 | return err; | |
14479 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
14480 | if (err < 0) | |
14481 | return err; | |
14482 | err = alc662_auto_create_extra_out(spec, | |
14483 | spec->autocfg.speaker_pins[0], | |
14484 | "Speaker"); | |
14485 | if (err < 0) | |
14486 | return err; | |
14487 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
14488 | "Headphone"); | |
14489 | if (err < 0) | |
14490 | return err; | |
14491 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
14492 | if (err < 0) | |
bc9f98a9 KY |
14493 | return err; |
14494 | ||
14495 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14496 | ||
14497 | if (spec->autocfg.dig_out_pin) | |
14498 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | |
14499 | ||
14500 | if (spec->kctl_alloc) | |
14501 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | |
14502 | ||
14503 | spec->num_mux_defs = 1; | |
14504 | spec->input_mux = &spec->private_imux; | |
14505 | ||
8c87286f | 14506 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
bc9f98a9 KY |
14507 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
14508 | spec->num_mixers++; | |
8c87286f | 14509 | return 1; |
bc9f98a9 KY |
14510 | } |
14511 | ||
14512 | /* additional initialization for auto-configuration model */ | |
14513 | static void alc662_auto_init(struct hda_codec *codec) | |
14514 | { | |
f6c7e546 | 14515 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
14516 | alc662_auto_init_multi_out(codec); |
14517 | alc662_auto_init_hp_out(codec); | |
14518 | alc662_auto_init_analog_input(codec); | |
f6c7e546 TI |
14519 | if (spec->unsol_event) |
14520 | alc_sku_automute(codec); | |
bc9f98a9 KY |
14521 | } |
14522 | ||
14523 | static int patch_alc662(struct hda_codec *codec) | |
14524 | { | |
14525 | struct alc_spec *spec; | |
14526 | int err, board_config; | |
14527 | ||
14528 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
14529 | if (!spec) | |
14530 | return -ENOMEM; | |
14531 | ||
14532 | codec->spec = spec; | |
14533 | ||
14534 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, | |
14535 | alc662_models, | |
14536 | alc662_cfg_tbl); | |
14537 | if (board_config < 0) { | |
14538 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " | |
14539 | "trying auto-probe from BIOS...\n"); | |
14540 | board_config = ALC662_AUTO; | |
14541 | } | |
14542 | ||
14543 | if (board_config == ALC662_AUTO) { | |
14544 | /* automatic parse from the BIOS config */ | |
14545 | err = alc662_parse_auto_config(codec); | |
14546 | if (err < 0) { | |
14547 | alc_free(codec); | |
14548 | return err; | |
8c87286f | 14549 | } else if (!err) { |
bc9f98a9 KY |
14550 | printk(KERN_INFO |
14551 | "hda_codec: Cannot set up configuration " | |
14552 | "from BIOS. Using base mode...\n"); | |
14553 | board_config = ALC662_3ST_2ch_DIG; | |
14554 | } | |
14555 | } | |
14556 | ||
14557 | if (board_config != ALC662_AUTO) | |
14558 | setup_preset(spec, &alc662_presets[board_config]); | |
14559 | ||
6dda9f4a KY |
14560 | if (codec->vendor_id == 0x10ec0663) { |
14561 | spec->stream_name_analog = "ALC663 Analog"; | |
14562 | spec->stream_name_digital = "ALC663 Digital"; | |
14563 | } else { | |
14564 | spec->stream_name_analog = "ALC662 Analog"; | |
14565 | spec->stream_name_digital = "ALC662 Digital"; | |
14566 | } | |
14567 | ||
bc9f98a9 KY |
14568 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
14569 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
14570 | ||
bc9f98a9 KY |
14571 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
14572 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
14573 | ||
e1406348 TI |
14574 | spec->adc_nids = alc662_adc_nids; |
14575 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
14576 | spec->capsrc_nids = alc662_capsrc_nids; | |
bc9f98a9 | 14577 | |
2134ea4f TI |
14578 | spec->vmaster_nid = 0x02; |
14579 | ||
bc9f98a9 KY |
14580 | codec->patch_ops = alc_patch_ops; |
14581 | if (board_config == ALC662_AUTO) | |
14582 | spec->init_hook = alc662_auto_init; | |
cb53c626 TI |
14583 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14584 | if (!spec->loopback.amplist) | |
14585 | spec->loopback.amplist = alc662_loopbacks; | |
14586 | #endif | |
bc9f98a9 KY |
14587 | |
14588 | return 0; | |
14589 | } | |
14590 | ||
1da177e4 LT |
14591 | /* |
14592 | * patch entries | |
14593 | */ | |
14594 | struct hda_codec_preset snd_hda_preset_realtek[] = { | |
14595 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | |
df694daa | 14596 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
f6a92248 | 14597 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
a361d84b | 14598 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
f6a92248 | 14599 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
f32610ed | 14600 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
bc9f98a9 | 14601 | .patch = patch_alc861 }, |
f32610ed JS |
14602 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
14603 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
14604 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
bc9f98a9 KY |
14605 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
14606 | .patch = patch_alc883 }, | |
14607 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | |
14608 | .patch = patch_alc662 }, | |
6dda9f4a | 14609 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
f32610ed | 14610 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
1da177e4 | 14611 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
9c7f852e | 14612 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
cb308f97 | 14613 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
7943a8ab | 14614 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
df694daa | 14615 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
9c7f852e | 14616 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
f6a92248 | 14617 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
1da177e4 LT |
14618 | {} /* terminator */ |
14619 | }; |