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" | |
680cd536 | 33 | #include "hda_beep.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, | |
3f878308 | 75 | ALC260_HP_DC7600, |
df694daa KY |
76 | ALC260_HP_3013, |
77 | ALC260_FUJITSU_S702X, | |
0bfc90e9 | 78 | ALC260_ACER, |
bc9f98a9 KY |
79 | ALC260_WILL, |
80 | ALC260_REPLACER_672V, | |
cc959489 | 81 | ALC260_FAVORIT100, |
7cf51e48 JW |
82 | #ifdef CONFIG_SND_DEBUG |
83 | ALC260_TEST, | |
84 | #endif | |
df694daa | 85 | ALC260_AUTO, |
16ded525 | 86 | ALC260_MODEL_LAST /* last tag */ |
1da177e4 LT |
87 | }; |
88 | ||
df694daa KY |
89 | /* ALC262 models */ |
90 | enum { | |
91 | ALC262_BASIC, | |
ccc656ce KY |
92 | ALC262_HIPPO, |
93 | ALC262_HIPPO_1, | |
834be88d | 94 | ALC262_FUJITSU, |
9c7f852e | 95 | ALC262_HP_BPC, |
cd7509a4 KY |
96 | ALC262_HP_BPC_D7000_WL, |
97 | ALC262_HP_BPC_D7000_WF, | |
66d2a9d6 | 98 | ALC262_HP_TC_T5735, |
8c427226 | 99 | ALC262_HP_RP5700, |
304dcaac | 100 | ALC262_BENQ_ED8, |
272a527c | 101 | ALC262_SONY_ASSAMD, |
83c34218 | 102 | ALC262_BENQ_T31, |
f651b50b | 103 | ALC262_ULTRA, |
0e31daf7 | 104 | ALC262_LENOVO_3000, |
e8f9ae2a | 105 | ALC262_NEC, |
4e555fe5 | 106 | ALC262_TOSHIBA_S06, |
9f99a638 | 107 | ALC262_TOSHIBA_RX1, |
ba340e82 | 108 | ALC262_TYAN, |
df694daa KY |
109 | ALC262_AUTO, |
110 | ALC262_MODEL_LAST /* last tag */ | |
111 | }; | |
112 | ||
a361d84b KY |
113 | /* ALC268 models */ |
114 | enum { | |
eb5a6621 | 115 | ALC267_QUANTA_IL1, |
a361d84b | 116 | ALC268_3ST, |
d1a991a6 | 117 | ALC268_TOSHIBA, |
d273809e | 118 | ALC268_ACER, |
c238b4f4 | 119 | ALC268_ACER_DMIC, |
8ef355da | 120 | ALC268_ACER_ASPIRE_ONE, |
3866f0b0 | 121 | ALC268_DELL, |
f12462c5 | 122 | ALC268_ZEPTO, |
86c53bd2 JW |
123 | #ifdef CONFIG_SND_DEBUG |
124 | ALC268_TEST, | |
125 | #endif | |
a361d84b KY |
126 | ALC268_AUTO, |
127 | ALC268_MODEL_LAST /* last tag */ | |
128 | }; | |
129 | ||
f6a92248 KY |
130 | /* ALC269 models */ |
131 | enum { | |
132 | ALC269_BASIC, | |
60db6b53 | 133 | ALC269_QUANTA_FL1, |
84898e87 KY |
134 | ALC269_AMIC, |
135 | ALC269_DMIC, | |
136 | ALC269VB_AMIC, | |
137 | ALC269VB_DMIC, | |
26f5df26 | 138 | ALC269_FUJITSU, |
64154835 | 139 | ALC269_LIFEBOOK, |
fe3eb0a7 | 140 | ALC271_ACER, |
f6a92248 KY |
141 | ALC269_AUTO, |
142 | ALC269_MODEL_LAST /* last tag */ | |
143 | }; | |
144 | ||
df694daa KY |
145 | /* ALC861 models */ |
146 | enum { | |
147 | ALC861_3ST, | |
9c7f852e | 148 | ALC660_3ST, |
df694daa KY |
149 | ALC861_3ST_DIG, |
150 | ALC861_6ST_DIG, | |
22309c3e | 151 | ALC861_UNIWILL_M31, |
a53d1aec | 152 | ALC861_TOSHIBA, |
7cdbff94 | 153 | ALC861_ASUS, |
56bb0cab | 154 | ALC861_ASUS_LAPTOP, |
df694daa KY |
155 | ALC861_AUTO, |
156 | ALC861_MODEL_LAST, | |
157 | }; | |
158 | ||
f32610ed JS |
159 | /* ALC861-VD models */ |
160 | enum { | |
161 | ALC660VD_3ST, | |
6963f84c | 162 | ALC660VD_3ST_DIG, |
13c94744 | 163 | ALC660VD_ASUS_V1S, |
f32610ed JS |
164 | ALC861VD_3ST, |
165 | ALC861VD_3ST_DIG, | |
166 | ALC861VD_6ST_DIG, | |
bdd148a3 | 167 | ALC861VD_LENOVO, |
272a527c | 168 | ALC861VD_DALLAS, |
d1a991a6 | 169 | ALC861VD_HP, |
f32610ed JS |
170 | ALC861VD_AUTO, |
171 | ALC861VD_MODEL_LAST, | |
172 | }; | |
173 | ||
bc9f98a9 KY |
174 | /* ALC662 models */ |
175 | enum { | |
176 | ALC662_3ST_2ch_DIG, | |
177 | ALC662_3ST_6ch_DIG, | |
178 | ALC662_3ST_6ch, | |
179 | ALC662_5ST_DIG, | |
180 | ALC662_LENOVO_101E, | |
291702f0 | 181 | ALC662_ASUS_EEEPC_P701, |
8c427226 | 182 | ALC662_ASUS_EEEPC_EP20, |
6dda9f4a KY |
183 | ALC663_ASUS_M51VA, |
184 | ALC663_ASUS_G71V, | |
185 | ALC663_ASUS_H13, | |
186 | ALC663_ASUS_G50V, | |
f1d4e28b KY |
187 | ALC662_ECS, |
188 | ALC663_ASUS_MODE1, | |
189 | ALC662_ASUS_MODE2, | |
190 | ALC663_ASUS_MODE3, | |
191 | ALC663_ASUS_MODE4, | |
192 | ALC663_ASUS_MODE5, | |
193 | ALC663_ASUS_MODE6, | |
ebb83eeb KY |
194 | ALC663_ASUS_MODE7, |
195 | ALC663_ASUS_MODE8, | |
622e84cd KY |
196 | ALC272_DELL, |
197 | ALC272_DELL_ZM1, | |
9541ba1d | 198 | ALC272_SAMSUNG_NC10, |
bc9f98a9 KY |
199 | ALC662_AUTO, |
200 | ALC662_MODEL_LAST, | |
201 | }; | |
202 | ||
df694daa KY |
203 | /* ALC882 models */ |
204 | enum { | |
205 | ALC882_3ST_DIG, | |
206 | ALC882_6ST_DIG, | |
4b146cb0 | 207 | ALC882_ARIMA, |
bdd148a3 | 208 | ALC882_W2JC, |
272a527c KY |
209 | ALC882_TARGA, |
210 | ALC882_ASUS_A7J, | |
914759b7 | 211 | ALC882_ASUS_A7M, |
9102cd1c | 212 | ALC885_MACPRO, |
76e6f5a9 | 213 | ALC885_MBA21, |
87350ad0 | 214 | ALC885_MBP3, |
41d5545d | 215 | ALC885_MB5, |
e458b1fa | 216 | ALC885_MACMINI3, |
c54728d8 | 217 | ALC885_IMAC24, |
4b7e1803 | 218 | ALC885_IMAC91, |
9c7f852e TI |
219 | ALC883_3ST_2ch_DIG, |
220 | ALC883_3ST_6ch_DIG, | |
221 | ALC883_3ST_6ch, | |
222 | ALC883_6ST_DIG, | |
ccc656ce KY |
223 | ALC883_TARGA_DIG, |
224 | ALC883_TARGA_2ch_DIG, | |
64a8be74 | 225 | ALC883_TARGA_8ch_DIG, |
bab282b9 | 226 | ALC883_ACER, |
2880a867 | 227 | ALC883_ACER_ASPIRE, |
5b2d1eca | 228 | ALC888_ACER_ASPIRE_4930G, |
d2fd4b09 | 229 | ALC888_ACER_ASPIRE_6530G, |
3b315d70 | 230 | ALC888_ACER_ASPIRE_8930G, |
fc86f954 | 231 | ALC888_ACER_ASPIRE_7730G, |
c07584c8 | 232 | ALC883_MEDION, |
ea1fb29a | 233 | ALC883_MEDION_MD2, |
7ad7b218 | 234 | ALC883_MEDION_WIM2160, |
b373bdeb | 235 | ALC883_LAPTOP_EAPD, |
bc9f98a9 | 236 | ALC883_LENOVO_101E_2ch, |
272a527c | 237 | ALC883_LENOVO_NB0763, |
189609ae | 238 | ALC888_LENOVO_MS7195_DIG, |
e2757d5e | 239 | ALC888_LENOVO_SKY, |
ea1fb29a | 240 | ALC883_HAIER_W66, |
4723c022 | 241 | ALC888_3ST_HP, |
5795b9e6 | 242 | ALC888_6ST_DELL, |
a8848bd6 | 243 | ALC883_MITAC, |
a65cc60f | 244 | ALC883_CLEVO_M540R, |
0c4cc443 | 245 | ALC883_CLEVO_M720, |
fb97dc67 | 246 | ALC883_FUJITSU_PI2515, |
ef8ef5fb | 247 | ALC888_FUJITSU_XA3530, |
17bba1b7 | 248 | ALC883_3ST_6ch_INTEL, |
87a8c370 JK |
249 | ALC889A_INTEL, |
250 | ALC889_INTEL, | |
e2757d5e KY |
251 | ALC888_ASUS_M90V, |
252 | ALC888_ASUS_EEE1601, | |
eb4c41d3 | 253 | ALC889A_MB31, |
3ab90935 | 254 | ALC1200_ASUS_P5Q, |
3e1647c5 | 255 | ALC883_SONY_VAIO_TT, |
4953550a TI |
256 | ALC882_AUTO, |
257 | ALC882_MODEL_LAST, | |
9c7f852e TI |
258 | }; |
259 | ||
d4a86d81 TI |
260 | /* ALC680 models */ |
261 | enum { | |
262 | ALC680_BASE, | |
263 | ALC680_AUTO, | |
264 | ALC680_MODEL_LAST, | |
265 | }; | |
266 | ||
df694daa KY |
267 | /* for GPIO Poll */ |
268 | #define GPIO_MASK 0x03 | |
269 | ||
4a79ba34 TI |
270 | /* extra amp-initialization sequence types */ |
271 | enum { | |
272 | ALC_INIT_NONE, | |
273 | ALC_INIT_DEFAULT, | |
274 | ALC_INIT_GPIO1, | |
275 | ALC_INIT_GPIO2, | |
276 | ALC_INIT_GPIO3, | |
277 | }; | |
278 | ||
6c819492 TI |
279 | struct alc_mic_route { |
280 | hda_nid_t pin; | |
281 | unsigned char mux_idx; | |
282 | unsigned char amix_idx; | |
283 | }; | |
284 | ||
285 | #define MUX_IDX_UNDEF ((unsigned char)-1) | |
286 | ||
da00c244 KY |
287 | struct alc_customize_define { |
288 | unsigned int sku_cfg; | |
289 | unsigned char port_connectivity; | |
290 | unsigned char check_sum; | |
291 | unsigned char customization; | |
292 | unsigned char external_amp; | |
293 | unsigned int enable_pcbeep:1; | |
294 | unsigned int platform_type:1; | |
295 | unsigned int swap:1; | |
296 | unsigned int override:1; | |
297 | }; | |
298 | ||
1da177e4 LT |
299 | struct alc_spec { |
300 | /* codec parameterization */ | |
df694daa | 301 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
1da177e4 | 302 | unsigned int num_mixers; |
f9e336f6 | 303 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
45bdd1c1 | 304 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
1da177e4 | 305 | |
2d9c6482 | 306 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
9c7f852e TI |
307 | * don't forget NULL |
308 | * termination! | |
e9edcee0 TI |
309 | */ |
310 | unsigned int num_init_verbs; | |
1da177e4 | 311 | |
aa563af7 | 312 | char stream_name_analog[32]; /* analog PCM stream */ |
1da177e4 LT |
313 | struct hda_pcm_stream *stream_analog_playback; |
314 | struct hda_pcm_stream *stream_analog_capture; | |
6330079f TI |
315 | struct hda_pcm_stream *stream_analog_alt_playback; |
316 | struct hda_pcm_stream *stream_analog_alt_capture; | |
1da177e4 | 317 | |
aa563af7 | 318 | char stream_name_digital[32]; /* digital PCM stream */ |
1da177e4 LT |
319 | struct hda_pcm_stream *stream_digital_playback; |
320 | struct hda_pcm_stream *stream_digital_capture; | |
321 | ||
322 | /* playback */ | |
16ded525 TI |
323 | struct hda_multi_out multiout; /* playback set-up |
324 | * max_channels, dacs must be set | |
325 | * dig_out_nid and hp_nid are optional | |
326 | */ | |
6330079f | 327 | hda_nid_t alt_dac_nid; |
6a05ac4a | 328 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
8c441982 | 329 | int dig_out_type; |
1da177e4 LT |
330 | |
331 | /* capture */ | |
332 | unsigned int num_adc_nids; | |
333 | hda_nid_t *adc_nids; | |
e1406348 | 334 | hda_nid_t *capsrc_nids; |
16ded525 | 335 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
1da177e4 | 336 | |
840b64c0 TI |
337 | /* capture setup for dynamic dual-adc switch */ |
338 | unsigned int cur_adc_idx; | |
339 | hda_nid_t cur_adc; | |
340 | unsigned int cur_adc_stream_tag; | |
341 | unsigned int cur_adc_format; | |
342 | ||
1da177e4 | 343 | /* capture source */ |
a1e8d2da | 344 | unsigned int num_mux_defs; |
1da177e4 LT |
345 | const struct hda_input_mux *input_mux; |
346 | unsigned int cur_mux[3]; | |
6c819492 TI |
347 | struct alc_mic_route ext_mic; |
348 | struct alc_mic_route int_mic; | |
1da177e4 LT |
349 | |
350 | /* channel model */ | |
d2a6d7dc | 351 | const struct hda_channel_mode *channel_mode; |
1da177e4 | 352 | int num_channel_mode; |
4e195a7b | 353 | int need_dac_fix; |
3b315d70 HM |
354 | int const_channel_count; |
355 | int ext_channel_count; | |
1da177e4 LT |
356 | |
357 | /* PCM information */ | |
4c5186ed | 358 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
41e41f1f | 359 | |
e9edcee0 TI |
360 | /* dynamic controls, init_verbs and input_mux */ |
361 | struct auto_pin_cfg autocfg; | |
da00c244 | 362 | struct alc_customize_define cdefine; |
603c4019 | 363 | struct snd_array kctls; |
61b9b9b1 | 364 | struct hda_input_mux private_imux[3]; |
41923e44 | 365 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
4953550a TI |
366 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
367 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; | |
834be88d | 368 | |
ae6b813a TI |
369 | /* hooks */ |
370 | void (*init_hook)(struct hda_codec *codec); | |
371 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
f5de24b0 | 372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
c97259df | 373 | void (*power_hook)(struct hda_codec *codec); |
f5de24b0 | 374 | #endif |
ae6b813a | 375 | |
834be88d TI |
376 | /* for pin sensing */ |
377 | unsigned int sense_updated: 1; | |
378 | unsigned int jack_present: 1; | |
bec15c3a | 379 | unsigned int master_sw: 1; |
6c819492 | 380 | unsigned int auto_mic:1; |
cb53c626 | 381 | |
e64f14f4 TI |
382 | /* other flags */ |
383 | unsigned int no_analog :1; /* digital I/O only */ | |
840b64c0 | 384 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
4a79ba34 | 385 | int init_amp; |
e64f14f4 | 386 | |
2134ea4f TI |
387 | /* for virtual master */ |
388 | hda_nid_t vmaster_nid; | |
cb53c626 TI |
389 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
390 | struct hda_loopback_check loopback; | |
391 | #endif | |
2c3bf9ab TI |
392 | |
393 | /* for PLL fix */ | |
394 | hda_nid_t pll_nid; | |
395 | unsigned int pll_coef_idx, pll_coef_bit; | |
df694daa KY |
396 | }; |
397 | ||
398 | /* | |
399 | * configuration template - to be copied to the spec instance | |
400 | */ | |
401 | struct alc_config_preset { | |
9c7f852e TI |
402 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
403 | * with spec | |
404 | */ | |
f9e336f6 | 405 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
df694daa KY |
406 | const struct hda_verb *init_verbs[5]; |
407 | unsigned int num_dacs; | |
408 | hda_nid_t *dac_nids; | |
409 | hda_nid_t dig_out_nid; /* optional */ | |
410 | hda_nid_t hp_nid; /* optional */ | |
b25c9da1 | 411 | hda_nid_t *slave_dig_outs; |
df694daa KY |
412 | unsigned int num_adc_nids; |
413 | hda_nid_t *adc_nids; | |
e1406348 | 414 | hda_nid_t *capsrc_nids; |
df694daa KY |
415 | hda_nid_t dig_in_nid; |
416 | unsigned int num_channel_mode; | |
417 | const struct hda_channel_mode *channel_mode; | |
4e195a7b | 418 | int need_dac_fix; |
3b315d70 | 419 | int const_channel_count; |
a1e8d2da | 420 | unsigned int num_mux_defs; |
df694daa | 421 | const struct hda_input_mux *input_mux; |
ae6b813a | 422 | void (*unsol_event)(struct hda_codec *, unsigned int); |
e9c364c0 | 423 | void (*setup)(struct hda_codec *); |
ae6b813a | 424 | void (*init_hook)(struct hda_codec *); |
cb53c626 TI |
425 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
426 | struct hda_amp_list *loopbacks; | |
c97259df | 427 | void (*power_hook)(struct hda_codec *codec); |
cb53c626 | 428 | #endif |
1da177e4 LT |
429 | }; |
430 | ||
1da177e4 LT |
431 | |
432 | /* | |
433 | * input MUX handling | |
434 | */ | |
9c7f852e TI |
435 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
436 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
437 | { |
438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
439 | struct alc_spec *spec = codec->spec; | |
a1e8d2da JW |
440 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
441 | if (mux_idx >= spec->num_mux_defs) | |
442 | mux_idx = 0; | |
5311114d TI |
443 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
444 | mux_idx = 0; | |
a1e8d2da | 445 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
1da177e4 LT |
446 | } |
447 | ||
9c7f852e TI |
448 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
449 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
450 | { |
451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
452 | struct alc_spec *spec = codec->spec; | |
453 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
454 | ||
455 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
456 | return 0; | |
457 | } | |
458 | ||
9c7f852e TI |
459 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
460 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
461 | { |
462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
463 | struct alc_spec *spec = codec->spec; | |
cd896c33 | 464 | const struct hda_input_mux *imux; |
1da177e4 | 465 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
cd896c33 | 466 | unsigned int mux_idx; |
e1406348 TI |
467 | hda_nid_t nid = spec->capsrc_nids ? |
468 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
0169b6b3 | 469 | unsigned int type; |
1da177e4 | 470 | |
cd896c33 TI |
471 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
472 | imux = &spec->input_mux[mux_idx]; | |
5311114d TI |
473 | if (!imux->num_items && mux_idx > 0) |
474 | imux = &spec->input_mux[0]; | |
cd896c33 | 475 | |
a22d543a | 476 | type = get_wcaps_type(get_wcaps(codec, nid)); |
0169b6b3 | 477 | if (type == AC_WID_AUD_MIX) { |
54cbc9ab TI |
478 | /* Matrix-mixer style (e.g. ALC882) */ |
479 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
480 | unsigned int i, idx; | |
481 | ||
482 | idx = ucontrol->value.enumerated.item[0]; | |
483 | if (idx >= imux->num_items) | |
484 | idx = imux->num_items - 1; | |
485 | if (*cur_val == idx) | |
486 | return 0; | |
487 | for (i = 0; i < imux->num_items; i++) { | |
488 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | |
489 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | |
490 | imux->items[i].index, | |
491 | HDA_AMP_MUTE, v); | |
492 | } | |
493 | *cur_val = idx; | |
494 | return 1; | |
495 | } else { | |
496 | /* MUX style (e.g. ALC880) */ | |
cd896c33 | 497 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
54cbc9ab TI |
498 | &spec->cur_mux[adc_idx]); |
499 | } | |
500 | } | |
e9edcee0 | 501 | |
1da177e4 LT |
502 | /* |
503 | * channel mode setting | |
504 | */ | |
9c7f852e TI |
505 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
506 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
507 | { |
508 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
509 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc TI |
510 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
511 | spec->num_channel_mode); | |
1da177e4 LT |
512 | } |
513 | ||
9c7f852e TI |
514 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
515 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
516 | { |
517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
518 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc | 519 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
9c7f852e | 520 | spec->num_channel_mode, |
3b315d70 | 521 | spec->ext_channel_count); |
1da177e4 LT |
522 | } |
523 | ||
9c7f852e TI |
524 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
525 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
526 | { |
527 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
528 | struct alc_spec *spec = codec->spec; | |
4e195a7b TI |
529 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
530 | spec->num_channel_mode, | |
3b315d70 HM |
531 | &spec->ext_channel_count); |
532 | if (err >= 0 && !spec->const_channel_count) { | |
533 | spec->multiout.max_channels = spec->ext_channel_count; | |
534 | if (spec->need_dac_fix) | |
535 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; | |
536 | } | |
4e195a7b | 537 | return err; |
1da177e4 LT |
538 | } |
539 | ||
a9430dd8 | 540 | /* |
4c5186ed | 541 | * Control the mode of pin widget settings via the mixer. "pc" is used |
ea1fb29a | 542 | * instead of "%" to avoid consequences of accidently treating the % as |
4c5186ed JW |
543 | * being part of a format specifier. Maximum allowed length of a value is |
544 | * 63 characters plus NULL terminator. | |
7cf51e48 JW |
545 | * |
546 | * Note: some retasking pin complexes seem to ignore requests for input | |
547 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
548 | * are requested. Therefore order this list so that this behaviour will not | |
549 | * cause problems when mixer clients move through the enum sequentially. | |
a1e8d2da JW |
550 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
551 | * March 2006. | |
4c5186ed JW |
552 | */ |
553 | static char *alc_pin_mode_names[] = { | |
7cf51e48 JW |
554 | "Mic 50pc bias", "Mic 80pc bias", |
555 | "Line in", "Line out", "Headphone out", | |
4c5186ed JW |
556 | }; |
557 | static unsigned char alc_pin_mode_values[] = { | |
7cf51e48 | 558 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
4c5186ed JW |
559 | }; |
560 | /* The control can present all 5 options, or it can limit the options based | |
a1e8d2da JW |
561 | * in the pin being assumed to be exclusively an input or an output pin. In |
562 | * addition, "input" pins may or may not process the mic bias option | |
563 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
564 | * accept requests for bias as of chip versions up to March 2006) and/or | |
565 | * wiring in the computer. | |
a9430dd8 | 566 | */ |
a1e8d2da JW |
567 | #define ALC_PIN_DIR_IN 0x00 |
568 | #define ALC_PIN_DIR_OUT 0x01 | |
569 | #define ALC_PIN_DIR_INOUT 0x02 | |
570 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
571 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
4c5186ed | 572 | |
ea1fb29a | 573 | /* Info about the pin modes supported by the different pin direction modes. |
4c5186ed JW |
574 | * For each direction the minimum and maximum values are given. |
575 | */ | |
a1e8d2da | 576 | static signed char alc_pin_mode_dir_info[5][2] = { |
4c5186ed JW |
577 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
578 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
579 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
a1e8d2da JW |
580 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
581 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
4c5186ed JW |
582 | }; |
583 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
584 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
585 | #define alc_pin_mode_n_items(_dir) \ | |
586 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
587 | ||
9c7f852e TI |
588 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
589 | struct snd_ctl_elem_info *uinfo) | |
a9430dd8 | 590 | { |
4c5186ed JW |
591 | unsigned int item_num = uinfo->value.enumerated.item; |
592 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
593 | ||
594 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
a9430dd8 | 595 | uinfo->count = 1; |
4c5186ed JW |
596 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
597 | ||
598 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
599 | item_num = alc_pin_mode_min(dir); | |
600 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
a9430dd8 JW |
601 | return 0; |
602 | } | |
603 | ||
9c7f852e TI |
604 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
605 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 606 | { |
4c5186ed | 607 | unsigned int i; |
a9430dd8 JW |
608 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
609 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed | 610 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
a9430dd8 | 611 | long *valp = ucontrol->value.integer.value; |
9c7f852e TI |
612 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
613 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
614 | 0x00); | |
a9430dd8 | 615 | |
4c5186ed JW |
616 | /* Find enumerated value for current pinctl setting */ |
617 | i = alc_pin_mode_min(dir); | |
4b35d2ca | 618 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
4c5186ed | 619 | i++; |
9c7f852e | 620 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
a9430dd8 JW |
621 | return 0; |
622 | } | |
623 | ||
9c7f852e TI |
624 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
625 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 626 | { |
4c5186ed | 627 | signed int change; |
a9430dd8 JW |
628 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
629 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed JW |
630 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
631 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
632 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
633 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
634 | 0x00); | |
a9430dd8 | 635 | |
f12ab1e0 | 636 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
4c5186ed JW |
637 | val = alc_pin_mode_min(dir); |
638 | ||
639 | change = pinctl != alc_pin_mode_values[val]; | |
cdcd9268 JW |
640 | if (change) { |
641 | /* Set pin mode to that requested */ | |
82beb8fd TI |
642 | snd_hda_codec_write_cache(codec, nid, 0, |
643 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
644 | alc_pin_mode_values[val]); | |
cdcd9268 | 645 | |
ea1fb29a | 646 | /* Also enable the retasking pin's input/output as required |
cdcd9268 JW |
647 | * for the requested pin mode. Enum values of 2 or less are |
648 | * input modes. | |
649 | * | |
650 | * Dynamically switching the input/output buffers probably | |
a1e8d2da JW |
651 | * reduces noise slightly (particularly on input) so we'll |
652 | * do it. However, having both input and output buffers | |
653 | * enabled simultaneously doesn't seem to be problematic if | |
654 | * this turns out to be necessary in the future. | |
cdcd9268 JW |
655 | */ |
656 | if (val <= 2) { | |
47fd830a TI |
657 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
658 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
659 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
660 | HDA_AMP_MUTE, 0); | |
cdcd9268 | 661 | } else { |
47fd830a TI |
662 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
663 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
664 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
665 | HDA_AMP_MUTE, 0); | |
cdcd9268 JW |
666 | } |
667 | } | |
a9430dd8 JW |
668 | return change; |
669 | } | |
670 | ||
4c5186ed | 671 | #define ALC_PIN_MODE(xname, nid, dir) \ |
a9430dd8 | 672 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
5b0cb1d8 | 673 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
4c5186ed JW |
674 | .info = alc_pin_mode_info, \ |
675 | .get = alc_pin_mode_get, \ | |
676 | .put = alc_pin_mode_put, \ | |
677 | .private_value = nid | (dir<<16) } | |
df694daa | 678 | |
5c8f858d JW |
679 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
680 | * together using a mask with more than one bit set. This control is | |
681 | * currently used only by the ALC260 test model. At this stage they are not | |
682 | * needed for any "production" models. | |
683 | */ | |
684 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 685 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
f12ab1e0 | 686 | |
9c7f852e TI |
687 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
688 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
689 | { |
690 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
691 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
692 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
693 | long *valp = ucontrol->value.integer.value; | |
9c7f852e TI |
694 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
695 | AC_VERB_GET_GPIO_DATA, 0x00); | |
5c8f858d JW |
696 | |
697 | *valp = (val & mask) != 0; | |
698 | return 0; | |
699 | } | |
9c7f852e TI |
700 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
701 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
702 | { |
703 | signed int change; | |
704 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
705 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
706 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
707 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
708 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
709 | AC_VERB_GET_GPIO_DATA, | |
710 | 0x00); | |
5c8f858d JW |
711 | |
712 | /* Set/unset the masked GPIO bit(s) as needed */ | |
9c7f852e TI |
713 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
714 | if (val == 0) | |
5c8f858d JW |
715 | gpio_data &= ~mask; |
716 | else | |
717 | gpio_data |= mask; | |
82beb8fd TI |
718 | snd_hda_codec_write_cache(codec, nid, 0, |
719 | AC_VERB_SET_GPIO_DATA, gpio_data); | |
5c8f858d JW |
720 | |
721 | return change; | |
722 | } | |
723 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
724 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
5b0cb1d8 | 725 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
5c8f858d JW |
726 | .info = alc_gpio_data_info, \ |
727 | .get = alc_gpio_data_get, \ | |
728 | .put = alc_gpio_data_put, \ | |
729 | .private_value = nid | (mask<<16) } | |
730 | #endif /* CONFIG_SND_DEBUG */ | |
731 | ||
92621f13 JW |
732 | /* A switch control to allow the enabling of the digital IO pins on the |
733 | * ALC260. This is incredibly simplistic; the intention of this control is | |
734 | * to provide something in the test model allowing digital outputs to be | |
735 | * identified if present. If models are found which can utilise these | |
736 | * outputs a more complete mixer control can be devised for those models if | |
737 | * necessary. | |
738 | */ | |
739 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 740 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
f12ab1e0 | 741 | |
9c7f852e TI |
742 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
743 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
744 | { |
745 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
746 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
747 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
748 | long *valp = ucontrol->value.integer.value; | |
9c7f852e | 749 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 750 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
92621f13 JW |
751 | |
752 | *valp = (val & mask) != 0; | |
753 | return 0; | |
754 | } | |
9c7f852e TI |
755 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
756 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
757 | { |
758 | signed int change; | |
759 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
760 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
761 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
762 | long val = *ucontrol->value.integer.value; | |
9c7f852e | 763 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 764 | AC_VERB_GET_DIGI_CONVERT_1, |
9c7f852e | 765 | 0x00); |
92621f13 JW |
766 | |
767 | /* Set/unset the masked control bit(s) as needed */ | |
9c7f852e | 768 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
92621f13 JW |
769 | if (val==0) |
770 | ctrl_data &= ~mask; | |
771 | else | |
772 | ctrl_data |= mask; | |
82beb8fd TI |
773 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
774 | ctrl_data); | |
92621f13 JW |
775 | |
776 | return change; | |
777 | } | |
778 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
779 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
5b0cb1d8 | 780 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
92621f13 JW |
781 | .info = alc_spdif_ctrl_info, \ |
782 | .get = alc_spdif_ctrl_get, \ | |
783 | .put = alc_spdif_ctrl_put, \ | |
784 | .private_value = nid | (mask<<16) } | |
785 | #endif /* CONFIG_SND_DEBUG */ | |
786 | ||
f8225f6d JW |
787 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
788 | * Again, this is only used in the ALC26x test models to help identify when | |
789 | * the EAPD line must be asserted for features to work. | |
790 | */ | |
791 | #ifdef CONFIG_SND_DEBUG | |
792 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | |
793 | ||
794 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | |
795 | struct snd_ctl_elem_value *ucontrol) | |
796 | { | |
797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
798 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
799 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
800 | long *valp = ucontrol->value.integer.value; | |
801 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
802 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | |
803 | ||
804 | *valp = (val & mask) != 0; | |
805 | return 0; | |
806 | } | |
807 | ||
808 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |
809 | struct snd_ctl_elem_value *ucontrol) | |
810 | { | |
811 | int change; | |
812 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
813 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
814 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
815 | long val = *ucontrol->value.integer.value; | |
816 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
817 | AC_VERB_GET_EAPD_BTLENABLE, | |
818 | 0x00); | |
819 | ||
820 | /* Set/unset the masked control bit(s) as needed */ | |
821 | change = (!val ? 0 : mask) != (ctrl_data & mask); | |
822 | if (!val) | |
823 | ctrl_data &= ~mask; | |
824 | else | |
825 | ctrl_data |= mask; | |
826 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
827 | ctrl_data); | |
828 | ||
829 | return change; | |
830 | } | |
831 | ||
832 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | |
833 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
5b0cb1d8 | 834 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
f8225f6d JW |
835 | .info = alc_eapd_ctrl_info, \ |
836 | .get = alc_eapd_ctrl_get, \ | |
837 | .put = alc_eapd_ctrl_put, \ | |
838 | .private_value = nid | (mask<<16) } | |
839 | #endif /* CONFIG_SND_DEBUG */ | |
840 | ||
23f0c048 TI |
841 | /* |
842 | * set up the input pin config (depending on the given auto-pin type) | |
843 | */ | |
844 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, | |
845 | int auto_pin_type) | |
846 | { | |
847 | unsigned int val = PIN_IN; | |
848 | ||
86e2959a | 849 | if (auto_pin_type == AUTO_PIN_MIC) { |
23f0c048 | 850 | unsigned int pincap; |
954a29c8 TI |
851 | unsigned int oldval; |
852 | oldval = snd_hda_codec_read(codec, nid, 0, | |
853 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
1327a32b | 854 | pincap = snd_hda_query_pin_caps(codec, nid); |
23f0c048 | 855 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
954a29c8 TI |
856 | /* if the default pin setup is vref50, we give it priority */ |
857 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) | |
23f0c048 | 858 | val = PIN_VREF80; |
461c6c3a TI |
859 | else if (pincap & AC_PINCAP_VREF_50) |
860 | val = PIN_VREF50; | |
861 | else if (pincap & AC_PINCAP_VREF_100) | |
862 | val = PIN_VREF100; | |
863 | else if (pincap & AC_PINCAP_VREF_GRD) | |
864 | val = PIN_VREFGRD; | |
23f0c048 TI |
865 | } |
866 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); | |
867 | } | |
868 | ||
d88897ea TI |
869 | /* |
870 | */ | |
871 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | |
872 | { | |
873 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
874 | return; | |
875 | spec->mixers[spec->num_mixers++] = mix; | |
876 | } | |
877 | ||
878 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | |
879 | { | |
880 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) | |
881 | return; | |
882 | spec->init_verbs[spec->num_init_verbs++] = verb; | |
883 | } | |
884 | ||
df694daa KY |
885 | /* |
886 | * set up from the preset table | |
887 | */ | |
e9c364c0 | 888 | static void setup_preset(struct hda_codec *codec, |
9c7f852e | 889 | const struct alc_config_preset *preset) |
df694daa | 890 | { |
e9c364c0 | 891 | struct alc_spec *spec = codec->spec; |
df694daa KY |
892 | int i; |
893 | ||
894 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
d88897ea | 895 | add_mixer(spec, preset->mixers[i]); |
f9e336f6 | 896 | spec->cap_mixer = preset->cap_mixer; |
9c7f852e TI |
897 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
898 | i++) | |
d88897ea | 899 | add_verb(spec, preset->init_verbs[i]); |
ea1fb29a | 900 | |
df694daa KY |
901 | spec->channel_mode = preset->channel_mode; |
902 | spec->num_channel_mode = preset->num_channel_mode; | |
4e195a7b | 903 | spec->need_dac_fix = preset->need_dac_fix; |
3b315d70 | 904 | spec->const_channel_count = preset->const_channel_count; |
df694daa | 905 | |
3b315d70 HM |
906 | if (preset->const_channel_count) |
907 | spec->multiout.max_channels = preset->const_channel_count; | |
908 | else | |
909 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
910 | spec->ext_channel_count = spec->channel_mode[0].channels; | |
df694daa KY |
911 | |
912 | spec->multiout.num_dacs = preset->num_dacs; | |
913 | spec->multiout.dac_nids = preset->dac_nids; | |
914 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
b25c9da1 | 915 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
df694daa | 916 | spec->multiout.hp_nid = preset->hp_nid; |
ea1fb29a | 917 | |
a1e8d2da | 918 | spec->num_mux_defs = preset->num_mux_defs; |
f12ab1e0 | 919 | if (!spec->num_mux_defs) |
a1e8d2da | 920 | spec->num_mux_defs = 1; |
df694daa KY |
921 | spec->input_mux = preset->input_mux; |
922 | ||
923 | spec->num_adc_nids = preset->num_adc_nids; | |
924 | spec->adc_nids = preset->adc_nids; | |
e1406348 | 925 | spec->capsrc_nids = preset->capsrc_nids; |
df694daa | 926 | spec->dig_in_nid = preset->dig_in_nid; |
ae6b813a TI |
927 | |
928 | spec->unsol_event = preset->unsol_event; | |
929 | spec->init_hook = preset->init_hook; | |
cb53c626 | 930 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
f5de24b0 | 931 | spec->power_hook = preset->power_hook; |
cb53c626 TI |
932 | spec->loopback.amplist = preset->loopbacks; |
933 | #endif | |
e9c364c0 TI |
934 | |
935 | if (preset->setup) | |
936 | preset->setup(codec); | |
df694daa KY |
937 | } |
938 | ||
bc9f98a9 KY |
939 | /* Enable GPIO mask and set output */ |
940 | static struct hda_verb alc_gpio1_init_verbs[] = { | |
941 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
942 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
943 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
944 | { } | |
945 | }; | |
946 | ||
947 | static struct hda_verb alc_gpio2_init_verbs[] = { | |
948 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
949 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
950 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
951 | { } | |
952 | }; | |
953 | ||
bdd148a3 KY |
954 | static struct hda_verb alc_gpio3_init_verbs[] = { |
955 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
956 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
957 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
958 | { } | |
959 | }; | |
960 | ||
2c3bf9ab TI |
961 | /* |
962 | * Fix hardware PLL issue | |
963 | * On some codecs, the analog PLL gating control must be off while | |
964 | * the default value is 1. | |
965 | */ | |
966 | static void alc_fix_pll(struct hda_codec *codec) | |
967 | { | |
968 | struct alc_spec *spec = codec->spec; | |
969 | unsigned int val; | |
970 | ||
971 | if (!spec->pll_nid) | |
972 | return; | |
973 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
974 | spec->pll_coef_idx); | |
975 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | |
976 | AC_VERB_GET_PROC_COEF, 0); | |
977 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
978 | spec->pll_coef_idx); | |
979 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | |
980 | val & ~(1 << spec->pll_coef_bit)); | |
981 | } | |
982 | ||
983 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
984 | unsigned int coef_idx, unsigned int coef_bit) | |
985 | { | |
986 | struct alc_spec *spec = codec->spec; | |
987 | spec->pll_nid = nid; | |
988 | spec->pll_coef_idx = coef_idx; | |
989 | spec->pll_coef_bit = coef_bit; | |
990 | alc_fix_pll(codec); | |
991 | } | |
992 | ||
bb35febd | 993 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
c9b58006 KY |
994 | { |
995 | struct alc_spec *spec = codec->spec; | |
bb35febd TI |
996 | unsigned int mute; |
997 | hda_nid_t nid; | |
a9fd4f3f | 998 | int i; |
c9b58006 | 999 | |
bb35febd TI |
1000 | spec->jack_present = 0; |
1001 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { | |
1002 | nid = spec->autocfg.hp_pins[i]; | |
1003 | if (!nid) | |
1004 | break; | |
1005 | if (snd_hda_jack_detect(codec, nid)) { | |
1006 | spec->jack_present = 1; | |
1007 | break; | |
1008 | } | |
1009 | } | |
1010 | ||
1011 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; | |
1012 | /* Toggle internal speakers muting */ | |
a9fd4f3f TI |
1013 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
1014 | nid = spec->autocfg.speaker_pins[i]; | |
1015 | if (!nid) | |
1016 | break; | |
bb35febd TI |
1017 | if (pinctl) { |
1018 | snd_hda_codec_write(codec, nid, 0, | |
a9fd4f3f TI |
1019 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
1020 | spec->jack_present ? 0 : PIN_OUT); | |
bb35febd TI |
1021 | } else { |
1022 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
1023 | HDA_AMP_MUTE, mute); | |
1024 | } | |
a9fd4f3f | 1025 | } |
c9b58006 KY |
1026 | } |
1027 | ||
bb35febd TI |
1028 | static void alc_automute_pin(struct hda_codec *codec) |
1029 | { | |
1030 | alc_automute_speaker(codec, 1); | |
1031 | } | |
1032 | ||
6c819492 TI |
1033 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
1034 | hda_nid_t nid) | |
1035 | { | |
1036 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
1037 | int i, nums; | |
1038 | ||
1039 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | |
1040 | for (i = 0; i < nums; i++) | |
1041 | if (conn[i] == nid) | |
1042 | return i; | |
1043 | return -1; | |
1044 | } | |
1045 | ||
840b64c0 TI |
1046 | /* switch the current ADC according to the jack state */ |
1047 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) | |
1048 | { | |
1049 | struct alc_spec *spec = codec->spec; | |
1050 | unsigned int present; | |
1051 | hda_nid_t new_adc; | |
1052 | ||
1053 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); | |
1054 | if (present) | |
1055 | spec->cur_adc_idx = 1; | |
1056 | else | |
1057 | spec->cur_adc_idx = 0; | |
1058 | new_adc = spec->adc_nids[spec->cur_adc_idx]; | |
1059 | if (spec->cur_adc && spec->cur_adc != new_adc) { | |
1060 | /* stream is running, let's swap the current ADC */ | |
f0cea797 | 1061 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
840b64c0 TI |
1062 | spec->cur_adc = new_adc; |
1063 | snd_hda_codec_setup_stream(codec, new_adc, | |
1064 | spec->cur_adc_stream_tag, 0, | |
1065 | spec->cur_adc_format); | |
1066 | } | |
1067 | } | |
1068 | ||
7fb0d78f KY |
1069 | static void alc_mic_automute(struct hda_codec *codec) |
1070 | { | |
1071 | struct alc_spec *spec = codec->spec; | |
6c819492 TI |
1072 | struct alc_mic_route *dead, *alive; |
1073 | unsigned int present, type; | |
1074 | hda_nid_t cap_nid; | |
1075 | ||
b59bdf3b TI |
1076 | if (!spec->auto_mic) |
1077 | return; | |
6c819492 TI |
1078 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
1079 | return; | |
1080 | if (snd_BUG_ON(!spec->adc_nids)) | |
1081 | return; | |
1082 | ||
840b64c0 TI |
1083 | if (spec->dual_adc_switch) { |
1084 | alc_dual_mic_adc_auto_switch(codec); | |
1085 | return; | |
1086 | } | |
1087 | ||
6c819492 TI |
1088 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
1089 | ||
864f92be | 1090 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
6c819492 TI |
1091 | if (present) { |
1092 | alive = &spec->ext_mic; | |
1093 | dead = &spec->int_mic; | |
1094 | } else { | |
1095 | alive = &spec->int_mic; | |
1096 | dead = &spec->ext_mic; | |
1097 | } | |
1098 | ||
6c819492 TI |
1099 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
1100 | if (type == AC_WID_AUD_MIX) { | |
1101 | /* Matrix-mixer style (e.g. ALC882) */ | |
1102 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1103 | alive->mux_idx, | |
1104 | HDA_AMP_MUTE, 0); | |
1105 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1106 | dead->mux_idx, | |
1107 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
1108 | } else { | |
1109 | /* MUX style (e.g. ALC880) */ | |
1110 | snd_hda_codec_write_cache(codec, cap_nid, 0, | |
1111 | AC_VERB_SET_CONNECT_SEL, | |
1112 | alive->mux_idx); | |
1113 | } | |
1114 | ||
1115 | /* FIXME: analog mixer */ | |
7fb0d78f KY |
1116 | } |
1117 | ||
c9b58006 KY |
1118 | /* unsolicited event for HP jack sensing */ |
1119 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |
1120 | { | |
1121 | if (codec->vendor_id == 0x10ec0880) | |
1122 | res >>= 28; | |
1123 | else | |
1124 | res >>= 26; | |
a9fd4f3f TI |
1125 | switch (res) { |
1126 | case ALC880_HP_EVENT: | |
1127 | alc_automute_pin(codec); | |
1128 | break; | |
1129 | case ALC880_MIC_EVENT: | |
7fb0d78f | 1130 | alc_mic_automute(codec); |
a9fd4f3f TI |
1131 | break; |
1132 | } | |
7fb0d78f KY |
1133 | } |
1134 | ||
1135 | static void alc_inithook(struct hda_codec *codec) | |
1136 | { | |
a9fd4f3f | 1137 | alc_automute_pin(codec); |
7fb0d78f | 1138 | alc_mic_automute(codec); |
c9b58006 KY |
1139 | } |
1140 | ||
f9423e7a KY |
1141 | /* additional initialization for ALC888 variants */ |
1142 | static void alc888_coef_init(struct hda_codec *codec) | |
1143 | { | |
1144 | unsigned int tmp; | |
1145 | ||
1146 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | |
1147 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1148 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
37db623a | 1149 | if ((tmp & 0xf0) == 0x20) |
f9423e7a KY |
1150 | /* alc888S-VC */ |
1151 | snd_hda_codec_read(codec, 0x20, 0, | |
1152 | AC_VERB_SET_PROC_COEF, 0x830); | |
1153 | else | |
1154 | /* alc888-VB */ | |
1155 | snd_hda_codec_read(codec, 0x20, 0, | |
1156 | AC_VERB_SET_PROC_COEF, 0x3030); | |
1157 | } | |
1158 | ||
87a8c370 JK |
1159 | static void alc889_coef_init(struct hda_codec *codec) |
1160 | { | |
1161 | unsigned int tmp; | |
1162 | ||
1163 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1164 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1165 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1166 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | |
1167 | } | |
1168 | ||
3fb4a508 TI |
1169 | /* turn on/off EAPD control (only if available) */ |
1170 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | |
1171 | { | |
1172 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | |
1173 | return; | |
1174 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | |
1175 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
1176 | on ? 2 : 0); | |
1177 | } | |
1178 | ||
4a79ba34 | 1179 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
bc9f98a9 | 1180 | { |
4a79ba34 | 1181 | unsigned int tmp; |
bc9f98a9 | 1182 | |
4a79ba34 TI |
1183 | switch (type) { |
1184 | case ALC_INIT_GPIO1: | |
bc9f98a9 KY |
1185 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
1186 | break; | |
4a79ba34 | 1187 | case ALC_INIT_GPIO2: |
bc9f98a9 KY |
1188 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
1189 | break; | |
4a79ba34 | 1190 | case ALC_INIT_GPIO3: |
bdd148a3 KY |
1191 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
1192 | break; | |
4a79ba34 | 1193 | case ALC_INIT_DEFAULT: |
bdd148a3 | 1194 | switch (codec->vendor_id) { |
c9b58006 | 1195 | case 0x10ec0260: |
3fb4a508 TI |
1196 | set_eapd(codec, 0x0f, 1); |
1197 | set_eapd(codec, 0x10, 1); | |
c9b58006 KY |
1198 | break; |
1199 | case 0x10ec0262: | |
bdd148a3 KY |
1200 | case 0x10ec0267: |
1201 | case 0x10ec0268: | |
c9b58006 | 1202 | case 0x10ec0269: |
3fb4a508 | 1203 | case 0x10ec0270: |
c6e8f2da | 1204 | case 0x10ec0272: |
f9423e7a KY |
1205 | case 0x10ec0660: |
1206 | case 0x10ec0662: | |
1207 | case 0x10ec0663: | |
c9b58006 | 1208 | case 0x10ec0862: |
20a3a05d | 1209 | case 0x10ec0889: |
3fb4a508 TI |
1210 | set_eapd(codec, 0x14, 1); |
1211 | set_eapd(codec, 0x15, 1); | |
c9b58006 | 1212 | break; |
bdd148a3 | 1213 | } |
c9b58006 KY |
1214 | switch (codec->vendor_id) { |
1215 | case 0x10ec0260: | |
1216 | snd_hda_codec_write(codec, 0x1a, 0, | |
1217 | AC_VERB_SET_COEF_INDEX, 7); | |
1218 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | |
1219 | AC_VERB_GET_PROC_COEF, 0); | |
1220 | snd_hda_codec_write(codec, 0x1a, 0, | |
1221 | AC_VERB_SET_COEF_INDEX, 7); | |
1222 | snd_hda_codec_write(codec, 0x1a, 0, | |
1223 | AC_VERB_SET_PROC_COEF, | |
1224 | tmp | 0x2010); | |
1225 | break; | |
1226 | case 0x10ec0262: | |
1227 | case 0x10ec0880: | |
1228 | case 0x10ec0882: | |
1229 | case 0x10ec0883: | |
1230 | case 0x10ec0885: | |
4a5a4c56 | 1231 | case 0x10ec0887: |
20a3a05d | 1232 | case 0x10ec0889: |
87a8c370 | 1233 | alc889_coef_init(codec); |
c9b58006 | 1234 | break; |
f9423e7a | 1235 | case 0x10ec0888: |
4a79ba34 | 1236 | alc888_coef_init(codec); |
f9423e7a | 1237 | break; |
0aea778e | 1238 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ |
c9b58006 KY |
1239 | case 0x10ec0267: |
1240 | case 0x10ec0268: | |
1241 | snd_hda_codec_write(codec, 0x20, 0, | |
1242 | AC_VERB_SET_COEF_INDEX, 7); | |
1243 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1244 | AC_VERB_GET_PROC_COEF, 0); | |
1245 | snd_hda_codec_write(codec, 0x20, 0, | |
ea1fb29a | 1246 | AC_VERB_SET_COEF_INDEX, 7); |
c9b58006 KY |
1247 | snd_hda_codec_write(codec, 0x20, 0, |
1248 | AC_VERB_SET_PROC_COEF, | |
1249 | tmp | 0x3000); | |
1250 | break; | |
0aea778e | 1251 | #endif /* XXX */ |
bc9f98a9 | 1252 | } |
4a79ba34 TI |
1253 | break; |
1254 | } | |
1255 | } | |
1256 | ||
1257 | static void alc_init_auto_hp(struct hda_codec *codec) | |
1258 | { | |
1259 | struct alc_spec *spec = codec->spec; | |
bb35febd TI |
1260 | struct auto_pin_cfg *cfg = &spec->autocfg; |
1261 | int i; | |
4a79ba34 | 1262 | |
bb35febd TI |
1263 | if (!cfg->hp_pins[0]) { |
1264 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | |
1265 | return; | |
1266 | } | |
4a79ba34 | 1267 | |
bb35febd TI |
1268 | if (!cfg->speaker_pins[0]) { |
1269 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) | |
4a79ba34 | 1270 | return; |
bb35febd TI |
1271 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
1272 | sizeof(cfg->speaker_pins)); | |
1273 | cfg->speaker_outs = cfg->line_outs; | |
1274 | } | |
1275 | ||
1276 | if (!cfg->hp_pins[0]) { | |
1277 | memcpy(cfg->hp_pins, cfg->line_out_pins, | |
1278 | sizeof(cfg->hp_pins)); | |
1279 | cfg->hp_outs = cfg->line_outs; | |
4a79ba34 TI |
1280 | } |
1281 | ||
bb35febd TI |
1282 | for (i = 0; i < cfg->hp_outs; i++) { |
1283 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", | |
1284 | cfg->hp_pins[i]); | |
1285 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, | |
4a79ba34 TI |
1286 | AC_VERB_SET_UNSOLICITED_ENABLE, |
1287 | AC_USRSP_EN | ALC880_HP_EVENT); | |
bb35febd | 1288 | } |
4a79ba34 TI |
1289 | spec->unsol_event = alc_sku_unsol_event; |
1290 | } | |
1291 | ||
6c819492 TI |
1292 | static void alc_init_auto_mic(struct hda_codec *codec) |
1293 | { | |
1294 | struct alc_spec *spec = codec->spec; | |
1295 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
1296 | hda_nid_t fixed, ext; | |
1297 | int i; | |
1298 | ||
1299 | /* there must be only two mic inputs exclusively */ | |
66ceeb6b | 1300 | for (i = 0; i < cfg->num_inputs; i++) |
86e2959a | 1301 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
6c819492 TI |
1302 | return; |
1303 | ||
1304 | fixed = ext = 0; | |
66ceeb6b TI |
1305 | for (i = 0; i < cfg->num_inputs; i++) { |
1306 | hda_nid_t nid = cfg->inputs[i].pin; | |
6c819492 | 1307 | unsigned int defcfg; |
6c819492 TI |
1308 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
1309 | switch (get_defcfg_connect(defcfg)) { | |
1310 | case AC_JACK_PORT_FIXED: | |
1311 | if (fixed) | |
1312 | return; /* already occupied */ | |
1313 | fixed = nid; | |
1314 | break; | |
1315 | case AC_JACK_PORT_COMPLEX: | |
1316 | if (ext) | |
1317 | return; /* already occupied */ | |
1318 | ext = nid; | |
1319 | break; | |
1320 | default: | |
1321 | return; /* invalid entry */ | |
1322 | } | |
1323 | } | |
eaa9b3a7 TI |
1324 | if (!ext || !fixed) |
1325 | return; | |
6c819492 TI |
1326 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
1327 | return; /* no unsol support */ | |
1328 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | |
1329 | ext, fixed); | |
1330 | spec->ext_mic.pin = ext; | |
1331 | spec->int_mic.pin = fixed; | |
1332 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1333 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1334 | spec->auto_mic = 1; | |
1335 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, | |
1336 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1337 | AC_USRSP_EN | ALC880_MIC_EVENT); | |
1338 | spec->unsol_event = alc_sku_unsol_event; | |
1339 | } | |
1340 | ||
da00c244 KY |
1341 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
1342 | { | |
1343 | unsigned int ass, tmp, i; | |
7fb56223 | 1344 | unsigned nid = 0; |
da00c244 KY |
1345 | struct alc_spec *spec = codec->spec; |
1346 | ||
b6cbe517 TI |
1347 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
1348 | ||
da00c244 | 1349 | ass = codec->subsystem_id & 0xffff; |
b6cbe517 | 1350 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
da00c244 KY |
1351 | goto do_sku; |
1352 | ||
1353 | nid = 0x1d; | |
1354 | if (codec->vendor_id == 0x10ec0260) | |
1355 | nid = 0x17; | |
1356 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1357 | ||
1358 | if (!(ass & 1)) { | |
1359 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", | |
1360 | codec->chip_name, ass); | |
1361 | return -1; | |
1362 | } | |
1363 | ||
1364 | /* check sum */ | |
1365 | tmp = 0; | |
1366 | for (i = 1; i < 16; i++) { | |
1367 | if ((ass >> i) & 1) | |
1368 | tmp++; | |
1369 | } | |
1370 | if (((ass >> 16) & 0xf) != tmp) | |
1371 | return -1; | |
1372 | ||
1373 | spec->cdefine.port_connectivity = ass >> 30; | |
1374 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; | |
1375 | spec->cdefine.check_sum = (ass >> 16) & 0xf; | |
1376 | spec->cdefine.customization = ass >> 8; | |
1377 | do_sku: | |
1378 | spec->cdefine.sku_cfg = ass; | |
1379 | spec->cdefine.external_amp = (ass & 0x38) >> 3; | |
1380 | spec->cdefine.platform_type = (ass & 0x4) >> 2; | |
1381 | spec->cdefine.swap = (ass & 0x2) >> 1; | |
1382 | spec->cdefine.override = ass & 0x1; | |
1383 | ||
1384 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", | |
1385 | nid, spec->cdefine.sku_cfg); | |
1386 | snd_printd("SKU: port_connectivity=0x%x\n", | |
1387 | spec->cdefine.port_connectivity); | |
1388 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); | |
1389 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); | |
1390 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); | |
1391 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); | |
1392 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); | |
1393 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); | |
1394 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); | |
1395 | ||
1396 | return 0; | |
1397 | } | |
1398 | ||
4a79ba34 TI |
1399 | /* check subsystem ID and set up device-specific initialization; |
1400 | * return 1 if initialized, 0 if invalid SSID | |
1401 | */ | |
1402 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | |
1403 | * 31 ~ 16 : Manufacture ID | |
1404 | * 15 ~ 8 : SKU ID | |
1405 | * 7 ~ 0 : Assembly ID | |
1406 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
1407 | */ | |
1408 | static int alc_subsystem_id(struct hda_codec *codec, | |
1409 | hda_nid_t porta, hda_nid_t porte, | |
6227cdce | 1410 | hda_nid_t portd, hda_nid_t porti) |
4a79ba34 TI |
1411 | { |
1412 | unsigned int ass, tmp, i; | |
1413 | unsigned nid; | |
1414 | struct alc_spec *spec = codec->spec; | |
1415 | ||
1416 | ass = codec->subsystem_id & 0xffff; | |
1417 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
1418 | goto do_sku; | |
1419 | ||
1420 | /* invalid SSID, check the special NID pin defcfg instead */ | |
1421 | /* | |
def319f9 | 1422 | * 31~30 : port connectivity |
4a79ba34 TI |
1423 | * 29~21 : reserve |
1424 | * 20 : PCBEEP input | |
1425 | * 19~16 : Check sum (15:1) | |
1426 | * 15~1 : Custom | |
1427 | * 0 : override | |
1428 | */ | |
1429 | nid = 0x1d; | |
1430 | if (codec->vendor_id == 0x10ec0260) | |
1431 | nid = 0x17; | |
1432 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1433 | snd_printd("realtek: No valid SSID, " | |
1434 | "checking pincfg 0x%08x for NID 0x%x\n", | |
cb6605c1 | 1435 | ass, nid); |
6227cdce | 1436 | if (!(ass & 1)) |
4a79ba34 TI |
1437 | return 0; |
1438 | if ((ass >> 30) != 1) /* no physical connection */ | |
1439 | return 0; | |
1440 | ||
1441 | /* check sum */ | |
1442 | tmp = 0; | |
1443 | for (i = 1; i < 16; i++) { | |
1444 | if ((ass >> i) & 1) | |
1445 | tmp++; | |
1446 | } | |
1447 | if (((ass >> 16) & 0xf) != tmp) | |
1448 | return 0; | |
1449 | do_sku: | |
1450 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", | |
1451 | ass & 0xffff, codec->vendor_id); | |
1452 | /* | |
1453 | * 0 : override | |
1454 | * 1 : Swap Jack | |
1455 | * 2 : 0 --> Desktop, 1 --> Laptop | |
1456 | * 3~5 : External Amplifier control | |
1457 | * 7~6 : Reserved | |
1458 | */ | |
1459 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | |
1460 | switch (tmp) { | |
1461 | case 1: | |
1462 | spec->init_amp = ALC_INIT_GPIO1; | |
1463 | break; | |
1464 | case 3: | |
1465 | spec->init_amp = ALC_INIT_GPIO2; | |
1466 | break; | |
1467 | case 7: | |
1468 | spec->init_amp = ALC_INIT_GPIO3; | |
1469 | break; | |
1470 | case 5: | |
1471 | spec->init_amp = ALC_INIT_DEFAULT; | |
bc9f98a9 KY |
1472 | break; |
1473 | } | |
ea1fb29a | 1474 | |
8c427226 | 1475 | /* is laptop or Desktop and enable the function "Mute internal speaker |
c9b58006 KY |
1476 | * when the external headphone out jack is plugged" |
1477 | */ | |
8c427226 | 1478 | if (!(ass & 0x8000)) |
4a79ba34 | 1479 | return 1; |
c9b58006 KY |
1480 | /* |
1481 | * 10~8 : Jack location | |
1482 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
1483 | * 14~13: Resvered | |
1484 | * 15 : 1 --> enable the function "Mute internal speaker | |
1485 | * when the external headphone out jack is plugged" | |
1486 | */ | |
c9b58006 | 1487 | if (!spec->autocfg.hp_pins[0]) { |
01d4825d | 1488 | hda_nid_t nid; |
c9b58006 KY |
1489 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
1490 | if (tmp == 0) | |
01d4825d | 1491 | nid = porta; |
c9b58006 | 1492 | else if (tmp == 1) |
01d4825d | 1493 | nid = porte; |
c9b58006 | 1494 | else if (tmp == 2) |
01d4825d | 1495 | nid = portd; |
6227cdce KY |
1496 | else if (tmp == 3) |
1497 | nid = porti; | |
c9b58006 | 1498 | else |
4a79ba34 | 1499 | return 1; |
01d4825d TI |
1500 | for (i = 0; i < spec->autocfg.line_outs; i++) |
1501 | if (spec->autocfg.line_out_pins[i] == nid) | |
1502 | return 1; | |
1503 | spec->autocfg.hp_pins[0] = nid; | |
c9b58006 KY |
1504 | } |
1505 | ||
4a79ba34 | 1506 | alc_init_auto_hp(codec); |
6c819492 | 1507 | alc_init_auto_mic(codec); |
4a79ba34 TI |
1508 | return 1; |
1509 | } | |
ea1fb29a | 1510 | |
4a79ba34 | 1511 | static void alc_ssid_check(struct hda_codec *codec, |
6227cdce KY |
1512 | hda_nid_t porta, hda_nid_t porte, |
1513 | hda_nid_t portd, hda_nid_t porti) | |
4a79ba34 | 1514 | { |
6227cdce | 1515 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
4a79ba34 TI |
1516 | struct alc_spec *spec = codec->spec; |
1517 | snd_printd("realtek: " | |
1518 | "Enable default setup for auto mode as fallback\n"); | |
1519 | spec->init_amp = ALC_INIT_DEFAULT; | |
1520 | alc_init_auto_hp(codec); | |
6c819492 | 1521 | alc_init_auto_mic(codec); |
4a79ba34 | 1522 | } |
bc9f98a9 KY |
1523 | } |
1524 | ||
f95474ec | 1525 | /* |
f8f25ba3 | 1526 | * Fix-up pin default configurations and add default verbs |
f95474ec TI |
1527 | */ |
1528 | ||
1529 | struct alc_pincfg { | |
1530 | hda_nid_t nid; | |
1531 | u32 val; | |
1532 | }; | |
1533 | ||
f8f25ba3 TI |
1534 | struct alc_fixup { |
1535 | const struct alc_pincfg *pins; | |
1536 | const struct hda_verb *verbs; | |
1537 | }; | |
1538 | ||
1539 | static void alc_pick_fixup(struct hda_codec *codec, | |
f95474ec | 1540 | const struct snd_pci_quirk *quirk, |
7fa90e87 TI |
1541 | const struct alc_fixup *fix, |
1542 | int pre_init) | |
f95474ec TI |
1543 | { |
1544 | const struct alc_pincfg *cfg; | |
1545 | ||
1546 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
1547 | if (!quirk) | |
1548 | return; | |
f8f25ba3 TI |
1549 | fix += quirk->value; |
1550 | cfg = fix->pins; | |
7fa90e87 TI |
1551 | if (pre_init && cfg) { |
1552 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1553 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", | |
1554 | codec->chip_name, quirk->name); | |
1555 | #endif | |
f8f25ba3 TI |
1556 | for (; cfg->nid; cfg++) |
1557 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | |
1558 | } | |
7fa90e87 TI |
1559 | if (!pre_init && fix->verbs) { |
1560 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1561 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", | |
1562 | codec->chip_name, quirk->name); | |
1563 | #endif | |
f8f25ba3 | 1564 | add_verb(codec->spec, fix->verbs); |
7fa90e87 | 1565 | } |
f95474ec TI |
1566 | } |
1567 | ||
274693f3 KY |
1568 | static int alc_read_coef_idx(struct hda_codec *codec, |
1569 | unsigned int coef_idx) | |
1570 | { | |
1571 | unsigned int val; | |
1572 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1573 | coef_idx); | |
1574 | val = snd_hda_codec_read(codec, 0x20, 0, | |
1575 | AC_VERB_GET_PROC_COEF, 0); | |
1576 | return val; | |
1577 | } | |
1578 | ||
757899ac TI |
1579 | /* set right pin controls for digital I/O */ |
1580 | static void alc_auto_init_digital(struct hda_codec *codec) | |
1581 | { | |
1582 | struct alc_spec *spec = codec->spec; | |
1583 | int i; | |
1584 | hda_nid_t pin; | |
1585 | ||
1586 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1587 | pin = spec->autocfg.dig_out_pins[i]; | |
1588 | if (pin) { | |
1589 | snd_hda_codec_write(codec, pin, 0, | |
1590 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1591 | PIN_OUT); | |
1592 | } | |
1593 | } | |
1594 | pin = spec->autocfg.dig_in_pin; | |
1595 | if (pin) | |
1596 | snd_hda_codec_write(codec, pin, 0, | |
1597 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1598 | PIN_IN); | |
1599 | } | |
1600 | ||
1601 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ | |
1602 | static void alc_auto_parse_digital(struct hda_codec *codec) | |
1603 | { | |
1604 | struct alc_spec *spec = codec->spec; | |
1605 | int i, err; | |
1606 | hda_nid_t dig_nid; | |
1607 | ||
1608 | /* support multiple SPDIFs; the secondary is set up as a slave */ | |
1609 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1610 | err = snd_hda_get_connections(codec, | |
1611 | spec->autocfg.dig_out_pins[i], | |
1612 | &dig_nid, 1); | |
1613 | if (err < 0) | |
1614 | continue; | |
1615 | if (!i) { | |
1616 | spec->multiout.dig_out_nid = dig_nid; | |
1617 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | |
1618 | } else { | |
1619 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | |
1620 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | |
1621 | break; | |
1622 | spec->slave_dig_outs[i - 1] = dig_nid; | |
1623 | } | |
1624 | } | |
1625 | ||
1626 | if (spec->autocfg.dig_in_pin) { | |
1627 | hda_nid_t dig_nid; | |
1628 | err = snd_hda_get_connections(codec, | |
1629 | spec->autocfg.dig_in_pin, | |
1630 | &dig_nid, 1); | |
1631 | if (err > 0) | |
1632 | spec->dig_in_nid = dig_nid; | |
1633 | } | |
1634 | } | |
1635 | ||
ef8ef5fb VP |
1636 | /* |
1637 | * ALC888 | |
1638 | */ | |
1639 | ||
1640 | /* | |
1641 | * 2ch mode | |
1642 | */ | |
1643 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { | |
1644 | /* Mic-in jack as mic in */ | |
1645 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1646 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1647 | /* Line-in jack as Line in */ | |
1648 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1649 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1650 | /* Line-Out as Front */ | |
1651 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1652 | { } /* end */ | |
1653 | }; | |
1654 | ||
1655 | /* | |
1656 | * 4ch mode | |
1657 | */ | |
1658 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { | |
1659 | /* Mic-in jack as mic in */ | |
1660 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1661 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1662 | /* Line-in jack as Surround */ | |
1663 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1664 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1665 | /* Line-Out as Front */ | |
1666 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1667 | { } /* end */ | |
1668 | }; | |
1669 | ||
1670 | /* | |
1671 | * 6ch mode | |
1672 | */ | |
1673 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { | |
1674 | /* Mic-in jack as CLFE */ | |
1675 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1676 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1677 | /* Line-in jack as Surround */ | |
1678 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1679 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1680 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ | |
1681 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1682 | { } /* end */ | |
1683 | }; | |
1684 | ||
1685 | /* | |
1686 | * 8ch mode | |
1687 | */ | |
1688 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { | |
1689 | /* Mic-in jack as CLFE */ | |
1690 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1691 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1692 | /* Line-in jack as Surround */ | |
1693 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1694 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1695 | /* Line-Out as Side */ | |
1696 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1697 | { } /* end */ | |
1698 | }; | |
1699 | ||
1700 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { | |
1701 | { 2, alc888_4ST_ch2_intel_init }, | |
1702 | { 4, alc888_4ST_ch4_intel_init }, | |
1703 | { 6, alc888_4ST_ch6_intel_init }, | |
1704 | { 8, alc888_4ST_ch8_intel_init }, | |
1705 | }; | |
1706 | ||
1707 | /* | |
1708 | * ALC888 Fujitsu Siemens Amillo xa3530 | |
1709 | */ | |
1710 | ||
1711 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | |
1712 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1713 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1714 | /* Connect Internal HP to Front */ | |
1715 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1716 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1717 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1718 | /* Connect Bass HP to Front */ | |
1719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1720 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1721 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1722 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
1723 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1724 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1725 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1726 | /* Connect Mic jack to CLFE */ | |
1727 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1728 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1729 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1730 | /* Connect Line-in jack to Surround */ | |
1731 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1732 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1733 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1734 | /* Connect HP out jack to Front */ | |
1735 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1736 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1737 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1738 | /* Enable unsolicited event for HP jack and Line-out jack */ | |
1739 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1740 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1741 | {} | |
1742 | }; | |
1743 | ||
a9fd4f3f | 1744 | static void alc_automute_amp(struct hda_codec *codec) |
ef8ef5fb | 1745 | { |
bb35febd | 1746 | alc_automute_speaker(codec, 0); |
ef8ef5fb VP |
1747 | } |
1748 | ||
a9fd4f3f TI |
1749 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
1750 | unsigned int res) | |
ef8ef5fb | 1751 | { |
a9fd4f3f TI |
1752 | if (codec->vendor_id == 0x10ec0880) |
1753 | res >>= 28; | |
1754 | else | |
1755 | res >>= 26; | |
1756 | if (res == ALC880_HP_EVENT) | |
1757 | alc_automute_amp(codec); | |
ef8ef5fb VP |
1758 | } |
1759 | ||
4f5d1706 | 1760 | static void alc889_automute_setup(struct hda_codec *codec) |
6732bd0d WF |
1761 | { |
1762 | struct alc_spec *spec = codec->spec; | |
1763 | ||
1764 | spec->autocfg.hp_pins[0] = 0x15; | |
1765 | spec->autocfg.speaker_pins[0] = 0x14; | |
1766 | spec->autocfg.speaker_pins[1] = 0x16; | |
1767 | spec->autocfg.speaker_pins[2] = 0x17; | |
1768 | spec->autocfg.speaker_pins[3] = 0x19; | |
1769 | spec->autocfg.speaker_pins[4] = 0x1a; | |
6732bd0d WF |
1770 | } |
1771 | ||
1772 | static void alc889_intel_init_hook(struct hda_codec *codec) | |
1773 | { | |
1774 | alc889_coef_init(codec); | |
4f5d1706 | 1775 | alc_automute_amp(codec); |
6732bd0d WF |
1776 | } |
1777 | ||
4f5d1706 | 1778 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
a9fd4f3f TI |
1779 | { |
1780 | struct alc_spec *spec = codec->spec; | |
1781 | ||
1782 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ | |
1783 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | |
1784 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | |
1785 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | |
a9fd4f3f | 1786 | } |
ef8ef5fb | 1787 | |
5b2d1eca VP |
1788 | /* |
1789 | * ALC888 Acer Aspire 4930G model | |
1790 | */ | |
1791 | ||
1792 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | |
1793 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1794 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1795 | /* Unselect Front Mic by default in input mixer 3 */ | |
1796 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
ef8ef5fb | 1797 | /* Enable unsolicited event for HP jack */ |
5b2d1eca VP |
1798 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
1799 | /* Connect Internal HP to front */ | |
1800 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1801 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1802 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1803 | /* Connect HP out to front */ | |
1804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1805 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1806 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1807 | { } | |
1808 | }; | |
1809 | ||
d2fd4b09 TV |
1810 | /* |
1811 | * ALC888 Acer Aspire 6530G model | |
1812 | */ | |
1813 | ||
1814 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | |
d1284182 TV |
1815 | /* Route to built-in subwoofer as well as speakers */ |
1816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
1818 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1819 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
d2fd4b09 TV |
1820 | /* Bias voltage on for external mic port */ |
1821 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | |
320d5920 EL |
1822 | /* Front Mic: set to PIN_IN (empty by default) */ |
1823 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1824 | /* Unselect Front Mic by default in input mixer 3 */ | |
1825 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
d2fd4b09 TV |
1826 | /* Enable unsolicited event for HP jack */ |
1827 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1828 | /* Enable speaker output */ | |
1829 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1830 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
d1284182 | 1831 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
d2fd4b09 TV |
1832 | /* Enable headphone output */ |
1833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
1834 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1835 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1284182 | 1836 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
d2fd4b09 TV |
1837 | { } |
1838 | }; | |
1839 | ||
3b315d70 | 1840 | /* |
018df418 | 1841 | * ALC889 Acer Aspire 8930G model |
3b315d70 HM |
1842 | */ |
1843 | ||
018df418 | 1844 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
3b315d70 HM |
1845 | /* Front Mic: set to PIN_IN (empty by default) */ |
1846 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1847 | /* Unselect Front Mic by default in input mixer 3 */ | |
1848 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
1849 | /* Enable unsolicited event for HP jack */ | |
1850 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1851 | /* Connect Internal Front to Front */ | |
1852 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1853 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1854 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1855 | /* Connect Internal Rear to Rear */ | |
1856 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1857 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1858 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1859 | /* Connect Internal CLFE to CLFE */ | |
1860 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1861 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1862 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1863 | /* Connect HP out to Front */ | |
018df418 | 1864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
3b315d70 HM |
1865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1866 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1867 | /* Enable all DACs */ | |
1868 | /* DAC DISABLE/MUTE 1? */ | |
1869 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ | |
1870 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, | |
1871 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
1872 | /* DAC DISABLE/MUTE 2? */ | |
1873 | /* some bit here disables the other DACs. Init=0x4900 */ | |
1874 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | |
1875 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
018df418 HM |
1876 | /* DMIC fix |
1877 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | |
1878 | * which makes the stereo useless. However, either the mic or the ALC889 | |
1879 | * makes the signal become a difference/sum signal instead of standard | |
1880 | * stereo, which is annoying. So instead we flip this bit which makes the | |
1881 | * codec replicate the sum signal to both channels, turning it into a | |
1882 | * normal mono mic. | |
1883 | */ | |
1884 | /* DMIC_CONTROL? Init value = 0x0001 */ | |
1885 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
1886 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, | |
3b315d70 HM |
1887 | { } |
1888 | }; | |
1889 | ||
ef8ef5fb | 1890 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
5b2d1eca VP |
1891 | /* Front mic only available on one ADC */ |
1892 | { | |
1893 | .num_items = 4, | |
1894 | .items = { | |
1895 | { "Mic", 0x0 }, | |
1896 | { "Line", 0x2 }, | |
1897 | { "CD", 0x4 }, | |
1898 | { "Front Mic", 0xb }, | |
1899 | }, | |
1900 | }, | |
1901 | { | |
1902 | .num_items = 3, | |
1903 | .items = { | |
1904 | { "Mic", 0x0 }, | |
1905 | { "Line", 0x2 }, | |
1906 | { "CD", 0x4 }, | |
1907 | }, | |
1908 | } | |
1909 | }; | |
1910 | ||
d2fd4b09 TV |
1911 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
1912 | /* Interal mic only available on one ADC */ | |
1913 | { | |
684a8842 | 1914 | .num_items = 5, |
d2fd4b09 TV |
1915 | .items = { |
1916 | { "Ext Mic", 0x0 }, | |
684a8842 | 1917 | { "Line In", 0x2 }, |
d2fd4b09 | 1918 | { "CD", 0x4 }, |
684a8842 | 1919 | { "Input Mix", 0xa }, |
d2fd4b09 TV |
1920 | { "Int Mic", 0xb }, |
1921 | }, | |
1922 | }, | |
1923 | { | |
684a8842 | 1924 | .num_items = 4, |
d2fd4b09 TV |
1925 | .items = { |
1926 | { "Ext Mic", 0x0 }, | |
684a8842 | 1927 | { "Line In", 0x2 }, |
d2fd4b09 | 1928 | { "CD", 0x4 }, |
684a8842 | 1929 | { "Input Mix", 0xa }, |
d2fd4b09 TV |
1930 | }, |
1931 | } | |
1932 | }; | |
1933 | ||
018df418 HM |
1934 | static struct hda_input_mux alc889_capture_sources[3] = { |
1935 | /* Digital mic only available on first "ADC" */ | |
1936 | { | |
1937 | .num_items = 5, | |
1938 | .items = { | |
1939 | { "Mic", 0x0 }, | |
1940 | { "Line", 0x2 }, | |
1941 | { "CD", 0x4 }, | |
1942 | { "Front Mic", 0xb }, | |
1943 | { "Input Mix", 0xa }, | |
1944 | }, | |
1945 | }, | |
1946 | { | |
1947 | .num_items = 4, | |
1948 | .items = { | |
1949 | { "Mic", 0x0 }, | |
1950 | { "Line", 0x2 }, | |
1951 | { "CD", 0x4 }, | |
1952 | { "Input Mix", 0xa }, | |
1953 | }, | |
1954 | }, | |
1955 | { | |
1956 | .num_items = 4, | |
1957 | .items = { | |
1958 | { "Mic", 0x0 }, | |
1959 | { "Line", 0x2 }, | |
1960 | { "CD", 0x4 }, | |
1961 | { "Input Mix", 0xa }, | |
1962 | }, | |
1963 | } | |
1964 | }; | |
1965 | ||
ef8ef5fb | 1966 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
5b2d1eca VP |
1967 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
1968 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
1969 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1970 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
1971 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
1972 | HDA_OUTPUT), | |
1973 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1974 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1975 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1976 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
1977 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
1978 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1979 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1981 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1982 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1983 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
1984 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5b2d1eca VP |
1985 | { } /* end */ |
1986 | }; | |
1987 | ||
556eea9a HM |
1988 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
1989 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1990 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
1991 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1992 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
1993 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
1994 | HDA_OUTPUT), | |
1995 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1996 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1997 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1998 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1999 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2001 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
2002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2003 | { } /* end */ | |
2004 | }; | |
2005 | ||
2006 | ||
4f5d1706 | 2007 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
5b2d1eca | 2008 | { |
a9fd4f3f | 2009 | struct alc_spec *spec = codec->spec; |
5b2d1eca | 2010 | |
a9fd4f3f TI |
2011 | spec->autocfg.hp_pins[0] = 0x15; |
2012 | spec->autocfg.speaker_pins[0] = 0x14; | |
7cef4cf1 ŁW |
2013 | spec->autocfg.speaker_pins[1] = 0x16; |
2014 | spec->autocfg.speaker_pins[2] = 0x17; | |
5b2d1eca VP |
2015 | } |
2016 | ||
4f5d1706 | 2017 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
320d5920 EL |
2018 | { |
2019 | struct alc_spec *spec = codec->spec; | |
2020 | ||
2021 | spec->autocfg.hp_pins[0] = 0x15; | |
2022 | spec->autocfg.speaker_pins[0] = 0x14; | |
2023 | spec->autocfg.speaker_pins[1] = 0x16; | |
2024 | spec->autocfg.speaker_pins[2] = 0x17; | |
320d5920 EL |
2025 | } |
2026 | ||
4f5d1706 | 2027 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
3b315d70 HM |
2028 | { |
2029 | struct alc_spec *spec = codec->spec; | |
2030 | ||
2031 | spec->autocfg.hp_pins[0] = 0x15; | |
2032 | spec->autocfg.speaker_pins[0] = 0x14; | |
2033 | spec->autocfg.speaker_pins[1] = 0x16; | |
2034 | spec->autocfg.speaker_pins[2] = 0x1b; | |
3b315d70 HM |
2035 | } |
2036 | ||
1da177e4 | 2037 | /* |
e9edcee0 TI |
2038 | * ALC880 3-stack model |
2039 | * | |
2040 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
9c7f852e TI |
2041 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
2042 | * F-Mic = 0x1b, HP = 0x19 | |
1da177e4 LT |
2043 | */ |
2044 | ||
e9edcee0 TI |
2045 | static hda_nid_t alc880_dac_nids[4] = { |
2046 | /* front, rear, clfe, rear_surr */ | |
2047 | 0x02, 0x05, 0x04, 0x03 | |
2048 | }; | |
2049 | ||
2050 | static hda_nid_t alc880_adc_nids[3] = { | |
2051 | /* ADC0-2 */ | |
2052 | 0x07, 0x08, 0x09, | |
2053 | }; | |
2054 | ||
2055 | /* The datasheet says the node 0x07 is connected from inputs, | |
2056 | * but it shows zero connection in the real implementation on some devices. | |
df694daa | 2057 | * Note: this is a 915GAV bug, fixed on 915GLV |
1da177e4 | 2058 | */ |
e9edcee0 TI |
2059 | static hda_nid_t alc880_adc_nids_alt[2] = { |
2060 | /* ADC1-2 */ | |
2061 | 0x08, 0x09, | |
2062 | }; | |
2063 | ||
2064 | #define ALC880_DIGOUT_NID 0x06 | |
2065 | #define ALC880_DIGIN_NID 0x0a | |
2066 | ||
2067 | static struct hda_input_mux alc880_capture_source = { | |
2068 | .num_items = 4, | |
2069 | .items = { | |
2070 | { "Mic", 0x0 }, | |
2071 | { "Front Mic", 0x3 }, | |
2072 | { "Line", 0x2 }, | |
2073 | { "CD", 0x4 }, | |
2074 | }, | |
2075 | }; | |
2076 | ||
2077 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
2078 | /* 2ch mode */ | |
2079 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
2080 | /* set line-in to input, mute it */ | |
2081 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2082 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2083 | /* set mic-in to input vref 80%, mute it */ | |
2084 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2085 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2086 | { } /* end */ | |
2087 | }; | |
2088 | ||
2089 | /* 6ch mode */ | |
2090 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
2091 | /* set line-in to output, unmute it */ | |
2092 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2093 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2094 | /* set mic-in to output, unmute it */ | |
2095 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2096 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2097 | { } /* end */ | |
2098 | }; | |
2099 | ||
d2a6d7dc | 2100 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
e9edcee0 TI |
2101 | { 2, alc880_threestack_ch2_init }, |
2102 | { 6, alc880_threestack_ch6_init }, | |
2103 | }; | |
2104 | ||
c8b6bf9b | 2105 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
05acb863 | 2106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2107 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 2108 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 2109 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
05acb863 TI |
2110 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2111 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2112 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2113 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1da177e4 LT |
2114 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2115 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2116 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2117 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2118 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2119 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2120 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
2121 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
e9edcee0 TI |
2122 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
2123 | { | |
2124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2125 | .name = "Channel Mode", | |
df694daa KY |
2126 | .info = alc_ch_mode_info, |
2127 | .get = alc_ch_mode_get, | |
2128 | .put = alc_ch_mode_put, | |
e9edcee0 TI |
2129 | }, |
2130 | { } /* end */ | |
2131 | }; | |
2132 | ||
2133 | /* capture mixer elements */ | |
f9e336f6 TI |
2134 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
2135 | struct snd_ctl_elem_info *uinfo) | |
2136 | { | |
2137 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2138 | struct alc_spec *spec = codec->spec; | |
2139 | int err; | |
1da177e4 | 2140 | |
5a9e02e9 | 2141 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2142 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
2143 | HDA_INPUT); | |
2144 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | |
5a9e02e9 | 2145 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2146 | return err; |
2147 | } | |
2148 | ||
2149 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |
2150 | unsigned int size, unsigned int __user *tlv) | |
2151 | { | |
2152 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2153 | struct alc_spec *spec = codec->spec; | |
2154 | int err; | |
1da177e4 | 2155 | |
5a9e02e9 | 2156 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2157 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
2158 | HDA_INPUT); | |
2159 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | |
5a9e02e9 | 2160 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2161 | return err; |
2162 | } | |
2163 | ||
2164 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, | |
2165 | struct snd_ctl_elem_value *ucontrol); | |
2166 | ||
2167 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | |
2168 | struct snd_ctl_elem_value *ucontrol, | |
2169 | getput_call_t func) | |
2170 | { | |
2171 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2172 | struct alc_spec *spec = codec->spec; | |
2173 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
2174 | int err; | |
2175 | ||
5a9e02e9 | 2176 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2177 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
2178 | 3, 0, HDA_INPUT); | |
2179 | err = func(kcontrol, ucontrol); | |
5a9e02e9 | 2180 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2181 | return err; |
2182 | } | |
2183 | ||
2184 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, | |
2185 | struct snd_ctl_elem_value *ucontrol) | |
2186 | { | |
2187 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2188 | snd_hda_mixer_amp_volume_get); | |
2189 | } | |
2190 | ||
2191 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, | |
2192 | struct snd_ctl_elem_value *ucontrol) | |
2193 | { | |
2194 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2195 | snd_hda_mixer_amp_volume_put); | |
2196 | } | |
2197 | ||
2198 | /* capture mixer elements */ | |
2199 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info | |
2200 | ||
2201 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, | |
2202 | struct snd_ctl_elem_value *ucontrol) | |
2203 | { | |
2204 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2205 | snd_hda_mixer_amp_switch_get); | |
2206 | } | |
2207 | ||
2208 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |
2209 | struct snd_ctl_elem_value *ucontrol) | |
2210 | { | |
2211 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2212 | snd_hda_mixer_amp_switch_put); | |
2213 | } | |
2214 | ||
a23b688f | 2215 | #define _DEFINE_CAPMIX(num) \ |
f9e336f6 TI |
2216 | { \ |
2217 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2218 | .name = "Capture Switch", \ | |
2219 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | |
2220 | .count = num, \ | |
2221 | .info = alc_cap_sw_info, \ | |
2222 | .get = alc_cap_sw_get, \ | |
2223 | .put = alc_cap_sw_put, \ | |
2224 | }, \ | |
2225 | { \ | |
2226 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2227 | .name = "Capture Volume", \ | |
2228 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | |
2229 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | |
2230 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ | |
2231 | .count = num, \ | |
2232 | .info = alc_cap_vol_info, \ | |
2233 | .get = alc_cap_vol_get, \ | |
2234 | .put = alc_cap_vol_put, \ | |
2235 | .tlv = { .c = alc_cap_vol_tlv }, \ | |
a23b688f TI |
2236 | } |
2237 | ||
2238 | #define _DEFINE_CAPSRC(num) \ | |
3c3e9892 TI |
2239 | { \ |
2240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2241 | /* .name = "Capture Source", */ \ | |
2242 | .name = "Input Source", \ | |
2243 | .count = num, \ | |
2244 | .info = alc_mux_enum_info, \ | |
2245 | .get = alc_mux_enum_get, \ | |
2246 | .put = alc_mux_enum_put, \ | |
a23b688f TI |
2247 | } |
2248 | ||
2249 | #define DEFINE_CAPMIX(num) \ | |
2250 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |
2251 | _DEFINE_CAPMIX(num), \ | |
2252 | _DEFINE_CAPSRC(num), \ | |
2253 | { } /* end */ \ | |
2254 | } | |
2255 | ||
2256 | #define DEFINE_CAPMIX_NOSRC(num) \ | |
2257 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | |
2258 | _DEFINE_CAPMIX(num), \ | |
2259 | { } /* end */ \ | |
f9e336f6 TI |
2260 | } |
2261 | ||
2262 | /* up to three ADCs */ | |
2263 | DEFINE_CAPMIX(1); | |
2264 | DEFINE_CAPMIX(2); | |
2265 | DEFINE_CAPMIX(3); | |
a23b688f TI |
2266 | DEFINE_CAPMIX_NOSRC(1); |
2267 | DEFINE_CAPMIX_NOSRC(2); | |
2268 | DEFINE_CAPMIX_NOSRC(3); | |
e9edcee0 TI |
2269 | |
2270 | /* | |
2271 | * ALC880 5-stack model | |
2272 | * | |
9c7f852e TI |
2273 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
2274 | * Side = 0x02 (0xd) | |
e9edcee0 TI |
2275 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
2276 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
2277 | */ | |
2278 | ||
2279 | /* additional mixers to alc880_three_stack_mixer */ | |
c8b6bf9b | 2280 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
e9edcee0 | 2281 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2282 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
1da177e4 LT |
2283 | { } /* end */ |
2284 | }; | |
2285 | ||
e9edcee0 TI |
2286 | /* channel source setting (6/8 channel selection for 5-stack) */ |
2287 | /* 6ch mode */ | |
2288 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
2289 | /* set line-in to input, mute it */ | |
2290 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2291 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
dfc0ff62 TI |
2292 | { } /* end */ |
2293 | }; | |
2294 | ||
e9edcee0 TI |
2295 | /* 8ch mode */ |
2296 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
2297 | /* set line-in to output, unmute it */ | |
2298 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2299 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2300 | { } /* end */ | |
2301 | }; | |
2302 | ||
d2a6d7dc | 2303 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
e9edcee0 TI |
2304 | { 6, alc880_fivestack_ch6_init }, |
2305 | { 8, alc880_fivestack_ch8_init }, | |
2306 | }; | |
2307 | ||
2308 | ||
2309 | /* | |
2310 | * ALC880 6-stack model | |
2311 | * | |
9c7f852e TI |
2312 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
2313 | * Side = 0x05 (0x0f) | |
e9edcee0 TI |
2314 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
2315 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
2316 | */ | |
2317 | ||
2318 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
2319 | /* front, rear, clfe, rear_surr */ | |
2320 | 0x02, 0x03, 0x04, 0x05 | |
f12ab1e0 | 2321 | }; |
e9edcee0 TI |
2322 | |
2323 | static struct hda_input_mux alc880_6stack_capture_source = { | |
2324 | .num_items = 4, | |
2325 | .items = { | |
2326 | { "Mic", 0x0 }, | |
2327 | { "Front Mic", 0x1 }, | |
2328 | { "Line", 0x2 }, | |
2329 | { "CD", 0x4 }, | |
2330 | }, | |
2331 | }; | |
2332 | ||
2333 | /* fixed 8-channels */ | |
d2a6d7dc | 2334 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
e9edcee0 TI |
2335 | { 8, NULL }, |
2336 | }; | |
2337 | ||
c8b6bf9b | 2338 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
16ded525 | 2339 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2340 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2341 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2342 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2343 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2344 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2345 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2346 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 | 2347 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 2348 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
16ded525 TI |
2349 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2350 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2351 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2352 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2355 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2356 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16ded525 TI |
2357 | { |
2358 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2359 | .name = "Channel Mode", | |
df694daa KY |
2360 | .info = alc_ch_mode_info, |
2361 | .get = alc_ch_mode_get, | |
2362 | .put = alc_ch_mode_put, | |
16ded525 TI |
2363 | }, |
2364 | { } /* end */ | |
2365 | }; | |
2366 | ||
e9edcee0 TI |
2367 | |
2368 | /* | |
2369 | * ALC880 W810 model | |
2370 | * | |
2371 | * W810 has rear IO for: | |
2372 | * Front (DAC 02) | |
2373 | * Surround (DAC 03) | |
2374 | * Center/LFE (DAC 04) | |
2375 | * Digital out (06) | |
2376 | * | |
2377 | * The system also has a pair of internal speakers, and a headphone jack. | |
2378 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
ea1fb29a | 2379 | * |
e9edcee0 TI |
2380 | * There is a variable resistor to control the speaker or headphone |
2381 | * volume. This is a hardware-only device without a software API. | |
2382 | * | |
2383 | * Plugging headphones in will disable the internal speakers. This is | |
2384 | * implemented in hardware, not via the driver using jack sense. In | |
2385 | * a similar fashion, plugging into the rear socket marked "front" will | |
2386 | * disable both the speakers and headphones. | |
2387 | * | |
2388 | * For input, there's a microphone jack, and an "audio in" jack. | |
2389 | * These may not do anything useful with this driver yet, because I | |
2390 | * haven't setup any initialization verbs for these yet... | |
2391 | */ | |
2392 | ||
2393 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
2394 | /* front, rear/surround, clfe */ | |
2395 | 0x02, 0x03, 0x04 | |
16ded525 TI |
2396 | }; |
2397 | ||
e9edcee0 | 2398 | /* fixed 6 channels */ |
d2a6d7dc | 2399 | static struct hda_channel_mode alc880_w810_modes[1] = { |
e9edcee0 TI |
2400 | { 6, NULL } |
2401 | }; | |
2402 | ||
2403 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
c8b6bf9b | 2404 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
16ded525 | 2405 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2406 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2407 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2408 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2409 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2410 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2411 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2412 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
e9edcee0 TI |
2413 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
2414 | { } /* end */ | |
2415 | }; | |
2416 | ||
2417 | ||
2418 | /* | |
2419 | * Z710V model | |
2420 | * | |
2421 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
9c7f852e TI |
2422 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
2423 | * Line = 0x1a | |
e9edcee0 TI |
2424 | */ |
2425 | ||
2426 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
2427 | 0x02 | |
2428 | }; | |
2429 | #define ALC880_Z71V_HP_DAC 0x03 | |
2430 | ||
2431 | /* fixed 2 channels */ | |
d2a6d7dc | 2432 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
e9edcee0 TI |
2433 | { 2, NULL } |
2434 | }; | |
2435 | ||
c8b6bf9b | 2436 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
e9edcee0 | 2437 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2438 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
e9edcee0 | 2439 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2440 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2441 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2442 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16ded525 TI |
2443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2444 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
2445 | { } /* end */ |
2446 | }; | |
2447 | ||
e9edcee0 | 2448 | |
e9edcee0 TI |
2449 | /* |
2450 | * ALC880 F1734 model | |
2451 | * | |
2452 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
2453 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
2454 | */ | |
2455 | ||
2456 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
2457 | 0x03 | |
2458 | }; | |
2459 | #define ALC880_F1734_HP_DAC 0x02 | |
2460 | ||
c8b6bf9b | 2461 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
e9edcee0 | 2462 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2463 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
2134ea4f TI |
2464 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
2465 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
e9edcee0 TI |
2466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2467 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
937b4160 TI |
2468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
2469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e9edcee0 TI |
2470 | { } /* end */ |
2471 | }; | |
2472 | ||
937b4160 TI |
2473 | static struct hda_input_mux alc880_f1734_capture_source = { |
2474 | .num_items = 2, | |
2475 | .items = { | |
2476 | { "Mic", 0x1 }, | |
2477 | { "CD", 0x4 }, | |
2478 | }, | |
2479 | }; | |
2480 | ||
e9edcee0 | 2481 | |
e9edcee0 TI |
2482 | /* |
2483 | * ALC880 ASUS model | |
2484 | * | |
2485 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2486 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2487 | * Mic = 0x18, Line = 0x1a | |
2488 | */ | |
2489 | ||
2490 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
2491 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
2492 | ||
c8b6bf9b | 2493 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
16ded525 | 2494 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2495 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2496 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2497 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2498 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2499 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2500 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2501 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 TI |
2502 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2503 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2505 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16ded525 TI |
2506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
2508 | { |
2509 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2510 | .name = "Channel Mode", | |
df694daa KY |
2511 | .info = alc_ch_mode_info, |
2512 | .get = alc_ch_mode_get, | |
2513 | .put = alc_ch_mode_put, | |
16ded525 TI |
2514 | }, |
2515 | { } /* end */ | |
2516 | }; | |
e9edcee0 | 2517 | |
e9edcee0 TI |
2518 | /* |
2519 | * ALC880 ASUS W1V model | |
2520 | * | |
2521 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2522 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2523 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
2524 | */ | |
2525 | ||
2526 | /* additional mixers to alc880_asus_mixer */ | |
c8b6bf9b | 2527 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
e9edcee0 TI |
2528 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
2529 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
2530 | { } /* end */ | |
2531 | }; | |
2532 | ||
df694daa KY |
2533 | /* TCL S700 */ |
2534 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
2535 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2536 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2537 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
2538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
2539 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
2540 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
2541 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
2542 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
2543 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
df694daa KY |
2544 | { } /* end */ |
2545 | }; | |
2546 | ||
ccc656ce KY |
2547 | /* Uniwill */ |
2548 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2134ea4f TI |
2549 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2550 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2551 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2552 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
2553 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2554 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2555 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2556 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2557 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2558 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2559 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2560 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2561 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2562 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2563 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2564 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce KY |
2565 | { |
2566 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2567 | .name = "Channel Mode", | |
2568 | .info = alc_ch_mode_info, | |
2569 | .get = alc_ch_mode_get, | |
2570 | .put = alc_ch_mode_put, | |
2571 | }, | |
2572 | { } /* end */ | |
2573 | }; | |
2574 | ||
2cf9f0fc TD |
2575 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
2576 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2577 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2578 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2579 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2580 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2581 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2582 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2583 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2584 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2585 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2586 | { } /* end */ | |
2587 | }; | |
2588 | ||
ccc656ce | 2589 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
2134ea4f TI |
2590 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2591 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2592 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2593 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
2594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2595 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2596 | { } /* end */ | |
2597 | }; | |
2598 | ||
2134ea4f TI |
2599 | /* |
2600 | * virtual master controls | |
2601 | */ | |
2602 | ||
2603 | /* | |
2604 | * slave controls for virtual master | |
2605 | */ | |
2606 | static const char *alc_slave_vols[] = { | |
2607 | "Front Playback Volume", | |
2608 | "Surround Playback Volume", | |
2609 | "Center Playback Volume", | |
2610 | "LFE Playback Volume", | |
2611 | "Side Playback Volume", | |
2612 | "Headphone Playback Volume", | |
2613 | "Speaker Playback Volume", | |
2614 | "Mono Playback Volume", | |
2134ea4f | 2615 | "Line-Out Playback Volume", |
26f5df26 | 2616 | "PCM Playback Volume", |
2134ea4f TI |
2617 | NULL, |
2618 | }; | |
2619 | ||
2620 | static const char *alc_slave_sws[] = { | |
2621 | "Front Playback Switch", | |
2622 | "Surround Playback Switch", | |
2623 | "Center Playback Switch", | |
2624 | "LFE Playback Switch", | |
2625 | "Side Playback Switch", | |
2626 | "Headphone Playback Switch", | |
2627 | "Speaker Playback Switch", | |
2628 | "Mono Playback Switch", | |
edb54a55 | 2629 | "IEC958 Playback Switch", |
23033b2b TI |
2630 | "Line-Out Playback Switch", |
2631 | "PCM Playback Switch", | |
2134ea4f TI |
2632 | NULL, |
2633 | }; | |
2634 | ||
1da177e4 | 2635 | /* |
e9edcee0 | 2636 | * build control elements |
1da177e4 | 2637 | */ |
603c4019 | 2638 | |
5b0cb1d8 JK |
2639 | #define NID_MAPPING (-1) |
2640 | ||
2641 | #define SUBDEV_SPEAKER_ (0 << 6) | |
2642 | #define SUBDEV_HP_ (1 << 6) | |
2643 | #define SUBDEV_LINE_ (2 << 6) | |
2644 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) | |
2645 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) | |
2646 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) | |
2647 | ||
603c4019 TI |
2648 | static void alc_free_kctls(struct hda_codec *codec); |
2649 | ||
67d634c0 | 2650 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
2651 | /* additional beep mixers; the actual parameters are overwritten at build */ |
2652 | static struct snd_kcontrol_new alc_beep_mixer[] = { | |
2653 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | |
123c07ae | 2654 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
45bdd1c1 TI |
2655 | { } /* end */ |
2656 | }; | |
67d634c0 | 2657 | #endif |
45bdd1c1 | 2658 | |
1da177e4 LT |
2659 | static int alc_build_controls(struct hda_codec *codec) |
2660 | { | |
2661 | struct alc_spec *spec = codec->spec; | |
2f44f847 | 2662 | struct snd_kcontrol *kctl = NULL; |
5b0cb1d8 JK |
2663 | struct snd_kcontrol_new *knew; |
2664 | int i, j, err; | |
2665 | unsigned int u; | |
2666 | hda_nid_t nid; | |
1da177e4 LT |
2667 | |
2668 | for (i = 0; i < spec->num_mixers; i++) { | |
2669 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
2670 | if (err < 0) | |
2671 | return err; | |
2672 | } | |
f9e336f6 TI |
2673 | if (spec->cap_mixer) { |
2674 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); | |
2675 | if (err < 0) | |
2676 | return err; | |
2677 | } | |
1da177e4 | 2678 | if (spec->multiout.dig_out_nid) { |
9c7f852e TI |
2679 | err = snd_hda_create_spdif_out_ctls(codec, |
2680 | spec->multiout.dig_out_nid); | |
1da177e4 LT |
2681 | if (err < 0) |
2682 | return err; | |
e64f14f4 TI |
2683 | if (!spec->no_analog) { |
2684 | err = snd_hda_create_spdif_share_sw(codec, | |
2685 | &spec->multiout); | |
2686 | if (err < 0) | |
2687 | return err; | |
2688 | spec->multiout.share_spdif = 1; | |
2689 | } | |
1da177e4 LT |
2690 | } |
2691 | if (spec->dig_in_nid) { | |
2692 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
2693 | if (err < 0) | |
2694 | return err; | |
2695 | } | |
2134ea4f | 2696 | |
67d634c0 | 2697 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
2698 | /* create beep controls if needed */ |
2699 | if (spec->beep_amp) { | |
2700 | struct snd_kcontrol_new *knew; | |
2701 | for (knew = alc_beep_mixer; knew->name; knew++) { | |
2702 | struct snd_kcontrol *kctl; | |
2703 | kctl = snd_ctl_new1(knew, codec); | |
2704 | if (!kctl) | |
2705 | return -ENOMEM; | |
2706 | kctl->private_value = spec->beep_amp; | |
5e26dfd0 | 2707 | err = snd_hda_ctl_add(codec, 0, kctl); |
45bdd1c1 TI |
2708 | if (err < 0) |
2709 | return err; | |
2710 | } | |
2711 | } | |
67d634c0 | 2712 | #endif |
45bdd1c1 | 2713 | |
2134ea4f | 2714 | /* if we have no master control, let's create it */ |
e64f14f4 TI |
2715 | if (!spec->no_analog && |
2716 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
1c82ed1b | 2717 | unsigned int vmaster_tlv[4]; |
2134ea4f | 2718 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
1c82ed1b | 2719 | HDA_OUTPUT, vmaster_tlv); |
2134ea4f | 2720 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1c82ed1b | 2721 | vmaster_tlv, alc_slave_vols); |
2134ea4f TI |
2722 | if (err < 0) |
2723 | return err; | |
2724 | } | |
e64f14f4 TI |
2725 | if (!spec->no_analog && |
2726 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
2134ea4f TI |
2727 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
2728 | NULL, alc_slave_sws); | |
2729 | if (err < 0) | |
2730 | return err; | |
2731 | } | |
2732 | ||
5b0cb1d8 | 2733 | /* assign Capture Source enums to NID */ |
fbe618f2 TI |
2734 | if (spec->capsrc_nids || spec->adc_nids) { |
2735 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | |
2736 | if (!kctl) | |
2737 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | |
2738 | for (i = 0; kctl && i < kctl->count; i++) { | |
2739 | hda_nid_t *nids = spec->capsrc_nids; | |
2740 | if (!nids) | |
2741 | nids = spec->adc_nids; | |
2742 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | |
2743 | if (err < 0) | |
2744 | return err; | |
2745 | } | |
5b0cb1d8 JK |
2746 | } |
2747 | if (spec->cap_mixer) { | |
2748 | const char *kname = kctl ? kctl->id.name : NULL; | |
2749 | for (knew = spec->cap_mixer; knew->name; knew++) { | |
2750 | if (kname && strcmp(knew->name, kname) == 0) | |
2751 | continue; | |
2752 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
2753 | for (i = 0; kctl && i < kctl->count; i++) { | |
2754 | err = snd_hda_add_nid(codec, kctl, i, | |
2755 | spec->adc_nids[i]); | |
2756 | if (err < 0) | |
2757 | return err; | |
2758 | } | |
2759 | } | |
2760 | } | |
2761 | ||
2762 | /* other nid->control mapping */ | |
2763 | for (i = 0; i < spec->num_mixers; i++) { | |
2764 | for (knew = spec->mixers[i]; knew->name; knew++) { | |
2765 | if (knew->iface != NID_MAPPING) | |
2766 | continue; | |
2767 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
2768 | if (kctl == NULL) | |
2769 | continue; | |
2770 | u = knew->subdevice; | |
2771 | for (j = 0; j < 4; j++, u >>= 8) { | |
2772 | nid = u & 0x3f; | |
2773 | if (nid == 0) | |
2774 | continue; | |
2775 | switch (u & 0xc0) { | |
2776 | case SUBDEV_SPEAKER_: | |
2777 | nid = spec->autocfg.speaker_pins[nid]; | |
2778 | break; | |
2779 | case SUBDEV_LINE_: | |
2780 | nid = spec->autocfg.line_out_pins[nid]; | |
2781 | break; | |
2782 | case SUBDEV_HP_: | |
2783 | nid = spec->autocfg.hp_pins[nid]; | |
2784 | break; | |
2785 | default: | |
2786 | continue; | |
2787 | } | |
2788 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
2789 | if (err < 0) | |
2790 | return err; | |
2791 | } | |
2792 | u = knew->private_value; | |
2793 | for (j = 0; j < 4; j++, u >>= 8) { | |
2794 | nid = u & 0xff; | |
2795 | if (nid == 0) | |
2796 | continue; | |
2797 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
2798 | if (err < 0) | |
2799 | return err; | |
2800 | } | |
2801 | } | |
2802 | } | |
bae84e70 TI |
2803 | |
2804 | alc_free_kctls(codec); /* no longer needed */ | |
2805 | ||
1da177e4 LT |
2806 | return 0; |
2807 | } | |
2808 | ||
e9edcee0 | 2809 | |
1da177e4 LT |
2810 | /* |
2811 | * initialize the codec volumes, etc | |
2812 | */ | |
2813 | ||
e9edcee0 TI |
2814 | /* |
2815 | * generic initialization of ADC, input mixers and output mixers | |
2816 | */ | |
2817 | static struct hda_verb alc880_volume_init_verbs[] = { | |
2818 | /* | |
2819 | * Unmute ADC0-2 and set the default input to mic-in | |
2820 | */ | |
71fe7b82 | 2821 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 2822 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 2823 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 2824 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 2825 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 2826 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 2827 | |
e9edcee0 TI |
2828 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
2829 | * mixer widget | |
9c7f852e TI |
2830 | * Note: PASD motherboards uses the Line In 2 as the input for front |
2831 | * panel mic (mic 2) | |
1da177e4 | 2832 | */ |
e9edcee0 | 2833 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
cb53c626 TI |
2834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
2837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
2838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
2840 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
1da177e4 | 2841 | |
e9edcee0 TI |
2842 | /* |
2843 | * Set up output mixers (0x0c - 0x0f) | |
1da177e4 | 2844 | */ |
e9edcee0 TI |
2845 | /* set vol=0 to output mixers */ |
2846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2848 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2849 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2850 | /* set up input amps for analog loopback */ | |
2851 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
05acb863 TI |
2852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
2854 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2855 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
2856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2857 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
2858 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2859 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
2860 | |
2861 | { } | |
2862 | }; | |
2863 | ||
e9edcee0 TI |
2864 | /* |
2865 | * 3-stack pin configuration: | |
2866 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
2867 | */ | |
2868 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
2869 | /* | |
2870 | * preset connection lists of input pins | |
2871 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
2872 | */ | |
2873 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
2874 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2875 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
2876 | ||
2877 | /* | |
2878 | * Set pin mode and muting | |
2879 | */ | |
2880 | /* set front pin widgets 0x14 for output */ | |
05acb863 | 2881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
2882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2883 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2884 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2885 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2886 | /* Mic2 (as headphone out) for HP output */ | |
2887 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2888 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1da177e4 | 2889 | /* Line In pin widget for input */ |
05acb863 | 2890 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
2891 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
2892 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
2893 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2894 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1da177e4 | 2895 | /* CD pin widget for input */ |
05acb863 | 2896 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 2897 | |
e9edcee0 TI |
2898 | { } |
2899 | }; | |
1da177e4 | 2900 | |
e9edcee0 TI |
2901 | /* |
2902 | * 5-stack pin configuration: | |
2903 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
2904 | * line-in/side = 0x1a, f-mic = 0x1b | |
2905 | */ | |
2906 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
2907 | /* | |
2908 | * preset connection lists of input pins | |
2909 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1da177e4 | 2910 | */ |
e9edcee0 TI |
2911 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
2912 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
1da177e4 | 2913 | |
e9edcee0 TI |
2914 | /* |
2915 | * Set pin mode and muting | |
1da177e4 | 2916 | */ |
e9edcee0 TI |
2917 | /* set pin widgets 0x14-0x17 for output */ |
2918 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2919 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2920 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2921 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2922 | /* unmute pins for output (no gain on this amp) */ | |
2923 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2925 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2926 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2927 | ||
2928 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2929 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2930 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2931 | /* Mic2 (as headphone out) for HP output */ | |
2932 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2933 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2934 | /* Line In pin widget for input */ | |
2935 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2936 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2937 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
2938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2939 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2940 | /* CD pin widget for input */ | |
2941 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1da177e4 LT |
2942 | |
2943 | { } | |
2944 | }; | |
2945 | ||
e9edcee0 TI |
2946 | /* |
2947 | * W810 pin configuration: | |
2948 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
2949 | */ | |
2950 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
2951 | /* hphone/speaker input selector: front DAC */ | |
2952 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
1da177e4 | 2953 | |
05acb863 | 2954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2955 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 2956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2957 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 2958 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2959 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 2960 | |
e9edcee0 | 2961 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
05acb863 | 2962 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1da177e4 | 2963 | |
1da177e4 LT |
2964 | { } |
2965 | }; | |
2966 | ||
e9edcee0 TI |
2967 | /* |
2968 | * Z71V pin configuration: | |
2969 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
2970 | */ | |
2971 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
05acb863 | 2972 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2973 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 2974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 2975 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
dfc0ff62 | 2976 | |
16ded525 | 2977 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 2978 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 | 2979 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 2980 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 TI |
2981 | |
2982 | { } | |
2983 | }; | |
2984 | ||
e9edcee0 TI |
2985 | /* |
2986 | * 6-stack pin configuration: | |
9c7f852e TI |
2987 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
2988 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
e9edcee0 TI |
2989 | */ |
2990 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
2991 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2992 | ||
16ded525 | 2993 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2994 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2995 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2996 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2997 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2998 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2999 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
3000 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3001 | ||
16ded525 | 3002 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3003 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3004 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3005 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3006 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 | 3007 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3008 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 3009 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3010 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 3011 | |
e9edcee0 TI |
3012 | { } |
3013 | }; | |
3014 | ||
ccc656ce KY |
3015 | /* |
3016 | * Uniwill pin configuration: | |
3017 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
3018 | * line = 0x1a | |
3019 | */ | |
3020 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
3021 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3022 | ||
3023 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3024 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3025 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3026 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3027 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3028 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3029 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3030 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3031 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3032 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3033 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3034 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3035 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3036 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3037 | ||
3038 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3039 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3040 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3041 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3042 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3043 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3044 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
3045 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
3046 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3047 | ||
3048 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3049 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
3050 | ||
3051 | { } | |
3052 | }; | |
3053 | ||
3054 | /* | |
3055 | * Uniwill P53 | |
ea1fb29a | 3056 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
ccc656ce KY |
3057 | */ |
3058 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
3059 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3060 | ||
3061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3062 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3063 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3064 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3065 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3066 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3067 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3068 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3069 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3070 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3072 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3073 | ||
3074 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3076 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3077 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3078 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3079 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3080 | ||
3081 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3082 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
3083 | ||
3084 | { } | |
3085 | }; | |
3086 | ||
2cf9f0fc TD |
3087 | static struct hda_verb alc880_beep_init_verbs[] = { |
3088 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
3089 | { } | |
3090 | }; | |
3091 | ||
458a4fab TI |
3092 | /* auto-toggle front mic */ |
3093 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |
3094 | { | |
3095 | unsigned int present; | |
3096 | unsigned char bits; | |
ccc656ce | 3097 | |
864f92be | 3098 | present = snd_hda_jack_detect(codec, 0x18); |
47fd830a TI |
3099 | bits = present ? HDA_AMP_MUTE : 0; |
3100 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
458a4fab TI |
3101 | } |
3102 | ||
4f5d1706 | 3103 | static void alc880_uniwill_setup(struct hda_codec *codec) |
458a4fab | 3104 | { |
a9fd4f3f TI |
3105 | struct alc_spec *spec = codec->spec; |
3106 | ||
3107 | spec->autocfg.hp_pins[0] = 0x14; | |
3108 | spec->autocfg.speaker_pins[0] = 0x15; | |
3109 | spec->autocfg.speaker_pins[0] = 0x16; | |
4f5d1706 TI |
3110 | } |
3111 | ||
3112 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | |
3113 | { | |
a9fd4f3f | 3114 | alc_automute_amp(codec); |
458a4fab | 3115 | alc880_uniwill_mic_automute(codec); |
ccc656ce KY |
3116 | } |
3117 | ||
3118 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
3119 | unsigned int res) | |
3120 | { | |
3121 | /* Looks like the unsol event is incompatible with the standard | |
3122 | * definition. 4bit tag is placed at 28 bit! | |
3123 | */ | |
458a4fab | 3124 | switch (res >> 28) { |
458a4fab TI |
3125 | case ALC880_MIC_EVENT: |
3126 | alc880_uniwill_mic_automute(codec); | |
3127 | break; | |
a9fd4f3f TI |
3128 | default: |
3129 | alc_automute_amp_unsol_event(codec, res); | |
3130 | break; | |
458a4fab | 3131 | } |
ccc656ce KY |
3132 | } |
3133 | ||
4f5d1706 | 3134 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
ccc656ce | 3135 | { |
a9fd4f3f | 3136 | struct alc_spec *spec = codec->spec; |
ccc656ce | 3137 | |
a9fd4f3f TI |
3138 | spec->autocfg.hp_pins[0] = 0x14; |
3139 | spec->autocfg.speaker_pins[0] = 0x15; | |
ccc656ce KY |
3140 | } |
3141 | ||
3142 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
3143 | { | |
3144 | unsigned int present; | |
ea1fb29a | 3145 | |
ccc656ce | 3146 | present = snd_hda_codec_read(codec, 0x21, 0, |
47fd830a TI |
3147 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
3148 | present &= HDA_AMP_VOLMASK; | |
3149 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
3150 | HDA_AMP_VOLMASK, present); | |
3151 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
3152 | HDA_AMP_VOLMASK, present); | |
ccc656ce | 3153 | } |
47fd830a | 3154 | |
ccc656ce KY |
3155 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
3156 | unsigned int res) | |
3157 | { | |
3158 | /* Looks like the unsol event is incompatible with the standard | |
3159 | * definition. 4bit tag is placed at 28 bit! | |
3160 | */ | |
f12ab1e0 | 3161 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
ccc656ce | 3162 | alc880_uniwill_p53_dcvol_automute(codec); |
a9fd4f3f TI |
3163 | else |
3164 | alc_automute_amp_unsol_event(codec, res); | |
ccc656ce KY |
3165 | } |
3166 | ||
e9edcee0 TI |
3167 | /* |
3168 | * F1734 pin configuration: | |
3169 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
3170 | */ | |
3171 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
ee7a9c7c | 3172 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
16ded525 TI |
3173 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
3174 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3175 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3176 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3177 | ||
e9edcee0 | 3178 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
16ded525 | 3179 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
e9edcee0 | 3180 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16ded525 | 3181 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3182 | |
e9edcee0 TI |
3183 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3184 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
ee7a9c7c | 3185 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
e9edcee0 | 3186 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3187 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3188 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3189 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3190 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3191 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
dfc0ff62 | 3192 | |
937b4160 TI |
3193 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
3194 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
3195 | ||
dfc0ff62 TI |
3196 | { } |
3197 | }; | |
3198 | ||
e9edcee0 TI |
3199 | /* |
3200 | * ASUS pin configuration: | |
3201 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
3202 | */ | |
3203 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
16ded525 TI |
3204 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
3205 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3206 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3207 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3208 | ||
3209 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
e9edcee0 | 3210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3212 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3213 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3214 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3215 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
3216 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3217 | ||
3218 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3220 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3221 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3222 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16ded525 | 3224 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3225 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3226 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 3227 | |
e9edcee0 TI |
3228 | { } |
3229 | }; | |
16ded525 | 3230 | |
e9edcee0 | 3231 | /* Enable GPIO mask and set output */ |
bc9f98a9 KY |
3232 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
3233 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
64a8be74 | 3234 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
df694daa KY |
3235 | |
3236 | /* Clevo m520g init */ | |
3237 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
3238 | /* headphone output */ | |
3239 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3240 | /* line-out */ | |
3241 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3242 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3243 | /* Line-in */ | |
3244 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3245 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3246 | /* CD */ | |
3247 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3248 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3249 | /* Mic1 (rear panel) */ | |
3250 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3251 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3252 | /* Mic2 (front panel) */ | |
3253 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3254 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3255 | /* headphone */ | |
3256 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3257 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3258 | /* change to EAPD mode */ | |
3259 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3260 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3261 | ||
3262 | { } | |
16ded525 TI |
3263 | }; |
3264 | ||
df694daa | 3265 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
4b146cb0 TI |
3266 | /* change to EAPD mode */ |
3267 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3268 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3269 | ||
df694daa KY |
3270 | /* Headphone output */ |
3271 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3272 | /* Front output*/ | |
3273 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3274 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3275 | ||
3276 | /* Line In pin widget for input */ | |
3277 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3278 | /* CD pin widget for input */ | |
3279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3280 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3281 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3282 | ||
3283 | /* change to EAPD mode */ | |
3284 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3285 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
3286 | ||
3287 | { } | |
3288 | }; | |
16ded525 | 3289 | |
e9edcee0 | 3290 | /* |
ae6b813a TI |
3291 | * LG m1 express dual |
3292 | * | |
3293 | * Pin assignment: | |
3294 | * Rear Line-In/Out (blue): 0x14 | |
3295 | * Build-in Mic-In: 0x15 | |
3296 | * Speaker-out: 0x17 | |
3297 | * HP-Out (green): 0x1b | |
3298 | * Mic-In/Out (red): 0x19 | |
3299 | * SPDIF-Out: 0x1e | |
3300 | */ | |
3301 | ||
3302 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
3303 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
3304 | 0x05, 0x02, 0x03 | |
3305 | }; | |
3306 | ||
3307 | /* seems analog CD is not working */ | |
3308 | static struct hda_input_mux alc880_lg_capture_source = { | |
3309 | .num_items = 3, | |
3310 | .items = { | |
3311 | { "Mic", 0x1 }, | |
3312 | { "Line", 0x5 }, | |
3313 | { "Internal Mic", 0x6 }, | |
3314 | }, | |
3315 | }; | |
3316 | ||
3317 | /* 2,4,6 channel modes */ | |
3318 | static struct hda_verb alc880_lg_ch2_init[] = { | |
3319 | /* set line-in and mic-in to input */ | |
3320 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
3321 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3322 | { } | |
3323 | }; | |
3324 | ||
3325 | static struct hda_verb alc880_lg_ch4_init[] = { | |
3326 | /* set line-in to out and mic-in to input */ | |
3327 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3328 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3329 | { } | |
3330 | }; | |
3331 | ||
3332 | static struct hda_verb alc880_lg_ch6_init[] = { | |
3333 | /* set line-in and mic-in to output */ | |
3334 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3335 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3336 | { } | |
3337 | }; | |
3338 | ||
3339 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
3340 | { 2, alc880_lg_ch2_init }, | |
3341 | { 4, alc880_lg_ch4_init }, | |
3342 | { 6, alc880_lg_ch6_init }, | |
3343 | }; | |
3344 | ||
3345 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
2134ea4f TI |
3346 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
3347 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
ae6b813a TI |
3348 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
3349 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
3350 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
3351 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
3352 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
3353 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
3354 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3355 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3356 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
3357 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
3358 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
3359 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
3360 | { | |
3361 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3362 | .name = "Channel Mode", | |
3363 | .info = alc_ch_mode_info, | |
3364 | .get = alc_ch_mode_get, | |
3365 | .put = alc_ch_mode_put, | |
3366 | }, | |
3367 | { } /* end */ | |
3368 | }; | |
3369 | ||
3370 | static struct hda_verb alc880_lg_init_verbs[] = { | |
3371 | /* set capture source to mic-in */ | |
3372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3373 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3374 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3375 | /* mute all amp mixer inputs */ | |
3376 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
cb53c626 TI |
3377 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
3378 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
ae6b813a TI |
3379 | /* line-in to input */ |
3380 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3381 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3382 | /* built-in mic */ | |
3383 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3384 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3385 | /* speaker-out */ | |
3386 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3387 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3388 | /* mic-in to input */ | |
3389 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3390 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3391 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3392 | /* HP-out */ | |
3393 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
3394 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3395 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3396 | /* jack sense */ | |
a9fd4f3f | 3397 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
ae6b813a TI |
3398 | { } |
3399 | }; | |
3400 | ||
3401 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 3402 | static void alc880_lg_setup(struct hda_codec *codec) |
ae6b813a | 3403 | { |
a9fd4f3f | 3404 | struct alc_spec *spec = codec->spec; |
ae6b813a | 3405 | |
a9fd4f3f TI |
3406 | spec->autocfg.hp_pins[0] = 0x1b; |
3407 | spec->autocfg.speaker_pins[0] = 0x17; | |
ae6b813a TI |
3408 | } |
3409 | ||
d681518a TI |
3410 | /* |
3411 | * LG LW20 | |
3412 | * | |
3413 | * Pin assignment: | |
3414 | * Speaker-out: 0x14 | |
3415 | * Mic-In: 0x18 | |
e4f41da9 CM |
3416 | * Built-in Mic-In: 0x19 |
3417 | * Line-In: 0x1b | |
3418 | * HP-Out: 0x1a | |
d681518a TI |
3419 | * SPDIF-Out: 0x1e |
3420 | */ | |
3421 | ||
d681518a | 3422 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
e4f41da9 | 3423 | .num_items = 3, |
d681518a TI |
3424 | .items = { |
3425 | { "Mic", 0x0 }, | |
3426 | { "Internal Mic", 0x1 }, | |
e4f41da9 | 3427 | { "Line In", 0x2 }, |
d681518a TI |
3428 | }, |
3429 | }; | |
3430 | ||
0a8c5da3 CM |
3431 | #define alc880_lg_lw_modes alc880_threestack_modes |
3432 | ||
d681518a | 3433 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
0a8c5da3 CM |
3434 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
3435 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
3436 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3437 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
3438 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
3439 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
3440 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
3441 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
3442 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
3443 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d681518a TI |
3444 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
3445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3446 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
3447 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
0a8c5da3 CM |
3448 | { |
3449 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3450 | .name = "Channel Mode", | |
3451 | .info = alc_ch_mode_info, | |
3452 | .get = alc_ch_mode_get, | |
3453 | .put = alc_ch_mode_put, | |
3454 | }, | |
d681518a TI |
3455 | { } /* end */ |
3456 | }; | |
3457 | ||
3458 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
0a8c5da3 CM |
3459 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
3460 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3461 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3462 | ||
d681518a TI |
3463 | /* set capture source to mic-in */ |
3464 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
cb53c626 | 3467 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
d681518a TI |
3468 | /* speaker-out */ |
3469 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3470 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3471 | /* HP-out */ | |
d681518a TI |
3472 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
3473 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3474 | /* mic-in to input */ | |
3475 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3476 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3477 | /* built-in mic */ | |
3478 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3479 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3480 | /* jack sense */ | |
a9fd4f3f | 3481 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
d681518a TI |
3482 | { } |
3483 | }; | |
3484 | ||
3485 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 3486 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
d681518a | 3487 | { |
a9fd4f3f | 3488 | struct alc_spec *spec = codec->spec; |
d681518a | 3489 | |
a9fd4f3f TI |
3490 | spec->autocfg.hp_pins[0] = 0x1b; |
3491 | spec->autocfg.speaker_pins[0] = 0x14; | |
d681518a TI |
3492 | } |
3493 | ||
df99cd33 TI |
3494 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
3495 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3496 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
3497 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3498 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3499 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3500 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3501 | { } /* end */ | |
3502 | }; | |
3503 | ||
3504 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
3505 | .num_items = 2, | |
3506 | .items = { | |
3507 | { "Mic", 0x0 }, | |
3508 | { "Internal Mic", 0x1 }, | |
3509 | }, | |
3510 | }; | |
3511 | ||
3512 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
3513 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3514 | ||
3515 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3516 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3517 | ||
3518 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3519 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3520 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3521 | /* Mic2 (as headphone out) for HP output */ | |
3522 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3523 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3524 | /* Internal Speaker */ | |
3525 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3526 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3527 | ||
3528 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3529 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3530 | ||
3531 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3532 | { } | |
3533 | }; | |
3534 | ||
3535 | /* toggle speaker-output according to the hp-jack state */ | |
3536 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
3537 | { | |
a9fd4f3f TI |
3538 | struct alc_spec *spec = codec->spec; |
3539 | alc_automute_amp(codec); | |
3540 | /* toggle EAPD */ | |
3541 | if (spec->jack_present) | |
df99cd33 TI |
3542 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
3543 | else | |
3544 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
3545 | } | |
3546 | ||
3547 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
3548 | unsigned int res) | |
3549 | { | |
3550 | /* Looks like the unsol event is incompatible with the standard | |
3551 | * definition. 4bit tag is placed at 28 bit! | |
3552 | */ | |
3553 | if ((res >> 28) == ALC880_HP_EVENT) | |
3554 | alc880_medion_rim_automute(codec); | |
3555 | } | |
3556 | ||
4f5d1706 | 3557 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
a9fd4f3f TI |
3558 | { |
3559 | struct alc_spec *spec = codec->spec; | |
3560 | ||
3561 | spec->autocfg.hp_pins[0] = 0x14; | |
3562 | spec->autocfg.speaker_pins[0] = 0x1b; | |
a9fd4f3f TI |
3563 | } |
3564 | ||
cb53c626 TI |
3565 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3566 | static struct hda_amp_list alc880_loopbacks[] = { | |
3567 | { 0x0b, HDA_INPUT, 0 }, | |
3568 | { 0x0b, HDA_INPUT, 1 }, | |
3569 | { 0x0b, HDA_INPUT, 2 }, | |
3570 | { 0x0b, HDA_INPUT, 3 }, | |
3571 | { 0x0b, HDA_INPUT, 4 }, | |
3572 | { } /* end */ | |
3573 | }; | |
3574 | ||
3575 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
3576 | { 0x0b, HDA_INPUT, 1 }, | |
3577 | { 0x0b, HDA_INPUT, 6 }, | |
3578 | { 0x0b, HDA_INPUT, 7 }, | |
3579 | { } /* end */ | |
3580 | }; | |
3581 | #endif | |
3582 | ||
ae6b813a TI |
3583 | /* |
3584 | * Common callbacks | |
e9edcee0 TI |
3585 | */ |
3586 | ||
1da177e4 LT |
3587 | static int alc_init(struct hda_codec *codec) |
3588 | { | |
3589 | struct alc_spec *spec = codec->spec; | |
e9edcee0 TI |
3590 | unsigned int i; |
3591 | ||
2c3bf9ab | 3592 | alc_fix_pll(codec); |
4a79ba34 | 3593 | alc_auto_init_amp(codec, spec->init_amp); |
2c3bf9ab | 3594 | |
e9edcee0 TI |
3595 | for (i = 0; i < spec->num_init_verbs; i++) |
3596 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
ae6b813a TI |
3597 | |
3598 | if (spec->init_hook) | |
3599 | spec->init_hook(codec); | |
3600 | ||
ad35879a TI |
3601 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3602 | if (codec->patch_ops.check_power_status) | |
3603 | codec->patch_ops.check_power_status(codec, 0x01); | |
3604 | #endif | |
1da177e4 LT |
3605 | return 0; |
3606 | } | |
3607 | ||
ae6b813a TI |
3608 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
3609 | { | |
3610 | struct alc_spec *spec = codec->spec; | |
3611 | ||
3612 | if (spec->unsol_event) | |
3613 | spec->unsol_event(codec, res); | |
3614 | } | |
3615 | ||
cb53c626 TI |
3616 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3617 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
3618 | { | |
3619 | struct alc_spec *spec = codec->spec; | |
3620 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
3621 | } | |
3622 | #endif | |
3623 | ||
1da177e4 LT |
3624 | /* |
3625 | * Analog playback callbacks | |
3626 | */ | |
3627 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3628 | struct hda_codec *codec, | |
c8b6bf9b | 3629 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3630 | { |
3631 | struct alc_spec *spec = codec->spec; | |
9a08160b TI |
3632 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
3633 | hinfo); | |
1da177e4 LT |
3634 | } |
3635 | ||
3636 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3637 | struct hda_codec *codec, | |
3638 | unsigned int stream_tag, | |
3639 | unsigned int format, | |
c8b6bf9b | 3640 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3641 | { |
3642 | struct alc_spec *spec = codec->spec; | |
9c7f852e TI |
3643 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
3644 | stream_tag, format, substream); | |
1da177e4 LT |
3645 | } |
3646 | ||
3647 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3648 | struct hda_codec *codec, | |
c8b6bf9b | 3649 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3650 | { |
3651 | struct alc_spec *spec = codec->spec; | |
3652 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
3653 | } | |
3654 | ||
3655 | /* | |
3656 | * Digital out | |
3657 | */ | |
3658 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3659 | struct hda_codec *codec, | |
c8b6bf9b | 3660 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3661 | { |
3662 | struct alc_spec *spec = codec->spec; | |
3663 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
3664 | } | |
3665 | ||
6b97eb45 TI |
3666 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
3667 | struct hda_codec *codec, | |
3668 | unsigned int stream_tag, | |
3669 | unsigned int format, | |
3670 | struct snd_pcm_substream *substream) | |
3671 | { | |
3672 | struct alc_spec *spec = codec->spec; | |
3673 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
3674 | stream_tag, format, substream); | |
3675 | } | |
3676 | ||
9b5f12e5 TI |
3677 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
3678 | struct hda_codec *codec, | |
3679 | struct snd_pcm_substream *substream) | |
3680 | { | |
3681 | struct alc_spec *spec = codec->spec; | |
3682 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | |
3683 | } | |
3684 | ||
1da177e4 LT |
3685 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
3686 | struct hda_codec *codec, | |
c8b6bf9b | 3687 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3688 | { |
3689 | struct alc_spec *spec = codec->spec; | |
3690 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
3691 | } | |
3692 | ||
3693 | /* | |
3694 | * Analog capture | |
3695 | */ | |
6330079f | 3696 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
1da177e4 LT |
3697 | struct hda_codec *codec, |
3698 | unsigned int stream_tag, | |
3699 | unsigned int format, | |
c8b6bf9b | 3700 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3701 | { |
3702 | struct alc_spec *spec = codec->spec; | |
3703 | ||
6330079f | 3704 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
1da177e4 LT |
3705 | stream_tag, 0, format); |
3706 | return 0; | |
3707 | } | |
3708 | ||
6330079f | 3709 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
1da177e4 | 3710 | struct hda_codec *codec, |
c8b6bf9b | 3711 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3712 | { |
3713 | struct alc_spec *spec = codec->spec; | |
3714 | ||
888afa15 TI |
3715 | snd_hda_codec_cleanup_stream(codec, |
3716 | spec->adc_nids[substream->number + 1]); | |
1da177e4 LT |
3717 | return 0; |
3718 | } | |
3719 | ||
840b64c0 TI |
3720 | /* analog capture with dynamic dual-adc changes */ |
3721 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3722 | struct hda_codec *codec, | |
3723 | unsigned int stream_tag, | |
3724 | unsigned int format, | |
3725 | struct snd_pcm_substream *substream) | |
3726 | { | |
3727 | struct alc_spec *spec = codec->spec; | |
3728 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; | |
3729 | spec->cur_adc_stream_tag = stream_tag; | |
3730 | spec->cur_adc_format = format; | |
3731 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); | |
3732 | return 0; | |
3733 | } | |
3734 | ||
3735 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3736 | struct hda_codec *codec, | |
3737 | struct snd_pcm_substream *substream) | |
3738 | { | |
3739 | struct alc_spec *spec = codec->spec; | |
3740 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); | |
3741 | spec->cur_adc = 0; | |
3742 | return 0; | |
3743 | } | |
3744 | ||
3745 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { | |
3746 | .substreams = 1, | |
3747 | .channels_min = 2, | |
3748 | .channels_max = 2, | |
3749 | .nid = 0, /* fill later */ | |
3750 | .ops = { | |
3751 | .prepare = dualmic_capture_pcm_prepare, | |
3752 | .cleanup = dualmic_capture_pcm_cleanup | |
3753 | }, | |
3754 | }; | |
1da177e4 LT |
3755 | |
3756 | /* | |
3757 | */ | |
3758 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
3759 | .substreams = 1, | |
3760 | .channels_min = 2, | |
3761 | .channels_max = 8, | |
e9edcee0 | 3762 | /* NID is set in alc_build_pcms */ |
1da177e4 LT |
3763 | .ops = { |
3764 | .open = alc880_playback_pcm_open, | |
3765 | .prepare = alc880_playback_pcm_prepare, | |
3766 | .cleanup = alc880_playback_pcm_cleanup | |
3767 | }, | |
3768 | }; | |
3769 | ||
3770 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
6330079f TI |
3771 | .substreams = 1, |
3772 | .channels_min = 2, | |
3773 | .channels_max = 2, | |
3774 | /* NID is set in alc_build_pcms */ | |
3775 | }; | |
3776 | ||
3777 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
3778 | .substreams = 1, | |
3779 | .channels_min = 2, | |
3780 | .channels_max = 2, | |
3781 | /* NID is set in alc_build_pcms */ | |
3782 | }; | |
3783 | ||
3784 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
3785 | .substreams = 2, /* can be overridden */ | |
1da177e4 LT |
3786 | .channels_min = 2, |
3787 | .channels_max = 2, | |
e9edcee0 | 3788 | /* NID is set in alc_build_pcms */ |
1da177e4 | 3789 | .ops = { |
6330079f TI |
3790 | .prepare = alc880_alt_capture_pcm_prepare, |
3791 | .cleanup = alc880_alt_capture_pcm_cleanup | |
1da177e4 LT |
3792 | }, |
3793 | }; | |
3794 | ||
3795 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
3796 | .substreams = 1, | |
3797 | .channels_min = 2, | |
3798 | .channels_max = 2, | |
3799 | /* NID is set in alc_build_pcms */ | |
3800 | .ops = { | |
3801 | .open = alc880_dig_playback_pcm_open, | |
6b97eb45 | 3802 | .close = alc880_dig_playback_pcm_close, |
9b5f12e5 TI |
3803 | .prepare = alc880_dig_playback_pcm_prepare, |
3804 | .cleanup = alc880_dig_playback_pcm_cleanup | |
1da177e4 LT |
3805 | }, |
3806 | }; | |
3807 | ||
3808 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
3809 | .substreams = 1, | |
3810 | .channels_min = 2, | |
3811 | .channels_max = 2, | |
3812 | /* NID is set in alc_build_pcms */ | |
3813 | }; | |
3814 | ||
4c5186ed | 3815 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
6330079f | 3816 | static struct hda_pcm_stream alc_pcm_null_stream = { |
4c5186ed JW |
3817 | .substreams = 0, |
3818 | .channels_min = 0, | |
3819 | .channels_max = 0, | |
3820 | }; | |
3821 | ||
1da177e4 LT |
3822 | static int alc_build_pcms(struct hda_codec *codec) |
3823 | { | |
3824 | struct alc_spec *spec = codec->spec; | |
3825 | struct hda_pcm *info = spec->pcm_rec; | |
3826 | int i; | |
3827 | ||
3828 | codec->num_pcms = 1; | |
3829 | codec->pcm_info = info; | |
3830 | ||
e64f14f4 TI |
3831 | if (spec->no_analog) |
3832 | goto skip_analog; | |
3833 | ||
812a2cca TI |
3834 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
3835 | "%s Analog", codec->chip_name); | |
1da177e4 | 3836 | info->name = spec->stream_name_analog; |
274693f3 | 3837 | |
4a471b7d | 3838 | if (spec->stream_analog_playback) { |
da3cec35 TI |
3839 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
3840 | return -EINVAL; | |
4a471b7d TI |
3841 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
3842 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
3843 | } | |
3844 | if (spec->stream_analog_capture) { | |
da3cec35 TI |
3845 | if (snd_BUG_ON(!spec->adc_nids)) |
3846 | return -EINVAL; | |
4a471b7d TI |
3847 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
3848 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
3849 | } | |
3850 | ||
3851 | if (spec->channel_mode) { | |
3852 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
3853 | for (i = 0; i < spec->num_channel_mode; i++) { | |
3854 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
3855 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
3856 | } | |
1da177e4 LT |
3857 | } |
3858 | } | |
3859 | ||
e64f14f4 | 3860 | skip_analog: |
e08a007d | 3861 | /* SPDIF for stream index #1 */ |
1da177e4 | 3862 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
812a2cca TI |
3863 | snprintf(spec->stream_name_digital, |
3864 | sizeof(spec->stream_name_digital), | |
3865 | "%s Digital", codec->chip_name); | |
e08a007d | 3866 | codec->num_pcms = 2; |
b25c9da1 | 3867 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
c06134d7 | 3868 | info = spec->pcm_rec + 1; |
1da177e4 | 3869 | info->name = spec->stream_name_digital; |
8c441982 TI |
3870 | if (spec->dig_out_type) |
3871 | info->pcm_type = spec->dig_out_type; | |
3872 | else | |
3873 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | |
4a471b7d TI |
3874 | if (spec->multiout.dig_out_nid && |
3875 | spec->stream_digital_playback) { | |
1da177e4 LT |
3876 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
3877 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
3878 | } | |
4a471b7d TI |
3879 | if (spec->dig_in_nid && |
3880 | spec->stream_digital_capture) { | |
1da177e4 LT |
3881 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
3882 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
3883 | } | |
963f803f TI |
3884 | /* FIXME: do we need this for all Realtek codec models? */ |
3885 | codec->spdif_status_reset = 1; | |
1da177e4 LT |
3886 | } |
3887 | ||
e64f14f4 TI |
3888 | if (spec->no_analog) |
3889 | return 0; | |
3890 | ||
e08a007d TI |
3891 | /* If the use of more than one ADC is requested for the current |
3892 | * model, configure a second analog capture-only PCM. | |
3893 | */ | |
3894 | /* Additional Analaog capture for index #2 */ | |
6330079f TI |
3895 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
3896 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
e08a007d | 3897 | codec->num_pcms = 3; |
c06134d7 | 3898 | info = spec->pcm_rec + 2; |
e08a007d | 3899 | info->name = spec->stream_name_analog; |
6330079f TI |
3900 | if (spec->alt_dac_nid) { |
3901 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
3902 | *spec->stream_analog_alt_playback; | |
3903 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
3904 | spec->alt_dac_nid; | |
3905 | } else { | |
3906 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
3907 | alc_pcm_null_stream; | |
3908 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
3909 | } | |
3910 | if (spec->num_adc_nids > 1) { | |
3911 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
3912 | *spec->stream_analog_alt_capture; | |
3913 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
3914 | spec->adc_nids[1]; | |
3915 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
3916 | spec->num_adc_nids - 1; | |
3917 | } else { | |
3918 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
3919 | alc_pcm_null_stream; | |
3920 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
e08a007d TI |
3921 | } |
3922 | } | |
3923 | ||
1da177e4 LT |
3924 | return 0; |
3925 | } | |
3926 | ||
a4e09aa3 TI |
3927 | static inline void alc_shutup(struct hda_codec *codec) |
3928 | { | |
3929 | snd_hda_shutup_pins(codec); | |
3930 | } | |
3931 | ||
603c4019 TI |
3932 | static void alc_free_kctls(struct hda_codec *codec) |
3933 | { | |
3934 | struct alc_spec *spec = codec->spec; | |
3935 | ||
3936 | if (spec->kctls.list) { | |
3937 | struct snd_kcontrol_new *kctl = spec->kctls.list; | |
3938 | int i; | |
3939 | for (i = 0; i < spec->kctls.used; i++) | |
3940 | kfree(kctl[i].name); | |
3941 | } | |
3942 | snd_array_free(&spec->kctls); | |
3943 | } | |
3944 | ||
1da177e4 LT |
3945 | static void alc_free(struct hda_codec *codec) |
3946 | { | |
e9edcee0 | 3947 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 3948 | |
f12ab1e0 | 3949 | if (!spec) |
e9edcee0 TI |
3950 | return; |
3951 | ||
a4e09aa3 | 3952 | alc_shutup(codec); |
603c4019 | 3953 | alc_free_kctls(codec); |
e9edcee0 | 3954 | kfree(spec); |
680cd536 | 3955 | snd_hda_detach_beep_device(codec); |
1da177e4 LT |
3956 | } |
3957 | ||
f5de24b0 | 3958 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
c97259df DC |
3959 | static void alc_power_eapd(struct hda_codec *codec) |
3960 | { | |
3961 | /* We currently only handle front, HP */ | |
3962 | switch (codec->vendor_id) { | |
3963 | case 0x10ec0260: | |
9e4c8496 TI |
3964 | set_eapd(codec, 0x0f, 0); |
3965 | set_eapd(codec, 0x10, 0); | |
c97259df DC |
3966 | break; |
3967 | case 0x10ec0262: | |
3968 | case 0x10ec0267: | |
3969 | case 0x10ec0268: | |
3970 | case 0x10ec0269: | |
9e4c8496 | 3971 | case 0x10ec0270: |
c97259df DC |
3972 | case 0x10ec0272: |
3973 | case 0x10ec0660: | |
3974 | case 0x10ec0662: | |
3975 | case 0x10ec0663: | |
3976 | case 0x10ec0862: | |
3977 | case 0x10ec0889: | |
9e4c8496 TI |
3978 | set_eapd(codec, 0x14, 0); |
3979 | set_eapd(codec, 0x15, 0); | |
c97259df DC |
3980 | break; |
3981 | } | |
3982 | } | |
3983 | ||
f5de24b0 HM |
3984 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
3985 | { | |
3986 | struct alc_spec *spec = codec->spec; | |
a4e09aa3 | 3987 | alc_shutup(codec); |
f5de24b0 | 3988 | if (spec && spec->power_hook) |
c97259df | 3989 | spec->power_hook(codec); |
f5de24b0 HM |
3990 | return 0; |
3991 | } | |
3992 | #endif | |
3993 | ||
e044c39a | 3994 | #ifdef SND_HDA_NEEDS_RESUME |
e044c39a TI |
3995 | static int alc_resume(struct hda_codec *codec) |
3996 | { | |
e044c39a TI |
3997 | codec->patch_ops.init(codec); |
3998 | snd_hda_codec_resume_amp(codec); | |
3999 | snd_hda_codec_resume_cache(codec); | |
ad35879a TI |
4000 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4001 | if (codec->patch_ops.check_power_status) | |
4002 | codec->patch_ops.check_power_status(codec, 0x01); | |
4003 | #endif | |
e044c39a TI |
4004 | return 0; |
4005 | } | |
e044c39a TI |
4006 | #endif |
4007 | ||
1da177e4 LT |
4008 | /* |
4009 | */ | |
4010 | static struct hda_codec_ops alc_patch_ops = { | |
4011 | .build_controls = alc_build_controls, | |
4012 | .build_pcms = alc_build_pcms, | |
4013 | .init = alc_init, | |
4014 | .free = alc_free, | |
ae6b813a | 4015 | .unsol_event = alc_unsol_event, |
e044c39a TI |
4016 | #ifdef SND_HDA_NEEDS_RESUME |
4017 | .resume = alc_resume, | |
4018 | #endif | |
cb53c626 | 4019 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
f5de24b0 | 4020 | .suspend = alc_suspend, |
cb53c626 TI |
4021 | .check_power_status = alc_check_power_status, |
4022 | #endif | |
c97259df | 4023 | .reboot_notify = alc_shutup, |
1da177e4 LT |
4024 | }; |
4025 | ||
c027ddcd KY |
4026 | /* replace the codec chip_name with the given string */ |
4027 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | |
4028 | { | |
4029 | kfree(codec->chip_name); | |
4030 | codec->chip_name = kstrdup(name, GFP_KERNEL); | |
4031 | if (!codec->chip_name) { | |
4032 | alc_free(codec); | |
4033 | return -ENOMEM; | |
4034 | } | |
4035 | return 0; | |
4036 | } | |
4037 | ||
2fa522be TI |
4038 | /* |
4039 | * Test configuration for debugging | |
4040 | * | |
4041 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
4042 | * enum controls. | |
4043 | */ | |
4044 | #ifdef CONFIG_SND_DEBUG | |
4045 | static hda_nid_t alc880_test_dac_nids[4] = { | |
4046 | 0x02, 0x03, 0x04, 0x05 | |
4047 | }; | |
4048 | ||
4049 | static struct hda_input_mux alc880_test_capture_source = { | |
ae6b813a | 4050 | .num_items = 7, |
2fa522be TI |
4051 | .items = { |
4052 | { "In-1", 0x0 }, | |
4053 | { "In-2", 0x1 }, | |
4054 | { "In-3", 0x2 }, | |
4055 | { "In-4", 0x3 }, | |
4056 | { "CD", 0x4 }, | |
ae6b813a TI |
4057 | { "Front", 0x5 }, |
4058 | { "Surround", 0x6 }, | |
2fa522be TI |
4059 | }, |
4060 | }; | |
4061 | ||
d2a6d7dc | 4062 | static struct hda_channel_mode alc880_test_modes[4] = { |
2fa522be | 4063 | { 2, NULL }, |
fd2c326d | 4064 | { 4, NULL }, |
2fa522be | 4065 | { 6, NULL }, |
fd2c326d | 4066 | { 8, NULL }, |
2fa522be TI |
4067 | }; |
4068 | ||
9c7f852e TI |
4069 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
4070 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
4071 | { |
4072 | static char *texts[] = { | |
4073 | "N/A", "Line Out", "HP Out", | |
4074 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
4075 | }; | |
4076 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4077 | uinfo->count = 1; | |
4078 | uinfo->value.enumerated.items = 8; | |
4079 | if (uinfo->value.enumerated.item >= 8) | |
4080 | uinfo->value.enumerated.item = 7; | |
4081 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4082 | return 0; | |
4083 | } | |
4084 | ||
9c7f852e TI |
4085 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
4086 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4087 | { |
4088 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4089 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4090 | unsigned int pin_ctl, item = 0; | |
4091 | ||
4092 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
4093 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4094 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
4095 | if (pin_ctl & AC_PINCTL_HP_EN) | |
4096 | item = 2; | |
4097 | else | |
4098 | item = 1; | |
4099 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
4100 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
4101 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
4102 | case AC_PINCTL_VREF_50: item = 4; break; | |
4103 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
4104 | case AC_PINCTL_VREF_80: item = 6; break; | |
4105 | case AC_PINCTL_VREF_100: item = 7; break; | |
4106 | } | |
4107 | } | |
4108 | ucontrol->value.enumerated.item[0] = item; | |
4109 | return 0; | |
4110 | } | |
4111 | ||
9c7f852e TI |
4112 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
4113 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4114 | { |
4115 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4116 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4117 | static unsigned int ctls[] = { | |
4118 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
4119 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
4120 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
4121 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
4122 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
4123 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
4124 | }; | |
4125 | unsigned int old_ctl, new_ctl; | |
4126 | ||
4127 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
4128 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4129 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
4130 | if (old_ctl != new_ctl) { | |
82beb8fd TI |
4131 | int val; |
4132 | snd_hda_codec_write_cache(codec, nid, 0, | |
4133 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4134 | new_ctl); | |
47fd830a TI |
4135 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
4136 | HDA_AMP_MUTE : 0; | |
4137 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
4138 | HDA_AMP_MUTE, val); | |
2fa522be TI |
4139 | return 1; |
4140 | } | |
4141 | return 0; | |
4142 | } | |
4143 | ||
9c7f852e TI |
4144 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
4145 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
4146 | { |
4147 | static char *texts[] = { | |
4148 | "Front", "Surround", "CLFE", "Side" | |
4149 | }; | |
4150 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4151 | uinfo->count = 1; | |
4152 | uinfo->value.enumerated.items = 4; | |
4153 | if (uinfo->value.enumerated.item >= 4) | |
4154 | uinfo->value.enumerated.item = 3; | |
4155 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4156 | return 0; | |
4157 | } | |
4158 | ||
9c7f852e TI |
4159 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
4160 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4161 | { |
4162 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4163 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4164 | unsigned int sel; | |
4165 | ||
4166 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
4167 | ucontrol->value.enumerated.item[0] = sel & 3; | |
4168 | return 0; | |
4169 | } | |
4170 | ||
9c7f852e TI |
4171 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
4172 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4173 | { |
4174 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4175 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4176 | unsigned int sel; | |
4177 | ||
4178 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
4179 | if (ucontrol->value.enumerated.item[0] != sel) { | |
4180 | sel = ucontrol->value.enumerated.item[0] & 3; | |
82beb8fd TI |
4181 | snd_hda_codec_write_cache(codec, nid, 0, |
4182 | AC_VERB_SET_CONNECT_SEL, sel); | |
2fa522be TI |
4183 | return 1; |
4184 | } | |
4185 | return 0; | |
4186 | } | |
4187 | ||
4188 | #define PIN_CTL_TEST(xname,nid) { \ | |
4189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4190 | .name = xname, \ | |
5b0cb1d8 | 4191 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
2fa522be TI |
4192 | .info = alc_test_pin_ctl_info, \ |
4193 | .get = alc_test_pin_ctl_get, \ | |
4194 | .put = alc_test_pin_ctl_put, \ | |
4195 | .private_value = nid \ | |
4196 | } | |
4197 | ||
4198 | #define PIN_SRC_TEST(xname,nid) { \ | |
4199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4200 | .name = xname, \ | |
5b0cb1d8 | 4201 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
2fa522be TI |
4202 | .info = alc_test_pin_src_info, \ |
4203 | .get = alc_test_pin_src_get, \ | |
4204 | .put = alc_test_pin_src_put, \ | |
4205 | .private_value = nid \ | |
4206 | } | |
4207 | ||
c8b6bf9b | 4208 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
05acb863 TI |
4209 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
4210 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
4211 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
4212 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
985be54b TI |
4213 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
4214 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
4215 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
4216 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2fa522be TI |
4217 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
4218 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
4219 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
4220 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
4221 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
4222 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
4223 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
4224 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
4225 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
4226 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
4227 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
4228 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
4229 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4230 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4231 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
4232 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
4233 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
4234 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
4235 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
4236 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
4237 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
4238 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
2fa522be TI |
4239 | { |
4240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4241 | .name = "Channel Mode", | |
df694daa KY |
4242 | .info = alc_ch_mode_info, |
4243 | .get = alc_ch_mode_get, | |
4244 | .put = alc_ch_mode_put, | |
2fa522be TI |
4245 | }, |
4246 | { } /* end */ | |
4247 | }; | |
4248 | ||
4249 | static struct hda_verb alc880_test_init_verbs[] = { | |
4250 | /* Unmute inputs of 0x0c - 0x0f */ | |
05acb863 TI |
4251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4253 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4254 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4255 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4256 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4257 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4258 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2fa522be | 4259 | /* Vol output for 0x0c-0x0f */ |
05acb863 TI |
4260 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
4261 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4262 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4263 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2fa522be | 4264 | /* Set output pins 0x14-0x17 */ |
05acb863 TI |
4265 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
4266 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4267 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4268 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2fa522be | 4269 | /* Unmute output pins 0x14-0x17 */ |
05acb863 TI |
4270 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
4271 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4272 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4273 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2fa522be | 4274 | /* Set input pins 0x18-0x1c */ |
16ded525 TI |
4275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
4276 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
05acb863 TI |
4277 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
4278 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4279 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2fa522be | 4280 | /* Mute input pins 0x18-0x1b */ |
05acb863 TI |
4281 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4282 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4283 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4284 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
71fe7b82 | 4285 | /* ADC set up */ |
05acb863 | 4286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4287 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 4288 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4289 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 4290 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4291 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
4292 | /* Analog input/passthru */ |
4293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4296 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4297 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2fa522be TI |
4298 | { } |
4299 | }; | |
4300 | #endif | |
4301 | ||
1da177e4 LT |
4302 | /* |
4303 | */ | |
4304 | ||
f5fcc13c TI |
4305 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
4306 | [ALC880_3ST] = "3stack", | |
4307 | [ALC880_TCL_S700] = "tcl", | |
4308 | [ALC880_3ST_DIG] = "3stack-digout", | |
4309 | [ALC880_CLEVO] = "clevo", | |
4310 | [ALC880_5ST] = "5stack", | |
4311 | [ALC880_5ST_DIG] = "5stack-digout", | |
4312 | [ALC880_W810] = "w810", | |
4313 | [ALC880_Z71V] = "z71v", | |
4314 | [ALC880_6ST] = "6stack", | |
4315 | [ALC880_6ST_DIG] = "6stack-digout", | |
4316 | [ALC880_ASUS] = "asus", | |
4317 | [ALC880_ASUS_W1V] = "asus-w1v", | |
4318 | [ALC880_ASUS_DIG] = "asus-dig", | |
4319 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
4320 | [ALC880_UNIWILL_DIG] = "uniwill", | |
2cf9f0fc TD |
4321 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
4322 | [ALC880_FUJITSU] = "fujitsu", | |
f5fcc13c TI |
4323 | [ALC880_F1734] = "F1734", |
4324 | [ALC880_LG] = "lg", | |
4325 | [ALC880_LG_LW] = "lg-lw", | |
df99cd33 | 4326 | [ALC880_MEDION_RIM] = "medion", |
2fa522be | 4327 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 4328 | [ALC880_TEST] = "test", |
2fa522be | 4329 | #endif |
f5fcc13c TI |
4330 | [ALC880_AUTO] = "auto", |
4331 | }; | |
4332 | ||
4333 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
ac3e3741 | 4334 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
f5fcc13c TI |
4335 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
4336 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
4337 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
4338 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
4339 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
4340 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
4341 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
4342 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
f5fcc13c TI |
4343 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
4344 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
f5fcc13c TI |
4345 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
4346 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
4347 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
4348 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
4349 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
4350 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
4351 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
4352 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
4353 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
4354 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
186c3117 | 4355 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
f5fcc13c TI |
4356 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
4357 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
4358 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
dea0a509 | 4359 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
f5fcc13c | 4360 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
ac3e3741 TI |
4361 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
4362 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
4363 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
4364 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
4365 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
4366 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
4367 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
4368 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
ac3e3741 TI |
4369 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
4370 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
f5fcc13c | 4371 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
ac3e3741 | 4372 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
f5fcc13c | 4373 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
ac3e3741 | 4374 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
f5fcc13c TI |
4375 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
4376 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
ac3e3741 | 4377 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
df99cd33 | 4378 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
ac3e3741 | 4379 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
f5fcc13c | 4380 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
f5fcc13c | 4381 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
1d11604e | 4382 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
3353541f | 4383 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
2cf9f0fc | 4384 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
ac3e3741 | 4385 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
f5fcc13c TI |
4386 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
4387 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
f5fcc13c | 4388 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
ac3e3741 TI |
4389 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
4390 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
4391 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
4392 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
f5fcc13c TI |
4393 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
4394 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 | 4395 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
f5fcc13c | 4396 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
ac3e3741 TI |
4397 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
4398 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
f5fcc13c TI |
4399 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
4400 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
4401 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
dea0a509 TI |
4402 | /* default Intel */ |
4403 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), | |
ac3e3741 TI |
4404 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
4405 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
1da177e4 LT |
4406 | {} |
4407 | }; | |
4408 | ||
16ded525 | 4409 | /* |
df694daa | 4410 | * ALC880 codec presets |
16ded525 | 4411 | */ |
16ded525 TI |
4412 | static struct alc_config_preset alc880_presets[] = { |
4413 | [ALC880_3ST] = { | |
e9edcee0 | 4414 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
4415 | .init_verbs = { alc880_volume_init_verbs, |
4416 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 4417 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 | 4418 | .dac_nids = alc880_dac_nids, |
16ded525 TI |
4419 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
4420 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4421 | .need_dac_fix = 1, |
16ded525 TI |
4422 | .input_mux = &alc880_capture_source, |
4423 | }, | |
4424 | [ALC880_3ST_DIG] = { | |
e9edcee0 | 4425 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
4426 | .init_verbs = { alc880_volume_init_verbs, |
4427 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 4428 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 TI |
4429 | .dac_nids = alc880_dac_nids, |
4430 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4431 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
4432 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4433 | .need_dac_fix = 1, |
16ded525 TI |
4434 | .input_mux = &alc880_capture_source, |
4435 | }, | |
df694daa KY |
4436 | [ALC880_TCL_S700] = { |
4437 | .mixers = { alc880_tcl_s700_mixer }, | |
4438 | .init_verbs = { alc880_volume_init_verbs, | |
4439 | alc880_pin_tcl_S700_init_verbs, | |
4440 | alc880_gpio2_init_verbs }, | |
4441 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4442 | .dac_nids = alc880_dac_nids, | |
f9e336f6 TI |
4443 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
4444 | .num_adc_nids = 1, /* single ADC */ | |
df694daa KY |
4445 | .hp_nid = 0x03, |
4446 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4447 | .channel_mode = alc880_2_jack_modes, | |
4448 | .input_mux = &alc880_capture_source, | |
4449 | }, | |
16ded525 | 4450 | [ALC880_5ST] = { |
f12ab1e0 TI |
4451 | .mixers = { alc880_three_stack_mixer, |
4452 | alc880_five_stack_mixer}, | |
4453 | .init_verbs = { alc880_volume_init_verbs, | |
4454 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
4455 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
4456 | .dac_nids = alc880_dac_nids, | |
16ded525 TI |
4457 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
4458 | .channel_mode = alc880_fivestack_modes, | |
4459 | .input_mux = &alc880_capture_source, | |
4460 | }, | |
4461 | [ALC880_5ST_DIG] = { | |
f12ab1e0 TI |
4462 | .mixers = { alc880_three_stack_mixer, |
4463 | alc880_five_stack_mixer }, | |
4464 | .init_verbs = { alc880_volume_init_verbs, | |
4465 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
4466 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
4467 | .dac_nids = alc880_dac_nids, | |
4468 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4469 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
4470 | .channel_mode = alc880_fivestack_modes, | |
4471 | .input_mux = &alc880_capture_source, | |
4472 | }, | |
b6482d48 TI |
4473 | [ALC880_6ST] = { |
4474 | .mixers = { alc880_six_stack_mixer }, | |
f12ab1e0 TI |
4475 | .init_verbs = { alc880_volume_init_verbs, |
4476 | alc880_pin_6stack_init_verbs }, | |
b6482d48 TI |
4477 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
4478 | .dac_nids = alc880_6st_dac_nids, | |
4479 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4480 | .channel_mode = alc880_sixstack_modes, | |
4481 | .input_mux = &alc880_6stack_capture_source, | |
4482 | }, | |
16ded525 | 4483 | [ALC880_6ST_DIG] = { |
e9edcee0 | 4484 | .mixers = { alc880_six_stack_mixer }, |
f12ab1e0 TI |
4485 | .init_verbs = { alc880_volume_init_verbs, |
4486 | alc880_pin_6stack_init_verbs }, | |
16ded525 TI |
4487 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
4488 | .dac_nids = alc880_6st_dac_nids, | |
4489 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4490 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
4491 | .channel_mode = alc880_sixstack_modes, | |
4492 | .input_mux = &alc880_6stack_capture_source, | |
4493 | }, | |
4494 | [ALC880_W810] = { | |
e9edcee0 | 4495 | .mixers = { alc880_w810_base_mixer }, |
f12ab1e0 TI |
4496 | .init_verbs = { alc880_volume_init_verbs, |
4497 | alc880_pin_w810_init_verbs, | |
b0af0de5 | 4498 | alc880_gpio2_init_verbs }, |
16ded525 TI |
4499 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
4500 | .dac_nids = alc880_w810_dac_nids, | |
4501 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4502 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
4503 | .channel_mode = alc880_w810_modes, | |
4504 | .input_mux = &alc880_capture_source, | |
4505 | }, | |
4506 | [ALC880_Z71V] = { | |
e9edcee0 | 4507 | .mixers = { alc880_z71v_mixer }, |
f12ab1e0 TI |
4508 | .init_verbs = { alc880_volume_init_verbs, |
4509 | alc880_pin_z71v_init_verbs }, | |
16ded525 TI |
4510 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
4511 | .dac_nids = alc880_z71v_dac_nids, | |
4512 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4513 | .hp_nid = 0x03, | |
e9edcee0 TI |
4514 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
4515 | .channel_mode = alc880_2_jack_modes, | |
16ded525 TI |
4516 | .input_mux = &alc880_capture_source, |
4517 | }, | |
4518 | [ALC880_F1734] = { | |
e9edcee0 | 4519 | .mixers = { alc880_f1734_mixer }, |
f12ab1e0 TI |
4520 | .init_verbs = { alc880_volume_init_verbs, |
4521 | alc880_pin_f1734_init_verbs }, | |
e9edcee0 TI |
4522 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
4523 | .dac_nids = alc880_f1734_dac_nids, | |
4524 | .hp_nid = 0x02, | |
4525 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4526 | .channel_mode = alc880_2_jack_modes, | |
937b4160 TI |
4527 | .input_mux = &alc880_f1734_capture_source, |
4528 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4529 | .setup = alc880_uniwill_p53_setup, |
4530 | .init_hook = alc_automute_amp, | |
16ded525 TI |
4531 | }, |
4532 | [ALC880_ASUS] = { | |
e9edcee0 | 4533 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
4534 | .init_verbs = { alc880_volume_init_verbs, |
4535 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4536 | alc880_gpio1_init_verbs }, |
4537 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4538 | .dac_nids = alc880_asus_dac_nids, | |
4539 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4540 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4541 | .need_dac_fix = 1, |
16ded525 TI |
4542 | .input_mux = &alc880_capture_source, |
4543 | }, | |
4544 | [ALC880_ASUS_DIG] = { | |
e9edcee0 | 4545 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
4546 | .init_verbs = { alc880_volume_init_verbs, |
4547 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4548 | alc880_gpio1_init_verbs }, |
4549 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4550 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4551 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4552 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4553 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4554 | .need_dac_fix = 1, |
16ded525 TI |
4555 | .input_mux = &alc880_capture_source, |
4556 | }, | |
df694daa KY |
4557 | [ALC880_ASUS_DIG2] = { |
4558 | .mixers = { alc880_asus_mixer }, | |
f12ab1e0 TI |
4559 | .init_verbs = { alc880_volume_init_verbs, |
4560 | alc880_pin_asus_init_verbs, | |
df694daa KY |
4561 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
4562 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4563 | .dac_nids = alc880_asus_dac_nids, | |
4564 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4565 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4566 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4567 | .need_dac_fix = 1, |
df694daa KY |
4568 | .input_mux = &alc880_capture_source, |
4569 | }, | |
16ded525 | 4570 | [ALC880_ASUS_W1V] = { |
e9edcee0 | 4571 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
f12ab1e0 TI |
4572 | .init_verbs = { alc880_volume_init_verbs, |
4573 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4574 | alc880_gpio1_init_verbs }, |
4575 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4576 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4577 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4578 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4579 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4580 | .need_dac_fix = 1, |
16ded525 TI |
4581 | .input_mux = &alc880_capture_source, |
4582 | }, | |
4583 | [ALC880_UNIWILL_DIG] = { | |
45bdd1c1 | 4584 | .mixers = { alc880_asus_mixer }, |
ccc656ce KY |
4585 | .init_verbs = { alc880_volume_init_verbs, |
4586 | alc880_pin_asus_init_verbs }, | |
e9edcee0 TI |
4587 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
4588 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4589 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4590 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4591 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4592 | .need_dac_fix = 1, |
16ded525 TI |
4593 | .input_mux = &alc880_capture_source, |
4594 | }, | |
ccc656ce KY |
4595 | [ALC880_UNIWILL] = { |
4596 | .mixers = { alc880_uniwill_mixer }, | |
4597 | .init_verbs = { alc880_volume_init_verbs, | |
4598 | alc880_uniwill_init_verbs }, | |
4599 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4600 | .dac_nids = alc880_asus_dac_nids, | |
4601 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4602 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4603 | .channel_mode = alc880_threestack_modes, | |
4604 | .need_dac_fix = 1, | |
4605 | .input_mux = &alc880_capture_source, | |
4606 | .unsol_event = alc880_uniwill_unsol_event, | |
4f5d1706 | 4607 | .setup = alc880_uniwill_setup, |
a9fd4f3f | 4608 | .init_hook = alc880_uniwill_init_hook, |
ccc656ce KY |
4609 | }, |
4610 | [ALC880_UNIWILL_P53] = { | |
4611 | .mixers = { alc880_uniwill_p53_mixer }, | |
4612 | .init_verbs = { alc880_volume_init_verbs, | |
4613 | alc880_uniwill_p53_init_verbs }, | |
4614 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4615 | .dac_nids = alc880_asus_dac_nids, | |
4616 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
2cf9f0fc TD |
4617 | .channel_mode = alc880_threestack_modes, |
4618 | .input_mux = &alc880_capture_source, | |
4619 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4620 | .setup = alc880_uniwill_p53_setup, |
4621 | .init_hook = alc_automute_amp, | |
2cf9f0fc TD |
4622 | }, |
4623 | [ALC880_FUJITSU] = { | |
45bdd1c1 | 4624 | .mixers = { alc880_fujitsu_mixer }, |
2cf9f0fc TD |
4625 | .init_verbs = { alc880_volume_init_verbs, |
4626 | alc880_uniwill_p53_init_verbs, | |
4627 | alc880_beep_init_verbs }, | |
4628 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4629 | .dac_nids = alc880_dac_nids, | |
d53d7d9e | 4630 | .dig_out_nid = ALC880_DIGOUT_NID, |
2cf9f0fc TD |
4631 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
4632 | .channel_mode = alc880_2_jack_modes, | |
ccc656ce KY |
4633 | .input_mux = &alc880_capture_source, |
4634 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4635 | .setup = alc880_uniwill_p53_setup, |
4636 | .init_hook = alc_automute_amp, | |
ccc656ce | 4637 | }, |
df694daa KY |
4638 | [ALC880_CLEVO] = { |
4639 | .mixers = { alc880_three_stack_mixer }, | |
4640 | .init_verbs = { alc880_volume_init_verbs, | |
4641 | alc880_pin_clevo_init_verbs }, | |
4642 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4643 | .dac_nids = alc880_dac_nids, | |
4644 | .hp_nid = 0x03, | |
4645 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4646 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4647 | .need_dac_fix = 1, |
df694daa KY |
4648 | .input_mux = &alc880_capture_source, |
4649 | }, | |
ae6b813a TI |
4650 | [ALC880_LG] = { |
4651 | .mixers = { alc880_lg_mixer }, | |
4652 | .init_verbs = { alc880_volume_init_verbs, | |
4653 | alc880_lg_init_verbs }, | |
4654 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
4655 | .dac_nids = alc880_lg_dac_nids, | |
4656 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4657 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
4658 | .channel_mode = alc880_lg_ch_modes, | |
4e195a7b | 4659 | .need_dac_fix = 1, |
ae6b813a | 4660 | .input_mux = &alc880_lg_capture_source, |
a9fd4f3f | 4661 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
4662 | .setup = alc880_lg_setup, |
4663 | .init_hook = alc_automute_amp, | |
cb53c626 TI |
4664 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4665 | .loopbacks = alc880_lg_loopbacks, | |
4666 | #endif | |
ae6b813a | 4667 | }, |
d681518a TI |
4668 | [ALC880_LG_LW] = { |
4669 | .mixers = { alc880_lg_lw_mixer }, | |
4670 | .init_verbs = { alc880_volume_init_verbs, | |
4671 | alc880_lg_lw_init_verbs }, | |
0a8c5da3 | 4672 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
d681518a TI |
4673 | .dac_nids = alc880_dac_nids, |
4674 | .dig_out_nid = ALC880_DIGOUT_NID, | |
0a8c5da3 CM |
4675 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
4676 | .channel_mode = alc880_lg_lw_modes, | |
d681518a | 4677 | .input_mux = &alc880_lg_lw_capture_source, |
a9fd4f3f | 4678 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
4679 | .setup = alc880_lg_lw_setup, |
4680 | .init_hook = alc_automute_amp, | |
d681518a | 4681 | }, |
df99cd33 TI |
4682 | [ALC880_MEDION_RIM] = { |
4683 | .mixers = { alc880_medion_rim_mixer }, | |
4684 | .init_verbs = { alc880_volume_init_verbs, | |
4685 | alc880_medion_rim_init_verbs, | |
4686 | alc_gpio2_init_verbs }, | |
4687 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4688 | .dac_nids = alc880_dac_nids, | |
4689 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4690 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4691 | .channel_mode = alc880_2_jack_modes, | |
4692 | .input_mux = &alc880_medion_rim_capture_source, | |
4693 | .unsol_event = alc880_medion_rim_unsol_event, | |
4f5d1706 TI |
4694 | .setup = alc880_medion_rim_setup, |
4695 | .init_hook = alc880_medion_rim_automute, | |
df99cd33 | 4696 | }, |
16ded525 TI |
4697 | #ifdef CONFIG_SND_DEBUG |
4698 | [ALC880_TEST] = { | |
e9edcee0 TI |
4699 | .mixers = { alc880_test_mixer }, |
4700 | .init_verbs = { alc880_test_init_verbs }, | |
16ded525 TI |
4701 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
4702 | .dac_nids = alc880_test_dac_nids, | |
4703 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4704 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
4705 | .channel_mode = alc880_test_modes, | |
4706 | .input_mux = &alc880_test_capture_source, | |
4707 | }, | |
4708 | #endif | |
4709 | }; | |
4710 | ||
e9edcee0 TI |
4711 | /* |
4712 | * Automatic parse of I/O pins from the BIOS configuration | |
4713 | */ | |
4714 | ||
e9edcee0 TI |
4715 | enum { |
4716 | ALC_CTL_WIDGET_VOL, | |
4717 | ALC_CTL_WIDGET_MUTE, | |
4718 | ALC_CTL_BIND_MUTE, | |
4719 | }; | |
c8b6bf9b | 4720 | static struct snd_kcontrol_new alc880_control_templates[] = { |
e9edcee0 TI |
4721 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
4722 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
985be54b | 4723 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
e9edcee0 TI |
4724 | }; |
4725 | ||
4726 | /* add dynamic controls */ | |
f12ab1e0 | 4727 | static int add_control(struct alc_spec *spec, int type, const char *name, |
66ceeb6b | 4728 | int cidx, unsigned long val) |
e9edcee0 | 4729 | { |
c8b6bf9b | 4730 | struct snd_kcontrol_new *knew; |
e9edcee0 | 4731 | |
603c4019 TI |
4732 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
4733 | knew = snd_array_new(&spec->kctls); | |
4734 | if (!knew) | |
4735 | return -ENOMEM; | |
e9edcee0 | 4736 | *knew = alc880_control_templates[type]; |
543537bd | 4737 | knew->name = kstrdup(name, GFP_KERNEL); |
f12ab1e0 | 4738 | if (!knew->name) |
e9edcee0 | 4739 | return -ENOMEM; |
66ceeb6b | 4740 | knew->index = cidx; |
4d02d1b6 | 4741 | if (get_amp_nid_(val)) |
5e26dfd0 | 4742 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
e9edcee0 | 4743 | knew->private_value = val; |
e9edcee0 TI |
4744 | return 0; |
4745 | } | |
4746 | ||
0afe5f89 TI |
4747 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
4748 | const char *pfx, const char *dir, | |
66ceeb6b | 4749 | const char *sfx, int cidx, unsigned long val) |
0afe5f89 TI |
4750 | { |
4751 | char name[32]; | |
4752 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); | |
66ceeb6b | 4753 | return add_control(spec, type, name, cidx, val); |
0afe5f89 TI |
4754 | } |
4755 | ||
66ceeb6b TI |
4756 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
4757 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) | |
4758 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ | |
4759 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) | |
4760 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ | |
4761 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) | |
4762 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ | |
4763 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) | |
0afe5f89 | 4764 | |
e9edcee0 TI |
4765 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
4766 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
4767 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
4768 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
e9edcee0 TI |
4769 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
4770 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
4771 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
4772 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
4773 | #define ALC880_PIN_CD_NID 0x1c | |
4774 | ||
4775 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
4776 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
4777 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
4778 | { |
4779 | hda_nid_t nid; | |
4780 | int assigned[4]; | |
4781 | int i, j; | |
4782 | ||
4783 | memset(assigned, 0, sizeof(assigned)); | |
b0af0de5 | 4784 | spec->multiout.dac_nids = spec->private_dac_nids; |
e9edcee0 TI |
4785 | |
4786 | /* check the pins hardwired to audio widget */ | |
4787 | for (i = 0; i < cfg->line_outs; i++) { | |
4788 | nid = cfg->line_out_pins[i]; | |
4789 | if (alc880_is_fixed_pin(nid)) { | |
4790 | int idx = alc880_fixed_pin_idx(nid); | |
5014f193 | 4791 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
e9edcee0 TI |
4792 | assigned[idx] = 1; |
4793 | } | |
4794 | } | |
4795 | /* left pins can be connect to any audio widget */ | |
4796 | for (i = 0; i < cfg->line_outs; i++) { | |
4797 | nid = cfg->line_out_pins[i]; | |
4798 | if (alc880_is_fixed_pin(nid)) | |
4799 | continue; | |
4800 | /* search for an empty channel */ | |
4801 | for (j = 0; j < cfg->line_outs; j++) { | |
f12ab1e0 TI |
4802 | if (!assigned[j]) { |
4803 | spec->multiout.dac_nids[i] = | |
4804 | alc880_idx_to_dac(j); | |
e9edcee0 TI |
4805 | assigned[j] = 1; |
4806 | break; | |
4807 | } | |
4808 | } | |
4809 | } | |
4810 | spec->multiout.num_dacs = cfg->line_outs; | |
4811 | return 0; | |
4812 | } | |
4813 | ||
4814 | /* add playback controls from the parsed DAC table */ | |
df694daa KY |
4815 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
4816 | const struct auto_pin_cfg *cfg) | |
e9edcee0 | 4817 | { |
f12ab1e0 TI |
4818 | static const char *chname[4] = { |
4819 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
4820 | }; | |
e9edcee0 TI |
4821 | hda_nid_t nid; |
4822 | int i, err; | |
4823 | ||
4824 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 4825 | if (!spec->multiout.dac_nids[i]) |
e9edcee0 TI |
4826 | continue; |
4827 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
4828 | if (i == 2) { | |
4829 | /* Center/LFE */ | |
0afe5f89 TI |
4830 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
4831 | "Center", | |
f12ab1e0 TI |
4832 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
4833 | HDA_OUTPUT)); | |
4834 | if (err < 0) | |
e9edcee0 | 4835 | return err; |
0afe5f89 TI |
4836 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
4837 | "LFE", | |
f12ab1e0 TI |
4838 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
4839 | HDA_OUTPUT)); | |
4840 | if (err < 0) | |
e9edcee0 | 4841 | return err; |
0afe5f89 TI |
4842 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
4843 | "Center", | |
f12ab1e0 TI |
4844 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
4845 | HDA_INPUT)); | |
4846 | if (err < 0) | |
e9edcee0 | 4847 | return err; |
0afe5f89 TI |
4848 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
4849 | "LFE", | |
f12ab1e0 TI |
4850 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
4851 | HDA_INPUT)); | |
4852 | if (err < 0) | |
e9edcee0 TI |
4853 | return err; |
4854 | } else { | |
cb162b6b TI |
4855 | const char *pfx; |
4856 | if (cfg->line_outs == 1 && | |
4857 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
4858 | pfx = "Speaker"; | |
4859 | else | |
4860 | pfx = chname[i]; | |
0afe5f89 | 4861 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
4862 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
4863 | HDA_OUTPUT)); | |
4864 | if (err < 0) | |
e9edcee0 | 4865 | return err; |
0afe5f89 | 4866 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
4867 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
4868 | HDA_INPUT)); | |
4869 | if (err < 0) | |
e9edcee0 TI |
4870 | return err; |
4871 | } | |
4872 | } | |
e9edcee0 TI |
4873 | return 0; |
4874 | } | |
4875 | ||
8d88bc3d TI |
4876 | /* add playback controls for speaker and HP outputs */ |
4877 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
4878 | const char *pfx) | |
e9edcee0 TI |
4879 | { |
4880 | hda_nid_t nid; | |
4881 | int err; | |
4882 | ||
f12ab1e0 | 4883 | if (!pin) |
e9edcee0 TI |
4884 | return 0; |
4885 | ||
4886 | if (alc880_is_fixed_pin(pin)) { | |
4887 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
82bc955f | 4888 | /* specify the DAC as the extra output */ |
f12ab1e0 | 4889 | if (!spec->multiout.hp_nid) |
e9edcee0 | 4890 | spec->multiout.hp_nid = nid; |
82bc955f TI |
4891 | else |
4892 | spec->multiout.extra_out_nid[0] = nid; | |
e9edcee0 TI |
4893 | /* control HP volume/switch on the output mixer amp */ |
4894 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
0afe5f89 | 4895 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
4896 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
4897 | if (err < 0) | |
e9edcee0 | 4898 | return err; |
0afe5f89 | 4899 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
4900 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
4901 | if (err < 0) | |
e9edcee0 TI |
4902 | return err; |
4903 | } else if (alc880_is_multi_pin(pin)) { | |
4904 | /* set manual connection */ | |
e9edcee0 | 4905 | /* we have only a switch on HP-out PIN */ |
0afe5f89 | 4906 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
f12ab1e0 TI |
4907 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
4908 | if (err < 0) | |
e9edcee0 TI |
4909 | return err; |
4910 | } | |
4911 | return 0; | |
4912 | } | |
4913 | ||
4914 | /* create input playback/capture controls for the given pin */ | |
f12ab1e0 | 4915 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
66ceeb6b | 4916 | const char *ctlname, int ctlidx, |
df694daa | 4917 | int idx, hda_nid_t mix_nid) |
e9edcee0 | 4918 | { |
df694daa | 4919 | int err; |
e9edcee0 | 4920 | |
66ceeb6b | 4921 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
f12ab1e0 TI |
4922 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
4923 | if (err < 0) | |
e9edcee0 | 4924 | return err; |
66ceeb6b | 4925 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
f12ab1e0 TI |
4926 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
4927 | if (err < 0) | |
e9edcee0 TI |
4928 | return err; |
4929 | return 0; | |
4930 | } | |
4931 | ||
05f5f477 TI |
4932 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
4933 | { | |
4934 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | |
4935 | return (pincap & AC_PINCAP_IN) != 0; | |
4936 | } | |
4937 | ||
e9edcee0 | 4938 | /* create playback/capture controls for input pins */ |
05f5f477 TI |
4939 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
4940 | const struct auto_pin_cfg *cfg, | |
4941 | hda_nid_t mixer, | |
4942 | hda_nid_t cap1, hda_nid_t cap2) | |
e9edcee0 | 4943 | { |
05f5f477 | 4944 | struct alc_spec *spec = codec->spec; |
61b9b9b1 | 4945 | struct hda_input_mux *imux = &spec->private_imux[0]; |
66ceeb6b | 4946 | int i, err, idx, type, type_idx = 0; |
e9edcee0 | 4947 | |
66ceeb6b | 4948 | for (i = 0; i < cfg->num_inputs; i++) { |
05f5f477 | 4949 | hda_nid_t pin; |
10a20af7 | 4950 | const char *label; |
05f5f477 | 4951 | |
66ceeb6b | 4952 | pin = cfg->inputs[i].pin; |
05f5f477 TI |
4953 | if (!alc_is_input_pin(codec, pin)) |
4954 | continue; | |
4955 | ||
66ceeb6b TI |
4956 | type = cfg->inputs[i].type; |
4957 | if (i > 0 && type == cfg->inputs[i - 1].type) | |
4958 | type_idx++; | |
4959 | else | |
4960 | type_idx = 0; | |
10a20af7 | 4961 | label = hda_get_autocfg_input_label(codec, cfg, i); |
05f5f477 TI |
4962 | if (mixer) { |
4963 | idx = get_connection_index(codec, mixer, pin); | |
4964 | if (idx >= 0) { | |
4965 | err = new_analog_input(spec, pin, | |
10a20af7 TI |
4966 | label, type_idx, |
4967 | idx, mixer); | |
05f5f477 TI |
4968 | if (err < 0) |
4969 | return err; | |
4970 | } | |
4971 | } | |
4972 | ||
4973 | if (!cap1) | |
4974 | continue; | |
4975 | idx = get_connection_index(codec, cap1, pin); | |
4976 | if (idx < 0 && cap2) | |
4977 | idx = get_connection_index(codec, cap2, pin); | |
10a20af7 TI |
4978 | if (idx >= 0) |
4979 | snd_hda_add_imux_item(imux, label, idx, NULL); | |
e9edcee0 TI |
4980 | } |
4981 | return 0; | |
4982 | } | |
4983 | ||
05f5f477 TI |
4984 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
4985 | const struct auto_pin_cfg *cfg) | |
4986 | { | |
4987 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | |
4988 | } | |
4989 | ||
f6c7e546 TI |
4990 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
4991 | unsigned int pin_type) | |
4992 | { | |
4993 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4994 | pin_type); | |
4995 | /* unmute pin */ | |
d260cdf6 TI |
4996 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
4997 | AMP_OUT_UNMUTE); | |
f6c7e546 TI |
4998 | } |
4999 | ||
df694daa KY |
5000 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
5001 | hda_nid_t nid, int pin_type, | |
e9edcee0 TI |
5002 | int dac_idx) |
5003 | { | |
f6c7e546 | 5004 | alc_set_pin_output(codec, nid, pin_type); |
e9edcee0 TI |
5005 | /* need the manual connection? */ |
5006 | if (alc880_is_multi_pin(nid)) { | |
5007 | struct alc_spec *spec = codec->spec; | |
5008 | int idx = alc880_multi_pin_idx(nid); | |
5009 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
5010 | AC_VERB_SET_CONNECT_SEL, | |
5011 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
5012 | } | |
5013 | } | |
5014 | ||
baba8ee9 TI |
5015 | static int get_pin_type(int line_out_type) |
5016 | { | |
5017 | if (line_out_type == AUTO_PIN_HP_OUT) | |
5018 | return PIN_HP; | |
5019 | else | |
5020 | return PIN_OUT; | |
5021 | } | |
5022 | ||
e9edcee0 TI |
5023 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
5024 | { | |
5025 | struct alc_spec *spec = codec->spec; | |
5026 | int i; | |
ea1fb29a | 5027 | |
e9edcee0 TI |
5028 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
5029 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 TI |
5030 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
5031 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
e9edcee0 TI |
5032 | } |
5033 | } | |
5034 | ||
8d88bc3d | 5035 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
e9edcee0 TI |
5036 | { |
5037 | struct alc_spec *spec = codec->spec; | |
5038 | hda_nid_t pin; | |
5039 | ||
82bc955f | 5040 | pin = spec->autocfg.speaker_pins[0]; |
8d88bc3d TI |
5041 | if (pin) /* connect to front */ |
5042 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
eb06ed8f | 5043 | pin = spec->autocfg.hp_pins[0]; |
e9edcee0 TI |
5044 | if (pin) /* connect to front */ |
5045 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
5046 | } | |
5047 | ||
5048 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
5049 | { | |
5050 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5051 | struct auto_pin_cfg *cfg = &spec->autocfg; |
e9edcee0 TI |
5052 | int i; |
5053 | ||
66ceeb6b TI |
5054 | for (i = 0; i < cfg->num_inputs; i++) { |
5055 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 5056 | if (alc_is_input_pin(codec, nid)) { |
23f0c048 | 5057 | alc_set_input_pin(codec, nid, i); |
e82c025b TI |
5058 | if (nid != ALC880_PIN_CD_NID && |
5059 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f12ab1e0 TI |
5060 | snd_hda_codec_write(codec, nid, 0, |
5061 | AC_VERB_SET_AMP_GAIN_MUTE, | |
e9edcee0 TI |
5062 | AMP_OUT_MUTE); |
5063 | } | |
5064 | } | |
5065 | } | |
5066 | ||
7f311a46 TI |
5067 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
5068 | { | |
5069 | struct alc_spec *spec = codec->spec; | |
5070 | int c; | |
5071 | ||
5072 | for (c = 0; c < spec->num_adc_nids; c++) { | |
5073 | unsigned int mux_idx; | |
5074 | const struct hda_input_mux *imux; | |
5075 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
5076 | imux = &spec->input_mux[mux_idx]; | |
5077 | if (!imux->num_items && mux_idx > 0) | |
5078 | imux = &spec->input_mux[0]; | |
5079 | if (imux) | |
5080 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, | |
5081 | AC_VERB_SET_CONNECT_SEL, | |
5082 | imux->items[0].index); | |
5083 | } | |
5084 | } | |
5085 | ||
e9edcee0 | 5086 | /* parse the BIOS configuration and set up the alc_spec */ |
f12ab1e0 TI |
5087 | /* return 1 if successful, 0 if the proper config is not found, |
5088 | * or a negative error code | |
5089 | */ | |
e9edcee0 TI |
5090 | static int alc880_parse_auto_config(struct hda_codec *codec) |
5091 | { | |
5092 | struct alc_spec *spec = codec->spec; | |
757899ac | 5093 | int err; |
df694daa | 5094 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
e9edcee0 | 5095 | |
f12ab1e0 TI |
5096 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
5097 | alc880_ignore); | |
5098 | if (err < 0) | |
e9edcee0 | 5099 | return err; |
f12ab1e0 | 5100 | if (!spec->autocfg.line_outs) |
e9edcee0 | 5101 | return 0; /* can't find valid BIOS pin config */ |
df694daa | 5102 | |
f12ab1e0 TI |
5103 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
5104 | if (err < 0) | |
5105 | return err; | |
5106 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
5107 | if (err < 0) | |
5108 | return err; | |
5109 | err = alc880_auto_create_extra_out(spec, | |
5110 | spec->autocfg.speaker_pins[0], | |
5111 | "Speaker"); | |
5112 | if (err < 0) | |
5113 | return err; | |
5114 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
5115 | "Headphone"); | |
5116 | if (err < 0) | |
5117 | return err; | |
05f5f477 | 5118 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 5119 | if (err < 0) |
e9edcee0 TI |
5120 | return err; |
5121 | ||
5122 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
5123 | ||
757899ac | 5124 | alc_auto_parse_digital(codec); |
e9edcee0 | 5125 | |
603c4019 | 5126 | if (spec->kctls.list) |
d88897ea | 5127 | add_mixer(spec, spec->kctls.list); |
e9edcee0 | 5128 | |
d88897ea | 5129 | add_verb(spec, alc880_volume_init_verbs); |
e9edcee0 | 5130 | |
a1e8d2da | 5131 | spec->num_mux_defs = 1; |
61b9b9b1 | 5132 | spec->input_mux = &spec->private_imux[0]; |
e9edcee0 | 5133 | |
6227cdce | 5134 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 5135 | |
e9edcee0 TI |
5136 | return 1; |
5137 | } | |
5138 | ||
ae6b813a TI |
5139 | /* additional initialization for auto-configuration model */ |
5140 | static void alc880_auto_init(struct hda_codec *codec) | |
e9edcee0 | 5141 | { |
f6c7e546 | 5142 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 5143 | alc880_auto_init_multi_out(codec); |
8d88bc3d | 5144 | alc880_auto_init_extra_out(codec); |
e9edcee0 | 5145 | alc880_auto_init_analog_input(codec); |
7f311a46 | 5146 | alc880_auto_init_input_src(codec); |
757899ac | 5147 | alc_auto_init_digital(codec); |
f6c7e546 | 5148 | if (spec->unsol_event) |
7fb0d78f | 5149 | alc_inithook(codec); |
e9edcee0 TI |
5150 | } |
5151 | ||
b59bdf3b TI |
5152 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
5153 | * one of two digital mic pins, e.g. on ALC272 | |
5154 | */ | |
5155 | static void fixup_automic_adc(struct hda_codec *codec) | |
5156 | { | |
5157 | struct alc_spec *spec = codec->spec; | |
5158 | int i; | |
5159 | ||
5160 | for (i = 0; i < spec->num_adc_nids; i++) { | |
5161 | hda_nid_t cap = spec->capsrc_nids ? | |
5162 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5163 | int iidx, eidx; | |
5164 | ||
5165 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | |
5166 | if (iidx < 0) | |
5167 | continue; | |
5168 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | |
5169 | if (eidx < 0) | |
5170 | continue; | |
5171 | spec->int_mic.mux_idx = iidx; | |
5172 | spec->ext_mic.mux_idx = eidx; | |
5173 | if (spec->capsrc_nids) | |
5174 | spec->capsrc_nids += i; | |
5175 | spec->adc_nids += i; | |
5176 | spec->num_adc_nids = 1; | |
5177 | return; | |
5178 | } | |
5179 | snd_printd(KERN_INFO "hda_codec: %s: " | |
5180 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | |
5181 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | |
5182 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | |
5183 | } | |
5184 | ||
748cce43 TI |
5185 | /* select or unmute the given capsrc route */ |
5186 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, | |
5187 | int idx) | |
5188 | { | |
5189 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | |
5190 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | |
5191 | HDA_AMP_MUTE, 0); | |
5192 | } else { | |
5193 | snd_hda_codec_write_cache(codec, cap, 0, | |
5194 | AC_VERB_SET_CONNECT_SEL, idx); | |
5195 | } | |
5196 | } | |
5197 | ||
840b64c0 TI |
5198 | /* set the default connection to that pin */ |
5199 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |
eaa9b3a7 TI |
5200 | { |
5201 | struct alc_spec *spec = codec->spec; | |
eaa9b3a7 TI |
5202 | int i; |
5203 | ||
eaa9b3a7 TI |
5204 | for (i = 0; i < spec->num_adc_nids; i++) { |
5205 | hda_nid_t cap = spec->capsrc_nids ? | |
5206 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5207 | int idx; | |
5208 | ||
5209 | idx = get_connection_index(codec, cap, pin); | |
5210 | if (idx < 0) | |
5211 | continue; | |
748cce43 | 5212 | select_or_unmute_capsrc(codec, cap, idx); |
840b64c0 TI |
5213 | return i; /* return the found index */ |
5214 | } | |
5215 | return -1; /* not found */ | |
5216 | } | |
5217 | ||
5218 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | |
5219 | static void fixup_single_adc(struct hda_codec *codec) | |
5220 | { | |
5221 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5222 | struct auto_pin_cfg *cfg = &spec->autocfg; |
840b64c0 TI |
5223 | int i; |
5224 | ||
5225 | /* search for the input pin; there must be only one */ | |
66ceeb6b | 5226 | if (cfg->num_inputs != 1) |
eaa9b3a7 | 5227 | return; |
66ceeb6b | 5228 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
840b64c0 TI |
5229 | if (i >= 0) { |
5230 | /* use only this ADC */ | |
5231 | if (spec->capsrc_nids) | |
5232 | spec->capsrc_nids += i; | |
5233 | spec->adc_nids += i; | |
5234 | spec->num_adc_nids = 1; | |
eaa9b3a7 TI |
5235 | } |
5236 | } | |
5237 | ||
840b64c0 TI |
5238 | /* initialize dual adcs */ |
5239 | static void fixup_dual_adc_switch(struct hda_codec *codec) | |
5240 | { | |
5241 | struct alc_spec *spec = codec->spec; | |
5242 | init_capsrc_for_pin(codec, spec->ext_mic.pin); | |
5243 | init_capsrc_for_pin(codec, spec->int_mic.pin); | |
5244 | } | |
5245 | ||
b59bdf3b | 5246 | static void set_capture_mixer(struct hda_codec *codec) |
f9e336f6 | 5247 | { |
b59bdf3b | 5248 | struct alc_spec *spec = codec->spec; |
a23b688f TI |
5249 | static struct snd_kcontrol_new *caps[2][3] = { |
5250 | { alc_capture_mixer_nosrc1, | |
5251 | alc_capture_mixer_nosrc2, | |
5252 | alc_capture_mixer_nosrc3 }, | |
5253 | { alc_capture_mixer1, | |
5254 | alc_capture_mixer2, | |
5255 | alc_capture_mixer3 }, | |
f9e336f6 | 5256 | }; |
a23b688f | 5257 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
eaa9b3a7 | 5258 | int mux = 0; |
840b64c0 TI |
5259 | int num_adcs = spec->num_adc_nids; |
5260 | if (spec->dual_adc_switch) | |
5261 | fixup_dual_adc_switch(codec); | |
5262 | else if (spec->auto_mic) | |
b59bdf3b | 5263 | fixup_automic_adc(codec); |
eaa9b3a7 TI |
5264 | else if (spec->input_mux) { |
5265 | if (spec->input_mux->num_items > 1) | |
5266 | mux = 1; | |
5267 | else if (spec->input_mux->num_items == 1) | |
5268 | fixup_single_adc(codec); | |
5269 | } | |
840b64c0 TI |
5270 | if (spec->dual_adc_switch) |
5271 | num_adcs = 1; | |
5272 | spec->cap_mixer = caps[mux][num_adcs - 1]; | |
a23b688f | 5273 | } |
f9e336f6 TI |
5274 | } |
5275 | ||
6694635d TI |
5276 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
5277 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | |
5278 | int num_nids) | |
5279 | { | |
5280 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5281 | struct auto_pin_cfg *cfg = &spec->autocfg; |
6694635d TI |
5282 | int n; |
5283 | hda_nid_t fallback_adc = 0, fallback_cap = 0; | |
5284 | ||
5285 | for (n = 0; n < num_nids; n++) { | |
5286 | hda_nid_t adc, cap; | |
5287 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
5288 | int nconns, i, j; | |
5289 | ||
5290 | adc = nids[n]; | |
5291 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) | |
5292 | continue; | |
5293 | cap = adc; | |
5294 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5295 | ARRAY_SIZE(conn)); | |
5296 | if (nconns == 1) { | |
5297 | cap = conn[0]; | |
5298 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5299 | ARRAY_SIZE(conn)); | |
5300 | } | |
5301 | if (nconns <= 0) | |
5302 | continue; | |
5303 | if (!fallback_adc) { | |
5304 | fallback_adc = adc; | |
5305 | fallback_cap = cap; | |
5306 | } | |
66ceeb6b TI |
5307 | for (i = 0; i < cfg->num_inputs; i++) { |
5308 | hda_nid_t nid = cfg->inputs[i].pin; | |
6694635d TI |
5309 | for (j = 0; j < nconns; j++) { |
5310 | if (conn[j] == nid) | |
5311 | break; | |
5312 | } | |
5313 | if (j >= nconns) | |
5314 | break; | |
5315 | } | |
66ceeb6b | 5316 | if (i >= cfg->num_inputs) { |
6694635d TI |
5317 | int num_adcs = spec->num_adc_nids; |
5318 | spec->private_adc_nids[num_adcs] = adc; | |
5319 | spec->private_capsrc_nids[num_adcs] = cap; | |
5320 | spec->num_adc_nids++; | |
5321 | spec->adc_nids = spec->private_adc_nids; | |
5322 | if (adc != cap) | |
5323 | spec->capsrc_nids = spec->private_capsrc_nids; | |
5324 | } | |
5325 | } | |
5326 | if (!spec->num_adc_nids) { | |
5327 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" | |
1f85d72d TI |
5328 | " using fallback 0x%x\n", |
5329 | codec->chip_name, fallback_adc); | |
6694635d TI |
5330 | spec->private_adc_nids[0] = fallback_adc; |
5331 | spec->adc_nids = spec->private_adc_nids; | |
5332 | if (fallback_adc != fallback_cap) { | |
5333 | spec->private_capsrc_nids[0] = fallback_cap; | |
5334 | spec->capsrc_nids = spec->private_adc_nids; | |
5335 | } | |
5336 | } | |
5337 | } | |
5338 | ||
67d634c0 | 5339 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
5340 | #define set_beep_amp(spec, nid, idx, dir) \ |
5341 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | |
dc1eae25 TI |
5342 | |
5343 | static struct snd_pci_quirk beep_white_list[] = { | |
5344 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), | |
080dc7bc | 5345 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
e096c8e6 | 5346 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
dc1eae25 TI |
5347 | {} |
5348 | }; | |
5349 | ||
5350 | static inline int has_cdefine_beep(struct hda_codec *codec) | |
5351 | { | |
5352 | struct alc_spec *spec = codec->spec; | |
5353 | const struct snd_pci_quirk *q; | |
5354 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); | |
5355 | if (q) | |
5356 | return q->value; | |
5357 | return spec->cdefine.enable_pcbeep; | |
5358 | } | |
67d634c0 TI |
5359 | #else |
5360 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | |
dc1eae25 | 5361 | #define has_cdefine_beep(codec) 0 |
67d634c0 | 5362 | #endif |
45bdd1c1 TI |
5363 | |
5364 | /* | |
5365 | * OK, here we have finally the patch for ALC880 | |
5366 | */ | |
5367 | ||
1da177e4 LT |
5368 | static int patch_alc880(struct hda_codec *codec) |
5369 | { | |
5370 | struct alc_spec *spec; | |
5371 | int board_config; | |
df694daa | 5372 | int err; |
1da177e4 | 5373 | |
e560d8d8 | 5374 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
5375 | if (spec == NULL) |
5376 | return -ENOMEM; | |
5377 | ||
5378 | codec->spec = spec; | |
5379 | ||
f5fcc13c TI |
5380 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
5381 | alc880_models, | |
5382 | alc880_cfg_tbl); | |
5383 | if (board_config < 0) { | |
9a11f1aa TI |
5384 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5385 | codec->chip_name); | |
e9edcee0 | 5386 | board_config = ALC880_AUTO; |
1da177e4 | 5387 | } |
1da177e4 | 5388 | |
e9edcee0 TI |
5389 | if (board_config == ALC880_AUTO) { |
5390 | /* automatic parse from the BIOS config */ | |
5391 | err = alc880_parse_auto_config(codec); | |
5392 | if (err < 0) { | |
5393 | alc_free(codec); | |
5394 | return err; | |
f12ab1e0 | 5395 | } else if (!err) { |
9c7f852e TI |
5396 | printk(KERN_INFO |
5397 | "hda_codec: Cannot set up configuration " | |
5398 | "from BIOS. Using 3-stack mode...\n"); | |
e9edcee0 TI |
5399 | board_config = ALC880_3ST; |
5400 | } | |
1da177e4 LT |
5401 | } |
5402 | ||
680cd536 KK |
5403 | err = snd_hda_attach_beep_device(codec, 0x1); |
5404 | if (err < 0) { | |
5405 | alc_free(codec); | |
5406 | return err; | |
5407 | } | |
5408 | ||
df694daa | 5409 | if (board_config != ALC880_AUTO) |
e9c364c0 | 5410 | setup_preset(codec, &alc880_presets[board_config]); |
1da177e4 | 5411 | |
1da177e4 LT |
5412 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
5413 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
6330079f | 5414 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
1da177e4 | 5415 | |
1da177e4 LT |
5416 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
5417 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
5418 | ||
f12ab1e0 | 5419 | if (!spec->adc_nids && spec->input_mux) { |
e9edcee0 | 5420 | /* check whether NID 0x07 is valid */ |
54d17403 | 5421 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
f12ab1e0 | 5422 | /* get type */ |
a22d543a | 5423 | wcap = get_wcaps_type(wcap); |
e9edcee0 TI |
5424 | if (wcap != AC_WID_AUD_IN) { |
5425 | spec->adc_nids = alc880_adc_nids_alt; | |
5426 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
e9edcee0 TI |
5427 | } else { |
5428 | spec->adc_nids = alc880_adc_nids; | |
5429 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
e9edcee0 TI |
5430 | } |
5431 | } | |
b59bdf3b | 5432 | set_capture_mixer(codec); |
45bdd1c1 | 5433 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
1da177e4 | 5434 | |
2134ea4f TI |
5435 | spec->vmaster_nid = 0x0c; |
5436 | ||
1da177e4 | 5437 | codec->patch_ops = alc_patch_ops; |
e9edcee0 | 5438 | if (board_config == ALC880_AUTO) |
ae6b813a | 5439 | spec->init_hook = alc880_auto_init; |
cb53c626 TI |
5440 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5441 | if (!spec->loopback.amplist) | |
5442 | spec->loopback.amplist = alc880_loopbacks; | |
5443 | #endif | |
1da177e4 LT |
5444 | |
5445 | return 0; | |
5446 | } | |
5447 | ||
e9edcee0 | 5448 | |
1da177e4 LT |
5449 | /* |
5450 | * ALC260 support | |
5451 | */ | |
5452 | ||
e9edcee0 TI |
5453 | static hda_nid_t alc260_dac_nids[1] = { |
5454 | /* front */ | |
5455 | 0x02, | |
5456 | }; | |
5457 | ||
5458 | static hda_nid_t alc260_adc_nids[1] = { | |
5459 | /* ADC0 */ | |
5460 | 0x04, | |
5461 | }; | |
5462 | ||
df694daa | 5463 | static hda_nid_t alc260_adc_nids_alt[1] = { |
e9edcee0 TI |
5464 | /* ADC1 */ |
5465 | 0x05, | |
5466 | }; | |
5467 | ||
d57fdac0 JW |
5468 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
5469 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
5470 | */ | |
5471 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
4c5186ed JW |
5472 | /* ADC0, ADC1 */ |
5473 | 0x04, 0x05 | |
5474 | }; | |
5475 | ||
e9edcee0 TI |
5476 | #define ALC260_DIGOUT_NID 0x03 |
5477 | #define ALC260_DIGIN_NID 0x06 | |
5478 | ||
5479 | static struct hda_input_mux alc260_capture_source = { | |
5480 | .num_items = 4, | |
5481 | .items = { | |
5482 | { "Mic", 0x0 }, | |
5483 | { "Front Mic", 0x1 }, | |
5484 | { "Line", 0x2 }, | |
5485 | { "CD", 0x4 }, | |
5486 | }, | |
5487 | }; | |
5488 | ||
17e7aec6 | 5489 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
a1e8d2da JW |
5490 | * headphone jack and the internal CD lines since these are the only pins at |
5491 | * which audio can appear. For flexibility, also allow the option of | |
5492 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
5493 | * connection to the mixer output). | |
a9430dd8 | 5494 | */ |
a1e8d2da JW |
5495 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
5496 | { | |
5497 | .num_items = 3, | |
5498 | .items = { | |
5499 | { "Mic/Line", 0x0 }, | |
5500 | { "CD", 0x4 }, | |
5501 | { "Headphone", 0x2 }, | |
5502 | }, | |
a9430dd8 | 5503 | }, |
a1e8d2da JW |
5504 | { |
5505 | .num_items = 4, | |
5506 | .items = { | |
5507 | { "Mic/Line", 0x0 }, | |
5508 | { "CD", 0x4 }, | |
5509 | { "Headphone", 0x2 }, | |
5510 | { "Mixer", 0x5 }, | |
5511 | }, | |
5512 | }, | |
5513 | ||
a9430dd8 JW |
5514 | }; |
5515 | ||
a1e8d2da JW |
5516 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
5517 | * the Fujitsu S702x, but jacks are marked differently. | |
0bfc90e9 | 5518 | */ |
a1e8d2da JW |
5519 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
5520 | { | |
5521 | .num_items = 4, | |
5522 | .items = { | |
5523 | { "Mic", 0x0 }, | |
5524 | { "Line", 0x2 }, | |
5525 | { "CD", 0x4 }, | |
5526 | { "Headphone", 0x5 }, | |
5527 | }, | |
5528 | }, | |
5529 | { | |
5530 | .num_items = 5, | |
5531 | .items = { | |
5532 | { "Mic", 0x0 }, | |
5533 | { "Line", 0x2 }, | |
5534 | { "CD", 0x4 }, | |
5535 | { "Headphone", 0x6 }, | |
5536 | { "Mixer", 0x5 }, | |
5537 | }, | |
0bfc90e9 JW |
5538 | }, |
5539 | }; | |
cc959489 MS |
5540 | |
5541 | /* Maxdata Favorit 100XS */ | |
5542 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { | |
5543 | { | |
5544 | .num_items = 2, | |
5545 | .items = { | |
5546 | { "Line/Mic", 0x0 }, | |
5547 | { "CD", 0x4 }, | |
5548 | }, | |
5549 | }, | |
5550 | { | |
5551 | .num_items = 3, | |
5552 | .items = { | |
5553 | { "Line/Mic", 0x0 }, | |
5554 | { "CD", 0x4 }, | |
5555 | { "Mixer", 0x5 }, | |
5556 | }, | |
5557 | }, | |
5558 | }; | |
5559 | ||
1da177e4 LT |
5560 | /* |
5561 | * This is just place-holder, so there's something for alc_build_pcms to look | |
5562 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
5563 | * element which allows changing the channel mode, so the verb list is | |
5564 | * never used. | |
5565 | */ | |
d2a6d7dc | 5566 | static struct hda_channel_mode alc260_modes[1] = { |
1da177e4 LT |
5567 | { 2, NULL }, |
5568 | }; | |
5569 | ||
df694daa KY |
5570 | |
5571 | /* Mixer combinations | |
5572 | * | |
5573 | * basic: base_output + input + pc_beep + capture | |
5574 | * HP: base_output + input + capture_alt | |
5575 | * HP_3013: hp_3013 + input + capture | |
5576 | * fujitsu: fujitsu + capture | |
0bfc90e9 | 5577 | * acer: acer + capture |
df694daa KY |
5578 | */ |
5579 | ||
5580 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
05acb863 | 5581 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 5582 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
05acb863 | 5583 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
985be54b | 5584 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
05acb863 | 5585 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
985be54b | 5586 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
1da177e4 | 5587 | { } /* end */ |
f12ab1e0 | 5588 | }; |
1da177e4 | 5589 | |
df694daa | 5590 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
16ded525 TI |
5591 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
5592 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5593 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5594 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5595 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5596 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5597 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
5598 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
df694daa KY |
5599 | { } /* end */ |
5600 | }; | |
5601 | ||
bec15c3a TI |
5602 | /* update HP, line and mono out pins according to the master switch */ |
5603 | static void alc260_hp_master_update(struct hda_codec *codec, | |
5604 | hda_nid_t hp, hda_nid_t line, | |
5605 | hda_nid_t mono) | |
5606 | { | |
5607 | struct alc_spec *spec = codec->spec; | |
5608 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
5609 | /* change HP and line-out pins */ | |
30cde0aa | 5610 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a | 5611 | val); |
30cde0aa | 5612 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a TI |
5613 | val); |
5614 | /* mono (speaker) depending on the HP jack sense */ | |
5615 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
30cde0aa | 5616 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a TI |
5617 | val); |
5618 | } | |
5619 | ||
5620 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
5621 | struct snd_ctl_elem_value *ucontrol) | |
5622 | { | |
5623 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5624 | struct alc_spec *spec = codec->spec; | |
5625 | *ucontrol->value.integer.value = spec->master_sw; | |
5626 | return 0; | |
5627 | } | |
5628 | ||
5629 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
5630 | struct snd_ctl_elem_value *ucontrol) | |
5631 | { | |
5632 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5633 | struct alc_spec *spec = codec->spec; | |
5634 | int val = !!*ucontrol->value.integer.value; | |
5635 | hda_nid_t hp, line, mono; | |
5636 | ||
5637 | if (val == spec->master_sw) | |
5638 | return 0; | |
5639 | spec->master_sw = val; | |
5640 | hp = (kcontrol->private_value >> 16) & 0xff; | |
5641 | line = (kcontrol->private_value >> 8) & 0xff; | |
5642 | mono = kcontrol->private_value & 0xff; | |
5643 | alc260_hp_master_update(codec, hp, line, mono); | |
5644 | return 1; | |
5645 | } | |
5646 | ||
5647 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
5648 | { | |
5649 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5650 | .name = "Master Playback Switch", | |
5b0cb1d8 | 5651 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
bec15c3a TI |
5652 | .info = snd_ctl_boolean_mono_info, |
5653 | .get = alc260_hp_master_sw_get, | |
5654 | .put = alc260_hp_master_sw_put, | |
5655 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
5656 | }, | |
5657 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5658 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
5659 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5660 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
5661 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
5662 | HDA_OUTPUT), | |
5663 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5664 | { } /* end */ | |
5665 | }; | |
5666 | ||
5667 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
5668 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5669 | {}, | |
5670 | }; | |
5671 | ||
5672 | static void alc260_hp_automute(struct hda_codec *codec) | |
5673 | { | |
5674 | struct alc_spec *spec = codec->spec; | |
bec15c3a | 5675 | |
864f92be | 5676 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
bec15c3a TI |
5677 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
5678 | } | |
5679 | ||
5680 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
5681 | { | |
5682 | if ((res >> 26) == ALC880_HP_EVENT) | |
5683 | alc260_hp_automute(codec); | |
5684 | } | |
5685 | ||
df694daa | 5686 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
bec15c3a TI |
5687 | { |
5688 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5689 | .name = "Master Playback Switch", | |
5b0cb1d8 | 5690 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
bec15c3a TI |
5691 | .info = snd_ctl_boolean_mono_info, |
5692 | .get = alc260_hp_master_sw_get, | |
5693 | .put = alc260_hp_master_sw_put, | |
30cde0aa | 5694 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
bec15c3a | 5695 | }, |
df694daa KY |
5696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
5697 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5698 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
5699 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
5700 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5701 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
5702 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
5703 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
16ded525 TI |
5704 | { } /* end */ |
5705 | }; | |
5706 | ||
3f878308 KY |
5707 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
5708 | .ops = &snd_hda_bind_vol, | |
5709 | .values = { | |
5710 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | |
5711 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | |
5712 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | |
5713 | 0 | |
5714 | }, | |
5715 | }; | |
5716 | ||
5717 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | |
5718 | .ops = &snd_hda_bind_sw, | |
5719 | .values = { | |
5720 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | |
5721 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
5722 | 0 | |
5723 | }, | |
5724 | }; | |
5725 | ||
5726 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | |
5727 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | |
5728 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | |
5729 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | |
5730 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5731 | { } /* end */ | |
5732 | }; | |
5733 | ||
bec15c3a TI |
5734 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
5735 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5736 | {}, | |
5737 | }; | |
5738 | ||
5739 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
5740 | { | |
5741 | struct alc_spec *spec = codec->spec; | |
bec15c3a | 5742 | |
864f92be | 5743 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
30cde0aa | 5744 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
bec15c3a TI |
5745 | } |
5746 | ||
5747 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
5748 | unsigned int res) | |
5749 | { | |
5750 | if ((res >> 26) == ALC880_HP_EVENT) | |
5751 | alc260_hp_3013_automute(codec); | |
5752 | } | |
5753 | ||
3f878308 KY |
5754 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
5755 | { | |
864f92be | 5756 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
3f878308 | 5757 | |
3f878308 KY |
5758 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
5759 | bits); | |
5760 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5761 | bits); | |
5762 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5763 | bits); | |
5764 | } | |
5765 | ||
5766 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | |
5767 | unsigned int res) | |
5768 | { | |
5769 | if ((res >> 26) == ALC880_HP_EVENT) | |
5770 | alc260_hp_3012_automute(codec); | |
5771 | } | |
5772 | ||
5773 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | |
a1e8d2da JW |
5774 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
5775 | */ | |
c8b6bf9b | 5776 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
a9430dd8 | 5777 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 5778 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
4c5186ed | 5779 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
a9430dd8 JW |
5780 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
5781 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5782 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5783 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4c5186ed | 5784 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
31bffaa9 TI |
5785 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
5786 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
df694daa KY |
5787 | { } /* end */ |
5788 | }; | |
5789 | ||
a1e8d2da JW |
5790 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
5791 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
5792 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
5793 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
5794 | * whether this behaviour is intentional or is a hardware bug in chip | |
5795 | * revisions available in early 2006. Therefore for now allow the | |
5796 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
5797 | * that the lack of mic bias for this NID is intentional we could change the | |
5798 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
5799 | * | |
5800 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
5801 | * don't appear to make the mic bias available from the "line" jack, even | |
5802 | * though the NID used for this jack (0x14) can supply it. The theory is | |
5803 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
5804 | * and the output jack. If this turns out to be the case for all such | |
5805 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
5806 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
bd869485 JW |
5807 | * |
5808 | * The C20x Tablet series have a mono internal speaker which is controlled | |
5809 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
5810 | * controls for such models. On models without a "mono speaker" the control | |
5811 | * won't do anything. | |
a1e8d2da | 5812 | */ |
0bfc90e9 JW |
5813 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
5814 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5815 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
a1e8d2da | 5816 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
31bffaa9 | 5817 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
bd869485 | 5818 | HDA_OUTPUT), |
31bffaa9 | 5819 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
bd869485 | 5820 | HDA_INPUT), |
0bfc90e9 JW |
5821 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
5822 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5823 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5824 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5825 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5826 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5827 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5828 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
0bfc90e9 JW |
5829 | { } /* end */ |
5830 | }; | |
5831 | ||
cc959489 MS |
5832 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
5833 | */ | |
5834 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { | |
5835 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5836 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
5837 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
5838 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5839 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5840 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5841 | { } /* end */ | |
5842 | }; | |
5843 | ||
bc9f98a9 KY |
5844 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
5845 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
5846 | */ | |
5847 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
5848 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5849 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
5850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5852 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5853 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5854 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5855 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5856 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5857 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
bc9f98a9 KY |
5858 | { } /* end */ |
5859 | }; | |
5860 | ||
5861 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
5862 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
5863 | */ | |
5864 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
5865 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5866 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
5867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5869 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5870 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
5871 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
5872 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5873 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5874 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5875 | { } /* end */ | |
5876 | }; | |
5877 | ||
df694daa KY |
5878 | /* |
5879 | * initialization verbs | |
5880 | */ | |
1da177e4 LT |
5881 | static struct hda_verb alc260_init_verbs[] = { |
5882 | /* Line In pin widget for input */ | |
05acb863 | 5883 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 5884 | /* CD pin widget for input */ |
05acb863 | 5885 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 5886 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
16ded525 | 5887 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 5888 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
16ded525 | 5889 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 5890 | /* LINE-2 is used for line-out in rear */ |
05acb863 | 5891 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 5892 | /* select line-out */ |
fd56f2db | 5893 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 | 5894 | /* LINE-OUT pin */ |
05acb863 | 5895 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 5896 | /* enable HP */ |
05acb863 | 5897 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1da177e4 | 5898 | /* enable Mono */ |
05acb863 TI |
5899 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5900 | /* mute capture amp left and right */ | |
16ded525 | 5901 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 LT |
5902 | /* set connection select to line in (default select for this ADC) */ |
5903 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16ded525 TI |
5904 | /* mute capture amp left and right */ |
5905 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5906 | /* set connection select to line in (default select for this ADC) */ | |
5907 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
05acb863 TI |
5908 | /* set vol=0 Line-Out mixer amp left and right */ |
5909 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5910 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5911 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5912 | /* set vol=0 HP mixer amp left and right */ | |
5913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5914 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5915 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5916 | /* set vol=0 Mono mixer amp left and right */ | |
5917 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5918 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
5919 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5920 | /* unmute LINE-2 out pin */ | |
5921 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f12ab1e0 TI |
5922 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
5923 | * Line In 2 = 0x03 | |
5924 | */ | |
cb53c626 TI |
5925 | /* mute analog inputs */ |
5926 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5927 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5929 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5930 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 5931 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
05acb863 TI |
5932 | /* mute Front out path */ |
5933 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5934 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5935 | /* mute Headphone out path */ | |
5936 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5937 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5938 | /* mute Mono out path */ | |
5939 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5940 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
5941 | { } |
5942 | }; | |
5943 | ||
474167d6 | 5944 | #if 0 /* should be identical with alc260_init_verbs? */ |
df694daa KY |
5945 | static struct hda_verb alc260_hp_init_verbs[] = { |
5946 | /* Headphone and output */ | |
5947 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
5948 | /* mono output */ | |
5949 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5950 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
5951 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5952 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
5953 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5954 | /* Line In pin widget for input */ | |
5955 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5956 | /* Line-2 pin widget for output */ | |
5957 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5958 | /* CD pin widget for input */ | |
5959 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
5960 | /* unmute amp left and right */ | |
5961 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
5962 | /* set connection select to line in (default select for this ADC) */ | |
5963 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
5964 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
5965 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
5966 | /* mute pin widget amp left and right (no gain on this amp) */ | |
5967 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
5968 | /* unmute HP mixer amp left and right (volume = 0) */ | |
5969 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
5970 | /* mute pin widget amp left and right (no gain on this amp) */ | |
5971 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
5972 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
5973 | * Line In 2 = 0x03 | |
5974 | */ | |
cb53c626 TI |
5975 | /* mute analog inputs */ |
5976 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5977 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5978 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5980 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
5981 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
5982 | /* Unmute Front out path */ | |
5983 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5984 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5985 | /* Unmute Headphone out path */ | |
5986 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5987 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5988 | /* Unmute Mono out path */ | |
5989 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
5990 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
5991 | { } | |
5992 | }; | |
474167d6 | 5993 | #endif |
df694daa KY |
5994 | |
5995 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
5996 | /* Line out and output */ | |
5997 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
5998 | /* mono output */ | |
5999 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6000 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
6001 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6002 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
6003 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6004 | /* Line In pin widget for input */ | |
6005 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6006 | /* Headphone pin widget for output */ | |
6007 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
6008 | /* CD pin widget for input */ | |
6009 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6010 | /* unmute amp left and right */ | |
6011 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
6012 | /* set connection select to line in (default select for this ADC) */ | |
6013 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6014 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
6015 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6016 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6017 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6018 | /* unmute HP mixer amp left and right (volume = 0) */ | |
6019 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6020 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6021 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
6022 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
6023 | * Line In 2 = 0x03 | |
6024 | */ | |
cb53c626 TI |
6025 | /* mute analog inputs */ |
6026 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6028 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6029 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6030 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
6031 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
6032 | /* Unmute Front out path */ | |
6033 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6034 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6035 | /* Unmute Headphone out path */ | |
6036 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6037 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6038 | /* Unmute Mono out path */ | |
6039 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6040 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6041 | { } | |
6042 | }; | |
6043 | ||
a9430dd8 | 6044 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
a1e8d2da JW |
6045 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
6046 | * audio = 0x16, internal speaker = 0x10. | |
a9430dd8 JW |
6047 | */ |
6048 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
6049 | /* Disable all GPIOs */ | |
6050 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
6051 | /* Internal speaker is connected to headphone pin */ | |
6052 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6053 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
6054 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
f7ace40d JW |
6055 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
6056 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6057 | /* Ensure all other unused pins are disabled and muted. */ | |
6058 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6059 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a9430dd8 | 6060 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d | 6061 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
a9430dd8 | 6062 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d JW |
6063 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6064 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6065 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6066 | ||
6067 | /* Disable digital (SPDIF) pins */ | |
6068 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6069 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
a9430dd8 | 6070 | |
ea1fb29a | 6071 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
f7ace40d JW |
6072 | * when acting as an output. |
6073 | */ | |
6074 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4c5186ed | 6075 | |
f7ace40d | 6076 | /* Start with output sum widgets muted and their output gains at min */ |
8b33a5aa TI |
6077 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6078 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6079 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6080 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6081 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6082 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6083 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6084 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6085 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a9430dd8 | 6086 | |
f7ace40d JW |
6087 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
6088 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6089 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
6090 | * If the pin mode is changed by the user the pin mode control will | |
6091 | * take care of enabling the pin's input/output buffers as needed. | |
6092 | * Therefore there's no need to enable the input buffer at this | |
6093 | * stage. | |
cdcd9268 | 6094 | */ |
f7ace40d | 6095 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
ea1fb29a | 6096 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
cdcd9268 JW |
6097 | * mixer ctrl) |
6098 | */ | |
f7ace40d JW |
6099 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
6100 | ||
6101 | /* Mute capture amp left and right */ | |
6102 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 6103 | /* Set ADC connection select to match default mixer setting - line |
f7ace40d JW |
6104 | * in (on mic1 pin) |
6105 | */ | |
6106 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6107 | ||
6108 | /* Do the same for the second ADC: mute capture input amp and | |
6109 | * set ADC connection to line in (on mic1 pin) | |
6110 | */ | |
6111 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6112 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6113 | ||
6114 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6115 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6116 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6117 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6119 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6120 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6121 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6122 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4a471b7d TI |
6123 | |
6124 | { } | |
a9430dd8 JW |
6125 | }; |
6126 | ||
0bfc90e9 JW |
6127 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
6128 | * similar laptops (adapted from Fujitsu init verbs). | |
6129 | */ | |
6130 | static struct hda_verb alc260_acer_init_verbs[] = { | |
6131 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
6132 | * the headphone jack. Turn this on and rely on the standard mute | |
6133 | * methods whenever the user wants to turn these outputs off. | |
6134 | */ | |
6135 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6136 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6137 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6138 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
6139 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6140 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
6141 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6142 | /* Line In jack is connected to Line1 pin */ | |
6143 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
bd869485 JW |
6144 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
6145 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
0bfc90e9 JW |
6146 | /* Ensure all other unused pins are disabled and muted. */ |
6147 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6148 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
0bfc90e9 JW |
6149 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
6150 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6151 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6152 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6153 | /* Disable digital (SPDIF) pins */ | |
6154 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6155 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6156 | ||
ea1fb29a | 6157 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
0bfc90e9 JW |
6158 | * bus when acting as outputs. |
6159 | */ | |
6160 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6161 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6162 | ||
6163 | /* Start with output sum widgets muted and their output gains at min */ | |
6164 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6165 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6166 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6167 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6168 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6169 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6170 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6171 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6172 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6173 | ||
f12ab1e0 TI |
6174 | /* Unmute Line-out pin widget amp left and right |
6175 | * (no equiv mixer ctrl) | |
6176 | */ | |
0bfc90e9 | 6177 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
bd869485 JW |
6178 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
6179 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
0bfc90e9 JW |
6180 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
6181 | * inputs. If the pin mode is changed by the user the pin mode control | |
6182 | * will take care of enabling the pin's input/output buffers as needed. | |
6183 | * Therefore there's no need to enable the input buffer at this | |
6184 | * stage. | |
6185 | */ | |
6186 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6187 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6188 | ||
6189 | /* Mute capture amp left and right */ | |
6190 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6191 | /* Set ADC connection select to match default mixer setting - mic | |
6192 | * (on mic1 pin) | |
6193 | */ | |
6194 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6195 | ||
6196 | /* Do similar with the second ADC: mute capture input amp and | |
a1e8d2da | 6197 | * set ADC connection to mic to match ALSA's default state. |
0bfc90e9 JW |
6198 | */ |
6199 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a1e8d2da | 6200 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
0bfc90e9 JW |
6201 | |
6202 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6203 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6204 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6205 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6206 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6207 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6208 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6210 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6211 | ||
6212 | { } | |
6213 | }; | |
6214 | ||
cc959489 MS |
6215 | /* Initialisation sequence for Maxdata Favorit 100XS |
6216 | * (adapted from Acer init verbs). | |
6217 | */ | |
6218 | static struct hda_verb alc260_favorit100_init_verbs[] = { | |
6219 | /* GPIO 0 enables the output jack. | |
6220 | * Turn this on and rely on the standard mute | |
6221 | * methods whenever the user wants to turn these outputs off. | |
6222 | */ | |
6223 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6224 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6225 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6226 | /* Line/Mic input jack is connected to Mic1 pin */ | |
6227 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6228 | /* Ensure all other unused pins are disabled and muted. */ | |
6229 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6230 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6231 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6232 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6233 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6234 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6235 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6237 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6238 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6239 | /* Disable digital (SPDIF) pins */ | |
6240 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6241 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6242 | ||
6243 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
6244 | * bus when acting as outputs. | |
6245 | */ | |
6246 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6247 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6248 | ||
6249 | /* Start with output sum widgets muted and their output gains at min */ | |
6250 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6251 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6252 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6253 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6254 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6255 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6256 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6257 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6258 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6259 | ||
6260 | /* Unmute Line-out pin widget amp left and right | |
6261 | * (no equiv mixer ctrl) | |
6262 | */ | |
6263 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6264 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
6265 | * inputs. If the pin mode is changed by the user the pin mode control | |
6266 | * will take care of enabling the pin's input/output buffers as needed. | |
6267 | * Therefore there's no need to enable the input buffer at this | |
6268 | * stage. | |
6269 | */ | |
6270 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6271 | ||
6272 | /* Mute capture amp left and right */ | |
6273 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6274 | /* Set ADC connection select to match default mixer setting - mic | |
6275 | * (on mic1 pin) | |
6276 | */ | |
6277 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6278 | ||
6279 | /* Do similar with the second ADC: mute capture input amp and | |
6280 | * set ADC connection to mic to match ALSA's default state. | |
6281 | */ | |
6282 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6283 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6284 | ||
6285 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6286 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6287 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6288 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6289 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6290 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6291 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6292 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6293 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6294 | ||
6295 | { } | |
6296 | }; | |
6297 | ||
bc9f98a9 KY |
6298 | static struct hda_verb alc260_will_verbs[] = { |
6299 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6300 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6301 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6302 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6303 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6304 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
6305 | {} | |
6306 | }; | |
6307 | ||
6308 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
6309 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6310 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6311 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
6312 | ||
6313 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6314 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6315 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6316 | ||
6317 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6318 | {} | |
6319 | }; | |
6320 | ||
6321 | /* toggle speaker-output according to the hp-jack state */ | |
6322 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
6323 | { | |
6324 | unsigned int present; | |
6325 | ||
6326 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
864f92be | 6327 | present = snd_hda_jack_detect(codec, 0x0f); |
bc9f98a9 | 6328 | if (present) { |
82beb8fd TI |
6329 | snd_hda_codec_write_cache(codec, 0x01, 0, |
6330 | AC_VERB_SET_GPIO_DATA, 1); | |
6331 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6332 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6333 | PIN_HP); | |
bc9f98a9 | 6334 | } else { |
82beb8fd TI |
6335 | snd_hda_codec_write_cache(codec, 0x01, 0, |
6336 | AC_VERB_SET_GPIO_DATA, 0); | |
6337 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6338 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6339 | PIN_OUT); | |
bc9f98a9 KY |
6340 | } |
6341 | } | |
6342 | ||
6343 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
6344 | unsigned int res) | |
6345 | { | |
6346 | if ((res >> 26) == ALC880_HP_EVENT) | |
6347 | alc260_replacer_672v_automute(codec); | |
6348 | } | |
6349 | ||
3f878308 KY |
6350 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
6351 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6352 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6353 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6354 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6355 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6356 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6357 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6358 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6359 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6360 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6361 | {} | |
6362 | }; | |
6363 | ||
7cf51e48 JW |
6364 | /* Test configuration for debugging, modelled after the ALC880 test |
6365 | * configuration. | |
6366 | */ | |
6367 | #ifdef CONFIG_SND_DEBUG | |
6368 | static hda_nid_t alc260_test_dac_nids[1] = { | |
6369 | 0x02, | |
6370 | }; | |
6371 | static hda_nid_t alc260_test_adc_nids[2] = { | |
6372 | 0x04, 0x05, | |
6373 | }; | |
a1e8d2da | 6374 | /* For testing the ALC260, each input MUX needs its own definition since |
ea1fb29a | 6375 | * the signal assignments are different. This assumes that the first ADC |
a1e8d2da | 6376 | * is NID 0x04. |
17e7aec6 | 6377 | */ |
a1e8d2da JW |
6378 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
6379 | { | |
6380 | .num_items = 7, | |
6381 | .items = { | |
6382 | { "MIC1 pin", 0x0 }, | |
6383 | { "MIC2 pin", 0x1 }, | |
6384 | { "LINE1 pin", 0x2 }, | |
6385 | { "LINE2 pin", 0x3 }, | |
6386 | { "CD pin", 0x4 }, | |
6387 | { "LINE-OUT pin", 0x5 }, | |
6388 | { "HP-OUT pin", 0x6 }, | |
6389 | }, | |
6390 | }, | |
6391 | { | |
6392 | .num_items = 8, | |
6393 | .items = { | |
6394 | { "MIC1 pin", 0x0 }, | |
6395 | { "MIC2 pin", 0x1 }, | |
6396 | { "LINE1 pin", 0x2 }, | |
6397 | { "LINE2 pin", 0x3 }, | |
6398 | { "CD pin", 0x4 }, | |
6399 | { "Mixer", 0x5 }, | |
6400 | { "LINE-OUT pin", 0x6 }, | |
6401 | { "HP-OUT pin", 0x7 }, | |
6402 | }, | |
7cf51e48 JW |
6403 | }, |
6404 | }; | |
6405 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
6406 | /* Output driver widgets */ | |
6407 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
6408 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
6409 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
6410 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
6411 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6412 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
6413 | ||
a1e8d2da JW |
6414 | /* Modes for retasking pin widgets |
6415 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
6416 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
6417 | * mention this restriction. At this stage it's not clear whether | |
6418 | * this behaviour is intentional or is a hardware bug in chip | |
6419 | * revisions available at least up until early 2006. Therefore for | |
6420 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
6421 | * choices, but if it turns out that the lack of mic bias for these | |
6422 | * NIDs is intentional we could change their modes from | |
6423 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
6424 | */ | |
7cf51e48 JW |
6425 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
6426 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
6427 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
6428 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
6429 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
6430 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
6431 | ||
6432 | /* Loopback mixer controls */ | |
6433 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
6434 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
6435 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
6436 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
6437 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6438 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6439 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
6440 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
6441 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6442 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
7cf51e48 JW |
6443 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
6444 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
6445 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
6446 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
5c8f858d JW |
6447 | |
6448 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
6449 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
6450 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
6451 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
6452 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
6453 | ||
92621f13 JW |
6454 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
6455 | * is ambigious as to which NID is which; testing on laptops which | |
ea1fb29a | 6456 | * make this output available should provide clarification. |
92621f13 JW |
6457 | */ |
6458 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
6459 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
6460 | ||
f8225f6d JW |
6461 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
6462 | * this output to turn on an external amplifier. | |
6463 | */ | |
6464 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
6465 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
6466 | ||
7cf51e48 JW |
6467 | { } /* end */ |
6468 | }; | |
6469 | static struct hda_verb alc260_test_init_verbs[] = { | |
5c8f858d JW |
6470 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
6471 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
6472 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6473 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
6474 | ||
7cf51e48 JW |
6475 | /* Enable retasking pins as output, initially without power amp */ |
6476 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6477 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6478 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6479 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6480 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6481 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6482 | ||
92621f13 JW |
6483 | /* Disable digital (SPDIF) pins initially, but users can enable |
6484 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
6485 | * payload also sets the generation to 0, output to be in "consumer" | |
6486 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
6487 | * control. | |
6488 | */ | |
7cf51e48 JW |
6489 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
6490 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6491 | ||
ea1fb29a | 6492 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
7cf51e48 JW |
6493 | * OUT1 sum bus when acting as an output. |
6494 | */ | |
6495 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6496 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
6497 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6498 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
6499 | ||
6500 | /* Start with output sum widgets muted and their output gains at min */ | |
6501 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6502 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6503 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6504 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6505 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6506 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6507 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6508 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6509 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6510 | ||
cdcd9268 JW |
6511 | /* Unmute retasking pin widget output buffers since the default |
6512 | * state appears to be output. As the pin mode is changed by the | |
6513 | * user the pin mode control will take care of enabling the pin's | |
6514 | * input/output buffers as needed. | |
6515 | */ | |
7cf51e48 JW |
6516 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
6517 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6519 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6520 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6521 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6522 | /* Also unmute the mono-out pin widget */ | |
6523 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6524 | ||
7cf51e48 JW |
6525 | /* Mute capture amp left and right */ |
6526 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
f7ace40d JW |
6527 | /* Set ADC connection select to match default mixer setting (mic1 |
6528 | * pin) | |
7cf51e48 JW |
6529 | */ |
6530 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6531 | ||
6532 | /* Do the same for the second ADC: mute capture input amp and | |
f7ace40d | 6533 | * set ADC connection to mic1 pin |
7cf51e48 JW |
6534 | */ |
6535 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6536 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6537 | ||
6538 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6539 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6540 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6541 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6542 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6544 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6545 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6547 | ||
6548 | { } | |
6549 | }; | |
6550 | #endif | |
6551 | ||
6330079f TI |
6552 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
6553 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
1da177e4 | 6554 | |
a3bcba38 TI |
6555 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
6556 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
6557 | ||
df694daa KY |
6558 | /* |
6559 | * for BIOS auto-configuration | |
6560 | */ | |
16ded525 | 6561 | |
df694daa | 6562 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
863b4518 | 6563 | const char *pfx, int *vol_bits) |
df694daa KY |
6564 | { |
6565 | hda_nid_t nid_vol; | |
6566 | unsigned long vol_val, sw_val; | |
df694daa KY |
6567 | int err; |
6568 | ||
6569 | if (nid >= 0x0f && nid < 0x11) { | |
6570 | nid_vol = nid - 0x7; | |
6571 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6572 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6573 | } else if (nid == 0x11) { | |
6574 | nid_vol = nid - 0x7; | |
6575 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
6576 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
6577 | } else if (nid >= 0x12 && nid <= 0x15) { | |
6578 | nid_vol = 0x08; | |
6579 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6580 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6581 | } else | |
6582 | return 0; /* N/A */ | |
ea1fb29a | 6583 | |
863b4518 TI |
6584 | if (!(*vol_bits & (1 << nid_vol))) { |
6585 | /* first control for the volume widget */ | |
0afe5f89 | 6586 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); |
863b4518 TI |
6587 | if (err < 0) |
6588 | return err; | |
6589 | *vol_bits |= (1 << nid_vol); | |
6590 | } | |
0afe5f89 | 6591 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); |
f12ab1e0 | 6592 | if (err < 0) |
df694daa KY |
6593 | return err; |
6594 | return 1; | |
6595 | } | |
6596 | ||
6597 | /* add playback controls from the parsed DAC table */ | |
6598 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
6599 | const struct auto_pin_cfg *cfg) | |
6600 | { | |
6601 | hda_nid_t nid; | |
6602 | int err; | |
863b4518 | 6603 | int vols = 0; |
df694daa KY |
6604 | |
6605 | spec->multiout.num_dacs = 1; | |
6606 | spec->multiout.dac_nids = spec->private_dac_nids; | |
6607 | spec->multiout.dac_nids[0] = 0x02; | |
6608 | ||
6609 | nid = cfg->line_out_pins[0]; | |
6610 | if (nid) { | |
23112d6d TI |
6611 | const char *pfx; |
6612 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | |
6613 | pfx = "Master"; | |
6614 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
6615 | pfx = "Speaker"; | |
6616 | else | |
6617 | pfx = "Front"; | |
6618 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | |
df694daa KY |
6619 | if (err < 0) |
6620 | return err; | |
6621 | } | |
6622 | ||
82bc955f | 6623 | nid = cfg->speaker_pins[0]; |
df694daa | 6624 | if (nid) { |
863b4518 | 6625 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
df694daa KY |
6626 | if (err < 0) |
6627 | return err; | |
6628 | } | |
6629 | ||
eb06ed8f | 6630 | nid = cfg->hp_pins[0]; |
df694daa | 6631 | if (nid) { |
863b4518 TI |
6632 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
6633 | &vols); | |
df694daa KY |
6634 | if (err < 0) |
6635 | return err; | |
6636 | } | |
f12ab1e0 | 6637 | return 0; |
df694daa KY |
6638 | } |
6639 | ||
6640 | /* create playback/capture controls for input pins */ | |
05f5f477 | 6641 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
df694daa KY |
6642 | const struct auto_pin_cfg *cfg) |
6643 | { | |
05f5f477 | 6644 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
df694daa KY |
6645 | } |
6646 | ||
6647 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
6648 | hda_nid_t nid, int pin_type, | |
6649 | int sel_idx) | |
6650 | { | |
f6c7e546 | 6651 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
6652 | /* need the manual connection? */ |
6653 | if (nid >= 0x12) { | |
6654 | int idx = nid - 0x12; | |
6655 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
6656 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
df694daa KY |
6657 | } |
6658 | } | |
6659 | ||
6660 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
6661 | { | |
6662 | struct alc_spec *spec = codec->spec; | |
6663 | hda_nid_t nid; | |
6664 | ||
f12ab1e0 | 6665 | nid = spec->autocfg.line_out_pins[0]; |
baba8ee9 TI |
6666 | if (nid) { |
6667 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
6668 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
6669 | } | |
ea1fb29a | 6670 | |
82bc955f | 6671 | nid = spec->autocfg.speaker_pins[0]; |
df694daa KY |
6672 | if (nid) |
6673 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
6674 | ||
eb06ed8f | 6675 | nid = spec->autocfg.hp_pins[0]; |
df694daa | 6676 | if (nid) |
baba8ee9 | 6677 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
f12ab1e0 | 6678 | } |
df694daa KY |
6679 | |
6680 | #define ALC260_PIN_CD_NID 0x16 | |
6681 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
6682 | { | |
6683 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 6684 | struct auto_pin_cfg *cfg = &spec->autocfg; |
df694daa KY |
6685 | int i; |
6686 | ||
66ceeb6b TI |
6687 | for (i = 0; i < cfg->num_inputs; i++) { |
6688 | hda_nid_t nid = cfg->inputs[i].pin; | |
df694daa | 6689 | if (nid >= 0x12) { |
23f0c048 | 6690 | alc_set_input_pin(codec, nid, i); |
e82c025b TI |
6691 | if (nid != ALC260_PIN_CD_NID && |
6692 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f12ab1e0 TI |
6693 | snd_hda_codec_write(codec, nid, 0, |
6694 | AC_VERB_SET_AMP_GAIN_MUTE, | |
df694daa KY |
6695 | AMP_OUT_MUTE); |
6696 | } | |
6697 | } | |
6698 | } | |
6699 | ||
7f311a46 TI |
6700 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
6701 | ||
df694daa KY |
6702 | /* |
6703 | * generic initialization of ADC, input mixers and output mixers | |
6704 | */ | |
6705 | static struct hda_verb alc260_volume_init_verbs[] = { | |
6706 | /* | |
6707 | * Unmute ADC0-1 and set the default input to mic-in | |
6708 | */ | |
6709 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6710 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6711 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6712 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 6713 | |
df694daa KY |
6714 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
6715 | * mixer widget | |
f12ab1e0 TI |
6716 | * Note: PASD motherboards uses the Line In 2 as the input for |
6717 | * front panel mic (mic 2) | |
df694daa KY |
6718 | */ |
6719 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
6720 | /* mute analog inputs */ |
6721 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6722 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6723 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6724 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6725 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
6726 | |
6727 | /* | |
6728 | * Set up output mixers (0x08 - 0x0a) | |
6729 | */ | |
6730 | /* set vol=0 to output mixers */ | |
6731 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6732 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6733 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6734 | /* set up input amps for analog loopback */ | |
6735 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6736 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6737 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6738 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6739 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6740 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6741 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 6742 | |
df694daa KY |
6743 | { } |
6744 | }; | |
6745 | ||
6746 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
6747 | { | |
6748 | struct alc_spec *spec = codec->spec; | |
df694daa KY |
6749 | int err; |
6750 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
6751 | ||
f12ab1e0 TI |
6752 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
6753 | alc260_ignore); | |
6754 | if (err < 0) | |
df694daa | 6755 | return err; |
f12ab1e0 TI |
6756 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
6757 | if (err < 0) | |
4a471b7d | 6758 | return err; |
603c4019 | 6759 | if (!spec->kctls.list) |
df694daa | 6760 | return 0; /* can't find valid BIOS pin config */ |
05f5f477 | 6761 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 6762 | if (err < 0) |
df694daa KY |
6763 | return err; |
6764 | ||
6765 | spec->multiout.max_channels = 2; | |
6766 | ||
0852d7a6 | 6767 | if (spec->autocfg.dig_outs) |
df694daa | 6768 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
603c4019 | 6769 | if (spec->kctls.list) |
d88897ea | 6770 | add_mixer(spec, spec->kctls.list); |
df694daa | 6771 | |
d88897ea | 6772 | add_verb(spec, alc260_volume_init_verbs); |
df694daa | 6773 | |
a1e8d2da | 6774 | spec->num_mux_defs = 1; |
61b9b9b1 | 6775 | spec->input_mux = &spec->private_imux[0]; |
df694daa | 6776 | |
6227cdce | 6777 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
4a79ba34 | 6778 | |
df694daa KY |
6779 | return 1; |
6780 | } | |
6781 | ||
ae6b813a TI |
6782 | /* additional initialization for auto-configuration model */ |
6783 | static void alc260_auto_init(struct hda_codec *codec) | |
df694daa | 6784 | { |
f6c7e546 | 6785 | struct alc_spec *spec = codec->spec; |
df694daa KY |
6786 | alc260_auto_init_multi_out(codec); |
6787 | alc260_auto_init_analog_input(codec); | |
7f311a46 | 6788 | alc260_auto_init_input_src(codec); |
757899ac | 6789 | alc_auto_init_digital(codec); |
f6c7e546 | 6790 | if (spec->unsol_event) |
7fb0d78f | 6791 | alc_inithook(codec); |
df694daa KY |
6792 | } |
6793 | ||
cb53c626 TI |
6794 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6795 | static struct hda_amp_list alc260_loopbacks[] = { | |
6796 | { 0x07, HDA_INPUT, 0 }, | |
6797 | { 0x07, HDA_INPUT, 1 }, | |
6798 | { 0x07, HDA_INPUT, 2 }, | |
6799 | { 0x07, HDA_INPUT, 3 }, | |
6800 | { 0x07, HDA_INPUT, 4 }, | |
6801 | { } /* end */ | |
6802 | }; | |
6803 | #endif | |
6804 | ||
fc091769 TI |
6805 | /* |
6806 | * Pin config fixes | |
6807 | */ | |
6808 | enum { | |
6809 | PINFIX_HP_DC5750, | |
6810 | }; | |
6811 | ||
fc091769 TI |
6812 | static const struct alc_fixup alc260_fixups[] = { |
6813 | [PINFIX_HP_DC5750] = { | |
73413b12 TI |
6814 | .pins = (const struct alc_pincfg[]) { |
6815 | { 0x11, 0x90130110 }, /* speaker */ | |
6816 | { } | |
6817 | } | |
fc091769 TI |
6818 | }, |
6819 | }; | |
6820 | ||
6821 | static struct snd_pci_quirk alc260_fixup_tbl[] = { | |
6822 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), | |
6823 | {} | |
6824 | }; | |
6825 | ||
df694daa KY |
6826 | /* |
6827 | * ALC260 configurations | |
6828 | */ | |
f5fcc13c TI |
6829 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
6830 | [ALC260_BASIC] = "basic", | |
6831 | [ALC260_HP] = "hp", | |
6832 | [ALC260_HP_3013] = "hp-3013", | |
2922c9af | 6833 | [ALC260_HP_DC7600] = "hp-dc7600", |
f5fcc13c TI |
6834 | [ALC260_FUJITSU_S702X] = "fujitsu", |
6835 | [ALC260_ACER] = "acer", | |
bc9f98a9 KY |
6836 | [ALC260_WILL] = "will", |
6837 | [ALC260_REPLACER_672V] = "replacer", | |
cc959489 | 6838 | [ALC260_FAVORIT100] = "favorit100", |
7cf51e48 | 6839 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 6840 | [ALC260_TEST] = "test", |
7cf51e48 | 6841 | #endif |
f5fcc13c TI |
6842 | [ALC260_AUTO] = "auto", |
6843 | }; | |
6844 | ||
6845 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
bd869485 | 6846 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
950200e2 | 6847 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
f5fcc13c | 6848 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
cc959489 | 6849 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
9720b718 | 6850 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
4ac55982 | 6851 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
f5fcc13c | 6852 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
34ec8a0a | 6853 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
3f878308 | 6854 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
f5fcc13c TI |
6855 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
6856 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
6857 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
6858 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
6859 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
6860 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
6861 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
6862 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
6863 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
bc9f98a9 | 6864 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
ac3e3741 | 6865 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
df694daa KY |
6866 | {} |
6867 | }; | |
6868 | ||
6869 | static struct alc_config_preset alc260_presets[] = { | |
6870 | [ALC260_BASIC] = { | |
6871 | .mixers = { alc260_base_output_mixer, | |
45bdd1c1 | 6872 | alc260_input_mixer }, |
df694daa KY |
6873 | .init_verbs = { alc260_init_verbs }, |
6874 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6875 | .dac_nids = alc260_dac_nids, | |
f9e336f6 | 6876 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
9c4cc0bd | 6877 | .adc_nids = alc260_dual_adc_nids, |
df694daa KY |
6878 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
6879 | .channel_mode = alc260_modes, | |
6880 | .input_mux = &alc260_capture_source, | |
6881 | }, | |
6882 | [ALC260_HP] = { | |
bec15c3a | 6883 | .mixers = { alc260_hp_output_mixer, |
f9e336f6 | 6884 | alc260_input_mixer }, |
bec15c3a TI |
6885 | .init_verbs = { alc260_init_verbs, |
6886 | alc260_hp_unsol_verbs }, | |
df694daa KY |
6887 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
6888 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
6889 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
6890 | .adc_nids = alc260_adc_nids_alt, | |
df694daa KY |
6891 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
6892 | .channel_mode = alc260_modes, | |
6893 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
6894 | .unsol_event = alc260_hp_unsol_event, |
6895 | .init_hook = alc260_hp_automute, | |
df694daa | 6896 | }, |
3f878308 KY |
6897 | [ALC260_HP_DC7600] = { |
6898 | .mixers = { alc260_hp_dc7600_mixer, | |
f9e336f6 | 6899 | alc260_input_mixer }, |
3f878308 KY |
6900 | .init_verbs = { alc260_init_verbs, |
6901 | alc260_hp_dc7600_verbs }, | |
6902 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6903 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
6904 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
6905 | .adc_nids = alc260_adc_nids_alt, | |
3f878308 KY |
6906 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
6907 | .channel_mode = alc260_modes, | |
6908 | .input_mux = &alc260_capture_source, | |
6909 | .unsol_event = alc260_hp_3012_unsol_event, | |
6910 | .init_hook = alc260_hp_3012_automute, | |
6911 | }, | |
df694daa KY |
6912 | [ALC260_HP_3013] = { |
6913 | .mixers = { alc260_hp_3013_mixer, | |
f9e336f6 | 6914 | alc260_input_mixer }, |
bec15c3a TI |
6915 | .init_verbs = { alc260_hp_3013_init_verbs, |
6916 | alc260_hp_3013_unsol_verbs }, | |
df694daa KY |
6917 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
6918 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
6919 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
6920 | .adc_nids = alc260_adc_nids_alt, | |
df694daa KY |
6921 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
6922 | .channel_mode = alc260_modes, | |
6923 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
6924 | .unsol_event = alc260_hp_3013_unsol_event, |
6925 | .init_hook = alc260_hp_3013_automute, | |
df694daa KY |
6926 | }, |
6927 | [ALC260_FUJITSU_S702X] = { | |
f9e336f6 | 6928 | .mixers = { alc260_fujitsu_mixer }, |
df694daa KY |
6929 | .init_verbs = { alc260_fujitsu_init_verbs }, |
6930 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6931 | .dac_nids = alc260_dac_nids, | |
d57fdac0 JW |
6932 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
6933 | .adc_nids = alc260_dual_adc_nids, | |
df694daa KY |
6934 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
6935 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
6936 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
6937 | .input_mux = alc260_fujitsu_capture_sources, | |
df694daa | 6938 | }, |
0bfc90e9 | 6939 | [ALC260_ACER] = { |
f9e336f6 | 6940 | .mixers = { alc260_acer_mixer }, |
0bfc90e9 JW |
6941 | .init_verbs = { alc260_acer_init_verbs }, |
6942 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6943 | .dac_nids = alc260_dac_nids, | |
6944 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6945 | .adc_nids = alc260_dual_adc_nids, | |
6946 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6947 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
6948 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
6949 | .input_mux = alc260_acer_capture_sources, | |
0bfc90e9 | 6950 | }, |
cc959489 MS |
6951 | [ALC260_FAVORIT100] = { |
6952 | .mixers = { alc260_favorit100_mixer }, | |
6953 | .init_verbs = { alc260_favorit100_init_verbs }, | |
6954 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6955 | .dac_nids = alc260_dac_nids, | |
6956 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
6957 | .adc_nids = alc260_dual_adc_nids, | |
6958 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6959 | .channel_mode = alc260_modes, | |
6960 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), | |
6961 | .input_mux = alc260_favorit100_capture_sources, | |
6962 | }, | |
bc9f98a9 | 6963 | [ALC260_WILL] = { |
f9e336f6 | 6964 | .mixers = { alc260_will_mixer }, |
bc9f98a9 KY |
6965 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
6966 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6967 | .dac_nids = alc260_dac_nids, | |
6968 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
6969 | .adc_nids = alc260_adc_nids, | |
6970 | .dig_out_nid = ALC260_DIGOUT_NID, | |
6971 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6972 | .channel_mode = alc260_modes, | |
6973 | .input_mux = &alc260_capture_source, | |
6974 | }, | |
6975 | [ALC260_REPLACER_672V] = { | |
f9e336f6 | 6976 | .mixers = { alc260_replacer_672v_mixer }, |
bc9f98a9 KY |
6977 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
6978 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
6979 | .dac_nids = alc260_dac_nids, | |
6980 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
6981 | .adc_nids = alc260_adc_nids, | |
6982 | .dig_out_nid = ALC260_DIGOUT_NID, | |
6983 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6984 | .channel_mode = alc260_modes, | |
6985 | .input_mux = &alc260_capture_source, | |
6986 | .unsol_event = alc260_replacer_672v_unsol_event, | |
6987 | .init_hook = alc260_replacer_672v_automute, | |
6988 | }, | |
7cf51e48 JW |
6989 | #ifdef CONFIG_SND_DEBUG |
6990 | [ALC260_TEST] = { | |
f9e336f6 | 6991 | .mixers = { alc260_test_mixer }, |
7cf51e48 JW |
6992 | .init_verbs = { alc260_test_init_verbs }, |
6993 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
6994 | .dac_nids = alc260_test_dac_nids, | |
6995 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
6996 | .adc_nids = alc260_test_adc_nids, | |
6997 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
6998 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
6999 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
7000 | .input_mux = alc260_test_capture_sources, | |
7cf51e48 JW |
7001 | }, |
7002 | #endif | |
df694daa KY |
7003 | }; |
7004 | ||
7005 | static int patch_alc260(struct hda_codec *codec) | |
1da177e4 LT |
7006 | { |
7007 | struct alc_spec *spec; | |
df694daa | 7008 | int err, board_config; |
1da177e4 | 7009 | |
e560d8d8 | 7010 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
7011 | if (spec == NULL) |
7012 | return -ENOMEM; | |
7013 | ||
7014 | codec->spec = spec; | |
7015 | ||
f5fcc13c TI |
7016 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
7017 | alc260_models, | |
7018 | alc260_cfg_tbl); | |
7019 | if (board_config < 0) { | |
9a11f1aa | 7020 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
6c627f39 | 7021 | codec->chip_name); |
df694daa | 7022 | board_config = ALC260_AUTO; |
16ded525 | 7023 | } |
1da177e4 | 7024 | |
fc091769 TI |
7025 | if (board_config == ALC260_AUTO) |
7026 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); | |
7027 | ||
df694daa KY |
7028 | if (board_config == ALC260_AUTO) { |
7029 | /* automatic parse from the BIOS config */ | |
7030 | err = alc260_parse_auto_config(codec); | |
7031 | if (err < 0) { | |
7032 | alc_free(codec); | |
7033 | return err; | |
f12ab1e0 | 7034 | } else if (!err) { |
9c7f852e TI |
7035 | printk(KERN_INFO |
7036 | "hda_codec: Cannot set up configuration " | |
7037 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
7038 | board_config = ALC260_BASIC; |
7039 | } | |
a9430dd8 | 7040 | } |
e9edcee0 | 7041 | |
680cd536 KK |
7042 | err = snd_hda_attach_beep_device(codec, 0x1); |
7043 | if (err < 0) { | |
7044 | alc_free(codec); | |
7045 | return err; | |
7046 | } | |
7047 | ||
df694daa | 7048 | if (board_config != ALC260_AUTO) |
e9c364c0 | 7049 | setup_preset(codec, &alc260_presets[board_config]); |
1da177e4 | 7050 | |
1da177e4 LT |
7051 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
7052 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
53bacfbb | 7053 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
1da177e4 | 7054 | |
a3bcba38 TI |
7055 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
7056 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
7057 | ||
4ef0ef19 TI |
7058 | if (!spec->adc_nids && spec->input_mux) { |
7059 | /* check whether NID 0x04 is valid */ | |
7060 | unsigned int wcap = get_wcaps(codec, 0x04); | |
a22d543a | 7061 | wcap = get_wcaps_type(wcap); |
4ef0ef19 TI |
7062 | /* get type */ |
7063 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
7064 | spec->adc_nids = alc260_adc_nids_alt; | |
7065 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
7066 | } else { | |
7067 | spec->adc_nids = alc260_adc_nids; | |
7068 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
7069 | } | |
7070 | } | |
b59bdf3b | 7071 | set_capture_mixer(codec); |
45bdd1c1 | 7072 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
f9e336f6 | 7073 | |
fc091769 TI |
7074 | if (board_config == ALC260_AUTO) |
7075 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); | |
7076 | ||
2134ea4f TI |
7077 | spec->vmaster_nid = 0x08; |
7078 | ||
1da177e4 | 7079 | codec->patch_ops = alc_patch_ops; |
df694daa | 7080 | if (board_config == ALC260_AUTO) |
ae6b813a | 7081 | spec->init_hook = alc260_auto_init; |
cb53c626 TI |
7082 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
7083 | if (!spec->loopback.amplist) | |
7084 | spec->loopback.amplist = alc260_loopbacks; | |
7085 | #endif | |
1da177e4 LT |
7086 | |
7087 | return 0; | |
7088 | } | |
7089 | ||
e9edcee0 | 7090 | |
1da177e4 | 7091 | /* |
4953550a | 7092 | * ALC882/883/885/888/889 support |
1da177e4 LT |
7093 | * |
7094 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
7095 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
7096 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
7097 | * 6-channel independent captures. | |
7098 | * | |
7099 | * In addition, an independent DAC for the multi-playback (not used in this | |
7100 | * driver yet). | |
7101 | */ | |
df694daa KY |
7102 | #define ALC882_DIGOUT_NID 0x06 |
7103 | #define ALC882_DIGIN_NID 0x0a | |
4953550a TI |
7104 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
7105 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | |
7106 | #define ALC1200_DIGOUT_NID 0x10 | |
7107 | ||
1da177e4 | 7108 | |
d2a6d7dc | 7109 | static struct hda_channel_mode alc882_ch_modes[1] = { |
1da177e4 LT |
7110 | { 8, NULL } |
7111 | }; | |
7112 | ||
4953550a | 7113 | /* DACs */ |
1da177e4 LT |
7114 | static hda_nid_t alc882_dac_nids[4] = { |
7115 | /* front, rear, clfe, rear_surr */ | |
7116 | 0x02, 0x03, 0x04, 0x05 | |
7117 | }; | |
4953550a | 7118 | #define alc883_dac_nids alc882_dac_nids |
1da177e4 | 7119 | |
4953550a | 7120 | /* ADCs */ |
df694daa KY |
7121 | #define alc882_adc_nids alc880_adc_nids |
7122 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
4953550a TI |
7123 | #define alc883_adc_nids alc882_adc_nids_alt |
7124 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | |
7125 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | |
7126 | #define alc889_adc_nids alc880_adc_nids | |
1da177e4 | 7127 | |
e1406348 TI |
7128 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
7129 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
4953550a TI |
7130 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
7131 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | |
7132 | #define alc889_capsrc_nids alc882_capsrc_nids | |
e1406348 | 7133 | |
1da177e4 LT |
7134 | /* input MUX */ |
7135 | /* FIXME: should be a matrix-type input source selection */ | |
7136 | ||
7137 | static struct hda_input_mux alc882_capture_source = { | |
7138 | .num_items = 4, | |
7139 | .items = { | |
7140 | { "Mic", 0x0 }, | |
7141 | { "Front Mic", 0x1 }, | |
7142 | { "Line", 0x2 }, | |
7143 | { "CD", 0x4 }, | |
7144 | }, | |
7145 | }; | |
41d5545d | 7146 | |
4953550a TI |
7147 | #define alc883_capture_source alc882_capture_source |
7148 | ||
87a8c370 JK |
7149 | static struct hda_input_mux alc889_capture_source = { |
7150 | .num_items = 3, | |
7151 | .items = { | |
7152 | { "Front Mic", 0x0 }, | |
7153 | { "Mic", 0x3 }, | |
7154 | { "Line", 0x2 }, | |
7155 | }, | |
7156 | }; | |
7157 | ||
41d5545d KS |
7158 | static struct hda_input_mux mb5_capture_source = { |
7159 | .num_items = 3, | |
7160 | .items = { | |
7161 | { "Mic", 0x1 }, | |
b8f171e7 | 7162 | { "Line", 0x7 }, |
41d5545d KS |
7163 | { "CD", 0x4 }, |
7164 | }, | |
7165 | }; | |
7166 | ||
e458b1fa LY |
7167 | static struct hda_input_mux macmini3_capture_source = { |
7168 | .num_items = 2, | |
7169 | .items = { | |
7170 | { "Line", 0x2 }, | |
7171 | { "CD", 0x4 }, | |
7172 | }, | |
7173 | }; | |
7174 | ||
4953550a TI |
7175 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
7176 | .num_items = 4, | |
7177 | .items = { | |
7178 | { "Mic", 0x1 }, | |
7179 | { "Front Mic", 0x0 }, | |
7180 | { "Line", 0x2 }, | |
7181 | { "CD", 0x4 }, | |
7182 | }, | |
7183 | }; | |
7184 | ||
7185 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | |
7186 | .num_items = 2, | |
7187 | .items = { | |
7188 | { "Mic", 0x1 }, | |
7189 | { "Line", 0x2 }, | |
7190 | }, | |
7191 | }; | |
7192 | ||
7193 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | |
7194 | .num_items = 4, | |
7195 | .items = { | |
7196 | { "Mic", 0x0 }, | |
150b432f | 7197 | { "Int Mic", 0x1 }, |
4953550a TI |
7198 | { "Line", 0x2 }, |
7199 | { "CD", 0x4 }, | |
7200 | }, | |
7201 | }; | |
7202 | ||
7203 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | |
7204 | .num_items = 2, | |
7205 | .items = { | |
7206 | { "Mic", 0x0 }, | |
7207 | { "Int Mic", 0x1 }, | |
7208 | }, | |
7209 | }; | |
7210 | ||
7211 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | |
7212 | .num_items = 3, | |
7213 | .items = { | |
7214 | { "Mic", 0x0 }, | |
7215 | { "Front Mic", 0x1 }, | |
7216 | { "Line", 0x4 }, | |
7217 | }, | |
7218 | }; | |
7219 | ||
7220 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | |
7221 | .num_items = 2, | |
7222 | .items = { | |
7223 | { "Mic", 0x0 }, | |
7224 | { "Line", 0x2 }, | |
7225 | }, | |
7226 | }; | |
7227 | ||
7228 | static struct hda_input_mux alc889A_mb31_capture_source = { | |
7229 | .num_items = 2, | |
7230 | .items = { | |
7231 | { "Mic", 0x0 }, | |
7232 | /* Front Mic (0x01) unused */ | |
7233 | { "Line", 0x2 }, | |
7234 | /* Line 2 (0x03) unused */ | |
af901ca1 | 7235 | /* CD (0x04) unused? */ |
4953550a TI |
7236 | }, |
7237 | }; | |
7238 | ||
b7cccc52 JM |
7239 | static struct hda_input_mux alc889A_imac91_capture_source = { |
7240 | .num_items = 2, | |
7241 | .items = { | |
7242 | { "Mic", 0x01 }, | |
7243 | { "Line", 0x2 }, /* Not sure! */ | |
7244 | }, | |
7245 | }; | |
7246 | ||
4953550a TI |
7247 | /* |
7248 | * 2ch mode | |
7249 | */ | |
7250 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
7251 | { 2, NULL } | |
7252 | }; | |
7253 | ||
272a527c KY |
7254 | /* |
7255 | * 2ch mode | |
7256 | */ | |
7257 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
7258 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7259 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7260 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7261 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7262 | { } /* end */ | |
7263 | }; | |
7264 | ||
4953550a TI |
7265 | /* |
7266 | * 4ch mode | |
7267 | */ | |
7268 | static struct hda_verb alc882_3ST_ch4_init[] = { | |
7269 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7270 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7271 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7272 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7273 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7274 | { } /* end */ | |
7275 | }; | |
7276 | ||
272a527c KY |
7277 | /* |
7278 | * 6ch mode | |
7279 | */ | |
7280 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
7281 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7282 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7283 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7284 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7285 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7286 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7287 | { } /* end */ | |
7288 | }; | |
7289 | ||
4953550a | 7290 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
272a527c | 7291 | { 2, alc882_3ST_ch2_init }, |
4953550a | 7292 | { 4, alc882_3ST_ch4_init }, |
272a527c KY |
7293 | { 6, alc882_3ST_ch6_init }, |
7294 | }; | |
7295 | ||
4953550a TI |
7296 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
7297 | ||
a65cc60f | 7298 | /* |
7299 | * 2ch mode | |
7300 | */ | |
7301 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | |
7302 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
7303 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7304 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7305 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7306 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7307 | { } /* end */ | |
7308 | }; | |
7309 | ||
7310 | /* | |
7311 | * 4ch mode | |
7312 | */ | |
7313 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | |
7314 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7315 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7316 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7317 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7318 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7319 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7320 | { } /* end */ | |
7321 | }; | |
7322 | ||
7323 | /* | |
7324 | * 6ch mode | |
7325 | */ | |
7326 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | |
7327 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7328 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7329 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7330 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7331 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7332 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7333 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7334 | { } /* end */ | |
7335 | }; | |
7336 | ||
7337 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | |
7338 | { 2, alc883_3ST_ch2_clevo_init }, | |
7339 | { 4, alc883_3ST_ch4_clevo_init }, | |
7340 | { 6, alc883_3ST_ch6_clevo_init }, | |
7341 | }; | |
7342 | ||
7343 | ||
df694daa KY |
7344 | /* |
7345 | * 6ch mode | |
7346 | */ | |
7347 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
7348 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7349 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7350 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7351 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7352 | { } /* end */ | |
7353 | }; | |
7354 | ||
7355 | /* | |
7356 | * 8ch mode | |
7357 | */ | |
7358 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
7359 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7360 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7361 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7362 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7363 | { } /* end */ | |
7364 | }; | |
7365 | ||
7366 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
7367 | { 6, alc882_sixstack_ch6_init }, | |
7368 | { 8, alc882_sixstack_ch8_init }, | |
7369 | }; | |
7370 | ||
76e6f5a9 RH |
7371 | |
7372 | /* Macbook Air 2,1 */ | |
7373 | ||
7374 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { | |
7375 | { 2, NULL }, | |
7376 | }; | |
7377 | ||
87350ad0 | 7378 | /* |
def319f9 | 7379 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
87350ad0 TI |
7380 | */ |
7381 | ||
7382 | /* | |
7383 | * 2ch mode | |
7384 | */ | |
7385 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
7386 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7387 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7388 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7389 | { } /* end */ | |
7390 | }; | |
7391 | ||
7392 | /* | |
a3f730af | 7393 | * 4ch mode |
87350ad0 | 7394 | */ |
a3f730af | 7395 | static struct hda_verb alc885_mbp_ch4_init[] = { |
87350ad0 TI |
7396 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7397 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7398 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7399 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7400 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7401 | { } /* end */ | |
7402 | }; | |
7403 | ||
a3f730af | 7404 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
87350ad0 | 7405 | { 2, alc885_mbp_ch2_init }, |
a3f730af | 7406 | { 4, alc885_mbp_ch4_init }, |
87350ad0 TI |
7407 | }; |
7408 | ||
92b9de83 KS |
7409 | /* |
7410 | * 2ch | |
7411 | * Speakers/Woofer/HP = Front | |
7412 | * LineIn = Input | |
7413 | */ | |
7414 | static struct hda_verb alc885_mb5_ch2_init[] = { | |
7415 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7416 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7417 | { } /* end */ | |
7418 | }; | |
7419 | ||
7420 | /* | |
7421 | * 6ch mode | |
7422 | * Speakers/HP = Front | |
7423 | * Woofer = LFE | |
7424 | * LineIn = Surround | |
7425 | */ | |
7426 | static struct hda_verb alc885_mb5_ch6_init[] = { | |
7427 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7428 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7429 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7430 | { } /* end */ | |
7431 | }; | |
7432 | ||
7433 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |
7434 | { 2, alc885_mb5_ch2_init }, | |
7435 | { 6, alc885_mb5_ch6_init }, | |
7436 | }; | |
87350ad0 | 7437 | |
d01aecdf | 7438 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
4953550a TI |
7439 | |
7440 | /* | |
7441 | * 2ch mode | |
7442 | */ | |
7443 | static struct hda_verb alc883_4ST_ch2_init[] = { | |
7444 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7445 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7446 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7447 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7448 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7449 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7450 | { } /* end */ | |
7451 | }; | |
7452 | ||
7453 | /* | |
7454 | * 4ch mode | |
7455 | */ | |
7456 | static struct hda_verb alc883_4ST_ch4_init[] = { | |
7457 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7458 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7459 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7460 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7461 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7462 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7463 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7464 | { } /* end */ | |
7465 | }; | |
7466 | ||
7467 | /* | |
7468 | * 6ch mode | |
7469 | */ | |
7470 | static struct hda_verb alc883_4ST_ch6_init[] = { | |
7471 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7472 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7473 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7474 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7475 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7476 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7477 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7478 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7479 | { } /* end */ | |
7480 | }; | |
7481 | ||
7482 | /* | |
7483 | * 8ch mode | |
7484 | */ | |
7485 | static struct hda_verb alc883_4ST_ch8_init[] = { | |
7486 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7487 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7488 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7489 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7490 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7491 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7492 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7493 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7494 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7495 | { } /* end */ | |
7496 | }; | |
7497 | ||
7498 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | |
7499 | { 2, alc883_4ST_ch2_init }, | |
7500 | { 4, alc883_4ST_ch4_init }, | |
7501 | { 6, alc883_4ST_ch6_init }, | |
7502 | { 8, alc883_4ST_ch8_init }, | |
7503 | }; | |
7504 | ||
7505 | ||
7506 | /* | |
7507 | * 2ch mode | |
7508 | */ | |
7509 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
7510 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7511 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7512 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7513 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7514 | { } /* end */ | |
7515 | }; | |
7516 | ||
7517 | /* | |
7518 | * 4ch mode | |
7519 | */ | |
7520 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
7521 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7522 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7523 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7524 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7525 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7526 | { } /* end */ | |
7527 | }; | |
7528 | ||
7529 | /* | |
7530 | * 6ch mode | |
7531 | */ | |
7532 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
7533 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7534 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7535 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7536 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7537 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7538 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7539 | { } /* end */ | |
7540 | }; | |
7541 | ||
7542 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
7543 | { 2, alc883_3ST_ch2_intel_init }, | |
7544 | { 4, alc883_3ST_ch4_intel_init }, | |
7545 | { 6, alc883_3ST_ch6_intel_init }, | |
7546 | }; | |
7547 | ||
dd7714c9 WF |
7548 | /* |
7549 | * 2ch mode | |
7550 | */ | |
7551 | static struct hda_verb alc889_ch2_intel_init[] = { | |
7552 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7553 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7554 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7555 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7556 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7557 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7558 | { } /* end */ | |
7559 | }; | |
7560 | ||
87a8c370 JK |
7561 | /* |
7562 | * 6ch mode | |
7563 | */ | |
7564 | static struct hda_verb alc889_ch6_intel_init[] = { | |
dd7714c9 WF |
7565 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7566 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7567 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7568 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7569 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
87a8c370 JK |
7570 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
7571 | { } /* end */ | |
7572 | }; | |
7573 | ||
7574 | /* | |
7575 | * 8ch mode | |
7576 | */ | |
7577 | static struct hda_verb alc889_ch8_intel_init[] = { | |
dd7714c9 WF |
7578 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7579 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7580 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7581 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7582 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
87a8c370 JK |
7583 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7584 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
87a8c370 JK |
7585 | { } /* end */ |
7586 | }; | |
7587 | ||
dd7714c9 WF |
7588 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
7589 | { 2, alc889_ch2_intel_init }, | |
87a8c370 JK |
7590 | { 6, alc889_ch6_intel_init }, |
7591 | { 8, alc889_ch8_intel_init }, | |
7592 | }; | |
7593 | ||
4953550a TI |
7594 | /* |
7595 | * 6ch mode | |
7596 | */ | |
7597 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
7598 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7599 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7600 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7601 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7602 | { } /* end */ | |
7603 | }; | |
7604 | ||
7605 | /* | |
7606 | * 8ch mode | |
7607 | */ | |
7608 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
7609 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7610 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7611 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7612 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7613 | { } /* end */ | |
7614 | }; | |
7615 | ||
7616 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
7617 | { 6, alc883_sixstack_ch6_init }, | |
7618 | { 8, alc883_sixstack_ch8_init }, | |
7619 | }; | |
7620 | ||
7621 | ||
1da177e4 LT |
7622 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
7623 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
7624 | */ | |
c8b6bf9b | 7625 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
05acb863 | 7626 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 7627 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 7628 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 7629 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
05acb863 TI |
7630 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
7631 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
7632 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
7633 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
05acb863 | 7634 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 7635 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1da177e4 LT |
7636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
7637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7638 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7639 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7640 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7642 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
1da177e4 LT |
7643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7644 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7645 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
1da177e4 | 7646 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
1da177e4 LT |
7647 | { } /* end */ |
7648 | }; | |
7649 | ||
76e6f5a9 RH |
7650 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
7651 | ||
7652 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { | |
7653 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7654 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), | |
7655 | { } | |
7656 | }; | |
7657 | ||
7658 | ||
87350ad0 | 7659 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
a3f730af TI |
7660 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7661 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7662 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7663 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7664 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
2134ea4f TI |
7665 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7666 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
87350ad0 TI |
7667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
7668 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
2134ea4f | 7669 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
87350ad0 TI |
7670 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
7671 | { } /* end */ | |
7672 | }; | |
41d5545d KS |
7673 | |
7674 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |
92b9de83 KS |
7675 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7676 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7677 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7678 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7679 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7680 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
a76221d4 AM |
7681 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
7682 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
b8f171e7 AM |
7683 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
7684 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
41d5545d KS |
7685 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
7686 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
7687 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7688 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), | |
7689 | { } /* end */ | |
7690 | }; | |
92b9de83 | 7691 | |
e458b1fa LY |
7692 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
7693 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7694 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7695 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7696 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7697 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7698 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7699 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | |
7700 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
7701 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
7702 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
7703 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7704 | { } /* end */ | |
7705 | }; | |
7706 | ||
4b7e1803 | 7707 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
b7cccc52 JM |
7708 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7709 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
4b7e1803 JM |
7710 | { } /* end */ |
7711 | }; | |
7712 | ||
7713 | ||
bdd148a3 KY |
7714 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
7715 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7716 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7717 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7718 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7719 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7720 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7721 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7722 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
bdd148a3 KY |
7724 | { } /* end */ |
7725 | }; | |
7726 | ||
272a527c KY |
7727 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
7728 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7729 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7730 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7731 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7732 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7733 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7734 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7735 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7736 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 7737 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
7738 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7739 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
96fe7cc8 | 7740 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
272a527c KY |
7741 | { } /* end */ |
7742 | }; | |
7743 | ||
7744 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
7745 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
7746 | */ | |
7747 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
7748 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7749 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7750 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7751 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
7752 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7753 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7754 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7755 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7756 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
7757 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
7758 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7759 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 7760 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
7761 | { } /* end */ |
7762 | }; | |
7763 | ||
914759b7 TI |
7764 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
7765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7766 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7767 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7768 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7769 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7770 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7771 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7773 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7774 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
914759b7 TI |
7775 | { } /* end */ |
7776 | }; | |
7777 | ||
df694daa KY |
7778 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
7779 | { | |
7780 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7781 | .name = "Channel Mode", | |
7782 | .info = alc_ch_mode_info, | |
7783 | .get = alc_ch_mode_get, | |
7784 | .put = alc_ch_mode_put, | |
7785 | }, | |
7786 | { } /* end */ | |
7787 | }; | |
7788 | ||
4953550a | 7789 | static struct hda_verb alc882_base_init_verbs[] = { |
1da177e4 | 7790 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
05acb863 TI |
7791 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7792 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 7793 | /* Rear mixer */ |
05acb863 TI |
7794 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7795 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 7796 | /* CLFE mixer */ |
05acb863 TI |
7797 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7798 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 7799 | /* Side mixer */ |
05acb863 TI |
7800 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7801 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 7802 | |
e9edcee0 | 7803 | /* Front Pin: output 0 (0x0c) */ |
05acb863 | 7804 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 7805 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 7806 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 7807 | /* Rear Pin: output 1 (0x0d) */ |
05acb863 | 7808 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 7809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 7810 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
e9edcee0 | 7811 | /* CLFE Pin: output 2 (0x0e) */ |
05acb863 | 7812 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 7813 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 7814 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
e9edcee0 | 7815 | /* Side Pin: output 3 (0x0f) */ |
05acb863 | 7816 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 7817 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 7818 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
e9edcee0 | 7819 | /* Mic (rear) pin: input vref at 80% */ |
16ded525 | 7820 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
7821 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
7822 | /* Front Mic pin: input vref at 80% */ | |
16ded525 | 7823 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
7824 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
7825 | /* Line In pin: input */ | |
05acb863 | 7826 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
7827 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
7828 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
7829 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7830 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7831 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1da177e4 | 7832 | /* CD pin widget for input */ |
05acb863 | 7833 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 LT |
7834 | |
7835 | /* FIXME: use matrix-type input source selection */ | |
7836 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
1da177e4 | 7837 | /* Input mixer2 */ |
05acb863 | 7838 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 7839 | /* Input mixer3 */ |
05acb863 | 7840 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
05acb863 TI |
7841 | /* ADC2: mute amp left and right */ |
7842 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 7843 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
7844 | /* ADC3: mute amp left and right */ |
7845 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 7846 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 LT |
7847 | |
7848 | { } | |
7849 | }; | |
7850 | ||
4953550a TI |
7851 | static struct hda_verb alc882_adc1_init_verbs[] = { |
7852 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7853 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7854 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7855 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7856 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7857 | /* ADC1: mute amp left and right */ | |
7858 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7859 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7860 | { } | |
7861 | }; | |
7862 | ||
4b146cb0 TI |
7863 | static struct hda_verb alc882_eapd_verbs[] = { |
7864 | /* change to EAPD mode */ | |
7865 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
b373bdeb | 7866 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
f12ab1e0 | 7867 | { } |
4b146cb0 TI |
7868 | }; |
7869 | ||
87a8c370 JK |
7870 | static struct hda_verb alc889_eapd_verbs[] = { |
7871 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
7872 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
7873 | { } | |
7874 | }; | |
7875 | ||
6732bd0d WF |
7876 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
7877 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
7878 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7879 | {} | |
7880 | }; | |
87a8c370 JK |
7881 | |
7882 | static struct hda_verb alc885_init_verbs[] = { | |
7883 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
88102f3f KY |
7884 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 7886 | /* Rear mixer */ |
88102f3f KY |
7887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7888 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 7889 | /* CLFE mixer */ |
88102f3f KY |
7890 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7891 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 7892 | /* Side mixer */ |
88102f3f KY |
7893 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7894 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 JK |
7895 | |
7896 | /* Front HP Pin: output 0 (0x0c) */ | |
6732bd0d | 7897 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
87a8c370 JK |
7898 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
7899 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7900 | /* Front Pin: output 0 (0x0c) */ | |
7901 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7902 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7903 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7904 | /* Rear Pin: output 1 (0x0d) */ | |
7905 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7906 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7907 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7908 | /* CLFE Pin: output 2 (0x0e) */ | |
7909 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7910 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7911 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7912 | /* Side Pin: output 3 (0x0f) */ | |
7913 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7914 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7915 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7916 | /* Mic (rear) pin: input vref at 80% */ | |
7917 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7918 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7919 | /* Front Mic pin: input vref at 80% */ | |
7920 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7921 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7922 | /* Line In pin: input */ | |
7923 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7924 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7925 | ||
7926 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | |
7927 | /* Input mixer1 */ | |
88102f3f | 7928 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
87a8c370 JK |
7929 | /* Input mixer2 */ |
7930 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
87a8c370 | 7931 | /* Input mixer3 */ |
88102f3f | 7932 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
87a8c370 JK |
7933 | /* ADC2: mute amp left and right */ |
7934 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7935 | /* ADC3: mute amp left and right */ | |
7936 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7937 | ||
7938 | { } | |
7939 | }; | |
7940 | ||
7941 | static struct hda_verb alc885_init_input_verbs[] = { | |
7942 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7943 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
7944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7945 | { } | |
7946 | }; | |
7947 | ||
7948 | ||
7949 | /* Unmute Selector 24h and set the default input to front mic */ | |
7950 | static struct hda_verb alc889_init_input_verbs[] = { | |
7951 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7952 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7953 | { } | |
7954 | }; | |
7955 | ||
7956 | ||
4953550a TI |
7957 | #define alc883_init_verbs alc882_base_init_verbs |
7958 | ||
9102cd1c TD |
7959 | /* Mac Pro test */ |
7960 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
7961 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7962 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7963 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
7964 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
7965 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
45bdd1c1 | 7966 | /* FIXME: this looks suspicious... |
d355c82a JK |
7967 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7968 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
45bdd1c1 | 7969 | */ |
9102cd1c TD |
7970 | { } /* end */ |
7971 | }; | |
7972 | ||
7973 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
7974 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
7975 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7976 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7977 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7978 | /* Front Pin: output 0 (0x0c) */ | |
7979 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7980 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7981 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7982 | /* Front Mic pin: input vref at 80% */ | |
7983 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7984 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7985 | /* Speaker: output */ | |
7986 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7987 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7988 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
7989 | /* Headphone output (output 0 - 0x0c) */ | |
7990 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7991 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7992 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7993 | ||
7994 | /* FIXME: use matrix-type input source selection */ | |
7995 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7996 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7997 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7998 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7999 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8000 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8001 | /* Input mixer2 */ | |
8002 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8003 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8004 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8005 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8006 | /* Input mixer3 */ | |
8007 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8009 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8010 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8011 | /* ADC1: mute amp left and right */ | |
8012 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8013 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8014 | /* ADC2: mute amp left and right */ | |
8015 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8016 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8017 | /* ADC3: mute amp left and right */ | |
8018 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8019 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8020 | ||
8021 | { } | |
8022 | }; | |
f12ab1e0 | 8023 | |
41d5545d KS |
8024 | /* Macbook 5,1 */ |
8025 | static struct hda_verb alc885_mb5_init_verbs[] = { | |
92b9de83 KS |
8026 | /* DACs */ |
8027 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8028 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8029 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8030 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
41d5545d | 8031 | /* Front mixer */ |
41d5545d KS |
8032 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
8033 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
92b9de83 KS |
8035 | /* Surround mixer */ |
8036 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8037 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8038 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8039 | /* LFE mixer */ | |
8040 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8041 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8043 | /* HP mixer */ | |
8044 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8045 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8046 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8047 | /* Front Pin (0x0c) */ | |
41d5545d KS |
8048 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
8049 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
92b9de83 KS |
8050 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8051 | /* LFE Pin (0x0e) */ | |
8052 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8053 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8054 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8055 | /* HP Pin (0x0f) */ | |
41d5545d KS |
8056 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
8057 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
92b9de83 | 8058 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
a76221d4 | 8059 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
41d5545d KS |
8060 | /* Front Mic pin: input vref at 80% */ |
8061 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8062 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8063 | /* Line In pin */ | |
8064 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8065 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8066 | ||
b8f171e7 AM |
8067 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
8068 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, | |
8069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, | |
41d5545d KS |
8070 | { } |
8071 | }; | |
8072 | ||
e458b1fa LY |
8073 | /* Macmini 3,1 */ |
8074 | static struct hda_verb alc885_macmini3_init_verbs[] = { | |
8075 | /* DACs */ | |
8076 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8077 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8078 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8079 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8080 | /* Front mixer */ | |
8081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8082 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8083 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8084 | /* Surround mixer */ | |
8085 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8086 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8087 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8088 | /* LFE mixer */ | |
8089 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8090 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8091 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8092 | /* HP mixer */ | |
8093 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8094 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8095 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8096 | /* Front Pin (0x0c) */ | |
8097 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8098 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8099 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8100 | /* LFE Pin (0x0e) */ | |
8101 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8102 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8103 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8104 | /* HP Pin (0x0f) */ | |
8105 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8106 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8107 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8108 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8109 | /* Line In pin */ | |
8110 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8111 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8112 | ||
8113 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8114 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8115 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8116 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8117 | { } | |
8118 | }; | |
8119 | ||
76e6f5a9 RH |
8120 | |
8121 | static struct hda_verb alc885_mba21_init_verbs[] = { | |
8122 | /*Internal and HP Speaker Mixer*/ | |
8123 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8124 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8125 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8126 | /*Internal Speaker Pin (0x0c)*/ | |
8127 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8128 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8129 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8130 | /* HP Pin: output 0 (0x0e) */ | |
8131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
8132 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8133 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8134 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | |
8135 | /* Line in (is hp when jack connected)*/ | |
8136 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
8137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8138 | ||
8139 | { } | |
8140 | }; | |
8141 | ||
8142 | ||
87350ad0 TI |
8143 | /* Macbook Pro rev3 */ |
8144 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
8145 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8146 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8147 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8148 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8149 | /* Rear mixer */ | |
8150 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8151 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8152 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a3f730af TI |
8153 | /* HP mixer */ |
8154 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8155 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8156 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
87350ad0 TI |
8157 | /* Front Pin: output 0 (0x0c) */ |
8158 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8159 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8160 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
a3f730af | 8161 | /* HP Pin: output 0 (0x0e) */ |
87350ad0 | 8162 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
a3f730af TI |
8163 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
8164 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
87350ad0 TI |
8165 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
8166 | /* Mic (rear) pin: input vref at 80% */ | |
8167 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8168 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8169 | /* Front Mic pin: input vref at 80% */ | |
8170 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8171 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8172 | /* Line In pin: use output 1 when in LineOut mode */ | |
8173 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8174 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8175 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8176 | ||
8177 | /* FIXME: use matrix-type input source selection */ | |
8178 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8179 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8180 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8181 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8182 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8183 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8184 | /* Input mixer2 */ | |
8185 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8186 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8187 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8188 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8189 | /* Input mixer3 */ | |
8190 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8191 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8192 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8193 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8194 | /* ADC1: mute amp left and right */ | |
8195 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8196 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8197 | /* ADC2: mute amp left and right */ | |
8198 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8199 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8200 | /* ADC3: mute amp left and right */ | |
8201 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8202 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8203 | ||
8204 | { } | |
8205 | }; | |
8206 | ||
4b7e1803 JM |
8207 | /* iMac 9,1 */ |
8208 | static struct hda_verb alc885_imac91_init_verbs[] = { | |
b7cccc52 JM |
8209 | /* Internal Speaker Pin (0x0c) */ |
8210 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8211 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8212 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8213 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8214 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8215 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8216 | /* HP Pin: Rear */ | |
4b7e1803 JM |
8217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
8218 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8219 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 JM |
8220 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
8221 | /* Line in Rear */ | |
8222 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
4b7e1803 | 8223 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4b7e1803 JM |
8224 | /* Front Mic pin: input vref at 80% */ |
8225 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8226 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
b7cccc52 JM |
8227 | /* Rear mixer */ |
8228 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8229 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8230 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8231 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | |
8232 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8233 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8234 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8235 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
4b7e1803 JM |
8236 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8237 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8238 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8239 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8240 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
4b7e1803 JM |
8241 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8242 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8243 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8244 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8245 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
4b7e1803 JM |
8246 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8247 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8248 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8249 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8250 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8252 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 | 8253 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8254 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8255 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 | 8256 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8258 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4b7e1803 JM |
8259 | { } |
8260 | }; | |
8261 | ||
c54728d8 NF |
8262 | /* iMac 24 mixer. */ |
8263 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
8264 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8265 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
8266 | { } /* end */ | |
8267 | }; | |
8268 | ||
8269 | /* iMac 24 init verbs. */ | |
8270 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
8271 | /* Internal speakers: output 0 (0x0c) */ | |
8272 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8273 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8274 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8275 | /* Internal speakers: output 0 (0x0c) */ | |
8276 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8277 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8278 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8279 | /* Headphone: output 0 (0x0c) */ | |
8280 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8281 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8282 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8283 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8284 | /* Front Mic: input vref at 80% */ | |
8285 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8286 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8287 | { } | |
8288 | }; | |
8289 | ||
8290 | /* Toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 8291 | static void alc885_imac24_setup(struct hda_codec *codec) |
c54728d8 | 8292 | { |
a9fd4f3f | 8293 | struct alc_spec *spec = codec->spec; |
c54728d8 | 8294 | |
a9fd4f3f TI |
8295 | spec->autocfg.hp_pins[0] = 0x14; |
8296 | spec->autocfg.speaker_pins[0] = 0x18; | |
8297 | spec->autocfg.speaker_pins[1] = 0x1a; | |
c54728d8 NF |
8298 | } |
8299 | ||
9d54f08b TI |
8300 | #define alc885_mb5_setup alc885_imac24_setup |
8301 | #define alc885_macmini3_setup alc885_imac24_setup | |
8302 | ||
76e6f5a9 RH |
8303 | /* Macbook Air 2,1 */ |
8304 | static void alc885_mba21_setup(struct hda_codec *codec) | |
8305 | { | |
8306 | struct alc_spec *spec = codec->spec; | |
8307 | ||
8308 | spec->autocfg.hp_pins[0] = 0x14; | |
8309 | spec->autocfg.speaker_pins[0] = 0x18; | |
8310 | } | |
8311 | ||
8312 | ||
8313 | ||
4f5d1706 | 8314 | static void alc885_mbp3_setup(struct hda_codec *codec) |
87350ad0 | 8315 | { |
a9fd4f3f | 8316 | struct alc_spec *spec = codec->spec; |
87350ad0 | 8317 | |
a9fd4f3f TI |
8318 | spec->autocfg.hp_pins[0] = 0x15; |
8319 | spec->autocfg.speaker_pins[0] = 0x14; | |
87350ad0 TI |
8320 | } |
8321 | ||
9d54f08b | 8322 | static void alc885_imac91_setup(struct hda_codec *codec) |
a76221d4 | 8323 | { |
9d54f08b | 8324 | struct alc_spec *spec = codec->spec; |
4b7e1803 | 8325 | |
9d54f08b | 8326 | spec->autocfg.hp_pins[0] = 0x14; |
b7cccc52 | 8327 | spec->autocfg.speaker_pins[0] = 0x18; |
9d54f08b | 8328 | spec->autocfg.speaker_pins[1] = 0x1a; |
4b7e1803 | 8329 | } |
87350ad0 | 8330 | |
272a527c KY |
8331 | static struct hda_verb alc882_targa_verbs[] = { |
8332 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8333 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8334 | ||
8335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8336 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8337 | |
272a527c KY |
8338 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
8339 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8340 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8341 | ||
8342 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
272a527c KY |
8343 | { } /* end */ |
8344 | }; | |
8345 | ||
8346 | /* toggle speaker-output according to the hp-jack state */ | |
8347 | static void alc882_targa_automute(struct hda_codec *codec) | |
8348 | { | |
a9fd4f3f TI |
8349 | struct alc_spec *spec = codec->spec; |
8350 | alc_automute_amp(codec); | |
82beb8fd | 8351 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
a9fd4f3f TI |
8352 | spec->jack_present ? 1 : 3); |
8353 | } | |
8354 | ||
4f5d1706 | 8355 | static void alc882_targa_setup(struct hda_codec *codec) |
a9fd4f3f TI |
8356 | { |
8357 | struct alc_spec *spec = codec->spec; | |
8358 | ||
8359 | spec->autocfg.hp_pins[0] = 0x14; | |
8360 | spec->autocfg.speaker_pins[0] = 0x1b; | |
272a527c KY |
8361 | } |
8362 | ||
8363 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
8364 | { | |
a9fd4f3f | 8365 | if ((res >> 26) == ALC880_HP_EVENT) |
272a527c | 8366 | alc882_targa_automute(codec); |
272a527c KY |
8367 | } |
8368 | ||
8369 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
8370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8371 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8372 | ||
8373 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8375 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8376 | |
272a527c KY |
8377 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
8378 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8379 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8380 | ||
8381 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8382 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8383 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8384 | { } /* end */ | |
8385 | }; | |
8386 | ||
914759b7 TI |
8387 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
8388 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8389 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8390 | ||
8391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8392 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8393 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8394 | |
914759b7 TI |
8395 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
8396 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8397 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8398 | ||
8399 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8400 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8401 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8402 | { } /* end */ | |
8403 | }; | |
8404 | ||
9102cd1c TD |
8405 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
8406 | { | |
8407 | unsigned int gpiostate, gpiomask, gpiodir; | |
8408 | ||
8409 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
8410 | AC_VERB_GET_GPIO_DATA, 0); | |
8411 | ||
8412 | if (!muted) | |
8413 | gpiostate |= (1 << pin); | |
8414 | else | |
8415 | gpiostate &= ~(1 << pin); | |
8416 | ||
8417 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
8418 | AC_VERB_GET_GPIO_MASK, 0); | |
8419 | gpiomask |= (1 << pin); | |
8420 | ||
8421 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
8422 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
8423 | gpiodir |= (1 << pin); | |
8424 | ||
8425 | ||
8426 | snd_hda_codec_write(codec, codec->afg, 0, | |
8427 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
8428 | snd_hda_codec_write(codec, codec->afg, 0, | |
8429 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
8430 | ||
8431 | msleep(1); | |
8432 | ||
8433 | snd_hda_codec_write(codec, codec->afg, 0, | |
8434 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
8435 | } | |
8436 | ||
7debbe51 TI |
8437 | /* set up GPIO at initialization */ |
8438 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
8439 | { | |
8440 | alc882_gpio_mute(codec, 0, 0); | |
8441 | alc882_gpio_mute(codec, 1, 0); | |
8442 | } | |
8443 | ||
8444 | /* set up GPIO and update auto-muting at initialization */ | |
8445 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
8446 | { | |
8447 | alc885_macpro_init_hook(codec); | |
4f5d1706 | 8448 | alc_automute_amp(codec); |
7debbe51 TI |
8449 | } |
8450 | ||
df694daa KY |
8451 | /* |
8452 | * generic initialization of ADC, input mixers and output mixers | |
8453 | */ | |
4953550a | 8454 | static struct hda_verb alc883_auto_init_verbs[] = { |
df694daa KY |
8455 | /* |
8456 | * Unmute ADC0-2 and set the default input to mic-in | |
8457 | */ | |
4953550a TI |
8458 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8459 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8460 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8461 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17bba1b7 | 8462 | |
4953550a TI |
8463 | /* |
8464 | * Set up output mixers (0x0c - 0x0f) | |
8465 | */ | |
8466 | /* set vol=0 to output mixers */ | |
8467 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8468 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8470 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8471 | /* set up input amps for analog loopback */ | |
8472 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
8473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8474 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8475 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8476 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8477 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8478 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8479 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8480 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8481 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8482 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9c7f852e | 8483 | |
4953550a TI |
8484 | /* FIXME: use matrix-type input source selection */ |
8485 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8486 | /* Input mixer2 */ | |
88102f3f | 8487 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4953550a | 8488 | /* Input mixer3 */ |
88102f3f | 8489 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4953550a | 8490 | { } |
9c7f852e TI |
8491 | }; |
8492 | ||
eb4c41d3 TS |
8493 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
8494 | static struct hda_verb alc889A_mb31_ch2_init[] = { | |
8495 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8496 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8497 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8498 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8499 | { } /* end */ | |
8500 | }; | |
8501 | ||
8502 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ | |
8503 | static struct hda_verb alc889A_mb31_ch4_init[] = { | |
8504 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8505 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8506 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8507 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8508 | { } /* end */ | |
8509 | }; | |
8510 | ||
8511 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ | |
8512 | static struct hda_verb alc889A_mb31_ch5_init[] = { | |
8513 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ | |
8514 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8515 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8516 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8517 | { } /* end */ | |
8518 | }; | |
8519 | ||
8520 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ | |
8521 | static struct hda_verb alc889A_mb31_ch6_init[] = { | |
8522 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ | |
8523 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ | |
8524 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8525 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8526 | { } /* end */ | |
8527 | }; | |
8528 | ||
8529 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { | |
8530 | { 2, alc889A_mb31_ch2_init }, | |
8531 | { 4, alc889A_mb31_ch4_init }, | |
8532 | { 5, alc889A_mb31_ch5_init }, | |
8533 | { 6, alc889A_mb31_ch6_init }, | |
8534 | }; | |
8535 | ||
b373bdeb AN |
8536 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
8537 | /* eanable EAPD on medion laptop */ | |
8538 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
8539 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
8540 | { } | |
8541 | }; | |
8542 | ||
4953550a | 8543 | #define alc883_base_mixer alc882_base_mixer |
834be88d | 8544 | |
a8848bd6 AS |
8545 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
8546 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8547 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8548 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8549 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8550 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8551 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8552 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8553 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8554 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8555 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8556 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8557 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8558 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
a8848bd6 AS |
8559 | { } /* end */ |
8560 | }; | |
8561 | ||
0c4cc443 | 8562 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
368c7a95 J |
8563 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8564 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8565 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8566 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8567 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8568 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8569 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8570 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8571 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8572 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
368c7a95 J |
8573 | { } /* end */ |
8574 | }; | |
8575 | ||
fb97dc67 J |
8576 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
8577 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8578 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8579 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8580 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8581 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8582 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8583 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8584 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8585 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8586 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
fb97dc67 J |
8587 | { } /* end */ |
8588 | }; | |
8589 | ||
9c7f852e TI |
8590 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
8591 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8592 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8593 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8594 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8595 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8596 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8597 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8598 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8599 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8600 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8601 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8602 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8603 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
9c7f852e TI |
8604 | { } /* end */ |
8605 | }; | |
df694daa | 8606 | |
9c7f852e TI |
8607 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
8608 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8609 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8610 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8611 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8612 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8613 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8614 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8615 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8616 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8617 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8618 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8619 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8620 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8621 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8622 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8623 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8624 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8625 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8626 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
9c7f852e TI |
8627 | { } /* end */ |
8628 | }; | |
8629 | ||
17bba1b7 J |
8630 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
8631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8632 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8633 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8634 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8635 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8636 | HDA_OUTPUT), | |
8637 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8638 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8639 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8640 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8641 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8642 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8643 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8644 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8645 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8646 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
8647 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8648 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8649 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8650 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17bba1b7 J |
8651 | { } /* end */ |
8652 | }; | |
8653 | ||
87a8c370 JK |
8654 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
8655 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8656 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8657 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8658 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8659 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8660 | HDA_OUTPUT), | |
8661 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8662 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8663 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8664 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8665 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | |
8666 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8667 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8668 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
8670 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), | |
8671 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
8672 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8673 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8674 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8675 | { } /* end */ | |
8676 | }; | |
8677 | ||
d1d985f0 | 8678 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
c07584c8 | 8679 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
0701e064 | 8680 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
c07584c8 | 8681 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
0701e064 | 8682 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
c07584c8 TD |
8683 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
8684 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
0701e064 TI |
8685 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
8686 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
c07584c8 TD |
8687 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8688 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8689 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8690 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8691 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8692 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8693 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c07584c8 TD |
8694 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8695 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8696 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
c07584c8 | 8697 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
c07584c8 TD |
8698 | { } /* end */ |
8699 | }; | |
8700 | ||
c259249f | 8701 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
ccc656ce | 8702 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
b99dba34 | 8703 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
ccc656ce | 8704 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
b99dba34 | 8705 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
ccc656ce KY |
8706 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
8707 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8708 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8709 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8710 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8711 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8712 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8713 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8714 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8715 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8716 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8717 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 8718 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
ccc656ce | 8719 | { } /* end */ |
f12ab1e0 | 8720 | }; |
ccc656ce | 8721 | |
c259249f | 8722 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
ccc656ce | 8723 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
b99dba34 | 8724 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
ccc656ce | 8725 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
b99dba34 | 8726 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
ccc656ce KY |
8727 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
8728 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8729 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8730 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 8731 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
4383fae0 J |
8732 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
8733 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8734 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce | 8735 | { } /* end */ |
f12ab1e0 | 8736 | }; |
ccc656ce | 8737 | |
b99dba34 TI |
8738 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
8739 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8740 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
8741 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8742 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8743 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8744 | { } /* end */ | |
8745 | }; | |
8746 | ||
bc9f98a9 KY |
8747 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
8748 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8749 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
86cd9298 TI |
8750 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
8751 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
bc9f98a9 KY |
8752 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8753 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8754 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8755 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 | 8756 | { } /* end */ |
f12ab1e0 | 8757 | }; |
bc9f98a9 | 8758 | |
272a527c KY |
8759 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
8760 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8761 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
8762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8763 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8764 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8765 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8766 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
150b432f DH |
8767 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
8768 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
272a527c KY |
8769 | { } /* end */ |
8770 | }; | |
8771 | ||
8772 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |
8773 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8774 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8775 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8776 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8777 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8778 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8779 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8780 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8781 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
272a527c | 8782 | { } /* end */ |
ea1fb29a | 8783 | }; |
272a527c | 8784 | |
7ad7b218 MC |
8785 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
8786 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8787 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8788 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8789 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | |
8790 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | |
8791 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | |
8792 | { } /* end */ | |
8793 | }; | |
8794 | ||
8795 | static struct hda_verb alc883_medion_wim2160_verbs[] = { | |
8796 | /* Unmute front mixer */ | |
8797 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8798 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8799 | ||
8800 | /* Set speaker pin to front mixer */ | |
8801 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8802 | ||
8803 | /* Init headphone pin */ | |
8804 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8806 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8807 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8808 | ||
8809 | { } /* end */ | |
8810 | }; | |
8811 | ||
8812 | /* toggle speaker-output according to the hp-jack state */ | |
8813 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | |
8814 | { | |
8815 | struct alc_spec *spec = codec->spec; | |
8816 | ||
8817 | spec->autocfg.hp_pins[0] = 0x1a; | |
8818 | spec->autocfg.speaker_pins[0] = 0x15; | |
8819 | } | |
8820 | ||
2880a867 | 8821 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
d1a991a6 KY |
8822 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8823 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2880a867 | 8824 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
2880a867 TD |
8825 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8826 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d1a991a6 KY |
8827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
8828 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8829 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2880a867 | 8830 | { } /* end */ |
d1a991a6 | 8831 | }; |
2880a867 | 8832 | |
d2fd4b09 TV |
8833 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
8834 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
d2fd4b09 | 8835 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
684a8842 TV |
8836 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8837 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d2fd4b09 TV |
8838 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
8839 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8840 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8843 | { } /* end */ | |
8844 | }; | |
8845 | ||
e2757d5e KY |
8846 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
8847 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8848 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8849 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
8850 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | |
8851 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | |
8852 | 0x0d, 1, 0x0, HDA_OUTPUT), | |
8853 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
8854 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
8855 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
8856 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8857 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
e2757d5e KY |
8858 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
8859 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8860 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8861 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8862 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8863 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8864 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8865 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8866 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8867 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e2757d5e KY |
8868 | { } /* end */ |
8869 | }; | |
8870 | ||
eb4c41d3 TS |
8871 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
8872 | /* Output mixers */ | |
8873 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8874 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
8875 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
8876 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
8877 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, | |
8878 | HDA_OUTPUT), | |
8879 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), | |
8880 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), | |
8881 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), | |
8882 | /* Output switches */ | |
8883 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), | |
8884 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), | |
8885 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), | |
8886 | /* Boost mixers */ | |
8887 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | |
8888 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | |
8889 | /* Input mixers */ | |
8890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
8891 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
8892 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8893 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8894 | { } /* end */ | |
8895 | }; | |
8896 | ||
3e1647c5 GG |
8897 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
8898 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8899 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8900 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8901 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8902 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
8903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8904 | { } /* end */ | |
8905 | }; | |
8906 | ||
e2757d5e KY |
8907 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
8908 | .ops = &snd_hda_bind_vol, | |
8909 | .values = { | |
8910 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
8911 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
8912 | 0 | |
8913 | }, | |
8914 | }; | |
8915 | ||
8916 | static struct hda_bind_ctls alc883_bind_cap_switch = { | |
8917 | .ops = &snd_hda_bind_sw, | |
8918 | .values = { | |
8919 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
8920 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
8921 | 0 | |
8922 | }, | |
8923 | }; | |
8924 | ||
8925 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | |
8926 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8927 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8928 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8929 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8930 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8931 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4953550a TI |
8932 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
8933 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8934 | { } /* end */ | |
8935 | }; | |
df694daa | 8936 | |
4953550a TI |
8937 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
8938 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | |
8939 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | |
8940 | { | |
8941 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8942 | /* .name = "Capture Source", */ | |
8943 | .name = "Input Source", | |
8944 | .count = 1, | |
8945 | .info = alc_mux_enum_info, | |
8946 | .get = alc_mux_enum_get, | |
8947 | .put = alc_mux_enum_put, | |
8948 | }, | |
8949 | { } /* end */ | |
8950 | }; | |
9c7f852e | 8951 | |
4953550a TI |
8952 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
8953 | { | |
8954 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8955 | .name = "Channel Mode", | |
8956 | .info = alc_ch_mode_info, | |
8957 | .get = alc_ch_mode_get, | |
8958 | .put = alc_ch_mode_put, | |
8959 | }, | |
8960 | { } /* end */ | |
9c7f852e TI |
8961 | }; |
8962 | ||
a8848bd6 | 8963 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 8964 | static void alc883_mitac_setup(struct hda_codec *codec) |
a8848bd6 | 8965 | { |
a9fd4f3f | 8966 | struct alc_spec *spec = codec->spec; |
a8848bd6 | 8967 | |
a9fd4f3f TI |
8968 | spec->autocfg.hp_pins[0] = 0x15; |
8969 | spec->autocfg.speaker_pins[0] = 0x14; | |
8970 | spec->autocfg.speaker_pins[1] = 0x17; | |
a8848bd6 AS |
8971 | } |
8972 | ||
8973 | /* auto-toggle front mic */ | |
8974 | /* | |
8975 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | |
8976 | { | |
864f92be | 8977 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; |
a8848bd6 | 8978 | |
a8848bd6 AS |
8979 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
8980 | } | |
8981 | */ | |
8982 | ||
a8848bd6 AS |
8983 | static struct hda_verb alc883_mitac_verbs[] = { |
8984 | /* HP */ | |
8985 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8986 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8987 | /* Subwoofer */ | |
8988 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8989 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8990 | ||
8991 | /* enable unsolicited event */ | |
8992 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8993 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
8994 | ||
8995 | { } /* end */ | |
8996 | }; | |
8997 | ||
a65cc60f | 8998 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
8999 | /* HP */ | |
9000 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9001 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9002 | /* Int speaker */ | |
9003 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | |
9004 | ||
9005 | /* enable unsolicited event */ | |
9006 | /* | |
9007 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9008 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9009 | */ | |
9010 | ||
9011 | { } /* end */ | |
9012 | }; | |
9013 | ||
0c4cc443 | 9014 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
368c7a95 J |
9015 | /* HP */ |
9016 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9017 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9018 | /* Int speaker */ | |
9019 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9020 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9021 | ||
9022 | /* enable unsolicited event */ | |
9023 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
0c4cc443 | 9024 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
368c7a95 J |
9025 | |
9026 | { } /* end */ | |
9027 | }; | |
9028 | ||
fb97dc67 J |
9029 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
9030 | /* HP */ | |
9031 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9032 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9033 | /* Subwoofer */ | |
9034 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9035 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9036 | ||
9037 | /* enable unsolicited event */ | |
9038 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9039 | ||
9040 | { } /* end */ | |
9041 | }; | |
9042 | ||
c259249f | 9043 | static struct hda_verb alc883_targa_verbs[] = { |
ccc656ce KY |
9044 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
9045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9046 | ||
9047 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9048 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 9049 | |
64a8be74 DH |
9050 | /* Connect Line-Out side jack (SPDIF) to Side */ |
9051 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9052 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9053 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
9054 | /* Connect Mic jack to CLFE */ | |
9055 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9056 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9057 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9058 | /* Connect Line-in jack to Surround */ | |
9059 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9060 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9061 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9062 | /* Connect HP out jack to Front */ | |
9063 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9064 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9065 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
ccc656ce KY |
9066 | |
9067 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
ccc656ce KY |
9068 | |
9069 | { } /* end */ | |
9070 | }; | |
9071 | ||
bc9f98a9 KY |
9072 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
9073 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9074 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
9075 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
9076 | { } /* end */ | |
9077 | }; | |
9078 | ||
272a527c KY |
9079 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
9080 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9081 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9082 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9083 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9084 | { } /* end */ | |
9085 | }; | |
9086 | ||
9087 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
9088 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9090 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9091 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
9092 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9093 | { } /* end */ | |
9094 | }; | |
9095 | ||
189609ae KY |
9096 | static struct hda_verb alc883_haier_w66_verbs[] = { |
9097 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9098 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9099 | ||
9100 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9101 | ||
9102 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9103 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9104 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9105 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9106 | { } /* end */ | |
9107 | }; | |
9108 | ||
e2757d5e KY |
9109 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
9110 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9111 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9112 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9113 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9114 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9115 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9116 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9117 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9118 | { } /* end */ | |
9119 | }; | |
9120 | ||
8718b700 HRK |
9121 | static struct hda_verb alc888_6st_dell_verbs[] = { |
9122 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9123 | { } | |
9124 | }; | |
9125 | ||
3e1647c5 GG |
9126 | static struct hda_verb alc883_vaiott_verbs[] = { |
9127 | /* HP */ | |
9128 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9129 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9130 | ||
9131 | /* enable unsolicited event */ | |
9132 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9133 | ||
9134 | { } /* end */ | |
9135 | }; | |
9136 | ||
4f5d1706 | 9137 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
8718b700 | 9138 | { |
a9fd4f3f | 9139 | struct alc_spec *spec = codec->spec; |
8718b700 | 9140 | |
a9fd4f3f TI |
9141 | spec->autocfg.hp_pins[0] = 0x1b; |
9142 | spec->autocfg.speaker_pins[0] = 0x14; | |
9143 | spec->autocfg.speaker_pins[1] = 0x16; | |
9144 | spec->autocfg.speaker_pins[2] = 0x18; | |
8718b700 HRK |
9145 | } |
9146 | ||
4723c022 | 9147 | static struct hda_verb alc888_3st_hp_verbs[] = { |
8341de60 | 9148 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
f32a19e3 HRK |
9149 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
9150 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
5795b9e6 | 9151 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
8718b700 | 9152 | { } /* end */ |
5795b9e6 CM |
9153 | }; |
9154 | ||
3ea0d7cf HRK |
9155 | /* |
9156 | * 2ch mode | |
9157 | */ | |
4723c022 | 9158 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
8341de60 CM |
9159 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
9160 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9161 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
9162 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
3ea0d7cf | 9163 | { } /* end */ |
8341de60 CM |
9164 | }; |
9165 | ||
3ea0d7cf HRK |
9166 | /* |
9167 | * 4ch mode | |
9168 | */ | |
9169 | static struct hda_verb alc888_3st_hp_4ch_init[] = { | |
9170 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
9171 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9172 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9173 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9174 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
9175 | { } /* end */ | |
9176 | }; | |
9177 | ||
9178 | /* | |
9179 | * 6ch mode | |
9180 | */ | |
4723c022 | 9181 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
8341de60 CM |
9182 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
9183 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
3ea0d7cf | 9184 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
8341de60 CM |
9185 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
9186 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
3ea0d7cf HRK |
9187 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
9188 | { } /* end */ | |
8341de60 CM |
9189 | }; |
9190 | ||
3ea0d7cf | 9191 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
4723c022 | 9192 | { 2, alc888_3st_hp_2ch_init }, |
3ea0d7cf | 9193 | { 4, alc888_3st_hp_4ch_init }, |
4723c022 | 9194 | { 6, alc888_3st_hp_6ch_init }, |
8341de60 CM |
9195 | }; |
9196 | ||
272a527c KY |
9197 | /* toggle front-jack and RCA according to the hp-jack state */ |
9198 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
9199 | { | |
864f92be | 9200 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
ea1fb29a | 9201 | |
47fd830a TI |
9202 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9203 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9204 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9205 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
9206 | } |
9207 | ||
9208 | /* toggle RCA according to the front-jack state */ | |
9209 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
9210 | { | |
864f92be | 9211 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
ea1fb29a | 9212 | |
47fd830a TI |
9213 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9214 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c | 9215 | } |
47fd830a | 9216 | |
272a527c KY |
9217 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
9218 | unsigned int res) | |
9219 | { | |
9220 | if ((res >> 26) == ALC880_HP_EVENT) | |
9221 | alc888_lenovo_ms7195_front_automute(codec); | |
9222 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9223 | alc888_lenovo_ms7195_rca_automute(codec); | |
9224 | } | |
9225 | ||
9226 | static struct hda_verb alc883_medion_md2_verbs[] = { | |
9227 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9228 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9229 | ||
9230 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9231 | ||
9232 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9233 | { } /* end */ | |
9234 | }; | |
9235 | ||
9236 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 9237 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
272a527c | 9238 | { |
a9fd4f3f | 9239 | struct alc_spec *spec = codec->spec; |
272a527c | 9240 | |
a9fd4f3f TI |
9241 | spec->autocfg.hp_pins[0] = 0x14; |
9242 | spec->autocfg.speaker_pins[0] = 0x15; | |
272a527c KY |
9243 | } |
9244 | ||
ccc656ce | 9245 | /* toggle speaker-output according to the hp-jack state */ |
c259249f SA |
9246 | #define alc883_targa_init_hook alc882_targa_init_hook |
9247 | #define alc883_targa_unsol_event alc882_targa_unsol_event | |
368c7a95 | 9248 | |
0c4cc443 HRK |
9249 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
9250 | { | |
9251 | unsigned int present; | |
9252 | ||
d56757ab | 9253 | present = snd_hda_jack_detect(codec, 0x18); |
0c4cc443 HRK |
9254 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
9255 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9256 | } | |
9257 | ||
4f5d1706 | 9258 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
0c4cc443 | 9259 | { |
a9fd4f3f TI |
9260 | struct alc_spec *spec = codec->spec; |
9261 | ||
9262 | spec->autocfg.hp_pins[0] = 0x15; | |
9263 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
9264 | } |
9265 | ||
9266 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | |
9267 | { | |
a9fd4f3f | 9268 | alc_automute_amp(codec); |
0c4cc443 HRK |
9269 | alc883_clevo_m720_mic_automute(codec); |
9270 | } | |
9271 | ||
9272 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
368c7a95 J |
9273 | unsigned int res) |
9274 | { | |
0c4cc443 | 9275 | switch (res >> 26) { |
0c4cc443 HRK |
9276 | case ALC880_MIC_EVENT: |
9277 | alc883_clevo_m720_mic_automute(codec); | |
9278 | break; | |
a9fd4f3f TI |
9279 | default: |
9280 | alc_automute_amp_unsol_event(codec, res); | |
9281 | break; | |
0c4cc443 | 9282 | } |
368c7a95 J |
9283 | } |
9284 | ||
fb97dc67 | 9285 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 9286 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
fb97dc67 | 9287 | { |
a9fd4f3f | 9288 | struct alc_spec *spec = codec->spec; |
fb97dc67 | 9289 | |
a9fd4f3f TI |
9290 | spec->autocfg.hp_pins[0] = 0x14; |
9291 | spec->autocfg.speaker_pins[0] = 0x15; | |
fb97dc67 J |
9292 | } |
9293 | ||
4f5d1706 | 9294 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
fb97dc67 | 9295 | { |
a9fd4f3f | 9296 | struct alc_spec *spec = codec->spec; |
189609ae | 9297 | |
a9fd4f3f TI |
9298 | spec->autocfg.hp_pins[0] = 0x1b; |
9299 | spec->autocfg.speaker_pins[0] = 0x14; | |
189609ae KY |
9300 | } |
9301 | ||
bc9f98a9 KY |
9302 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
9303 | { | |
864f92be | 9304 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
bc9f98a9 | 9305 | |
47fd830a TI |
9306 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9307 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
9308 | } |
9309 | ||
9310 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
9311 | { | |
864f92be | 9312 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
bc9f98a9 | 9313 | |
47fd830a TI |
9314 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9315 | HDA_AMP_MUTE, bits); | |
9316 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9317 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
9318 | } |
9319 | ||
9320 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
9321 | unsigned int res) | |
9322 | { | |
9323 | if ((res >> 26) == ALC880_HP_EVENT) | |
9324 | alc883_lenovo_101e_all_automute(codec); | |
9325 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9326 | alc883_lenovo_101e_ispeaker_automute(codec); | |
9327 | } | |
9328 | ||
676a9b53 | 9329 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 9330 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
676a9b53 | 9331 | { |
a9fd4f3f | 9332 | struct alc_spec *spec = codec->spec; |
676a9b53 | 9333 | |
a9fd4f3f TI |
9334 | spec->autocfg.hp_pins[0] = 0x14; |
9335 | spec->autocfg.speaker_pins[0] = 0x15; | |
9336 | spec->autocfg.speaker_pins[1] = 0x16; | |
676a9b53 TI |
9337 | } |
9338 | ||
d1a991a6 KY |
9339 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
9340 | /* HP Pin: output 0 (0x0c) */ | |
9341 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9342 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9343 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9344 | /* Front Pin: output 0 (0x0c) */ | |
676a9b53 TI |
9345 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
9346 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1a991a6 | 9347 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
d1a991a6 KY |
9348 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9349 | /* eanable EAPD on medion laptop */ | |
9350 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9351 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
676a9b53 TI |
9352 | /* enable unsolicited event */ |
9353 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
d1a991a6 KY |
9354 | { } |
9355 | }; | |
9356 | ||
fc86f954 DK |
9357 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
9358 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9359 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9360 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9361 | { } /* end */ | |
9362 | }; | |
9363 | ||
4f5d1706 | 9364 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
5795b9e6 | 9365 | { |
a9fd4f3f | 9366 | struct alc_spec *spec = codec->spec; |
5795b9e6 | 9367 | |
a9fd4f3f TI |
9368 | spec->autocfg.hp_pins[0] = 0x1b; |
9369 | spec->autocfg.speaker_pins[0] = 0x14; | |
9370 | spec->autocfg.speaker_pins[1] = 0x15; | |
9371 | spec->autocfg.speaker_pins[2] = 0x16; | |
9372 | spec->autocfg.speaker_pins[3] = 0x17; | |
5795b9e6 CM |
9373 | } |
9374 | ||
4f5d1706 | 9375 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
e2757d5e | 9376 | { |
a9fd4f3f | 9377 | struct alc_spec *spec = codec->spec; |
e2757d5e | 9378 | |
a9fd4f3f TI |
9379 | spec->autocfg.hp_pins[0] = 0x1b; |
9380 | spec->autocfg.speaker_pins[0] = 0x14; | |
9381 | spec->autocfg.speaker_pins[1] = 0x15; | |
9382 | spec->autocfg.speaker_pins[2] = 0x16; | |
9383 | spec->autocfg.speaker_pins[3] = 0x17; | |
9384 | spec->autocfg.speaker_pins[4] = 0x1a; | |
e2757d5e KY |
9385 | } |
9386 | ||
4f5d1706 | 9387 | static void alc883_vaiott_setup(struct hda_codec *codec) |
3e1647c5 GG |
9388 | { |
9389 | struct alc_spec *spec = codec->spec; | |
9390 | ||
9391 | spec->autocfg.hp_pins[0] = 0x15; | |
9392 | spec->autocfg.speaker_pins[0] = 0x14; | |
9393 | spec->autocfg.speaker_pins[1] = 0x17; | |
3e1647c5 GG |
9394 | } |
9395 | ||
e2757d5e KY |
9396 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
9397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9398 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9399 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9400 | /* enable unsolicited event */ | |
9401 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9402 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9403 | { } /* end */ | |
9404 | }; | |
9405 | ||
4f5d1706 | 9406 | static void alc883_mode2_setup(struct hda_codec *codec) |
e2757d5e | 9407 | { |
a9fd4f3f | 9408 | struct alc_spec *spec = codec->spec; |
e2757d5e | 9409 | |
a9fd4f3f TI |
9410 | spec->autocfg.hp_pins[0] = 0x1b; |
9411 | spec->autocfg.speaker_pins[0] = 0x14; | |
9412 | spec->autocfg.speaker_pins[1] = 0x15; | |
9413 | spec->autocfg.speaker_pins[2] = 0x16; | |
4f5d1706 TI |
9414 | spec->ext_mic.pin = 0x18; |
9415 | spec->int_mic.pin = 0x19; | |
9416 | spec->ext_mic.mux_idx = 0; | |
9417 | spec->int_mic.mux_idx = 1; | |
9418 | spec->auto_mic = 1; | |
e2757d5e KY |
9419 | } |
9420 | ||
9421 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | |
9422 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9423 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9424 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9425 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9426 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9427 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
9428 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | |
9429 | /* enable unsolicited event */ | |
9430 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9431 | { } /* end */ | |
9432 | }; | |
9433 | ||
e2757d5e KY |
9434 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
9435 | { | |
a9fd4f3f TI |
9436 | struct alc_spec *spec = codec->spec; |
9437 | ||
9438 | spec->autocfg.hp_pins[0] = 0x14; | |
9439 | spec->autocfg.speaker_pins[0] = 0x1b; | |
9440 | alc_automute_pin(codec); | |
e2757d5e KY |
9441 | } |
9442 | ||
eb4c41d3 TS |
9443 | static struct hda_verb alc889A_mb31_verbs[] = { |
9444 | /* Init rear pin (used as headphone output) */ | |
9445 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ | |
9446 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ | |
9447 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9448 | /* Init line pin (used as output in 4ch and 6ch mode) */ | |
9449 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ | |
9450 | /* Init line 2 pin (used as headphone out by default) */ | |
9451 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ | |
9452 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ | |
9453 | { } /* end */ | |
9454 | }; | |
9455 | ||
9456 | /* Mute speakers according to the headphone jack state */ | |
9457 | static void alc889A_mb31_automute(struct hda_codec *codec) | |
9458 | { | |
9459 | unsigned int present; | |
9460 | ||
9461 | /* Mute only in 2ch or 4ch mode */ | |
9462 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) | |
9463 | == 0x00) { | |
864f92be | 9464 | present = snd_hda_jack_detect(codec, 0x15); |
eb4c41d3 TS |
9465 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9466 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9467 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9468 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9469 | } | |
9470 | } | |
9471 | ||
9472 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |
9473 | { | |
9474 | if ((res >> 26) == ALC880_HP_EVENT) | |
9475 | alc889A_mb31_automute(codec); | |
9476 | } | |
9477 | ||
4953550a | 9478 | |
cb53c626 | 9479 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4953550a | 9480 | #define alc882_loopbacks alc880_loopbacks |
cb53c626 TI |
9481 | #endif |
9482 | ||
def319f9 | 9483 | /* pcm configuration: identical with ALC880 */ |
4953550a TI |
9484 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
9485 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
9486 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
9487 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
9488 | ||
9489 | static hda_nid_t alc883_slave_dig_outs[] = { | |
9490 | ALC1200_DIGOUT_NID, 0, | |
9491 | }; | |
9492 | ||
9493 | static hda_nid_t alc1200_slave_dig_outs[] = { | |
9494 | ALC883_DIGOUT_NID, 0, | |
9495 | }; | |
9c7f852e TI |
9496 | |
9497 | /* | |
9498 | * configuration and preset | |
9499 | */ | |
4953550a TI |
9500 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
9501 | [ALC882_3ST_DIG] = "3stack-dig", | |
9502 | [ALC882_6ST_DIG] = "6stack-dig", | |
9503 | [ALC882_ARIMA] = "arima", | |
9504 | [ALC882_W2JC] = "w2jc", | |
9505 | [ALC882_TARGA] = "targa", | |
9506 | [ALC882_ASUS_A7J] = "asus-a7j", | |
9507 | [ALC882_ASUS_A7M] = "asus-a7m", | |
9508 | [ALC885_MACPRO] = "macpro", | |
9509 | [ALC885_MB5] = "mb5", | |
e458b1fa | 9510 | [ALC885_MACMINI3] = "macmini3", |
76e6f5a9 | 9511 | [ALC885_MBA21] = "mba21", |
4953550a TI |
9512 | [ALC885_MBP3] = "mbp3", |
9513 | [ALC885_IMAC24] = "imac24", | |
4b7e1803 | 9514 | [ALC885_IMAC91] = "imac91", |
4953550a | 9515 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
f5fcc13c TI |
9516 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
9517 | [ALC883_3ST_6ch] = "3stack-6ch", | |
4953550a | 9518 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
f5fcc13c TI |
9519 | [ALC883_TARGA_DIG] = "targa-dig", |
9520 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
64a8be74 | 9521 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
f5fcc13c | 9522 | [ALC883_ACER] = "acer", |
2880a867 | 9523 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
5b2d1eca | 9524 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
b1a91469 | 9525 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
3b315d70 | 9526 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
fc86f954 | 9527 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
f5fcc13c | 9528 | [ALC883_MEDION] = "medion", |
272a527c | 9529 | [ALC883_MEDION_MD2] = "medion-md2", |
7ad7b218 | 9530 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
f5fcc13c | 9531 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
bc9f98a9 | 9532 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
272a527c KY |
9533 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
9534 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
e2757d5e | 9535 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
189609ae | 9536 | [ALC883_HAIER_W66] = "haier-w66", |
4723c022 | 9537 | [ALC888_3ST_HP] = "3stack-hp", |
5795b9e6 | 9538 | [ALC888_6ST_DELL] = "6stack-dell", |
a8848bd6 | 9539 | [ALC883_MITAC] = "mitac", |
a65cc60f | 9540 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
0c4cc443 | 9541 | [ALC883_CLEVO_M720] = "clevo-m720", |
fb97dc67 | 9542 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
ef8ef5fb | 9543 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
17bba1b7 | 9544 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
87a8c370 JK |
9545 | [ALC889A_INTEL] = "intel-alc889a", |
9546 | [ALC889_INTEL] = "intel-x58", | |
3ab90935 | 9547 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
eb4c41d3 | 9548 | [ALC889A_MB31] = "mb31", |
3e1647c5 | 9549 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
4953550a | 9550 | [ALC882_AUTO] = "auto", |
f5fcc13c TI |
9551 | }; |
9552 | ||
4953550a TI |
9553 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
9554 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
9555 | ||
ac3e3741 | 9556 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
69e50282 | 9557 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
9b6682ff | 9558 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
ac3e3741 TI |
9559 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
9560 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
0b18cb18 | 9561 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
5b2d1eca VP |
9562 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
9563 | ALC888_ACER_ASPIRE_4930G), | |
a8e4f9dd | 9564 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
83dd7408 | 9565 | ALC888_ACER_ASPIRE_4930G), |
3b315d70 HM |
9566 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
9567 | ALC888_ACER_ASPIRE_8930G), | |
e46b0c8c TI |
9568 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
9569 | ALC888_ACER_ASPIRE_8930G), | |
4953550a TI |
9570 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
9571 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), | |
a8e4f9dd | 9572 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
dde65356 | 9573 | ALC888_ACER_ASPIRE_6530G), |
cc374c47 | 9574 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
d2fd4b09 | 9575 | ALC888_ACER_ASPIRE_6530G), |
fc86f954 DK |
9576 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
9577 | ALC888_ACER_ASPIRE_7730G), | |
22b530e0 TI |
9578 | /* default Acer -- disabled as it causes more problems. |
9579 | * model=auto should work fine now | |
9580 | */ | |
9581 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | |
4953550a | 9582 | |
5795b9e6 | 9583 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
4953550a | 9584 | |
febe3375 | 9585 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
ac3e3741 TI |
9586 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
9587 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
5d85f8d0 | 9588 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
06bf3e15 | 9589 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
7ec30f0e | 9590 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
4953550a TI |
9591 | |
9592 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | |
9593 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | |
9594 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | |
a01c30cb | 9595 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
4953550a TI |
9596 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
9597 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | |
9598 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | |
ac3e3741 | 9599 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
44a678d0 | 9600 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
3ab90935 | 9601 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
e2757d5e | 9602 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
4953550a TI |
9603 | |
9604 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | |
97ec710c | 9605 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
4953550a | 9606 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
2de686d2 | 9607 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
ac3e3741 TI |
9608 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
9609 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
e2757d5e | 9610 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
ac3e3741 | 9611 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
4953550a TI |
9612 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
9613 | ||
6f3bf657 | 9614 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
bba8dee7 | 9615 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 9616 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
4953550a | 9617 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
2fef62c8 | 9618 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
4953550a | 9619 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
dd146a60 | 9620 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
82808236 | 9621 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
f5fcc13c | 9622 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 9623 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
9624 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
9625 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 | 9626 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
64ca1c29 | 9627 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
b1e4422f | 9628 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
9629 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
9630 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
9631 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
b43f6e5e | 9632 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
64a8be74 | 9633 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
ac3e3741 TI |
9634 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
9635 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
9636 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
ee09543c | 9637 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
86d34b7e | 9638 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
ac3e3741 TI |
9639 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
9640 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
df01b8af | 9641 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
b43f6e5e | 9642 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
f5fcc13c | 9643 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
b1e4422f | 9644 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
4953550a | 9645 | |
ac3e3741 | 9646 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
d1501ea8 | 9647 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), |
0c4cc443 HRK |
9648 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
9649 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
a65cc60f | 9650 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
dea0a509 | 9651 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
e60623b4 | 9652 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
4953550a | 9653 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
f5fcc13c | 9654 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
bfb53037 | 9655 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
f67d8176 | 9656 | ALC883_FUJITSU_PI2515), |
bfb53037 | 9657 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
ef8ef5fb | 9658 | ALC888_FUJITSU_XA3530), |
272a527c | 9659 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
272a527c | 9660 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
ac3e3741 TI |
9661 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
9662 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
e2757d5e | 9663 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
272a527c | 9664 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
959973b9 | 9665 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
0b167bf4 | 9666 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
189609ae | 9667 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
4953550a | 9668 | |
17bba1b7 J |
9669 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
9670 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
2de686d2 | 9671 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
87a8c370 JK |
9672 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
9673 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | |
9674 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | |
572c0e3c | 9675 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
9c7f852e | 9676 | |
4953550a | 9677 | {} |
f3cd3f5d WF |
9678 | }; |
9679 | ||
4953550a TI |
9680 | /* codec SSID table for Intel Mac */ |
9681 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |
9682 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | |
9683 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | |
9684 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | |
9685 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | |
9686 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | |
9687 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | |
9688 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | |
26fd74fc | 9689 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
ab669967 | 9690 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), |
f53dae28 | 9691 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
6e12970b | 9692 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
4953550a TI |
9693 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
9694 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | |
9695 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | |
4b7e1803 | 9696 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
4953550a | 9697 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
3bfea98f | 9698 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
46ef6ec9 DC |
9699 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
9700 | * so apparently no perfect solution yet | |
4953550a TI |
9701 | */ |
9702 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | |
46ef6ec9 | 9703 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
e458b1fa | 9704 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
4953550a | 9705 | {} /* terminator */ |
b25c9da1 WF |
9706 | }; |
9707 | ||
4953550a TI |
9708 | static struct alc_config_preset alc882_presets[] = { |
9709 | [ALC882_3ST_DIG] = { | |
9710 | .mixers = { alc882_base_mixer }, | |
8ab9e0af TI |
9711 | .init_verbs = { alc882_base_init_verbs, |
9712 | alc882_adc1_init_verbs }, | |
4953550a TI |
9713 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9714 | .dac_nids = alc882_dac_nids, | |
9715 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9716 | .dig_in_nid = ALC882_DIGIN_NID, | |
9717 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9718 | .channel_mode = alc882_ch_modes, | |
9719 | .need_dac_fix = 1, | |
9720 | .input_mux = &alc882_capture_source, | |
9721 | }, | |
9722 | [ALC882_6ST_DIG] = { | |
9723 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9724 | .init_verbs = { alc882_base_init_verbs, |
9725 | alc882_adc1_init_verbs }, | |
4953550a TI |
9726 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9727 | .dac_nids = alc882_dac_nids, | |
9728 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9729 | .dig_in_nid = ALC882_DIGIN_NID, | |
9730 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9731 | .channel_mode = alc882_sixstack_modes, | |
9732 | .input_mux = &alc882_capture_source, | |
9733 | }, | |
9734 | [ALC882_ARIMA] = { | |
9735 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9736 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
9737 | alc882_eapd_verbs }, | |
4953550a TI |
9738 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9739 | .dac_nids = alc882_dac_nids, | |
9740 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9741 | .channel_mode = alc882_sixstack_modes, | |
9742 | .input_mux = &alc882_capture_source, | |
9743 | }, | |
9744 | [ALC882_W2JC] = { | |
9745 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9746 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
9747 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | |
4953550a TI |
9748 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9749 | .dac_nids = alc882_dac_nids, | |
9750 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
9751 | .channel_mode = alc880_threestack_modes, | |
9752 | .need_dac_fix = 1, | |
9753 | .input_mux = &alc882_capture_source, | |
9754 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9755 | }, | |
76e6f5a9 RH |
9756 | [ALC885_MBA21] = { |
9757 | .mixers = { alc885_mba21_mixer }, | |
9758 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, | |
9759 | .num_dacs = 2, | |
9760 | .dac_nids = alc882_dac_nids, | |
9761 | .channel_mode = alc885_mba21_ch_modes, | |
9762 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
9763 | .input_mux = &alc882_capture_source, | |
9764 | .unsol_event = alc_automute_amp_unsol_event, | |
9765 | .setup = alc885_mba21_setup, | |
9766 | .init_hook = alc_automute_amp, | |
9767 | }, | |
4953550a TI |
9768 | [ALC885_MBP3] = { |
9769 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
9770 | .init_verbs = { alc885_mbp3_init_verbs, | |
9771 | alc880_gpio1_init_verbs }, | |
be0ae923 | 9772 | .num_dacs = 2, |
4953550a | 9773 | .dac_nids = alc882_dac_nids, |
be0ae923 TI |
9774 | .hp_nid = 0x04, |
9775 | .channel_mode = alc885_mbp_4ch_modes, | |
9776 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | |
4953550a TI |
9777 | .input_mux = &alc882_capture_source, |
9778 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9779 | .dig_in_nid = ALC882_DIGIN_NID, | |
9780 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 TI |
9781 | .setup = alc885_mbp3_setup, |
9782 | .init_hook = alc_automute_amp, | |
4953550a TI |
9783 | }, |
9784 | [ALC885_MB5] = { | |
9785 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | |
9786 | .init_verbs = { alc885_mb5_init_verbs, | |
9787 | alc880_gpio1_init_verbs }, | |
9788 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9789 | .dac_nids = alc882_dac_nids, | |
9790 | .channel_mode = alc885_mb5_6ch_modes, | |
9791 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | |
9792 | .input_mux = &mb5_capture_source, | |
9793 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9794 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
9795 | .unsol_event = alc_automute_amp_unsol_event, |
9796 | .setup = alc885_mb5_setup, | |
9797 | .init_hook = alc_automute_amp, | |
4953550a | 9798 | }, |
e458b1fa LY |
9799 | [ALC885_MACMINI3] = { |
9800 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, | |
9801 | .init_verbs = { alc885_macmini3_init_verbs, | |
9802 | alc880_gpio1_init_verbs }, | |
9803 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9804 | .dac_nids = alc882_dac_nids, | |
9805 | .channel_mode = alc885_macmini3_6ch_modes, | |
9806 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), | |
9807 | .input_mux = &macmini3_capture_source, | |
9808 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9809 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
9810 | .unsol_event = alc_automute_amp_unsol_event, |
9811 | .setup = alc885_macmini3_setup, | |
9812 | .init_hook = alc_automute_amp, | |
e458b1fa | 9813 | }, |
4953550a TI |
9814 | [ALC885_MACPRO] = { |
9815 | .mixers = { alc882_macpro_mixer }, | |
9816 | .init_verbs = { alc882_macpro_init_verbs }, | |
9817 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9818 | .dac_nids = alc882_dac_nids, | |
9819 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9820 | .dig_in_nid = ALC882_DIGIN_NID, | |
9821 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9822 | .channel_mode = alc882_ch_modes, | |
9823 | .input_mux = &alc882_capture_source, | |
9824 | .init_hook = alc885_macpro_init_hook, | |
9825 | }, | |
9826 | [ALC885_IMAC24] = { | |
9827 | .mixers = { alc885_imac24_mixer }, | |
9828 | .init_verbs = { alc885_imac24_init_verbs }, | |
9829 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9830 | .dac_nids = alc882_dac_nids, | |
9831 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9832 | .dig_in_nid = ALC882_DIGIN_NID, | |
9833 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9834 | .channel_mode = alc882_ch_modes, | |
9835 | .input_mux = &alc882_capture_source, | |
9836 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 | 9837 | .setup = alc885_imac24_setup, |
4953550a TI |
9838 | .init_hook = alc885_imac24_init_hook, |
9839 | }, | |
4b7e1803 | 9840 | [ALC885_IMAC91] = { |
b7cccc52 | 9841 | .mixers = {alc885_imac91_mixer}, |
4b7e1803 JM |
9842 | .init_verbs = { alc885_imac91_init_verbs, |
9843 | alc880_gpio1_init_verbs }, | |
9844 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9845 | .dac_nids = alc882_dac_nids, | |
b7cccc52 JM |
9846 | .channel_mode = alc885_mba21_ch_modes, |
9847 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
9848 | .input_mux = &alc889A_imac91_capture_source, | |
4b7e1803 JM |
9849 | .dig_out_nid = ALC882_DIGOUT_NID, |
9850 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
9851 | .unsol_event = alc_automute_amp_unsol_event, |
9852 | .setup = alc885_imac91_setup, | |
9853 | .init_hook = alc_automute_amp, | |
4b7e1803 | 9854 | }, |
4953550a TI |
9855 | [ALC882_TARGA] = { |
9856 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | |
8ab9e0af | 9857 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
31909b83 | 9858 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
4953550a TI |
9859 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9860 | .dac_nids = alc882_dac_nids, | |
9861 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9862 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
9863 | .adc_nids = alc882_adc_nids, | |
9864 | .capsrc_nids = alc882_capsrc_nids, | |
9865 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
9866 | .channel_mode = alc882_3ST_6ch_modes, | |
9867 | .need_dac_fix = 1, | |
9868 | .input_mux = &alc882_capture_source, | |
9869 | .unsol_event = alc882_targa_unsol_event, | |
4f5d1706 TI |
9870 | .setup = alc882_targa_setup, |
9871 | .init_hook = alc882_targa_automute, | |
4953550a TI |
9872 | }, |
9873 | [ALC882_ASUS_A7J] = { | |
9874 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9875 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
9876 | alc882_asus_a7j_verbs}, | |
4953550a TI |
9877 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9878 | .dac_nids = alc882_dac_nids, | |
9879 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9880 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
9881 | .adc_nids = alc882_adc_nids, | |
9882 | .capsrc_nids = alc882_capsrc_nids, | |
9883 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
9884 | .channel_mode = alc882_3ST_6ch_modes, | |
9885 | .need_dac_fix = 1, | |
9886 | .input_mux = &alc882_capture_source, | |
9887 | }, | |
9888 | [ALC882_ASUS_A7M] = { | |
9889 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9890 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
9891 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | |
4953550a TI |
9892 | alc882_asus_a7m_verbs }, |
9893 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9894 | .dac_nids = alc882_dac_nids, | |
9895 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9896 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
9897 | .channel_mode = alc880_threestack_modes, | |
9898 | .need_dac_fix = 1, | |
9899 | .input_mux = &alc882_capture_source, | |
9900 | }, | |
9c7f852e TI |
9901 | [ALC883_3ST_2ch_DIG] = { |
9902 | .mixers = { alc883_3ST_2ch_mixer }, | |
9903 | .init_verbs = { alc883_init_verbs }, | |
9904 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9905 | .dac_nids = alc883_dac_nids, | |
9906 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
9907 | .dig_in_nid = ALC883_DIGIN_NID, |
9908 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
9909 | .channel_mode = alc883_3ST_2ch_modes, | |
9910 | .input_mux = &alc883_capture_source, | |
9911 | }, | |
9912 | [ALC883_3ST_6ch_DIG] = { | |
9913 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9914 | .init_verbs = { alc883_init_verbs }, | |
9915 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9916 | .dac_nids = alc883_dac_nids, | |
9917 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
9918 | .dig_in_nid = ALC883_DIGIN_NID, |
9919 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
9920 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 9921 | .need_dac_fix = 1, |
9c7f852e | 9922 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 9923 | }, |
9c7f852e TI |
9924 | [ALC883_3ST_6ch] = { |
9925 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
9926 | .init_verbs = { alc883_init_verbs }, | |
9927 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9928 | .dac_nids = alc883_dac_nids, | |
9c7f852e TI |
9929 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
9930 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 9931 | .need_dac_fix = 1, |
9c7f852e | 9932 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 9933 | }, |
17bba1b7 J |
9934 | [ALC883_3ST_6ch_INTEL] = { |
9935 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
9936 | .init_verbs = { alc883_init_verbs }, | |
9937 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9938 | .dac_nids = alc883_dac_nids, | |
9939 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9940 | .dig_in_nid = ALC883_DIGIN_NID, | |
f3cd3f5d | 9941 | .slave_dig_outs = alc883_slave_dig_outs, |
17bba1b7 J |
9942 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
9943 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
9944 | .need_dac_fix = 1, | |
9945 | .input_mux = &alc883_3stack_6ch_intel, | |
9946 | }, | |
87a8c370 JK |
9947 | [ALC889A_INTEL] = { |
9948 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
6732bd0d WF |
9949 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
9950 | alc_hp15_unsol_verbs }, | |
87a8c370 JK |
9951 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9952 | .dac_nids = alc883_dac_nids, | |
9953 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
9954 | .adc_nids = alc889_adc_nids, | |
9955 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9956 | .dig_in_nid = ALC883_DIGIN_NID, | |
9957 | .slave_dig_outs = alc883_slave_dig_outs, | |
9958 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
9959 | .channel_mode = alc889_8ch_intel_modes, | |
9960 | .capsrc_nids = alc889_capsrc_nids, | |
9961 | .input_mux = &alc889_capture_source, | |
4f5d1706 TI |
9962 | .setup = alc889_automute_setup, |
9963 | .init_hook = alc_automute_amp, | |
6732bd0d | 9964 | .unsol_event = alc_automute_amp_unsol_event, |
87a8c370 JK |
9965 | .need_dac_fix = 1, |
9966 | }, | |
9967 | [ALC889_INTEL] = { | |
9968 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
9969 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | |
6732bd0d | 9970 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
87a8c370 JK |
9971 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9972 | .dac_nids = alc883_dac_nids, | |
9973 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
9974 | .adc_nids = alc889_adc_nids, | |
9975 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9976 | .dig_in_nid = ALC883_DIGIN_NID, | |
9977 | .slave_dig_outs = alc883_slave_dig_outs, | |
9978 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
9979 | .channel_mode = alc889_8ch_intel_modes, | |
9980 | .capsrc_nids = alc889_capsrc_nids, | |
9981 | .input_mux = &alc889_capture_source, | |
4f5d1706 | 9982 | .setup = alc889_automute_setup, |
6732bd0d WF |
9983 | .init_hook = alc889_intel_init_hook, |
9984 | .unsol_event = alc_automute_amp_unsol_event, | |
87a8c370 JK |
9985 | .need_dac_fix = 1, |
9986 | }, | |
9c7f852e TI |
9987 | [ALC883_6ST_DIG] = { |
9988 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
9989 | .init_verbs = { alc883_init_verbs }, | |
9990 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
9991 | .dac_nids = alc883_dac_nids, | |
9992 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
9993 | .dig_in_nid = ALC883_DIGIN_NID, |
9994 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
9995 | .channel_mode = alc883_sixstack_modes, | |
9996 | .input_mux = &alc883_capture_source, | |
9997 | }, | |
ccc656ce | 9998 | [ALC883_TARGA_DIG] = { |
c259249f | 9999 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
005b1076 DH |
10000 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
10001 | alc883_targa_verbs}, | |
ccc656ce KY |
10002 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10003 | .dac_nids = alc883_dac_nids, | |
10004 | .dig_out_nid = ALC883_DIGOUT_NID, | |
ccc656ce KY |
10005 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
10006 | .channel_mode = alc883_3ST_6ch_modes, | |
10007 | .need_dac_fix = 1, | |
10008 | .input_mux = &alc883_capture_source, | |
c259249f | 10009 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10010 | .setup = alc882_targa_setup, |
10011 | .init_hook = alc882_targa_automute, | |
ccc656ce KY |
10012 | }, |
10013 | [ALC883_TARGA_2ch_DIG] = { | |
c259249f | 10014 | .mixers = { alc883_targa_2ch_mixer}, |
005b1076 DH |
10015 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
10016 | alc883_targa_verbs}, | |
ccc656ce KY |
10017 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10018 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10019 | .adc_nids = alc883_adc_nids_alt, |
10020 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10021 | .capsrc_nids = alc883_capsrc_nids, |
ccc656ce | 10022 | .dig_out_nid = ALC883_DIGOUT_NID, |
ccc656ce KY |
10023 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10024 | .channel_mode = alc883_3ST_2ch_modes, | |
10025 | .input_mux = &alc883_capture_source, | |
c259249f | 10026 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10027 | .setup = alc882_targa_setup, |
10028 | .init_hook = alc882_targa_automute, | |
ccc656ce | 10029 | }, |
64a8be74 | 10030 | [ALC883_TARGA_8ch_DIG] = { |
b99dba34 TI |
10031 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
10032 | alc883_chmode_mixer }, | |
64a8be74 | 10033 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
c259249f | 10034 | alc883_targa_verbs }, |
64a8be74 DH |
10035 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10036 | .dac_nids = alc883_dac_nids, | |
10037 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10038 | .adc_nids = alc883_adc_nids_rev, | |
10039 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10040 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10041 | .dig_in_nid = ALC883_DIGIN_NID, | |
10042 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), | |
10043 | .channel_mode = alc883_4ST_8ch_modes, | |
10044 | .need_dac_fix = 1, | |
10045 | .input_mux = &alc883_capture_source, | |
c259249f | 10046 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10047 | .setup = alc882_targa_setup, |
10048 | .init_hook = alc882_targa_automute, | |
64a8be74 | 10049 | }, |
bab282b9 | 10050 | [ALC883_ACER] = { |
676a9b53 | 10051 | .mixers = { alc883_base_mixer }, |
bab282b9 VA |
10052 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
10053 | * and the headphone jack. Turn this on and rely on the | |
10054 | * standard mute methods whenever the user wants to turn | |
10055 | * these outputs off. | |
10056 | */ | |
10057 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
10058 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10059 | .dac_nids = alc883_dac_nids, | |
bab282b9 VA |
10060 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10061 | .channel_mode = alc883_3ST_2ch_modes, | |
10062 | .input_mux = &alc883_capture_source, | |
10063 | }, | |
2880a867 | 10064 | [ALC883_ACER_ASPIRE] = { |
676a9b53 | 10065 | .mixers = { alc883_acer_aspire_mixer }, |
d1a991a6 | 10066 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
2880a867 TD |
10067 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10068 | .dac_nids = alc883_dac_nids, | |
10069 | .dig_out_nid = ALC883_DIGOUT_NID, | |
2880a867 TD |
10070 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10071 | .channel_mode = alc883_3ST_2ch_modes, | |
10072 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10073 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10074 | .setup = alc883_acer_aspire_setup, |
10075 | .init_hook = alc_automute_amp, | |
d1a991a6 | 10076 | }, |
5b2d1eca | 10077 | [ALC888_ACER_ASPIRE_4930G] = { |
ef8ef5fb | 10078 | .mixers = { alc888_base_mixer, |
5b2d1eca VP |
10079 | alc883_chmode_mixer }, |
10080 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10081 | alc888_acer_aspire_4930g_verbs }, | |
10082 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10083 | .dac_nids = alc883_dac_nids, | |
10084 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10085 | .adc_nids = alc883_adc_nids_rev, | |
10086 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10087 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10088 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10089 | .channel_mode = alc883_3ST_6ch_modes, | |
10090 | .need_dac_fix = 1, | |
973b8cb0 | 10091 | .const_channel_count = 6, |
5b2d1eca | 10092 | .num_mux_defs = |
ef8ef5fb VP |
10093 | ARRAY_SIZE(alc888_2_capture_sources), |
10094 | .input_mux = alc888_2_capture_sources, | |
d2fd4b09 | 10095 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10096 | .setup = alc888_acer_aspire_4930g_setup, |
10097 | .init_hook = alc_automute_amp, | |
d2fd4b09 TV |
10098 | }, |
10099 | [ALC888_ACER_ASPIRE_6530G] = { | |
10100 | .mixers = { alc888_acer_aspire_6530_mixer }, | |
10101 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10102 | alc888_acer_aspire_6530g_verbs }, | |
10103 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10104 | .dac_nids = alc883_dac_nids, | |
10105 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10106 | .adc_nids = alc883_adc_nids_rev, | |
10107 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10108 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10109 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10110 | .channel_mode = alc883_3ST_2ch_modes, | |
10111 | .num_mux_defs = | |
10112 | ARRAY_SIZE(alc888_2_capture_sources), | |
10113 | .input_mux = alc888_acer_aspire_6530_sources, | |
a9fd4f3f | 10114 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10115 | .setup = alc888_acer_aspire_6530g_setup, |
10116 | .init_hook = alc_automute_amp, | |
5b2d1eca | 10117 | }, |
3b315d70 | 10118 | [ALC888_ACER_ASPIRE_8930G] = { |
556eea9a | 10119 | .mixers = { alc889_acer_aspire_8930g_mixer, |
3b315d70 HM |
10120 | alc883_chmode_mixer }, |
10121 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
0f86a228 HM |
10122 | alc889_acer_aspire_8930g_verbs, |
10123 | alc889_eapd_verbs}, | |
3b315d70 HM |
10124 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10125 | .dac_nids = alc883_dac_nids, | |
018df418 HM |
10126 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
10127 | .adc_nids = alc889_adc_nids, | |
10128 | .capsrc_nids = alc889_capsrc_nids, | |
3b315d70 HM |
10129 | .dig_out_nid = ALC883_DIGOUT_NID, |
10130 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10131 | .channel_mode = alc883_3ST_6ch_modes, | |
10132 | .need_dac_fix = 1, | |
10133 | .const_channel_count = 6, | |
10134 | .num_mux_defs = | |
018df418 HM |
10135 | ARRAY_SIZE(alc889_capture_sources), |
10136 | .input_mux = alc889_capture_sources, | |
3b315d70 | 10137 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10138 | .setup = alc889_acer_aspire_8930g_setup, |
10139 | .init_hook = alc_automute_amp, | |
f5de24b0 | 10140 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
c97259df | 10141 | .power_hook = alc_power_eapd, |
f5de24b0 | 10142 | #endif |
3b315d70 | 10143 | }, |
fc86f954 DK |
10144 | [ALC888_ACER_ASPIRE_7730G] = { |
10145 | .mixers = { alc883_3ST_6ch_mixer, | |
10146 | alc883_chmode_mixer }, | |
10147 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10148 | alc888_acer_aspire_7730G_verbs }, | |
10149 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10150 | .dac_nids = alc883_dac_nids, | |
10151 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10152 | .adc_nids = alc883_adc_nids_rev, | |
10153 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10154 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10155 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10156 | .channel_mode = alc883_3ST_6ch_modes, | |
10157 | .need_dac_fix = 1, | |
10158 | .const_channel_count = 6, | |
10159 | .input_mux = &alc883_capture_source, | |
10160 | .unsol_event = alc_automute_amp_unsol_event, | |
10161 | .setup = alc888_acer_aspire_6530g_setup, | |
10162 | .init_hook = alc_automute_amp, | |
10163 | }, | |
c07584c8 TD |
10164 | [ALC883_MEDION] = { |
10165 | .mixers = { alc883_fivestack_mixer, | |
10166 | alc883_chmode_mixer }, | |
10167 | .init_verbs = { alc883_init_verbs, | |
b373bdeb | 10168 | alc883_medion_eapd_verbs }, |
c07584c8 TD |
10169 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10170 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10171 | .adc_nids = alc883_adc_nids_alt, |
10172 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10173 | .capsrc_nids = alc883_capsrc_nids, |
c07584c8 TD |
10174 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10175 | .channel_mode = alc883_sixstack_modes, | |
10176 | .input_mux = &alc883_capture_source, | |
b373bdeb | 10177 | }, |
272a527c KY |
10178 | [ALC883_MEDION_MD2] = { |
10179 | .mixers = { alc883_medion_md2_mixer}, | |
10180 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, | |
10181 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10182 | .dac_nids = alc883_dac_nids, | |
10183 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
10184 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10185 | .channel_mode = alc883_3ST_2ch_modes, | |
10186 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10187 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10188 | .setup = alc883_medion_md2_setup, |
10189 | .init_hook = alc_automute_amp, | |
ea1fb29a | 10190 | }, |
7ad7b218 MC |
10191 | [ALC883_MEDION_WIM2160] = { |
10192 | .mixers = { alc883_medion_wim2160_mixer }, | |
10193 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | |
10194 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10195 | .dac_nids = alc883_dac_nids, | |
10196 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10197 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
10198 | .adc_nids = alc883_adc_nids, | |
10199 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10200 | .channel_mode = alc883_3ST_2ch_modes, | |
10201 | .input_mux = &alc883_capture_source, | |
10202 | .unsol_event = alc_automute_amp_unsol_event, | |
10203 | .setup = alc883_medion_wim2160_setup, | |
10204 | .init_hook = alc_automute_amp, | |
10205 | }, | |
b373bdeb | 10206 | [ALC883_LAPTOP_EAPD] = { |
676a9b53 | 10207 | .mixers = { alc883_base_mixer }, |
b373bdeb AN |
10208 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
10209 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10210 | .dac_nids = alc883_dac_nids, | |
b373bdeb AN |
10211 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10212 | .channel_mode = alc883_3ST_2ch_modes, | |
10213 | .input_mux = &alc883_capture_source, | |
10214 | }, | |
a65cc60f | 10215 | [ALC883_CLEVO_M540R] = { |
10216 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10217 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | |
10218 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10219 | .dac_nids = alc883_dac_nids, | |
10220 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10221 | .dig_in_nid = ALC883_DIGIN_NID, | |
10222 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | |
10223 | .channel_mode = alc883_3ST_6ch_clevo_modes, | |
10224 | .need_dac_fix = 1, | |
10225 | .input_mux = &alc883_capture_source, | |
10226 | /* This machine has the hardware HP auto-muting, thus | |
10227 | * we need no software mute via unsol event | |
10228 | */ | |
10229 | }, | |
0c4cc443 HRK |
10230 | [ALC883_CLEVO_M720] = { |
10231 | .mixers = { alc883_clevo_m720_mixer }, | |
10232 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
368c7a95 J |
10233 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10234 | .dac_nids = alc883_dac_nids, | |
10235 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10236 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10237 | .channel_mode = alc883_3ST_2ch_modes, | |
10238 | .input_mux = &alc883_capture_source, | |
0c4cc443 | 10239 | .unsol_event = alc883_clevo_m720_unsol_event, |
4f5d1706 | 10240 | .setup = alc883_clevo_m720_setup, |
a9fd4f3f | 10241 | .init_hook = alc883_clevo_m720_init_hook, |
368c7a95 | 10242 | }, |
bc9f98a9 KY |
10243 | [ALC883_LENOVO_101E_2ch] = { |
10244 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
10245 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
10246 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10247 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10248 | .adc_nids = alc883_adc_nids_alt, |
10249 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10250 | .capsrc_nids = alc883_capsrc_nids, |
bc9f98a9 KY |
10251 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10252 | .channel_mode = alc883_3ST_2ch_modes, | |
10253 | .input_mux = &alc883_lenovo_101e_capture_source, | |
10254 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
10255 | .init_hook = alc883_lenovo_101e_all_automute, | |
10256 | }, | |
272a527c KY |
10257 | [ALC883_LENOVO_NB0763] = { |
10258 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
10259 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
10260 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10261 | .dac_nids = alc883_dac_nids, | |
272a527c KY |
10262 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10263 | .channel_mode = alc883_3ST_2ch_modes, | |
10264 | .need_dac_fix = 1, | |
10265 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
a9fd4f3f | 10266 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10267 | .setup = alc883_medion_md2_setup, |
10268 | .init_hook = alc_automute_amp, | |
272a527c KY |
10269 | }, |
10270 | [ALC888_LENOVO_MS7195_DIG] = { | |
10271 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10272 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
10273 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10274 | .dac_nids = alc883_dac_nids, | |
10275 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
10276 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
10277 | .channel_mode = alc883_3ST_6ch_modes, | |
10278 | .need_dac_fix = 1, | |
10279 | .input_mux = &alc883_capture_source, | |
10280 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
10281 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
189609ae KY |
10282 | }, |
10283 | [ALC883_HAIER_W66] = { | |
c259249f | 10284 | .mixers = { alc883_targa_2ch_mixer}, |
189609ae KY |
10285 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
10286 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10287 | .dac_nids = alc883_dac_nids, | |
10288 | .dig_out_nid = ALC883_DIGOUT_NID, | |
189609ae KY |
10289 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10290 | .channel_mode = alc883_3ST_2ch_modes, | |
10291 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10292 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10293 | .setup = alc883_haier_w66_setup, |
10294 | .init_hook = alc_automute_amp, | |
eea6419e | 10295 | }, |
4723c022 | 10296 | [ALC888_3ST_HP] = { |
eea6419e | 10297 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
4723c022 | 10298 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
8341de60 CM |
10299 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10300 | .dac_nids = alc883_dac_nids, | |
4723c022 CM |
10301 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
10302 | .channel_mode = alc888_3st_hp_modes, | |
8341de60 CM |
10303 | .need_dac_fix = 1, |
10304 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10305 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10306 | .setup = alc888_3st_hp_setup, |
10307 | .init_hook = alc_automute_amp, | |
8341de60 | 10308 | }, |
5795b9e6 | 10309 | [ALC888_6ST_DELL] = { |
f24dbdc6 | 10310 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
5795b9e6 CM |
10311 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
10312 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10313 | .dac_nids = alc883_dac_nids, | |
10314 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5795b9e6 CM |
10315 | .dig_in_nid = ALC883_DIGIN_NID, |
10316 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10317 | .channel_mode = alc883_sixstack_modes, | |
10318 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10319 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10320 | .setup = alc888_6st_dell_setup, |
10321 | .init_hook = alc_automute_amp, | |
5795b9e6 | 10322 | }, |
a8848bd6 AS |
10323 | [ALC883_MITAC] = { |
10324 | .mixers = { alc883_mitac_mixer }, | |
10325 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
10326 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10327 | .dac_nids = alc883_dac_nids, | |
a8848bd6 AS |
10328 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10329 | .channel_mode = alc883_3ST_2ch_modes, | |
10330 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10331 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10332 | .setup = alc883_mitac_setup, |
10333 | .init_hook = alc_automute_amp, | |
a8848bd6 | 10334 | }, |
fb97dc67 J |
10335 | [ALC883_FUJITSU_PI2515] = { |
10336 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
10337 | .init_verbs = { alc883_init_verbs, | |
10338 | alc883_2ch_fujitsu_pi2515_verbs}, | |
10339 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10340 | .dac_nids = alc883_dac_nids, | |
10341 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10342 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10343 | .channel_mode = alc883_3ST_2ch_modes, | |
10344 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
a9fd4f3f | 10345 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10346 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
10347 | .init_hook = alc_automute_amp, | |
fb97dc67 | 10348 | }, |
ef8ef5fb VP |
10349 | [ALC888_FUJITSU_XA3530] = { |
10350 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | |
10351 | .init_verbs = { alc883_init_verbs, | |
10352 | alc888_fujitsu_xa3530_verbs }, | |
10353 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10354 | .dac_nids = alc883_dac_nids, | |
10355 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10356 | .adc_nids = alc883_adc_nids_rev, | |
10357 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10358 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10359 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), | |
10360 | .channel_mode = alc888_4ST_8ch_intel_modes, | |
10361 | .num_mux_defs = | |
10362 | ARRAY_SIZE(alc888_2_capture_sources), | |
10363 | .input_mux = alc888_2_capture_sources, | |
a9fd4f3f | 10364 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10365 | .setup = alc888_fujitsu_xa3530_setup, |
10366 | .init_hook = alc_automute_amp, | |
ef8ef5fb | 10367 | }, |
e2757d5e KY |
10368 | [ALC888_LENOVO_SKY] = { |
10369 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | |
10370 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | |
10371 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10372 | .dac_nids = alc883_dac_nids, | |
10373 | .dig_out_nid = ALC883_DIGOUT_NID, | |
e2757d5e KY |
10374 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10375 | .channel_mode = alc883_sixstack_modes, | |
10376 | .need_dac_fix = 1, | |
10377 | .input_mux = &alc883_lenovo_sky_capture_source, | |
a9fd4f3f | 10378 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10379 | .setup = alc888_lenovo_sky_setup, |
10380 | .init_hook = alc_automute_amp, | |
e2757d5e KY |
10381 | }, |
10382 | [ALC888_ASUS_M90V] = { | |
10383 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10384 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | |
10385 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10386 | .dac_nids = alc883_dac_nids, | |
10387 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10388 | .dig_in_nid = ALC883_DIGIN_NID, | |
10389 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10390 | .channel_mode = alc883_3ST_6ch_modes, | |
10391 | .need_dac_fix = 1, | |
10392 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
4f5d1706 TI |
10393 | .unsol_event = alc_sku_unsol_event, |
10394 | .setup = alc883_mode2_setup, | |
10395 | .init_hook = alc_inithook, | |
e2757d5e KY |
10396 | }, |
10397 | [ALC888_ASUS_EEE1601] = { | |
10398 | .mixers = { alc883_asus_eee1601_mixer }, | |
f9e336f6 | 10399 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
e2757d5e KY |
10400 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
10401 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10402 | .dac_nids = alc883_dac_nids, | |
10403 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10404 | .dig_in_nid = ALC883_DIGIN_NID, | |
10405 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10406 | .channel_mode = alc883_3ST_2ch_modes, | |
10407 | .need_dac_fix = 1, | |
10408 | .input_mux = &alc883_asus_eee1601_capture_source, | |
a9fd4f3f | 10409 | .unsol_event = alc_sku_unsol_event, |
e2757d5e KY |
10410 | .init_hook = alc883_eee1601_inithook, |
10411 | }, | |
3ab90935 WF |
10412 | [ALC1200_ASUS_P5Q] = { |
10413 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10414 | .init_verbs = { alc883_init_verbs }, | |
10415 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10416 | .dac_nids = alc883_dac_nids, | |
10417 | .dig_out_nid = ALC1200_DIGOUT_NID, | |
10418 | .dig_in_nid = ALC883_DIGIN_NID, | |
b25c9da1 | 10419 | .slave_dig_outs = alc1200_slave_dig_outs, |
3ab90935 WF |
10420 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10421 | .channel_mode = alc883_sixstack_modes, | |
10422 | .input_mux = &alc883_capture_source, | |
10423 | }, | |
eb4c41d3 TS |
10424 | [ALC889A_MB31] = { |
10425 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, | |
10426 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, | |
10427 | alc880_gpio1_init_verbs }, | |
10428 | .adc_nids = alc883_adc_nids, | |
10429 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
035eb0cf | 10430 | .capsrc_nids = alc883_capsrc_nids, |
eb4c41d3 TS |
10431 | .dac_nids = alc883_dac_nids, |
10432 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10433 | .channel_mode = alc889A_mb31_6ch_modes, | |
10434 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), | |
10435 | .input_mux = &alc889A_mb31_capture_source, | |
10436 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10437 | .unsol_event = alc889A_mb31_unsol_event, | |
10438 | .init_hook = alc889A_mb31_automute, | |
10439 | }, | |
3e1647c5 GG |
10440 | [ALC883_SONY_VAIO_TT] = { |
10441 | .mixers = { alc883_vaiott_mixer }, | |
10442 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, | |
10443 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10444 | .dac_nids = alc883_dac_nids, | |
10445 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10446 | .channel_mode = alc883_3ST_2ch_modes, | |
10447 | .input_mux = &alc883_capture_source, | |
10448 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 TI |
10449 | .setup = alc883_vaiott_setup, |
10450 | .init_hook = alc_automute_amp, | |
3e1647c5 | 10451 | }, |
9c7f852e TI |
10452 | }; |
10453 | ||
10454 | ||
4953550a TI |
10455 | /* |
10456 | * Pin config fixes | |
10457 | */ | |
10458 | enum { | |
954a29c8 TI |
10459 | PINFIX_ABIT_AW9D_MAX, |
10460 | PINFIX_PB_M5210, | |
4953550a TI |
10461 | }; |
10462 | ||
f8f25ba3 TI |
10463 | static const struct alc_fixup alc882_fixups[] = { |
10464 | [PINFIX_ABIT_AW9D_MAX] = { | |
73413b12 TI |
10465 | .pins = (const struct alc_pincfg[]) { |
10466 | { 0x15, 0x01080104 }, /* side */ | |
10467 | { 0x16, 0x01011012 }, /* rear */ | |
10468 | { 0x17, 0x01016011 }, /* clfe */ | |
10469 | { } | |
10470 | } | |
f8f25ba3 | 10471 | }, |
954a29c8 | 10472 | [PINFIX_PB_M5210] = { |
73413b12 TI |
10473 | .verbs = (const struct hda_verb[]) { |
10474 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | |
10475 | {} | |
10476 | } | |
954a29c8 | 10477 | }, |
4953550a TI |
10478 | }; |
10479 | ||
f8f25ba3 | 10480 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
954a29c8 | 10481 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
4953550a TI |
10482 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
10483 | {} | |
10484 | }; | |
10485 | ||
9c7f852e TI |
10486 | /* |
10487 | * BIOS auto configuration | |
10488 | */ | |
05f5f477 TI |
10489 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
10490 | const struct auto_pin_cfg *cfg) | |
10491 | { | |
10492 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | |
10493 | } | |
10494 | ||
4953550a | 10495 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
9c7f852e | 10496 | hda_nid_t nid, int pin_type, |
489008cd | 10497 | hda_nid_t dac) |
9c7f852e | 10498 | { |
f12ab1e0 TI |
10499 | int idx; |
10500 | ||
489008cd | 10501 | /* set as output */ |
f6c7e546 | 10502 | alc_set_pin_output(codec, nid, pin_type); |
489008cd TI |
10503 | |
10504 | if (dac == 0x25) | |
9c7f852e | 10505 | idx = 4; |
489008cd TI |
10506 | else if (dac >= 0x02 && dac <= 0x05) |
10507 | idx = dac - 2; | |
f9700d5a | 10508 | else |
489008cd | 10509 | return; |
9c7f852e | 10510 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
9c7f852e TI |
10511 | } |
10512 | ||
4953550a | 10513 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
9c7f852e TI |
10514 | { |
10515 | struct alc_spec *spec = codec->spec; | |
10516 | int i; | |
10517 | ||
10518 | for (i = 0; i <= HDA_SIDE; i++) { | |
f12ab1e0 | 10519 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 10520 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
9c7f852e | 10521 | if (nid) |
4953550a | 10522 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
489008cd | 10523 | spec->multiout.dac_nids[i]); |
9c7f852e TI |
10524 | } |
10525 | } | |
10526 | ||
4953550a | 10527 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
9c7f852e TI |
10528 | { |
10529 | struct alc_spec *spec = codec->spec; | |
489008cd | 10530 | hda_nid_t pin, dac; |
9c7f852e | 10531 | |
eb06ed8f | 10532 | pin = spec->autocfg.hp_pins[0]; |
489008cd TI |
10533 | if (pin) { |
10534 | dac = spec->multiout.hp_nid; | |
10535 | if (!dac) | |
10536 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10537 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | |
10538 | } | |
f6c7e546 | 10539 | pin = spec->autocfg.speaker_pins[0]; |
489008cd TI |
10540 | if (pin) { |
10541 | dac = spec->multiout.extra_out_nid[0]; | |
10542 | if (!dac) | |
10543 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10544 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | |
10545 | } | |
9c7f852e TI |
10546 | } |
10547 | ||
4953550a | 10548 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
9c7f852e TI |
10549 | { |
10550 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 10551 | struct auto_pin_cfg *cfg = &spec->autocfg; |
9c7f852e TI |
10552 | int i; |
10553 | ||
66ceeb6b TI |
10554 | for (i = 0; i < cfg->num_inputs; i++) { |
10555 | hda_nid_t nid = cfg->inputs[i].pin; | |
0d971c9f | 10556 | alc_set_input_pin(codec, nid, i); |
4953550a TI |
10557 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
10558 | snd_hda_codec_write(codec, nid, 0, | |
10559 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10560 | AMP_OUT_MUTE); | |
10561 | } | |
10562 | } | |
10563 | ||
10564 | static void alc882_auto_init_input_src(struct hda_codec *codec) | |
10565 | { | |
10566 | struct alc_spec *spec = codec->spec; | |
10567 | int c; | |
10568 | ||
10569 | for (c = 0; c < spec->num_adc_nids; c++) { | |
10570 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | |
10571 | hda_nid_t nid = spec->capsrc_nids[c]; | |
10572 | unsigned int mux_idx; | |
10573 | const struct hda_input_mux *imux; | |
10574 | int conns, mute, idx, item; | |
10575 | ||
10576 | conns = snd_hda_get_connections(codec, nid, conn_list, | |
10577 | ARRAY_SIZE(conn_list)); | |
10578 | if (conns < 0) | |
10579 | continue; | |
10580 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
10581 | imux = &spec->input_mux[mux_idx]; | |
5311114d TI |
10582 | if (!imux->num_items && mux_idx > 0) |
10583 | imux = &spec->input_mux[0]; | |
4953550a TI |
10584 | for (idx = 0; idx < conns; idx++) { |
10585 | /* if the current connection is the selected one, | |
10586 | * unmute it as default - otherwise mute it | |
10587 | */ | |
10588 | mute = AMP_IN_MUTE(idx); | |
10589 | for (item = 0; item < imux->num_items; item++) { | |
10590 | if (imux->items[item].index == idx) { | |
10591 | if (spec->cur_mux[c] == item) | |
10592 | mute = AMP_IN_UNMUTE(idx); | |
10593 | break; | |
10594 | } | |
10595 | } | |
10596 | /* check if we have a selector or mixer | |
10597 | * we could check for the widget type instead, but | |
10598 | * just check for Amp-In presence (in case of mixer | |
10599 | * without amp-in there is something wrong, this | |
10600 | * function shouldn't be used or capsrc nid is wrong) | |
10601 | */ | |
10602 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | |
9c7f852e TI |
10603 | snd_hda_codec_write(codec, nid, 0, |
10604 | AC_VERB_SET_AMP_GAIN_MUTE, | |
4953550a TI |
10605 | mute); |
10606 | else if (mute != AMP_IN_MUTE(idx)) | |
10607 | snd_hda_codec_write(codec, nid, 0, | |
10608 | AC_VERB_SET_CONNECT_SEL, | |
10609 | idx); | |
9c7f852e TI |
10610 | } |
10611 | } | |
10612 | } | |
10613 | ||
4953550a TI |
10614 | /* add mic boosts if needed */ |
10615 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
10616 | { | |
10617 | struct alc_spec *spec = codec->spec; | |
66ceeb6b TI |
10618 | struct auto_pin_cfg *cfg = &spec->autocfg; |
10619 | int i, err; | |
4953550a TI |
10620 | hda_nid_t nid; |
10621 | ||
66ceeb6b | 10622 | for (i = 0; i < cfg->num_inputs; i++) { |
86e2959a | 10623 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
66ceeb6b TI |
10624 | break; |
10625 | nid = cfg->inputs[i].pin; | |
10626 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { | |
10a20af7 TI |
10627 | char label[32]; |
10628 | snprintf(label, sizeof(label), "%s Boost", | |
10629 | hda_get_autocfg_input_label(codec, cfg, i)); | |
66ceeb6b | 10630 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, |
4953550a | 10631 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
66ceeb6b TI |
10632 | if (err < 0) |
10633 | return err; | |
10634 | } | |
4953550a TI |
10635 | } |
10636 | return 0; | |
10637 | } | |
f511b01c | 10638 | |
9c7f852e | 10639 | /* almost identical with ALC880 parser... */ |
4953550a | 10640 | static int alc882_parse_auto_config(struct hda_codec *codec) |
9c7f852e TI |
10641 | { |
10642 | struct alc_spec *spec = codec->spec; | |
05f5f477 | 10643 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
757899ac | 10644 | int err; |
9c7f852e | 10645 | |
05f5f477 TI |
10646 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
10647 | alc882_ignore); | |
9c7f852e TI |
10648 | if (err < 0) |
10649 | return err; | |
05f5f477 TI |
10650 | if (!spec->autocfg.line_outs) |
10651 | return 0; /* can't find valid BIOS pin config */ | |
776e184e | 10652 | |
05f5f477 TI |
10653 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
10654 | if (err < 0) | |
10655 | return err; | |
10656 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
489008cd TI |
10657 | if (err < 0) |
10658 | return err; | |
10659 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
10660 | "Headphone"); | |
05f5f477 TI |
10661 | if (err < 0) |
10662 | return err; | |
10663 | err = alc880_auto_create_extra_out(spec, | |
10664 | spec->autocfg.speaker_pins[0], | |
10665 | "Speaker"); | |
10666 | if (err < 0) | |
10667 | return err; | |
05f5f477 | 10668 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
776e184e TI |
10669 | if (err < 0) |
10670 | return err; | |
10671 | ||
05f5f477 TI |
10672 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
10673 | ||
757899ac | 10674 | alc_auto_parse_digital(codec); |
05f5f477 TI |
10675 | |
10676 | if (spec->kctls.list) | |
10677 | add_mixer(spec, spec->kctls.list); | |
10678 | ||
10679 | add_verb(spec, alc883_auto_init_verbs); | |
4953550a | 10680 | /* if ADC 0x07 is available, initialize it, too */ |
05f5f477 | 10681 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
4953550a | 10682 | add_verb(spec, alc882_adc1_init_verbs); |
776e184e | 10683 | |
05f5f477 TI |
10684 | spec->num_mux_defs = 1; |
10685 | spec->input_mux = &spec->private_imux[0]; | |
10686 | ||
6227cdce | 10687 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
05f5f477 TI |
10688 | |
10689 | err = alc_auto_add_mic_boost(codec); | |
10690 | if (err < 0) | |
10691 | return err; | |
61b9b9b1 | 10692 | |
776e184e | 10693 | return 1; /* config found */ |
9c7f852e TI |
10694 | } |
10695 | ||
10696 | /* additional initialization for auto-configuration model */ | |
4953550a | 10697 | static void alc882_auto_init(struct hda_codec *codec) |
9c7f852e | 10698 | { |
f6c7e546 | 10699 | struct alc_spec *spec = codec->spec; |
4953550a TI |
10700 | alc882_auto_init_multi_out(codec); |
10701 | alc882_auto_init_hp_out(codec); | |
10702 | alc882_auto_init_analog_input(codec); | |
10703 | alc882_auto_init_input_src(codec); | |
757899ac | 10704 | alc_auto_init_digital(codec); |
f6c7e546 | 10705 | if (spec->unsol_event) |
7fb0d78f | 10706 | alc_inithook(codec); |
9c7f852e TI |
10707 | } |
10708 | ||
4953550a | 10709 | static int patch_alc882(struct hda_codec *codec) |
9c7f852e TI |
10710 | { |
10711 | struct alc_spec *spec; | |
10712 | int err, board_config; | |
10713 | ||
10714 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
10715 | if (spec == NULL) | |
10716 | return -ENOMEM; | |
10717 | ||
10718 | codec->spec = spec; | |
10719 | ||
da00c244 KY |
10720 | alc_auto_parse_customize_define(codec); |
10721 | ||
4953550a TI |
10722 | switch (codec->vendor_id) { |
10723 | case 0x10ec0882: | |
10724 | case 0x10ec0885: | |
10725 | break; | |
10726 | default: | |
10727 | /* ALC883 and variants */ | |
10728 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
10729 | break; | |
10730 | } | |
2c3bf9ab | 10731 | |
4953550a TI |
10732 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
10733 | alc882_models, | |
10734 | alc882_cfg_tbl); | |
10735 | ||
10736 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) | |
10737 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
10738 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); | |
10739 | ||
10740 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
9a11f1aa | 10741 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
4953550a TI |
10742 | codec->chip_name); |
10743 | board_config = ALC882_AUTO; | |
9c7f852e TI |
10744 | } |
10745 | ||
7fa90e87 TI |
10746 | if (board_config == ALC882_AUTO) |
10747 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); | |
4953550a TI |
10748 | |
10749 | if (board_config == ALC882_AUTO) { | |
9c7f852e | 10750 | /* automatic parse from the BIOS config */ |
4953550a | 10751 | err = alc882_parse_auto_config(codec); |
9c7f852e TI |
10752 | if (err < 0) { |
10753 | alc_free(codec); | |
10754 | return err; | |
f12ab1e0 | 10755 | } else if (!err) { |
9c7f852e TI |
10756 | printk(KERN_INFO |
10757 | "hda_codec: Cannot set up configuration " | |
10758 | "from BIOS. Using base mode...\n"); | |
4953550a | 10759 | board_config = ALC882_3ST_DIG; |
9c7f852e TI |
10760 | } |
10761 | } | |
10762 | ||
dc1eae25 | 10763 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
10764 | err = snd_hda_attach_beep_device(codec, 0x1); |
10765 | if (err < 0) { | |
10766 | alc_free(codec); | |
10767 | return err; | |
10768 | } | |
680cd536 KK |
10769 | } |
10770 | ||
4953550a | 10771 | if (board_config != ALC882_AUTO) |
e9c364c0 | 10772 | setup_preset(codec, &alc882_presets[board_config]); |
9c7f852e | 10773 | |
4953550a TI |
10774 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
10775 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
10776 | /* FIXME: setup DAC5 */ | |
10777 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
10778 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
10779 | ||
10780 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | |
10781 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
10782 | ||
4953550a | 10783 | if (!spec->adc_nids && spec->input_mux) { |
d11f74c6 | 10784 | int i, j; |
4953550a TI |
10785 | spec->num_adc_nids = 0; |
10786 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | |
d11f74c6 | 10787 | const struct hda_input_mux *imux = spec->input_mux; |
4953550a | 10788 | hda_nid_t cap; |
d11f74c6 | 10789 | hda_nid_t items[16]; |
4953550a TI |
10790 | hda_nid_t nid = alc882_adc_nids[i]; |
10791 | unsigned int wcap = get_wcaps(codec, nid); | |
10792 | /* get type */ | |
a22d543a | 10793 | wcap = get_wcaps_type(wcap); |
4953550a TI |
10794 | if (wcap != AC_WID_AUD_IN) |
10795 | continue; | |
10796 | spec->private_adc_nids[spec->num_adc_nids] = nid; | |
10797 | err = snd_hda_get_connections(codec, nid, &cap, 1); | |
10798 | if (err < 0) | |
10799 | continue; | |
d11f74c6 TI |
10800 | err = snd_hda_get_connections(codec, cap, items, |
10801 | ARRAY_SIZE(items)); | |
10802 | if (err < 0) | |
10803 | continue; | |
10804 | for (j = 0; j < imux->num_items; j++) | |
10805 | if (imux->items[j].index >= err) | |
10806 | break; | |
10807 | if (j < imux->num_items) | |
10808 | continue; | |
4953550a TI |
10809 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
10810 | spec->num_adc_nids++; | |
61b9b9b1 | 10811 | } |
4953550a TI |
10812 | spec->adc_nids = spec->private_adc_nids; |
10813 | spec->capsrc_nids = spec->private_capsrc_nids; | |
2f893286 KY |
10814 | } |
10815 | ||
b59bdf3b | 10816 | set_capture_mixer(codec); |
da00c244 | 10817 | |
dc1eae25 | 10818 | if (has_cdefine_beep(codec)) |
da00c244 | 10819 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
9c7f852e | 10820 | |
7fa90e87 TI |
10821 | if (board_config == ALC882_AUTO) |
10822 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); | |
10823 | ||
2134ea4f TI |
10824 | spec->vmaster_nid = 0x0c; |
10825 | ||
9c7f852e | 10826 | codec->patch_ops = alc_patch_ops; |
4953550a TI |
10827 | if (board_config == ALC882_AUTO) |
10828 | spec->init_hook = alc882_auto_init; | |
cb53c626 TI |
10829 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
10830 | if (!spec->loopback.amplist) | |
4953550a | 10831 | spec->loopback.amplist = alc882_loopbacks; |
cb53c626 | 10832 | #endif |
9c7f852e TI |
10833 | |
10834 | return 0; | |
10835 | } | |
10836 | ||
4953550a | 10837 | |
9c7f852e TI |
10838 | /* |
10839 | * ALC262 support | |
10840 | */ | |
10841 | ||
10842 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
10843 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
10844 | ||
10845 | #define alc262_dac_nids alc260_dac_nids | |
10846 | #define alc262_adc_nids alc882_adc_nids | |
10847 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
88c71a99 TI |
10848 | #define alc262_capsrc_nids alc882_capsrc_nids |
10849 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
9c7f852e TI |
10850 | |
10851 | #define alc262_modes alc260_modes | |
10852 | #define alc262_capture_source alc882_capture_source | |
10853 | ||
4e555fe5 KY |
10854 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
10855 | /* ADC0 */ | |
10856 | 0x09 | |
10857 | }; | |
10858 | ||
10859 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | |
10860 | ||
9c7f852e TI |
10861 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
10862 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10863 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10864 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10865 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
10866 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
10867 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10868 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
10869 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 10870 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
10871 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
10872 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 10873 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
10874 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
10875 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10876 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
10877 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
10878 | { } /* end */ | |
10879 | }; | |
10880 | ||
ce875f07 TI |
10881 | /* update HP, line and mono-out pins according to the master switch */ |
10882 | static void alc262_hp_master_update(struct hda_codec *codec) | |
10883 | { | |
10884 | struct alc_spec *spec = codec->spec; | |
10885 | int val = spec->master_sw; | |
10886 | ||
10887 | /* HP & line-out */ | |
10888 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
10889 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10890 | val ? PIN_HP : 0); | |
10891 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
10892 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10893 | val ? PIN_HP : 0); | |
10894 | /* mono (speaker) depending on the HP jack sense */ | |
10895 | val = val && !spec->jack_present; | |
10896 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
10897 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10898 | val ? PIN_OUT : 0); | |
10899 | } | |
10900 | ||
10901 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
10902 | { | |
10903 | struct alc_spec *spec = codec->spec; | |
864f92be WF |
10904 | |
10905 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
ce875f07 TI |
10906 | alc262_hp_master_update(codec); |
10907 | } | |
10908 | ||
10909 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
10910 | { | |
10911 | if ((res >> 26) != ALC880_HP_EVENT) | |
10912 | return; | |
10913 | alc262_hp_bpc_automute(codec); | |
10914 | } | |
10915 | ||
10916 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
10917 | { | |
10918 | struct alc_spec *spec = codec->spec; | |
864f92be WF |
10919 | |
10920 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
ce875f07 TI |
10921 | alc262_hp_master_update(codec); |
10922 | } | |
10923 | ||
10924 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
10925 | unsigned int res) | |
10926 | { | |
10927 | if ((res >> 26) != ALC880_HP_EVENT) | |
10928 | return; | |
10929 | alc262_hp_wildwest_automute(codec); | |
10930 | } | |
10931 | ||
b72519b5 | 10932 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
ce875f07 TI |
10933 | |
10934 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
10935 | struct snd_ctl_elem_value *ucontrol) | |
10936 | { | |
10937 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10938 | struct alc_spec *spec = codec->spec; | |
10939 | int val = !!*ucontrol->value.integer.value; | |
10940 | ||
10941 | if (val == spec->master_sw) | |
10942 | return 0; | |
10943 | spec->master_sw = val; | |
10944 | alc262_hp_master_update(codec); | |
10945 | return 1; | |
10946 | } | |
10947 | ||
b72519b5 TI |
10948 | #define ALC262_HP_MASTER_SWITCH \ |
10949 | { \ | |
10950 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
10951 | .name = "Master Playback Switch", \ | |
10952 | .info = snd_ctl_boolean_mono_info, \ | |
10953 | .get = alc262_hp_master_sw_get, \ | |
10954 | .put = alc262_hp_master_sw_put, \ | |
5b0cb1d8 JK |
10955 | }, \ |
10956 | { \ | |
10957 | .iface = NID_MAPPING, \ | |
10958 | .name = "Master Playback Switch", \ | |
10959 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ | |
b72519b5 TI |
10960 | } |
10961 | ||
5b0cb1d8 | 10962 | |
9c7f852e | 10963 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
b72519b5 | 10964 | ALC262_HP_MASTER_SWITCH, |
9c7f852e TI |
10965 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
10966 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10967 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
10968 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
10969 | HDA_OUTPUT), | |
10970 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
10971 | HDA_OUTPUT), | |
9c7f852e TI |
10972 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
10973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 10974 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
10975 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
10976 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 10977 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
10978 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
10979 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
10980 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10981 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9c7f852e TI |
10982 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
10983 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
10984 | { } /* end */ | |
10985 | }; | |
10986 | ||
cd7509a4 | 10987 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
b72519b5 | 10988 | ALC262_HP_MASTER_SWITCH, |
cd7509a4 KY |
10989 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
10990 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
10991 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
10992 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
10993 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
10994 | HDA_OUTPUT), | |
10995 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
10996 | HDA_OUTPUT), | |
cd7509a4 KY |
10997 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
10998 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
cc69d12d | 10999 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
cd7509a4 KY |
11000 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11001 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11002 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11003 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
cd7509a4 KY |
11004 | { } /* end */ |
11005 | }; | |
11006 | ||
11007 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
11008 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11009 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 11010 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
cd7509a4 KY |
11011 | { } /* end */ |
11012 | }; | |
11013 | ||
66d2a9d6 | 11014 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
4f5d1706 | 11015 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
66d2a9d6 KY |
11016 | { |
11017 | struct alc_spec *spec = codec->spec; | |
66d2a9d6 | 11018 | |
a9fd4f3f | 11019 | spec->autocfg.hp_pins[0] = 0x15; |
dc99be47 | 11020 | spec->autocfg.speaker_pins[0] = 0x14; |
66d2a9d6 KY |
11021 | } |
11022 | ||
66d2a9d6 | 11023 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
86cd9298 TI |
11024 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11025 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
66d2a9d6 KY |
11026 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
11027 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11028 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11029 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11030 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11031 | { } /* end */ | |
11032 | }; | |
11033 | ||
11034 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
11035 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11036 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11037 | ||
11038 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11039 | { } | |
11040 | }; | |
11041 | ||
8c427226 | 11042 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
f2f48e18 TI |
11043 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11044 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
11045 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
11046 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
8c427226 KY |
11047 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11048 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11049 | { } /* end */ | |
11050 | }; | |
11051 | ||
11052 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
11053 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11054 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11055 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11056 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11057 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11058 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11061 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11063 | {} | |
11064 | }; | |
11065 | ||
11066 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
11067 | .num_items = 1, | |
11068 | .items = { | |
11069 | { "Line", 0x1 }, | |
11070 | }, | |
11071 | }; | |
11072 | ||
42171c17 TI |
11073 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
11074 | static void alc262_hippo_master_update(struct hda_codec *codec) | |
0724ea2a | 11075 | { |
42171c17 TI |
11076 | struct alc_spec *spec = codec->spec; |
11077 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11078 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
11079 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
11080 | unsigned int mute; | |
0724ea2a | 11081 | |
42171c17 TI |
11082 | /* HP */ |
11083 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; | |
11084 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, | |
11085 | HDA_AMP_MUTE, mute); | |
11086 | /* mute internal speaker per jack sense */ | |
11087 | if (spec->jack_present) | |
11088 | mute = HDA_AMP_MUTE; | |
11089 | if (line_nid) | |
11090 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, | |
11091 | HDA_AMP_MUTE, mute); | |
11092 | if (speaker_nid && speaker_nid != line_nid) | |
11093 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, | |
0724ea2a | 11094 | HDA_AMP_MUTE, mute); |
42171c17 TI |
11095 | } |
11096 | ||
11097 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get | |
11098 | ||
11099 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | |
11100 | struct snd_ctl_elem_value *ucontrol) | |
11101 | { | |
11102 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11103 | struct alc_spec *spec = codec->spec; | |
11104 | int val = !!*ucontrol->value.integer.value; | |
11105 | ||
11106 | if (val == spec->master_sw) | |
11107 | return 0; | |
11108 | spec->master_sw = val; | |
11109 | alc262_hippo_master_update(codec); | |
11110 | return 1; | |
11111 | } | |
11112 | ||
11113 | #define ALC262_HIPPO_MASTER_SWITCH \ | |
11114 | { \ | |
11115 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
11116 | .name = "Master Playback Switch", \ | |
11117 | .info = snd_ctl_boolean_mono_info, \ | |
11118 | .get = alc262_hippo_master_sw_get, \ | |
11119 | .put = alc262_hippo_master_sw_put, \ | |
5b0cb1d8 JK |
11120 | }, \ |
11121 | { \ | |
11122 | .iface = NID_MAPPING, \ | |
11123 | .name = "Master Playback Switch", \ | |
11124 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ | |
11125 | (SUBDEV_SPEAKER(0) << 16), \ | |
0724ea2a | 11126 | } |
42171c17 TI |
11127 | |
11128 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { | |
11129 | ALC262_HIPPO_MASTER_SWITCH, | |
11130 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11131 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11132 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11133 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11134 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11138 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11139 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11140 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11141 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11142 | { } /* end */ | |
11143 | }; | |
11144 | ||
11145 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | |
11146 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11147 | ALC262_HIPPO_MASTER_SWITCH, | |
11148 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11149 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11150 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11151 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11153 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11154 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11155 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11156 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11157 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11158 | { } /* end */ | |
11159 | }; | |
11160 | ||
11161 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11162 | static void alc262_hippo_automute(struct hda_codec *codec) | |
11163 | { | |
11164 | struct alc_spec *spec = codec->spec; | |
11165 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
42171c17 | 11166 | |
864f92be | 11167 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
42171c17 | 11168 | alc262_hippo_master_update(codec); |
0724ea2a | 11169 | } |
5b31954e | 11170 | |
42171c17 TI |
11171 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
11172 | { | |
11173 | if ((res >> 26) != ALC880_HP_EVENT) | |
11174 | return; | |
11175 | alc262_hippo_automute(codec); | |
11176 | } | |
11177 | ||
4f5d1706 | 11178 | static void alc262_hippo_setup(struct hda_codec *codec) |
42171c17 TI |
11179 | { |
11180 | struct alc_spec *spec = codec->spec; | |
11181 | ||
11182 | spec->autocfg.hp_pins[0] = 0x15; | |
11183 | spec->autocfg.speaker_pins[0] = 0x14; | |
42171c17 TI |
11184 | } |
11185 | ||
4f5d1706 | 11186 | static void alc262_hippo1_setup(struct hda_codec *codec) |
42171c17 TI |
11187 | { |
11188 | struct alc_spec *spec = codec->spec; | |
11189 | ||
11190 | spec->autocfg.hp_pins[0] = 0x1b; | |
11191 | spec->autocfg.speaker_pins[0] = 0x14; | |
42171c17 TI |
11192 | } |
11193 | ||
11194 | ||
272a527c | 11195 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
0724ea2a | 11196 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
42171c17 | 11197 | ALC262_HIPPO_MASTER_SWITCH, |
272a527c KY |
11198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11200 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11201 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11202 | { } /* end */ | |
11203 | }; | |
11204 | ||
83c34218 | 11205 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
42171c17 TI |
11206 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11207 | ALC262_HIPPO_MASTER_SWITCH, | |
83c34218 KY |
11208 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
11209 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11210 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11211 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11212 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11213 | { } /* end */ | |
11214 | }; | |
272a527c | 11215 | |
ba340e82 TV |
11216 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
11217 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11218 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
11219 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
11220 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
11221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11222 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11225 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11226 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11227 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11228 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11229 | { } /* end */ | |
11230 | }; | |
11231 | ||
11232 | static struct hda_verb alc262_tyan_verbs[] = { | |
11233 | /* Headphone automute */ | |
11234 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11235 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11236 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11237 | ||
11238 | /* P11 AUX_IN, white 4-pin connector */ | |
11239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11240 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | |
11241 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | |
11242 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | |
11243 | ||
11244 | {} | |
11245 | }; | |
11246 | ||
11247 | /* unsolicited event for HP jack sensing */ | |
4f5d1706 | 11248 | static void alc262_tyan_setup(struct hda_codec *codec) |
ba340e82 | 11249 | { |
a9fd4f3f | 11250 | struct alc_spec *spec = codec->spec; |
ba340e82 | 11251 | |
a9fd4f3f TI |
11252 | spec->autocfg.hp_pins[0] = 0x1b; |
11253 | spec->autocfg.speaker_pins[0] = 0x15; | |
ba340e82 TV |
11254 | } |
11255 | ||
ba340e82 | 11256 | |
9c7f852e TI |
11257 | #define alc262_capture_mixer alc882_capture_mixer |
11258 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
11259 | ||
11260 | /* | |
11261 | * generic initialization of ADC, input mixers and output mixers | |
11262 | */ | |
11263 | static struct hda_verb alc262_init_verbs[] = { | |
11264 | /* | |
11265 | * Unmute ADC0-2 and set the default input to mic-in | |
11266 | */ | |
11267 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11268 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11269 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11270 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11271 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11272 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11273 | ||
cb53c626 | 11274 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 11275 | * mixer widget |
f12ab1e0 TI |
11276 | * Note: PASD motherboards uses the Line In 2 as the input for |
11277 | * front panel mic (mic 2) | |
9c7f852e TI |
11278 | */ |
11279 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
11280 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
11281 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11282 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11283 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11284 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
11285 | |
11286 | /* | |
df694daa KY |
11287 | * Set up output mixers (0x0c - 0x0e) |
11288 | */ | |
11289 | /* set vol=0 to output mixers */ | |
11290 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11291 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11292 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11293 | /* set up input amps for analog loopback */ | |
11294 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11295 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11297 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11298 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11299 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11300 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11301 | ||
11302 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11303 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11304 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11305 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11306 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11307 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11308 | ||
11309 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11310 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11311 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11312 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11313 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
ea1fb29a | 11314 | |
df694daa KY |
11315 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
11316 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
ea1fb29a | 11317 | |
df694daa KY |
11318 | /* FIXME: use matrix-type input source selection */ |
11319 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11320 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11323 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11324 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11325 | /* Input mixer2 */ | |
11326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11330 | /* Input mixer3 */ | |
11331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
f12ab1e0 | 11334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
df694daa KY |
11335 | |
11336 | { } | |
11337 | }; | |
1da177e4 | 11338 | |
4e555fe5 KY |
11339 | static struct hda_verb alc262_eapd_verbs[] = { |
11340 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11341 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11342 | { } | |
11343 | }; | |
11344 | ||
ccc656ce KY |
11345 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
11346 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11347 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11348 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11349 | ||
11350 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11351 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11352 | {} | |
11353 | }; | |
11354 | ||
272a527c KY |
11355 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
11356 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11357 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11358 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
11359 | ||
11360 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11361 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7b1e8795 | 11362 | {} |
272a527c KY |
11363 | }; |
11364 | ||
4e555fe5 KY |
11365 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
11366 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11367 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11368 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11369 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11370 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4e555fe5 KY |
11371 | { } /* end */ |
11372 | }; | |
11373 | ||
11374 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | |
11375 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11377 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11378 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11379 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | |
11380 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11381 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11382 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11383 | {} | |
11384 | }; | |
11385 | ||
4f5d1706 | 11386 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
4e555fe5 | 11387 | { |
a9fd4f3f TI |
11388 | struct alc_spec *spec = codec->spec; |
11389 | ||
11390 | spec->autocfg.hp_pins[0] = 0x15; | |
11391 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
11392 | spec->ext_mic.pin = 0x18; |
11393 | spec->ext_mic.mux_idx = 0; | |
11394 | spec->int_mic.pin = 0x12; | |
11395 | spec->int_mic.mux_idx = 9; | |
11396 | spec->auto_mic = 1; | |
4e555fe5 KY |
11397 | } |
11398 | ||
e8f9ae2a PT |
11399 | /* |
11400 | * nec model | |
11401 | * 0x15 = headphone | |
11402 | * 0x16 = internal speaker | |
11403 | * 0x18 = external mic | |
11404 | */ | |
11405 | ||
11406 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | |
11407 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
11408 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | |
11409 | ||
11410 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11411 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11412 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11413 | ||
11414 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11415 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11416 | { } /* end */ | |
11417 | }; | |
11418 | ||
11419 | static struct hda_verb alc262_nec_verbs[] = { | |
11420 | /* Unmute Speaker */ | |
11421 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11422 | ||
11423 | /* Headphone */ | |
11424 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11425 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11426 | ||
11427 | /* External mic to headphone */ | |
11428 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11429 | /* External mic to speaker */ | |
11430 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11431 | {} | |
11432 | }; | |
11433 | ||
834be88d TI |
11434 | /* |
11435 | * fujitsu model | |
5d9fab2d TV |
11436 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
11437 | * 0x1b = port replicator headphone out | |
834be88d TI |
11438 | */ |
11439 | ||
11440 | #define ALC_HP_EVENT 0x37 | |
11441 | ||
11442 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
11443 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11444 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5d9fab2d TV |
11445 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
11446 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
834be88d TI |
11447 | {} |
11448 | }; | |
11449 | ||
0e31daf7 J |
11450 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
11451 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11452 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11453 | {} | |
11454 | }; | |
11455 | ||
e2595322 DC |
11456 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
11457 | /* Front Mic pin: input vref at 50% */ | |
11458 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
11459 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11460 | {} | |
11461 | }; | |
11462 | ||
834be88d | 11463 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
39d3ed38 | 11464 | .num_items = 3, |
834be88d TI |
11465 | .items = { |
11466 | { "Mic", 0x0 }, | |
39d3ed38 | 11467 | { "Int Mic", 0x1 }, |
834be88d TI |
11468 | { "CD", 0x4 }, |
11469 | }, | |
11470 | }; | |
11471 | ||
9c7f852e TI |
11472 | static struct hda_input_mux alc262_HP_capture_source = { |
11473 | .num_items = 5, | |
11474 | .items = { | |
11475 | { "Mic", 0x0 }, | |
accbe498 | 11476 | { "Front Mic", 0x1 }, |
9c7f852e TI |
11477 | { "Line", 0x2 }, |
11478 | { "CD", 0x4 }, | |
11479 | { "AUX IN", 0x6 }, | |
11480 | }, | |
11481 | }; | |
11482 | ||
accbe498 | 11483 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
11484 | .num_items = 4, | |
11485 | .items = { | |
11486 | { "Mic", 0x0 }, | |
11487 | { "Front Mic", 0x2 }, | |
11488 | { "Line", 0x1 }, | |
11489 | { "CD", 0x4 }, | |
11490 | }, | |
11491 | }; | |
11492 | ||
ebc7a406 | 11493 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
834be88d TI |
11494 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
11495 | { | |
11496 | struct alc_spec *spec = codec->spec; | |
11497 | unsigned int mute; | |
11498 | ||
f12ab1e0 | 11499 | if (force || !spec->sense_updated) { |
864f92be WF |
11500 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
11501 | snd_hda_jack_detect(codec, 0x1b); | |
834be88d TI |
11502 | spec->sense_updated = 1; |
11503 | } | |
ebc7a406 TI |
11504 | /* unmute internal speaker only if both HPs are unplugged and |
11505 | * master switch is on | |
11506 | */ | |
11507 | if (spec->jack_present) | |
11508 | mute = HDA_AMP_MUTE; | |
11509 | else | |
834be88d | 11510 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
ebc7a406 TI |
11511 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
11512 | HDA_AMP_MUTE, mute); | |
834be88d TI |
11513 | } |
11514 | ||
11515 | /* unsolicited event for HP jack sensing */ | |
11516 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
11517 | unsigned int res) | |
11518 | { | |
11519 | if ((res >> 26) != ALC_HP_EVENT) | |
11520 | return; | |
11521 | alc262_fujitsu_automute(codec, 1); | |
11522 | } | |
11523 | ||
ebc7a406 TI |
11524 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
11525 | { | |
11526 | alc262_fujitsu_automute(codec, 1); | |
11527 | } | |
11528 | ||
834be88d | 11529 | /* bind volumes of both NID 0x0c and 0x0d */ |
cca3b371 TI |
11530 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
11531 | .ops = &snd_hda_bind_vol, | |
11532 | .values = { | |
11533 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
11534 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
11535 | 0 | |
11536 | }, | |
11537 | }; | |
834be88d | 11538 | |
0e31daf7 J |
11539 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
11540 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
11541 | { | |
11542 | struct alc_spec *spec = codec->spec; | |
11543 | unsigned int mute; | |
11544 | ||
11545 | if (force || !spec->sense_updated) { | |
864f92be | 11546 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
0e31daf7 J |
11547 | spec->sense_updated = 1; |
11548 | } | |
11549 | if (spec->jack_present) { | |
11550 | /* mute internal speaker */ | |
11551 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11552 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11553 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11554 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11555 | } else { | |
11556 | /* unmute internal speaker if necessary */ | |
11557 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
11558 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11559 | HDA_AMP_MUTE, mute); | |
11560 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11561 | HDA_AMP_MUTE, mute); | |
11562 | } | |
11563 | } | |
11564 | ||
11565 | /* unsolicited event for HP jack sensing */ | |
11566 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
11567 | unsigned int res) | |
11568 | { | |
11569 | if ((res >> 26) != ALC_HP_EVENT) | |
11570 | return; | |
11571 | alc262_lenovo_3000_automute(codec, 1); | |
11572 | } | |
11573 | ||
8de56b7d TI |
11574 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
11575 | int dir, int idx, long *valp) | |
11576 | { | |
11577 | int i, change = 0; | |
11578 | ||
11579 | for (i = 0; i < 2; i++, valp++) | |
11580 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, | |
11581 | HDA_AMP_MUTE, | |
11582 | *valp ? 0 : HDA_AMP_MUTE); | |
11583 | return change; | |
11584 | } | |
11585 | ||
834be88d TI |
11586 | /* bind hp and internal speaker mute (with plug check) */ |
11587 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
11588 | struct snd_ctl_elem_value *ucontrol) | |
11589 | { | |
11590 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11591 | long *valp = ucontrol->value.integer.value; | |
11592 | int change; | |
11593 | ||
8de56b7d TI |
11594 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
11595 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
82beb8fd TI |
11596 | if (change) |
11597 | alc262_fujitsu_automute(codec, 0); | |
834be88d TI |
11598 | return change; |
11599 | } | |
11600 | ||
11601 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
cca3b371 | 11602 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
834be88d TI |
11603 | { |
11604 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11605 | .name = "Master Playback Switch", | |
5e26dfd0 | 11606 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
834be88d TI |
11607 | .info = snd_hda_mixer_amp_switch_info, |
11608 | .get = snd_hda_mixer_amp_switch_get, | |
11609 | .put = alc262_fujitsu_master_sw_put, | |
11610 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
11611 | }, | |
5b0cb1d8 JK |
11612 | { |
11613 | .iface = NID_MAPPING, | |
11614 | .name = "Master Playback Switch", | |
11615 | .private_value = 0x1b, | |
11616 | }, | |
834be88d TI |
11617 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
11618 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11619 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11620 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11621 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
39d3ed38 TI |
11622 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
11623 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11624 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
834be88d TI |
11625 | { } /* end */ |
11626 | }; | |
11627 | ||
0e31daf7 J |
11628 | /* bind hp and internal speaker mute (with plug check) */ |
11629 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
11630 | struct snd_ctl_elem_value *ucontrol) | |
11631 | { | |
11632 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11633 | long *valp = ucontrol->value.integer.value; | |
11634 | int change; | |
11635 | ||
8de56b7d | 11636 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
0e31daf7 J |
11637 | if (change) |
11638 | alc262_lenovo_3000_automute(codec, 0); | |
11639 | return change; | |
11640 | } | |
11641 | ||
11642 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
11643 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11644 | { | |
11645 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11646 | .name = "Master Playback Switch", | |
5e26dfd0 | 11647 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
0e31daf7 J |
11648 | .info = snd_hda_mixer_amp_switch_info, |
11649 | .get = snd_hda_mixer_amp_switch_get, | |
11650 | .put = alc262_lenovo_3000_master_sw_put, | |
11651 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
11652 | }, | |
11653 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11654 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11655 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11656 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11657 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11658 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
11659 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11660 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
11661 | { } /* end */ | |
11662 | }; | |
11663 | ||
9f99a638 HM |
11664 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
11665 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
42171c17 | 11666 | ALC262_HIPPO_MASTER_SWITCH, |
9f99a638 HM |
11667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11670 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11671 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11672 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11673 | { } /* end */ | |
11674 | }; | |
11675 | ||
304dcaac TI |
11676 | /* additional init verbs for Benq laptops */ |
11677 | static struct hda_verb alc262_EAPD_verbs[] = { | |
11678 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11679 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
11680 | {} | |
11681 | }; | |
11682 | ||
83c34218 KY |
11683 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
11684 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11685 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11686 | ||
11687 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11688 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
11689 | {} | |
11690 | }; | |
11691 | ||
f651b50b TD |
11692 | /* Samsung Q1 Ultra Vista model setup */ |
11693 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
bb9f76cd TI |
11694 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11695 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
f651b50b TD |
11696 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11697 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11698 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
bb9f76cd | 11699 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
f651b50b TD |
11700 | { } /* end */ |
11701 | }; | |
11702 | ||
11703 | static struct hda_verb alc262_ultra_verbs[] = { | |
bb9f76cd TI |
11704 | /* output mixer */ |
11705 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11706 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11708 | /* speaker */ | |
11709 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11710 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11711 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11712 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11713 | /* HP */ | |
f651b50b | 11714 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
bb9f76cd TI |
11715 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11716 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11717 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11718 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11719 | /* internal mic */ | |
11720 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
11721 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11722 | /* ADC, choose mic */ | |
11723 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11724 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11725 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11726 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11727 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11728 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11729 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
11730 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
11731 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
11732 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
f651b50b TD |
11733 | {} |
11734 | }; | |
11735 | ||
f651b50b TD |
11736 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
11737 | static void alc262_ultra_automute(struct hda_codec *codec) | |
11738 | { | |
11739 | struct alc_spec *spec = codec->spec; | |
11740 | unsigned int mute; | |
f651b50b | 11741 | |
bb9f76cd TI |
11742 | mute = 0; |
11743 | /* auto-mute only when HP is used as HP */ | |
11744 | if (!spec->cur_mux[0]) { | |
864f92be | 11745 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
bb9f76cd TI |
11746 | if (spec->jack_present) |
11747 | mute = HDA_AMP_MUTE; | |
f651b50b | 11748 | } |
bb9f76cd TI |
11749 | /* mute/unmute internal speaker */ |
11750 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11751 | HDA_AMP_MUTE, mute); | |
11752 | /* mute/unmute HP */ | |
11753 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
11754 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
f651b50b TD |
11755 | } |
11756 | ||
11757 | /* unsolicited event for HP jack sensing */ | |
11758 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
11759 | unsigned int res) | |
11760 | { | |
11761 | if ((res >> 26) != ALC880_HP_EVENT) | |
11762 | return; | |
11763 | alc262_ultra_automute(codec); | |
11764 | } | |
11765 | ||
bb9f76cd TI |
11766 | static struct hda_input_mux alc262_ultra_capture_source = { |
11767 | .num_items = 2, | |
11768 | .items = { | |
11769 | { "Mic", 0x1 }, | |
11770 | { "Headphone", 0x7 }, | |
11771 | }, | |
11772 | }; | |
11773 | ||
11774 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
11775 | struct snd_ctl_elem_value *ucontrol) | |
11776 | { | |
11777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11778 | struct alc_spec *spec = codec->spec; | |
11779 | int ret; | |
11780 | ||
54cbc9ab | 11781 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
bb9f76cd TI |
11782 | if (!ret) |
11783 | return 0; | |
11784 | /* reprogram the HP pin as mic or HP according to the input source */ | |
11785 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
11786 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11787 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
11788 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
11789 | return ret; | |
11790 | } | |
11791 | ||
11792 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
11793 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
11794 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
11795 | { | |
11796 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11797 | .name = "Capture Source", | |
54cbc9ab TI |
11798 | .info = alc_mux_enum_info, |
11799 | .get = alc_mux_enum_get, | |
bb9f76cd TI |
11800 | .put = alc262_ultra_mux_enum_put, |
11801 | }, | |
5b0cb1d8 JK |
11802 | { |
11803 | .iface = NID_MAPPING, | |
11804 | .name = "Capture Source", | |
11805 | .private_value = 0x15, | |
11806 | }, | |
bb9f76cd TI |
11807 | { } /* end */ |
11808 | }; | |
11809 | ||
c3fc1f50 TI |
11810 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
11811 | * and thus it's bound with a different mixer. | |
11812 | * This function returns which mixer amp should be used. | |
11813 | */ | |
11814 | static int alc262_check_volbit(hda_nid_t nid) | |
11815 | { | |
11816 | if (!nid) | |
11817 | return 0; | |
11818 | else if (nid == 0x16) | |
11819 | return 2; | |
11820 | else | |
11821 | return 1; | |
11822 | } | |
11823 | ||
11824 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | |
033688a5 | 11825 | const char *pfx, int *vbits, int idx) |
c3fc1f50 | 11826 | { |
c3fc1f50 TI |
11827 | unsigned long val; |
11828 | int vbit; | |
11829 | ||
11830 | vbit = alc262_check_volbit(nid); | |
11831 | if (!vbit) | |
11832 | return 0; | |
11833 | if (*vbits & vbit) /* a volume control for this mixer already there */ | |
11834 | return 0; | |
11835 | *vbits |= vbit; | |
c3fc1f50 TI |
11836 | if (vbit == 2) |
11837 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | |
11838 | else | |
11839 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | |
033688a5 | 11840 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val); |
c3fc1f50 TI |
11841 | } |
11842 | ||
11843 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | |
033688a5 | 11844 | const char *pfx, int idx) |
c3fc1f50 | 11845 | { |
c3fc1f50 TI |
11846 | unsigned long val; |
11847 | ||
11848 | if (!nid) | |
11849 | return 0; | |
c3fc1f50 TI |
11850 | if (nid == 0x16) |
11851 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
11852 | else | |
11853 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
033688a5 | 11854 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val); |
c3fc1f50 TI |
11855 | } |
11856 | ||
df694daa | 11857 | /* add playback controls from the parsed DAC table */ |
f12ab1e0 TI |
11858 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
11859 | const struct auto_pin_cfg *cfg) | |
df694daa | 11860 | { |
c3fc1f50 TI |
11861 | const char *pfx; |
11862 | int vbits; | |
033688a5 | 11863 | int i, err; |
df694daa KY |
11864 | |
11865 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
11866 | spec->multiout.dac_nids = spec->private_dac_nids; | |
11867 | spec->multiout.dac_nids[0] = 2; | |
11868 | ||
c3fc1f50 TI |
11869 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
11870 | pfx = "Master"; | |
11871 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
11872 | pfx = "Speaker"; | |
033688a5 TI |
11873 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) |
11874 | pfx = "Headphone"; | |
c3fc1f50 TI |
11875 | else |
11876 | pfx = "Front"; | |
033688a5 TI |
11877 | for (i = 0; i < 2; i++) { |
11878 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); | |
11879 | if (err < 0) | |
11880 | return err; | |
11881 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | |
11882 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], | |
11883 | "Speaker", i); | |
11884 | if (err < 0) | |
11885 | return err; | |
11886 | } | |
11887 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | |
11888 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], | |
11889 | "Headphone", i); | |
11890 | if (err < 0) | |
11891 | return err; | |
11892 | } | |
11893 | } | |
df694daa | 11894 | |
c3fc1f50 TI |
11895 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
11896 | alc262_check_volbit(cfg->speaker_pins[0]) | | |
11897 | alc262_check_volbit(cfg->hp_pins[0]); | |
11898 | if (vbits == 1 || vbits == 2) | |
11899 | pfx = "Master"; /* only one mixer is used */ | |
c3fc1f50 | 11900 | vbits = 0; |
033688a5 TI |
11901 | for (i = 0; i < 2; i++) { |
11902 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, | |
11903 | &vbits, i); | |
11904 | if (err < 0) | |
11905 | return err; | |
11906 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | |
11907 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], | |
11908 | "Speaker", &vbits, i); | |
11909 | if (err < 0) | |
11910 | return err; | |
11911 | } | |
11912 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | |
11913 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], | |
11914 | "Headphone", &vbits, i); | |
11915 | if (err < 0) | |
11916 | return err; | |
11917 | } | |
11918 | } | |
f12ab1e0 | 11919 | return 0; |
df694daa KY |
11920 | } |
11921 | ||
05f5f477 | 11922 | #define alc262_auto_create_input_ctls \ |
eaa9b3a7 | 11923 | alc882_auto_create_input_ctls |
df694daa KY |
11924 | |
11925 | /* | |
11926 | * generic initialization of ADC, input mixers and output mixers | |
11927 | */ | |
11928 | static struct hda_verb alc262_volume_init_verbs[] = { | |
11929 | /* | |
11930 | * Unmute ADC0-2 and set the default input to mic-in | |
11931 | */ | |
11932 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11933 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11934 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11935 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11936 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11937 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11938 | ||
cb53c626 | 11939 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 11940 | * mixer widget |
f12ab1e0 TI |
11941 | * Note: PASD motherboards uses the Line In 2 as the input for |
11942 | * front panel mic (mic 2) | |
df694daa KY |
11943 | */ |
11944 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
11945 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
11946 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11947 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11948 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11949 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
11950 | |
11951 | /* | |
11952 | * Set up output mixers (0x0c - 0x0f) | |
11953 | */ | |
11954 | /* set vol=0 to output mixers */ | |
11955 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11956 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11957 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
ea1fb29a | 11958 | |
df694daa KY |
11959 | /* set up input amps for analog loopback */ |
11960 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11961 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11962 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11963 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11964 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11965 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11966 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11967 | ||
11968 | /* FIXME: use matrix-type input source selection */ | |
11969 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11970 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11972 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11975 | /* Input mixer2 */ | |
11976 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11977 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11980 | /* Input mixer3 */ | |
11981 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11982 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11985 | ||
11986 | { } | |
11987 | }; | |
11988 | ||
9c7f852e TI |
11989 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
11990 | /* | |
11991 | * Unmute ADC0-2 and set the default input to mic-in | |
11992 | */ | |
11993 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11994 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11995 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11996 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11997 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11998 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11999 | ||
cb53c626 | 12000 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 12001 | * mixer widget |
f12ab1e0 TI |
12002 | * Note: PASD motherboards uses the Line In 2 as the input for |
12003 | * front panel mic (mic 2) | |
9c7f852e TI |
12004 | */ |
12005 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12006 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12009 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12010 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
ea1fb29a | 12013 | |
9c7f852e TI |
12014 | /* |
12015 | * Set up output mixers (0x0c - 0x0e) | |
12016 | */ | |
12017 | /* set vol=0 to output mixers */ | |
12018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12019 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12020 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12021 | ||
12022 | /* set up input amps for analog loopback */ | |
12023 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12026 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12028 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12029 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12030 | ||
ce875f07 | 12031 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
9c7f852e TI |
12032 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
12033 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12034 | ||
12035 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12036 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12037 | ||
12038 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12039 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12040 | ||
12041 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12042 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12043 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12044 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12045 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12046 | ||
0e4835c1 | 12047 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
9c7f852e TI |
12048 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
12049 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
0e4835c1 | 12050 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
9c7f852e TI |
12051 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
12052 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12053 | ||
12054 | ||
12055 | /* FIXME: use matrix-type input source selection */ | |
0e4835c1 JK |
12056 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
12057 | /* Input mixer1: only unmute Mic */ | |
9c7f852e | 12058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
0e4835c1 JK |
12059 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12060 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12061 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12064 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12065 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12066 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e TI |
12067 | /* Input mixer2 */ |
12068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
0e4835c1 JK |
12069 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12071 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12072 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12073 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12074 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12075 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12076 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e TI |
12077 | /* Input mixer3 */ |
12078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
0e4835c1 JK |
12079 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12082 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e | 12087 | |
ce875f07 TI |
12088 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12089 | ||
9c7f852e TI |
12090 | { } |
12091 | }; | |
12092 | ||
cd7509a4 KY |
12093 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
12094 | /* | |
12095 | * Unmute ADC0-2 and set the default input to mic-in | |
12096 | */ | |
12097 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12098 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12099 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12100 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12101 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12103 | ||
cb53c626 | 12104 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
cd7509a4 KY |
12105 | * mixer widget |
12106 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
12107 | * panel mic (mic 2) | |
12108 | */ | |
12109 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
12117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
cd7509a4 KY |
12118 | /* |
12119 | * Set up output mixers (0x0c - 0x0e) | |
12120 | */ | |
12121 | /* set vol=0 to output mixers */ | |
12122 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12123 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12124 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12125 | ||
12126 | /* set up input amps for analog loopback */ | |
12127 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12128 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12132 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12134 | ||
12135 | ||
12136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
12137 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
12138 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
12139 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
12140 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12141 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
12142 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
12143 | ||
12144 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12145 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12146 | ||
12147 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12148 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12149 | ||
12150 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
12151 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12152 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12153 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
12154 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12155 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12156 | ||
12157 | /* FIXME: use matrix-type input source selection */ | |
12158 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
12159 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12160 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
12161 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
12162 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
12163 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
12164 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
12165 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12166 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
12167 | /* Input mixer2 */ | |
12168 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12169 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12170 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12171 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12173 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12174 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12175 | /* Input mixer3 */ | |
12176 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12181 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12182 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12183 | ||
ce875f07 TI |
12184 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12185 | ||
cd7509a4 KY |
12186 | { } |
12187 | }; | |
12188 | ||
9f99a638 HM |
12189 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
12190 | ||
12191 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | |
12192 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12193 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12194 | ||
12195 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | |
12196 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12197 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12198 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12199 | ||
12200 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | |
12201 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12202 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
12203 | {} | |
12204 | }; | |
12205 | ||
18675e42 TI |
12206 | /* |
12207 | * Pin config fixes | |
12208 | */ | |
12209 | enum { | |
12210 | PINFIX_FSC_H270, | |
12211 | }; | |
12212 | ||
12213 | static const struct alc_fixup alc262_fixups[] = { | |
12214 | [PINFIX_FSC_H270] = { | |
12215 | .pins = (const struct alc_pincfg[]) { | |
12216 | { 0x14, 0x99130110 }, /* speaker */ | |
12217 | { 0x15, 0x0221142f }, /* front HP */ | |
12218 | { 0x1b, 0x0121141f }, /* rear HP */ | |
12219 | { } | |
12220 | } | |
12221 | }, | |
12222 | [PINFIX_PB_M5210] = { | |
12223 | .verbs = (const struct hda_verb[]) { | |
12224 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | |
12225 | {} | |
12226 | } | |
12227 | }, | |
12228 | }; | |
12229 | ||
12230 | static struct snd_pci_quirk alc262_fixup_tbl[] = { | |
12231 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), | |
12232 | {} | |
12233 | }; | |
12234 | ||
9f99a638 | 12235 | |
cb53c626 TI |
12236 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12237 | #define alc262_loopbacks alc880_loopbacks | |
12238 | #endif | |
12239 | ||
def319f9 | 12240 | /* pcm configuration: identical with ALC880 */ |
df694daa KY |
12241 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
12242 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
12243 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
12244 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
12245 | ||
12246 | /* | |
12247 | * BIOS auto configuration | |
12248 | */ | |
12249 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
12250 | { | |
12251 | struct alc_spec *spec = codec->spec; | |
12252 | int err; | |
12253 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
12254 | ||
f12ab1e0 TI |
12255 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
12256 | alc262_ignore); | |
12257 | if (err < 0) | |
df694daa | 12258 | return err; |
e64f14f4 | 12259 | if (!spec->autocfg.line_outs) { |
0852d7a6 | 12260 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
e64f14f4 TI |
12261 | spec->multiout.max_channels = 2; |
12262 | spec->no_analog = 1; | |
12263 | goto dig_only; | |
12264 | } | |
df694daa | 12265 | return 0; /* can't find valid BIOS pin config */ |
e64f14f4 | 12266 | } |
f12ab1e0 TI |
12267 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
12268 | if (err < 0) | |
12269 | return err; | |
05f5f477 | 12270 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 12271 | if (err < 0) |
df694daa KY |
12272 | return err; |
12273 | ||
12274 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
12275 | ||
e64f14f4 | 12276 | dig_only: |
757899ac | 12277 | alc_auto_parse_digital(codec); |
df694daa | 12278 | |
603c4019 | 12279 | if (spec->kctls.list) |
d88897ea | 12280 | add_mixer(spec, spec->kctls.list); |
df694daa | 12281 | |
d88897ea | 12282 | add_verb(spec, alc262_volume_init_verbs); |
a1e8d2da | 12283 | spec->num_mux_defs = 1; |
61b9b9b1 | 12284 | spec->input_mux = &spec->private_imux[0]; |
df694daa | 12285 | |
776e184e TI |
12286 | err = alc_auto_add_mic_boost(codec); |
12287 | if (err < 0) | |
12288 | return err; | |
12289 | ||
6227cdce | 12290 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 12291 | |
df694daa KY |
12292 | return 1; |
12293 | } | |
12294 | ||
12295 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
12296 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
12297 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
f511b01c | 12298 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
df694daa KY |
12299 | |
12300 | ||
12301 | /* init callback for auto-configuration model -- overriding the default init */ | |
ae6b813a | 12302 | static void alc262_auto_init(struct hda_codec *codec) |
df694daa | 12303 | { |
f6c7e546 | 12304 | struct alc_spec *spec = codec->spec; |
df694daa KY |
12305 | alc262_auto_init_multi_out(codec); |
12306 | alc262_auto_init_hp_out(codec); | |
12307 | alc262_auto_init_analog_input(codec); | |
f511b01c | 12308 | alc262_auto_init_input_src(codec); |
757899ac | 12309 | alc_auto_init_digital(codec); |
f6c7e546 | 12310 | if (spec->unsol_event) |
7fb0d78f | 12311 | alc_inithook(codec); |
df694daa KY |
12312 | } |
12313 | ||
12314 | /* | |
12315 | * configuration and preset | |
12316 | */ | |
f5fcc13c TI |
12317 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
12318 | [ALC262_BASIC] = "basic", | |
12319 | [ALC262_HIPPO] = "hippo", | |
12320 | [ALC262_HIPPO_1] = "hippo_1", | |
12321 | [ALC262_FUJITSU] = "fujitsu", | |
12322 | [ALC262_HP_BPC] = "hp-bpc", | |
cd7509a4 | 12323 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
61dc35de | 12324 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
8c427226 | 12325 | [ALC262_HP_RP5700] = "hp-rp5700", |
f5fcc13c | 12326 | [ALC262_BENQ_ED8] = "benq", |
0f40502e TI |
12327 | [ALC262_BENQ_T31] = "benq-t31", |
12328 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
2922c9af | 12329 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
9f99a638 | 12330 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
f651b50b | 12331 | [ALC262_ULTRA] = "ultra", |
0e31daf7 | 12332 | [ALC262_LENOVO_3000] = "lenovo-3000", |
e8f9ae2a | 12333 | [ALC262_NEC] = "nec", |
ba340e82 | 12334 | [ALC262_TYAN] = "tyan", |
f5fcc13c TI |
12335 | [ALC262_AUTO] = "auto", |
12336 | }; | |
12337 | ||
12338 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
12339 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
e8f9ae2a | 12340 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
dea0a509 TI |
12341 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
12342 | ALC262_HP_BPC), | |
12343 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", | |
12344 | ALC262_HP_BPC), | |
53eff7e1 TI |
12345 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
12346 | ALC262_HP_BPC), | |
cd7509a4 | 12347 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12348 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12349 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12350 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12351 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12352 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12353 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12354 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 TI |
12355 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
12356 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
12357 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
66d2a9d6 KY |
12358 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
12359 | ALC262_HP_TC_T5735), | |
8c427226 | 12360 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
ac3e3741 | 12361 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
f5fcc13c | 12362 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
5b31954e | 12363 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
bd6afe3f | 12364 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
376b508f | 12365 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
95491d90 | 12366 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
12929bae | 12367 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
c5b5165c | 12368 | #if 0 /* disable the quirk since model=auto works better in recent versions */ |
f872a919 TI |
12369 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
12370 | ALC262_SONY_ASSAMD), | |
c5b5165c | 12371 | #endif |
36ca6e13 | 12372 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
9f99a638 | 12373 | ALC262_TOSHIBA_RX1), |
80ffe869 | 12374 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
ac3e3741 | 12375 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
3f1eeaed | 12376 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
ba340e82 | 12377 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
dea0a509 TI |
12378 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
12379 | ALC262_ULTRA), | |
3e420e78 | 12380 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
0e31daf7 | 12381 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
ac3e3741 TI |
12382 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
12383 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
12384 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
df694daa KY |
12385 | {} |
12386 | }; | |
12387 | ||
12388 | static struct alc_config_preset alc262_presets[] = { | |
12389 | [ALC262_BASIC] = { | |
12390 | .mixers = { alc262_base_mixer }, | |
12391 | .init_verbs = { alc262_init_verbs }, | |
12392 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12393 | .dac_nids = alc262_dac_nids, | |
12394 | .hp_nid = 0x03, | |
12395 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12396 | .channel_mode = alc262_modes, | |
a3bcba38 | 12397 | .input_mux = &alc262_capture_source, |
df694daa | 12398 | }, |
ccc656ce | 12399 | [ALC262_HIPPO] = { |
42171c17 | 12400 | .mixers = { alc262_hippo_mixer }, |
6732bd0d | 12401 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
ccc656ce KY |
12402 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12403 | .dac_nids = alc262_dac_nids, | |
12404 | .hp_nid = 0x03, | |
12405 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12406 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12407 | .channel_mode = alc262_modes, | |
12408 | .input_mux = &alc262_capture_source, | |
12409 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12410 | .setup = alc262_hippo_setup, |
12411 | .init_hook = alc262_hippo_automute, | |
ccc656ce KY |
12412 | }, |
12413 | [ALC262_HIPPO_1] = { | |
12414 | .mixers = { alc262_hippo1_mixer }, | |
12415 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
12416 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12417 | .dac_nids = alc262_dac_nids, | |
12418 | .hp_nid = 0x02, | |
12419 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12420 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12421 | .channel_mode = alc262_modes, | |
12422 | .input_mux = &alc262_capture_source, | |
42171c17 | 12423 | .unsol_event = alc262_hippo_unsol_event, |
4f5d1706 TI |
12424 | .setup = alc262_hippo1_setup, |
12425 | .init_hook = alc262_hippo_automute, | |
ccc656ce | 12426 | }, |
834be88d TI |
12427 | [ALC262_FUJITSU] = { |
12428 | .mixers = { alc262_fujitsu_mixer }, | |
39d3ed38 TI |
12429 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
12430 | alc262_fujitsu_unsol_verbs }, | |
834be88d TI |
12431 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12432 | .dac_nids = alc262_dac_nids, | |
12433 | .hp_nid = 0x03, | |
12434 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12435 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12436 | .channel_mode = alc262_modes, | |
12437 | .input_mux = &alc262_fujitsu_capture_source, | |
ae6b813a | 12438 | .unsol_event = alc262_fujitsu_unsol_event, |
ebc7a406 | 12439 | .init_hook = alc262_fujitsu_init_hook, |
834be88d | 12440 | }, |
9c7f852e TI |
12441 | [ALC262_HP_BPC] = { |
12442 | .mixers = { alc262_HP_BPC_mixer }, | |
12443 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
12444 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12445 | .dac_nids = alc262_dac_nids, | |
12446 | .hp_nid = 0x03, | |
12447 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12448 | .channel_mode = alc262_modes, | |
12449 | .input_mux = &alc262_HP_capture_source, | |
ce875f07 TI |
12450 | .unsol_event = alc262_hp_bpc_unsol_event, |
12451 | .init_hook = alc262_hp_bpc_automute, | |
f12ab1e0 | 12452 | }, |
cd7509a4 KY |
12453 | [ALC262_HP_BPC_D7000_WF] = { |
12454 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
12455 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12456 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12457 | .dac_nids = alc262_dac_nids, | |
12458 | .hp_nid = 0x03, | |
12459 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12460 | .channel_mode = alc262_modes, | |
accbe498 | 12461 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
12462 | .unsol_event = alc262_hp_wildwest_unsol_event, |
12463 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 12464 | }, |
cd7509a4 KY |
12465 | [ALC262_HP_BPC_D7000_WL] = { |
12466 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
12467 | alc262_HP_BPC_WildWest_option_mixer }, | |
12468 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12469 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12470 | .dac_nids = alc262_dac_nids, | |
12471 | .hp_nid = 0x03, | |
12472 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12473 | .channel_mode = alc262_modes, | |
accbe498 | 12474 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
12475 | .unsol_event = alc262_hp_wildwest_unsol_event, |
12476 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 12477 | }, |
66d2a9d6 KY |
12478 | [ALC262_HP_TC_T5735] = { |
12479 | .mixers = { alc262_hp_t5735_mixer }, | |
12480 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
12481 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12482 | .dac_nids = alc262_dac_nids, | |
12483 | .hp_nid = 0x03, | |
12484 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12485 | .channel_mode = alc262_modes, | |
12486 | .input_mux = &alc262_capture_source, | |
dc99be47 | 12487 | .unsol_event = alc_sku_unsol_event, |
4f5d1706 | 12488 | .setup = alc262_hp_t5735_setup, |
dc99be47 | 12489 | .init_hook = alc_inithook, |
8c427226 KY |
12490 | }, |
12491 | [ALC262_HP_RP5700] = { | |
12492 | .mixers = { alc262_hp_rp5700_mixer }, | |
12493 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
12494 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12495 | .dac_nids = alc262_dac_nids, | |
12496 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12497 | .channel_mode = alc262_modes, | |
12498 | .input_mux = &alc262_hp_rp5700_capture_source, | |
66d2a9d6 | 12499 | }, |
304dcaac TI |
12500 | [ALC262_BENQ_ED8] = { |
12501 | .mixers = { alc262_base_mixer }, | |
12502 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
12503 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12504 | .dac_nids = alc262_dac_nids, | |
12505 | .hp_nid = 0x03, | |
12506 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12507 | .channel_mode = alc262_modes, | |
12508 | .input_mux = &alc262_capture_source, | |
f12ab1e0 | 12509 | }, |
272a527c KY |
12510 | [ALC262_SONY_ASSAMD] = { |
12511 | .mixers = { alc262_sony_mixer }, | |
12512 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
12513 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12514 | .dac_nids = alc262_dac_nids, | |
12515 | .hp_nid = 0x02, | |
12516 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12517 | .channel_mode = alc262_modes, | |
12518 | .input_mux = &alc262_capture_source, | |
12519 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12520 | .setup = alc262_hippo_setup, |
12521 | .init_hook = alc262_hippo_automute, | |
83c34218 KY |
12522 | }, |
12523 | [ALC262_BENQ_T31] = { | |
12524 | .mixers = { alc262_benq_t31_mixer }, | |
6732bd0d WF |
12525 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
12526 | alc_hp15_unsol_verbs }, | |
83c34218 KY |
12527 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12528 | .dac_nids = alc262_dac_nids, | |
12529 | .hp_nid = 0x03, | |
12530 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12531 | .channel_mode = alc262_modes, | |
12532 | .input_mux = &alc262_capture_source, | |
12533 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12534 | .setup = alc262_hippo_setup, |
12535 | .init_hook = alc262_hippo_automute, | |
ea1fb29a | 12536 | }, |
f651b50b | 12537 | [ALC262_ULTRA] = { |
f9e336f6 TI |
12538 | .mixers = { alc262_ultra_mixer }, |
12539 | .cap_mixer = alc262_ultra_capture_mixer, | |
bb9f76cd | 12540 | .init_verbs = { alc262_ultra_verbs }, |
f651b50b TD |
12541 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12542 | .dac_nids = alc262_dac_nids, | |
f651b50b TD |
12543 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
12544 | .channel_mode = alc262_modes, | |
12545 | .input_mux = &alc262_ultra_capture_source, | |
bb9f76cd TI |
12546 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
12547 | .capsrc_nids = alc262_capsrc_nids, | |
12548 | .num_adc_nids = 1, /* single ADC */ | |
f651b50b TD |
12549 | .unsol_event = alc262_ultra_unsol_event, |
12550 | .init_hook = alc262_ultra_automute, | |
12551 | }, | |
0e31daf7 J |
12552 | [ALC262_LENOVO_3000] = { |
12553 | .mixers = { alc262_lenovo_3000_mixer }, | |
12554 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
e2595322 DC |
12555 | alc262_lenovo_3000_unsol_verbs, |
12556 | alc262_lenovo_3000_init_verbs }, | |
0e31daf7 J |
12557 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12558 | .dac_nids = alc262_dac_nids, | |
12559 | .hp_nid = 0x03, | |
12560 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12561 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12562 | .channel_mode = alc262_modes, | |
12563 | .input_mux = &alc262_fujitsu_capture_source, | |
12564 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
12565 | }, | |
e8f9ae2a PT |
12566 | [ALC262_NEC] = { |
12567 | .mixers = { alc262_nec_mixer }, | |
12568 | .init_verbs = { alc262_nec_verbs }, | |
12569 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12570 | .dac_nids = alc262_dac_nids, | |
12571 | .hp_nid = 0x03, | |
12572 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12573 | .channel_mode = alc262_modes, | |
12574 | .input_mux = &alc262_capture_source, | |
12575 | }, | |
4e555fe5 KY |
12576 | [ALC262_TOSHIBA_S06] = { |
12577 | .mixers = { alc262_toshiba_s06_mixer }, | |
12578 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | |
12579 | alc262_eapd_verbs }, | |
12580 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12581 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
12582 | .dac_nids = alc262_dac_nids, | |
12583 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | |
ae14ef68 | 12584 | .num_adc_nids = 1, /* single ADC */ |
4e555fe5 KY |
12585 | .dig_out_nid = ALC262_DIGOUT_NID, |
12586 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12587 | .channel_mode = alc262_modes, | |
4f5d1706 TI |
12588 | .unsol_event = alc_sku_unsol_event, |
12589 | .setup = alc262_toshiba_s06_setup, | |
12590 | .init_hook = alc_inithook, | |
4e555fe5 | 12591 | }, |
9f99a638 HM |
12592 | [ALC262_TOSHIBA_RX1] = { |
12593 | .mixers = { alc262_toshiba_rx1_mixer }, | |
12594 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | |
12595 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12596 | .dac_nids = alc262_dac_nids, | |
12597 | .hp_nid = 0x03, | |
12598 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12599 | .channel_mode = alc262_modes, | |
12600 | .input_mux = &alc262_capture_source, | |
12601 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12602 | .setup = alc262_hippo_setup, |
12603 | .init_hook = alc262_hippo_automute, | |
9f99a638 | 12604 | }, |
ba340e82 TV |
12605 | [ALC262_TYAN] = { |
12606 | .mixers = { alc262_tyan_mixer }, | |
12607 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | |
12608 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12609 | .dac_nids = alc262_dac_nids, | |
12610 | .hp_nid = 0x02, | |
12611 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12612 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12613 | .channel_mode = alc262_modes, | |
12614 | .input_mux = &alc262_capture_source, | |
a9fd4f3f | 12615 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
12616 | .setup = alc262_tyan_setup, |
12617 | .init_hook = alc_automute_amp, | |
ba340e82 | 12618 | }, |
df694daa KY |
12619 | }; |
12620 | ||
12621 | static int patch_alc262(struct hda_codec *codec) | |
12622 | { | |
12623 | struct alc_spec *spec; | |
12624 | int board_config; | |
12625 | int err; | |
12626 | ||
dc041e0b | 12627 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
12628 | if (spec == NULL) |
12629 | return -ENOMEM; | |
12630 | ||
12631 | codec->spec = spec; | |
12632 | #if 0 | |
f12ab1e0 TI |
12633 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
12634 | * under-run | |
12635 | */ | |
df694daa KY |
12636 | { |
12637 | int tmp; | |
12638 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12639 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
12640 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12641 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
12642 | } | |
12643 | #endif | |
da00c244 | 12644 | alc_auto_parse_customize_define(codec); |
df694daa | 12645 | |
2c3bf9ab TI |
12646 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
12647 | ||
f5fcc13c TI |
12648 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
12649 | alc262_models, | |
12650 | alc262_cfg_tbl); | |
cd7509a4 | 12651 | |
f5fcc13c | 12652 | if (board_config < 0) { |
9a11f1aa TI |
12653 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
12654 | codec->chip_name); | |
df694daa KY |
12655 | board_config = ALC262_AUTO; |
12656 | } | |
12657 | ||
18675e42 TI |
12658 | if (board_config == ALC262_AUTO) |
12659 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); | |
12660 | ||
df694daa KY |
12661 | if (board_config == ALC262_AUTO) { |
12662 | /* automatic parse from the BIOS config */ | |
12663 | err = alc262_parse_auto_config(codec); | |
12664 | if (err < 0) { | |
12665 | alc_free(codec); | |
12666 | return err; | |
f12ab1e0 | 12667 | } else if (!err) { |
9c7f852e TI |
12668 | printk(KERN_INFO |
12669 | "hda_codec: Cannot set up configuration " | |
12670 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
12671 | board_config = ALC262_BASIC; |
12672 | } | |
12673 | } | |
12674 | ||
dc1eae25 | 12675 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
07eba61d TI |
12676 | err = snd_hda_attach_beep_device(codec, 0x1); |
12677 | if (err < 0) { | |
12678 | alc_free(codec); | |
12679 | return err; | |
12680 | } | |
680cd536 KK |
12681 | } |
12682 | ||
df694daa | 12683 | if (board_config != ALC262_AUTO) |
e9c364c0 | 12684 | setup_preset(codec, &alc262_presets[board_config]); |
df694daa | 12685 | |
df694daa KY |
12686 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
12687 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
ea1fb29a | 12688 | |
df694daa KY |
12689 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
12690 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
12691 | ||
f12ab1e0 | 12692 | if (!spec->adc_nids && spec->input_mux) { |
8c927b4a TI |
12693 | int i; |
12694 | /* check whether the digital-mic has to be supported */ | |
12695 | for (i = 0; i < spec->input_mux->num_items; i++) { | |
12696 | if (spec->input_mux->items[i].index >= 9) | |
12697 | break; | |
12698 | } | |
12699 | if (i < spec->input_mux->num_items) { | |
12700 | /* use only ADC0 */ | |
12701 | spec->adc_nids = alc262_dmic_adc_nids; | |
12702 | spec->num_adc_nids = 1; | |
12703 | spec->capsrc_nids = alc262_dmic_capsrc_nids; | |
df694daa | 12704 | } else { |
8c927b4a TI |
12705 | /* all analog inputs */ |
12706 | /* check whether NID 0x07 is valid */ | |
12707 | unsigned int wcap = get_wcaps(codec, 0x07); | |
12708 | ||
12709 | /* get type */ | |
a22d543a | 12710 | wcap = get_wcaps_type(wcap); |
8c927b4a TI |
12711 | if (wcap != AC_WID_AUD_IN) { |
12712 | spec->adc_nids = alc262_adc_nids_alt; | |
12713 | spec->num_adc_nids = | |
12714 | ARRAY_SIZE(alc262_adc_nids_alt); | |
12715 | spec->capsrc_nids = alc262_capsrc_nids_alt; | |
12716 | } else { | |
12717 | spec->adc_nids = alc262_adc_nids; | |
12718 | spec->num_adc_nids = | |
12719 | ARRAY_SIZE(alc262_adc_nids); | |
12720 | spec->capsrc_nids = alc262_capsrc_nids; | |
12721 | } | |
df694daa KY |
12722 | } |
12723 | } | |
e64f14f4 | 12724 | if (!spec->cap_mixer && !spec->no_analog) |
b59bdf3b | 12725 | set_capture_mixer(codec); |
dc1eae25 | 12726 | if (!spec->no_analog && has_cdefine_beep(codec)) |
07eba61d | 12727 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
df694daa | 12728 | |
18675e42 TI |
12729 | if (board_config == ALC262_AUTO) |
12730 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); | |
12731 | ||
2134ea4f TI |
12732 | spec->vmaster_nid = 0x0c; |
12733 | ||
df694daa KY |
12734 | codec->patch_ops = alc_patch_ops; |
12735 | if (board_config == ALC262_AUTO) | |
ae6b813a | 12736 | spec->init_hook = alc262_auto_init; |
cb53c626 TI |
12737 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12738 | if (!spec->loopback.amplist) | |
12739 | spec->loopback.amplist = alc262_loopbacks; | |
12740 | #endif | |
ea1fb29a | 12741 | |
df694daa KY |
12742 | return 0; |
12743 | } | |
12744 | ||
a361d84b KY |
12745 | /* |
12746 | * ALC268 channel source setting (2 channel) | |
12747 | */ | |
12748 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
12749 | #define alc268_modes alc260_modes | |
ea1fb29a | 12750 | |
a361d84b KY |
12751 | static hda_nid_t alc268_dac_nids[2] = { |
12752 | /* front, hp */ | |
12753 | 0x02, 0x03 | |
12754 | }; | |
12755 | ||
12756 | static hda_nid_t alc268_adc_nids[2] = { | |
12757 | /* ADC0-1 */ | |
12758 | 0x08, 0x07 | |
12759 | }; | |
12760 | ||
12761 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
12762 | /* ADC0 */ | |
12763 | 0x08 | |
12764 | }; | |
12765 | ||
e1406348 TI |
12766 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
12767 | ||
a361d84b KY |
12768 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
12769 | /* output mixer control */ | |
12770 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12771 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12772 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12773 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
33bf17ab TI |
12774 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
12775 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12776 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
a361d84b KY |
12777 | { } |
12778 | }; | |
12779 | ||
42171c17 TI |
12780 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
12781 | /* output mixer control */ | |
12782 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12783 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12784 | ALC262_HIPPO_MASTER_SWITCH, | |
12785 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12786 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12787 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12788 | { } | |
12789 | }; | |
12790 | ||
aef9d318 TI |
12791 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
12792 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
12793 | .ops = &snd_hda_bind_sw, | |
12794 | .values = { | |
12795 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
12796 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
12797 | 0 | |
12798 | }, | |
12799 | }; | |
12800 | ||
12801 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
12802 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
12803 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
12804 | { } | |
12805 | }; | |
12806 | ||
d1a991a6 KY |
12807 | static struct hda_verb alc268_eapd_verbs[] = { |
12808 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12809 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12810 | { } | |
12811 | }; | |
12812 | ||
d273809e | 12813 | /* Toshiba specific */ |
d273809e TI |
12814 | static struct hda_verb alc268_toshiba_verbs[] = { |
12815 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12816 | { } /* end */ | |
12817 | }; | |
12818 | ||
12819 | /* Acer specific */ | |
889c4395 | 12820 | /* bind volumes of both NID 0x02 and 0x03 */ |
6bc96857 TI |
12821 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
12822 | .ops = &snd_hda_bind_vol, | |
12823 | .values = { | |
12824 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
12825 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
12826 | 0 | |
12827 | }, | |
12828 | }; | |
12829 | ||
889c4395 TI |
12830 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
12831 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
12832 | { | |
12833 | struct alc_spec *spec = codec->spec; | |
12834 | unsigned int mute; | |
12835 | ||
12836 | if (force || !spec->sense_updated) { | |
864f92be | 12837 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
889c4395 TI |
12838 | spec->sense_updated = 1; |
12839 | } | |
12840 | if (spec->jack_present) | |
12841 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
12842 | else /* unmute internal speaker if necessary */ | |
12843 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
12844 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
12845 | HDA_AMP_MUTE, mute); | |
12846 | } | |
12847 | ||
12848 | ||
12849 | /* bind hp and internal speaker mute (with plug check) */ | |
12850 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
12851 | struct snd_ctl_elem_value *ucontrol) | |
12852 | { | |
12853 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
12854 | long *valp = ucontrol->value.integer.value; | |
12855 | int change; | |
12856 | ||
8de56b7d | 12857 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
889c4395 TI |
12858 | if (change) |
12859 | alc268_acer_automute(codec, 0); | |
12860 | return change; | |
12861 | } | |
d273809e | 12862 | |
8ef355da KY |
12863 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
12864 | /* output mixer control */ | |
12865 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12866 | { | |
12867 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12868 | .name = "Master Playback Switch", | |
5e26dfd0 | 12869 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
8ef355da KY |
12870 | .info = snd_hda_mixer_amp_switch_info, |
12871 | .get = snd_hda_mixer_amp_switch_get, | |
12872 | .put = alc268_acer_master_sw_put, | |
12873 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12874 | }, | |
12875 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | |
12876 | { } | |
12877 | }; | |
12878 | ||
d273809e TI |
12879 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
12880 | /* output mixer control */ | |
12881 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12882 | { | |
12883 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12884 | .name = "Master Playback Switch", | |
5e26dfd0 | 12885 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
d273809e TI |
12886 | .info = snd_hda_mixer_amp_switch_info, |
12887 | .get = snd_hda_mixer_amp_switch_get, | |
12888 | .put = alc268_acer_master_sw_put, | |
12889 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12890 | }, | |
33bf17ab TI |
12891 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
12892 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
12893 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
d273809e TI |
12894 | { } |
12895 | }; | |
12896 | ||
c238b4f4 TI |
12897 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
12898 | /* output mixer control */ | |
12899 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
12900 | { | |
12901 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12902 | .name = "Master Playback Switch", | |
5e26dfd0 | 12903 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
c238b4f4 TI |
12904 | .info = snd_hda_mixer_amp_switch_info, |
12905 | .get = snd_hda_mixer_amp_switch_get, | |
12906 | .put = alc268_acer_master_sw_put, | |
12907 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
12908 | }, | |
12909 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12910 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12911 | { } | |
12912 | }; | |
12913 | ||
8ef355da KY |
12914 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
12915 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12916 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12917 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12918 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
12919 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
12920 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | |
12921 | { } | |
12922 | }; | |
12923 | ||
d273809e | 12924 | static struct hda_verb alc268_acer_verbs[] = { |
0ccb541c TI |
12925 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
12926 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d273809e TI |
12927 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
12928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
0ccb541c TI |
12929 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
12930 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
d273809e TI |
12931 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12932 | { } | |
12933 | }; | |
12934 | ||
12935 | /* unsolicited event for HP jack sensing */ | |
42171c17 | 12936 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
4f5d1706 TI |
12937 | #define alc268_toshiba_setup alc262_hippo_setup |
12938 | #define alc268_toshiba_automute alc262_hippo_automute | |
d273809e TI |
12939 | |
12940 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
12941 | unsigned int res) | |
12942 | { | |
889c4395 | 12943 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
12944 | return; |
12945 | alc268_acer_automute(codec, 1); | |
12946 | } | |
12947 | ||
889c4395 TI |
12948 | static void alc268_acer_init_hook(struct hda_codec *codec) |
12949 | { | |
12950 | alc268_acer_automute(codec, 1); | |
12951 | } | |
12952 | ||
8ef355da KY |
12953 | /* toggle speaker-output according to the hp-jack state */ |
12954 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |
12955 | { | |
12956 | unsigned int present; | |
12957 | unsigned char bits; | |
12958 | ||
864f92be | 12959 | present = snd_hda_jack_detect(codec, 0x15); |
5dbd5ec6 | 12960 | bits = present ? HDA_AMP_MUTE : 0; |
8ef355da | 12961 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
5dbd5ec6 | 12962 | HDA_AMP_MUTE, bits); |
8ef355da | 12963 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
5dbd5ec6 | 12964 | HDA_AMP_MUTE, bits); |
8ef355da KY |
12965 | } |
12966 | ||
8ef355da KY |
12967 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
12968 | unsigned int res) | |
12969 | { | |
4f5d1706 TI |
12970 | switch (res >> 26) { |
12971 | case ALC880_HP_EVENT: | |
8ef355da | 12972 | alc268_aspire_one_speaker_automute(codec); |
4f5d1706 TI |
12973 | break; |
12974 | case ALC880_MIC_EVENT: | |
12975 | alc_mic_automute(codec); | |
12976 | break; | |
12977 | } | |
12978 | } | |
12979 | ||
12980 | static void alc268_acer_lc_setup(struct hda_codec *codec) | |
12981 | { | |
12982 | struct alc_spec *spec = codec->spec; | |
12983 | spec->ext_mic.pin = 0x18; | |
12984 | spec->ext_mic.mux_idx = 0; | |
12985 | spec->int_mic.pin = 0x12; | |
12986 | spec->int_mic.mux_idx = 6; | |
12987 | spec->auto_mic = 1; | |
8ef355da KY |
12988 | } |
12989 | ||
12990 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | |
12991 | { | |
12992 | alc268_aspire_one_speaker_automute(codec); | |
4f5d1706 | 12993 | alc_mic_automute(codec); |
8ef355da KY |
12994 | } |
12995 | ||
3866f0b0 TI |
12996 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
12997 | /* output mixer control */ | |
12998 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
12999 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13000 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13001 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13002 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13003 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13004 | { } | |
13005 | }; | |
13006 | ||
13007 | static struct hda_verb alc268_dell_verbs[] = { | |
13008 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13009 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13010 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
4f5d1706 | 13011 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
3866f0b0 TI |
13012 | { } |
13013 | }; | |
13014 | ||
13015 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
4f5d1706 | 13016 | static void alc268_dell_setup(struct hda_codec *codec) |
3866f0b0 | 13017 | { |
a9fd4f3f | 13018 | struct alc_spec *spec = codec->spec; |
3866f0b0 | 13019 | |
a9fd4f3f TI |
13020 | spec->autocfg.hp_pins[0] = 0x15; |
13021 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
13022 | spec->ext_mic.pin = 0x18; |
13023 | spec->ext_mic.mux_idx = 0; | |
13024 | spec->int_mic.pin = 0x19; | |
13025 | spec->int_mic.mux_idx = 1; | |
13026 | spec->auto_mic = 1; | |
3866f0b0 TI |
13027 | } |
13028 | ||
eb5a6621 HRK |
13029 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
13030 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
13031 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13032 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
13033 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13034 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13035 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13036 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
13037 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
13038 | { } | |
13039 | }; | |
13040 | ||
13041 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
13042 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13043 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
13044 | { } | |
13045 | }; | |
13046 | ||
4f5d1706 | 13047 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
eb5a6621 | 13048 | { |
a9fd4f3f | 13049 | struct alc_spec *spec = codec->spec; |
a9fd4f3f TI |
13050 | spec->autocfg.hp_pins[0] = 0x15; |
13051 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
13052 | spec->ext_mic.pin = 0x18; |
13053 | spec->ext_mic.mux_idx = 0; | |
13054 | spec->int_mic.pin = 0x19; | |
13055 | spec->int_mic.mux_idx = 1; | |
13056 | spec->auto_mic = 1; | |
eb5a6621 HRK |
13057 | } |
13058 | ||
a361d84b KY |
13059 | /* |
13060 | * generic initialization of ADC, input mixers and output mixers | |
13061 | */ | |
13062 | static struct hda_verb alc268_base_init_verbs[] = { | |
13063 | /* Unmute DAC0-1 and set vol = 0 */ | |
13064 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a361d84b | 13065 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
a361d84b KY |
13066 | |
13067 | /* | |
13068 | * Set up output mixers (0x0c - 0x0e) | |
13069 | */ | |
13070 | /* set vol=0 to output mixers */ | |
13071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
a361d84b KY |
13072 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
13073 | ||
13074 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13075 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13076 | ||
13077 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13078 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
13079 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13080 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13081 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13082 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13083 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13084 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13085 | ||
13086 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13087 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13088 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13089 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
a361d84b | 13090 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
aef9d318 TI |
13091 | |
13092 | /* set PCBEEP vol = 0, mute connections */ | |
13093 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13094 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13095 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b | 13096 | |
a9b3aa8a | 13097 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
ea1fb29a | 13098 | |
a9b3aa8a JZ |
13099 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
13100 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13101 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13102 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
a361d84b | 13103 | |
a361d84b KY |
13104 | { } |
13105 | }; | |
13106 | ||
13107 | /* | |
13108 | * generic initialization of ADC, input mixers and output mixers | |
13109 | */ | |
13110 | static struct hda_verb alc268_volume_init_verbs[] = { | |
13111 | /* set output DAC */ | |
4cfb91c6 TI |
13112 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
13113 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a361d84b KY |
13114 | |
13115 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13116 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13117 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13118 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13119 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13120 | ||
a361d84b | 13121 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
a361d84b KY |
13122 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
13123 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13124 | ||
13125 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
a361d84b | 13126 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
a361d84b | 13127 | |
aef9d318 TI |
13128 | /* set PCBEEP vol = 0, mute connections */ |
13129 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13130 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13131 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b KY |
13132 | |
13133 | { } | |
13134 | }; | |
13135 | ||
fdbc6626 TI |
13136 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
13137 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13138 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13139 | { } /* end */ | |
13140 | }; | |
13141 | ||
a361d84b KY |
13142 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
13143 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13144 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
fdbc6626 | 13145 | _DEFINE_CAPSRC(1), |
a361d84b KY |
13146 | { } /* end */ |
13147 | }; | |
13148 | ||
13149 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
13150 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13151 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13152 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
13153 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
fdbc6626 | 13154 | _DEFINE_CAPSRC(2), |
a361d84b KY |
13155 | { } /* end */ |
13156 | }; | |
13157 | ||
13158 | static struct hda_input_mux alc268_capture_source = { | |
13159 | .num_items = 4, | |
13160 | .items = { | |
13161 | { "Mic", 0x0 }, | |
13162 | { "Front Mic", 0x1 }, | |
13163 | { "Line", 0x2 }, | |
13164 | { "CD", 0x3 }, | |
13165 | }, | |
13166 | }; | |
13167 | ||
0ccb541c | 13168 | static struct hda_input_mux alc268_acer_capture_source = { |
c238b4f4 TI |
13169 | .num_items = 3, |
13170 | .items = { | |
13171 | { "Mic", 0x0 }, | |
13172 | { "Internal Mic", 0x1 }, | |
13173 | { "Line", 0x2 }, | |
13174 | }, | |
13175 | }; | |
13176 | ||
13177 | static struct hda_input_mux alc268_acer_dmic_capture_source = { | |
0ccb541c TI |
13178 | .num_items = 3, |
13179 | .items = { | |
13180 | { "Mic", 0x0 }, | |
13181 | { "Internal Mic", 0x6 }, | |
13182 | { "Line", 0x2 }, | |
13183 | }, | |
13184 | }; | |
13185 | ||
86c53bd2 JW |
13186 | #ifdef CONFIG_SND_DEBUG |
13187 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
86c53bd2 JW |
13188 | /* Volume widgets */ |
13189 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13190 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13191 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
13192 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
13193 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
13194 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
13195 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
13196 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
13197 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
13198 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
13199 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
13200 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
13201 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
f0747ee6 TI |
13202 | /* The below appears problematic on some hardwares */ |
13203 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
86c53bd2 JW |
13204 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
13205 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13206 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
13207 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
13208 | ||
13209 | /* Modes for retasking pin widgets */ | |
13210 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
13211 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
13212 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
13213 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
13214 | ||
13215 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
13216 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
13217 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
13218 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
13219 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
13220 | ||
13221 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
13222 | * The ALC268 does not have an SPDIF input. | |
13223 | */ | |
13224 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
13225 | ||
13226 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
13227 | * this output to turn on an external amplifier. | |
13228 | */ | |
13229 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
13230 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
13231 | ||
13232 | { } /* end */ | |
13233 | }; | |
13234 | #endif | |
13235 | ||
a361d84b KY |
13236 | /* create input playback/capture controls for the given pin */ |
13237 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
13238 | const char *ctlname, int idx) | |
13239 | { | |
3f3b7c1a | 13240 | hda_nid_t dac; |
a361d84b KY |
13241 | int err; |
13242 | ||
3f3b7c1a TI |
13243 | switch (nid) { |
13244 | case 0x14: | |
13245 | case 0x16: | |
13246 | dac = 0x02; | |
13247 | break; | |
13248 | case 0x15: | |
b08b1637 TI |
13249 | case 0x1a: /* ALC259/269 only */ |
13250 | case 0x1b: /* ALC259/269 only */ | |
531d8791 | 13251 | case 0x21: /* ALC269vb has this pin, too */ |
3f3b7c1a TI |
13252 | dac = 0x03; |
13253 | break; | |
13254 | default: | |
c7a9434d TI |
13255 | snd_printd(KERN_WARNING "hda_codec: " |
13256 | "ignoring pin 0x%x as unknown\n", nid); | |
3f3b7c1a TI |
13257 | return 0; |
13258 | } | |
13259 | if (spec->multiout.dac_nids[0] != dac && | |
13260 | spec->multiout.dac_nids[1] != dac) { | |
0afe5f89 | 13261 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
3f3b7c1a | 13262 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
a361d84b KY |
13263 | HDA_OUTPUT)); |
13264 | if (err < 0) | |
13265 | return err; | |
3f3b7c1a TI |
13266 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
13267 | } | |
13268 | ||
3f3b7c1a | 13269 | if (nid != 0x16) |
0afe5f89 | 13270 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
a361d84b | 13271 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
3f3b7c1a | 13272 | else /* mono */ |
0afe5f89 | 13273 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
3f3b7c1a | 13274 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
a361d84b KY |
13275 | if (err < 0) |
13276 | return err; | |
13277 | return 0; | |
13278 | } | |
13279 | ||
13280 | /* add playback controls from the parsed DAC table */ | |
13281 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
13282 | const struct auto_pin_cfg *cfg) | |
13283 | { | |
13284 | hda_nid_t nid; | |
13285 | int err; | |
13286 | ||
a361d84b | 13287 | spec->multiout.dac_nids = spec->private_dac_nids; |
a361d84b KY |
13288 | |
13289 | nid = cfg->line_out_pins[0]; | |
3f3b7c1a TI |
13290 | if (nid) { |
13291 | const char *name; | |
13292 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
13293 | name = "Speaker"; | |
13294 | else | |
13295 | name = "Front"; | |
13296 | err = alc268_new_analog_output(spec, nid, name, 0); | |
13297 | if (err < 0) | |
13298 | return err; | |
13299 | } | |
a361d84b KY |
13300 | |
13301 | nid = cfg->speaker_pins[0]; | |
13302 | if (nid == 0x1d) { | |
0afe5f89 | 13303 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
a361d84b KY |
13304 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
13305 | if (err < 0) | |
13306 | return err; | |
7bfb9c03 | 13307 | } else if (nid) { |
3f3b7c1a TI |
13308 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
13309 | if (err < 0) | |
13310 | return err; | |
a361d84b KY |
13311 | } |
13312 | nid = cfg->hp_pins[0]; | |
3f3b7c1a TI |
13313 | if (nid) { |
13314 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); | |
13315 | if (err < 0) | |
13316 | return err; | |
13317 | } | |
a361d84b KY |
13318 | |
13319 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
13320 | if (nid == 0x16) { | |
0afe5f89 | 13321 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
3f3b7c1a | 13322 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
a361d84b KY |
13323 | if (err < 0) |
13324 | return err; | |
13325 | } | |
ea1fb29a | 13326 | return 0; |
a361d84b KY |
13327 | } |
13328 | ||
13329 | /* create playback/capture controls for input pins */ | |
05f5f477 | 13330 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
a361d84b KY |
13331 | const struct auto_pin_cfg *cfg) |
13332 | { | |
05f5f477 | 13333 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
a361d84b KY |
13334 | } |
13335 | ||
e9af4f36 TI |
13336 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
13337 | hda_nid_t nid, int pin_type) | |
13338 | { | |
13339 | int idx; | |
13340 | ||
13341 | alc_set_pin_output(codec, nid, pin_type); | |
13342 | if (nid == 0x14 || nid == 0x16) | |
13343 | idx = 0; | |
13344 | else | |
13345 | idx = 1; | |
13346 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
13347 | } | |
13348 | ||
13349 | static void alc268_auto_init_multi_out(struct hda_codec *codec) | |
13350 | { | |
13351 | struct alc_spec *spec = codec->spec; | |
13352 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | |
13353 | if (nid) { | |
13354 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
13355 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); | |
13356 | } | |
13357 | } | |
13358 | ||
13359 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | |
13360 | { | |
13361 | struct alc_spec *spec = codec->spec; | |
13362 | hda_nid_t pin; | |
13363 | ||
13364 | pin = spec->autocfg.hp_pins[0]; | |
13365 | if (pin) | |
13366 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
13367 | pin = spec->autocfg.speaker_pins[0]; | |
13368 | if (pin) | |
13369 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
13370 | } | |
13371 | ||
a361d84b KY |
13372 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
13373 | { | |
13374 | struct alc_spec *spec = codec->spec; | |
13375 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
13376 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
13377 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
13378 | unsigned int dac_vol1, dac_vol2; | |
13379 | ||
e9af4f36 | 13380 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
a361d84b KY |
13381 | snd_hda_codec_write(codec, speaker_nid, 0, |
13382 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
e9af4f36 | 13383 | /* mute mixer inputs from 0x1d */ |
a361d84b KY |
13384 | snd_hda_codec_write(codec, 0x0f, 0, |
13385 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13386 | AMP_IN_UNMUTE(1)); | |
13387 | snd_hda_codec_write(codec, 0x10, 0, | |
13388 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13389 | AMP_IN_UNMUTE(1)); | |
13390 | } else { | |
e9af4f36 | 13391 | /* unmute mixer inputs from 0x1d */ |
a361d84b KY |
13392 | snd_hda_codec_write(codec, 0x0f, 0, |
13393 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13394 | snd_hda_codec_write(codec, 0x10, 0, | |
13395 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13396 | } | |
13397 | ||
13398 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
ea1fb29a | 13399 | if (line_nid == 0x14) |
a361d84b KY |
13400 | dac_vol2 = AMP_OUT_ZERO; |
13401 | else if (line_nid == 0x15) | |
13402 | dac_vol1 = AMP_OUT_ZERO; | |
ea1fb29a | 13403 | if (hp_nid == 0x14) |
a361d84b KY |
13404 | dac_vol2 = AMP_OUT_ZERO; |
13405 | else if (hp_nid == 0x15) | |
13406 | dac_vol1 = AMP_OUT_ZERO; | |
13407 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
13408 | spec->autocfg.line_out_pins[1] != 0x16 || | |
13409 | spec->autocfg.line_out_pins[2] != 0x16) | |
13410 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
13411 | ||
13412 | snd_hda_codec_write(codec, 0x02, 0, | |
13413 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
13414 | snd_hda_codec_write(codec, 0x03, 0, | |
13415 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
13416 | } | |
13417 | ||
def319f9 | 13418 | /* pcm configuration: identical with ALC880 */ |
a361d84b KY |
13419 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
13420 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 13421 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
a361d84b KY |
13422 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
13423 | ||
13424 | /* | |
13425 | * BIOS auto configuration | |
13426 | */ | |
13427 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
13428 | { | |
13429 | struct alc_spec *spec = codec->spec; | |
13430 | int err; | |
13431 | static hda_nid_t alc268_ignore[] = { 0 }; | |
13432 | ||
13433 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
13434 | alc268_ignore); | |
13435 | if (err < 0) | |
13436 | return err; | |
7e0e44d4 TI |
13437 | if (!spec->autocfg.line_outs) { |
13438 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
13439 | spec->multiout.max_channels = 2; | |
13440 | spec->no_analog = 1; | |
13441 | goto dig_only; | |
13442 | } | |
a361d84b | 13443 | return 0; /* can't find valid BIOS pin config */ |
7e0e44d4 | 13444 | } |
a361d84b KY |
13445 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
13446 | if (err < 0) | |
13447 | return err; | |
05f5f477 | 13448 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
a361d84b KY |
13449 | if (err < 0) |
13450 | return err; | |
13451 | ||
13452 | spec->multiout.max_channels = 2; | |
13453 | ||
7e0e44d4 | 13454 | dig_only: |
a361d84b | 13455 | /* digital only support output */ |
757899ac | 13456 | alc_auto_parse_digital(codec); |
603c4019 | 13457 | if (spec->kctls.list) |
d88897ea | 13458 | add_mixer(spec, spec->kctls.list); |
a361d84b | 13459 | |
892981ff | 13460 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
d88897ea | 13461 | add_mixer(spec, alc268_beep_mixer); |
aef9d318 | 13462 | |
d88897ea | 13463 | add_verb(spec, alc268_volume_init_verbs); |
5908589f | 13464 | spec->num_mux_defs = 2; |
61b9b9b1 | 13465 | spec->input_mux = &spec->private_imux[0]; |
a361d84b | 13466 | |
776e184e TI |
13467 | err = alc_auto_add_mic_boost(codec); |
13468 | if (err < 0) | |
13469 | return err; | |
13470 | ||
6227cdce | 13471 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
1d955ebd | 13472 | |
a361d84b KY |
13473 | return 1; |
13474 | } | |
13475 | ||
a361d84b KY |
13476 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
13477 | ||
13478 | /* init callback for auto-configuration model -- overriding the default init */ | |
13479 | static void alc268_auto_init(struct hda_codec *codec) | |
13480 | { | |
f6c7e546 | 13481 | struct alc_spec *spec = codec->spec; |
a361d84b KY |
13482 | alc268_auto_init_multi_out(codec); |
13483 | alc268_auto_init_hp_out(codec); | |
13484 | alc268_auto_init_mono_speaker_out(codec); | |
13485 | alc268_auto_init_analog_input(codec); | |
757899ac | 13486 | alc_auto_init_digital(codec); |
f6c7e546 | 13487 | if (spec->unsol_event) |
7fb0d78f | 13488 | alc_inithook(codec); |
a361d84b KY |
13489 | } |
13490 | ||
13491 | /* | |
13492 | * configuration and preset | |
13493 | */ | |
13494 | static const char *alc268_models[ALC268_MODEL_LAST] = { | |
eb5a6621 | 13495 | [ALC267_QUANTA_IL1] = "quanta-il1", |
a361d84b | 13496 | [ALC268_3ST] = "3stack", |
983f8ae4 | 13497 | [ALC268_TOSHIBA] = "toshiba", |
d273809e | 13498 | [ALC268_ACER] = "acer", |
c238b4f4 | 13499 | [ALC268_ACER_DMIC] = "acer-dmic", |
8ef355da | 13500 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
3866f0b0 | 13501 | [ALC268_DELL] = "dell", |
f12462c5 | 13502 | [ALC268_ZEPTO] = "zepto", |
86c53bd2 JW |
13503 | #ifdef CONFIG_SND_DEBUG |
13504 | [ALC268_TEST] = "test", | |
13505 | #endif | |
a361d84b KY |
13506 | [ALC268_AUTO] = "auto", |
13507 | }; | |
13508 | ||
13509 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
a0b8f7d8 | 13510 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
ac3e3741 | 13511 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
dafc8357 | 13512 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
ac3e3741 | 13513 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
29a52c24 | 13514 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
8ef355da KY |
13515 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
13516 | ALC268_ACER_ASPIRE_ONE), | |
3866f0b0 | 13517 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
a1bf8088 DC |
13518 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
13519 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), | |
33d78674 TI |
13520 | /* almost compatible with toshiba but with optional digital outs; |
13521 | * auto-probing seems working fine | |
13522 | */ | |
8871e5b9 | 13523 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
33d78674 | 13524 | ALC268_AUTO), |
a361d84b | 13525 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
8871e5b9 | 13526 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
378bd6a5 | 13527 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
b875bf3a | 13528 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
eb5a6621 | 13529 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
a361d84b KY |
13530 | {} |
13531 | }; | |
13532 | ||
3abf2f36 TI |
13533 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
13534 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | |
13535 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | |
13536 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | |
13537 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | |
13538 | ALC268_TOSHIBA), | |
13539 | {} | |
13540 | }; | |
13541 | ||
a361d84b | 13542 | static struct alc_config_preset alc268_presets[] = { |
eb5a6621 | 13543 | [ALC267_QUANTA_IL1] = { |
fdbc6626 TI |
13544 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
13545 | alc268_capture_nosrc_mixer }, | |
eb5a6621 HRK |
13546 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13547 | alc267_quanta_il1_verbs }, | |
13548 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13549 | .dac_nids = alc268_dac_nids, | |
13550 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13551 | .adc_nids = alc268_adc_nids_alt, | |
13552 | .hp_nid = 0x03, | |
13553 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13554 | .channel_mode = alc268_modes, | |
4f5d1706 TI |
13555 | .unsol_event = alc_sku_unsol_event, |
13556 | .setup = alc267_quanta_il1_setup, | |
13557 | .init_hook = alc_inithook, | |
eb5a6621 | 13558 | }, |
a361d84b | 13559 | [ALC268_3ST] = { |
aef9d318 TI |
13560 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
13561 | alc268_beep_mixer }, | |
a361d84b KY |
13562 | .init_verbs = { alc268_base_init_verbs }, |
13563 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13564 | .dac_nids = alc268_dac_nids, | |
13565 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13566 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13567 | .capsrc_nids = alc268_capsrc_nids, |
a361d84b KY |
13568 | .hp_nid = 0x03, |
13569 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13570 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13571 | .channel_mode = alc268_modes, | |
13572 | .input_mux = &alc268_capture_source, | |
13573 | }, | |
d1a991a6 | 13574 | [ALC268_TOSHIBA] = { |
42171c17 | 13575 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
aef9d318 | 13576 | alc268_beep_mixer }, |
d273809e TI |
13577 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13578 | alc268_toshiba_verbs }, | |
d1a991a6 KY |
13579 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
13580 | .dac_nids = alc268_dac_nids, | |
13581 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13582 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13583 | .capsrc_nids = alc268_capsrc_nids, |
d1a991a6 KY |
13584 | .hp_nid = 0x03, |
13585 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13586 | .channel_mode = alc268_modes, | |
13587 | .input_mux = &alc268_capture_source, | |
d273809e | 13588 | .unsol_event = alc268_toshiba_unsol_event, |
4f5d1706 TI |
13589 | .setup = alc268_toshiba_setup, |
13590 | .init_hook = alc268_toshiba_automute, | |
d273809e TI |
13591 | }, |
13592 | [ALC268_ACER] = { | |
432fd133 | 13593 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
aef9d318 | 13594 | alc268_beep_mixer }, |
d273809e TI |
13595 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13596 | alc268_acer_verbs }, | |
13597 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13598 | .dac_nids = alc268_dac_nids, | |
13599 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13600 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13601 | .capsrc_nids = alc268_capsrc_nids, |
d273809e TI |
13602 | .hp_nid = 0x02, |
13603 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13604 | .channel_mode = alc268_modes, | |
0ccb541c | 13605 | .input_mux = &alc268_acer_capture_source, |
d273809e | 13606 | .unsol_event = alc268_acer_unsol_event, |
889c4395 | 13607 | .init_hook = alc268_acer_init_hook, |
d1a991a6 | 13608 | }, |
c238b4f4 TI |
13609 | [ALC268_ACER_DMIC] = { |
13610 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, | |
13611 | alc268_beep_mixer }, | |
13612 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13613 | alc268_acer_verbs }, | |
13614 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13615 | .dac_nids = alc268_dac_nids, | |
13616 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13617 | .adc_nids = alc268_adc_nids_alt, | |
13618 | .capsrc_nids = alc268_capsrc_nids, | |
13619 | .hp_nid = 0x02, | |
13620 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13621 | .channel_mode = alc268_modes, | |
13622 | .input_mux = &alc268_acer_dmic_capture_source, | |
13623 | .unsol_event = alc268_acer_unsol_event, | |
13624 | .init_hook = alc268_acer_init_hook, | |
13625 | }, | |
8ef355da KY |
13626 | [ALC268_ACER_ASPIRE_ONE] = { |
13627 | .mixers = { alc268_acer_aspire_one_mixer, | |
22971e3a | 13628 | alc268_beep_mixer, |
fdbc6626 | 13629 | alc268_capture_nosrc_mixer }, |
8ef355da KY |
13630 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13631 | alc268_acer_aspire_one_verbs }, | |
13632 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13633 | .dac_nids = alc268_dac_nids, | |
13634 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13635 | .adc_nids = alc268_adc_nids_alt, | |
13636 | .capsrc_nids = alc268_capsrc_nids, | |
13637 | .hp_nid = 0x03, | |
13638 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13639 | .channel_mode = alc268_modes, | |
8ef355da | 13640 | .unsol_event = alc268_acer_lc_unsol_event, |
4f5d1706 | 13641 | .setup = alc268_acer_lc_setup, |
8ef355da KY |
13642 | .init_hook = alc268_acer_lc_init_hook, |
13643 | }, | |
3866f0b0 | 13644 | [ALC268_DELL] = { |
fdbc6626 TI |
13645 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
13646 | alc268_capture_nosrc_mixer }, | |
3866f0b0 TI |
13647 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13648 | alc268_dell_verbs }, | |
13649 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13650 | .dac_nids = alc268_dac_nids, | |
fdbc6626 TI |
13651 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
13652 | .adc_nids = alc268_adc_nids_alt, | |
13653 | .capsrc_nids = alc268_capsrc_nids, | |
3866f0b0 TI |
13654 | .hp_nid = 0x02, |
13655 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13656 | .channel_mode = alc268_modes, | |
a9fd4f3f | 13657 | .unsol_event = alc_sku_unsol_event, |
4f5d1706 TI |
13658 | .setup = alc268_dell_setup, |
13659 | .init_hook = alc_inithook, | |
3866f0b0 | 13660 | }, |
f12462c5 | 13661 | [ALC268_ZEPTO] = { |
aef9d318 TI |
13662 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
13663 | alc268_beep_mixer }, | |
f12462c5 MT |
13664 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13665 | alc268_toshiba_verbs }, | |
13666 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13667 | .dac_nids = alc268_dac_nids, | |
13668 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13669 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13670 | .capsrc_nids = alc268_capsrc_nids, |
f12462c5 MT |
13671 | .hp_nid = 0x03, |
13672 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13673 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13674 | .channel_mode = alc268_modes, | |
13675 | .input_mux = &alc268_capture_source, | |
4f5d1706 TI |
13676 | .setup = alc268_toshiba_setup, |
13677 | .init_hook = alc268_toshiba_automute, | |
f12462c5 | 13678 | }, |
86c53bd2 JW |
13679 | #ifdef CONFIG_SND_DEBUG |
13680 | [ALC268_TEST] = { | |
13681 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
13682 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13683 | alc268_volume_init_verbs }, | |
13684 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13685 | .dac_nids = alc268_dac_nids, | |
13686 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13687 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13688 | .capsrc_nids = alc268_capsrc_nids, |
86c53bd2 JW |
13689 | .hp_nid = 0x03, |
13690 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13691 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13692 | .channel_mode = alc268_modes, | |
13693 | .input_mux = &alc268_capture_source, | |
13694 | }, | |
13695 | #endif | |
a361d84b KY |
13696 | }; |
13697 | ||
13698 | static int patch_alc268(struct hda_codec *codec) | |
13699 | { | |
13700 | struct alc_spec *spec; | |
13701 | int board_config; | |
22971e3a | 13702 | int i, has_beep, err; |
a361d84b | 13703 | |
ef86f581 | 13704 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
a361d84b KY |
13705 | if (spec == NULL) |
13706 | return -ENOMEM; | |
13707 | ||
13708 | codec->spec = spec; | |
13709 | ||
13710 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
13711 | alc268_models, | |
13712 | alc268_cfg_tbl); | |
13713 | ||
3abf2f36 TI |
13714 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
13715 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
50ae0aa8 | 13716 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
3abf2f36 | 13717 | |
a361d84b | 13718 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
9a11f1aa TI |
13719 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
13720 | codec->chip_name); | |
a361d84b KY |
13721 | board_config = ALC268_AUTO; |
13722 | } | |
13723 | ||
13724 | if (board_config == ALC268_AUTO) { | |
13725 | /* automatic parse from the BIOS config */ | |
13726 | err = alc268_parse_auto_config(codec); | |
13727 | if (err < 0) { | |
13728 | alc_free(codec); | |
13729 | return err; | |
13730 | } else if (!err) { | |
13731 | printk(KERN_INFO | |
13732 | "hda_codec: Cannot set up configuration " | |
13733 | "from BIOS. Using base mode...\n"); | |
13734 | board_config = ALC268_3ST; | |
13735 | } | |
13736 | } | |
13737 | ||
13738 | if (board_config != ALC268_AUTO) | |
e9c364c0 | 13739 | setup_preset(codec, &alc268_presets[board_config]); |
a361d84b | 13740 | |
a361d84b KY |
13741 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
13742 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
6330079f | 13743 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
a361d84b | 13744 | |
a361d84b KY |
13745 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
13746 | ||
22971e3a TI |
13747 | has_beep = 0; |
13748 | for (i = 0; i < spec->num_mixers; i++) { | |
13749 | if (spec->mixers[i] == alc268_beep_mixer) { | |
13750 | has_beep = 1; | |
13751 | break; | |
13752 | } | |
13753 | } | |
13754 | ||
13755 | if (has_beep) { | |
13756 | err = snd_hda_attach_beep_device(codec, 0x1); | |
13757 | if (err < 0) { | |
13758 | alc_free(codec); | |
13759 | return err; | |
13760 | } | |
13761 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | |
13762 | /* override the amp caps for beep generator */ | |
13763 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
aef9d318 TI |
13764 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
13765 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
13766 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
13767 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
22971e3a | 13768 | } |
aef9d318 | 13769 | |
7e0e44d4 | 13770 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
3866f0b0 TI |
13771 | /* check whether NID 0x07 is valid */ |
13772 | unsigned int wcap = get_wcaps(codec, 0x07); | |
85860c06 | 13773 | int i; |
3866f0b0 | 13774 | |
defb5ab2 | 13775 | spec->capsrc_nids = alc268_capsrc_nids; |
3866f0b0 | 13776 | /* get type */ |
a22d543a | 13777 | wcap = get_wcaps_type(wcap); |
fdbc6626 TI |
13778 | if (spec->auto_mic || |
13779 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
3866f0b0 TI |
13780 | spec->adc_nids = alc268_adc_nids_alt; |
13781 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
defb5ab2 TI |
13782 | if (spec->auto_mic) |
13783 | fixup_automic_adc(codec); | |
fdbc6626 TI |
13784 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
13785 | add_mixer(spec, alc268_capture_nosrc_mixer); | |
13786 | else | |
13787 | add_mixer(spec, alc268_capture_alt_mixer); | |
3866f0b0 TI |
13788 | } else { |
13789 | spec->adc_nids = alc268_adc_nids; | |
13790 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
d88897ea | 13791 | add_mixer(spec, alc268_capture_mixer); |
a361d84b | 13792 | } |
85860c06 TI |
13793 | /* set default input source */ |
13794 | for (i = 0; i < spec->num_adc_nids; i++) | |
13795 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
13796 | 0, AC_VERB_SET_CONNECT_SEL, | |
5908589f HRK |
13797 | i < spec->num_mux_defs ? |
13798 | spec->input_mux[i].items[0].index : | |
85860c06 | 13799 | spec->input_mux->items[0].index); |
a361d84b | 13800 | } |
2134ea4f TI |
13801 | |
13802 | spec->vmaster_nid = 0x02; | |
13803 | ||
a361d84b KY |
13804 | codec->patch_ops = alc_patch_ops; |
13805 | if (board_config == ALC268_AUTO) | |
13806 | spec->init_hook = alc268_auto_init; | |
ea1fb29a | 13807 | |
a361d84b KY |
13808 | return 0; |
13809 | } | |
13810 | ||
f6a92248 KY |
13811 | /* |
13812 | * ALC269 channel source setting (2 channel) | |
13813 | */ | |
13814 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
13815 | ||
13816 | #define alc269_dac_nids alc260_dac_nids | |
13817 | ||
13818 | static hda_nid_t alc269_adc_nids[1] = { | |
13819 | /* ADC1 */ | |
f53281e6 KY |
13820 | 0x08, |
13821 | }; | |
13822 | ||
e01bf509 TI |
13823 | static hda_nid_t alc269_capsrc_nids[1] = { |
13824 | 0x23, | |
13825 | }; | |
13826 | ||
84898e87 KY |
13827 | static hda_nid_t alc269vb_adc_nids[1] = { |
13828 | /* ADC1 */ | |
13829 | 0x09, | |
13830 | }; | |
13831 | ||
13832 | static hda_nid_t alc269vb_capsrc_nids[1] = { | |
13833 | 0x22, | |
13834 | }; | |
13835 | ||
6694635d TI |
13836 | static hda_nid_t alc269_adc_candidates[] = { |
13837 | 0x08, 0x09, 0x07, | |
13838 | }; | |
e01bf509 | 13839 | |
f6a92248 KY |
13840 | #define alc269_modes alc260_modes |
13841 | #define alc269_capture_source alc880_lg_lw_capture_source | |
13842 | ||
13843 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
13844 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13845 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13846 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13847 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13849 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13850 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13851 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13852 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13853 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13855 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
13856 | { } /* end */ | |
13857 | }; | |
13858 | ||
60db6b53 KY |
13859 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
13860 | /* output mixer control */ | |
13861 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13862 | { | |
13863 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13864 | .name = "Master Playback Switch", | |
5e26dfd0 | 13865 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
60db6b53 KY |
13866 | .info = snd_hda_mixer_amp_switch_info, |
13867 | .get = snd_hda_mixer_amp_switch_get, | |
13868 | .put = alc268_acer_master_sw_put, | |
13869 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13870 | }, | |
13871 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13873 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13874 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13875 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13876 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
60db6b53 KY |
13877 | { } |
13878 | }; | |
13879 | ||
64154835 TV |
13880 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
13881 | /* output mixer control */ | |
13882 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13883 | { | |
13884 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13885 | .name = "Master Playback Switch", | |
5e26dfd0 | 13886 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
64154835 TV |
13887 | .info = snd_hda_mixer_amp_switch_info, |
13888 | .get = snd_hda_mixer_amp_switch_get, | |
13889 | .put = alc268_acer_master_sw_put, | |
13890 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13891 | }, | |
13892 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13893 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13894 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13895 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13896 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13897 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13898 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
13899 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
13900 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), | |
64154835 TV |
13901 | { } |
13902 | }; | |
13903 | ||
84898e87 | 13904 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
aa202455 | 13905 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
508f7110 | 13906 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
aa202455 | 13907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
508f7110 | 13908 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
f53281e6 KY |
13909 | { } /* end */ |
13910 | }; | |
13911 | ||
84898e87 KY |
13912 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
13913 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13914 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13915 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
13916 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13917 | { } /* end */ | |
13918 | }; | |
13919 | ||
fe3eb0a7 KY |
13920 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
13921 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13922 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
13923 | { } /* end */ | |
13924 | }; | |
13925 | ||
f53281e6 | 13926 | /* capture mixer elements */ |
84898e87 KY |
13927 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
13928 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
13929 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
13930 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13931 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | |
13932 | { } /* end */ | |
13933 | }; | |
13934 | ||
13935 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { | |
f53281e6 KY |
13936 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
13937 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
26f5df26 TI |
13938 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
13939 | { } /* end */ | |
13940 | }; | |
13941 | ||
84898e87 KY |
13942 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
13943 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
13944 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
13945 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13946 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | |
13947 | { } /* end */ | |
13948 | }; | |
13949 | ||
13950 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { | |
13951 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
13952 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
13953 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13954 | { } /* end */ | |
13955 | }; | |
13956 | ||
26f5df26 | 13957 | /* FSC amilo */ |
84898e87 | 13958 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
f53281e6 | 13959 | |
60db6b53 KY |
13960 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
13961 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13962 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13963 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13964 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13965 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13966 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13967 | { } | |
13968 | }; | |
f6a92248 | 13969 | |
64154835 TV |
13970 | static struct hda_verb alc269_lifebook_verbs[] = { |
13971 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13972 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13973 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13975 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13976 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13977 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13978 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13979 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13980 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13981 | { } | |
13982 | }; | |
13983 | ||
60db6b53 KY |
13984 | /* toggle speaker-output according to the hp-jack state */ |
13985 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |
13986 | { | |
13987 | unsigned int present; | |
13988 | unsigned char bits; | |
f6a92248 | 13989 | |
864f92be | 13990 | present = snd_hda_jack_detect(codec, 0x15); |
5dbd5ec6 | 13991 | bits = present ? HDA_AMP_MUTE : 0; |
60db6b53 | 13992 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 13993 | HDA_AMP_MUTE, bits); |
60db6b53 | 13994 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 13995 | HDA_AMP_MUTE, bits); |
f6a92248 | 13996 | |
60db6b53 KY |
13997 | snd_hda_codec_write(codec, 0x20, 0, |
13998 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
13999 | snd_hda_codec_write(codec, 0x20, 0, | |
14000 | AC_VERB_SET_PROC_COEF, 0x680); | |
f6a92248 | 14001 | |
60db6b53 KY |
14002 | snd_hda_codec_write(codec, 0x20, 0, |
14003 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14004 | snd_hda_codec_write(codec, 0x20, 0, | |
14005 | AC_VERB_SET_PROC_COEF, 0x480); | |
14006 | } | |
f6a92248 | 14007 | |
64154835 TV |
14008 | /* toggle speaker-output according to the hp-jacks state */ |
14009 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |
14010 | { | |
14011 | unsigned int present; | |
14012 | unsigned char bits; | |
14013 | ||
14014 | /* Check laptop headphone socket */ | |
864f92be | 14015 | present = snd_hda_jack_detect(codec, 0x15); |
64154835 TV |
14016 | |
14017 | /* Check port replicator headphone socket */ | |
864f92be | 14018 | present |= snd_hda_jack_detect(codec, 0x1a); |
64154835 | 14019 | |
5dbd5ec6 | 14020 | bits = present ? HDA_AMP_MUTE : 0; |
64154835 | 14021 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 14022 | HDA_AMP_MUTE, bits); |
64154835 | 14023 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 14024 | HDA_AMP_MUTE, bits); |
64154835 TV |
14025 | |
14026 | snd_hda_codec_write(codec, 0x20, 0, | |
14027 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14028 | snd_hda_codec_write(codec, 0x20, 0, | |
14029 | AC_VERB_SET_PROC_COEF, 0x680); | |
14030 | ||
14031 | snd_hda_codec_write(codec, 0x20, 0, | |
14032 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14033 | snd_hda_codec_write(codec, 0x20, 0, | |
14034 | AC_VERB_SET_PROC_COEF, 0x480); | |
14035 | } | |
14036 | ||
64154835 TV |
14037 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
14038 | { | |
14039 | unsigned int present_laptop; | |
14040 | unsigned int present_dock; | |
14041 | ||
864f92be WF |
14042 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
14043 | present_dock = snd_hda_jack_detect(codec, 0x1b); | |
64154835 TV |
14044 | |
14045 | /* Laptop mic port overrides dock mic port, design decision */ | |
14046 | if (present_dock) | |
14047 | snd_hda_codec_write(codec, 0x23, 0, | |
14048 | AC_VERB_SET_CONNECT_SEL, 0x3); | |
14049 | if (present_laptop) | |
14050 | snd_hda_codec_write(codec, 0x23, 0, | |
14051 | AC_VERB_SET_CONNECT_SEL, 0x0); | |
14052 | if (!present_dock && !present_laptop) | |
14053 | snd_hda_codec_write(codec, 0x23, 0, | |
14054 | AC_VERB_SET_CONNECT_SEL, 0x1); | |
14055 | } | |
14056 | ||
60db6b53 KY |
14057 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
14058 | unsigned int res) | |
14059 | { | |
4f5d1706 TI |
14060 | switch (res >> 26) { |
14061 | case ALC880_HP_EVENT: | |
60db6b53 | 14062 | alc269_quanta_fl1_speaker_automute(codec); |
4f5d1706 TI |
14063 | break; |
14064 | case ALC880_MIC_EVENT: | |
14065 | alc_mic_automute(codec); | |
14066 | break; | |
14067 | } | |
60db6b53 | 14068 | } |
f6a92248 | 14069 | |
64154835 TV |
14070 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
14071 | unsigned int res) | |
14072 | { | |
14073 | if ((res >> 26) == ALC880_HP_EVENT) | |
14074 | alc269_lifebook_speaker_automute(codec); | |
14075 | if ((res >> 26) == ALC880_MIC_EVENT) | |
14076 | alc269_lifebook_mic_autoswitch(codec); | |
14077 | } | |
14078 | ||
4f5d1706 TI |
14079 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
14080 | { | |
14081 | struct alc_spec *spec = codec->spec; | |
20645d70 TI |
14082 | spec->autocfg.hp_pins[0] = 0x15; |
14083 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
14084 | spec->ext_mic.pin = 0x18; |
14085 | spec->ext_mic.mux_idx = 0; | |
14086 | spec->int_mic.pin = 0x19; | |
14087 | spec->int_mic.mux_idx = 1; | |
14088 | spec->auto_mic = 1; | |
14089 | } | |
14090 | ||
60db6b53 KY |
14091 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
14092 | { | |
14093 | alc269_quanta_fl1_speaker_automute(codec); | |
4f5d1706 | 14094 | alc_mic_automute(codec); |
60db6b53 | 14095 | } |
f6a92248 | 14096 | |
64154835 TV |
14097 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
14098 | { | |
14099 | alc269_lifebook_speaker_automute(codec); | |
14100 | alc269_lifebook_mic_autoswitch(codec); | |
14101 | } | |
14102 | ||
84898e87 | 14103 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
f53281e6 KY |
14104 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
14105 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | |
14106 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14107 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14108 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14109 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14110 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14111 | {} | |
14112 | }; | |
14113 | ||
84898e87 | 14114 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
f53281e6 KY |
14115 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
14116 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14117 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14118 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | |
14119 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14120 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14121 | {} | |
14122 | }; | |
14123 | ||
84898e87 KY |
14124 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
14125 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14126 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
14127 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14128 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14129 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14130 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14131 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14132 | {} | |
14133 | }; | |
14134 | ||
14135 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { | |
14136 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14137 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14138 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14139 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14140 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14141 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14142 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14143 | {} | |
14144 | }; | |
14145 | ||
fe3eb0a7 KY |
14146 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
14147 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | |
14148 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | |
14149 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14150 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14151 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14152 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14153 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14154 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14155 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14156 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, | |
14157 | { } | |
14158 | }; | |
14159 | ||
f53281e6 KY |
14160 | /* toggle speaker-output according to the hp-jack state */ |
14161 | static void alc269_speaker_automute(struct hda_codec *codec) | |
14162 | { | |
ebb83eeb KY |
14163 | struct alc_spec *spec = codec->spec; |
14164 | unsigned int nid = spec->autocfg.hp_pins[0]; | |
f53281e6 | 14165 | unsigned int present; |
60db6b53 | 14166 | unsigned char bits; |
f53281e6 | 14167 | |
ebb83eeb | 14168 | present = snd_hda_jack_detect(codec, nid); |
5dbd5ec6 | 14169 | bits = present ? HDA_AMP_MUTE : 0; |
f53281e6 | 14170 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 14171 | HDA_AMP_MUTE, bits); |
f53281e6 | 14172 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 14173 | HDA_AMP_MUTE, bits); |
f53281e6 KY |
14174 | } |
14175 | ||
f53281e6 | 14176 | /* unsolicited event for HP jack sensing */ |
84898e87 | 14177 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
60db6b53 | 14178 | unsigned int res) |
f53281e6 | 14179 | { |
4f5d1706 TI |
14180 | switch (res >> 26) { |
14181 | case ALC880_HP_EVENT: | |
f53281e6 | 14182 | alc269_speaker_automute(codec); |
4f5d1706 TI |
14183 | break; |
14184 | case ALC880_MIC_EVENT: | |
14185 | alc_mic_automute(codec); | |
14186 | break; | |
14187 | } | |
f53281e6 KY |
14188 | } |
14189 | ||
226b1ec8 | 14190 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
f53281e6 | 14191 | { |
4f5d1706 | 14192 | struct alc_spec *spec = codec->spec; |
20645d70 TI |
14193 | spec->autocfg.hp_pins[0] = 0x15; |
14194 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
14195 | spec->ext_mic.pin = 0x18; |
14196 | spec->ext_mic.mux_idx = 0; | |
226b1ec8 KY |
14197 | spec->int_mic.pin = 0x19; |
14198 | spec->int_mic.mux_idx = 1; | |
4f5d1706 | 14199 | spec->auto_mic = 1; |
f53281e6 KY |
14200 | } |
14201 | ||
226b1ec8 | 14202 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
84898e87 KY |
14203 | { |
14204 | struct alc_spec *spec = codec->spec; | |
20645d70 TI |
14205 | spec->autocfg.hp_pins[0] = 0x15; |
14206 | spec->autocfg.speaker_pins[0] = 0x14; | |
84898e87 KY |
14207 | spec->ext_mic.pin = 0x18; |
14208 | spec->ext_mic.mux_idx = 0; | |
14209 | spec->int_mic.pin = 0x12; | |
226b1ec8 | 14210 | spec->int_mic.mux_idx = 5; |
84898e87 KY |
14211 | spec->auto_mic = 1; |
14212 | } | |
14213 | ||
226b1ec8 | 14214 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
f53281e6 | 14215 | { |
4f5d1706 | 14216 | struct alc_spec *spec = codec->spec; |
226b1ec8 | 14217 | spec->autocfg.hp_pins[0] = 0x21; |
20645d70 | 14218 | spec->autocfg.speaker_pins[0] = 0x14; |
4f5d1706 TI |
14219 | spec->ext_mic.pin = 0x18; |
14220 | spec->ext_mic.mux_idx = 0; | |
14221 | spec->int_mic.pin = 0x19; | |
14222 | spec->int_mic.mux_idx = 1; | |
14223 | spec->auto_mic = 1; | |
f53281e6 KY |
14224 | } |
14225 | ||
226b1ec8 KY |
14226 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
14227 | { | |
14228 | struct alc_spec *spec = codec->spec; | |
14229 | spec->autocfg.hp_pins[0] = 0x21; | |
14230 | spec->autocfg.speaker_pins[0] = 0x14; | |
14231 | spec->ext_mic.pin = 0x18; | |
14232 | spec->ext_mic.mux_idx = 0; | |
14233 | spec->int_mic.pin = 0x12; | |
14234 | spec->int_mic.mux_idx = 6; | |
14235 | spec->auto_mic = 1; | |
14236 | } | |
14237 | ||
84898e87 | 14238 | static void alc269_laptop_inithook(struct hda_codec *codec) |
f53281e6 KY |
14239 | { |
14240 | alc269_speaker_automute(codec); | |
4f5d1706 | 14241 | alc_mic_automute(codec); |
f53281e6 KY |
14242 | } |
14243 | ||
60db6b53 KY |
14244 | /* |
14245 | * generic initialization of ADC, input mixers and output mixers | |
14246 | */ | |
14247 | static struct hda_verb alc269_init_verbs[] = { | |
14248 | /* | |
14249 | * Unmute ADC0 and set the default input to mic-in | |
14250 | */ | |
84898e87 | 14251 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
60db6b53 KY |
14252 | |
14253 | /* | |
84898e87 | 14254 | * Set up output mixers (0x02 - 0x03) |
60db6b53 KY |
14255 | */ |
14256 | /* set vol=0 to output mixers */ | |
14257 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14258 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14259 | ||
14260 | /* set up input amps for analog loopback */ | |
14261 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14264 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14265 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14266 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14267 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14268 | ||
14269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14270 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14271 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14272 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14273 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14274 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14276 | ||
14277 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14278 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
60db6b53 | 14279 | |
84898e87 KY |
14280 | /* FIXME: use Mux-type input source selection */ |
14281 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
14282 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
14283 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
60db6b53 | 14284 | |
84898e87 KY |
14285 | /* set EAPD */ |
14286 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14287 | { } | |
14288 | }; | |
14289 | ||
14290 | static struct hda_verb alc269vb_init_verbs[] = { | |
14291 | /* | |
14292 | * Unmute ADC0 and set the default input to mic-in | |
14293 | */ | |
14294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14295 | ||
14296 | /* | |
14297 | * Set up output mixers (0x02 - 0x03) | |
14298 | */ | |
14299 | /* set vol=0 to output mixers */ | |
14300 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14301 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14302 | ||
14303 | /* set up input amps for analog loopback */ | |
14304 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14307 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14308 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14309 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14310 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14311 | ||
14312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14313 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14314 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14315 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14316 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14317 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14318 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14319 | ||
14320 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14321 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14322 | ||
14323 | /* FIXME: use Mux-type input source selection */ | |
60db6b53 KY |
14324 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
14325 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
84898e87 | 14326 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
60db6b53 KY |
14327 | |
14328 | /* set EAPD */ | |
14329 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
60db6b53 KY |
14330 | { } |
14331 | }; | |
14332 | ||
9d0b71b1 TI |
14333 | #define alc269_auto_create_multi_out_ctls \ |
14334 | alc268_auto_create_multi_out_ctls | |
05f5f477 TI |
14335 | #define alc269_auto_create_input_ctls \ |
14336 | alc268_auto_create_input_ctls | |
f6a92248 KY |
14337 | |
14338 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14339 | #define alc269_loopbacks alc880_loopbacks | |
14340 | #endif | |
14341 | ||
def319f9 | 14342 | /* pcm configuration: identical with ALC880 */ |
f6a92248 KY |
14343 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
14344 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
14345 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
14346 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
14347 | ||
f03d3115 TI |
14348 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
14349 | .substreams = 1, | |
14350 | .channels_min = 2, | |
14351 | .channels_max = 8, | |
14352 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14353 | /* NID is set in alc_build_pcms */ | |
14354 | .ops = { | |
14355 | .open = alc880_playback_pcm_open, | |
14356 | .prepare = alc880_playback_pcm_prepare, | |
14357 | .cleanup = alc880_playback_pcm_cleanup | |
14358 | }, | |
14359 | }; | |
14360 | ||
14361 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { | |
14362 | .substreams = 1, | |
14363 | .channels_min = 2, | |
14364 | .channels_max = 2, | |
14365 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14366 | /* NID is set in alc_build_pcms */ | |
14367 | }; | |
14368 | ||
ad35879a TI |
14369 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14370 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) | |
14371 | { | |
14372 | switch (codec->subsystem_id) { | |
14373 | case 0x103c1586: | |
14374 | return 1; | |
14375 | } | |
14376 | return 0; | |
14377 | } | |
14378 | ||
14379 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) | |
14380 | { | |
14381 | /* update mute-LED according to the speaker mute state */ | |
14382 | if (nid == 0x01 || nid == 0x14) { | |
14383 | int pinval; | |
14384 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & | |
14385 | HDA_AMP_MUTE) | |
14386 | pinval = 0x24; | |
14387 | else | |
14388 | pinval = 0x20; | |
14389 | /* mic2 vref pin is used for mute LED control */ | |
a68d5a54 TI |
14390 | snd_hda_codec_update_cache(codec, 0x19, 0, |
14391 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14392 | pinval); | |
ad35879a TI |
14393 | } |
14394 | return alc_check_power_status(codec, nid); | |
14395 | } | |
14396 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | |
14397 | ||
840b64c0 TI |
14398 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
14399 | { | |
14400 | struct alc_spec *spec = codec->spec; | |
14401 | ||
14402 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) | |
14403 | return 0; | |
14404 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || | |
14405 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { | |
14406 | if (spec->ext_mic.pin <= 0x12) { | |
14407 | spec->private_adc_nids[0] = 0x08; | |
14408 | spec->private_adc_nids[1] = 0x11; | |
14409 | spec->private_capsrc_nids[0] = 0x23; | |
14410 | spec->private_capsrc_nids[1] = 0x22; | |
14411 | } else { | |
14412 | spec->private_adc_nids[0] = 0x11; | |
14413 | spec->private_adc_nids[1] = 0x08; | |
14414 | spec->private_capsrc_nids[0] = 0x22; | |
14415 | spec->private_capsrc_nids[1] = 0x23; | |
14416 | } | |
14417 | spec->adc_nids = spec->private_adc_nids; | |
14418 | spec->capsrc_nids = spec->private_capsrc_nids; | |
14419 | spec->num_adc_nids = 2; | |
14420 | spec->dual_adc_switch = 1; | |
14421 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", | |
14422 | spec->adc_nids[0], spec->adc_nids[1]); | |
14423 | return 1; | |
14424 | } | |
14425 | return 0; | |
14426 | } | |
14427 | ||
f6a92248 KY |
14428 | /* |
14429 | * BIOS auto configuration | |
14430 | */ | |
14431 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
14432 | { | |
14433 | struct alc_spec *spec = codec->spec; | |
cfb9fb55 | 14434 | int err; |
f6a92248 KY |
14435 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
14436 | ||
14437 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
14438 | alc269_ignore); | |
14439 | if (err < 0) | |
14440 | return err; | |
14441 | ||
14442 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
14443 | if (err < 0) | |
14444 | return err; | |
05f5f477 | 14445 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
f6a92248 KY |
14446 | if (err < 0) |
14447 | return err; | |
14448 | ||
14449 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14450 | ||
757899ac | 14451 | alc_auto_parse_digital(codec); |
f6a92248 | 14452 | |
603c4019 | 14453 | if (spec->kctls.list) |
d88897ea | 14454 | add_mixer(spec, spec->kctls.list); |
f6a92248 | 14455 | |
84898e87 KY |
14456 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
14457 | add_verb(spec, alc269vb_init_verbs); | |
6227cdce | 14458 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
84898e87 KY |
14459 | } else { |
14460 | add_verb(spec, alc269_init_verbs); | |
6227cdce | 14461 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
84898e87 KY |
14462 | } |
14463 | ||
f6a92248 | 14464 | spec->num_mux_defs = 1; |
61b9b9b1 | 14465 | spec->input_mux = &spec->private_imux[0]; |
840b64c0 TI |
14466 | |
14467 | if (!alc275_setup_dual_adc(codec)) | |
14468 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | |
14469 | sizeof(alc269_adc_candidates)); | |
6694635d | 14470 | |
e01bf509 | 14471 | /* set default input source */ |
840b64c0 | 14472 | if (!spec->dual_adc_switch) |
748cce43 TI |
14473 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
14474 | spec->input_mux->items[0].index); | |
f6a92248 KY |
14475 | |
14476 | err = alc_auto_add_mic_boost(codec); | |
14477 | if (err < 0) | |
14478 | return err; | |
14479 | ||
7e0e44d4 | 14480 | if (!spec->cap_mixer && !spec->no_analog) |
b59bdf3b | 14481 | set_capture_mixer(codec); |
f53281e6 | 14482 | |
f6a92248 KY |
14483 | return 1; |
14484 | } | |
14485 | ||
e9af4f36 TI |
14486 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
14487 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out | |
f6a92248 KY |
14488 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
14489 | ||
14490 | ||
14491 | /* init callback for auto-configuration model -- overriding the default init */ | |
14492 | static void alc269_auto_init(struct hda_codec *codec) | |
14493 | { | |
f6c7e546 | 14494 | struct alc_spec *spec = codec->spec; |
f6a92248 KY |
14495 | alc269_auto_init_multi_out(codec); |
14496 | alc269_auto_init_hp_out(codec); | |
14497 | alc269_auto_init_analog_input(codec); | |
757899ac | 14498 | alc_auto_init_digital(codec); |
f6c7e546 | 14499 | if (spec->unsol_event) |
7fb0d78f | 14500 | alc_inithook(codec); |
f6a92248 KY |
14501 | } |
14502 | ||
ff818c24 TI |
14503 | enum { |
14504 | ALC269_FIXUP_SONY_VAIO, | |
14505 | }; | |
14506 | ||
ff818c24 TI |
14507 | static const struct alc_fixup alc269_fixups[] = { |
14508 | [ALC269_FIXUP_SONY_VAIO] = { | |
73413b12 TI |
14509 | .verbs = (const struct hda_verb[]) { |
14510 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, | |
14511 | {} | |
14512 | } | |
ff818c24 TI |
14513 | }, |
14514 | }; | |
14515 | ||
14516 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | |
14517 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | |
dbbcbc07 | 14518 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
ff818c24 TI |
14519 | {} |
14520 | }; | |
14521 | ||
14522 | ||
f6a92248 KY |
14523 | /* |
14524 | * configuration and preset | |
14525 | */ | |
14526 | static const char *alc269_models[ALC269_MODEL_LAST] = { | |
60db6b53 | 14527 | [ALC269_BASIC] = "basic", |
2922c9af | 14528 | [ALC269_QUANTA_FL1] = "quanta", |
84898e87 KY |
14529 | [ALC269_AMIC] = "laptop-amic", |
14530 | [ALC269_DMIC] = "laptop-dmic", | |
64154835 | 14531 | [ALC269_FUJITSU] = "fujitsu", |
3d3792cb TI |
14532 | [ALC269_LIFEBOOK] = "lifebook", |
14533 | [ALC269_AUTO] = "auto", | |
f6a92248 KY |
14534 | }; |
14535 | ||
14536 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
60db6b53 | 14537 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
fe3eb0a7 | 14538 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
f53281e6 | 14539 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
84898e87 KY |
14540 | ALC269_AMIC), |
14541 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), | |
14542 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), | |
14543 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), | |
14544 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), | |
14545 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), | |
14546 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), | |
14547 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), | |
14548 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), | |
14549 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), | |
14550 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), | |
14551 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), | |
14552 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), | |
14553 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), | |
14554 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), | |
14555 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), | |
14556 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), | |
14557 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), | |
14558 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), | |
14559 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), | |
14560 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), | |
14561 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), | |
14562 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), | |
14563 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), | |
14564 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), | |
14565 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), | |
14566 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), | |
14567 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), | |
14568 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), | |
14569 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), | |
14570 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), | |
14571 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), | |
14572 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), | |
14573 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), | |
14574 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), | |
14575 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), | |
14576 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), | |
f53281e6 | 14577 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
84898e87 | 14578 | ALC269_DMIC), |
60db6b53 | 14579 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
84898e87 KY |
14580 | ALC269_DMIC), |
14581 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), | |
14582 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), | |
ff818c24 | 14583 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
64154835 | 14584 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
61c2d2b5 KY |
14585 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
14586 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | |
14587 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), | |
14588 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), | |
14589 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), | |
14590 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), | |
f6a92248 KY |
14591 | {} |
14592 | }; | |
14593 | ||
14594 | static struct alc_config_preset alc269_presets[] = { | |
14595 | [ALC269_BASIC] = { | |
f9e336f6 | 14596 | .mixers = { alc269_base_mixer }, |
f6a92248 KY |
14597 | .init_verbs = { alc269_init_verbs }, |
14598 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14599 | .dac_nids = alc269_dac_nids, | |
14600 | .hp_nid = 0x03, | |
14601 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14602 | .channel_mode = alc269_modes, | |
14603 | .input_mux = &alc269_capture_source, | |
14604 | }, | |
60db6b53 KY |
14605 | [ALC269_QUANTA_FL1] = { |
14606 | .mixers = { alc269_quanta_fl1_mixer }, | |
14607 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | |
14608 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14609 | .dac_nids = alc269_dac_nids, | |
14610 | .hp_nid = 0x03, | |
14611 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14612 | .channel_mode = alc269_modes, | |
14613 | .input_mux = &alc269_capture_source, | |
14614 | .unsol_event = alc269_quanta_fl1_unsol_event, | |
4f5d1706 | 14615 | .setup = alc269_quanta_fl1_setup, |
60db6b53 KY |
14616 | .init_hook = alc269_quanta_fl1_init_hook, |
14617 | }, | |
84898e87 KY |
14618 | [ALC269_AMIC] = { |
14619 | .mixers = { alc269_laptop_mixer }, | |
14620 | .cap_mixer = alc269_laptop_analog_capture_mixer, | |
f53281e6 | 14621 | .init_verbs = { alc269_init_verbs, |
84898e87 | 14622 | alc269_laptop_amic_init_verbs }, |
f53281e6 KY |
14623 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14624 | .dac_nids = alc269_dac_nids, | |
14625 | .hp_nid = 0x03, | |
14626 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14627 | .channel_mode = alc269_modes, | |
84898e87 KY |
14628 | .unsol_event = alc269_laptop_unsol_event, |
14629 | .setup = alc269_laptop_amic_setup, | |
14630 | .init_hook = alc269_laptop_inithook, | |
f53281e6 | 14631 | }, |
84898e87 KY |
14632 | [ALC269_DMIC] = { |
14633 | .mixers = { alc269_laptop_mixer }, | |
14634 | .cap_mixer = alc269_laptop_digital_capture_mixer, | |
f53281e6 | 14635 | .init_verbs = { alc269_init_verbs, |
84898e87 KY |
14636 | alc269_laptop_dmic_init_verbs }, |
14637 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14638 | .dac_nids = alc269_dac_nids, | |
14639 | .hp_nid = 0x03, | |
14640 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14641 | .channel_mode = alc269_modes, | |
14642 | .unsol_event = alc269_laptop_unsol_event, | |
14643 | .setup = alc269_laptop_dmic_setup, | |
14644 | .init_hook = alc269_laptop_inithook, | |
14645 | }, | |
14646 | [ALC269VB_AMIC] = { | |
14647 | .mixers = { alc269vb_laptop_mixer }, | |
14648 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, | |
14649 | .init_verbs = { alc269vb_init_verbs, | |
14650 | alc269vb_laptop_amic_init_verbs }, | |
f53281e6 KY |
14651 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14652 | .dac_nids = alc269_dac_nids, | |
14653 | .hp_nid = 0x03, | |
14654 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14655 | .channel_mode = alc269_modes, | |
84898e87 | 14656 | .unsol_event = alc269_laptop_unsol_event, |
226b1ec8 | 14657 | .setup = alc269vb_laptop_amic_setup, |
84898e87 KY |
14658 | .init_hook = alc269_laptop_inithook, |
14659 | }, | |
14660 | [ALC269VB_DMIC] = { | |
14661 | .mixers = { alc269vb_laptop_mixer }, | |
14662 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
14663 | .init_verbs = { alc269vb_init_verbs, | |
14664 | alc269vb_laptop_dmic_init_verbs }, | |
14665 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14666 | .dac_nids = alc269_dac_nids, | |
14667 | .hp_nid = 0x03, | |
14668 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14669 | .channel_mode = alc269_modes, | |
14670 | .unsol_event = alc269_laptop_unsol_event, | |
14671 | .setup = alc269vb_laptop_dmic_setup, | |
14672 | .init_hook = alc269_laptop_inithook, | |
f53281e6 | 14673 | }, |
26f5df26 | 14674 | [ALC269_FUJITSU] = { |
45bdd1c1 | 14675 | .mixers = { alc269_fujitsu_mixer }, |
84898e87 | 14676 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
26f5df26 | 14677 | .init_verbs = { alc269_init_verbs, |
84898e87 | 14678 | alc269_laptop_dmic_init_verbs }, |
26f5df26 TI |
14679 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14680 | .dac_nids = alc269_dac_nids, | |
14681 | .hp_nid = 0x03, | |
14682 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14683 | .channel_mode = alc269_modes, | |
84898e87 KY |
14684 | .unsol_event = alc269_laptop_unsol_event, |
14685 | .setup = alc269_laptop_dmic_setup, | |
14686 | .init_hook = alc269_laptop_inithook, | |
26f5df26 | 14687 | }, |
64154835 TV |
14688 | [ALC269_LIFEBOOK] = { |
14689 | .mixers = { alc269_lifebook_mixer }, | |
14690 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | |
14691 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14692 | .dac_nids = alc269_dac_nids, | |
14693 | .hp_nid = 0x03, | |
14694 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14695 | .channel_mode = alc269_modes, | |
14696 | .input_mux = &alc269_capture_source, | |
14697 | .unsol_event = alc269_lifebook_unsol_event, | |
14698 | .init_hook = alc269_lifebook_init_hook, | |
14699 | }, | |
fe3eb0a7 KY |
14700 | [ALC271_ACER] = { |
14701 | .mixers = { alc269_asus_mixer }, | |
14702 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
14703 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, | |
14704 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14705 | .dac_nids = alc269_dac_nids, | |
14706 | .adc_nids = alc262_dmic_adc_nids, | |
14707 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), | |
14708 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
14709 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14710 | .channel_mode = alc269_modes, | |
14711 | .input_mux = &alc269_capture_source, | |
14712 | .dig_out_nid = ALC880_DIGOUT_NID, | |
14713 | .unsol_event = alc_sku_unsol_event, | |
14714 | .setup = alc269vb_laptop_dmic_setup, | |
14715 | .init_hook = alc_inithook, | |
14716 | }, | |
f6a92248 KY |
14717 | }; |
14718 | ||
14719 | static int patch_alc269(struct hda_codec *codec) | |
14720 | { | |
14721 | struct alc_spec *spec; | |
14722 | int board_config; | |
14723 | int err; | |
84898e87 | 14724 | int is_alc269vb = 0; |
f6a92248 KY |
14725 | |
14726 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
14727 | if (spec == NULL) | |
14728 | return -ENOMEM; | |
14729 | ||
14730 | codec->spec = spec; | |
14731 | ||
da00c244 KY |
14732 | alc_auto_parse_customize_define(codec); |
14733 | ||
274693f3 | 14734 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
c027ddcd KY |
14735 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
14736 | spec->cdefine.platform_type == 1) | |
14737 | alc_codec_rename(codec, "ALC271X"); | |
14738 | else | |
14739 | alc_codec_rename(codec, "ALC259"); | |
84898e87 | 14740 | is_alc269vb = 1; |
c027ddcd KY |
14741 | } else |
14742 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
274693f3 | 14743 | |
f6a92248 KY |
14744 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
14745 | alc269_models, | |
14746 | alc269_cfg_tbl); | |
14747 | ||
14748 | if (board_config < 0) { | |
9a11f1aa TI |
14749 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
14750 | codec->chip_name); | |
f6a92248 KY |
14751 | board_config = ALC269_AUTO; |
14752 | } | |
14753 | ||
ff818c24 TI |
14754 | if (board_config == ALC269_AUTO) |
14755 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); | |
14756 | ||
f6a92248 KY |
14757 | if (board_config == ALC269_AUTO) { |
14758 | /* automatic parse from the BIOS config */ | |
14759 | err = alc269_parse_auto_config(codec); | |
14760 | if (err < 0) { | |
14761 | alc_free(codec); | |
14762 | return err; | |
14763 | } else if (!err) { | |
14764 | printk(KERN_INFO | |
14765 | "hda_codec: Cannot set up configuration " | |
14766 | "from BIOS. Using base mode...\n"); | |
14767 | board_config = ALC269_BASIC; | |
14768 | } | |
14769 | } | |
14770 | ||
dc1eae25 | 14771 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
14772 | err = snd_hda_attach_beep_device(codec, 0x1); |
14773 | if (err < 0) { | |
14774 | alc_free(codec); | |
14775 | return err; | |
14776 | } | |
680cd536 KK |
14777 | } |
14778 | ||
f6a92248 | 14779 | if (board_config != ALC269_AUTO) |
e9c364c0 | 14780 | setup_preset(codec, &alc269_presets[board_config]); |
f6a92248 | 14781 | |
84898e87 | 14782 | if (board_config == ALC269_QUANTA_FL1) { |
f03d3115 TI |
14783 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
14784 | * fix the sample rate of analog I/O to 44.1kHz | |
14785 | */ | |
14786 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; | |
14787 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; | |
840b64c0 TI |
14788 | } else if (spec->dual_adc_switch) { |
14789 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
14790 | /* switch ADC dynamically */ | |
14791 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; | |
f03d3115 TI |
14792 | } else { |
14793 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
14794 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
14795 | } | |
f6a92248 KY |
14796 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
14797 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
14798 | ||
6694635d TI |
14799 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
14800 | if (!is_alc269vb) { | |
14801 | spec->adc_nids = alc269_adc_nids; | |
14802 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
14803 | spec->capsrc_nids = alc269_capsrc_nids; | |
14804 | } else { | |
14805 | spec->adc_nids = alc269vb_adc_nids; | |
14806 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); | |
14807 | spec->capsrc_nids = alc269vb_capsrc_nids; | |
14808 | } | |
84898e87 KY |
14809 | } |
14810 | ||
f9e336f6 | 14811 | if (!spec->cap_mixer) |
b59bdf3b | 14812 | set_capture_mixer(codec); |
dc1eae25 | 14813 | if (has_cdefine_beep(codec)) |
da00c244 | 14814 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
f6a92248 | 14815 | |
ff818c24 TI |
14816 | if (board_config == ALC269_AUTO) |
14817 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); | |
14818 | ||
100d5eb3 TI |
14819 | spec->vmaster_nid = 0x02; |
14820 | ||
f6a92248 KY |
14821 | codec->patch_ops = alc_patch_ops; |
14822 | if (board_config == ALC269_AUTO) | |
14823 | spec->init_hook = alc269_auto_init; | |
14824 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14825 | if (!spec->loopback.amplist) | |
14826 | spec->loopback.amplist = alc269_loopbacks; | |
ad35879a TI |
14827 | if (alc269_mic2_for_mute_led(codec)) |
14828 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; | |
f6a92248 KY |
14829 | #endif |
14830 | ||
14831 | return 0; | |
14832 | } | |
14833 | ||
df694daa KY |
14834 | /* |
14835 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
14836 | */ | |
14837 | ||
14838 | /* | |
14839 | * set the path ways for 2 channel output | |
14840 | * need to set the codec line out and mic 1 pin widgets to inputs | |
14841 | */ | |
14842 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
14843 | /* set pin widget 1Ah (line in) for input */ | |
14844 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
14845 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
14846 | * the vref | |
14847 | */ | |
df694daa KY |
14848 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
14849 | ||
9c7f852e TI |
14850 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
14851 | #if 0 | |
14852 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
14853 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
14854 | #endif | |
df694daa KY |
14855 | { } /* end */ |
14856 | }; | |
14857 | /* | |
14858 | * 6ch mode | |
14859 | * need to set the codec line out and mic 1 pin widgets to outputs | |
14860 | */ | |
14861 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
14862 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
14863 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14864 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
14865 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14866 | ||
14867 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
9c7f852e | 14868 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa | 14869 | |
9c7f852e TI |
14870 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
14871 | #if 0 | |
14872 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
14873 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
14874 | #endif | |
df694daa KY |
14875 | { } /* end */ |
14876 | }; | |
14877 | ||
14878 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
14879 | { 2, alc861_threestack_ch2_init }, | |
14880 | { 6, alc861_threestack_ch6_init }, | |
14881 | }; | |
22309c3e TI |
14882 | /* Set mic1 as input and unmute the mixer */ |
14883 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
14884 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
14885 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
14886 | { } /* end */ | |
14887 | }; | |
14888 | /* Set mic1 as output and mute mixer */ | |
14889 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
14890 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14891 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
14892 | { } /* end */ | |
14893 | }; | |
14894 | ||
14895 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
14896 | { 2, alc861_uniwill_m31_ch2_init }, | |
14897 | { 4, alc861_uniwill_m31_ch4_init }, | |
14898 | }; | |
df694daa | 14899 | |
7cdbff94 MD |
14900 | /* Set mic1 and line-in as input and unmute the mixer */ |
14901 | static struct hda_verb alc861_asus_ch2_init[] = { | |
14902 | /* set pin widget 1Ah (line in) for input */ | |
14903 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
14904 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
14905 | * the vref | |
14906 | */ | |
7cdbff94 MD |
14907 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
14908 | ||
14909 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
14910 | #if 0 | |
14911 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
14912 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
14913 | #endif | |
14914 | { } /* end */ | |
14915 | }; | |
14916 | /* Set mic1 nad line-in as output and mute mixer */ | |
14917 | static struct hda_verb alc861_asus_ch6_init[] = { | |
14918 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
14919 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14920 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
14921 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
14922 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
14923 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
14924 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14925 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
14926 | ||
14927 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
14928 | #if 0 | |
14929 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
14930 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
14931 | #endif | |
14932 | { } /* end */ | |
14933 | }; | |
14934 | ||
14935 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
14936 | { 2, alc861_asus_ch2_init }, | |
14937 | { 6, alc861_asus_ch6_init }, | |
14938 | }; | |
14939 | ||
df694daa KY |
14940 | /* patch-ALC861 */ |
14941 | ||
14942 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
14943 | /* output mixer control */ | |
14944 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14945 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
14946 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
14947 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
14948 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
14949 | ||
14950 | /*Input mixer control */ | |
14951 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
14952 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
14953 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
14954 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
14955 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
14956 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
14957 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
14958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
14959 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
14960 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 14961 | |
df694daa KY |
14962 | { } /* end */ |
14963 | }; | |
14964 | ||
14965 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
14966 | /* output mixer control */ | |
14967 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14968 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
14969 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
14970 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
14971 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
14972 | ||
14973 | /* Input mixer control */ | |
14974 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
14975 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
14976 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
14977 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
14978 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
14979 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
14980 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
14981 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
14982 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
14983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 14984 | |
df694daa KY |
14985 | { |
14986 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14987 | .name = "Channel Mode", | |
14988 | .info = alc_ch_mode_info, | |
14989 | .get = alc_ch_mode_get, | |
14990 | .put = alc_ch_mode_put, | |
14991 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
14992 | }, | |
14993 | { } /* end */ | |
a53d1aec TD |
14994 | }; |
14995 | ||
d1d985f0 | 14996 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
a53d1aec TD |
14997 | /* output mixer control */ |
14998 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
14999 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15000 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
ea1fb29a | 15001 | |
a53d1aec | 15002 | { } /* end */ |
f12ab1e0 | 15003 | }; |
a53d1aec | 15004 | |
22309c3e TI |
15005 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
15006 | /* output mixer control */ | |
15007 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15008 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15009 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15010 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15011 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
15012 | ||
15013 | /* Input mixer control */ | |
15014 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15015 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15016 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15017 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15018 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15019 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15022 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15023 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 15024 | |
22309c3e TI |
15025 | { |
15026 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15027 | .name = "Channel Mode", | |
15028 | .info = alc_ch_mode_info, | |
15029 | .get = alc_ch_mode_get, | |
15030 | .put = alc_ch_mode_put, | |
15031 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
15032 | }, | |
15033 | { } /* end */ | |
f12ab1e0 | 15034 | }; |
7cdbff94 MD |
15035 | |
15036 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
15037 | /* output mixer control */ | |
15038 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15039 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15040 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15041 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15042 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
15043 | ||
15044 | /* Input mixer control */ | |
15045 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15046 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
15047 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15048 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15050 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15051 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15052 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15053 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
f12ab1e0 TI |
15054 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
15055 | ||
7cdbff94 MD |
15056 | { |
15057 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15058 | .name = "Channel Mode", | |
15059 | .info = alc_ch_mode_info, | |
15060 | .get = alc_ch_mode_get, | |
15061 | .put = alc_ch_mode_put, | |
15062 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
15063 | }, | |
15064 | { } | |
56bb0cab TI |
15065 | }; |
15066 | ||
15067 | /* additional mixer */ | |
d1d985f0 | 15068 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
56bb0cab TI |
15069 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
15070 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
56bb0cab TI |
15071 | { } |
15072 | }; | |
7cdbff94 | 15073 | |
df694daa KY |
15074 | /* |
15075 | * generic initialization of ADC, input mixers and output mixers | |
15076 | */ | |
15077 | static struct hda_verb alc861_base_init_verbs[] = { | |
15078 | /* | |
15079 | * Unmute ADC0 and set the default input to mic-in | |
15080 | */ | |
15081 | /* port-A for surround (rear panel) */ | |
15082 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15083 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15084 | /* port-B for mic-in (rear panel) with vref */ | |
15085 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15086 | /* port-C for line-in (rear panel) */ | |
15087 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15088 | /* port-D for Front */ | |
15089 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15090 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15091 | /* port-E for HP out (front panel) */ | |
15092 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15093 | /* route front PCM to HP */ | |
9dece1d7 | 15094 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
15095 | /* port-F for mic-in (front panel) with vref */ |
15096 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15097 | /* port-G for CLFE (rear panel) */ | |
15098 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15099 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15100 | /* port-H for side (rear panel) */ | |
15101 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15102 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15103 | /* CD-in */ | |
15104 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15105 | /* route front mic to ADC1*/ | |
15106 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15107 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 15108 | |
df694daa KY |
15109 | /* Unmute DAC0~3 & spdif out*/ |
15110 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15111 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15112 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15113 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15114 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15115 | |
df694daa KY |
15116 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15117 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15118 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15119 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15120 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15121 | |
df694daa KY |
15122 | /* Unmute Stereo Mixer 15 */ |
15123 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15124 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15125 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15126 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
15127 | |
15128 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15129 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15130 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15131 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15132 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15133 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15134 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15135 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15136 | /* hp used DAC 3 (Front) */ |
15137 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
15138 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15139 | ||
15140 | { } | |
15141 | }; | |
15142 | ||
15143 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
15144 | /* | |
15145 | * Unmute ADC0 and set the default input to mic-in | |
15146 | */ | |
15147 | /* port-A for surround (rear panel) */ | |
15148 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15149 | /* port-B for mic-in (rear panel) with vref */ | |
15150 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15151 | /* port-C for line-in (rear panel) */ | |
15152 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15153 | /* port-D for Front */ | |
15154 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15155 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15156 | /* port-E for HP out (front panel) */ | |
15157 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15158 | /* route front PCM to HP */ | |
9dece1d7 | 15159 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
15160 | /* port-F for mic-in (front panel) with vref */ |
15161 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15162 | /* port-G for CLFE (rear panel) */ | |
15163 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15164 | /* port-H for side (rear panel) */ | |
15165 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15166 | /* CD-in */ | |
15167 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15168 | /* route front mic to ADC1*/ | |
15169 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15170 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15171 | /* Unmute DAC0~3 & spdif out*/ | |
15172 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15173 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15174 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15175 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15176 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15177 | |
df694daa KY |
15178 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15179 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15180 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15181 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15182 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15183 | |
df694daa KY |
15184 | /* Unmute Stereo Mixer 15 */ |
15185 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15186 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
15189 | |
15190 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15191 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15192 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15193 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15194 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15195 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15196 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15197 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15198 | /* hp used DAC 3 (Front) */ |
15199 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
15200 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15201 | { } | |
15202 | }; | |
22309c3e TI |
15203 | |
15204 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
15205 | /* | |
15206 | * Unmute ADC0 and set the default input to mic-in | |
15207 | */ | |
15208 | /* port-A for surround (rear panel) */ | |
15209 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15210 | /* port-B for mic-in (rear panel) with vref */ | |
15211 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15212 | /* port-C for line-in (rear panel) */ | |
15213 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15214 | /* port-D for Front */ | |
15215 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15216 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15217 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
15218 | /* this has to be set to VREF80 */ |
15219 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
22309c3e | 15220 | /* route front PCM to HP */ |
9dece1d7 | 15221 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
22309c3e TI |
15222 | /* port-F for mic-in (front panel) with vref */ |
15223 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15224 | /* port-G for CLFE (rear panel) */ | |
15225 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15226 | /* port-H for side (rear panel) */ | |
15227 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15228 | /* CD-in */ | |
15229 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15230 | /* route front mic to ADC1*/ | |
15231 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15232 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15233 | /* Unmute DAC0~3 & spdif out*/ | |
15234 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15235 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15236 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15237 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15239 | |
22309c3e TI |
15240 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15241 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15242 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15243 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15244 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15245 | |
22309c3e TI |
15246 | /* Unmute Stereo Mixer 15 */ |
15247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15248 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15250 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
22309c3e TI |
15251 | |
15252 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15253 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15254 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15255 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15256 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15257 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15258 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15259 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15260 | /* hp used DAC 3 (Front) */ |
15261 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
22309c3e TI |
15262 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15263 | { } | |
15264 | }; | |
15265 | ||
7cdbff94 MD |
15266 | static struct hda_verb alc861_asus_init_verbs[] = { |
15267 | /* | |
15268 | * Unmute ADC0 and set the default input to mic-in | |
15269 | */ | |
f12ab1e0 TI |
15270 | /* port-A for surround (rear panel) |
15271 | * according to codec#0 this is the HP jack | |
15272 | */ | |
7cdbff94 MD |
15273 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
15274 | /* route front PCM to HP */ | |
15275 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
15276 | /* port-B for mic-in (rear panel) with vref */ | |
15277 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15278 | /* port-C for line-in (rear panel) */ | |
15279 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15280 | /* port-D for Front */ | |
15281 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15282 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15283 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
15284 | /* this has to be set to VREF80 */ |
15285 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7cdbff94 | 15286 | /* route front PCM to HP */ |
9dece1d7 | 15287 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7cdbff94 MD |
15288 | /* port-F for mic-in (front panel) with vref */ |
15289 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15290 | /* port-G for CLFE (rear panel) */ | |
15291 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15292 | /* port-H for side (rear panel) */ | |
15293 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15294 | /* CD-in */ | |
15295 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15296 | /* route front mic to ADC1*/ | |
15297 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15298 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15299 | /* Unmute DAC0~3 & spdif out*/ | |
15300 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15301 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15302 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15303 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15304 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15305 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15306 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15307 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15308 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15309 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15310 | |
7cdbff94 MD |
15311 | /* Unmute Stereo Mixer 15 */ |
15312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15313 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15314 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15315 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
7cdbff94 MD |
15316 | |
15317 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15318 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15319 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15320 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15321 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15322 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15323 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15324 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15325 | /* hp used DAC 3 (Front) */ |
15326 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7cdbff94 MD |
15327 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15328 | { } | |
15329 | }; | |
15330 | ||
56bb0cab TI |
15331 | /* additional init verbs for ASUS laptops */ |
15332 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
15333 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
15334 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
15335 | { } | |
15336 | }; | |
7cdbff94 | 15337 | |
df694daa KY |
15338 | /* |
15339 | * generic initialization of ADC, input mixers and output mixers | |
15340 | */ | |
15341 | static struct hda_verb alc861_auto_init_verbs[] = { | |
15342 | /* | |
15343 | * Unmute ADC0 and set the default input to mic-in | |
15344 | */ | |
f12ab1e0 | 15345 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
df694daa | 15346 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
ea1fb29a | 15347 | |
df694daa KY |
15348 | /* Unmute DAC0~3 & spdif out*/ |
15349 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15350 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15351 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15352 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15353 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15354 | |
df694daa KY |
15355 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15356 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15357 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15358 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15359 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15360 | |
df694daa KY |
15361 | /* Unmute Stereo Mixer 15 */ |
15362 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15363 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15365 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
15366 | ||
1c20930a TI |
15367 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
15368 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15369 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15370 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15371 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15372 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15373 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15374 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
df694daa KY |
15375 | |
15376 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15377 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1c20930a TI |
15378 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
15379 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
df694daa KY |
15380 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
15381 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1c20930a TI |
15382 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
15383 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
df694daa | 15384 | |
f12ab1e0 | 15385 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
df694daa KY |
15386 | |
15387 | { } | |
15388 | }; | |
15389 | ||
a53d1aec TD |
15390 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
15391 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f12ab1e0 | 15392 | |
a53d1aec TD |
15393 | { } |
15394 | }; | |
15395 | ||
15396 | /* toggle speaker-output according to the hp-jack state */ | |
15397 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
15398 | { | |
864f92be | 15399 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
a53d1aec | 15400 | |
47fd830a TI |
15401 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
15402 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
15403 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
15404 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
a53d1aec TD |
15405 | } |
15406 | ||
15407 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
15408 | unsigned int res) | |
15409 | { | |
a53d1aec TD |
15410 | if ((res >> 26) == ALC880_HP_EVENT) |
15411 | alc861_toshiba_automute(codec); | |
15412 | } | |
15413 | ||
def319f9 | 15414 | /* pcm configuration: identical with ALC880 */ |
df694daa KY |
15415 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
15416 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
15417 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
15418 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
15419 | ||
15420 | ||
15421 | #define ALC861_DIGOUT_NID 0x07 | |
15422 | ||
15423 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
15424 | { 8, NULL } | |
15425 | }; | |
15426 | ||
15427 | static hda_nid_t alc861_dac_nids[4] = { | |
15428 | /* front, surround, clfe, side */ | |
15429 | 0x03, 0x06, 0x05, 0x04 | |
15430 | }; | |
15431 | ||
9c7f852e TI |
15432 | static hda_nid_t alc660_dac_nids[3] = { |
15433 | /* front, clfe, surround */ | |
15434 | 0x03, 0x05, 0x06 | |
15435 | }; | |
15436 | ||
df694daa KY |
15437 | static hda_nid_t alc861_adc_nids[1] = { |
15438 | /* ADC0-2 */ | |
15439 | 0x08, | |
15440 | }; | |
15441 | ||
15442 | static struct hda_input_mux alc861_capture_source = { | |
15443 | .num_items = 5, | |
15444 | .items = { | |
15445 | { "Mic", 0x0 }, | |
15446 | { "Front Mic", 0x3 }, | |
15447 | { "Line", 0x1 }, | |
15448 | { "CD", 0x4 }, | |
15449 | { "Mixer", 0x5 }, | |
15450 | }, | |
15451 | }; | |
15452 | ||
1c20930a TI |
15453 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
15454 | { | |
15455 | struct alc_spec *spec = codec->spec; | |
15456 | hda_nid_t mix, srcs[5]; | |
15457 | int i, j, num; | |
15458 | ||
15459 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | |
15460 | return 0; | |
15461 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15462 | if (num < 0) | |
15463 | return 0; | |
15464 | for (i = 0; i < num; i++) { | |
15465 | unsigned int type; | |
a22d543a | 15466 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
1c20930a TI |
15467 | if (type != AC_WID_AUD_OUT) |
15468 | continue; | |
15469 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
15470 | if (spec->multiout.dac_nids[j] == srcs[i]) | |
15471 | break; | |
15472 | if (j >= spec->multiout.num_dacs) | |
15473 | return srcs[i]; | |
15474 | } | |
15475 | return 0; | |
15476 | } | |
15477 | ||
df694daa | 15478 | /* fill in the dac_nids table from the parsed pin configuration */ |
1c20930a | 15479 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
f12ab1e0 | 15480 | const struct auto_pin_cfg *cfg) |
df694daa | 15481 | { |
1c20930a | 15482 | struct alc_spec *spec = codec->spec; |
df694daa | 15483 | int i; |
1c20930a | 15484 | hda_nid_t nid, dac; |
df694daa KY |
15485 | |
15486 | spec->multiout.dac_nids = spec->private_dac_nids; | |
15487 | for (i = 0; i < cfg->line_outs; i++) { | |
15488 | nid = cfg->line_out_pins[i]; | |
1c20930a TI |
15489 | dac = alc861_look_for_dac(codec, nid); |
15490 | if (!dac) | |
15491 | continue; | |
15492 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
df694daa | 15493 | } |
df694daa KY |
15494 | return 0; |
15495 | } | |
15496 | ||
1c20930a TI |
15497 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
15498 | hda_nid_t nid, unsigned int chs) | |
15499 | { | |
0afe5f89 | 15500 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
1c20930a TI |
15501 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
15502 | } | |
15503 | ||
df694daa | 15504 | /* add playback controls from the parsed DAC table */ |
1c20930a | 15505 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
df694daa KY |
15506 | const struct auto_pin_cfg *cfg) |
15507 | { | |
1c20930a | 15508 | struct alc_spec *spec = codec->spec; |
f12ab1e0 TI |
15509 | static const char *chname[4] = { |
15510 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
15511 | }; | |
df694daa | 15512 | hda_nid_t nid; |
1c20930a TI |
15513 | int i, err; |
15514 | ||
15515 | if (cfg->line_outs == 1) { | |
15516 | const char *pfx = NULL; | |
15517 | if (!cfg->hp_outs) | |
15518 | pfx = "Master"; | |
15519 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
15520 | pfx = "Speaker"; | |
15521 | if (pfx) { | |
15522 | nid = spec->multiout.dac_nids[0]; | |
15523 | return alc861_create_out_sw(codec, pfx, nid, 3); | |
15524 | } | |
15525 | } | |
df694daa KY |
15526 | |
15527 | for (i = 0; i < cfg->line_outs; i++) { | |
15528 | nid = spec->multiout.dac_nids[i]; | |
f12ab1e0 | 15529 | if (!nid) |
df694daa | 15530 | continue; |
1c20930a | 15531 | if (i == 2) { |
df694daa | 15532 | /* Center/LFE */ |
1c20930a | 15533 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
f12ab1e0 | 15534 | if (err < 0) |
df694daa | 15535 | return err; |
1c20930a | 15536 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
f12ab1e0 | 15537 | if (err < 0) |
df694daa KY |
15538 | return err; |
15539 | } else { | |
1c20930a | 15540 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
f12ab1e0 | 15541 | if (err < 0) |
df694daa KY |
15542 | return err; |
15543 | } | |
15544 | } | |
15545 | return 0; | |
15546 | } | |
15547 | ||
1c20930a | 15548 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
df694daa | 15549 | { |
1c20930a | 15550 | struct alc_spec *spec = codec->spec; |
df694daa KY |
15551 | int err; |
15552 | hda_nid_t nid; | |
15553 | ||
f12ab1e0 | 15554 | if (!pin) |
df694daa KY |
15555 | return 0; |
15556 | ||
15557 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
1c20930a TI |
15558 | nid = alc861_look_for_dac(codec, pin); |
15559 | if (nid) { | |
15560 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); | |
15561 | if (err < 0) | |
15562 | return err; | |
15563 | spec->multiout.hp_nid = nid; | |
15564 | } | |
df694daa KY |
15565 | } |
15566 | return 0; | |
15567 | } | |
15568 | ||
15569 | /* create playback/capture controls for input pins */ | |
05f5f477 | 15570 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
f12ab1e0 | 15571 | const struct auto_pin_cfg *cfg) |
df694daa | 15572 | { |
05f5f477 | 15573 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
df694daa KY |
15574 | } |
15575 | ||
f12ab1e0 TI |
15576 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
15577 | hda_nid_t nid, | |
1c20930a | 15578 | int pin_type, hda_nid_t dac) |
df694daa | 15579 | { |
1c20930a TI |
15580 | hda_nid_t mix, srcs[5]; |
15581 | int i, num; | |
15582 | ||
564c5bea JL |
15583 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
15584 | pin_type); | |
1c20930a | 15585 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
564c5bea | 15586 | AMP_OUT_UNMUTE); |
1c20930a TI |
15587 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
15588 | return; | |
15589 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15590 | if (num < 0) | |
15591 | return; | |
15592 | for (i = 0; i < num; i++) { | |
15593 | unsigned int mute; | |
15594 | if (srcs[i] == dac || srcs[i] == 0x15) | |
15595 | mute = AMP_IN_UNMUTE(i); | |
15596 | else | |
15597 | mute = AMP_IN_MUTE(i); | |
15598 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15599 | mute); | |
15600 | } | |
df694daa KY |
15601 | } |
15602 | ||
15603 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
15604 | { | |
15605 | struct alc_spec *spec = codec->spec; | |
15606 | int i; | |
15607 | ||
15608 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
15609 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 15610 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 15611 | if (nid) |
baba8ee9 | 15612 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 15613 | spec->multiout.dac_nids[i]); |
df694daa KY |
15614 | } |
15615 | } | |
15616 | ||
15617 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
15618 | { | |
15619 | struct alc_spec *spec = codec->spec; | |
df694daa | 15620 | |
15870f05 TI |
15621 | if (spec->autocfg.hp_outs) |
15622 | alc861_auto_set_output_and_unmute(codec, | |
15623 | spec->autocfg.hp_pins[0], | |
15624 | PIN_HP, | |
1c20930a | 15625 | spec->multiout.hp_nid); |
15870f05 TI |
15626 | if (spec->autocfg.speaker_outs) |
15627 | alc861_auto_set_output_and_unmute(codec, | |
15628 | spec->autocfg.speaker_pins[0], | |
15629 | PIN_OUT, | |
1c20930a | 15630 | spec->multiout.dac_nids[0]); |
df694daa KY |
15631 | } |
15632 | ||
15633 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
15634 | { | |
15635 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 15636 | struct auto_pin_cfg *cfg = &spec->autocfg; |
df694daa KY |
15637 | int i; |
15638 | ||
66ceeb6b TI |
15639 | for (i = 0; i < cfg->num_inputs; i++) { |
15640 | hda_nid_t nid = cfg->inputs[i].pin; | |
23f0c048 TI |
15641 | if (nid >= 0x0c && nid <= 0x11) |
15642 | alc_set_input_pin(codec, nid, i); | |
df694daa KY |
15643 | } |
15644 | } | |
15645 | ||
15646 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
15647 | /* return 1 if successful, 0 if the proper config is not found, |
15648 | * or a negative error code | |
15649 | */ | |
df694daa KY |
15650 | static int alc861_parse_auto_config(struct hda_codec *codec) |
15651 | { | |
15652 | struct alc_spec *spec = codec->spec; | |
15653 | int err; | |
15654 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
15655 | ||
f12ab1e0 TI |
15656 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
15657 | alc861_ignore); | |
15658 | if (err < 0) | |
df694daa | 15659 | return err; |
f12ab1e0 | 15660 | if (!spec->autocfg.line_outs) |
df694daa KY |
15661 | return 0; /* can't find valid BIOS pin config */ |
15662 | ||
1c20930a | 15663 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
f12ab1e0 TI |
15664 | if (err < 0) |
15665 | return err; | |
1c20930a | 15666 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
f12ab1e0 TI |
15667 | if (err < 0) |
15668 | return err; | |
1c20930a | 15669 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
f12ab1e0 TI |
15670 | if (err < 0) |
15671 | return err; | |
05f5f477 | 15672 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 15673 | if (err < 0) |
df694daa KY |
15674 | return err; |
15675 | ||
15676 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
15677 | ||
757899ac | 15678 | alc_auto_parse_digital(codec); |
df694daa | 15679 | |
603c4019 | 15680 | if (spec->kctls.list) |
d88897ea | 15681 | add_mixer(spec, spec->kctls.list); |
df694daa | 15682 | |
d88897ea | 15683 | add_verb(spec, alc861_auto_init_verbs); |
df694daa | 15684 | |
a1e8d2da | 15685 | spec->num_mux_defs = 1; |
61b9b9b1 | 15686 | spec->input_mux = &spec->private_imux[0]; |
df694daa KY |
15687 | |
15688 | spec->adc_nids = alc861_adc_nids; | |
15689 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
b59bdf3b | 15690 | set_capture_mixer(codec); |
df694daa | 15691 | |
6227cdce | 15692 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
4a79ba34 | 15693 | |
df694daa KY |
15694 | return 1; |
15695 | } | |
15696 | ||
ae6b813a TI |
15697 | /* additional initialization for auto-configuration model */ |
15698 | static void alc861_auto_init(struct hda_codec *codec) | |
df694daa | 15699 | { |
f6c7e546 | 15700 | struct alc_spec *spec = codec->spec; |
df694daa KY |
15701 | alc861_auto_init_multi_out(codec); |
15702 | alc861_auto_init_hp_out(codec); | |
15703 | alc861_auto_init_analog_input(codec); | |
757899ac | 15704 | alc_auto_init_digital(codec); |
f6c7e546 | 15705 | if (spec->unsol_event) |
7fb0d78f | 15706 | alc_inithook(codec); |
df694daa KY |
15707 | } |
15708 | ||
cb53c626 TI |
15709 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15710 | static struct hda_amp_list alc861_loopbacks[] = { | |
15711 | { 0x15, HDA_INPUT, 0 }, | |
15712 | { 0x15, HDA_INPUT, 1 }, | |
15713 | { 0x15, HDA_INPUT, 2 }, | |
15714 | { 0x15, HDA_INPUT, 3 }, | |
15715 | { } /* end */ | |
15716 | }; | |
15717 | #endif | |
15718 | ||
df694daa KY |
15719 | |
15720 | /* | |
15721 | * configuration and preset | |
15722 | */ | |
f5fcc13c TI |
15723 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
15724 | [ALC861_3ST] = "3stack", | |
15725 | [ALC660_3ST] = "3stack-660", | |
15726 | [ALC861_3ST_DIG] = "3stack-dig", | |
15727 | [ALC861_6ST_DIG] = "6stack-dig", | |
15728 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
15729 | [ALC861_TOSHIBA] = "toshiba", | |
15730 | [ALC861_ASUS] = "asus", | |
15731 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
15732 | [ALC861_AUTO] = "auto", | |
15733 | }; | |
15734 | ||
15735 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
687a47bd | 15736 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
f5fcc13c TI |
15737 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
15738 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
15739 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
ac3e3741 | 15740 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
83c34218 | 15741 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
ad5e7737 | 15742 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
341d4eb0 TI |
15743 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
15744 | * Any other models that need this preset? | |
15745 | */ | |
15746 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
ac3e3741 TI |
15747 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
15748 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
4147dab6 | 15749 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
ac3e3741 TI |
15750 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
15751 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
15752 | /* FIXME: the below seems conflict */ | |
15753 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
07e038b3 | 15754 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
f5fcc13c | 15755 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
df694daa KY |
15756 | {} |
15757 | }; | |
15758 | ||
15759 | static struct alc_config_preset alc861_presets[] = { | |
15760 | [ALC861_3ST] = { | |
15761 | .mixers = { alc861_3ST_mixer }, | |
15762 | .init_verbs = { alc861_threestack_init_verbs }, | |
15763 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15764 | .dac_nids = alc861_dac_nids, | |
15765 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
15766 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 15767 | .need_dac_fix = 1, |
df694daa KY |
15768 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
15769 | .adc_nids = alc861_adc_nids, | |
15770 | .input_mux = &alc861_capture_source, | |
15771 | }, | |
15772 | [ALC861_3ST_DIG] = { | |
15773 | .mixers = { alc861_base_mixer }, | |
15774 | .init_verbs = { alc861_threestack_init_verbs }, | |
15775 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15776 | .dac_nids = alc861_dac_nids, | |
15777 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15778 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
15779 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 15780 | .need_dac_fix = 1, |
df694daa KY |
15781 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
15782 | .adc_nids = alc861_adc_nids, | |
15783 | .input_mux = &alc861_capture_source, | |
15784 | }, | |
15785 | [ALC861_6ST_DIG] = { | |
15786 | .mixers = { alc861_base_mixer }, | |
15787 | .init_verbs = { alc861_base_init_verbs }, | |
15788 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15789 | .dac_nids = alc861_dac_nids, | |
15790 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15791 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
15792 | .channel_mode = alc861_8ch_modes, | |
15793 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15794 | .adc_nids = alc861_adc_nids, | |
15795 | .input_mux = &alc861_capture_source, | |
15796 | }, | |
9c7f852e TI |
15797 | [ALC660_3ST] = { |
15798 | .mixers = { alc861_3ST_mixer }, | |
15799 | .init_verbs = { alc861_threestack_init_verbs }, | |
15800 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
15801 | .dac_nids = alc660_dac_nids, | |
15802 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
15803 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 15804 | .need_dac_fix = 1, |
9c7f852e TI |
15805 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
15806 | .adc_nids = alc861_adc_nids, | |
15807 | .input_mux = &alc861_capture_source, | |
15808 | }, | |
22309c3e TI |
15809 | [ALC861_UNIWILL_M31] = { |
15810 | .mixers = { alc861_uniwill_m31_mixer }, | |
15811 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
15812 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15813 | .dac_nids = alc861_dac_nids, | |
15814 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15815 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
15816 | .channel_mode = alc861_uniwill_m31_modes, | |
15817 | .need_dac_fix = 1, | |
15818 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15819 | .adc_nids = alc861_adc_nids, | |
15820 | .input_mux = &alc861_capture_source, | |
15821 | }, | |
a53d1aec TD |
15822 | [ALC861_TOSHIBA] = { |
15823 | .mixers = { alc861_toshiba_mixer }, | |
f12ab1e0 TI |
15824 | .init_verbs = { alc861_base_init_verbs, |
15825 | alc861_toshiba_init_verbs }, | |
a53d1aec TD |
15826 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
15827 | .dac_nids = alc861_dac_nids, | |
15828 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
15829 | .channel_mode = alc883_3ST_2ch_modes, | |
15830 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15831 | .adc_nids = alc861_adc_nids, | |
15832 | .input_mux = &alc861_capture_source, | |
15833 | .unsol_event = alc861_toshiba_unsol_event, | |
15834 | .init_hook = alc861_toshiba_automute, | |
15835 | }, | |
7cdbff94 MD |
15836 | [ALC861_ASUS] = { |
15837 | .mixers = { alc861_asus_mixer }, | |
15838 | .init_verbs = { alc861_asus_init_verbs }, | |
15839 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15840 | .dac_nids = alc861_dac_nids, | |
15841 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15842 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
15843 | .channel_mode = alc861_asus_modes, | |
15844 | .need_dac_fix = 1, | |
15845 | .hp_nid = 0x06, | |
15846 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15847 | .adc_nids = alc861_adc_nids, | |
15848 | .input_mux = &alc861_capture_source, | |
15849 | }, | |
56bb0cab TI |
15850 | [ALC861_ASUS_LAPTOP] = { |
15851 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
15852 | .init_verbs = { alc861_asus_init_verbs, | |
15853 | alc861_asus_laptop_init_verbs }, | |
15854 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
15855 | .dac_nids = alc861_dac_nids, | |
15856 | .dig_out_nid = ALC861_DIGOUT_NID, | |
15857 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
15858 | .channel_mode = alc883_3ST_2ch_modes, | |
15859 | .need_dac_fix = 1, | |
15860 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
15861 | .adc_nids = alc861_adc_nids, | |
15862 | .input_mux = &alc861_capture_source, | |
15863 | }, | |
15864 | }; | |
df694daa | 15865 | |
cfc9b06f TI |
15866 | /* Pin config fixes */ |
15867 | enum { | |
15868 | PINFIX_FSC_AMILO_PI1505, | |
15869 | }; | |
15870 | ||
cfc9b06f TI |
15871 | static const struct alc_fixup alc861_fixups[] = { |
15872 | [PINFIX_FSC_AMILO_PI1505] = { | |
73413b12 TI |
15873 | .pins = (const struct alc_pincfg[]) { |
15874 | { 0x0b, 0x0221101f }, /* HP */ | |
15875 | { 0x0f, 0x90170310 }, /* speaker */ | |
15876 | { } | |
15877 | } | |
cfc9b06f TI |
15878 | }, |
15879 | }; | |
15880 | ||
15881 | static struct snd_pci_quirk alc861_fixup_tbl[] = { | |
15882 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), | |
15883 | {} | |
15884 | }; | |
df694daa KY |
15885 | |
15886 | static int patch_alc861(struct hda_codec *codec) | |
15887 | { | |
15888 | struct alc_spec *spec; | |
15889 | int board_config; | |
15890 | int err; | |
15891 | ||
dc041e0b | 15892 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
15893 | if (spec == NULL) |
15894 | return -ENOMEM; | |
15895 | ||
f12ab1e0 | 15896 | codec->spec = spec; |
df694daa | 15897 | |
f5fcc13c TI |
15898 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
15899 | alc861_models, | |
15900 | alc861_cfg_tbl); | |
9c7f852e | 15901 | |
f5fcc13c | 15902 | if (board_config < 0) { |
9a11f1aa TI |
15903 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
15904 | codec->chip_name); | |
df694daa KY |
15905 | board_config = ALC861_AUTO; |
15906 | } | |
15907 | ||
7fa90e87 TI |
15908 | if (board_config == ALC861_AUTO) |
15909 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); | |
cfc9b06f | 15910 | |
df694daa KY |
15911 | if (board_config == ALC861_AUTO) { |
15912 | /* automatic parse from the BIOS config */ | |
15913 | err = alc861_parse_auto_config(codec); | |
15914 | if (err < 0) { | |
15915 | alc_free(codec); | |
15916 | return err; | |
f12ab1e0 | 15917 | } else if (!err) { |
9c7f852e TI |
15918 | printk(KERN_INFO |
15919 | "hda_codec: Cannot set up configuration " | |
15920 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
15921 | board_config = ALC861_3ST_DIG; |
15922 | } | |
15923 | } | |
15924 | ||
680cd536 KK |
15925 | err = snd_hda_attach_beep_device(codec, 0x23); |
15926 | if (err < 0) { | |
15927 | alc_free(codec); | |
15928 | return err; | |
15929 | } | |
15930 | ||
df694daa | 15931 | if (board_config != ALC861_AUTO) |
e9c364c0 | 15932 | setup_preset(codec, &alc861_presets[board_config]); |
df694daa | 15933 | |
df694daa KY |
15934 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
15935 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
15936 | ||
df694daa KY |
15937 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
15938 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
15939 | ||
c7a8eb10 TI |
15940 | if (!spec->cap_mixer) |
15941 | set_capture_mixer(codec); | |
45bdd1c1 TI |
15942 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
15943 | ||
2134ea4f TI |
15944 | spec->vmaster_nid = 0x03; |
15945 | ||
7fa90e87 TI |
15946 | if (board_config == ALC861_AUTO) |
15947 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); | |
15948 | ||
df694daa | 15949 | codec->patch_ops = alc_patch_ops; |
c97259df | 15950 | if (board_config == ALC861_AUTO) { |
ae6b813a | 15951 | spec->init_hook = alc861_auto_init; |
c97259df DC |
15952 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15953 | spec->power_hook = alc_power_eapd; | |
15954 | #endif | |
15955 | } | |
cb53c626 TI |
15956 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15957 | if (!spec->loopback.amplist) | |
15958 | spec->loopback.amplist = alc861_loopbacks; | |
15959 | #endif | |
ea1fb29a | 15960 | |
1da177e4 LT |
15961 | return 0; |
15962 | } | |
15963 | ||
f32610ed JS |
15964 | /* |
15965 | * ALC861-VD support | |
15966 | * | |
15967 | * Based on ALC882 | |
15968 | * | |
15969 | * In addition, an independent DAC | |
15970 | */ | |
15971 | #define ALC861VD_DIGOUT_NID 0x06 | |
15972 | ||
15973 | static hda_nid_t alc861vd_dac_nids[4] = { | |
15974 | /* front, surr, clfe, side surr */ | |
15975 | 0x02, 0x03, 0x04, 0x05 | |
15976 | }; | |
15977 | ||
15978 | /* dac_nids for ALC660vd are in a different order - according to | |
15979 | * Realtek's driver. | |
def319f9 | 15980 | * This should probably result in a different mixer for 6stack models |
f32610ed JS |
15981 | * of ALC660vd codecs, but for now there is only 3stack mixer |
15982 | * - and it is the same as in 861vd. | |
15983 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
15984 | */ | |
15985 | static hda_nid_t alc660vd_dac_nids[3] = { | |
15986 | /* front, rear, clfe, rear_surr */ | |
15987 | 0x02, 0x04, 0x03 | |
15988 | }; | |
15989 | ||
15990 | static hda_nid_t alc861vd_adc_nids[1] = { | |
15991 | /* ADC0 */ | |
15992 | 0x09, | |
15993 | }; | |
15994 | ||
e1406348 TI |
15995 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
15996 | ||
f32610ed JS |
15997 | /* input MUX */ |
15998 | /* FIXME: should be a matrix-type input source selection */ | |
15999 | static struct hda_input_mux alc861vd_capture_source = { | |
16000 | .num_items = 4, | |
16001 | .items = { | |
16002 | { "Mic", 0x0 }, | |
16003 | { "Front Mic", 0x1 }, | |
16004 | { "Line", 0x2 }, | |
16005 | { "CD", 0x4 }, | |
16006 | }, | |
16007 | }; | |
16008 | ||
272a527c | 16009 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
b419f346 | 16010 | .num_items = 2, |
272a527c | 16011 | .items = { |
b419f346 TD |
16012 | { "Ext Mic", 0x0 }, |
16013 | { "Int Mic", 0x1 }, | |
272a527c KY |
16014 | }, |
16015 | }; | |
16016 | ||
d1a991a6 KY |
16017 | static struct hda_input_mux alc861vd_hp_capture_source = { |
16018 | .num_items = 2, | |
16019 | .items = { | |
16020 | { "Front Mic", 0x0 }, | |
16021 | { "ATAPI Mic", 0x1 }, | |
16022 | }, | |
16023 | }; | |
16024 | ||
f32610ed JS |
16025 | /* |
16026 | * 2ch mode | |
16027 | */ | |
16028 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
16029 | { 2, NULL } | |
16030 | }; | |
16031 | ||
16032 | /* | |
16033 | * 6ch mode | |
16034 | */ | |
16035 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
16036 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
16037 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16038 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16039 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16040 | { } /* end */ | |
16041 | }; | |
16042 | ||
16043 | /* | |
16044 | * 8ch mode | |
16045 | */ | |
16046 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
16047 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16048 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16049 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16050 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16051 | { } /* end */ | |
16052 | }; | |
16053 | ||
16054 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
16055 | { 6, alc861vd_6stack_ch6_init }, | |
16056 | { 8, alc861vd_6stack_ch8_init }, | |
16057 | }; | |
16058 | ||
16059 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
16060 | { | |
16061 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
16062 | .name = "Channel Mode", | |
16063 | .info = alc_ch_mode_info, | |
16064 | .get = alc_ch_mode_get, | |
16065 | .put = alc_ch_mode_put, | |
16066 | }, | |
16067 | { } /* end */ | |
16068 | }; | |
16069 | ||
f32610ed JS |
16070 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
16071 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
16072 | */ | |
16073 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
16074 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16075 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16076 | ||
16077 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16078 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
16079 | ||
16080 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
16081 | HDA_OUTPUT), | |
16082 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
16083 | HDA_OUTPUT), | |
16084 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
16085 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16086 | ||
16087 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
16088 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
16089 | ||
16090 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16091 | ||
16092 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16095 | ||
16096 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16097 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16098 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16099 | ||
16100 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16101 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16102 | ||
16103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16104 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16105 | ||
f32610ed JS |
16106 | { } /* end */ |
16107 | }; | |
16108 | ||
16109 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
16110 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16111 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16112 | ||
16113 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16114 | ||
16115 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16117 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16118 | ||
16119 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16120 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16121 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16122 | ||
16123 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16124 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16125 | ||
16126 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16127 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16128 | ||
f32610ed JS |
16129 | { } /* end */ |
16130 | }; | |
16131 | ||
bdd148a3 KY |
16132 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
16133 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16134 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
16135 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
16136 | ||
16137 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16138 | ||
16139 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16140 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16141 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16142 | ||
16143 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16144 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16145 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16146 | ||
16147 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16148 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16149 | ||
16150 | { } /* end */ | |
16151 | }; | |
16152 | ||
b419f346 TD |
16153 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
16154 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
272a527c KY |
16155 | */ |
16156 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
b419f346 TD |
16157 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
16158 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
272a527c KY |
16159 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
16160 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
b419f346 TD |
16161 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
16162 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16163 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16164 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
16165 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16166 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
272a527c KY |
16167 | { } /* end */ |
16168 | }; | |
16169 | ||
d1a991a6 KY |
16170 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
16171 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
16172 | */ | |
16173 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
16174 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16175 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16176 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16177 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
16178 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16179 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16180 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16181 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ea1fb29a | 16182 | |
d1a991a6 KY |
16183 | { } /* end */ |
16184 | }; | |
16185 | ||
f32610ed JS |
16186 | /* |
16187 | * generic initialization of ADC, input mixers and output mixers | |
16188 | */ | |
16189 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
16190 | /* | |
16191 | * Unmute ADC0 and set the default input to mic-in | |
16192 | */ | |
16193 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16194 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16195 | ||
16196 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
16197 | * the analog-loopback mixer widget | |
16198 | */ | |
16199 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
16200 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
16201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16203 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16204 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
f32610ed JS |
16205 | |
16206 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
bdd148a3 KY |
16207 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
16208 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16209 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f32610ed | 16210 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
f32610ed JS |
16211 | |
16212 | /* | |
16213 | * Set up output mixers (0x02 - 0x05) | |
16214 | */ | |
16215 | /* set vol=0 to output mixers */ | |
16216 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16217 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16218 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16219 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16220 | ||
16221 | /* set up input amps for analog loopback */ | |
16222 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
16223 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16225 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16226 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16227 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16228 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16229 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16230 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16231 | ||
16232 | { } | |
16233 | }; | |
16234 | ||
16235 | /* | |
16236 | * 3-stack pin configuration: | |
16237 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
16238 | */ | |
16239 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
16240 | /* | |
16241 | * Set pin mode and muting | |
16242 | */ | |
16243 | /* set front pin widgets 0x14 for output */ | |
16244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16245 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16246 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16247 | ||
16248 | /* Mic (rear) pin: input vref at 80% */ | |
16249 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16250 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16251 | /* Front Mic pin: input vref at 80% */ | |
16252 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16253 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16254 | /* Line In pin: input */ | |
16255 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16256 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16257 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16258 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16259 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16260 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16261 | /* CD pin widget for input */ | |
16262 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16263 | ||
16264 | { } | |
16265 | }; | |
16266 | ||
16267 | /* | |
16268 | * 6-stack pin configuration: | |
16269 | */ | |
16270 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
16271 | /* | |
16272 | * Set pin mode and muting | |
16273 | */ | |
16274 | /* set front pin widgets 0x14 for output */ | |
16275 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16276 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16277 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16278 | ||
16279 | /* Rear Pin: output 1 (0x0d) */ | |
16280 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16281 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16282 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
16283 | /* CLFE Pin: output 2 (0x0e) */ | |
16284 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16285 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16286 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16287 | /* Side Pin: output 3 (0x0f) */ | |
16288 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16289 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16290 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
16291 | ||
16292 | /* Mic (rear) pin: input vref at 80% */ | |
16293 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16294 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16295 | /* Front Mic pin: input vref at 80% */ | |
16296 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16297 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16298 | /* Line In pin: input */ | |
16299 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16300 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16301 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16302 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16303 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16304 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16305 | /* CD pin widget for input */ | |
16306 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16307 | ||
16308 | { } | |
16309 | }; | |
16310 | ||
bdd148a3 KY |
16311 | static struct hda_verb alc861vd_eapd_verbs[] = { |
16312 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16313 | { } | |
16314 | }; | |
16315 | ||
f9423e7a KY |
16316 | static struct hda_verb alc660vd_eapd_verbs[] = { |
16317 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16318 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16319 | { } | |
16320 | }; | |
16321 | ||
bdd148a3 KY |
16322 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
16323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16325 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
16326 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
ea1fb29a | 16327 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
bdd148a3 KY |
16328 | {} |
16329 | }; | |
16330 | ||
bdd148a3 KY |
16331 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
16332 | { | |
16333 | unsigned int present; | |
16334 | unsigned char bits; | |
16335 | ||
864f92be | 16336 | present = snd_hda_jack_detect(codec, 0x18); |
47fd830a | 16337 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 16338 | |
47fd830a TI |
16339 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
16340 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
16341 | } |
16342 | ||
4f5d1706 | 16343 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
bdd148a3 | 16344 | { |
a9fd4f3f | 16345 | struct alc_spec *spec = codec->spec; |
a9fd4f3f TI |
16346 | spec->autocfg.hp_pins[0] = 0x1b; |
16347 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
16348 | } |
16349 | ||
16350 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | |
16351 | { | |
a9fd4f3f | 16352 | alc_automute_amp(codec); |
bdd148a3 KY |
16353 | alc861vd_lenovo_mic_automute(codec); |
16354 | } | |
16355 | ||
16356 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
16357 | unsigned int res) | |
16358 | { | |
16359 | switch (res >> 26) { | |
bdd148a3 KY |
16360 | case ALC880_MIC_EVENT: |
16361 | alc861vd_lenovo_mic_automute(codec); | |
16362 | break; | |
a9fd4f3f TI |
16363 | default: |
16364 | alc_automute_amp_unsol_event(codec, res); | |
16365 | break; | |
bdd148a3 KY |
16366 | } |
16367 | } | |
16368 | ||
272a527c KY |
16369 | static struct hda_verb alc861vd_dallas_verbs[] = { |
16370 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16371 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16372 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16373 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16374 | ||
16375 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16376 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16377 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16378 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16379 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16380 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16381 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16382 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
ea1fb29a | 16383 | |
272a527c KY |
16384 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16385 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16386 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16387 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16388 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16389 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16390 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16391 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16392 | ||
16393 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16394 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16395 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16396 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16397 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16398 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16399 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16400 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16401 | ||
16402 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16403 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16404 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16405 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16406 | ||
16407 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 16408 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
272a527c KY |
16409 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
16410 | ||
16411 | { } /* end */ | |
16412 | }; | |
16413 | ||
16414 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 16415 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
272a527c | 16416 | { |
a9fd4f3f | 16417 | struct alc_spec *spec = codec->spec; |
272a527c | 16418 | |
a9fd4f3f TI |
16419 | spec->autocfg.hp_pins[0] = 0x15; |
16420 | spec->autocfg.speaker_pins[0] = 0x14; | |
272a527c KY |
16421 | } |
16422 | ||
cb53c626 TI |
16423 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16424 | #define alc861vd_loopbacks alc880_loopbacks | |
16425 | #endif | |
16426 | ||
def319f9 | 16427 | /* pcm configuration: identical with ALC880 */ |
f32610ed JS |
16428 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
16429 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
16430 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
16431 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
16432 | ||
16433 | /* | |
16434 | * configuration and preset | |
16435 | */ | |
16436 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |
16437 | [ALC660VD_3ST] = "3stack-660", | |
983f8ae4 | 16438 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
13c94744 | 16439 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
f32610ed JS |
16440 | [ALC861VD_3ST] = "3stack", |
16441 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
16442 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
bdd148a3 | 16443 | [ALC861VD_LENOVO] = "lenovo", |
272a527c | 16444 | [ALC861VD_DALLAS] = "dallas", |
983f8ae4 | 16445 | [ALC861VD_HP] = "hp", |
f32610ed JS |
16446 | [ALC861VD_AUTO] = "auto", |
16447 | }; | |
16448 | ||
16449 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
ac3e3741 TI |
16450 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
16451 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
07e038b3 | 16452 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
f8f25ba3 | 16453 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
13c94744 | 16454 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
6963f84c | 16455 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
f32610ed | 16456 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
ac3e3741 | 16457 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
38baf5ad | 16458 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
ce577e8c | 16459 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
542d7c66 | 16460 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
b419f346 | 16461 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
39c5d41f | 16462 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
dea0a509 | 16463 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
625dc0bf | 16464 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
f32610ed JS |
16465 | {} |
16466 | }; | |
16467 | ||
16468 | static struct alc_config_preset alc861vd_presets[] = { | |
16469 | [ALC660VD_3ST] = { | |
16470 | .mixers = { alc861vd_3st_mixer }, | |
16471 | .init_verbs = { alc861vd_volume_init_verbs, | |
16472 | alc861vd_3stack_init_verbs }, | |
16473 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16474 | .dac_nids = alc660vd_dac_nids, | |
f32610ed JS |
16475 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16476 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16477 | .input_mux = &alc861vd_capture_source, | |
16478 | }, | |
6963f84c MC |
16479 | [ALC660VD_3ST_DIG] = { |
16480 | .mixers = { alc861vd_3st_mixer }, | |
16481 | .init_verbs = { alc861vd_volume_init_verbs, | |
16482 | alc861vd_3stack_init_verbs }, | |
16483 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16484 | .dac_nids = alc660vd_dac_nids, | |
16485 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
6963f84c MC |
16486 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16487 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16488 | .input_mux = &alc861vd_capture_source, | |
16489 | }, | |
f32610ed JS |
16490 | [ALC861VD_3ST] = { |
16491 | .mixers = { alc861vd_3st_mixer }, | |
16492 | .init_verbs = { alc861vd_volume_init_verbs, | |
16493 | alc861vd_3stack_init_verbs }, | |
16494 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16495 | .dac_nids = alc861vd_dac_nids, | |
16496 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16497 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16498 | .input_mux = &alc861vd_capture_source, | |
16499 | }, | |
16500 | [ALC861VD_3ST_DIG] = { | |
16501 | .mixers = { alc861vd_3st_mixer }, | |
16502 | .init_verbs = { alc861vd_volume_init_verbs, | |
16503 | alc861vd_3stack_init_verbs }, | |
16504 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16505 | .dac_nids = alc861vd_dac_nids, | |
16506 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16507 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16508 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16509 | .input_mux = &alc861vd_capture_source, | |
16510 | }, | |
16511 | [ALC861VD_6ST_DIG] = { | |
16512 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
16513 | .init_verbs = { alc861vd_volume_init_verbs, | |
16514 | alc861vd_6stack_init_verbs }, | |
16515 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16516 | .dac_nids = alc861vd_dac_nids, | |
16517 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16518 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
16519 | .channel_mode = alc861vd_6stack_modes, | |
16520 | .input_mux = &alc861vd_capture_source, | |
16521 | }, | |
bdd148a3 KY |
16522 | [ALC861VD_LENOVO] = { |
16523 | .mixers = { alc861vd_lenovo_mixer }, | |
16524 | .init_verbs = { alc861vd_volume_init_verbs, | |
16525 | alc861vd_3stack_init_verbs, | |
16526 | alc861vd_eapd_verbs, | |
16527 | alc861vd_lenovo_unsol_verbs }, | |
16528 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16529 | .dac_nids = alc660vd_dac_nids, | |
bdd148a3 KY |
16530 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16531 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16532 | .input_mux = &alc861vd_capture_source, | |
16533 | .unsol_event = alc861vd_lenovo_unsol_event, | |
4f5d1706 | 16534 | .setup = alc861vd_lenovo_setup, |
a9fd4f3f | 16535 | .init_hook = alc861vd_lenovo_init_hook, |
bdd148a3 | 16536 | }, |
272a527c KY |
16537 | [ALC861VD_DALLAS] = { |
16538 | .mixers = { alc861vd_dallas_mixer }, | |
16539 | .init_verbs = { alc861vd_dallas_verbs }, | |
16540 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16541 | .dac_nids = alc861vd_dac_nids, | |
272a527c KY |
16542 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16543 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16544 | .input_mux = &alc861vd_dallas_capture_source, | |
a9fd4f3f | 16545 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
16546 | .setup = alc861vd_dallas_setup, |
16547 | .init_hook = alc_automute_amp, | |
d1a991a6 KY |
16548 | }, |
16549 | [ALC861VD_HP] = { | |
16550 | .mixers = { alc861vd_hp_mixer }, | |
16551 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
16552 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16553 | .dac_nids = alc861vd_dac_nids, | |
d1a991a6 | 16554 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
d1a991a6 KY |
16555 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16556 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16557 | .input_mux = &alc861vd_hp_capture_source, | |
a9fd4f3f | 16558 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
16559 | .setup = alc861vd_dallas_setup, |
16560 | .init_hook = alc_automute_amp, | |
ea1fb29a | 16561 | }, |
13c94744 TI |
16562 | [ALC660VD_ASUS_V1S] = { |
16563 | .mixers = { alc861vd_lenovo_mixer }, | |
16564 | .init_verbs = { alc861vd_volume_init_verbs, | |
16565 | alc861vd_3stack_init_verbs, | |
16566 | alc861vd_eapd_verbs, | |
16567 | alc861vd_lenovo_unsol_verbs }, | |
16568 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16569 | .dac_nids = alc660vd_dac_nids, | |
16570 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16571 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16572 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16573 | .input_mux = &alc861vd_capture_source, | |
16574 | .unsol_event = alc861vd_lenovo_unsol_event, | |
4f5d1706 | 16575 | .setup = alc861vd_lenovo_setup, |
a9fd4f3f | 16576 | .init_hook = alc861vd_lenovo_init_hook, |
13c94744 | 16577 | }, |
f32610ed JS |
16578 | }; |
16579 | ||
16580 | /* | |
16581 | * BIOS auto configuration | |
16582 | */ | |
05f5f477 TI |
16583 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
16584 | const struct auto_pin_cfg *cfg) | |
16585 | { | |
6227cdce | 16586 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
05f5f477 TI |
16587 | } |
16588 | ||
16589 | ||
f32610ed JS |
16590 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
16591 | hda_nid_t nid, int pin_type, int dac_idx) | |
16592 | { | |
f6c7e546 | 16593 | alc_set_pin_output(codec, nid, pin_type); |
f32610ed JS |
16594 | } |
16595 | ||
16596 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
16597 | { | |
16598 | struct alc_spec *spec = codec->spec; | |
16599 | int i; | |
16600 | ||
16601 | for (i = 0; i <= HDA_SIDE; i++) { | |
16602 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 16603 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
f32610ed JS |
16604 | if (nid) |
16605 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
baba8ee9 | 16606 | pin_type, i); |
f32610ed JS |
16607 | } |
16608 | } | |
16609 | ||
16610 | ||
16611 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
16612 | { | |
16613 | struct alc_spec *spec = codec->spec; | |
16614 | hda_nid_t pin; | |
16615 | ||
16616 | pin = spec->autocfg.hp_pins[0]; | |
def319f9 | 16617 | if (pin) /* connect to front and use dac 0 */ |
f32610ed | 16618 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
f6c7e546 TI |
16619 | pin = spec->autocfg.speaker_pins[0]; |
16620 | if (pin) | |
16621 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
f32610ed JS |
16622 | } |
16623 | ||
f32610ed JS |
16624 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
16625 | ||
16626 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
16627 | { | |
16628 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 16629 | struct auto_pin_cfg *cfg = &spec->autocfg; |
f32610ed JS |
16630 | int i; |
16631 | ||
66ceeb6b TI |
16632 | for (i = 0; i < cfg->num_inputs; i++) { |
16633 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 16634 | if (alc_is_input_pin(codec, nid)) { |
23f0c048 | 16635 | alc_set_input_pin(codec, nid, i); |
e82c025b TI |
16636 | if (nid != ALC861VD_PIN_CD_NID && |
16637 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f32610ed JS |
16638 | snd_hda_codec_write(codec, nid, 0, |
16639 | AC_VERB_SET_AMP_GAIN_MUTE, | |
16640 | AMP_OUT_MUTE); | |
16641 | } | |
16642 | } | |
16643 | } | |
16644 | ||
f511b01c TI |
16645 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
16646 | ||
f32610ed JS |
16647 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
16648 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
16649 | ||
16650 | /* add playback controls from the parsed DAC table */ | |
16651 | /* Based on ALC880 version. But ALC861VD has separate, | |
16652 | * different NIDs for mute/unmute switch and volume control */ | |
16653 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
16654 | const struct auto_pin_cfg *cfg) | |
16655 | { | |
f32610ed JS |
16656 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
16657 | hda_nid_t nid_v, nid_s; | |
16658 | int i, err; | |
16659 | ||
16660 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 16661 | if (!spec->multiout.dac_nids[i]) |
f32610ed JS |
16662 | continue; |
16663 | nid_v = alc861vd_idx_to_mixer_vol( | |
16664 | alc880_dac_to_idx( | |
16665 | spec->multiout.dac_nids[i])); | |
16666 | nid_s = alc861vd_idx_to_mixer_switch( | |
16667 | alc880_dac_to_idx( | |
16668 | spec->multiout.dac_nids[i])); | |
16669 | ||
16670 | if (i == 2) { | |
16671 | /* Center/LFE */ | |
0afe5f89 TI |
16672 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
16673 | "Center", | |
f12ab1e0 TI |
16674 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
16675 | HDA_OUTPUT)); | |
16676 | if (err < 0) | |
f32610ed | 16677 | return err; |
0afe5f89 TI |
16678 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
16679 | "LFE", | |
f12ab1e0 TI |
16680 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
16681 | HDA_OUTPUT)); | |
16682 | if (err < 0) | |
f32610ed | 16683 | return err; |
0afe5f89 TI |
16684 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
16685 | "Center", | |
f12ab1e0 TI |
16686 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
16687 | HDA_INPUT)); | |
16688 | if (err < 0) | |
f32610ed | 16689 | return err; |
0afe5f89 TI |
16690 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
16691 | "LFE", | |
f12ab1e0 TI |
16692 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
16693 | HDA_INPUT)); | |
16694 | if (err < 0) | |
f32610ed JS |
16695 | return err; |
16696 | } else { | |
a4fcd491 TI |
16697 | const char *pfx; |
16698 | if (cfg->line_outs == 1 && | |
16699 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
16700 | if (!cfg->hp_pins) | |
16701 | pfx = "Speaker"; | |
16702 | else | |
16703 | pfx = "PCM"; | |
16704 | } else | |
16705 | pfx = chname[i]; | |
0afe5f89 | 16706 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
16707 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
16708 | HDA_OUTPUT)); | |
16709 | if (err < 0) | |
f32610ed | 16710 | return err; |
a4fcd491 TI |
16711 | if (cfg->line_outs == 1 && |
16712 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
16713 | pfx = "Speaker"; | |
0afe5f89 | 16714 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
bdd148a3 | 16715 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
f12ab1e0 TI |
16716 | HDA_INPUT)); |
16717 | if (err < 0) | |
f32610ed JS |
16718 | return err; |
16719 | } | |
16720 | } | |
16721 | return 0; | |
16722 | } | |
16723 | ||
16724 | /* add playback controls for speaker and HP outputs */ | |
16725 | /* Based on ALC880 version. But ALC861VD has separate, | |
16726 | * different NIDs for mute/unmute switch and volume control */ | |
16727 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
16728 | hda_nid_t pin, const char *pfx) | |
16729 | { | |
16730 | hda_nid_t nid_v, nid_s; | |
16731 | int err; | |
f32610ed | 16732 | |
f12ab1e0 | 16733 | if (!pin) |
f32610ed JS |
16734 | return 0; |
16735 | ||
16736 | if (alc880_is_fixed_pin(pin)) { | |
16737 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
16738 | /* specify the DAC as the extra output */ | |
f12ab1e0 | 16739 | if (!spec->multiout.hp_nid) |
f32610ed JS |
16740 | spec->multiout.hp_nid = nid_v; |
16741 | else | |
16742 | spec->multiout.extra_out_nid[0] = nid_v; | |
16743 | /* control HP volume/switch on the output mixer amp */ | |
16744 | nid_v = alc861vd_idx_to_mixer_vol( | |
16745 | alc880_fixed_pin_idx(pin)); | |
16746 | nid_s = alc861vd_idx_to_mixer_switch( | |
16747 | alc880_fixed_pin_idx(pin)); | |
16748 | ||
0afe5f89 | 16749 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
16750 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
16751 | if (err < 0) | |
f32610ed | 16752 | return err; |
0afe5f89 | 16753 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
16754 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
16755 | if (err < 0) | |
f32610ed JS |
16756 | return err; |
16757 | } else if (alc880_is_multi_pin(pin)) { | |
16758 | /* set manual connection */ | |
16759 | /* we have only a switch on HP-out PIN */ | |
0afe5f89 | 16760 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
f12ab1e0 TI |
16761 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
16762 | if (err < 0) | |
f32610ed JS |
16763 | return err; |
16764 | } | |
16765 | return 0; | |
16766 | } | |
16767 | ||
16768 | /* parse the BIOS configuration and set up the alc_spec | |
16769 | * return 1 if successful, 0 if the proper config is not found, | |
16770 | * or a negative error code | |
16771 | * Based on ALC880 version - had to change it to override | |
16772 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
16773 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
16774 | { | |
16775 | struct alc_spec *spec = codec->spec; | |
16776 | int err; | |
16777 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
16778 | ||
f12ab1e0 TI |
16779 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
16780 | alc861vd_ignore); | |
16781 | if (err < 0) | |
f32610ed | 16782 | return err; |
f12ab1e0 | 16783 | if (!spec->autocfg.line_outs) |
f32610ed JS |
16784 | return 0; /* can't find valid BIOS pin config */ |
16785 | ||
f12ab1e0 TI |
16786 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
16787 | if (err < 0) | |
16788 | return err; | |
16789 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
16790 | if (err < 0) | |
16791 | return err; | |
16792 | err = alc861vd_auto_create_extra_out(spec, | |
16793 | spec->autocfg.speaker_pins[0], | |
16794 | "Speaker"); | |
16795 | if (err < 0) | |
16796 | return err; | |
16797 | err = alc861vd_auto_create_extra_out(spec, | |
16798 | spec->autocfg.hp_pins[0], | |
16799 | "Headphone"); | |
16800 | if (err < 0) | |
16801 | return err; | |
05f5f477 | 16802 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 16803 | if (err < 0) |
f32610ed JS |
16804 | return err; |
16805 | ||
16806 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
16807 | ||
757899ac | 16808 | alc_auto_parse_digital(codec); |
f32610ed | 16809 | |
603c4019 | 16810 | if (spec->kctls.list) |
d88897ea | 16811 | add_mixer(spec, spec->kctls.list); |
f32610ed | 16812 | |
d88897ea | 16813 | add_verb(spec, alc861vd_volume_init_verbs); |
f32610ed JS |
16814 | |
16815 | spec->num_mux_defs = 1; | |
61b9b9b1 | 16816 | spec->input_mux = &spec->private_imux[0]; |
f32610ed | 16817 | |
776e184e TI |
16818 | err = alc_auto_add_mic_boost(codec); |
16819 | if (err < 0) | |
16820 | return err; | |
16821 | ||
6227cdce | 16822 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 16823 | |
f32610ed JS |
16824 | return 1; |
16825 | } | |
16826 | ||
16827 | /* additional initialization for auto-configuration model */ | |
16828 | static void alc861vd_auto_init(struct hda_codec *codec) | |
16829 | { | |
f6c7e546 | 16830 | struct alc_spec *spec = codec->spec; |
f32610ed JS |
16831 | alc861vd_auto_init_multi_out(codec); |
16832 | alc861vd_auto_init_hp_out(codec); | |
16833 | alc861vd_auto_init_analog_input(codec); | |
f511b01c | 16834 | alc861vd_auto_init_input_src(codec); |
757899ac | 16835 | alc_auto_init_digital(codec); |
f6c7e546 | 16836 | if (spec->unsol_event) |
7fb0d78f | 16837 | alc_inithook(codec); |
f32610ed JS |
16838 | } |
16839 | ||
f8f25ba3 TI |
16840 | enum { |
16841 | ALC660VD_FIX_ASUS_GPIO1 | |
16842 | }; | |
16843 | ||
16844 | /* reset GPIO1 */ | |
f8f25ba3 TI |
16845 | static const struct alc_fixup alc861vd_fixups[] = { |
16846 | [ALC660VD_FIX_ASUS_GPIO1] = { | |
73413b12 TI |
16847 | .verbs = (const struct hda_verb[]) { |
16848 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
16849 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
16850 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
16851 | { } | |
16852 | } | |
f8f25ba3 TI |
16853 | }, |
16854 | }; | |
16855 | ||
16856 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | |
16857 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | |
16858 | {} | |
16859 | }; | |
16860 | ||
f32610ed JS |
16861 | static int patch_alc861vd(struct hda_codec *codec) |
16862 | { | |
16863 | struct alc_spec *spec; | |
16864 | int err, board_config; | |
16865 | ||
16866 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
16867 | if (spec == NULL) | |
16868 | return -ENOMEM; | |
16869 | ||
16870 | codec->spec = spec; | |
16871 | ||
16872 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
16873 | alc861vd_models, | |
16874 | alc861vd_cfg_tbl); | |
16875 | ||
16876 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
9a11f1aa TI |
16877 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
16878 | codec->chip_name); | |
f32610ed JS |
16879 | board_config = ALC861VD_AUTO; |
16880 | } | |
16881 | ||
7fa90e87 TI |
16882 | if (board_config == ALC861VD_AUTO) |
16883 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); | |
f8f25ba3 | 16884 | |
f32610ed JS |
16885 | if (board_config == ALC861VD_AUTO) { |
16886 | /* automatic parse from the BIOS config */ | |
16887 | err = alc861vd_parse_auto_config(codec); | |
16888 | if (err < 0) { | |
16889 | alc_free(codec); | |
16890 | return err; | |
f12ab1e0 | 16891 | } else if (!err) { |
f32610ed JS |
16892 | printk(KERN_INFO |
16893 | "hda_codec: Cannot set up configuration " | |
16894 | "from BIOS. Using base mode...\n"); | |
16895 | board_config = ALC861VD_3ST; | |
16896 | } | |
16897 | } | |
16898 | ||
680cd536 KK |
16899 | err = snd_hda_attach_beep_device(codec, 0x23); |
16900 | if (err < 0) { | |
16901 | alc_free(codec); | |
16902 | return err; | |
16903 | } | |
16904 | ||
f32610ed | 16905 | if (board_config != ALC861VD_AUTO) |
e9c364c0 | 16906 | setup_preset(codec, &alc861vd_presets[board_config]); |
f32610ed | 16907 | |
2f893286 | 16908 | if (codec->vendor_id == 0x10ec0660) { |
f9423e7a | 16909 | /* always turn on EAPD */ |
d88897ea | 16910 | add_verb(spec, alc660vd_eapd_verbs); |
2f893286 KY |
16911 | } |
16912 | ||
f32610ed JS |
16913 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
16914 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
16915 | ||
f32610ed JS |
16916 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
16917 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
16918 | ||
dd704698 TI |
16919 | if (!spec->adc_nids) { |
16920 | spec->adc_nids = alc861vd_adc_nids; | |
16921 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
16922 | } | |
16923 | if (!spec->capsrc_nids) | |
16924 | spec->capsrc_nids = alc861vd_capsrc_nids; | |
f32610ed | 16925 | |
b59bdf3b | 16926 | set_capture_mixer(codec); |
45bdd1c1 | 16927 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
f32610ed | 16928 | |
2134ea4f TI |
16929 | spec->vmaster_nid = 0x02; |
16930 | ||
7fa90e87 TI |
16931 | if (board_config == ALC861VD_AUTO) |
16932 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); | |
16933 | ||
f32610ed JS |
16934 | codec->patch_ops = alc_patch_ops; |
16935 | ||
16936 | if (board_config == ALC861VD_AUTO) | |
16937 | spec->init_hook = alc861vd_auto_init; | |
cb53c626 TI |
16938 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16939 | if (!spec->loopback.amplist) | |
16940 | spec->loopback.amplist = alc861vd_loopbacks; | |
16941 | #endif | |
f32610ed JS |
16942 | |
16943 | return 0; | |
16944 | } | |
16945 | ||
bc9f98a9 KY |
16946 | /* |
16947 | * ALC662 support | |
16948 | * | |
16949 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
16950 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
16951 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
16952 | * 6-channel independent captures. | |
16953 | * | |
16954 | * In addition, an independent DAC for the multi-playback (not used in this | |
16955 | * driver yet). | |
16956 | */ | |
16957 | #define ALC662_DIGOUT_NID 0x06 | |
16958 | #define ALC662_DIGIN_NID 0x0a | |
16959 | ||
16960 | static hda_nid_t alc662_dac_nids[4] = { | |
16961 | /* front, rear, clfe, rear_surr */ | |
16962 | 0x02, 0x03, 0x04 | |
16963 | }; | |
16964 | ||
622e84cd KY |
16965 | static hda_nid_t alc272_dac_nids[2] = { |
16966 | 0x02, 0x03 | |
16967 | }; | |
16968 | ||
b59bdf3b | 16969 | static hda_nid_t alc662_adc_nids[2] = { |
bc9f98a9 | 16970 | /* ADC1-2 */ |
b59bdf3b | 16971 | 0x09, 0x08 |
bc9f98a9 | 16972 | }; |
e1406348 | 16973 | |
622e84cd KY |
16974 | static hda_nid_t alc272_adc_nids[1] = { |
16975 | /* ADC1-2 */ | |
16976 | 0x08, | |
16977 | }; | |
16978 | ||
b59bdf3b | 16979 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
622e84cd KY |
16980 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
16981 | ||
e1406348 | 16982 | |
bc9f98a9 KY |
16983 | /* input MUX */ |
16984 | /* FIXME: should be a matrix-type input source selection */ | |
bc9f98a9 KY |
16985 | static struct hda_input_mux alc662_capture_source = { |
16986 | .num_items = 4, | |
16987 | .items = { | |
16988 | { "Mic", 0x0 }, | |
16989 | { "Front Mic", 0x1 }, | |
16990 | { "Line", 0x2 }, | |
16991 | { "CD", 0x4 }, | |
16992 | }, | |
16993 | }; | |
16994 | ||
16995 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
16996 | .num_items = 2, | |
16997 | .items = { | |
16998 | { "Mic", 0x1 }, | |
16999 | { "Line", 0x2 }, | |
17000 | }, | |
17001 | }; | |
291702f0 | 17002 | |
6dda9f4a KY |
17003 | static struct hda_input_mux alc663_capture_source = { |
17004 | .num_items = 3, | |
17005 | .items = { | |
17006 | { "Mic", 0x0 }, | |
17007 | { "Front Mic", 0x1 }, | |
17008 | { "Line", 0x2 }, | |
17009 | }, | |
17010 | }; | |
17011 | ||
4f5d1706 | 17012 | #if 0 /* set to 1 for testing other input sources below */ |
9541ba1d CP |
17013 | static struct hda_input_mux alc272_nc10_capture_source = { |
17014 | .num_items = 16, | |
17015 | .items = { | |
17016 | { "Autoselect Mic", 0x0 }, | |
17017 | { "Internal Mic", 0x1 }, | |
17018 | { "In-0x02", 0x2 }, | |
17019 | { "In-0x03", 0x3 }, | |
17020 | { "In-0x04", 0x4 }, | |
17021 | { "In-0x05", 0x5 }, | |
17022 | { "In-0x06", 0x6 }, | |
17023 | { "In-0x07", 0x7 }, | |
17024 | { "In-0x08", 0x8 }, | |
17025 | { "In-0x09", 0x9 }, | |
17026 | { "In-0x0a", 0x0a }, | |
17027 | { "In-0x0b", 0x0b }, | |
17028 | { "In-0x0c", 0x0c }, | |
17029 | { "In-0x0d", 0x0d }, | |
17030 | { "In-0x0e", 0x0e }, | |
17031 | { "In-0x0f", 0x0f }, | |
17032 | }, | |
17033 | }; | |
17034 | #endif | |
17035 | ||
bc9f98a9 KY |
17036 | /* |
17037 | * 2ch mode | |
17038 | */ | |
17039 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
17040 | { 2, NULL } | |
17041 | }; | |
17042 | ||
17043 | /* | |
17044 | * 2ch mode | |
17045 | */ | |
17046 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
17047 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
17048 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17049 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
17050 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17051 | { } /* end */ | |
17052 | }; | |
17053 | ||
17054 | /* | |
17055 | * 6ch mode | |
17056 | */ | |
17057 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
17058 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17059 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17060 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
17061 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17062 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17063 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
17064 | { } /* end */ | |
17065 | }; | |
17066 | ||
17067 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
17068 | { 2, alc662_3ST_ch2_init }, | |
17069 | { 6, alc662_3ST_ch6_init }, | |
17070 | }; | |
17071 | ||
17072 | /* | |
17073 | * 2ch mode | |
17074 | */ | |
17075 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
17076 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17077 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17078 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17079 | { } /* end */ | |
17080 | }; | |
17081 | ||
17082 | /* | |
17083 | * 6ch mode | |
17084 | */ | |
17085 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
17086 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17087 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17088 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17089 | { } /* end */ | |
17090 | }; | |
17091 | ||
17092 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
17093 | { 2, alc662_sixstack_ch6_init }, | |
17094 | { 6, alc662_sixstack_ch8_init }, | |
17095 | }; | |
17096 | ||
17097 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
17098 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
17099 | */ | |
17100 | ||
17101 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
17102 | /* output mixer control */ | |
17103 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
7055ad8a | 17104 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 17105 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
7055ad8a | 17106 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17107 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17108 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
17109 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
17110 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
17111 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17112 | ||
17113 | /*Input mixer control */ | |
17114 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
17115 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
17116 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
17117 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
17118 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
17119 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
17120 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
17121 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
bc9f98a9 KY |
17122 | { } /* end */ |
17123 | }; | |
17124 | ||
17125 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
17126 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 17127 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17128 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17129 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17130 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17131 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17132 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17133 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17134 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17135 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17136 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17137 | { } /* end */ |
17138 | }; | |
17139 | ||
17140 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
17141 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 17142 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 17143 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
7055ad8a | 17144 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17145 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17146 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
17147 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
17148 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
17149 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17150 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17151 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17152 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17153 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17154 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17155 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17156 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17157 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17158 | { } /* end */ |
17159 | }; | |
17160 | ||
17161 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
17162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17163 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
86cd9298 TI |
17164 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
17165 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
bc9f98a9 KY |
17166 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17167 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17168 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17171 | { } /* end */ |
17172 | }; | |
17173 | ||
291702f0 | 17174 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
42171c17 TI |
17175 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
17176 | ALC262_HIPPO_MASTER_SWITCH, | |
291702f0 KY |
17177 | |
17178 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | |
17179 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17180 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17181 | ||
17182 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
17183 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17184 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17185 | { } /* end */ | |
17186 | }; | |
17187 | ||
8c427226 | 17188 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
42171c17 TI |
17189 | ALC262_HIPPO_MASTER_SWITCH, |
17190 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
8c427226 | 17191 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
8c427226 KY |
17192 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17193 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
8c427226 KY |
17194 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
17195 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17196 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17198 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17199 | { } /* end */ | |
17200 | }; | |
17201 | ||
f1d4e28b KY |
17202 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
17203 | .ops = &snd_hda_bind_vol, | |
17204 | .values = { | |
17205 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17206 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
17207 | 0 | |
17208 | }, | |
17209 | }; | |
17210 | ||
17211 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | |
17212 | .ops = &snd_hda_bind_sw, | |
17213 | .values = { | |
17214 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17215 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17216 | 0 | |
17217 | }, | |
17218 | }; | |
17219 | ||
6dda9f4a | 17220 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
f1d4e28b KY |
17221 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
17222 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | |
17223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17225 | { } /* end */ | |
17226 | }; | |
17227 | ||
17228 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | |
17229 | .ops = &snd_hda_bind_sw, | |
17230 | .values = { | |
17231 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17232 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17233 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17234 | 0 | |
17235 | }, | |
17236 | }; | |
17237 | ||
17238 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | |
17239 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17240 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | |
17241 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17242 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17243 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17244 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17245 | ||
17246 | { } /* end */ | |
17247 | }; | |
17248 | ||
17249 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | |
17250 | .ops = &snd_hda_bind_sw, | |
17251 | .values = { | |
17252 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17253 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17254 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17255 | 0 | |
17256 | }, | |
17257 | }; | |
17258 | ||
17259 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | |
17260 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17261 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | |
17262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17263 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17264 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17265 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17266 | { } /* end */ | |
17267 | }; | |
17268 | ||
17269 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | |
6dda9f4a KY |
17270 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
17271 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
f1d4e28b KY |
17272 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17273 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17274 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17275 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17276 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17277 | { } /* end */ | |
17278 | }; | |
17279 | ||
17280 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | |
17281 | .ops = &snd_hda_bind_vol, | |
17282 | .values = { | |
17283 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17284 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | |
17285 | 0 | |
17286 | }, | |
17287 | }; | |
17288 | ||
17289 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | |
17290 | .ops = &snd_hda_bind_sw, | |
17291 | .values = { | |
17292 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17293 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | |
17294 | 0 | |
17295 | }, | |
17296 | }; | |
17297 | ||
17298 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | |
17299 | HDA_BIND_VOL("Master Playback Volume", | |
17300 | &alc663_asus_two_bind_master_vol), | |
17301 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17302 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
6dda9f4a KY |
17303 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
17304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
f1d4e28b KY |
17306 | { } /* end */ |
17307 | }; | |
17308 | ||
17309 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | |
17310 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17311 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17312 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17313 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6dda9f4a KY |
17316 | { } /* end */ |
17317 | }; | |
17318 | ||
17319 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
17320 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17321 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17322 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17323 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17324 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17325 | ||
17326 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17327 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17328 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17329 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17330 | { } /* end */ | |
17331 | }; | |
17332 | ||
17333 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
17334 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17335 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17336 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17337 | ||
17338 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17339 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17340 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17341 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17342 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17343 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17344 | { } /* end */ | |
17345 | }; | |
17346 | ||
ebb83eeb KY |
17347 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
17348 | .ops = &snd_hda_bind_sw, | |
17349 | .values = { | |
17350 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17351 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17352 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17353 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17354 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17355 | 0 | |
17356 | }, | |
17357 | }; | |
17358 | ||
17359 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | |
17360 | .ops = &snd_hda_bind_sw, | |
17361 | .values = { | |
17362 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17363 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17364 | 0 | |
17365 | }, | |
17366 | }; | |
17367 | ||
17368 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | |
17369 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17370 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17371 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17372 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17373 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17374 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17375 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17376 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17378 | { } /* end */ | |
17379 | }; | |
17380 | ||
17381 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | |
17382 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17383 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17384 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17385 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17386 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17387 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17388 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17389 | { } /* end */ | |
17390 | }; | |
17391 | ||
17392 | ||
bc9f98a9 KY |
17393 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
17394 | { | |
17395 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
17396 | .name = "Channel Mode", | |
17397 | .info = alc_ch_mode_info, | |
17398 | .get = alc_ch_mode_get, | |
17399 | .put = alc_ch_mode_put, | |
17400 | }, | |
17401 | { } /* end */ | |
17402 | }; | |
17403 | ||
17404 | static struct hda_verb alc662_init_verbs[] = { | |
17405 | /* ADC: mute amp left and right */ | |
17406 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17407 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
bc9f98a9 | 17408 | |
b60dd394 KY |
17409 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
17410 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17411 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17412 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17413 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17414 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
17415 | |
17416 | /* Front Pin: output 0 (0x0c) */ | |
17417 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17418 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17419 | ||
17420 | /* Rear Pin: output 1 (0x0d) */ | |
17421 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17422 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17423 | ||
17424 | /* CLFE Pin: output 2 (0x0e) */ | |
17425 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17426 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17427 | ||
17428 | /* Mic (rear) pin: input vref at 80% */ | |
17429 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17430 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17431 | /* Front Mic pin: input vref at 80% */ | |
17432 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17433 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17434 | /* Line In pin: input */ | |
17435 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17436 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17437 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
17438 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17439 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17440 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
17441 | /* CD pin widget for input */ | |
17442 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17443 | ||
17444 | /* FIXME: use matrix-type input source selection */ | |
17445 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
17446 | /* Input mixer */ | |
17447 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
291702f0 | 17448 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
6dda9f4a KY |
17449 | |
17450 | /* always trun on EAPD */ | |
17451 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17452 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17453 | ||
bc9f98a9 KY |
17454 | { } |
17455 | }; | |
17456 | ||
cec27c89 KY |
17457 | static struct hda_verb alc663_init_verbs[] = { |
17458 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17459 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17460 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17461 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17462 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17463 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17464 | { } | |
17465 | }; | |
17466 | ||
17467 | static struct hda_verb alc272_init_verbs[] = { | |
17468 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17469 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17470 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17471 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17472 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17473 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17474 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17475 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17476 | { } | |
17477 | }; | |
17478 | ||
bc9f98a9 KY |
17479 | static struct hda_verb alc662_sue_init_verbs[] = { |
17480 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17481 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
291702f0 KY |
17482 | {} |
17483 | }; | |
17484 | ||
17485 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
17486 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17487 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17488 | {} | |
bc9f98a9 KY |
17489 | }; |
17490 | ||
8c427226 KY |
17491 | /* Set Unsolicited Event*/ |
17492 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
17493 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17494 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17495 | {} | |
17496 | }; | |
17497 | ||
6dda9f4a | 17498 | static struct hda_verb alc663_m51va_init_verbs[] = { |
f1d4e28b KY |
17499 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
17500 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6dda9f4a KY |
17501 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
17502 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f1d4e28b KY |
17503 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
17504 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17505 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17506 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17507 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17508 | {} | |
17509 | }; | |
17510 | ||
17511 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | |
17512 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17513 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17514 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17515 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17516 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17517 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17518 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17519 | {} | |
17520 | }; | |
17521 | ||
17522 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | |
17523 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17524 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17525 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17526 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17527 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17528 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17529 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17530 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17531 | {} | |
17532 | }; | |
6dda9f4a | 17533 | |
f1d4e28b KY |
17534 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
17535 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17536 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17537 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17538 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17539 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17540 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17541 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17542 | {} | |
17543 | }; | |
6dda9f4a | 17544 | |
f1d4e28b KY |
17545 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
17546 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17547 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17548 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17549 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
17550 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17551 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17552 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
17553 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17554 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6dda9f4a KY |
17555 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
17556 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f1d4e28b KY |
17557 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
17558 | {} | |
17559 | }; | |
17560 | ||
17561 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | |
17562 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17563 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17564 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17565 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17566 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17567 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17568 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17571 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17572 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17573 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6dda9f4a KY |
17574 | {} |
17575 | }; | |
17576 | ||
17577 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
17578 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17579 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
17580 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
17581 | ||
17582 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17583 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17584 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17585 | ||
17586 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17587 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
17588 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
17589 | {} | |
17590 | }; | |
17591 | ||
17592 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
17593 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17594 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17595 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17596 | ||
17597 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17598 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17599 | {} | |
17600 | }; | |
17601 | ||
f1d4e28b KY |
17602 | static struct hda_verb alc662_ecs_init_verbs[] = { |
17603 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | |
17604 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17605 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17606 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17607 | {} | |
17608 | }; | |
17609 | ||
622e84cd KY |
17610 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
17611 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17612 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17613 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17614 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17615 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17616 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17617 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17618 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17620 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17621 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17622 | {} | |
17623 | }; | |
17624 | ||
17625 | static struct hda_verb alc272_dell_init_verbs[] = { | |
17626 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17627 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17628 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17629 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17630 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17631 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17632 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17633 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17634 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17635 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17636 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17637 | {} | |
17638 | }; | |
17639 | ||
ebb83eeb KY |
17640 | static struct hda_verb alc663_mode7_init_verbs[] = { |
17641 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17642 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17643 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17644 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17645 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17646 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17647 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
17648 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17649 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17650 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17651 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17652 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17653 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17654 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17655 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17656 | {} | |
17657 | }; | |
17658 | ||
17659 | static struct hda_verb alc663_mode8_init_verbs[] = { | |
17660 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17662 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17663 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
17664 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17665 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17666 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17667 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17668 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17669 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17670 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17673 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17674 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17675 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17676 | {} | |
17677 | }; | |
17678 | ||
f1d4e28b KY |
17679 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
17680 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
17681 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
17682 | { } /* end */ | |
17683 | }; | |
17684 | ||
622e84cd KY |
17685 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
17686 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
17687 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
17688 | { } /* end */ | |
17689 | }; | |
17690 | ||
bc9f98a9 KY |
17691 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
17692 | { | |
17693 | unsigned int present; | |
f12ab1e0 | 17694 | unsigned char bits; |
bc9f98a9 | 17695 | |
864f92be | 17696 | present = snd_hda_jack_detect(codec, 0x14); |
47fd830a | 17697 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 17698 | |
47fd830a TI |
17699 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
17700 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
17701 | } |
17702 | ||
17703 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
17704 | { | |
17705 | unsigned int present; | |
f12ab1e0 | 17706 | unsigned char bits; |
bc9f98a9 | 17707 | |
864f92be | 17708 | present = snd_hda_jack_detect(codec, 0x1b); |
47fd830a | 17709 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 17710 | |
47fd830a TI |
17711 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
17712 | HDA_AMP_MUTE, bits); | |
17713 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
17714 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
17715 | } |
17716 | ||
17717 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
17718 | unsigned int res) | |
17719 | { | |
17720 | if ((res >> 26) == ALC880_HP_EVENT) | |
17721 | alc662_lenovo_101e_all_automute(codec); | |
17722 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
17723 | alc662_lenovo_101e_ispeaker_automute(codec); | |
17724 | } | |
17725 | ||
291702f0 KY |
17726 | /* unsolicited event for HP jack sensing */ |
17727 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
17728 | unsigned int res) | |
17729 | { | |
291702f0 | 17730 | if ((res >> 26) == ALC880_MIC_EVENT) |
4f5d1706 | 17731 | alc_mic_automute(codec); |
42171c17 TI |
17732 | else |
17733 | alc262_hippo_unsol_event(codec, res); | |
291702f0 KY |
17734 | } |
17735 | ||
4f5d1706 TI |
17736 | static void alc662_eeepc_setup(struct hda_codec *codec) |
17737 | { | |
17738 | struct alc_spec *spec = codec->spec; | |
17739 | ||
17740 | alc262_hippo1_setup(codec); | |
17741 | spec->ext_mic.pin = 0x18; | |
17742 | spec->ext_mic.mux_idx = 0; | |
17743 | spec->int_mic.pin = 0x19; | |
17744 | spec->int_mic.mux_idx = 1; | |
17745 | spec->auto_mic = 1; | |
17746 | } | |
17747 | ||
291702f0 KY |
17748 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
17749 | { | |
4f5d1706 TI |
17750 | alc262_hippo_automute(codec); |
17751 | alc_mic_automute(codec); | |
291702f0 KY |
17752 | } |
17753 | ||
4f5d1706 | 17754 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
8c427226 | 17755 | { |
42171c17 TI |
17756 | struct alc_spec *spec = codec->spec; |
17757 | ||
17758 | spec->autocfg.hp_pins[0] = 0x14; | |
17759 | spec->autocfg.speaker_pins[0] = 0x1b; | |
8c427226 KY |
17760 | } |
17761 | ||
4f5d1706 TI |
17762 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
17763 | ||
6dda9f4a KY |
17764 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
17765 | { | |
17766 | unsigned int present; | |
17767 | unsigned char bits; | |
17768 | ||
864f92be | 17769 | present = snd_hda_jack_detect(codec, 0x21); |
6dda9f4a | 17770 | bits = present ? HDA_AMP_MUTE : 0; |
f1d4e28b | 17771 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 17772 | HDA_AMP_MUTE, bits); |
f1d4e28b | 17773 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 17774 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
17775 | } |
17776 | ||
17777 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |
17778 | { | |
17779 | unsigned int present; | |
17780 | unsigned char bits; | |
17781 | ||
864f92be | 17782 | present = snd_hda_jack_detect(codec, 0x21); |
f1d4e28b KY |
17783 | bits = present ? HDA_AMP_MUTE : 0; |
17784 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 17785 | HDA_AMP_MUTE, bits); |
f1d4e28b | 17786 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 17787 | HDA_AMP_MUTE, bits); |
f1d4e28b | 17788 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
5dbd5ec6 | 17789 | HDA_AMP_MUTE, bits); |
f1d4e28b | 17790 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
5dbd5ec6 | 17791 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
17792 | } |
17793 | ||
17794 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |
17795 | { | |
17796 | unsigned int present; | |
17797 | unsigned char bits; | |
17798 | ||
864f92be | 17799 | present = snd_hda_jack_detect(codec, 0x15); |
f1d4e28b KY |
17800 | bits = present ? HDA_AMP_MUTE : 0; |
17801 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 17802 | HDA_AMP_MUTE, bits); |
f1d4e28b | 17803 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 17804 | HDA_AMP_MUTE, bits); |
f1d4e28b | 17805 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
5dbd5ec6 | 17806 | HDA_AMP_MUTE, bits); |
f1d4e28b | 17807 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
5dbd5ec6 | 17808 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
17809 | } |
17810 | ||
17811 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | |
17812 | { | |
17813 | unsigned int present; | |
17814 | unsigned char bits; | |
17815 | ||
864f92be | 17816 | present = snd_hda_jack_detect(codec, 0x1b); |
f1d4e28b KY |
17817 | bits = present ? 0 : PIN_OUT; |
17818 | snd_hda_codec_write(codec, 0x14, 0, | |
17819 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
17820 | } | |
17821 | ||
17822 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | |
17823 | { | |
17824 | unsigned int present1, present2; | |
17825 | ||
864f92be WF |
17826 | present1 = snd_hda_jack_detect(codec, 0x21); |
17827 | present2 = snd_hda_jack_detect(codec, 0x15); | |
f1d4e28b KY |
17828 | |
17829 | if (present1 || present2) { | |
17830 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17831 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17832 | } else { | |
17833 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17834 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17835 | } | |
17836 | } | |
17837 | ||
17838 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |
17839 | { | |
17840 | unsigned int present1, present2; | |
17841 | ||
864f92be WF |
17842 | present1 = snd_hda_jack_detect(codec, 0x1b); |
17843 | present2 = snd_hda_jack_detect(codec, 0x15); | |
f1d4e28b KY |
17844 | |
17845 | if (present1 || present2) { | |
17846 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 17847 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
f1d4e28b | 17848 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 17849 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
f1d4e28b KY |
17850 | } else { |
17851 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 17852 | HDA_AMP_MUTE, 0); |
f1d4e28b | 17853 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 17854 | HDA_AMP_MUTE, 0); |
f1d4e28b | 17855 | } |
6dda9f4a KY |
17856 | } |
17857 | ||
ebb83eeb KY |
17858 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
17859 | { | |
17860 | unsigned int present1, present2; | |
17861 | ||
17862 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | |
17863 | AC_VERB_GET_PIN_SENSE, 0) | |
17864 | & AC_PINSENSE_PRESENCE; | |
17865 | present2 = snd_hda_codec_read(codec, 0x21, 0, | |
17866 | AC_VERB_GET_PIN_SENSE, 0) | |
17867 | & AC_PINSENSE_PRESENCE; | |
17868 | ||
17869 | if (present1 || present2) { | |
17870 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17871 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17872 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
17873 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17874 | } else { | |
17875 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17876 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17877 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
17878 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17879 | } | |
17880 | } | |
17881 | ||
17882 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | |
17883 | { | |
17884 | unsigned int present1, present2; | |
17885 | ||
17886 | present1 = snd_hda_codec_read(codec, 0x21, 0, | |
17887 | AC_VERB_GET_PIN_SENSE, 0) | |
17888 | & AC_PINSENSE_PRESENCE; | |
17889 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
17890 | AC_VERB_GET_PIN_SENSE, 0) | |
17891 | & AC_PINSENSE_PRESENCE; | |
17892 | ||
17893 | if (present1 || present2) { | |
17894 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17895 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17896 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
17897 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
17898 | } else { | |
17899 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
17900 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17901 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
17902 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
17903 | } | |
17904 | } | |
17905 | ||
6dda9f4a KY |
17906 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
17907 | unsigned int res) | |
17908 | { | |
17909 | switch (res >> 26) { | |
17910 | case ALC880_HP_EVENT: | |
17911 | alc663_m51va_speaker_automute(codec); | |
17912 | break; | |
17913 | case ALC880_MIC_EVENT: | |
4f5d1706 | 17914 | alc_mic_automute(codec); |
6dda9f4a KY |
17915 | break; |
17916 | } | |
17917 | } | |
17918 | ||
4f5d1706 TI |
17919 | static void alc663_m51va_setup(struct hda_codec *codec) |
17920 | { | |
17921 | struct alc_spec *spec = codec->spec; | |
17922 | spec->ext_mic.pin = 0x18; | |
17923 | spec->ext_mic.mux_idx = 0; | |
17924 | spec->int_mic.pin = 0x12; | |
ebb83eeb | 17925 | spec->int_mic.mux_idx = 9; |
4f5d1706 TI |
17926 | spec->auto_mic = 1; |
17927 | } | |
17928 | ||
6dda9f4a KY |
17929 | static void alc663_m51va_inithook(struct hda_codec *codec) |
17930 | { | |
17931 | alc663_m51va_speaker_automute(codec); | |
4f5d1706 | 17932 | alc_mic_automute(codec); |
6dda9f4a KY |
17933 | } |
17934 | ||
f1d4e28b | 17935 | /* ***************** Mode1 ******************************/ |
4f5d1706 | 17936 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
ebb83eeb KY |
17937 | |
17938 | static void alc663_mode1_setup(struct hda_codec *codec) | |
17939 | { | |
17940 | struct alc_spec *spec = codec->spec; | |
17941 | spec->ext_mic.pin = 0x18; | |
17942 | spec->ext_mic.mux_idx = 0; | |
17943 | spec->int_mic.pin = 0x19; | |
17944 | spec->int_mic.mux_idx = 1; | |
17945 | spec->auto_mic = 1; | |
17946 | } | |
17947 | ||
4f5d1706 | 17948 | #define alc663_mode1_inithook alc663_m51va_inithook |
f1d4e28b | 17949 | |
f1d4e28b KY |
17950 | /* ***************** Mode2 ******************************/ |
17951 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | |
17952 | unsigned int res) | |
17953 | { | |
17954 | switch (res >> 26) { | |
17955 | case ALC880_HP_EVENT: | |
17956 | alc662_f5z_speaker_automute(codec); | |
17957 | break; | |
17958 | case ALC880_MIC_EVENT: | |
4f5d1706 | 17959 | alc_mic_automute(codec); |
f1d4e28b KY |
17960 | break; |
17961 | } | |
17962 | } | |
17963 | ||
ebb83eeb | 17964 | #define alc662_mode2_setup alc663_mode1_setup |
4f5d1706 | 17965 | |
f1d4e28b KY |
17966 | static void alc662_mode2_inithook(struct hda_codec *codec) |
17967 | { | |
17968 | alc662_f5z_speaker_automute(codec); | |
4f5d1706 | 17969 | alc_mic_automute(codec); |
f1d4e28b KY |
17970 | } |
17971 | /* ***************** Mode3 ******************************/ | |
17972 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | |
17973 | unsigned int res) | |
17974 | { | |
17975 | switch (res >> 26) { | |
17976 | case ALC880_HP_EVENT: | |
17977 | alc663_two_hp_m1_speaker_automute(codec); | |
17978 | break; | |
17979 | case ALC880_MIC_EVENT: | |
4f5d1706 | 17980 | alc_mic_automute(codec); |
f1d4e28b KY |
17981 | break; |
17982 | } | |
17983 | } | |
17984 | ||
ebb83eeb | 17985 | #define alc663_mode3_setup alc663_mode1_setup |
4f5d1706 | 17986 | |
f1d4e28b KY |
17987 | static void alc663_mode3_inithook(struct hda_codec *codec) |
17988 | { | |
17989 | alc663_two_hp_m1_speaker_automute(codec); | |
4f5d1706 | 17990 | alc_mic_automute(codec); |
f1d4e28b KY |
17991 | } |
17992 | /* ***************** Mode4 ******************************/ | |
17993 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | |
17994 | unsigned int res) | |
17995 | { | |
17996 | switch (res >> 26) { | |
17997 | case ALC880_HP_EVENT: | |
17998 | alc663_21jd_two_speaker_automute(codec); | |
17999 | break; | |
18000 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18001 | alc_mic_automute(codec); |
f1d4e28b KY |
18002 | break; |
18003 | } | |
18004 | } | |
18005 | ||
ebb83eeb | 18006 | #define alc663_mode4_setup alc663_mode1_setup |
4f5d1706 | 18007 | |
f1d4e28b KY |
18008 | static void alc663_mode4_inithook(struct hda_codec *codec) |
18009 | { | |
18010 | alc663_21jd_two_speaker_automute(codec); | |
4f5d1706 | 18011 | alc_mic_automute(codec); |
f1d4e28b KY |
18012 | } |
18013 | /* ***************** Mode5 ******************************/ | |
18014 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | |
18015 | unsigned int res) | |
18016 | { | |
18017 | switch (res >> 26) { | |
18018 | case ALC880_HP_EVENT: | |
18019 | alc663_15jd_two_speaker_automute(codec); | |
18020 | break; | |
18021 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18022 | alc_mic_automute(codec); |
f1d4e28b KY |
18023 | break; |
18024 | } | |
18025 | } | |
18026 | ||
ebb83eeb | 18027 | #define alc663_mode5_setup alc663_mode1_setup |
4f5d1706 | 18028 | |
f1d4e28b KY |
18029 | static void alc663_mode5_inithook(struct hda_codec *codec) |
18030 | { | |
18031 | alc663_15jd_two_speaker_automute(codec); | |
4f5d1706 | 18032 | alc_mic_automute(codec); |
f1d4e28b KY |
18033 | } |
18034 | /* ***************** Mode6 ******************************/ | |
18035 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | |
18036 | unsigned int res) | |
18037 | { | |
18038 | switch (res >> 26) { | |
18039 | case ALC880_HP_EVENT: | |
18040 | alc663_two_hp_m2_speaker_automute(codec); | |
18041 | break; | |
18042 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18043 | alc_mic_automute(codec); |
f1d4e28b KY |
18044 | break; |
18045 | } | |
18046 | } | |
18047 | ||
ebb83eeb | 18048 | #define alc663_mode6_setup alc663_mode1_setup |
4f5d1706 | 18049 | |
f1d4e28b KY |
18050 | static void alc663_mode6_inithook(struct hda_codec *codec) |
18051 | { | |
18052 | alc663_two_hp_m2_speaker_automute(codec); | |
4f5d1706 | 18053 | alc_mic_automute(codec); |
f1d4e28b KY |
18054 | } |
18055 | ||
ebb83eeb KY |
18056 | /* ***************** Mode7 ******************************/ |
18057 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | |
18058 | unsigned int res) | |
18059 | { | |
18060 | switch (res >> 26) { | |
18061 | case ALC880_HP_EVENT: | |
18062 | alc663_two_hp_m7_speaker_automute(codec); | |
18063 | break; | |
18064 | case ALC880_MIC_EVENT: | |
18065 | alc_mic_automute(codec); | |
18066 | break; | |
18067 | } | |
18068 | } | |
18069 | ||
18070 | #define alc663_mode7_setup alc663_mode1_setup | |
18071 | ||
18072 | static void alc663_mode7_inithook(struct hda_codec *codec) | |
18073 | { | |
18074 | alc663_two_hp_m7_speaker_automute(codec); | |
18075 | alc_mic_automute(codec); | |
18076 | } | |
18077 | ||
18078 | /* ***************** Mode8 ******************************/ | |
18079 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | |
18080 | unsigned int res) | |
18081 | { | |
18082 | switch (res >> 26) { | |
18083 | case ALC880_HP_EVENT: | |
18084 | alc663_two_hp_m8_speaker_automute(codec); | |
18085 | break; | |
18086 | case ALC880_MIC_EVENT: | |
18087 | alc_mic_automute(codec); | |
18088 | break; | |
18089 | } | |
18090 | } | |
18091 | ||
18092 | #define alc663_mode8_setup alc663_m51va_setup | |
18093 | ||
18094 | static void alc663_mode8_inithook(struct hda_codec *codec) | |
18095 | { | |
18096 | alc663_two_hp_m8_speaker_automute(codec); | |
18097 | alc_mic_automute(codec); | |
18098 | } | |
18099 | ||
6dda9f4a KY |
18100 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
18101 | { | |
18102 | unsigned int present; | |
18103 | unsigned char bits; | |
18104 | ||
864f92be | 18105 | present = snd_hda_jack_detect(codec, 0x21); |
6dda9f4a KY |
18106 | bits = present ? HDA_AMP_MUTE : 0; |
18107 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
18108 | HDA_AMP_MUTE, bits); | |
18109 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18110 | HDA_AMP_MUTE, bits); | |
18111 | } | |
18112 | ||
18113 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
18114 | { | |
18115 | unsigned int present; | |
18116 | unsigned char bits; | |
18117 | ||
864f92be | 18118 | present = snd_hda_jack_detect(codec, 0x15); |
6dda9f4a KY |
18119 | bits = present ? HDA_AMP_MUTE : 0; |
18120 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18121 | HDA_AMP_MUTE, bits); | |
18122 | } | |
18123 | ||
18124 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
18125 | unsigned int res) | |
18126 | { | |
18127 | switch (res >> 26) { | |
18128 | case ALC880_HP_EVENT: | |
18129 | alc663_g71v_hp_automute(codec); | |
18130 | break; | |
18131 | case ALC880_FRONT_EVENT: | |
18132 | alc663_g71v_front_automute(codec); | |
18133 | break; | |
18134 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18135 | alc_mic_automute(codec); |
6dda9f4a KY |
18136 | break; |
18137 | } | |
18138 | } | |
18139 | ||
4f5d1706 TI |
18140 | #define alc663_g71v_setup alc663_m51va_setup |
18141 | ||
6dda9f4a KY |
18142 | static void alc663_g71v_inithook(struct hda_codec *codec) |
18143 | { | |
18144 | alc663_g71v_front_automute(codec); | |
18145 | alc663_g71v_hp_automute(codec); | |
4f5d1706 | 18146 | alc_mic_automute(codec); |
6dda9f4a KY |
18147 | } |
18148 | ||
18149 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
18150 | unsigned int res) | |
18151 | { | |
18152 | switch (res >> 26) { | |
18153 | case ALC880_HP_EVENT: | |
18154 | alc663_m51va_speaker_automute(codec); | |
18155 | break; | |
18156 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18157 | alc_mic_automute(codec); |
6dda9f4a KY |
18158 | break; |
18159 | } | |
18160 | } | |
18161 | ||
4f5d1706 TI |
18162 | #define alc663_g50v_setup alc663_m51va_setup |
18163 | ||
6dda9f4a KY |
18164 | static void alc663_g50v_inithook(struct hda_codec *codec) |
18165 | { | |
18166 | alc663_m51va_speaker_automute(codec); | |
4f5d1706 | 18167 | alc_mic_automute(codec); |
6dda9f4a KY |
18168 | } |
18169 | ||
f1d4e28b KY |
18170 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
18171 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
42171c17 | 18172 | ALC262_HIPPO_MASTER_SWITCH, |
f1d4e28b KY |
18173 | |
18174 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | |
18175 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18176 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18177 | ||
18178 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
18179 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18180 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18181 | { } /* end */ | |
18182 | }; | |
18183 | ||
9541ba1d CP |
18184 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
18185 | /* Master Playback automatically created from Speaker and Headphone */ | |
18186 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
18187 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
18188 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
18189 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
18190 | ||
18191 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18192 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18193 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
18194 | ||
18195 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18196 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18197 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
18198 | { } /* end */ | |
18199 | }; | |
18200 | ||
cb53c626 TI |
18201 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
18202 | #define alc662_loopbacks alc880_loopbacks | |
18203 | #endif | |
18204 | ||
bc9f98a9 | 18205 | |
def319f9 | 18206 | /* pcm configuration: identical with ALC880 */ |
bc9f98a9 KY |
18207 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
18208 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
18209 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
18210 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
18211 | ||
18212 | /* | |
18213 | * configuration and preset | |
18214 | */ | |
18215 | static const char *alc662_models[ALC662_MODEL_LAST] = { | |
18216 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
18217 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
18218 | [ALC662_3ST_6ch] = "3stack-6ch", | |
18219 | [ALC662_5ST_DIG] = "6stack-dig", | |
18220 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
b995d76d | 18221 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
8c427226 | 18222 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
f1d4e28b | 18223 | [ALC662_ECS] = "ecs", |
6dda9f4a KY |
18224 | [ALC663_ASUS_M51VA] = "m51va", |
18225 | [ALC663_ASUS_G71V] = "g71v", | |
18226 | [ALC663_ASUS_H13] = "h13", | |
18227 | [ALC663_ASUS_G50V] = "g50v", | |
f1d4e28b KY |
18228 | [ALC663_ASUS_MODE1] = "asus-mode1", |
18229 | [ALC662_ASUS_MODE2] = "asus-mode2", | |
18230 | [ALC663_ASUS_MODE3] = "asus-mode3", | |
18231 | [ALC663_ASUS_MODE4] = "asus-mode4", | |
18232 | [ALC663_ASUS_MODE5] = "asus-mode5", | |
18233 | [ALC663_ASUS_MODE6] = "asus-mode6", | |
ebb83eeb KY |
18234 | [ALC663_ASUS_MODE7] = "asus-mode7", |
18235 | [ALC663_ASUS_MODE8] = "asus-mode8", | |
01f2bd48 TI |
18236 | [ALC272_DELL] = "dell", |
18237 | [ALC272_DELL_ZM1] = "dell-zm1", | |
9541ba1d | 18238 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
bc9f98a9 KY |
18239 | [ALC662_AUTO] = "auto", |
18240 | }; | |
18241 | ||
18242 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
dea0a509 | 18243 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
622e84cd KY |
18244 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
18245 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), | |
f1d4e28b | 18246 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
dea0a509 | 18247 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
cec27c89 | 18248 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
dea0a509 | 18249 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
f1d4e28b | 18250 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
dea0a509 | 18251 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
f1d4e28b | 18252 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
ebb83eeb KY |
18253 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
18254 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | |
f1d4e28b | 18255 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
ebb83eeb KY |
18256 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
18257 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | |
18258 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | |
18259 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | |
18260 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | |
dea0a509 | 18261 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
ebb83eeb KY |
18262 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
18263 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | |
dea0a509 TI |
18264 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
18265 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | |
18266 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | |
18267 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | |
ebb83eeb | 18268 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
622e84cd KY |
18269 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
18270 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | |
18271 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | |
f1d4e28b | 18272 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
dea0a509 TI |
18273 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
18274 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | |
18275 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | |
622e84cd | 18276 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
f1d4e28b | 18277 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
dea0a509 TI |
18278 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
18279 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | |
18280 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ | |
f1d4e28b | 18281 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
f1d4e28b | 18282 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
622e84cd | 18283 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
cec27c89 | 18284 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
622e84cd KY |
18285 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
18286 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), | |
dea0a509 TI |
18287 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
18288 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | |
18289 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | |
622e84cd | 18290 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
dea0a509 TI |
18291 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
18292 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | |
622e84cd | 18293 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
dea0a509 TI |
18294 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
18295 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | |
18296 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | |
18297 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | |
18298 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | |
622e84cd | 18299 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
dea0a509 | 18300 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
f1d4e28b | 18301 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
dea0a509 TI |
18302 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
18303 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | |
18304 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | |
18305 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | |
95fe5f2c HRK |
18306 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
18307 | ALC662_3ST_6ch_DIG), | |
4dee8baa | 18308 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
9541ba1d | 18309 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
cb55974c HRK |
18310 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
18311 | ALC662_3ST_6ch_DIG), | |
6227cdce | 18312 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
19c009aa | 18313 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
5bd3729f | 18314 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
dea0a509 | 18315 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
238713d4 | 18316 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
19c009aa | 18317 | ALC662_3ST_6ch_DIG), |
dea0a509 TI |
18318 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
18319 | ALC663_ASUS_H13), | |
bc9f98a9 KY |
18320 | {} |
18321 | }; | |
18322 | ||
18323 | static struct alc_config_preset alc662_presets[] = { | |
18324 | [ALC662_3ST_2ch_DIG] = { | |
f9e336f6 | 18325 | .mixers = { alc662_3ST_2ch_mixer }, |
bc9f98a9 KY |
18326 | .init_verbs = { alc662_init_verbs }, |
18327 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18328 | .dac_nids = alc662_dac_nids, | |
18329 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18330 | .dig_in_nid = ALC662_DIGIN_NID, |
18331 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18332 | .channel_mode = alc662_3ST_2ch_modes, | |
18333 | .input_mux = &alc662_capture_source, | |
18334 | }, | |
18335 | [ALC662_3ST_6ch_DIG] = { | |
f9e336f6 | 18336 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18337 | .init_verbs = { alc662_init_verbs }, |
18338 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18339 | .dac_nids = alc662_dac_nids, | |
18340 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18341 | .dig_in_nid = ALC662_DIGIN_NID, |
18342 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18343 | .channel_mode = alc662_3ST_6ch_modes, | |
18344 | .need_dac_fix = 1, | |
18345 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 18346 | }, |
bc9f98a9 | 18347 | [ALC662_3ST_6ch] = { |
f9e336f6 | 18348 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18349 | .init_verbs = { alc662_init_verbs }, |
18350 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18351 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
18352 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
18353 | .channel_mode = alc662_3ST_6ch_modes, | |
18354 | .need_dac_fix = 1, | |
18355 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 18356 | }, |
bc9f98a9 | 18357 | [ALC662_5ST_DIG] = { |
f9e336f6 | 18358 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18359 | .init_verbs = { alc662_init_verbs }, |
18360 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18361 | .dac_nids = alc662_dac_nids, | |
18362 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18363 | .dig_in_nid = ALC662_DIGIN_NID, |
18364 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
18365 | .channel_mode = alc662_5stack_modes, | |
18366 | .input_mux = &alc662_capture_source, | |
18367 | }, | |
18368 | [ALC662_LENOVO_101E] = { | |
f9e336f6 | 18369 | .mixers = { alc662_lenovo_101e_mixer }, |
bc9f98a9 KY |
18370 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
18371 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18372 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
18373 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
18374 | .channel_mode = alc662_3ST_2ch_modes, | |
18375 | .input_mux = &alc662_lenovo_101e_capture_source, | |
18376 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
18377 | .init_hook = alc662_lenovo_101e_all_automute, | |
18378 | }, | |
291702f0 | 18379 | [ALC662_ASUS_EEEPC_P701] = { |
f9e336f6 | 18380 | .mixers = { alc662_eeepc_p701_mixer }, |
291702f0 KY |
18381 | .init_verbs = { alc662_init_verbs, |
18382 | alc662_eeepc_sue_init_verbs }, | |
18383 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18384 | .dac_nids = alc662_dac_nids, | |
291702f0 KY |
18385 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
18386 | .channel_mode = alc662_3ST_2ch_modes, | |
291702f0 | 18387 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18388 | .setup = alc662_eeepc_setup, |
291702f0 KY |
18389 | .init_hook = alc662_eeepc_inithook, |
18390 | }, | |
8c427226 | 18391 | [ALC662_ASUS_EEEPC_EP20] = { |
f9e336f6 | 18392 | .mixers = { alc662_eeepc_ep20_mixer, |
8c427226 KY |
18393 | alc662_chmode_mixer }, |
18394 | .init_verbs = { alc662_init_verbs, | |
18395 | alc662_eeepc_ep20_sue_init_verbs }, | |
18396 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18397 | .dac_nids = alc662_dac_nids, | |
8c427226 KY |
18398 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
18399 | .channel_mode = alc662_3ST_6ch_modes, | |
18400 | .input_mux = &alc662_lenovo_101e_capture_source, | |
42171c17 | 18401 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18402 | .setup = alc662_eeepc_ep20_setup, |
8c427226 KY |
18403 | .init_hook = alc662_eeepc_ep20_inithook, |
18404 | }, | |
f1d4e28b | 18405 | [ALC662_ECS] = { |
f9e336f6 | 18406 | .mixers = { alc662_ecs_mixer }, |
f1d4e28b KY |
18407 | .init_verbs = { alc662_init_verbs, |
18408 | alc662_ecs_init_verbs }, | |
18409 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18410 | .dac_nids = alc662_dac_nids, | |
18411 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18412 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18413 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18414 | .setup = alc662_eeepc_setup, |
f1d4e28b KY |
18415 | .init_hook = alc662_eeepc_inithook, |
18416 | }, | |
6dda9f4a | 18417 | [ALC663_ASUS_M51VA] = { |
f9e336f6 | 18418 | .mixers = { alc663_m51va_mixer }, |
6dda9f4a KY |
18419 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
18420 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18421 | .dac_nids = alc662_dac_nids, | |
18422 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18423 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18424 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a | 18425 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18426 | .setup = alc663_m51va_setup, |
6dda9f4a KY |
18427 | .init_hook = alc663_m51va_inithook, |
18428 | }, | |
18429 | [ALC663_ASUS_G71V] = { | |
f9e336f6 | 18430 | .mixers = { alc663_g71v_mixer }, |
6dda9f4a KY |
18431 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
18432 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18433 | .dac_nids = alc662_dac_nids, | |
18434 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18435 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18436 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a | 18437 | .unsol_event = alc663_g71v_unsol_event, |
4f5d1706 | 18438 | .setup = alc663_g71v_setup, |
6dda9f4a KY |
18439 | .init_hook = alc663_g71v_inithook, |
18440 | }, | |
18441 | [ALC663_ASUS_H13] = { | |
f9e336f6 | 18442 | .mixers = { alc663_m51va_mixer }, |
6dda9f4a KY |
18443 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
18444 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18445 | .dac_nids = alc662_dac_nids, | |
18446 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18447 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a KY |
18448 | .unsol_event = alc663_m51va_unsol_event, |
18449 | .init_hook = alc663_m51va_inithook, | |
18450 | }, | |
18451 | [ALC663_ASUS_G50V] = { | |
f9e336f6 | 18452 | .mixers = { alc663_g50v_mixer }, |
6dda9f4a KY |
18453 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
18454 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18455 | .dac_nids = alc662_dac_nids, | |
18456 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18457 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18458 | .channel_mode = alc662_3ST_6ch_modes, | |
18459 | .input_mux = &alc663_capture_source, | |
18460 | .unsol_event = alc663_g50v_unsol_event, | |
4f5d1706 | 18461 | .setup = alc663_g50v_setup, |
6dda9f4a KY |
18462 | .init_hook = alc663_g50v_inithook, |
18463 | }, | |
f1d4e28b | 18464 | [ALC663_ASUS_MODE1] = { |
f9e336f6 TI |
18465 | .mixers = { alc663_m51va_mixer }, |
18466 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18467 | .init_verbs = { alc662_init_verbs, |
18468 | alc663_21jd_amic_init_verbs }, | |
18469 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18470 | .hp_nid = 0x03, | |
18471 | .dac_nids = alc662_dac_nids, | |
18472 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18473 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18474 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18475 | .unsol_event = alc663_mode1_unsol_event, |
4f5d1706 | 18476 | .setup = alc663_mode1_setup, |
f1d4e28b KY |
18477 | .init_hook = alc663_mode1_inithook, |
18478 | }, | |
18479 | [ALC662_ASUS_MODE2] = { | |
f9e336f6 TI |
18480 | .mixers = { alc662_1bjd_mixer }, |
18481 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18482 | .init_verbs = { alc662_init_verbs, |
18483 | alc662_1bjd_amic_init_verbs }, | |
18484 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18485 | .dac_nids = alc662_dac_nids, | |
18486 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18487 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18488 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18489 | .unsol_event = alc662_mode2_unsol_event, |
4f5d1706 | 18490 | .setup = alc662_mode2_setup, |
f1d4e28b KY |
18491 | .init_hook = alc662_mode2_inithook, |
18492 | }, | |
18493 | [ALC663_ASUS_MODE3] = { | |
f9e336f6 TI |
18494 | .mixers = { alc663_two_hp_m1_mixer }, |
18495 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18496 | .init_verbs = { alc662_init_verbs, |
18497 | alc663_two_hp_amic_m1_init_verbs }, | |
18498 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18499 | .hp_nid = 0x03, | |
18500 | .dac_nids = alc662_dac_nids, | |
18501 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18502 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18503 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18504 | .unsol_event = alc663_mode3_unsol_event, |
4f5d1706 | 18505 | .setup = alc663_mode3_setup, |
f1d4e28b KY |
18506 | .init_hook = alc663_mode3_inithook, |
18507 | }, | |
18508 | [ALC663_ASUS_MODE4] = { | |
f9e336f6 TI |
18509 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
18510 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18511 | .init_verbs = { alc662_init_verbs, |
18512 | alc663_21jd_amic_init_verbs}, | |
18513 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18514 | .hp_nid = 0x03, | |
18515 | .dac_nids = alc662_dac_nids, | |
18516 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18517 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18518 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18519 | .unsol_event = alc663_mode4_unsol_event, |
4f5d1706 | 18520 | .setup = alc663_mode4_setup, |
f1d4e28b KY |
18521 | .init_hook = alc663_mode4_inithook, |
18522 | }, | |
18523 | [ALC663_ASUS_MODE5] = { | |
f9e336f6 TI |
18524 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
18525 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18526 | .init_verbs = { alc662_init_verbs, |
18527 | alc663_15jd_amic_init_verbs }, | |
18528 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18529 | .hp_nid = 0x03, | |
18530 | .dac_nids = alc662_dac_nids, | |
18531 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18532 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18533 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18534 | .unsol_event = alc663_mode5_unsol_event, |
4f5d1706 | 18535 | .setup = alc663_mode5_setup, |
f1d4e28b KY |
18536 | .init_hook = alc663_mode5_inithook, |
18537 | }, | |
18538 | [ALC663_ASUS_MODE6] = { | |
f9e336f6 TI |
18539 | .mixers = { alc663_two_hp_m2_mixer }, |
18540 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18541 | .init_verbs = { alc662_init_verbs, |
18542 | alc663_two_hp_amic_m2_init_verbs }, | |
18543 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18544 | .hp_nid = 0x03, | |
18545 | .dac_nids = alc662_dac_nids, | |
18546 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18547 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18548 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18549 | .unsol_event = alc663_mode6_unsol_event, |
4f5d1706 | 18550 | .setup = alc663_mode6_setup, |
f1d4e28b KY |
18551 | .init_hook = alc663_mode6_inithook, |
18552 | }, | |
ebb83eeb KY |
18553 | [ALC663_ASUS_MODE7] = { |
18554 | .mixers = { alc663_mode7_mixer }, | |
18555 | .cap_mixer = alc662_auto_capture_mixer, | |
18556 | .init_verbs = { alc662_init_verbs, | |
18557 | alc663_mode7_init_verbs }, | |
18558 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18559 | .hp_nid = 0x03, | |
18560 | .dac_nids = alc662_dac_nids, | |
18561 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18562 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18563 | .channel_mode = alc662_3ST_2ch_modes, | |
18564 | .unsol_event = alc663_mode7_unsol_event, | |
18565 | .setup = alc663_mode7_setup, | |
18566 | .init_hook = alc663_mode7_inithook, | |
18567 | }, | |
18568 | [ALC663_ASUS_MODE8] = { | |
18569 | .mixers = { alc663_mode8_mixer }, | |
18570 | .cap_mixer = alc662_auto_capture_mixer, | |
18571 | .init_verbs = { alc662_init_verbs, | |
18572 | alc663_mode8_init_verbs }, | |
18573 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18574 | .hp_nid = 0x03, | |
18575 | .dac_nids = alc662_dac_nids, | |
18576 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18577 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18578 | .channel_mode = alc662_3ST_2ch_modes, | |
18579 | .unsol_event = alc663_mode8_unsol_event, | |
18580 | .setup = alc663_mode8_setup, | |
18581 | .init_hook = alc663_mode8_inithook, | |
18582 | }, | |
622e84cd KY |
18583 | [ALC272_DELL] = { |
18584 | .mixers = { alc663_m51va_mixer }, | |
18585 | .cap_mixer = alc272_auto_capture_mixer, | |
18586 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, | |
18587 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18588 | .dac_nids = alc662_dac_nids, | |
18589 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18590 | .adc_nids = alc272_adc_nids, | |
18591 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | |
18592 | .capsrc_nids = alc272_capsrc_nids, | |
18593 | .channel_mode = alc662_3ST_2ch_modes, | |
622e84cd | 18594 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18595 | .setup = alc663_m51va_setup, |
622e84cd KY |
18596 | .init_hook = alc663_m51va_inithook, |
18597 | }, | |
18598 | [ALC272_DELL_ZM1] = { | |
18599 | .mixers = { alc663_m51va_mixer }, | |
18600 | .cap_mixer = alc662_auto_capture_mixer, | |
18601 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, | |
18602 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18603 | .dac_nids = alc662_dac_nids, | |
18604 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18605 | .adc_nids = alc662_adc_nids, | |
b59bdf3b | 18606 | .num_adc_nids = 1, |
622e84cd KY |
18607 | .capsrc_nids = alc662_capsrc_nids, |
18608 | .channel_mode = alc662_3ST_2ch_modes, | |
622e84cd | 18609 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18610 | .setup = alc663_m51va_setup, |
622e84cd KY |
18611 | .init_hook = alc663_m51va_inithook, |
18612 | }, | |
9541ba1d CP |
18613 | [ALC272_SAMSUNG_NC10] = { |
18614 | .mixers = { alc272_nc10_mixer }, | |
18615 | .init_verbs = { alc662_init_verbs, | |
18616 | alc663_21jd_amic_init_verbs }, | |
18617 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18618 | .dac_nids = alc272_dac_nids, | |
18619 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18620 | .channel_mode = alc662_3ST_2ch_modes, | |
4f5d1706 | 18621 | /*.input_mux = &alc272_nc10_capture_source,*/ |
9541ba1d | 18622 | .unsol_event = alc663_mode4_unsol_event, |
4f5d1706 | 18623 | .setup = alc663_mode4_setup, |
9541ba1d CP |
18624 | .init_hook = alc663_mode4_inithook, |
18625 | }, | |
bc9f98a9 KY |
18626 | }; |
18627 | ||
18628 | ||
18629 | /* | |
18630 | * BIOS auto configuration | |
18631 | */ | |
18632 | ||
7085ec12 TI |
18633 | /* convert from MIX nid to DAC */ |
18634 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | |
18635 | { | |
18636 | if (nid == 0x0f) | |
18637 | return 0x02; | |
18638 | else if (nid >= 0x0c && nid <= 0x0e) | |
18639 | return nid - 0x0c + 0x02; | |
18640 | else | |
18641 | return 0; | |
18642 | } | |
18643 | ||
18644 | /* get MIX nid connected to the given pin targeted to DAC */ | |
18645 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | |
18646 | hda_nid_t dac) | |
18647 | { | |
18648 | hda_nid_t mix[4]; | |
18649 | int i, num; | |
18650 | ||
18651 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | |
18652 | for (i = 0; i < num; i++) { | |
18653 | if (alc662_mix_to_dac(mix[i]) == dac) | |
18654 | return mix[i]; | |
18655 | } | |
18656 | return 0; | |
18657 | } | |
18658 | ||
18659 | /* look for an empty DAC slot */ | |
18660 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
18661 | { | |
18662 | struct alc_spec *spec = codec->spec; | |
18663 | hda_nid_t srcs[5]; | |
18664 | int i, j, num; | |
18665 | ||
18666 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | |
18667 | if (num < 0) | |
18668 | return 0; | |
18669 | for (i = 0; i < num; i++) { | |
18670 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); | |
18671 | if (!nid) | |
18672 | continue; | |
18673 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
18674 | if (spec->multiout.dac_nids[j] == nid) | |
18675 | break; | |
18676 | if (j >= spec->multiout.num_dacs) | |
18677 | return nid; | |
18678 | } | |
18679 | return 0; | |
18680 | } | |
18681 | ||
18682 | /* fill in the dac_nids table from the parsed pin configuration */ | |
18683 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, | |
18684 | const struct auto_pin_cfg *cfg) | |
18685 | { | |
18686 | struct alc_spec *spec = codec->spec; | |
18687 | int i; | |
18688 | hda_nid_t dac; | |
18689 | ||
18690 | spec->multiout.dac_nids = spec->private_dac_nids; | |
18691 | for (i = 0; i < cfg->line_outs; i++) { | |
18692 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); | |
18693 | if (!dac) | |
18694 | continue; | |
18695 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
18696 | } | |
18697 | return 0; | |
18698 | } | |
18699 | ||
0afe5f89 | 18700 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
7085ec12 TI |
18701 | hda_nid_t nid, unsigned int chs) |
18702 | { | |
0afe5f89 | 18703 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
7085ec12 TI |
18704 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
18705 | } | |
18706 | ||
0afe5f89 | 18707 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
7085ec12 TI |
18708 | hda_nid_t nid, unsigned int chs) |
18709 | { | |
0afe5f89 | 18710 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
7085ec12 TI |
18711 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
18712 | } | |
18713 | ||
18714 | #define alc662_add_stereo_vol(spec, pfx, nid) \ | |
18715 | alc662_add_vol_ctl(spec, pfx, nid, 3) | |
18716 | #define alc662_add_stereo_sw(spec, pfx, nid) \ | |
18717 | alc662_add_sw_ctl(spec, pfx, nid, 3) | |
18718 | ||
bc9f98a9 | 18719 | /* add playback controls from the parsed DAC table */ |
7085ec12 | 18720 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
bc9f98a9 KY |
18721 | const struct auto_pin_cfg *cfg) |
18722 | { | |
7085ec12 | 18723 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
18724 | static const char *chname[4] = { |
18725 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
18726 | }; | |
7085ec12 | 18727 | hda_nid_t nid, mix; |
bc9f98a9 KY |
18728 | int i, err; |
18729 | ||
18730 | for (i = 0; i < cfg->line_outs; i++) { | |
7085ec12 TI |
18731 | nid = spec->multiout.dac_nids[i]; |
18732 | if (!nid) | |
18733 | continue; | |
18734 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); | |
18735 | if (!mix) | |
bc9f98a9 | 18736 | continue; |
bc9f98a9 KY |
18737 | if (i == 2) { |
18738 | /* Center/LFE */ | |
7085ec12 | 18739 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
bc9f98a9 KY |
18740 | if (err < 0) |
18741 | return err; | |
7085ec12 | 18742 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
bc9f98a9 KY |
18743 | if (err < 0) |
18744 | return err; | |
7085ec12 | 18745 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
bc9f98a9 KY |
18746 | if (err < 0) |
18747 | return err; | |
7085ec12 | 18748 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
bc9f98a9 KY |
18749 | if (err < 0) |
18750 | return err; | |
18751 | } else { | |
0d884cb9 TI |
18752 | const char *pfx; |
18753 | if (cfg->line_outs == 1 && | |
18754 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
7085ec12 | 18755 | if (cfg->hp_outs) |
0d884cb9 TI |
18756 | pfx = "Speaker"; |
18757 | else | |
18758 | pfx = "PCM"; | |
18759 | } else | |
18760 | pfx = chname[i]; | |
7085ec12 | 18761 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
bc9f98a9 KY |
18762 | if (err < 0) |
18763 | return err; | |
0d884cb9 TI |
18764 | if (cfg->line_outs == 1 && |
18765 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
18766 | pfx = "Speaker"; | |
7085ec12 | 18767 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
bc9f98a9 KY |
18768 | if (err < 0) |
18769 | return err; | |
18770 | } | |
18771 | } | |
18772 | return 0; | |
18773 | } | |
18774 | ||
18775 | /* add playback controls for speaker and HP outputs */ | |
7085ec12 TI |
18776 | /* return DAC nid if any new DAC is assigned */ |
18777 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |
bc9f98a9 KY |
18778 | const char *pfx) |
18779 | { | |
7085ec12 TI |
18780 | struct alc_spec *spec = codec->spec; |
18781 | hda_nid_t nid, mix; | |
bc9f98a9 | 18782 | int err; |
bc9f98a9 KY |
18783 | |
18784 | if (!pin) | |
18785 | return 0; | |
7085ec12 TI |
18786 | nid = alc662_look_for_dac(codec, pin); |
18787 | if (!nid) { | |
7085ec12 TI |
18788 | /* the corresponding DAC is already occupied */ |
18789 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | |
18790 | return 0; /* no way */ | |
18791 | /* create a switch only */ | |
0afe5f89 | 18792 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
7085ec12 | 18793 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
24fb9173 TI |
18794 | } |
18795 | ||
7085ec12 TI |
18796 | mix = alc662_dac_to_mix(codec, pin, nid); |
18797 | if (!mix) | |
18798 | return 0; | |
18799 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | |
18800 | if (err < 0) | |
18801 | return err; | |
18802 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | |
18803 | if (err < 0) | |
18804 | return err; | |
18805 | return nid; | |
bc9f98a9 KY |
18806 | } |
18807 | ||
18808 | /* create playback/capture controls for input pins */ | |
05f5f477 | 18809 | #define alc662_auto_create_input_ctls \ |
4b7348a1 | 18810 | alc882_auto_create_input_ctls |
bc9f98a9 KY |
18811 | |
18812 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
18813 | hda_nid_t nid, int pin_type, | |
7085ec12 | 18814 | hda_nid_t dac) |
bc9f98a9 | 18815 | { |
7085ec12 | 18816 | int i, num; |
ce503f38 | 18817 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
7085ec12 | 18818 | |
f6c7e546 | 18819 | alc_set_pin_output(codec, nid, pin_type); |
bc9f98a9 | 18820 | /* need the manual connection? */ |
7085ec12 TI |
18821 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
18822 | if (num <= 1) | |
18823 | return; | |
18824 | for (i = 0; i < num; i++) { | |
18825 | if (alc662_mix_to_dac(srcs[i]) != dac) | |
18826 | continue; | |
18827 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); | |
18828 | return; | |
bc9f98a9 KY |
18829 | } |
18830 | } | |
18831 | ||
18832 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
18833 | { | |
18834 | struct alc_spec *spec = codec->spec; | |
7085ec12 | 18835 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
bc9f98a9 KY |
18836 | int i; |
18837 | ||
18838 | for (i = 0; i <= HDA_SIDE; i++) { | |
18839 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
18840 | if (nid) | |
baba8ee9 | 18841 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
7085ec12 | 18842 | spec->multiout.dac_nids[i]); |
bc9f98a9 KY |
18843 | } |
18844 | } | |
18845 | ||
18846 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
18847 | { | |
18848 | struct alc_spec *spec = codec->spec; | |
18849 | hda_nid_t pin; | |
18850 | ||
18851 | pin = spec->autocfg.hp_pins[0]; | |
7085ec12 TI |
18852 | if (pin) |
18853 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, | |
18854 | spec->multiout.hp_nid); | |
f6c7e546 TI |
18855 | pin = spec->autocfg.speaker_pins[0]; |
18856 | if (pin) | |
7085ec12 TI |
18857 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
18858 | spec->multiout.extra_out_nid[0]); | |
bc9f98a9 KY |
18859 | } |
18860 | ||
bc9f98a9 KY |
18861 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
18862 | ||
18863 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
18864 | { | |
18865 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 18866 | struct auto_pin_cfg *cfg = &spec->autocfg; |
bc9f98a9 KY |
18867 | int i; |
18868 | ||
66ceeb6b TI |
18869 | for (i = 0; i < cfg->num_inputs; i++) { |
18870 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 18871 | if (alc_is_input_pin(codec, nid)) { |
23f0c048 | 18872 | alc_set_input_pin(codec, nid, i); |
52ca15b7 | 18873 | if (nid != ALC662_PIN_CD_NID && |
e82c025b | 18874 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
bc9f98a9 KY |
18875 | snd_hda_codec_write(codec, nid, 0, |
18876 | AC_VERB_SET_AMP_GAIN_MUTE, | |
18877 | AMP_OUT_MUTE); | |
18878 | } | |
18879 | } | |
18880 | } | |
18881 | ||
f511b01c TI |
18882 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
18883 | ||
bc9f98a9 KY |
18884 | static int alc662_parse_auto_config(struct hda_codec *codec) |
18885 | { | |
18886 | struct alc_spec *spec = codec->spec; | |
18887 | int err; | |
18888 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
18889 | ||
18890 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
18891 | alc662_ignore); | |
18892 | if (err < 0) | |
18893 | return err; | |
18894 | if (!spec->autocfg.line_outs) | |
18895 | return 0; /* can't find valid BIOS pin config */ | |
18896 | ||
7085ec12 | 18897 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
f12ab1e0 TI |
18898 | if (err < 0) |
18899 | return err; | |
7085ec12 | 18900 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
f12ab1e0 TI |
18901 | if (err < 0) |
18902 | return err; | |
7085ec12 | 18903 | err = alc662_auto_create_extra_out(codec, |
f12ab1e0 TI |
18904 | spec->autocfg.speaker_pins[0], |
18905 | "Speaker"); | |
18906 | if (err < 0) | |
18907 | return err; | |
7085ec12 TI |
18908 | if (err) |
18909 | spec->multiout.extra_out_nid[0] = err; | |
18910 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | |
f12ab1e0 TI |
18911 | "Headphone"); |
18912 | if (err < 0) | |
18913 | return err; | |
7085ec12 TI |
18914 | if (err) |
18915 | spec->multiout.hp_nid = err; | |
05f5f477 | 18916 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 18917 | if (err < 0) |
bc9f98a9 KY |
18918 | return err; |
18919 | ||
18920 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
18921 | ||
757899ac | 18922 | alc_auto_parse_digital(codec); |
bc9f98a9 | 18923 | |
603c4019 | 18924 | if (spec->kctls.list) |
d88897ea | 18925 | add_mixer(spec, spec->kctls.list); |
bc9f98a9 KY |
18926 | |
18927 | spec->num_mux_defs = 1; | |
61b9b9b1 | 18928 | spec->input_mux = &spec->private_imux[0]; |
ea1fb29a | 18929 | |
cec27c89 KY |
18930 | add_verb(spec, alc662_init_verbs); |
18931 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | |
d1eb57f4 | 18932 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
cec27c89 KY |
18933 | add_verb(spec, alc663_init_verbs); |
18934 | ||
18935 | if (codec->vendor_id == 0x10ec0272) | |
18936 | add_verb(spec, alc272_init_verbs); | |
ee979a14 TI |
18937 | |
18938 | err = alc_auto_add_mic_boost(codec); | |
18939 | if (err < 0) | |
18940 | return err; | |
18941 | ||
6227cdce KY |
18942 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
18943 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | |
18944 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); | |
18945 | else | |
18946 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
4a79ba34 | 18947 | |
8c87286f | 18948 | return 1; |
bc9f98a9 KY |
18949 | } |
18950 | ||
18951 | /* additional initialization for auto-configuration model */ | |
18952 | static void alc662_auto_init(struct hda_codec *codec) | |
18953 | { | |
f6c7e546 | 18954 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
18955 | alc662_auto_init_multi_out(codec); |
18956 | alc662_auto_init_hp_out(codec); | |
18957 | alc662_auto_init_analog_input(codec); | |
f511b01c | 18958 | alc662_auto_init_input_src(codec); |
757899ac | 18959 | alc_auto_init_digital(codec); |
f6c7e546 | 18960 | if (spec->unsol_event) |
7fb0d78f | 18961 | alc_inithook(codec); |
bc9f98a9 KY |
18962 | } |
18963 | ||
6cb3b707 DH |
18964 | enum { |
18965 | ALC662_FIXUP_IDEAPAD, | |
18966 | }; | |
18967 | ||
18968 | static const struct alc_fixup alc662_fixups[] = { | |
18969 | [ALC662_FIXUP_IDEAPAD] = { | |
18970 | .pins = (const struct alc_pincfg[]) { | |
18971 | { 0x17, 0x99130112 }, /* subwoofer */ | |
18972 | { } | |
18973 | } | |
18974 | }, | |
18975 | }; | |
18976 | ||
18977 | static struct snd_pci_quirk alc662_fixup_tbl[] = { | |
18978 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), | |
18979 | {} | |
18980 | }; | |
18981 | ||
18982 | ||
18983 | ||
bc9f98a9 KY |
18984 | static int patch_alc662(struct hda_codec *codec) |
18985 | { | |
18986 | struct alc_spec *spec; | |
18987 | int err, board_config; | |
18988 | ||
18989 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
18990 | if (!spec) | |
18991 | return -ENOMEM; | |
18992 | ||
18993 | codec->spec = spec; | |
18994 | ||
da00c244 KY |
18995 | alc_auto_parse_customize_define(codec); |
18996 | ||
2c3bf9ab TI |
18997 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
18998 | ||
c027ddcd KY |
18999 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
19000 | alc_codec_rename(codec, "ALC661"); | |
19001 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && | |
19002 | codec->bus->pci->subsystem_vendor == 0x1025 && | |
19003 | spec->cdefine.platform_type == 1) | |
19004 | alc_codec_rename(codec, "ALC272X"); | |
274693f3 | 19005 | |
bc9f98a9 KY |
19006 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
19007 | alc662_models, | |
19008 | alc662_cfg_tbl); | |
19009 | if (board_config < 0) { | |
9a11f1aa TI |
19010 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
19011 | codec->chip_name); | |
bc9f98a9 KY |
19012 | board_config = ALC662_AUTO; |
19013 | } | |
19014 | ||
19015 | if (board_config == ALC662_AUTO) { | |
6cb3b707 | 19016 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
bc9f98a9 KY |
19017 | /* automatic parse from the BIOS config */ |
19018 | err = alc662_parse_auto_config(codec); | |
19019 | if (err < 0) { | |
19020 | alc_free(codec); | |
19021 | return err; | |
8c87286f | 19022 | } else if (!err) { |
bc9f98a9 KY |
19023 | printk(KERN_INFO |
19024 | "hda_codec: Cannot set up configuration " | |
19025 | "from BIOS. Using base mode...\n"); | |
19026 | board_config = ALC662_3ST_2ch_DIG; | |
19027 | } | |
19028 | } | |
19029 | ||
dc1eae25 | 19030 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
19031 | err = snd_hda_attach_beep_device(codec, 0x1); |
19032 | if (err < 0) { | |
19033 | alc_free(codec); | |
19034 | return err; | |
19035 | } | |
680cd536 KK |
19036 | } |
19037 | ||
bc9f98a9 | 19038 | if (board_config != ALC662_AUTO) |
e9c364c0 | 19039 | setup_preset(codec, &alc662_presets[board_config]); |
bc9f98a9 | 19040 | |
bc9f98a9 KY |
19041 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
19042 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
19043 | ||
bc9f98a9 KY |
19044 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
19045 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
19046 | ||
dd704698 TI |
19047 | if (!spec->adc_nids) { |
19048 | spec->adc_nids = alc662_adc_nids; | |
19049 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
19050 | } | |
19051 | if (!spec->capsrc_nids) | |
19052 | spec->capsrc_nids = alc662_capsrc_nids; | |
bc9f98a9 | 19053 | |
f9e336f6 | 19054 | if (!spec->cap_mixer) |
b59bdf3b | 19055 | set_capture_mixer(codec); |
cec27c89 | 19056 | |
dc1eae25 | 19057 | if (has_cdefine_beep(codec)) { |
da00c244 KY |
19058 | switch (codec->vendor_id) { |
19059 | case 0x10ec0662: | |
19060 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
19061 | break; | |
19062 | case 0x10ec0272: | |
19063 | case 0x10ec0663: | |
19064 | case 0x10ec0665: | |
19065 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
19066 | break; | |
19067 | case 0x10ec0273: | |
19068 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); | |
19069 | break; | |
19070 | } | |
cec27c89 | 19071 | } |
2134ea4f TI |
19072 | spec->vmaster_nid = 0x02; |
19073 | ||
bc9f98a9 | 19074 | codec->patch_ops = alc_patch_ops; |
6cb3b707 | 19075 | if (board_config == ALC662_AUTO) { |
bc9f98a9 | 19076 | spec->init_hook = alc662_auto_init; |
6cb3b707 DH |
19077 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
19078 | } | |
19079 | ||
cb53c626 TI |
19080 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
19081 | if (!spec->loopback.amplist) | |
19082 | spec->loopback.amplist = alc662_loopbacks; | |
19083 | #endif | |
bc9f98a9 KY |
19084 | |
19085 | return 0; | |
19086 | } | |
19087 | ||
274693f3 KY |
19088 | static int patch_alc888(struct hda_codec *codec) |
19089 | { | |
19090 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | |
19091 | kfree(codec->chip_name); | |
19092 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | |
ac2c92e0 TI |
19093 | if (!codec->chip_name) { |
19094 | alc_free(codec); | |
274693f3 | 19095 | return -ENOMEM; |
ac2c92e0 TI |
19096 | } |
19097 | return patch_alc662(codec); | |
274693f3 | 19098 | } |
ac2c92e0 | 19099 | return patch_alc882(codec); |
274693f3 KY |
19100 | } |
19101 | ||
d1eb57f4 KY |
19102 | /* |
19103 | * ALC680 support | |
19104 | */ | |
c69aefab | 19105 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
d1eb57f4 KY |
19106 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
19107 | #define alc680_modes alc260_modes | |
19108 | ||
19109 | static hda_nid_t alc680_dac_nids[3] = { | |
19110 | /* Lout1, Lout2, hp */ | |
19111 | 0x02, 0x03, 0x04 | |
19112 | }; | |
19113 | ||
19114 | static hda_nid_t alc680_adc_nids[3] = { | |
19115 | /* ADC0-2 */ | |
19116 | /* DMIC, MIC, Line-in*/ | |
19117 | 0x07, 0x08, 0x09 | |
19118 | }; | |
19119 | ||
c69aefab KY |
19120 | /* |
19121 | * Analog capture ADC cgange | |
19122 | */ | |
66ceeb6b TI |
19123 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
19124 | { | |
19125 | struct alc_spec *spec = codec->spec; | |
19126 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
19127 | int pin_found = 0; | |
19128 | int type_found = AUTO_PIN_LAST; | |
19129 | hda_nid_t nid; | |
19130 | int i; | |
19131 | ||
19132 | for (i = 0; i < cfg->num_inputs; i++) { | |
19133 | nid = cfg->inputs[i].pin; | |
19134 | if (!(snd_hda_query_pin_caps(codec, nid) & | |
19135 | AC_PINCAP_PRES_DETECT)) | |
19136 | continue; | |
19137 | if (snd_hda_jack_detect(codec, nid)) { | |
19138 | if (cfg->inputs[i].type < type_found) { | |
19139 | type_found = cfg->inputs[i].type; | |
19140 | pin_found = nid; | |
19141 | } | |
19142 | } | |
19143 | } | |
19144 | ||
19145 | nid = 0x07; | |
19146 | if (pin_found) | |
19147 | snd_hda_get_connections(codec, pin_found, &nid, 1); | |
19148 | ||
19149 | if (nid != spec->cur_adc) | |
19150 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); | |
19151 | spec->cur_adc = nid; | |
19152 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, | |
19153 | spec->cur_adc_format); | |
19154 | } | |
19155 | ||
c69aefab KY |
19156 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
19157 | struct hda_codec *codec, | |
19158 | unsigned int stream_tag, | |
19159 | unsigned int format, | |
19160 | struct snd_pcm_substream *substream) | |
19161 | { | |
19162 | struct alc_spec *spec = codec->spec; | |
c69aefab | 19163 | |
66ceeb6b | 19164 | spec->cur_adc = 0x07; |
c69aefab KY |
19165 | spec->cur_adc_stream_tag = stream_tag; |
19166 | spec->cur_adc_format = format; | |
19167 | ||
66ceeb6b | 19168 | alc680_rec_autoswitch(codec); |
c69aefab KY |
19169 | return 0; |
19170 | } | |
19171 | ||
19172 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
19173 | struct hda_codec *codec, | |
19174 | struct snd_pcm_substream *substream) | |
19175 | { | |
19176 | snd_hda_codec_cleanup_stream(codec, 0x07); | |
19177 | snd_hda_codec_cleanup_stream(codec, 0x08); | |
19178 | snd_hda_codec_cleanup_stream(codec, 0x09); | |
19179 | return 0; | |
19180 | } | |
19181 | ||
19182 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { | |
19183 | .substreams = 1, /* can be overridden */ | |
19184 | .channels_min = 2, | |
19185 | .channels_max = 2, | |
19186 | /* NID is set in alc_build_pcms */ | |
19187 | .ops = { | |
19188 | .prepare = alc680_capture_pcm_prepare, | |
19189 | .cleanup = alc680_capture_pcm_cleanup | |
19190 | }, | |
19191 | }; | |
19192 | ||
d1eb57f4 KY |
19193 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
19194 | /* output mixer control */ | |
19195 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
19196 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
19197 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), | |
19198 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
c69aefab | 19199 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
d1eb57f4 | 19200 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c69aefab | 19201 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
d1eb57f4 KY |
19202 | { } |
19203 | }; | |
19204 | ||
c69aefab KY |
19205 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
19206 | .ops = &snd_hda_bind_vol, | |
19207 | .values = { | |
19208 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19209 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19210 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19211 | 0 | |
19212 | }, | |
19213 | }; | |
19214 | ||
19215 | static struct hda_bind_ctls alc680_bind_cap_switch = { | |
19216 | .ops = &snd_hda_bind_sw, | |
19217 | .values = { | |
19218 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19219 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19220 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19221 | 0 | |
19222 | }, | |
19223 | }; | |
19224 | ||
19225 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { | |
19226 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), | |
19227 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), | |
d1eb57f4 KY |
19228 | { } /* end */ |
19229 | }; | |
19230 | ||
19231 | /* | |
19232 | * generic initialization of ADC, input mixers and output mixers | |
19233 | */ | |
19234 | static struct hda_verb alc680_init_verbs[] = { | |
c69aefab KY |
19235 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
19236 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19237 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
d1eb57f4 | 19238 | |
c69aefab KY |
19239 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
19240 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19241 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19242 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
19243 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
19244 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d1eb57f4 KY |
19245 | |
19246 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19248 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19249 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19250 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
c69aefab KY |
19251 | |
19252 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
19253 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
66ceeb6b | 19254 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
c69aefab | 19255 | |
d1eb57f4 KY |
19256 | { } |
19257 | }; | |
19258 | ||
c69aefab KY |
19259 | /* toggle speaker-output according to the hp-jack state */ |
19260 | static void alc680_base_setup(struct hda_codec *codec) | |
19261 | { | |
19262 | struct alc_spec *spec = codec->spec; | |
19263 | ||
19264 | spec->autocfg.hp_pins[0] = 0x16; | |
19265 | spec->autocfg.speaker_pins[0] = 0x14; | |
19266 | spec->autocfg.speaker_pins[1] = 0x15; | |
66ceeb6b TI |
19267 | spec->autocfg.num_inputs = 2; |
19268 | spec->autocfg.inputs[0].pin = 0x18; | |
19269 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; | |
19270 | spec->autocfg.inputs[1].pin = 0x19; | |
86e2959a | 19271 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
c69aefab KY |
19272 | } |
19273 | ||
19274 | static void alc680_unsol_event(struct hda_codec *codec, | |
19275 | unsigned int res) | |
19276 | { | |
19277 | if ((res >> 26) == ALC880_HP_EVENT) | |
19278 | alc_automute_amp(codec); | |
19279 | if ((res >> 26) == ALC880_MIC_EVENT) | |
19280 | alc680_rec_autoswitch(codec); | |
19281 | } | |
19282 | ||
19283 | static void alc680_inithook(struct hda_codec *codec) | |
19284 | { | |
19285 | alc_automute_amp(codec); | |
19286 | alc680_rec_autoswitch(codec); | |
19287 | } | |
19288 | ||
d1eb57f4 KY |
19289 | /* create input playback/capture controls for the given pin */ |
19290 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
19291 | const char *ctlname, int idx) | |
19292 | { | |
19293 | hda_nid_t dac; | |
19294 | int err; | |
19295 | ||
19296 | switch (nid) { | |
19297 | case 0x14: | |
19298 | dac = 0x02; | |
19299 | break; | |
19300 | case 0x15: | |
19301 | dac = 0x03; | |
19302 | break; | |
19303 | case 0x16: | |
19304 | dac = 0x04; | |
19305 | break; | |
19306 | default: | |
19307 | return 0; | |
19308 | } | |
19309 | if (spec->multiout.dac_nids[0] != dac && | |
19310 | spec->multiout.dac_nids[1] != dac) { | |
19311 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
19312 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | |
19313 | HDA_OUTPUT)); | |
19314 | if (err < 0) | |
19315 | return err; | |
19316 | ||
19317 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
19318 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
19319 | ||
19320 | if (err < 0) | |
19321 | return err; | |
19322 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
19323 | } | |
19324 | ||
19325 | return 0; | |
19326 | } | |
19327 | ||
19328 | /* add playback controls from the parsed DAC table */ | |
19329 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, | |
19330 | const struct auto_pin_cfg *cfg) | |
19331 | { | |
19332 | hda_nid_t nid; | |
19333 | int err; | |
19334 | ||
19335 | spec->multiout.dac_nids = spec->private_dac_nids; | |
19336 | ||
19337 | nid = cfg->line_out_pins[0]; | |
19338 | if (nid) { | |
19339 | const char *name; | |
19340 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
19341 | name = "Speaker"; | |
19342 | else | |
19343 | name = "Front"; | |
19344 | err = alc680_new_analog_output(spec, nid, name, 0); | |
19345 | if (err < 0) | |
19346 | return err; | |
19347 | } | |
19348 | ||
19349 | nid = cfg->speaker_pins[0]; | |
19350 | if (nid) { | |
19351 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); | |
19352 | if (err < 0) | |
19353 | return err; | |
19354 | } | |
19355 | nid = cfg->hp_pins[0]; | |
19356 | if (nid) { | |
19357 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); | |
19358 | if (err < 0) | |
19359 | return err; | |
19360 | } | |
19361 | ||
19362 | return 0; | |
19363 | } | |
19364 | ||
19365 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, | |
19366 | hda_nid_t nid, int pin_type) | |
19367 | { | |
19368 | alc_set_pin_output(codec, nid, pin_type); | |
19369 | } | |
19370 | ||
19371 | static void alc680_auto_init_multi_out(struct hda_codec *codec) | |
19372 | { | |
19373 | struct alc_spec *spec = codec->spec; | |
19374 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | |
19375 | if (nid) { | |
19376 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
19377 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); | |
19378 | } | |
19379 | } | |
19380 | ||
19381 | static void alc680_auto_init_hp_out(struct hda_codec *codec) | |
19382 | { | |
19383 | struct alc_spec *spec = codec->spec; | |
19384 | hda_nid_t pin; | |
19385 | ||
19386 | pin = spec->autocfg.hp_pins[0]; | |
19387 | if (pin) | |
19388 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
19389 | pin = spec->autocfg.speaker_pins[0]; | |
19390 | if (pin) | |
19391 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
19392 | } | |
19393 | ||
19394 | /* pcm configuration: identical with ALC880 */ | |
19395 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback | |
19396 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture | |
19397 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | |
19398 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback | |
c69aefab | 19399 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
d1eb57f4 KY |
19400 | |
19401 | /* | |
19402 | * BIOS auto configuration | |
19403 | */ | |
19404 | static int alc680_parse_auto_config(struct hda_codec *codec) | |
19405 | { | |
19406 | struct alc_spec *spec = codec->spec; | |
19407 | int err; | |
19408 | static hda_nid_t alc680_ignore[] = { 0 }; | |
19409 | ||
19410 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
19411 | alc680_ignore); | |
19412 | if (err < 0) | |
19413 | return err; | |
c69aefab | 19414 | |
d1eb57f4 KY |
19415 | if (!spec->autocfg.line_outs) { |
19416 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
19417 | spec->multiout.max_channels = 2; | |
19418 | spec->no_analog = 1; | |
19419 | goto dig_only; | |
19420 | } | |
19421 | return 0; /* can't find valid BIOS pin config */ | |
19422 | } | |
19423 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
19424 | if (err < 0) | |
19425 | return err; | |
19426 | ||
19427 | spec->multiout.max_channels = 2; | |
19428 | ||
19429 | dig_only: | |
19430 | /* digital only support output */ | |
757899ac | 19431 | alc_auto_parse_digital(codec); |
d1eb57f4 KY |
19432 | if (spec->kctls.list) |
19433 | add_mixer(spec, spec->kctls.list); | |
19434 | ||
19435 | add_verb(spec, alc680_init_verbs); | |
d1eb57f4 KY |
19436 | |
19437 | err = alc_auto_add_mic_boost(codec); | |
19438 | if (err < 0) | |
19439 | return err; | |
19440 | ||
19441 | return 1; | |
19442 | } | |
19443 | ||
19444 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input | |
19445 | ||
19446 | /* init callback for auto-configuration model -- overriding the default init */ | |
19447 | static void alc680_auto_init(struct hda_codec *codec) | |
19448 | { | |
19449 | struct alc_spec *spec = codec->spec; | |
19450 | alc680_auto_init_multi_out(codec); | |
19451 | alc680_auto_init_hp_out(codec); | |
19452 | alc680_auto_init_analog_input(codec); | |
757899ac | 19453 | alc_auto_init_digital(codec); |
d1eb57f4 KY |
19454 | if (spec->unsol_event) |
19455 | alc_inithook(codec); | |
19456 | } | |
19457 | ||
19458 | /* | |
19459 | * configuration and preset | |
19460 | */ | |
19461 | static const char *alc680_models[ALC680_MODEL_LAST] = { | |
d4a86d81 TI |
19462 | [ALC680_BASE] = "base", |
19463 | [ALC680_AUTO] = "auto", | |
d1eb57f4 KY |
19464 | }; |
19465 | ||
19466 | static struct snd_pci_quirk alc680_cfg_tbl[] = { | |
19467 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), | |
19468 | {} | |
19469 | }; | |
19470 | ||
19471 | static struct alc_config_preset alc680_presets[] = { | |
19472 | [ALC680_BASE] = { | |
19473 | .mixers = { alc680_base_mixer }, | |
c69aefab | 19474 | .cap_mixer = alc680_master_capture_mixer, |
d1eb57f4 KY |
19475 | .init_verbs = { alc680_init_verbs }, |
19476 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), | |
19477 | .dac_nids = alc680_dac_nids, | |
d1eb57f4 KY |
19478 | .dig_out_nid = ALC680_DIGOUT_NID, |
19479 | .num_channel_mode = ARRAY_SIZE(alc680_modes), | |
19480 | .channel_mode = alc680_modes, | |
c69aefab KY |
19481 | .unsol_event = alc680_unsol_event, |
19482 | .setup = alc680_base_setup, | |
19483 | .init_hook = alc680_inithook, | |
19484 | ||
d1eb57f4 KY |
19485 | }, |
19486 | }; | |
19487 | ||
19488 | static int patch_alc680(struct hda_codec *codec) | |
19489 | { | |
19490 | struct alc_spec *spec; | |
19491 | int board_config; | |
19492 | int err; | |
19493 | ||
19494 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
19495 | if (spec == NULL) | |
19496 | return -ENOMEM; | |
19497 | ||
19498 | codec->spec = spec; | |
19499 | ||
19500 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, | |
19501 | alc680_models, | |
19502 | alc680_cfg_tbl); | |
19503 | ||
19504 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { | |
19505 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
19506 | codec->chip_name); | |
19507 | board_config = ALC680_AUTO; | |
19508 | } | |
19509 | ||
19510 | if (board_config == ALC680_AUTO) { | |
19511 | /* automatic parse from the BIOS config */ | |
19512 | err = alc680_parse_auto_config(codec); | |
19513 | if (err < 0) { | |
19514 | alc_free(codec); | |
19515 | return err; | |
19516 | } else if (!err) { | |
19517 | printk(KERN_INFO | |
19518 | "hda_codec: Cannot set up configuration " | |
19519 | "from BIOS. Using base mode...\n"); | |
19520 | board_config = ALC680_BASE; | |
19521 | } | |
19522 | } | |
19523 | ||
19524 | if (board_config != ALC680_AUTO) | |
19525 | setup_preset(codec, &alc680_presets[board_config]); | |
19526 | ||
19527 | spec->stream_analog_playback = &alc680_pcm_analog_playback; | |
c69aefab | 19528 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
d1eb57f4 | 19529 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
c69aefab | 19530 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
d1eb57f4 KY |
19531 | |
19532 | if (!spec->adc_nids) { | |
19533 | spec->adc_nids = alc680_adc_nids; | |
19534 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); | |
19535 | } | |
19536 | ||
19537 | if (!spec->cap_mixer) | |
19538 | set_capture_mixer(codec); | |
19539 | ||
19540 | spec->vmaster_nid = 0x02; | |
19541 | ||
19542 | codec->patch_ops = alc_patch_ops; | |
19543 | if (board_config == ALC680_AUTO) | |
19544 | spec->init_hook = alc680_auto_init; | |
19545 | ||
19546 | return 0; | |
19547 | } | |
19548 | ||
1da177e4 LT |
19549 | /* |
19550 | * patch entries | |
19551 | */ | |
1289e9e8 | 19552 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
1da177e4 | 19553 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
df694daa | 19554 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
f6a92248 | 19555 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
a361d84b | 19556 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
f6a92248 | 19557 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
ebb83eeb | 19558 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
01afd41f | 19559 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
ebb83eeb | 19560 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
f32610ed | 19561 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
bc9f98a9 | 19562 | .patch = patch_alc861 }, |
f32610ed JS |
19563 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
19564 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
19565 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
bc9f98a9 | 19566 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
4953550a | 19567 | .patch = patch_alc882 }, |
bc9f98a9 KY |
19568 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
19569 | .patch = patch_alc662 }, | |
6dda9f4a | 19570 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
cec27c89 | 19571 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
6227cdce | 19572 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
d1eb57f4 | 19573 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
f32610ed | 19574 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
1da177e4 | 19575 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
4953550a | 19576 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
669faba2 | 19577 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
4953550a | 19578 | .patch = patch_alc882 }, |
cb308f97 | 19579 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
4953550a | 19580 | .patch = patch_alc882 }, |
df694daa | 19581 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
4953550a | 19582 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
4442608d | 19583 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
4953550a | 19584 | .patch = patch_alc882 }, |
274693f3 | 19585 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
4953550a | 19586 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
274693f3 | 19587 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
1da177e4 LT |
19588 | {} /* terminator */ |
19589 | }; | |
1289e9e8 TI |
19590 | |
19591 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | |
19592 | ||
19593 | MODULE_LICENSE("GPL"); | |
19594 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | |
19595 | ||
19596 | static struct hda_codec_preset_list realtek_list = { | |
19597 | .preset = snd_hda_preset_realtek, | |
19598 | .owner = THIS_MODULE, | |
19599 | }; | |
19600 | ||
19601 | static int __init patch_realtek_init(void) | |
19602 | { | |
19603 | return snd_hda_add_codec_preset(&realtek_list); | |
19604 | } | |
19605 | ||
19606 | static void __exit patch_realtek_exit(void) | |
19607 | { | |
19608 | snd_hda_delete_codec_preset(&realtek_list); | |
19609 | } | |
19610 | ||
19611 | module_init(patch_realtek_init) | |
19612 | module_exit(patch_realtek_exit) |