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> | |
9ad0e496 | 31 | #include <sound/jack.h> |
1da177e4 LT |
32 | #include "hda_codec.h" |
33 | #include "hda_local.h" | |
680cd536 | 34 | #include "hda_beep.h" |
1da177e4 | 35 | |
ccc656ce KY |
36 | #define ALC880_FRONT_EVENT 0x01 |
37 | #define ALC880_DCVOL_EVENT 0x02 | |
38 | #define ALC880_HP_EVENT 0x04 | |
39 | #define ALC880_MIC_EVENT 0x08 | |
1da177e4 LT |
40 | |
41 | /* ALC880 board config type */ | |
42 | enum { | |
1da177e4 LT |
43 | ALC880_3ST, |
44 | ALC880_3ST_DIG, | |
45 | ALC880_5ST, | |
46 | ALC880_5ST_DIG, | |
47 | ALC880_W810, | |
dfc0ff62 | 48 | ALC880_Z71V, |
b6482d48 | 49 | ALC880_6ST, |
16ded525 TI |
50 | ALC880_6ST_DIG, |
51 | ALC880_F1734, | |
52 | ALC880_ASUS, | |
53 | ALC880_ASUS_DIG, | |
54 | ALC880_ASUS_W1V, | |
df694daa | 55 | ALC880_ASUS_DIG2, |
2cf9f0fc | 56 | ALC880_FUJITSU, |
16ded525 | 57 | ALC880_UNIWILL_DIG, |
ccc656ce KY |
58 | ALC880_UNIWILL, |
59 | ALC880_UNIWILL_P53, | |
df694daa KY |
60 | ALC880_CLEVO, |
61 | ALC880_TCL_S700, | |
ae6b813a | 62 | ALC880_LG, |
d681518a | 63 | ALC880_LG_LW, |
df99cd33 | 64 | ALC880_MEDION_RIM, |
e9edcee0 TI |
65 | #ifdef CONFIG_SND_DEBUG |
66 | ALC880_TEST, | |
67 | #endif | |
df694daa | 68 | ALC880_AUTO, |
16ded525 TI |
69 | ALC880_MODEL_LAST /* last tag */ |
70 | }; | |
71 | ||
72 | /* ALC260 models */ | |
73 | enum { | |
74 | ALC260_BASIC, | |
75 | ALC260_HP, | |
3f878308 | 76 | ALC260_HP_DC7600, |
df694daa KY |
77 | ALC260_HP_3013, |
78 | ALC260_FUJITSU_S702X, | |
0bfc90e9 | 79 | ALC260_ACER, |
bc9f98a9 KY |
80 | ALC260_WILL, |
81 | ALC260_REPLACER_672V, | |
cc959489 | 82 | ALC260_FAVORIT100, |
7cf51e48 JW |
83 | #ifdef CONFIG_SND_DEBUG |
84 | ALC260_TEST, | |
85 | #endif | |
df694daa | 86 | ALC260_AUTO, |
16ded525 | 87 | ALC260_MODEL_LAST /* last tag */ |
1da177e4 LT |
88 | }; |
89 | ||
df694daa KY |
90 | /* ALC262 models */ |
91 | enum { | |
92 | ALC262_BASIC, | |
ccc656ce KY |
93 | ALC262_HIPPO, |
94 | ALC262_HIPPO_1, | |
834be88d | 95 | ALC262_FUJITSU, |
9c7f852e | 96 | ALC262_HP_BPC, |
cd7509a4 KY |
97 | ALC262_HP_BPC_D7000_WL, |
98 | ALC262_HP_BPC_D7000_WF, | |
66d2a9d6 | 99 | ALC262_HP_TC_T5735, |
8c427226 | 100 | ALC262_HP_RP5700, |
304dcaac | 101 | ALC262_BENQ_ED8, |
272a527c | 102 | ALC262_SONY_ASSAMD, |
83c34218 | 103 | ALC262_BENQ_T31, |
f651b50b | 104 | ALC262_ULTRA, |
0e31daf7 | 105 | ALC262_LENOVO_3000, |
e8f9ae2a | 106 | ALC262_NEC, |
4e555fe5 | 107 | ALC262_TOSHIBA_S06, |
9f99a638 | 108 | ALC262_TOSHIBA_RX1, |
ba340e82 | 109 | ALC262_TYAN, |
df694daa KY |
110 | ALC262_AUTO, |
111 | ALC262_MODEL_LAST /* last tag */ | |
112 | }; | |
113 | ||
a361d84b KY |
114 | /* ALC268 models */ |
115 | enum { | |
eb5a6621 | 116 | ALC267_QUANTA_IL1, |
a361d84b | 117 | ALC268_3ST, |
d1a991a6 | 118 | ALC268_TOSHIBA, |
d273809e | 119 | ALC268_ACER, |
c238b4f4 | 120 | ALC268_ACER_DMIC, |
8ef355da | 121 | ALC268_ACER_ASPIRE_ONE, |
3866f0b0 | 122 | ALC268_DELL, |
f12462c5 | 123 | ALC268_ZEPTO, |
86c53bd2 JW |
124 | #ifdef CONFIG_SND_DEBUG |
125 | ALC268_TEST, | |
126 | #endif | |
a361d84b KY |
127 | ALC268_AUTO, |
128 | ALC268_MODEL_LAST /* last tag */ | |
129 | }; | |
130 | ||
f6a92248 KY |
131 | /* ALC269 models */ |
132 | enum { | |
133 | ALC269_BASIC, | |
60db6b53 | 134 | ALC269_QUANTA_FL1, |
84898e87 KY |
135 | ALC269_AMIC, |
136 | ALC269_DMIC, | |
137 | ALC269VB_AMIC, | |
138 | ALC269VB_DMIC, | |
26f5df26 | 139 | ALC269_FUJITSU, |
64154835 | 140 | ALC269_LIFEBOOK, |
fe3eb0a7 | 141 | ALC271_ACER, |
f6a92248 KY |
142 | ALC269_AUTO, |
143 | ALC269_MODEL_LAST /* last tag */ | |
144 | }; | |
145 | ||
df694daa KY |
146 | /* ALC861 models */ |
147 | enum { | |
148 | ALC861_3ST, | |
9c7f852e | 149 | ALC660_3ST, |
df694daa KY |
150 | ALC861_3ST_DIG, |
151 | ALC861_6ST_DIG, | |
22309c3e | 152 | ALC861_UNIWILL_M31, |
a53d1aec | 153 | ALC861_TOSHIBA, |
7cdbff94 | 154 | ALC861_ASUS, |
56bb0cab | 155 | ALC861_ASUS_LAPTOP, |
df694daa KY |
156 | ALC861_AUTO, |
157 | ALC861_MODEL_LAST, | |
158 | }; | |
159 | ||
f32610ed JS |
160 | /* ALC861-VD models */ |
161 | enum { | |
162 | ALC660VD_3ST, | |
6963f84c | 163 | ALC660VD_3ST_DIG, |
13c94744 | 164 | ALC660VD_ASUS_V1S, |
f32610ed JS |
165 | ALC861VD_3ST, |
166 | ALC861VD_3ST_DIG, | |
167 | ALC861VD_6ST_DIG, | |
bdd148a3 | 168 | ALC861VD_LENOVO, |
272a527c | 169 | ALC861VD_DALLAS, |
d1a991a6 | 170 | ALC861VD_HP, |
f32610ed JS |
171 | ALC861VD_AUTO, |
172 | ALC861VD_MODEL_LAST, | |
173 | }; | |
174 | ||
bc9f98a9 KY |
175 | /* ALC662 models */ |
176 | enum { | |
177 | ALC662_3ST_2ch_DIG, | |
178 | ALC662_3ST_6ch_DIG, | |
179 | ALC662_3ST_6ch, | |
180 | ALC662_5ST_DIG, | |
181 | ALC662_LENOVO_101E, | |
291702f0 | 182 | ALC662_ASUS_EEEPC_P701, |
8c427226 | 183 | ALC662_ASUS_EEEPC_EP20, |
6dda9f4a KY |
184 | ALC663_ASUS_M51VA, |
185 | ALC663_ASUS_G71V, | |
186 | ALC663_ASUS_H13, | |
187 | ALC663_ASUS_G50V, | |
f1d4e28b KY |
188 | ALC662_ECS, |
189 | ALC663_ASUS_MODE1, | |
190 | ALC662_ASUS_MODE2, | |
191 | ALC663_ASUS_MODE3, | |
192 | ALC663_ASUS_MODE4, | |
193 | ALC663_ASUS_MODE5, | |
194 | ALC663_ASUS_MODE6, | |
ebb83eeb KY |
195 | ALC663_ASUS_MODE7, |
196 | ALC663_ASUS_MODE8, | |
622e84cd KY |
197 | ALC272_DELL, |
198 | ALC272_DELL_ZM1, | |
9541ba1d | 199 | ALC272_SAMSUNG_NC10, |
bc9f98a9 KY |
200 | ALC662_AUTO, |
201 | ALC662_MODEL_LAST, | |
202 | }; | |
203 | ||
df694daa KY |
204 | /* ALC882 models */ |
205 | enum { | |
206 | ALC882_3ST_DIG, | |
207 | ALC882_6ST_DIG, | |
4b146cb0 | 208 | ALC882_ARIMA, |
bdd148a3 | 209 | ALC882_W2JC, |
272a527c KY |
210 | ALC882_TARGA, |
211 | ALC882_ASUS_A7J, | |
914759b7 | 212 | ALC882_ASUS_A7M, |
9102cd1c | 213 | ALC885_MACPRO, |
76e6f5a9 | 214 | ALC885_MBA21, |
87350ad0 | 215 | ALC885_MBP3, |
41d5545d | 216 | ALC885_MB5, |
e458b1fa | 217 | ALC885_MACMINI3, |
c54728d8 | 218 | ALC885_IMAC24, |
4b7e1803 | 219 | ALC885_IMAC91, |
9c7f852e TI |
220 | ALC883_3ST_2ch_DIG, |
221 | ALC883_3ST_6ch_DIG, | |
222 | ALC883_3ST_6ch, | |
223 | ALC883_6ST_DIG, | |
ccc656ce KY |
224 | ALC883_TARGA_DIG, |
225 | ALC883_TARGA_2ch_DIG, | |
64a8be74 | 226 | ALC883_TARGA_8ch_DIG, |
bab282b9 | 227 | ALC883_ACER, |
2880a867 | 228 | ALC883_ACER_ASPIRE, |
5b2d1eca | 229 | ALC888_ACER_ASPIRE_4930G, |
d2fd4b09 | 230 | ALC888_ACER_ASPIRE_6530G, |
3b315d70 | 231 | ALC888_ACER_ASPIRE_8930G, |
fc86f954 | 232 | ALC888_ACER_ASPIRE_7730G, |
c07584c8 | 233 | ALC883_MEDION, |
ea1fb29a | 234 | ALC883_MEDION_MD2, |
7ad7b218 | 235 | ALC883_MEDION_WIM2160, |
b373bdeb | 236 | ALC883_LAPTOP_EAPD, |
bc9f98a9 | 237 | ALC883_LENOVO_101E_2ch, |
272a527c | 238 | ALC883_LENOVO_NB0763, |
189609ae | 239 | ALC888_LENOVO_MS7195_DIG, |
e2757d5e | 240 | ALC888_LENOVO_SKY, |
ea1fb29a | 241 | ALC883_HAIER_W66, |
4723c022 | 242 | ALC888_3ST_HP, |
5795b9e6 | 243 | ALC888_6ST_DELL, |
a8848bd6 | 244 | ALC883_MITAC, |
a65cc60f | 245 | ALC883_CLEVO_M540R, |
0c4cc443 | 246 | ALC883_CLEVO_M720, |
fb97dc67 | 247 | ALC883_FUJITSU_PI2515, |
ef8ef5fb | 248 | ALC888_FUJITSU_XA3530, |
17bba1b7 | 249 | ALC883_3ST_6ch_INTEL, |
87a8c370 JK |
250 | ALC889A_INTEL, |
251 | ALC889_INTEL, | |
e2757d5e KY |
252 | ALC888_ASUS_M90V, |
253 | ALC888_ASUS_EEE1601, | |
eb4c41d3 | 254 | ALC889A_MB31, |
3ab90935 | 255 | ALC1200_ASUS_P5Q, |
3e1647c5 | 256 | ALC883_SONY_VAIO_TT, |
4953550a TI |
257 | ALC882_AUTO, |
258 | ALC882_MODEL_LAST, | |
9c7f852e TI |
259 | }; |
260 | ||
d4a86d81 TI |
261 | /* ALC680 models */ |
262 | enum { | |
263 | ALC680_BASE, | |
264 | ALC680_AUTO, | |
265 | ALC680_MODEL_LAST, | |
266 | }; | |
267 | ||
df694daa KY |
268 | /* for GPIO Poll */ |
269 | #define GPIO_MASK 0x03 | |
270 | ||
4a79ba34 TI |
271 | /* extra amp-initialization sequence types */ |
272 | enum { | |
273 | ALC_INIT_NONE, | |
274 | ALC_INIT_DEFAULT, | |
275 | ALC_INIT_GPIO1, | |
276 | ALC_INIT_GPIO2, | |
277 | ALC_INIT_GPIO3, | |
278 | }; | |
279 | ||
6c819492 TI |
280 | struct alc_mic_route { |
281 | hda_nid_t pin; | |
282 | unsigned char mux_idx; | |
283 | unsigned char amix_idx; | |
284 | }; | |
285 | ||
9ad0e496 KY |
286 | struct alc_jack { |
287 | hda_nid_t nid; | |
288 | int type; | |
289 | struct snd_jack *jack; | |
290 | }; | |
291 | ||
6c819492 TI |
292 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
293 | ||
da00c244 KY |
294 | struct alc_customize_define { |
295 | unsigned int sku_cfg; | |
296 | unsigned char port_connectivity; | |
297 | unsigned char check_sum; | |
298 | unsigned char customization; | |
299 | unsigned char external_amp; | |
300 | unsigned int enable_pcbeep:1; | |
301 | unsigned int platform_type:1; | |
302 | unsigned int swap:1; | |
303 | unsigned int override:1; | |
304 | }; | |
305 | ||
1da177e4 LT |
306 | struct alc_spec { |
307 | /* codec parameterization */ | |
df694daa | 308 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
1da177e4 | 309 | unsigned int num_mixers; |
f9e336f6 | 310 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
45bdd1c1 | 311 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
1da177e4 | 312 | |
2d9c6482 | 313 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
9c7f852e TI |
314 | * don't forget NULL |
315 | * termination! | |
e9edcee0 TI |
316 | */ |
317 | unsigned int num_init_verbs; | |
1da177e4 | 318 | |
aa563af7 | 319 | char stream_name_analog[32]; /* analog PCM stream */ |
1da177e4 LT |
320 | struct hda_pcm_stream *stream_analog_playback; |
321 | struct hda_pcm_stream *stream_analog_capture; | |
6330079f TI |
322 | struct hda_pcm_stream *stream_analog_alt_playback; |
323 | struct hda_pcm_stream *stream_analog_alt_capture; | |
1da177e4 | 324 | |
aa563af7 | 325 | char stream_name_digital[32]; /* digital PCM stream */ |
1da177e4 LT |
326 | struct hda_pcm_stream *stream_digital_playback; |
327 | struct hda_pcm_stream *stream_digital_capture; | |
328 | ||
329 | /* playback */ | |
16ded525 TI |
330 | struct hda_multi_out multiout; /* playback set-up |
331 | * max_channels, dacs must be set | |
332 | * dig_out_nid and hp_nid are optional | |
333 | */ | |
6330079f | 334 | hda_nid_t alt_dac_nid; |
6a05ac4a | 335 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
8c441982 | 336 | int dig_out_type; |
1da177e4 LT |
337 | |
338 | /* capture */ | |
339 | unsigned int num_adc_nids; | |
340 | hda_nid_t *adc_nids; | |
e1406348 | 341 | hda_nid_t *capsrc_nids; |
16ded525 | 342 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
1da177e4 | 343 | |
840b64c0 TI |
344 | /* capture setup for dynamic dual-adc switch */ |
345 | unsigned int cur_adc_idx; | |
346 | hda_nid_t cur_adc; | |
347 | unsigned int cur_adc_stream_tag; | |
348 | unsigned int cur_adc_format; | |
349 | ||
1da177e4 | 350 | /* capture source */ |
a1e8d2da | 351 | unsigned int num_mux_defs; |
1da177e4 LT |
352 | const struct hda_input_mux *input_mux; |
353 | unsigned int cur_mux[3]; | |
6c819492 TI |
354 | struct alc_mic_route ext_mic; |
355 | struct alc_mic_route int_mic; | |
1da177e4 LT |
356 | |
357 | /* channel model */ | |
d2a6d7dc | 358 | const struct hda_channel_mode *channel_mode; |
1da177e4 | 359 | int num_channel_mode; |
4e195a7b | 360 | int need_dac_fix; |
3b315d70 HM |
361 | int const_channel_count; |
362 | int ext_channel_count; | |
1da177e4 LT |
363 | |
364 | /* PCM information */ | |
4c5186ed | 365 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
41e41f1f | 366 | |
9ad0e496 KY |
367 | /* jack detection */ |
368 | struct snd_array jacks; | |
369 | ||
e9edcee0 TI |
370 | /* dynamic controls, init_verbs and input_mux */ |
371 | struct auto_pin_cfg autocfg; | |
da00c244 | 372 | struct alc_customize_define cdefine; |
603c4019 | 373 | struct snd_array kctls; |
61b9b9b1 | 374 | struct hda_input_mux private_imux[3]; |
41923e44 | 375 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
4953550a TI |
376 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
377 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; | |
834be88d | 378 | |
ae6b813a TI |
379 | /* hooks */ |
380 | void (*init_hook)(struct hda_codec *codec); | |
381 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
f5de24b0 | 382 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
c97259df | 383 | void (*power_hook)(struct hda_codec *codec); |
f5de24b0 | 384 | #endif |
ae6b813a | 385 | |
834be88d TI |
386 | /* for pin sensing */ |
387 | unsigned int sense_updated: 1; | |
388 | unsigned int jack_present: 1; | |
bec15c3a | 389 | unsigned int master_sw: 1; |
6c819492 | 390 | unsigned int auto_mic:1; |
cb53c626 | 391 | |
e64f14f4 TI |
392 | /* other flags */ |
393 | unsigned int no_analog :1; /* digital I/O only */ | |
840b64c0 | 394 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
4a79ba34 | 395 | int init_amp; |
d433a678 | 396 | int codec_variant; /* flag for other variants */ |
e64f14f4 | 397 | |
2134ea4f TI |
398 | /* for virtual master */ |
399 | hda_nid_t vmaster_nid; | |
cb53c626 TI |
400 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
401 | struct hda_loopback_check loopback; | |
402 | #endif | |
2c3bf9ab TI |
403 | |
404 | /* for PLL fix */ | |
405 | hda_nid_t pll_nid; | |
406 | unsigned int pll_coef_idx, pll_coef_bit; | |
df694daa KY |
407 | }; |
408 | ||
409 | /* | |
410 | * configuration template - to be copied to the spec instance | |
411 | */ | |
412 | struct alc_config_preset { | |
9c7f852e TI |
413 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
414 | * with spec | |
415 | */ | |
f9e336f6 | 416 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
df694daa KY |
417 | const struct hda_verb *init_verbs[5]; |
418 | unsigned int num_dacs; | |
419 | hda_nid_t *dac_nids; | |
420 | hda_nid_t dig_out_nid; /* optional */ | |
421 | hda_nid_t hp_nid; /* optional */ | |
b25c9da1 | 422 | hda_nid_t *slave_dig_outs; |
df694daa KY |
423 | unsigned int num_adc_nids; |
424 | hda_nid_t *adc_nids; | |
e1406348 | 425 | hda_nid_t *capsrc_nids; |
df694daa KY |
426 | hda_nid_t dig_in_nid; |
427 | unsigned int num_channel_mode; | |
428 | const struct hda_channel_mode *channel_mode; | |
4e195a7b | 429 | int need_dac_fix; |
3b315d70 | 430 | int const_channel_count; |
a1e8d2da | 431 | unsigned int num_mux_defs; |
df694daa | 432 | const struct hda_input_mux *input_mux; |
ae6b813a | 433 | void (*unsol_event)(struct hda_codec *, unsigned int); |
e9c364c0 | 434 | void (*setup)(struct hda_codec *); |
ae6b813a | 435 | void (*init_hook)(struct hda_codec *); |
cb53c626 TI |
436 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
437 | struct hda_amp_list *loopbacks; | |
c97259df | 438 | void (*power_hook)(struct hda_codec *codec); |
cb53c626 | 439 | #endif |
1da177e4 LT |
440 | }; |
441 | ||
1da177e4 LT |
442 | |
443 | /* | |
444 | * input MUX handling | |
445 | */ | |
9c7f852e TI |
446 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
447 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
448 | { |
449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
450 | struct alc_spec *spec = codec->spec; | |
a1e8d2da JW |
451 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
452 | if (mux_idx >= spec->num_mux_defs) | |
453 | mux_idx = 0; | |
5311114d TI |
454 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
455 | mux_idx = 0; | |
a1e8d2da | 456 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
1da177e4 LT |
457 | } |
458 | ||
9c7f852e TI |
459 | static int alc_mux_enum_get(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; | |
464 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
465 | ||
466 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
467 | return 0; | |
468 | } | |
469 | ||
9c7f852e TI |
470 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
471 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
472 | { |
473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
474 | struct alc_spec *spec = codec->spec; | |
cd896c33 | 475 | const struct hda_input_mux *imux; |
1da177e4 | 476 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
cd896c33 | 477 | unsigned int mux_idx; |
e1406348 TI |
478 | hda_nid_t nid = spec->capsrc_nids ? |
479 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
0169b6b3 | 480 | unsigned int type; |
1da177e4 | 481 | |
cd896c33 TI |
482 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
483 | imux = &spec->input_mux[mux_idx]; | |
5311114d TI |
484 | if (!imux->num_items && mux_idx > 0) |
485 | imux = &spec->input_mux[0]; | |
cd896c33 | 486 | |
a22d543a | 487 | type = get_wcaps_type(get_wcaps(codec, nid)); |
0169b6b3 | 488 | if (type == AC_WID_AUD_MIX) { |
54cbc9ab TI |
489 | /* Matrix-mixer style (e.g. ALC882) */ |
490 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
491 | unsigned int i, idx; | |
492 | ||
493 | idx = ucontrol->value.enumerated.item[0]; | |
494 | if (idx >= imux->num_items) | |
495 | idx = imux->num_items - 1; | |
496 | if (*cur_val == idx) | |
497 | return 0; | |
498 | for (i = 0; i < imux->num_items; i++) { | |
499 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | |
500 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | |
501 | imux->items[i].index, | |
502 | HDA_AMP_MUTE, v); | |
503 | } | |
504 | *cur_val = idx; | |
505 | return 1; | |
506 | } else { | |
507 | /* MUX style (e.g. ALC880) */ | |
cd896c33 | 508 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
54cbc9ab TI |
509 | &spec->cur_mux[adc_idx]); |
510 | } | |
511 | } | |
e9edcee0 | 512 | |
1da177e4 LT |
513 | /* |
514 | * channel mode setting | |
515 | */ | |
9c7f852e TI |
516 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
517 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
518 | { |
519 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
520 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc TI |
521 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
522 | spec->num_channel_mode); | |
1da177e4 LT |
523 | } |
524 | ||
9c7f852e TI |
525 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
526 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
527 | { |
528 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
529 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc | 530 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
9c7f852e | 531 | spec->num_channel_mode, |
3b315d70 | 532 | spec->ext_channel_count); |
1da177e4 LT |
533 | } |
534 | ||
9c7f852e TI |
535 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
536 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
537 | { |
538 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
539 | struct alc_spec *spec = codec->spec; | |
4e195a7b TI |
540 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
541 | spec->num_channel_mode, | |
3b315d70 HM |
542 | &spec->ext_channel_count); |
543 | if (err >= 0 && !spec->const_channel_count) { | |
544 | spec->multiout.max_channels = spec->ext_channel_count; | |
545 | if (spec->need_dac_fix) | |
546 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; | |
547 | } | |
4e195a7b | 548 | return err; |
1da177e4 LT |
549 | } |
550 | ||
a9430dd8 | 551 | /* |
4c5186ed | 552 | * Control the mode of pin widget settings via the mixer. "pc" is used |
ea1fb29a | 553 | * instead of "%" to avoid consequences of accidently treating the % as |
4c5186ed JW |
554 | * being part of a format specifier. Maximum allowed length of a value is |
555 | * 63 characters plus NULL terminator. | |
7cf51e48 JW |
556 | * |
557 | * Note: some retasking pin complexes seem to ignore requests for input | |
558 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
559 | * are requested. Therefore order this list so that this behaviour will not | |
560 | * cause problems when mixer clients move through the enum sequentially. | |
a1e8d2da JW |
561 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
562 | * March 2006. | |
4c5186ed JW |
563 | */ |
564 | static char *alc_pin_mode_names[] = { | |
7cf51e48 JW |
565 | "Mic 50pc bias", "Mic 80pc bias", |
566 | "Line in", "Line out", "Headphone out", | |
4c5186ed JW |
567 | }; |
568 | static unsigned char alc_pin_mode_values[] = { | |
7cf51e48 | 569 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
4c5186ed JW |
570 | }; |
571 | /* The control can present all 5 options, or it can limit the options based | |
a1e8d2da JW |
572 | * in the pin being assumed to be exclusively an input or an output pin. In |
573 | * addition, "input" pins may or may not process the mic bias option | |
574 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
575 | * accept requests for bias as of chip versions up to March 2006) and/or | |
576 | * wiring in the computer. | |
a9430dd8 | 577 | */ |
a1e8d2da JW |
578 | #define ALC_PIN_DIR_IN 0x00 |
579 | #define ALC_PIN_DIR_OUT 0x01 | |
580 | #define ALC_PIN_DIR_INOUT 0x02 | |
581 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
582 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
4c5186ed | 583 | |
ea1fb29a | 584 | /* Info about the pin modes supported by the different pin direction modes. |
4c5186ed JW |
585 | * For each direction the minimum and maximum values are given. |
586 | */ | |
a1e8d2da | 587 | static signed char alc_pin_mode_dir_info[5][2] = { |
4c5186ed JW |
588 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
589 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
590 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
a1e8d2da JW |
591 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
592 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
4c5186ed JW |
593 | }; |
594 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
595 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
596 | #define alc_pin_mode_n_items(_dir) \ | |
597 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
598 | ||
9c7f852e TI |
599 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
600 | struct snd_ctl_elem_info *uinfo) | |
a9430dd8 | 601 | { |
4c5186ed JW |
602 | unsigned int item_num = uinfo->value.enumerated.item; |
603 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
604 | ||
605 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
a9430dd8 | 606 | uinfo->count = 1; |
4c5186ed JW |
607 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
608 | ||
609 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
610 | item_num = alc_pin_mode_min(dir); | |
611 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
a9430dd8 JW |
612 | return 0; |
613 | } | |
614 | ||
9c7f852e TI |
615 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
616 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 617 | { |
4c5186ed | 618 | unsigned int i; |
a9430dd8 JW |
619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
620 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed | 621 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
a9430dd8 | 622 | long *valp = ucontrol->value.integer.value; |
9c7f852e TI |
623 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
624 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
625 | 0x00); | |
a9430dd8 | 626 | |
4c5186ed JW |
627 | /* Find enumerated value for current pinctl setting */ |
628 | i = alc_pin_mode_min(dir); | |
4b35d2ca | 629 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
4c5186ed | 630 | i++; |
9c7f852e | 631 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
a9430dd8 JW |
632 | return 0; |
633 | } | |
634 | ||
9c7f852e TI |
635 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
636 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 637 | { |
4c5186ed | 638 | signed int change; |
a9430dd8 JW |
639 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
640 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed JW |
641 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
642 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
643 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
644 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
645 | 0x00); | |
a9430dd8 | 646 | |
f12ab1e0 | 647 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
4c5186ed JW |
648 | val = alc_pin_mode_min(dir); |
649 | ||
650 | change = pinctl != alc_pin_mode_values[val]; | |
cdcd9268 JW |
651 | if (change) { |
652 | /* Set pin mode to that requested */ | |
82beb8fd TI |
653 | snd_hda_codec_write_cache(codec, nid, 0, |
654 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
655 | alc_pin_mode_values[val]); | |
cdcd9268 | 656 | |
ea1fb29a | 657 | /* Also enable the retasking pin's input/output as required |
cdcd9268 JW |
658 | * for the requested pin mode. Enum values of 2 or less are |
659 | * input modes. | |
660 | * | |
661 | * Dynamically switching the input/output buffers probably | |
a1e8d2da JW |
662 | * reduces noise slightly (particularly on input) so we'll |
663 | * do it. However, having both input and output buffers | |
664 | * enabled simultaneously doesn't seem to be problematic if | |
665 | * this turns out to be necessary in the future. | |
cdcd9268 JW |
666 | */ |
667 | if (val <= 2) { | |
47fd830a TI |
668 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
669 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
670 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
671 | HDA_AMP_MUTE, 0); | |
cdcd9268 | 672 | } else { |
47fd830a TI |
673 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
674 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
675 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
676 | HDA_AMP_MUTE, 0); | |
cdcd9268 JW |
677 | } |
678 | } | |
a9430dd8 JW |
679 | return change; |
680 | } | |
681 | ||
4c5186ed | 682 | #define ALC_PIN_MODE(xname, nid, dir) \ |
a9430dd8 | 683 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
5b0cb1d8 | 684 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
4c5186ed JW |
685 | .info = alc_pin_mode_info, \ |
686 | .get = alc_pin_mode_get, \ | |
687 | .put = alc_pin_mode_put, \ | |
688 | .private_value = nid | (dir<<16) } | |
df694daa | 689 | |
5c8f858d JW |
690 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
691 | * together using a mask with more than one bit set. This control is | |
692 | * currently used only by the ALC260 test model. At this stage they are not | |
693 | * needed for any "production" models. | |
694 | */ | |
695 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 696 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
f12ab1e0 | 697 | |
9c7f852e TI |
698 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
699 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
700 | { |
701 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
702 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
703 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
704 | long *valp = ucontrol->value.integer.value; | |
9c7f852e TI |
705 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
706 | AC_VERB_GET_GPIO_DATA, 0x00); | |
5c8f858d JW |
707 | |
708 | *valp = (val & mask) != 0; | |
709 | return 0; | |
710 | } | |
9c7f852e TI |
711 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
712 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
713 | { |
714 | signed int change; | |
715 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
716 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
717 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
718 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
719 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
720 | AC_VERB_GET_GPIO_DATA, | |
721 | 0x00); | |
5c8f858d JW |
722 | |
723 | /* Set/unset the masked GPIO bit(s) as needed */ | |
9c7f852e TI |
724 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
725 | if (val == 0) | |
5c8f858d JW |
726 | gpio_data &= ~mask; |
727 | else | |
728 | gpio_data |= mask; | |
82beb8fd TI |
729 | snd_hda_codec_write_cache(codec, nid, 0, |
730 | AC_VERB_SET_GPIO_DATA, gpio_data); | |
5c8f858d JW |
731 | |
732 | return change; | |
733 | } | |
734 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
735 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
5b0cb1d8 | 736 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
5c8f858d JW |
737 | .info = alc_gpio_data_info, \ |
738 | .get = alc_gpio_data_get, \ | |
739 | .put = alc_gpio_data_put, \ | |
740 | .private_value = nid | (mask<<16) } | |
741 | #endif /* CONFIG_SND_DEBUG */ | |
742 | ||
92621f13 JW |
743 | /* A switch control to allow the enabling of the digital IO pins on the |
744 | * ALC260. This is incredibly simplistic; the intention of this control is | |
745 | * to provide something in the test model allowing digital outputs to be | |
746 | * identified if present. If models are found which can utilise these | |
747 | * outputs a more complete mixer control can be devised for those models if | |
748 | * necessary. | |
749 | */ | |
750 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 751 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
f12ab1e0 | 752 | |
9c7f852e TI |
753 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
754 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
755 | { |
756 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
757 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
758 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
759 | long *valp = ucontrol->value.integer.value; | |
9c7f852e | 760 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 761 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
92621f13 JW |
762 | |
763 | *valp = (val & mask) != 0; | |
764 | return 0; | |
765 | } | |
9c7f852e TI |
766 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
767 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
768 | { |
769 | signed int change; | |
770 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
771 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
772 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
773 | long val = *ucontrol->value.integer.value; | |
9c7f852e | 774 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 775 | AC_VERB_GET_DIGI_CONVERT_1, |
9c7f852e | 776 | 0x00); |
92621f13 JW |
777 | |
778 | /* Set/unset the masked control bit(s) as needed */ | |
9c7f852e | 779 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
92621f13 JW |
780 | if (val==0) |
781 | ctrl_data &= ~mask; | |
782 | else | |
783 | ctrl_data |= mask; | |
82beb8fd TI |
784 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
785 | ctrl_data); | |
92621f13 JW |
786 | |
787 | return change; | |
788 | } | |
789 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
790 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
5b0cb1d8 | 791 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
92621f13 JW |
792 | .info = alc_spdif_ctrl_info, \ |
793 | .get = alc_spdif_ctrl_get, \ | |
794 | .put = alc_spdif_ctrl_put, \ | |
795 | .private_value = nid | (mask<<16) } | |
796 | #endif /* CONFIG_SND_DEBUG */ | |
797 | ||
f8225f6d JW |
798 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
799 | * Again, this is only used in the ALC26x test models to help identify when | |
800 | * the EAPD line must be asserted for features to work. | |
801 | */ | |
802 | #ifdef CONFIG_SND_DEBUG | |
803 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | |
804 | ||
805 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | |
806 | struct snd_ctl_elem_value *ucontrol) | |
807 | { | |
808 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
809 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
810 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
811 | long *valp = ucontrol->value.integer.value; | |
812 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
813 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | |
814 | ||
815 | *valp = (val & mask) != 0; | |
816 | return 0; | |
817 | } | |
818 | ||
819 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |
820 | struct snd_ctl_elem_value *ucontrol) | |
821 | { | |
822 | int change; | |
823 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
824 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
825 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
826 | long val = *ucontrol->value.integer.value; | |
827 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
828 | AC_VERB_GET_EAPD_BTLENABLE, | |
829 | 0x00); | |
830 | ||
831 | /* Set/unset the masked control bit(s) as needed */ | |
832 | change = (!val ? 0 : mask) != (ctrl_data & mask); | |
833 | if (!val) | |
834 | ctrl_data &= ~mask; | |
835 | else | |
836 | ctrl_data |= mask; | |
837 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
838 | ctrl_data); | |
839 | ||
840 | return change; | |
841 | } | |
842 | ||
843 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | |
844 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
5b0cb1d8 | 845 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
f8225f6d JW |
846 | .info = alc_eapd_ctrl_info, \ |
847 | .get = alc_eapd_ctrl_get, \ | |
848 | .put = alc_eapd_ctrl_put, \ | |
849 | .private_value = nid | (mask<<16) } | |
850 | #endif /* CONFIG_SND_DEBUG */ | |
851 | ||
23f0c048 TI |
852 | /* |
853 | * set up the input pin config (depending on the given auto-pin type) | |
854 | */ | |
855 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, | |
856 | int auto_pin_type) | |
857 | { | |
858 | unsigned int val = PIN_IN; | |
859 | ||
86e2959a | 860 | if (auto_pin_type == AUTO_PIN_MIC) { |
23f0c048 | 861 | unsigned int pincap; |
954a29c8 TI |
862 | unsigned int oldval; |
863 | oldval = snd_hda_codec_read(codec, nid, 0, | |
864 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
1327a32b | 865 | pincap = snd_hda_query_pin_caps(codec, nid); |
23f0c048 | 866 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
954a29c8 TI |
867 | /* if the default pin setup is vref50, we give it priority */ |
868 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) | |
23f0c048 | 869 | val = PIN_VREF80; |
461c6c3a TI |
870 | else if (pincap & AC_PINCAP_VREF_50) |
871 | val = PIN_VREF50; | |
872 | else if (pincap & AC_PINCAP_VREF_100) | |
873 | val = PIN_VREF100; | |
874 | else if (pincap & AC_PINCAP_VREF_GRD) | |
875 | val = PIN_VREFGRD; | |
23f0c048 TI |
876 | } |
877 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); | |
878 | } | |
879 | ||
f6837bbd TI |
880 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
881 | { | |
882 | struct alc_spec *spec = codec->spec; | |
883 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
884 | ||
885 | if (!cfg->line_outs) { | |
886 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && | |
887 | cfg->line_out_pins[cfg->line_outs]) | |
888 | cfg->line_outs++; | |
889 | } | |
890 | if (!cfg->speaker_outs) { | |
891 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && | |
892 | cfg->speaker_pins[cfg->speaker_outs]) | |
893 | cfg->speaker_outs++; | |
894 | } | |
895 | if (!cfg->hp_outs) { | |
896 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && | |
897 | cfg->hp_pins[cfg->hp_outs]) | |
898 | cfg->hp_outs++; | |
899 | } | |
900 | } | |
901 | ||
d88897ea TI |
902 | /* |
903 | */ | |
904 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | |
905 | { | |
906 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
907 | return; | |
908 | spec->mixers[spec->num_mixers++] = mix; | |
909 | } | |
910 | ||
911 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | |
912 | { | |
913 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) | |
914 | return; | |
915 | spec->init_verbs[spec->num_init_verbs++] = verb; | |
916 | } | |
917 | ||
df694daa KY |
918 | /* |
919 | * set up from the preset table | |
920 | */ | |
e9c364c0 | 921 | static void setup_preset(struct hda_codec *codec, |
9c7f852e | 922 | const struct alc_config_preset *preset) |
df694daa | 923 | { |
e9c364c0 | 924 | struct alc_spec *spec = codec->spec; |
df694daa KY |
925 | int i; |
926 | ||
927 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
d88897ea | 928 | add_mixer(spec, preset->mixers[i]); |
f9e336f6 | 929 | spec->cap_mixer = preset->cap_mixer; |
9c7f852e TI |
930 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
931 | i++) | |
d88897ea | 932 | add_verb(spec, preset->init_verbs[i]); |
ea1fb29a | 933 | |
df694daa KY |
934 | spec->channel_mode = preset->channel_mode; |
935 | spec->num_channel_mode = preset->num_channel_mode; | |
4e195a7b | 936 | spec->need_dac_fix = preset->need_dac_fix; |
3b315d70 | 937 | spec->const_channel_count = preset->const_channel_count; |
df694daa | 938 | |
3b315d70 HM |
939 | if (preset->const_channel_count) |
940 | spec->multiout.max_channels = preset->const_channel_count; | |
941 | else | |
942 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
943 | spec->ext_channel_count = spec->channel_mode[0].channels; | |
df694daa KY |
944 | |
945 | spec->multiout.num_dacs = preset->num_dacs; | |
946 | spec->multiout.dac_nids = preset->dac_nids; | |
947 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
b25c9da1 | 948 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
df694daa | 949 | spec->multiout.hp_nid = preset->hp_nid; |
ea1fb29a | 950 | |
a1e8d2da | 951 | spec->num_mux_defs = preset->num_mux_defs; |
f12ab1e0 | 952 | if (!spec->num_mux_defs) |
a1e8d2da | 953 | spec->num_mux_defs = 1; |
df694daa KY |
954 | spec->input_mux = preset->input_mux; |
955 | ||
956 | spec->num_adc_nids = preset->num_adc_nids; | |
957 | spec->adc_nids = preset->adc_nids; | |
e1406348 | 958 | spec->capsrc_nids = preset->capsrc_nids; |
df694daa | 959 | spec->dig_in_nid = preset->dig_in_nid; |
ae6b813a TI |
960 | |
961 | spec->unsol_event = preset->unsol_event; | |
962 | spec->init_hook = preset->init_hook; | |
cb53c626 | 963 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
f5de24b0 | 964 | spec->power_hook = preset->power_hook; |
cb53c626 TI |
965 | spec->loopback.amplist = preset->loopbacks; |
966 | #endif | |
e9c364c0 TI |
967 | |
968 | if (preset->setup) | |
969 | preset->setup(codec); | |
f6837bbd TI |
970 | |
971 | alc_fixup_autocfg_pin_nums(codec); | |
df694daa KY |
972 | } |
973 | ||
bc9f98a9 KY |
974 | /* Enable GPIO mask and set output */ |
975 | static struct hda_verb alc_gpio1_init_verbs[] = { | |
976 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
977 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
978 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
979 | { } | |
980 | }; | |
981 | ||
982 | static struct hda_verb alc_gpio2_init_verbs[] = { | |
983 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
984 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
985 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
986 | { } | |
987 | }; | |
988 | ||
bdd148a3 KY |
989 | static struct hda_verb alc_gpio3_init_verbs[] = { |
990 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
991 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
992 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
993 | { } | |
994 | }; | |
995 | ||
2c3bf9ab TI |
996 | /* |
997 | * Fix hardware PLL issue | |
998 | * On some codecs, the analog PLL gating control must be off while | |
999 | * the default value is 1. | |
1000 | */ | |
1001 | static void alc_fix_pll(struct hda_codec *codec) | |
1002 | { | |
1003 | struct alc_spec *spec = codec->spec; | |
1004 | unsigned int val; | |
1005 | ||
1006 | if (!spec->pll_nid) | |
1007 | return; | |
1008 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
1009 | spec->pll_coef_idx); | |
1010 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | |
1011 | AC_VERB_GET_PROC_COEF, 0); | |
1012 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
1013 | spec->pll_coef_idx); | |
1014 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | |
1015 | val & ~(1 << spec->pll_coef_bit)); | |
1016 | } | |
1017 | ||
1018 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
1019 | unsigned int coef_idx, unsigned int coef_bit) | |
1020 | { | |
1021 | struct alc_spec *spec = codec->spec; | |
1022 | spec->pll_nid = nid; | |
1023 | spec->pll_coef_idx = coef_idx; | |
1024 | spec->pll_coef_bit = coef_bit; | |
1025 | alc_fix_pll(codec); | |
1026 | } | |
1027 | ||
9ad0e496 KY |
1028 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
1029 | static void alc_free_jack_priv(struct snd_jack *jack) | |
1030 | { | |
1031 | struct alc_jack *jacks = jack->private_data; | |
1032 | jacks->nid = 0; | |
1033 | jacks->jack = NULL; | |
1034 | } | |
1035 | ||
1036 | static int alc_add_jack(struct hda_codec *codec, | |
1037 | hda_nid_t nid, int type) | |
1038 | { | |
1039 | struct alc_spec *spec; | |
1040 | struct alc_jack *jack; | |
1041 | const char *name; | |
1042 | int err; | |
1043 | ||
1044 | spec = codec->spec; | |
1045 | snd_array_init(&spec->jacks, sizeof(*jack), 32); | |
1046 | jack = snd_array_new(&spec->jacks); | |
1047 | if (!jack) | |
1048 | return -ENOMEM; | |
1049 | ||
1050 | jack->nid = nid; | |
1051 | jack->type = type; | |
1052 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; | |
1053 | ||
1054 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); | |
1055 | if (err < 0) | |
1056 | return err; | |
1057 | jack->jack->private_data = jack; | |
1058 | jack->jack->private_free = alc_free_jack_priv; | |
1059 | return 0; | |
1060 | } | |
1061 | ||
1062 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) | |
1063 | { | |
1064 | struct alc_spec *spec = codec->spec; | |
1065 | struct alc_jack *jacks = spec->jacks.list; | |
1066 | ||
1067 | if (jacks) { | |
1068 | int i; | |
1069 | for (i = 0; i < spec->jacks.used; i++) { | |
1070 | if (jacks->nid == nid) { | |
1071 | unsigned int present; | |
1072 | present = snd_hda_jack_detect(codec, nid); | |
1073 | ||
1074 | present = (present) ? jacks->type : 0; | |
1075 | ||
1076 | snd_jack_report(jacks->jack, present); | |
1077 | } | |
1078 | jacks++; | |
1079 | } | |
1080 | } | |
1081 | } | |
1082 | ||
1083 | static int alc_init_jacks(struct hda_codec *codec) | |
1084 | { | |
1085 | struct alc_spec *spec = codec->spec; | |
1086 | int err; | |
1087 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; | |
1088 | unsigned int mic_nid = spec->ext_mic.pin; | |
1089 | ||
265a0247 TI |
1090 | if (hp_nid) { |
1091 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); | |
1092 | if (err < 0) | |
1093 | return err; | |
1094 | alc_report_jack(codec, hp_nid); | |
1095 | } | |
9ad0e496 | 1096 | |
265a0247 TI |
1097 | if (mic_nid) { |
1098 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); | |
1099 | if (err < 0) | |
1100 | return err; | |
1101 | alc_report_jack(codec, mic_nid); | |
1102 | } | |
9ad0e496 KY |
1103 | |
1104 | return 0; | |
1105 | } | |
1106 | #else | |
1107 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) | |
1108 | { | |
1109 | } | |
1110 | ||
1111 | static inline int alc_init_jacks(struct hda_codec *codec) | |
1112 | { | |
1113 | return 0; | |
1114 | } | |
1115 | #endif | |
1116 | ||
bb35febd | 1117 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
c9b58006 KY |
1118 | { |
1119 | struct alc_spec *spec = codec->spec; | |
bb35febd TI |
1120 | unsigned int mute; |
1121 | hda_nid_t nid; | |
a9fd4f3f | 1122 | int i; |
c9b58006 | 1123 | |
bb35febd TI |
1124 | spec->jack_present = 0; |
1125 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { | |
1126 | nid = spec->autocfg.hp_pins[i]; | |
1127 | if (!nid) | |
1128 | break; | |
1129 | if (snd_hda_jack_detect(codec, nid)) { | |
1130 | spec->jack_present = 1; | |
1131 | break; | |
1132 | } | |
9ad0e496 | 1133 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); |
bb35febd TI |
1134 | } |
1135 | ||
1136 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; | |
1137 | /* Toggle internal speakers muting */ | |
a9fd4f3f TI |
1138 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
1139 | nid = spec->autocfg.speaker_pins[i]; | |
1140 | if (!nid) | |
1141 | break; | |
bb35febd TI |
1142 | if (pinctl) { |
1143 | snd_hda_codec_write(codec, nid, 0, | |
a9fd4f3f TI |
1144 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
1145 | spec->jack_present ? 0 : PIN_OUT); | |
bb35febd TI |
1146 | } else { |
1147 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
1148 | HDA_AMP_MUTE, mute); | |
1149 | } | |
a9fd4f3f | 1150 | } |
c9b58006 KY |
1151 | } |
1152 | ||
bb35febd TI |
1153 | static void alc_automute_pin(struct hda_codec *codec) |
1154 | { | |
1155 | alc_automute_speaker(codec, 1); | |
1156 | } | |
1157 | ||
6c819492 TI |
1158 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
1159 | hda_nid_t nid) | |
1160 | { | |
1161 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
1162 | int i, nums; | |
1163 | ||
1164 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | |
1165 | for (i = 0; i < nums; i++) | |
1166 | if (conn[i] == nid) | |
1167 | return i; | |
1168 | return -1; | |
1169 | } | |
1170 | ||
840b64c0 TI |
1171 | /* switch the current ADC according to the jack state */ |
1172 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) | |
1173 | { | |
1174 | struct alc_spec *spec = codec->spec; | |
1175 | unsigned int present; | |
1176 | hda_nid_t new_adc; | |
1177 | ||
1178 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); | |
1179 | if (present) | |
1180 | spec->cur_adc_idx = 1; | |
1181 | else | |
1182 | spec->cur_adc_idx = 0; | |
1183 | new_adc = spec->adc_nids[spec->cur_adc_idx]; | |
1184 | if (spec->cur_adc && spec->cur_adc != new_adc) { | |
1185 | /* stream is running, let's swap the current ADC */ | |
f0cea797 | 1186 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
840b64c0 TI |
1187 | spec->cur_adc = new_adc; |
1188 | snd_hda_codec_setup_stream(codec, new_adc, | |
1189 | spec->cur_adc_stream_tag, 0, | |
1190 | spec->cur_adc_format); | |
1191 | } | |
1192 | } | |
1193 | ||
7fb0d78f KY |
1194 | static void alc_mic_automute(struct hda_codec *codec) |
1195 | { | |
1196 | struct alc_spec *spec = codec->spec; | |
6c819492 TI |
1197 | struct alc_mic_route *dead, *alive; |
1198 | unsigned int present, type; | |
1199 | hda_nid_t cap_nid; | |
1200 | ||
b59bdf3b TI |
1201 | if (!spec->auto_mic) |
1202 | return; | |
6c819492 TI |
1203 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
1204 | return; | |
1205 | if (snd_BUG_ON(!spec->adc_nids)) | |
1206 | return; | |
1207 | ||
840b64c0 TI |
1208 | if (spec->dual_adc_switch) { |
1209 | alc_dual_mic_adc_auto_switch(codec); | |
1210 | return; | |
1211 | } | |
1212 | ||
6c819492 TI |
1213 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
1214 | ||
864f92be | 1215 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
6c819492 TI |
1216 | if (present) { |
1217 | alive = &spec->ext_mic; | |
1218 | dead = &spec->int_mic; | |
1219 | } else { | |
1220 | alive = &spec->int_mic; | |
1221 | dead = &spec->ext_mic; | |
1222 | } | |
1223 | ||
6c819492 TI |
1224 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
1225 | if (type == AC_WID_AUD_MIX) { | |
1226 | /* Matrix-mixer style (e.g. ALC882) */ | |
1227 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1228 | alive->mux_idx, | |
1229 | HDA_AMP_MUTE, 0); | |
1230 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | |
1231 | dead->mux_idx, | |
1232 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
1233 | } else { | |
1234 | /* MUX style (e.g. ALC880) */ | |
1235 | snd_hda_codec_write_cache(codec, cap_nid, 0, | |
1236 | AC_VERB_SET_CONNECT_SEL, | |
1237 | alive->mux_idx); | |
1238 | } | |
9ad0e496 | 1239 | alc_report_jack(codec, spec->ext_mic.pin); |
6c819492 TI |
1240 | |
1241 | /* FIXME: analog mixer */ | |
7fb0d78f KY |
1242 | } |
1243 | ||
c9b58006 KY |
1244 | /* unsolicited event for HP jack sensing */ |
1245 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |
1246 | { | |
1247 | if (codec->vendor_id == 0x10ec0880) | |
1248 | res >>= 28; | |
1249 | else | |
1250 | res >>= 26; | |
a9fd4f3f TI |
1251 | switch (res) { |
1252 | case ALC880_HP_EVENT: | |
1253 | alc_automute_pin(codec); | |
1254 | break; | |
1255 | case ALC880_MIC_EVENT: | |
7fb0d78f | 1256 | alc_mic_automute(codec); |
a9fd4f3f TI |
1257 | break; |
1258 | } | |
7fb0d78f KY |
1259 | } |
1260 | ||
1261 | static void alc_inithook(struct hda_codec *codec) | |
1262 | { | |
a9fd4f3f | 1263 | alc_automute_pin(codec); |
7fb0d78f | 1264 | alc_mic_automute(codec); |
c9b58006 KY |
1265 | } |
1266 | ||
f9423e7a KY |
1267 | /* additional initialization for ALC888 variants */ |
1268 | static void alc888_coef_init(struct hda_codec *codec) | |
1269 | { | |
1270 | unsigned int tmp; | |
1271 | ||
1272 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | |
1273 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1274 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
37db623a | 1275 | if ((tmp & 0xf0) == 0x20) |
f9423e7a KY |
1276 | /* alc888S-VC */ |
1277 | snd_hda_codec_read(codec, 0x20, 0, | |
1278 | AC_VERB_SET_PROC_COEF, 0x830); | |
1279 | else | |
1280 | /* alc888-VB */ | |
1281 | snd_hda_codec_read(codec, 0x20, 0, | |
1282 | AC_VERB_SET_PROC_COEF, 0x3030); | |
1283 | } | |
1284 | ||
87a8c370 JK |
1285 | static void alc889_coef_init(struct hda_codec *codec) |
1286 | { | |
1287 | unsigned int tmp; | |
1288 | ||
1289 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1290 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
1291 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
1292 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | |
1293 | } | |
1294 | ||
3fb4a508 TI |
1295 | /* turn on/off EAPD control (only if available) */ |
1296 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | |
1297 | { | |
1298 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | |
1299 | return; | |
1300 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | |
1301 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
1302 | on ? 2 : 0); | |
1303 | } | |
1304 | ||
4a79ba34 | 1305 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
bc9f98a9 | 1306 | { |
4a79ba34 | 1307 | unsigned int tmp; |
bc9f98a9 | 1308 | |
4a79ba34 TI |
1309 | switch (type) { |
1310 | case ALC_INIT_GPIO1: | |
bc9f98a9 KY |
1311 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
1312 | break; | |
4a79ba34 | 1313 | case ALC_INIT_GPIO2: |
bc9f98a9 KY |
1314 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
1315 | break; | |
4a79ba34 | 1316 | case ALC_INIT_GPIO3: |
bdd148a3 KY |
1317 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
1318 | break; | |
4a79ba34 | 1319 | case ALC_INIT_DEFAULT: |
bdd148a3 | 1320 | switch (codec->vendor_id) { |
c9b58006 | 1321 | case 0x10ec0260: |
3fb4a508 TI |
1322 | set_eapd(codec, 0x0f, 1); |
1323 | set_eapd(codec, 0x10, 1); | |
c9b58006 KY |
1324 | break; |
1325 | case 0x10ec0262: | |
bdd148a3 KY |
1326 | case 0x10ec0267: |
1327 | case 0x10ec0268: | |
c9b58006 | 1328 | case 0x10ec0269: |
3fb4a508 | 1329 | case 0x10ec0270: |
c6e8f2da | 1330 | case 0x10ec0272: |
f9423e7a KY |
1331 | case 0x10ec0660: |
1332 | case 0x10ec0662: | |
1333 | case 0x10ec0663: | |
c9b58006 | 1334 | case 0x10ec0862: |
20a3a05d | 1335 | case 0x10ec0889: |
3fb4a508 TI |
1336 | set_eapd(codec, 0x14, 1); |
1337 | set_eapd(codec, 0x15, 1); | |
c9b58006 | 1338 | break; |
bdd148a3 | 1339 | } |
c9b58006 KY |
1340 | switch (codec->vendor_id) { |
1341 | case 0x10ec0260: | |
1342 | snd_hda_codec_write(codec, 0x1a, 0, | |
1343 | AC_VERB_SET_COEF_INDEX, 7); | |
1344 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | |
1345 | AC_VERB_GET_PROC_COEF, 0); | |
1346 | snd_hda_codec_write(codec, 0x1a, 0, | |
1347 | AC_VERB_SET_COEF_INDEX, 7); | |
1348 | snd_hda_codec_write(codec, 0x1a, 0, | |
1349 | AC_VERB_SET_PROC_COEF, | |
1350 | tmp | 0x2010); | |
1351 | break; | |
1352 | case 0x10ec0262: | |
1353 | case 0x10ec0880: | |
1354 | case 0x10ec0882: | |
1355 | case 0x10ec0883: | |
1356 | case 0x10ec0885: | |
4a5a4c56 | 1357 | case 0x10ec0887: |
20a3a05d | 1358 | case 0x10ec0889: |
87a8c370 | 1359 | alc889_coef_init(codec); |
c9b58006 | 1360 | break; |
f9423e7a | 1361 | case 0x10ec0888: |
4a79ba34 | 1362 | alc888_coef_init(codec); |
f9423e7a | 1363 | break; |
0aea778e | 1364 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ |
c9b58006 KY |
1365 | case 0x10ec0267: |
1366 | case 0x10ec0268: | |
1367 | snd_hda_codec_write(codec, 0x20, 0, | |
1368 | AC_VERB_SET_COEF_INDEX, 7); | |
1369 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1370 | AC_VERB_GET_PROC_COEF, 0); | |
1371 | snd_hda_codec_write(codec, 0x20, 0, | |
ea1fb29a | 1372 | AC_VERB_SET_COEF_INDEX, 7); |
c9b58006 KY |
1373 | snd_hda_codec_write(codec, 0x20, 0, |
1374 | AC_VERB_SET_PROC_COEF, | |
1375 | tmp | 0x3000); | |
1376 | break; | |
0aea778e | 1377 | #endif /* XXX */ |
bc9f98a9 | 1378 | } |
4a79ba34 TI |
1379 | break; |
1380 | } | |
1381 | } | |
1382 | ||
1383 | static void alc_init_auto_hp(struct hda_codec *codec) | |
1384 | { | |
1385 | struct alc_spec *spec = codec->spec; | |
bb35febd TI |
1386 | struct auto_pin_cfg *cfg = &spec->autocfg; |
1387 | int i; | |
4a79ba34 | 1388 | |
bb35febd TI |
1389 | if (!cfg->hp_pins[0]) { |
1390 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | |
1391 | return; | |
1392 | } | |
4a79ba34 | 1393 | |
bb35febd TI |
1394 | if (!cfg->speaker_pins[0]) { |
1395 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) | |
4a79ba34 | 1396 | return; |
bb35febd TI |
1397 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
1398 | sizeof(cfg->speaker_pins)); | |
1399 | cfg->speaker_outs = cfg->line_outs; | |
1400 | } | |
1401 | ||
1402 | if (!cfg->hp_pins[0]) { | |
1403 | memcpy(cfg->hp_pins, cfg->line_out_pins, | |
1404 | sizeof(cfg->hp_pins)); | |
1405 | cfg->hp_outs = cfg->line_outs; | |
4a79ba34 TI |
1406 | } |
1407 | ||
bb35febd TI |
1408 | for (i = 0; i < cfg->hp_outs; i++) { |
1409 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", | |
1410 | cfg->hp_pins[i]); | |
1411 | snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, | |
4a79ba34 TI |
1412 | AC_VERB_SET_UNSOLICITED_ENABLE, |
1413 | AC_USRSP_EN | ALC880_HP_EVENT); | |
bb35febd | 1414 | } |
4a79ba34 TI |
1415 | spec->unsol_event = alc_sku_unsol_event; |
1416 | } | |
1417 | ||
6c819492 TI |
1418 | static void alc_init_auto_mic(struct hda_codec *codec) |
1419 | { | |
1420 | struct alc_spec *spec = codec->spec; | |
1421 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
1422 | hda_nid_t fixed, ext; | |
1423 | int i; | |
1424 | ||
1425 | /* there must be only two mic inputs exclusively */ | |
66ceeb6b | 1426 | for (i = 0; i < cfg->num_inputs; i++) |
86e2959a | 1427 | if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN) |
6c819492 TI |
1428 | return; |
1429 | ||
1430 | fixed = ext = 0; | |
66ceeb6b TI |
1431 | for (i = 0; i < cfg->num_inputs; i++) { |
1432 | hda_nid_t nid = cfg->inputs[i].pin; | |
6c819492 | 1433 | unsigned int defcfg; |
6c819492 | 1434 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
99ae28be TI |
1435 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
1436 | case INPUT_PIN_ATTR_INT: | |
6c819492 TI |
1437 | if (fixed) |
1438 | return; /* already occupied */ | |
1439 | fixed = nid; | |
1440 | break; | |
99ae28be TI |
1441 | case INPUT_PIN_ATTR_UNUSED: |
1442 | return; /* invalid entry */ | |
1443 | default: | |
6c819492 TI |
1444 | if (ext) |
1445 | return; /* already occupied */ | |
1446 | ext = nid; | |
1447 | break; | |
6c819492 TI |
1448 | } |
1449 | } | |
eaa9b3a7 TI |
1450 | if (!ext || !fixed) |
1451 | return; | |
6c819492 TI |
1452 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
1453 | return; /* no unsol support */ | |
1454 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | |
1455 | ext, fixed); | |
1456 | spec->ext_mic.pin = ext; | |
1457 | spec->int_mic.pin = fixed; | |
1458 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1459 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | |
1460 | spec->auto_mic = 1; | |
1461 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, | |
1462 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1463 | AC_USRSP_EN | ALC880_MIC_EVENT); | |
1464 | spec->unsol_event = alc_sku_unsol_event; | |
1465 | } | |
1466 | ||
da00c244 KY |
1467 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
1468 | { | |
1469 | unsigned int ass, tmp, i; | |
7fb56223 | 1470 | unsigned nid = 0; |
da00c244 KY |
1471 | struct alc_spec *spec = codec->spec; |
1472 | ||
b6cbe517 TI |
1473 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
1474 | ||
da00c244 | 1475 | ass = codec->subsystem_id & 0xffff; |
b6cbe517 | 1476 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
da00c244 KY |
1477 | goto do_sku; |
1478 | ||
1479 | nid = 0x1d; | |
1480 | if (codec->vendor_id == 0x10ec0260) | |
1481 | nid = 0x17; | |
1482 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1483 | ||
1484 | if (!(ass & 1)) { | |
1485 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", | |
1486 | codec->chip_name, ass); | |
1487 | return -1; | |
1488 | } | |
1489 | ||
1490 | /* check sum */ | |
1491 | tmp = 0; | |
1492 | for (i = 1; i < 16; i++) { | |
1493 | if ((ass >> i) & 1) | |
1494 | tmp++; | |
1495 | } | |
1496 | if (((ass >> 16) & 0xf) != tmp) | |
1497 | return -1; | |
1498 | ||
1499 | spec->cdefine.port_connectivity = ass >> 30; | |
1500 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; | |
1501 | spec->cdefine.check_sum = (ass >> 16) & 0xf; | |
1502 | spec->cdefine.customization = ass >> 8; | |
1503 | do_sku: | |
1504 | spec->cdefine.sku_cfg = ass; | |
1505 | spec->cdefine.external_amp = (ass & 0x38) >> 3; | |
1506 | spec->cdefine.platform_type = (ass & 0x4) >> 2; | |
1507 | spec->cdefine.swap = (ass & 0x2) >> 1; | |
1508 | spec->cdefine.override = ass & 0x1; | |
1509 | ||
1510 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", | |
1511 | nid, spec->cdefine.sku_cfg); | |
1512 | snd_printd("SKU: port_connectivity=0x%x\n", | |
1513 | spec->cdefine.port_connectivity); | |
1514 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); | |
1515 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); | |
1516 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); | |
1517 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); | |
1518 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); | |
1519 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); | |
1520 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); | |
1521 | ||
1522 | return 0; | |
1523 | } | |
1524 | ||
4a79ba34 TI |
1525 | /* check subsystem ID and set up device-specific initialization; |
1526 | * return 1 if initialized, 0 if invalid SSID | |
1527 | */ | |
1528 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | |
1529 | * 31 ~ 16 : Manufacture ID | |
1530 | * 15 ~ 8 : SKU ID | |
1531 | * 7 ~ 0 : Assembly ID | |
1532 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
1533 | */ | |
1534 | static int alc_subsystem_id(struct hda_codec *codec, | |
1535 | hda_nid_t porta, hda_nid_t porte, | |
6227cdce | 1536 | hda_nid_t portd, hda_nid_t porti) |
4a79ba34 TI |
1537 | { |
1538 | unsigned int ass, tmp, i; | |
1539 | unsigned nid; | |
1540 | struct alc_spec *spec = codec->spec; | |
1541 | ||
1542 | ass = codec->subsystem_id & 0xffff; | |
1543 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
1544 | goto do_sku; | |
1545 | ||
1546 | /* invalid SSID, check the special NID pin defcfg instead */ | |
1547 | /* | |
def319f9 | 1548 | * 31~30 : port connectivity |
4a79ba34 TI |
1549 | * 29~21 : reserve |
1550 | * 20 : PCBEEP input | |
1551 | * 19~16 : Check sum (15:1) | |
1552 | * 15~1 : Custom | |
1553 | * 0 : override | |
1554 | */ | |
1555 | nid = 0x1d; | |
1556 | if (codec->vendor_id == 0x10ec0260) | |
1557 | nid = 0x17; | |
1558 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1559 | snd_printd("realtek: No valid SSID, " | |
1560 | "checking pincfg 0x%08x for NID 0x%x\n", | |
cb6605c1 | 1561 | ass, nid); |
6227cdce | 1562 | if (!(ass & 1)) |
4a79ba34 TI |
1563 | return 0; |
1564 | if ((ass >> 30) != 1) /* no physical connection */ | |
1565 | return 0; | |
1566 | ||
1567 | /* check sum */ | |
1568 | tmp = 0; | |
1569 | for (i = 1; i < 16; i++) { | |
1570 | if ((ass >> i) & 1) | |
1571 | tmp++; | |
1572 | } | |
1573 | if (((ass >> 16) & 0xf) != tmp) | |
1574 | return 0; | |
1575 | do_sku: | |
1576 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", | |
1577 | ass & 0xffff, codec->vendor_id); | |
1578 | /* | |
1579 | * 0 : override | |
1580 | * 1 : Swap Jack | |
1581 | * 2 : 0 --> Desktop, 1 --> Laptop | |
1582 | * 3~5 : External Amplifier control | |
1583 | * 7~6 : Reserved | |
1584 | */ | |
1585 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | |
1586 | switch (tmp) { | |
1587 | case 1: | |
1588 | spec->init_amp = ALC_INIT_GPIO1; | |
1589 | break; | |
1590 | case 3: | |
1591 | spec->init_amp = ALC_INIT_GPIO2; | |
1592 | break; | |
1593 | case 7: | |
1594 | spec->init_amp = ALC_INIT_GPIO3; | |
1595 | break; | |
1596 | case 5: | |
1597 | spec->init_amp = ALC_INIT_DEFAULT; | |
bc9f98a9 KY |
1598 | break; |
1599 | } | |
ea1fb29a | 1600 | |
8c427226 | 1601 | /* is laptop or Desktop and enable the function "Mute internal speaker |
c9b58006 KY |
1602 | * when the external headphone out jack is plugged" |
1603 | */ | |
8c427226 | 1604 | if (!(ass & 0x8000)) |
4a79ba34 | 1605 | return 1; |
c9b58006 KY |
1606 | /* |
1607 | * 10~8 : Jack location | |
1608 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
1609 | * 14~13: Resvered | |
1610 | * 15 : 1 --> enable the function "Mute internal speaker | |
1611 | * when the external headphone out jack is plugged" | |
1612 | */ | |
c9b58006 | 1613 | if (!spec->autocfg.hp_pins[0]) { |
01d4825d | 1614 | hda_nid_t nid; |
c9b58006 KY |
1615 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
1616 | if (tmp == 0) | |
01d4825d | 1617 | nid = porta; |
c9b58006 | 1618 | else if (tmp == 1) |
01d4825d | 1619 | nid = porte; |
c9b58006 | 1620 | else if (tmp == 2) |
01d4825d | 1621 | nid = portd; |
6227cdce KY |
1622 | else if (tmp == 3) |
1623 | nid = porti; | |
c9b58006 | 1624 | else |
4a79ba34 | 1625 | return 1; |
01d4825d TI |
1626 | for (i = 0; i < spec->autocfg.line_outs; i++) |
1627 | if (spec->autocfg.line_out_pins[i] == nid) | |
1628 | return 1; | |
1629 | spec->autocfg.hp_pins[0] = nid; | |
c9b58006 KY |
1630 | } |
1631 | ||
4a79ba34 | 1632 | alc_init_auto_hp(codec); |
6c819492 | 1633 | alc_init_auto_mic(codec); |
4a79ba34 TI |
1634 | return 1; |
1635 | } | |
ea1fb29a | 1636 | |
4a79ba34 | 1637 | static void alc_ssid_check(struct hda_codec *codec, |
6227cdce KY |
1638 | hda_nid_t porta, hda_nid_t porte, |
1639 | hda_nid_t portd, hda_nid_t porti) | |
4a79ba34 | 1640 | { |
6227cdce | 1641 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
4a79ba34 TI |
1642 | struct alc_spec *spec = codec->spec; |
1643 | snd_printd("realtek: " | |
1644 | "Enable default setup for auto mode as fallback\n"); | |
1645 | spec->init_amp = ALC_INIT_DEFAULT; | |
1646 | alc_init_auto_hp(codec); | |
6c819492 | 1647 | alc_init_auto_mic(codec); |
4a79ba34 | 1648 | } |
bc9f98a9 KY |
1649 | } |
1650 | ||
f95474ec | 1651 | /* |
f8f25ba3 | 1652 | * Fix-up pin default configurations and add default verbs |
f95474ec TI |
1653 | */ |
1654 | ||
1655 | struct alc_pincfg { | |
1656 | hda_nid_t nid; | |
1657 | u32 val; | |
1658 | }; | |
1659 | ||
f8f25ba3 TI |
1660 | struct alc_fixup { |
1661 | const struct alc_pincfg *pins; | |
1662 | const struct hda_verb *verbs; | |
1663 | }; | |
1664 | ||
1665 | static void alc_pick_fixup(struct hda_codec *codec, | |
f95474ec | 1666 | const struct snd_pci_quirk *quirk, |
7fa90e87 TI |
1667 | const struct alc_fixup *fix, |
1668 | int pre_init) | |
f95474ec TI |
1669 | { |
1670 | const struct alc_pincfg *cfg; | |
1671 | ||
1672 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
1673 | if (!quirk) | |
1674 | return; | |
f8f25ba3 TI |
1675 | fix += quirk->value; |
1676 | cfg = fix->pins; | |
7fa90e87 TI |
1677 | if (pre_init && cfg) { |
1678 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1679 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", | |
1680 | codec->chip_name, quirk->name); | |
1681 | #endif | |
f8f25ba3 TI |
1682 | for (; cfg->nid; cfg++) |
1683 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | |
1684 | } | |
7fa90e87 TI |
1685 | if (!pre_init && fix->verbs) { |
1686 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1687 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", | |
1688 | codec->chip_name, quirk->name); | |
1689 | #endif | |
f8f25ba3 | 1690 | add_verb(codec->spec, fix->verbs); |
7fa90e87 | 1691 | } |
f95474ec TI |
1692 | } |
1693 | ||
274693f3 KY |
1694 | static int alc_read_coef_idx(struct hda_codec *codec, |
1695 | unsigned int coef_idx) | |
1696 | { | |
1697 | unsigned int val; | |
1698 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1699 | coef_idx); | |
1700 | val = snd_hda_codec_read(codec, 0x20, 0, | |
1701 | AC_VERB_GET_PROC_COEF, 0); | |
1702 | return val; | |
1703 | } | |
1704 | ||
977ddd6b KY |
1705 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
1706 | unsigned int coef_val) | |
1707 | { | |
1708 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1709 | coef_idx); | |
1710 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, | |
1711 | coef_val); | |
1712 | } | |
1713 | ||
757899ac TI |
1714 | /* set right pin controls for digital I/O */ |
1715 | static void alc_auto_init_digital(struct hda_codec *codec) | |
1716 | { | |
1717 | struct alc_spec *spec = codec->spec; | |
1718 | int i; | |
1719 | hda_nid_t pin; | |
1720 | ||
1721 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1722 | pin = spec->autocfg.dig_out_pins[i]; | |
1723 | if (pin) { | |
1724 | snd_hda_codec_write(codec, pin, 0, | |
1725 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1726 | PIN_OUT); | |
1727 | } | |
1728 | } | |
1729 | pin = spec->autocfg.dig_in_pin; | |
1730 | if (pin) | |
1731 | snd_hda_codec_write(codec, pin, 0, | |
1732 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1733 | PIN_IN); | |
1734 | } | |
1735 | ||
1736 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ | |
1737 | static void alc_auto_parse_digital(struct hda_codec *codec) | |
1738 | { | |
1739 | struct alc_spec *spec = codec->spec; | |
1740 | int i, err; | |
1741 | hda_nid_t dig_nid; | |
1742 | ||
1743 | /* support multiple SPDIFs; the secondary is set up as a slave */ | |
1744 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1745 | err = snd_hda_get_connections(codec, | |
1746 | spec->autocfg.dig_out_pins[i], | |
1747 | &dig_nid, 1); | |
1748 | if (err < 0) | |
1749 | continue; | |
1750 | if (!i) { | |
1751 | spec->multiout.dig_out_nid = dig_nid; | |
1752 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | |
1753 | } else { | |
1754 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | |
1755 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | |
1756 | break; | |
1757 | spec->slave_dig_outs[i - 1] = dig_nid; | |
1758 | } | |
1759 | } | |
1760 | ||
1761 | if (spec->autocfg.dig_in_pin) { | |
1762 | hda_nid_t dig_nid; | |
1763 | err = snd_hda_get_connections(codec, | |
1764 | spec->autocfg.dig_in_pin, | |
1765 | &dig_nid, 1); | |
1766 | if (err > 0) | |
1767 | spec->dig_in_nid = dig_nid; | |
1768 | } | |
1769 | } | |
1770 | ||
ef8ef5fb VP |
1771 | /* |
1772 | * ALC888 | |
1773 | */ | |
1774 | ||
1775 | /* | |
1776 | * 2ch mode | |
1777 | */ | |
1778 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { | |
1779 | /* Mic-in jack as mic in */ | |
1780 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1781 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1782 | /* Line-in jack as Line in */ | |
1783 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1784 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1785 | /* Line-Out as Front */ | |
1786 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1787 | { } /* end */ | |
1788 | }; | |
1789 | ||
1790 | /* | |
1791 | * 4ch mode | |
1792 | */ | |
1793 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { | |
1794 | /* Mic-in jack as mic in */ | |
1795 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1796 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1797 | /* Line-in jack as Surround */ | |
1798 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1799 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1800 | /* Line-Out as Front */ | |
1801 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1802 | { } /* end */ | |
1803 | }; | |
1804 | ||
1805 | /* | |
1806 | * 6ch mode | |
1807 | */ | |
1808 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { | |
1809 | /* Mic-in jack as CLFE */ | |
1810 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1811 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1812 | /* Line-in jack as Surround */ | |
1813 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1814 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1815 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ | |
1816 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1817 | { } /* end */ | |
1818 | }; | |
1819 | ||
1820 | /* | |
1821 | * 8ch mode | |
1822 | */ | |
1823 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { | |
1824 | /* Mic-in jack as CLFE */ | |
1825 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1826 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1827 | /* Line-in jack as Surround */ | |
1828 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1829 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1830 | /* Line-Out as Side */ | |
1831 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1832 | { } /* end */ | |
1833 | }; | |
1834 | ||
1835 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { | |
1836 | { 2, alc888_4ST_ch2_intel_init }, | |
1837 | { 4, alc888_4ST_ch4_intel_init }, | |
1838 | { 6, alc888_4ST_ch6_intel_init }, | |
1839 | { 8, alc888_4ST_ch8_intel_init }, | |
1840 | }; | |
1841 | ||
1842 | /* | |
1843 | * ALC888 Fujitsu Siemens Amillo xa3530 | |
1844 | */ | |
1845 | ||
1846 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | |
1847 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1848 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1849 | /* Connect Internal HP to Front */ | |
1850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1851 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1852 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1853 | /* Connect Bass HP to Front */ | |
1854 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1855 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1856 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1857 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
1858 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1859 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1860 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1861 | /* Connect Mic jack to CLFE */ | |
1862 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1863 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1864 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1865 | /* Connect Line-in jack to Surround */ | |
1866 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1867 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1868 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1869 | /* Connect HP out jack to Front */ | |
1870 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1871 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1872 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1873 | /* Enable unsolicited event for HP jack and Line-out jack */ | |
1874 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1875 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1876 | {} | |
1877 | }; | |
1878 | ||
a9fd4f3f | 1879 | static void alc_automute_amp(struct hda_codec *codec) |
ef8ef5fb | 1880 | { |
bb35febd | 1881 | alc_automute_speaker(codec, 0); |
ef8ef5fb VP |
1882 | } |
1883 | ||
a9fd4f3f TI |
1884 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
1885 | unsigned int res) | |
ef8ef5fb | 1886 | { |
a9fd4f3f TI |
1887 | if (codec->vendor_id == 0x10ec0880) |
1888 | res >>= 28; | |
1889 | else | |
1890 | res >>= 26; | |
1891 | if (res == ALC880_HP_EVENT) | |
1892 | alc_automute_amp(codec); | |
ef8ef5fb VP |
1893 | } |
1894 | ||
4f5d1706 | 1895 | static void alc889_automute_setup(struct hda_codec *codec) |
6732bd0d WF |
1896 | { |
1897 | struct alc_spec *spec = codec->spec; | |
1898 | ||
1899 | spec->autocfg.hp_pins[0] = 0x15; | |
1900 | spec->autocfg.speaker_pins[0] = 0x14; | |
1901 | spec->autocfg.speaker_pins[1] = 0x16; | |
1902 | spec->autocfg.speaker_pins[2] = 0x17; | |
1903 | spec->autocfg.speaker_pins[3] = 0x19; | |
1904 | spec->autocfg.speaker_pins[4] = 0x1a; | |
6732bd0d WF |
1905 | } |
1906 | ||
1907 | static void alc889_intel_init_hook(struct hda_codec *codec) | |
1908 | { | |
1909 | alc889_coef_init(codec); | |
4f5d1706 | 1910 | alc_automute_amp(codec); |
6732bd0d WF |
1911 | } |
1912 | ||
4f5d1706 | 1913 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
a9fd4f3f TI |
1914 | { |
1915 | struct alc_spec *spec = codec->spec; | |
1916 | ||
1917 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ | |
1918 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | |
1919 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | |
1920 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | |
a9fd4f3f | 1921 | } |
ef8ef5fb | 1922 | |
5b2d1eca VP |
1923 | /* |
1924 | * ALC888 Acer Aspire 4930G model | |
1925 | */ | |
1926 | ||
1927 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | |
1928 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1929 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1930 | /* Unselect Front Mic by default in input mixer 3 */ | |
1931 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
ef8ef5fb | 1932 | /* Enable unsolicited event for HP jack */ |
5b2d1eca VP |
1933 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
1934 | /* Connect Internal HP to front */ | |
1935 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1936 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1937 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1938 | /* Connect HP out to front */ | |
1939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1941 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1942 | { } | |
1943 | }; | |
1944 | ||
d2fd4b09 TV |
1945 | /* |
1946 | * ALC888 Acer Aspire 6530G model | |
1947 | */ | |
1948 | ||
1949 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | |
d1284182 TV |
1950 | /* Route to built-in subwoofer as well as speakers */ |
1951 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1952 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
1953 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1954 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
d2fd4b09 TV |
1955 | /* Bias voltage on for external mic port */ |
1956 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | |
320d5920 EL |
1957 | /* Front Mic: set to PIN_IN (empty by default) */ |
1958 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1959 | /* Unselect Front Mic by default in input mixer 3 */ | |
1960 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
d2fd4b09 TV |
1961 | /* Enable unsolicited event for HP jack */ |
1962 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1963 | /* Enable speaker output */ | |
1964 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1965 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
d1284182 | 1966 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
d2fd4b09 TV |
1967 | /* Enable headphone output */ |
1968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
1969 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1970 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1284182 | 1971 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
d2fd4b09 TV |
1972 | { } |
1973 | }; | |
1974 | ||
3b315d70 | 1975 | /* |
018df418 | 1976 | * ALC889 Acer Aspire 8930G model |
3b315d70 HM |
1977 | */ |
1978 | ||
018df418 | 1979 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
3b315d70 HM |
1980 | /* Front Mic: set to PIN_IN (empty by default) */ |
1981 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1982 | /* Unselect Front Mic by default in input mixer 3 */ | |
1983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
1984 | /* Enable unsolicited event for HP jack */ | |
1985 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1986 | /* Connect Internal Front to Front */ | |
1987 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1988 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1989 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1990 | /* Connect Internal Rear to Rear */ | |
1991 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1992 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1993 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1994 | /* Connect Internal CLFE to CLFE */ | |
1995 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1996 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1997 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1998 | /* Connect HP out to Front */ | |
018df418 | 1999 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
3b315d70 HM |
2000 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2001 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2002 | /* Enable all DACs */ | |
2003 | /* DAC DISABLE/MUTE 1? */ | |
2004 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ | |
2005 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, | |
2006 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
2007 | /* DAC DISABLE/MUTE 2? */ | |
2008 | /* some bit here disables the other DACs. Init=0x4900 */ | |
2009 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | |
2010 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
018df418 HM |
2011 | /* DMIC fix |
2012 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | |
2013 | * which makes the stereo useless. However, either the mic or the ALC889 | |
2014 | * makes the signal become a difference/sum signal instead of standard | |
2015 | * stereo, which is annoying. So instead we flip this bit which makes the | |
2016 | * codec replicate the sum signal to both channels, turning it into a | |
2017 | * normal mono mic. | |
2018 | */ | |
2019 | /* DMIC_CONTROL? Init value = 0x0001 */ | |
2020 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
2021 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, | |
3b315d70 HM |
2022 | { } |
2023 | }; | |
2024 | ||
ef8ef5fb | 2025 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
5b2d1eca VP |
2026 | /* Front mic only available on one ADC */ |
2027 | { | |
2028 | .num_items = 4, | |
2029 | .items = { | |
2030 | { "Mic", 0x0 }, | |
2031 | { "Line", 0x2 }, | |
2032 | { "CD", 0x4 }, | |
2033 | { "Front Mic", 0xb }, | |
2034 | }, | |
2035 | }, | |
2036 | { | |
2037 | .num_items = 3, | |
2038 | .items = { | |
2039 | { "Mic", 0x0 }, | |
2040 | { "Line", 0x2 }, | |
2041 | { "CD", 0x4 }, | |
2042 | }, | |
2043 | } | |
2044 | }; | |
2045 | ||
d2fd4b09 TV |
2046 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
2047 | /* Interal mic only available on one ADC */ | |
2048 | { | |
684a8842 | 2049 | .num_items = 5, |
d2fd4b09 TV |
2050 | .items = { |
2051 | { "Ext Mic", 0x0 }, | |
684a8842 | 2052 | { "Line In", 0x2 }, |
d2fd4b09 | 2053 | { "CD", 0x4 }, |
684a8842 | 2054 | { "Input Mix", 0xa }, |
d2fd4b09 TV |
2055 | { "Int Mic", 0xb }, |
2056 | }, | |
2057 | }, | |
2058 | { | |
684a8842 | 2059 | .num_items = 4, |
d2fd4b09 TV |
2060 | .items = { |
2061 | { "Ext Mic", 0x0 }, | |
684a8842 | 2062 | { "Line In", 0x2 }, |
d2fd4b09 | 2063 | { "CD", 0x4 }, |
684a8842 | 2064 | { "Input Mix", 0xa }, |
d2fd4b09 TV |
2065 | }, |
2066 | } | |
2067 | }; | |
2068 | ||
018df418 HM |
2069 | static struct hda_input_mux alc889_capture_sources[3] = { |
2070 | /* Digital mic only available on first "ADC" */ | |
2071 | { | |
2072 | .num_items = 5, | |
2073 | .items = { | |
2074 | { "Mic", 0x0 }, | |
2075 | { "Line", 0x2 }, | |
2076 | { "CD", 0x4 }, | |
2077 | { "Front Mic", 0xb }, | |
2078 | { "Input Mix", 0xa }, | |
2079 | }, | |
2080 | }, | |
2081 | { | |
2082 | .num_items = 4, | |
2083 | .items = { | |
2084 | { "Mic", 0x0 }, | |
2085 | { "Line", 0x2 }, | |
2086 | { "CD", 0x4 }, | |
2087 | { "Input Mix", 0xa }, | |
2088 | }, | |
2089 | }, | |
2090 | { | |
2091 | .num_items = 4, | |
2092 | .items = { | |
2093 | { "Mic", 0x0 }, | |
2094 | { "Line", 0x2 }, | |
2095 | { "CD", 0x4 }, | |
2096 | { "Input Mix", 0xa }, | |
2097 | }, | |
2098 | } | |
2099 | }; | |
2100 | ||
ef8ef5fb | 2101 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
5b2d1eca VP |
2102 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2103 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2104 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2105 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2106 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
2107 | HDA_OUTPUT), | |
2108 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2109 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2110 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2111 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2112 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2113 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2114 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2115 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2116 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2117 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2118 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
2119 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5b2d1eca VP |
2120 | { } /* end */ |
2121 | }; | |
2122 | ||
556eea9a HM |
2123 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
2124 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2125 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2126 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2127 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2128 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
2129 | HDA_OUTPUT), | |
2130 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2131 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2132 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2133 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2134 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2136 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
2137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2138 | { } /* end */ | |
2139 | }; | |
2140 | ||
2141 | ||
4f5d1706 | 2142 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
5b2d1eca | 2143 | { |
a9fd4f3f | 2144 | struct alc_spec *spec = codec->spec; |
5b2d1eca | 2145 | |
a9fd4f3f TI |
2146 | spec->autocfg.hp_pins[0] = 0x15; |
2147 | spec->autocfg.speaker_pins[0] = 0x14; | |
7cef4cf1 ŁW |
2148 | spec->autocfg.speaker_pins[1] = 0x16; |
2149 | spec->autocfg.speaker_pins[2] = 0x17; | |
5b2d1eca VP |
2150 | } |
2151 | ||
4f5d1706 | 2152 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
320d5920 EL |
2153 | { |
2154 | struct alc_spec *spec = codec->spec; | |
2155 | ||
2156 | spec->autocfg.hp_pins[0] = 0x15; | |
2157 | spec->autocfg.speaker_pins[0] = 0x14; | |
2158 | spec->autocfg.speaker_pins[1] = 0x16; | |
2159 | spec->autocfg.speaker_pins[2] = 0x17; | |
320d5920 EL |
2160 | } |
2161 | ||
4f5d1706 | 2162 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
3b315d70 HM |
2163 | { |
2164 | struct alc_spec *spec = codec->spec; | |
2165 | ||
2166 | spec->autocfg.hp_pins[0] = 0x15; | |
2167 | spec->autocfg.speaker_pins[0] = 0x14; | |
2168 | spec->autocfg.speaker_pins[1] = 0x16; | |
2169 | spec->autocfg.speaker_pins[2] = 0x1b; | |
3b315d70 HM |
2170 | } |
2171 | ||
1da177e4 | 2172 | /* |
e9edcee0 TI |
2173 | * ALC880 3-stack model |
2174 | * | |
2175 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
9c7f852e TI |
2176 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
2177 | * F-Mic = 0x1b, HP = 0x19 | |
1da177e4 LT |
2178 | */ |
2179 | ||
e9edcee0 TI |
2180 | static hda_nid_t alc880_dac_nids[4] = { |
2181 | /* front, rear, clfe, rear_surr */ | |
2182 | 0x02, 0x05, 0x04, 0x03 | |
2183 | }; | |
2184 | ||
2185 | static hda_nid_t alc880_adc_nids[3] = { | |
2186 | /* ADC0-2 */ | |
2187 | 0x07, 0x08, 0x09, | |
2188 | }; | |
2189 | ||
2190 | /* The datasheet says the node 0x07 is connected from inputs, | |
2191 | * but it shows zero connection in the real implementation on some devices. | |
df694daa | 2192 | * Note: this is a 915GAV bug, fixed on 915GLV |
1da177e4 | 2193 | */ |
e9edcee0 TI |
2194 | static hda_nid_t alc880_adc_nids_alt[2] = { |
2195 | /* ADC1-2 */ | |
2196 | 0x08, 0x09, | |
2197 | }; | |
2198 | ||
2199 | #define ALC880_DIGOUT_NID 0x06 | |
2200 | #define ALC880_DIGIN_NID 0x0a | |
2201 | ||
2202 | static struct hda_input_mux alc880_capture_source = { | |
2203 | .num_items = 4, | |
2204 | .items = { | |
2205 | { "Mic", 0x0 }, | |
2206 | { "Front Mic", 0x3 }, | |
2207 | { "Line", 0x2 }, | |
2208 | { "CD", 0x4 }, | |
2209 | }, | |
2210 | }; | |
2211 | ||
2212 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
2213 | /* 2ch mode */ | |
2214 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
2215 | /* set line-in to input, mute it */ | |
2216 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2217 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2218 | /* set mic-in to input vref 80%, mute it */ | |
2219 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2220 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2221 | { } /* end */ | |
2222 | }; | |
2223 | ||
2224 | /* 6ch mode */ | |
2225 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
2226 | /* set line-in to output, unmute it */ | |
2227 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2228 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2229 | /* set mic-in to output, unmute it */ | |
2230 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2231 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2232 | { } /* end */ | |
2233 | }; | |
2234 | ||
d2a6d7dc | 2235 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
e9edcee0 TI |
2236 | { 2, alc880_threestack_ch2_init }, |
2237 | { 6, alc880_threestack_ch6_init }, | |
2238 | }; | |
2239 | ||
c8b6bf9b | 2240 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
05acb863 | 2241 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2242 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 2243 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 2244 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
05acb863 TI |
2245 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2246 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2247 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2248 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1da177e4 LT |
2249 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2250 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2251 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2252 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2254 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2255 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
2256 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
e9edcee0 TI |
2257 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
2258 | { | |
2259 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2260 | .name = "Channel Mode", | |
df694daa KY |
2261 | .info = alc_ch_mode_info, |
2262 | .get = alc_ch_mode_get, | |
2263 | .put = alc_ch_mode_put, | |
e9edcee0 TI |
2264 | }, |
2265 | { } /* end */ | |
2266 | }; | |
2267 | ||
2268 | /* capture mixer elements */ | |
f9e336f6 TI |
2269 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
2270 | struct snd_ctl_elem_info *uinfo) | |
2271 | { | |
2272 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2273 | struct alc_spec *spec = codec->spec; | |
2274 | int err; | |
1da177e4 | 2275 | |
5a9e02e9 | 2276 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2277 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
2278 | HDA_INPUT); | |
2279 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | |
5a9e02e9 | 2280 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2281 | return err; |
2282 | } | |
2283 | ||
2284 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |
2285 | unsigned int size, unsigned int __user *tlv) | |
2286 | { | |
2287 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2288 | struct alc_spec *spec = codec->spec; | |
2289 | int err; | |
1da177e4 | 2290 | |
5a9e02e9 | 2291 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2292 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
2293 | HDA_INPUT); | |
2294 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | |
5a9e02e9 | 2295 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2296 | return err; |
2297 | } | |
2298 | ||
2299 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, | |
2300 | struct snd_ctl_elem_value *ucontrol); | |
2301 | ||
2302 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | |
2303 | struct snd_ctl_elem_value *ucontrol, | |
2304 | getput_call_t func) | |
2305 | { | |
2306 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2307 | struct alc_spec *spec = codec->spec; | |
2308 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
2309 | int err; | |
2310 | ||
5a9e02e9 | 2311 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2312 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
2313 | 3, 0, HDA_INPUT); | |
2314 | err = func(kcontrol, ucontrol); | |
5a9e02e9 | 2315 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2316 | return err; |
2317 | } | |
2318 | ||
2319 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, | |
2320 | struct snd_ctl_elem_value *ucontrol) | |
2321 | { | |
2322 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2323 | snd_hda_mixer_amp_volume_get); | |
2324 | } | |
2325 | ||
2326 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, | |
2327 | struct snd_ctl_elem_value *ucontrol) | |
2328 | { | |
2329 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2330 | snd_hda_mixer_amp_volume_put); | |
2331 | } | |
2332 | ||
2333 | /* capture mixer elements */ | |
2334 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info | |
2335 | ||
2336 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, | |
2337 | struct snd_ctl_elem_value *ucontrol) | |
2338 | { | |
2339 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2340 | snd_hda_mixer_amp_switch_get); | |
2341 | } | |
2342 | ||
2343 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |
2344 | struct snd_ctl_elem_value *ucontrol) | |
2345 | { | |
2346 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2347 | snd_hda_mixer_amp_switch_put); | |
2348 | } | |
2349 | ||
a23b688f | 2350 | #define _DEFINE_CAPMIX(num) \ |
f9e336f6 TI |
2351 | { \ |
2352 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2353 | .name = "Capture Switch", \ | |
2354 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | |
2355 | .count = num, \ | |
2356 | .info = alc_cap_sw_info, \ | |
2357 | .get = alc_cap_sw_get, \ | |
2358 | .put = alc_cap_sw_put, \ | |
2359 | }, \ | |
2360 | { \ | |
2361 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2362 | .name = "Capture Volume", \ | |
2363 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | |
2364 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | |
2365 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ | |
2366 | .count = num, \ | |
2367 | .info = alc_cap_vol_info, \ | |
2368 | .get = alc_cap_vol_get, \ | |
2369 | .put = alc_cap_vol_put, \ | |
2370 | .tlv = { .c = alc_cap_vol_tlv }, \ | |
a23b688f TI |
2371 | } |
2372 | ||
2373 | #define _DEFINE_CAPSRC(num) \ | |
3c3e9892 TI |
2374 | { \ |
2375 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2376 | /* .name = "Capture Source", */ \ | |
2377 | .name = "Input Source", \ | |
2378 | .count = num, \ | |
2379 | .info = alc_mux_enum_info, \ | |
2380 | .get = alc_mux_enum_get, \ | |
2381 | .put = alc_mux_enum_put, \ | |
a23b688f TI |
2382 | } |
2383 | ||
2384 | #define DEFINE_CAPMIX(num) \ | |
2385 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |
2386 | _DEFINE_CAPMIX(num), \ | |
2387 | _DEFINE_CAPSRC(num), \ | |
2388 | { } /* end */ \ | |
2389 | } | |
2390 | ||
2391 | #define DEFINE_CAPMIX_NOSRC(num) \ | |
2392 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | |
2393 | _DEFINE_CAPMIX(num), \ | |
2394 | { } /* end */ \ | |
f9e336f6 TI |
2395 | } |
2396 | ||
2397 | /* up to three ADCs */ | |
2398 | DEFINE_CAPMIX(1); | |
2399 | DEFINE_CAPMIX(2); | |
2400 | DEFINE_CAPMIX(3); | |
a23b688f TI |
2401 | DEFINE_CAPMIX_NOSRC(1); |
2402 | DEFINE_CAPMIX_NOSRC(2); | |
2403 | DEFINE_CAPMIX_NOSRC(3); | |
e9edcee0 TI |
2404 | |
2405 | /* | |
2406 | * ALC880 5-stack model | |
2407 | * | |
9c7f852e TI |
2408 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
2409 | * Side = 0x02 (0xd) | |
e9edcee0 TI |
2410 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
2411 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
2412 | */ | |
2413 | ||
2414 | /* additional mixers to alc880_three_stack_mixer */ | |
c8b6bf9b | 2415 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
e9edcee0 | 2416 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2417 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
1da177e4 LT |
2418 | { } /* end */ |
2419 | }; | |
2420 | ||
e9edcee0 TI |
2421 | /* channel source setting (6/8 channel selection for 5-stack) */ |
2422 | /* 6ch mode */ | |
2423 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
2424 | /* set line-in to input, mute it */ | |
2425 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2426 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
dfc0ff62 TI |
2427 | { } /* end */ |
2428 | }; | |
2429 | ||
e9edcee0 TI |
2430 | /* 8ch mode */ |
2431 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
2432 | /* set line-in to output, unmute it */ | |
2433 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2434 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2435 | { } /* end */ | |
2436 | }; | |
2437 | ||
d2a6d7dc | 2438 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
e9edcee0 TI |
2439 | { 6, alc880_fivestack_ch6_init }, |
2440 | { 8, alc880_fivestack_ch8_init }, | |
2441 | }; | |
2442 | ||
2443 | ||
2444 | /* | |
2445 | * ALC880 6-stack model | |
2446 | * | |
9c7f852e TI |
2447 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
2448 | * Side = 0x05 (0x0f) | |
e9edcee0 TI |
2449 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
2450 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
2451 | */ | |
2452 | ||
2453 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
2454 | /* front, rear, clfe, rear_surr */ | |
2455 | 0x02, 0x03, 0x04, 0x05 | |
f12ab1e0 | 2456 | }; |
e9edcee0 TI |
2457 | |
2458 | static struct hda_input_mux alc880_6stack_capture_source = { | |
2459 | .num_items = 4, | |
2460 | .items = { | |
2461 | { "Mic", 0x0 }, | |
2462 | { "Front Mic", 0x1 }, | |
2463 | { "Line", 0x2 }, | |
2464 | { "CD", 0x4 }, | |
2465 | }, | |
2466 | }; | |
2467 | ||
2468 | /* fixed 8-channels */ | |
d2a6d7dc | 2469 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
e9edcee0 TI |
2470 | { 8, NULL }, |
2471 | }; | |
2472 | ||
c8b6bf9b | 2473 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
16ded525 | 2474 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2475 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2476 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2477 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2478 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2479 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2480 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2481 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 | 2482 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 2483 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
16ded525 TI |
2484 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2485 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2486 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2487 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2488 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2489 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2490 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2491 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16ded525 TI |
2492 | { |
2493 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2494 | .name = "Channel Mode", | |
df694daa KY |
2495 | .info = alc_ch_mode_info, |
2496 | .get = alc_ch_mode_get, | |
2497 | .put = alc_ch_mode_put, | |
16ded525 TI |
2498 | }, |
2499 | { } /* end */ | |
2500 | }; | |
2501 | ||
e9edcee0 TI |
2502 | |
2503 | /* | |
2504 | * ALC880 W810 model | |
2505 | * | |
2506 | * W810 has rear IO for: | |
2507 | * Front (DAC 02) | |
2508 | * Surround (DAC 03) | |
2509 | * Center/LFE (DAC 04) | |
2510 | * Digital out (06) | |
2511 | * | |
2512 | * The system also has a pair of internal speakers, and a headphone jack. | |
2513 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
ea1fb29a | 2514 | * |
e9edcee0 TI |
2515 | * There is a variable resistor to control the speaker or headphone |
2516 | * volume. This is a hardware-only device without a software API. | |
2517 | * | |
2518 | * Plugging headphones in will disable the internal speakers. This is | |
2519 | * implemented in hardware, not via the driver using jack sense. In | |
2520 | * a similar fashion, plugging into the rear socket marked "front" will | |
2521 | * disable both the speakers and headphones. | |
2522 | * | |
2523 | * For input, there's a microphone jack, and an "audio in" jack. | |
2524 | * These may not do anything useful with this driver yet, because I | |
2525 | * haven't setup any initialization verbs for these yet... | |
2526 | */ | |
2527 | ||
2528 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
2529 | /* front, rear/surround, clfe */ | |
2530 | 0x02, 0x03, 0x04 | |
16ded525 TI |
2531 | }; |
2532 | ||
e9edcee0 | 2533 | /* fixed 6 channels */ |
d2a6d7dc | 2534 | static struct hda_channel_mode alc880_w810_modes[1] = { |
e9edcee0 TI |
2535 | { 6, NULL } |
2536 | }; | |
2537 | ||
2538 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
c8b6bf9b | 2539 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
16ded525 | 2540 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2541 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2542 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2543 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2544 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2545 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2546 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2547 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
e9edcee0 TI |
2548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
2549 | { } /* end */ | |
2550 | }; | |
2551 | ||
2552 | ||
2553 | /* | |
2554 | * Z710V model | |
2555 | * | |
2556 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
9c7f852e TI |
2557 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
2558 | * Line = 0x1a | |
e9edcee0 TI |
2559 | */ |
2560 | ||
2561 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
2562 | 0x02 | |
2563 | }; | |
2564 | #define ALC880_Z71V_HP_DAC 0x03 | |
2565 | ||
2566 | /* fixed 2 channels */ | |
d2a6d7dc | 2567 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
e9edcee0 TI |
2568 | { 2, NULL } |
2569 | }; | |
2570 | ||
c8b6bf9b | 2571 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
e9edcee0 | 2572 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2573 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
e9edcee0 | 2574 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2575 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2577 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16ded525 TI |
2578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
2580 | { } /* end */ |
2581 | }; | |
2582 | ||
e9edcee0 | 2583 | |
e9edcee0 TI |
2584 | /* |
2585 | * ALC880 F1734 model | |
2586 | * | |
2587 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
2588 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
2589 | */ | |
2590 | ||
2591 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
2592 | 0x03 | |
2593 | }; | |
2594 | #define ALC880_F1734_HP_DAC 0x02 | |
2595 | ||
c8b6bf9b | 2596 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
e9edcee0 | 2597 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2598 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
2134ea4f TI |
2599 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
2600 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
e9edcee0 TI |
2601 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2602 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
937b4160 TI |
2603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
2604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e9edcee0 TI |
2605 | { } /* end */ |
2606 | }; | |
2607 | ||
937b4160 TI |
2608 | static struct hda_input_mux alc880_f1734_capture_source = { |
2609 | .num_items = 2, | |
2610 | .items = { | |
2611 | { "Mic", 0x1 }, | |
2612 | { "CD", 0x4 }, | |
2613 | }, | |
2614 | }; | |
2615 | ||
e9edcee0 | 2616 | |
e9edcee0 TI |
2617 | /* |
2618 | * ALC880 ASUS model | |
2619 | * | |
2620 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2621 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2622 | * Mic = 0x18, Line = 0x1a | |
2623 | */ | |
2624 | ||
2625 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
2626 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
2627 | ||
c8b6bf9b | 2628 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
16ded525 | 2629 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2630 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2631 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2632 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2633 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2634 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2635 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2636 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 TI |
2637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2638 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2639 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2640 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16ded525 TI |
2641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
2643 | { |
2644 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2645 | .name = "Channel Mode", | |
df694daa KY |
2646 | .info = alc_ch_mode_info, |
2647 | .get = alc_ch_mode_get, | |
2648 | .put = alc_ch_mode_put, | |
16ded525 TI |
2649 | }, |
2650 | { } /* end */ | |
2651 | }; | |
e9edcee0 | 2652 | |
e9edcee0 TI |
2653 | /* |
2654 | * ALC880 ASUS W1V model | |
2655 | * | |
2656 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2657 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2658 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
2659 | */ | |
2660 | ||
2661 | /* additional mixers to alc880_asus_mixer */ | |
c8b6bf9b | 2662 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
e9edcee0 TI |
2663 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
2664 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
2665 | { } /* end */ | |
2666 | }; | |
2667 | ||
df694daa KY |
2668 | /* TCL S700 */ |
2669 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
2670 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2671 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2672 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
2673 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
2674 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
2675 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
2676 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
2677 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
2678 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
df694daa KY |
2679 | { } /* end */ |
2680 | }; | |
2681 | ||
ccc656ce KY |
2682 | /* Uniwill */ |
2683 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2134ea4f TI |
2684 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2685 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2686 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2687 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
2688 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2689 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2690 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2691 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2692 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2693 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2694 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2695 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2696 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2697 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2698 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2699 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce KY |
2700 | { |
2701 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2702 | .name = "Channel Mode", | |
2703 | .info = alc_ch_mode_info, | |
2704 | .get = alc_ch_mode_get, | |
2705 | .put = alc_ch_mode_put, | |
2706 | }, | |
2707 | { } /* end */ | |
2708 | }; | |
2709 | ||
2cf9f0fc TD |
2710 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
2711 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2712 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2713 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2714 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2715 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2716 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2717 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2718 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2719 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2720 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2721 | { } /* end */ | |
2722 | }; | |
2723 | ||
ccc656ce | 2724 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
2134ea4f TI |
2725 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2726 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2727 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2728 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
2729 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2730 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2731 | { } /* end */ | |
2732 | }; | |
2733 | ||
2134ea4f TI |
2734 | /* |
2735 | * virtual master controls | |
2736 | */ | |
2737 | ||
2738 | /* | |
2739 | * slave controls for virtual master | |
2740 | */ | |
2741 | static const char *alc_slave_vols[] = { | |
2742 | "Front Playback Volume", | |
2743 | "Surround Playback Volume", | |
2744 | "Center Playback Volume", | |
2745 | "LFE Playback Volume", | |
2746 | "Side Playback Volume", | |
2747 | "Headphone Playback Volume", | |
2748 | "Speaker Playback Volume", | |
2749 | "Mono Playback Volume", | |
2134ea4f | 2750 | "Line-Out Playback Volume", |
26f5df26 | 2751 | "PCM Playback Volume", |
2134ea4f TI |
2752 | NULL, |
2753 | }; | |
2754 | ||
2755 | static const char *alc_slave_sws[] = { | |
2756 | "Front Playback Switch", | |
2757 | "Surround Playback Switch", | |
2758 | "Center Playback Switch", | |
2759 | "LFE Playback Switch", | |
2760 | "Side Playback Switch", | |
2761 | "Headphone Playback Switch", | |
2762 | "Speaker Playback Switch", | |
2763 | "Mono Playback Switch", | |
edb54a55 | 2764 | "IEC958 Playback Switch", |
23033b2b TI |
2765 | "Line-Out Playback Switch", |
2766 | "PCM Playback Switch", | |
2134ea4f TI |
2767 | NULL, |
2768 | }; | |
2769 | ||
1da177e4 | 2770 | /* |
e9edcee0 | 2771 | * build control elements |
1da177e4 | 2772 | */ |
603c4019 | 2773 | |
5b0cb1d8 JK |
2774 | #define NID_MAPPING (-1) |
2775 | ||
2776 | #define SUBDEV_SPEAKER_ (0 << 6) | |
2777 | #define SUBDEV_HP_ (1 << 6) | |
2778 | #define SUBDEV_LINE_ (2 << 6) | |
2779 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) | |
2780 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) | |
2781 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) | |
2782 | ||
603c4019 TI |
2783 | static void alc_free_kctls(struct hda_codec *codec); |
2784 | ||
67d634c0 | 2785 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
2786 | /* additional beep mixers; the actual parameters are overwritten at build */ |
2787 | static struct snd_kcontrol_new alc_beep_mixer[] = { | |
2788 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | |
123c07ae | 2789 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
45bdd1c1 TI |
2790 | { } /* end */ |
2791 | }; | |
67d634c0 | 2792 | #endif |
45bdd1c1 | 2793 | |
1da177e4 LT |
2794 | static int alc_build_controls(struct hda_codec *codec) |
2795 | { | |
2796 | struct alc_spec *spec = codec->spec; | |
2f44f847 | 2797 | struct snd_kcontrol *kctl = NULL; |
5b0cb1d8 JK |
2798 | struct snd_kcontrol_new *knew; |
2799 | int i, j, err; | |
2800 | unsigned int u; | |
2801 | hda_nid_t nid; | |
1da177e4 LT |
2802 | |
2803 | for (i = 0; i < spec->num_mixers; i++) { | |
2804 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
2805 | if (err < 0) | |
2806 | return err; | |
2807 | } | |
f9e336f6 TI |
2808 | if (spec->cap_mixer) { |
2809 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); | |
2810 | if (err < 0) | |
2811 | return err; | |
2812 | } | |
1da177e4 | 2813 | if (spec->multiout.dig_out_nid) { |
9c7f852e TI |
2814 | err = snd_hda_create_spdif_out_ctls(codec, |
2815 | spec->multiout.dig_out_nid); | |
1da177e4 LT |
2816 | if (err < 0) |
2817 | return err; | |
e64f14f4 TI |
2818 | if (!spec->no_analog) { |
2819 | err = snd_hda_create_spdif_share_sw(codec, | |
2820 | &spec->multiout); | |
2821 | if (err < 0) | |
2822 | return err; | |
2823 | spec->multiout.share_spdif = 1; | |
2824 | } | |
1da177e4 LT |
2825 | } |
2826 | if (spec->dig_in_nid) { | |
2827 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
2828 | if (err < 0) | |
2829 | return err; | |
2830 | } | |
2134ea4f | 2831 | |
67d634c0 | 2832 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
2833 | /* create beep controls if needed */ |
2834 | if (spec->beep_amp) { | |
2835 | struct snd_kcontrol_new *knew; | |
2836 | for (knew = alc_beep_mixer; knew->name; knew++) { | |
2837 | struct snd_kcontrol *kctl; | |
2838 | kctl = snd_ctl_new1(knew, codec); | |
2839 | if (!kctl) | |
2840 | return -ENOMEM; | |
2841 | kctl->private_value = spec->beep_amp; | |
5e26dfd0 | 2842 | err = snd_hda_ctl_add(codec, 0, kctl); |
45bdd1c1 TI |
2843 | if (err < 0) |
2844 | return err; | |
2845 | } | |
2846 | } | |
67d634c0 | 2847 | #endif |
45bdd1c1 | 2848 | |
2134ea4f | 2849 | /* if we have no master control, let's create it */ |
e64f14f4 TI |
2850 | if (!spec->no_analog && |
2851 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
1c82ed1b | 2852 | unsigned int vmaster_tlv[4]; |
2134ea4f | 2853 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
1c82ed1b | 2854 | HDA_OUTPUT, vmaster_tlv); |
2134ea4f | 2855 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1c82ed1b | 2856 | vmaster_tlv, alc_slave_vols); |
2134ea4f TI |
2857 | if (err < 0) |
2858 | return err; | |
2859 | } | |
e64f14f4 TI |
2860 | if (!spec->no_analog && |
2861 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
2134ea4f TI |
2862 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
2863 | NULL, alc_slave_sws); | |
2864 | if (err < 0) | |
2865 | return err; | |
2866 | } | |
2867 | ||
5b0cb1d8 | 2868 | /* assign Capture Source enums to NID */ |
fbe618f2 TI |
2869 | if (spec->capsrc_nids || spec->adc_nids) { |
2870 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | |
2871 | if (!kctl) | |
2872 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | |
2873 | for (i = 0; kctl && i < kctl->count; i++) { | |
2874 | hda_nid_t *nids = spec->capsrc_nids; | |
2875 | if (!nids) | |
2876 | nids = spec->adc_nids; | |
2877 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | |
2878 | if (err < 0) | |
2879 | return err; | |
2880 | } | |
5b0cb1d8 JK |
2881 | } |
2882 | if (spec->cap_mixer) { | |
2883 | const char *kname = kctl ? kctl->id.name : NULL; | |
2884 | for (knew = spec->cap_mixer; knew->name; knew++) { | |
2885 | if (kname && strcmp(knew->name, kname) == 0) | |
2886 | continue; | |
2887 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
2888 | for (i = 0; kctl && i < kctl->count; i++) { | |
2889 | err = snd_hda_add_nid(codec, kctl, i, | |
2890 | spec->adc_nids[i]); | |
2891 | if (err < 0) | |
2892 | return err; | |
2893 | } | |
2894 | } | |
2895 | } | |
2896 | ||
2897 | /* other nid->control mapping */ | |
2898 | for (i = 0; i < spec->num_mixers; i++) { | |
2899 | for (knew = spec->mixers[i]; knew->name; knew++) { | |
2900 | if (knew->iface != NID_MAPPING) | |
2901 | continue; | |
2902 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
2903 | if (kctl == NULL) | |
2904 | continue; | |
2905 | u = knew->subdevice; | |
2906 | for (j = 0; j < 4; j++, u >>= 8) { | |
2907 | nid = u & 0x3f; | |
2908 | if (nid == 0) | |
2909 | continue; | |
2910 | switch (u & 0xc0) { | |
2911 | case SUBDEV_SPEAKER_: | |
2912 | nid = spec->autocfg.speaker_pins[nid]; | |
2913 | break; | |
2914 | case SUBDEV_LINE_: | |
2915 | nid = spec->autocfg.line_out_pins[nid]; | |
2916 | break; | |
2917 | case SUBDEV_HP_: | |
2918 | nid = spec->autocfg.hp_pins[nid]; | |
2919 | break; | |
2920 | default: | |
2921 | continue; | |
2922 | } | |
2923 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
2924 | if (err < 0) | |
2925 | return err; | |
2926 | } | |
2927 | u = knew->private_value; | |
2928 | for (j = 0; j < 4; j++, u >>= 8) { | |
2929 | nid = u & 0xff; | |
2930 | if (nid == 0) | |
2931 | continue; | |
2932 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
2933 | if (err < 0) | |
2934 | return err; | |
2935 | } | |
2936 | } | |
2937 | } | |
bae84e70 TI |
2938 | |
2939 | alc_free_kctls(codec); /* no longer needed */ | |
2940 | ||
1da177e4 LT |
2941 | return 0; |
2942 | } | |
2943 | ||
e9edcee0 | 2944 | |
1da177e4 LT |
2945 | /* |
2946 | * initialize the codec volumes, etc | |
2947 | */ | |
2948 | ||
e9edcee0 TI |
2949 | /* |
2950 | * generic initialization of ADC, input mixers and output mixers | |
2951 | */ | |
2952 | static struct hda_verb alc880_volume_init_verbs[] = { | |
2953 | /* | |
2954 | * Unmute ADC0-2 and set the default input to mic-in | |
2955 | */ | |
71fe7b82 | 2956 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 2957 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 2958 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 2959 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 2960 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 2961 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 2962 | |
e9edcee0 TI |
2963 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
2964 | * mixer widget | |
9c7f852e TI |
2965 | * Note: PASD motherboards uses the Line In 2 as the input for front |
2966 | * panel mic (mic 2) | |
1da177e4 | 2967 | */ |
e9edcee0 | 2968 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
cb53c626 TI |
2969 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2970 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2971 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
2972 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
2973 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2974 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
2975 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
1da177e4 | 2976 | |
e9edcee0 TI |
2977 | /* |
2978 | * Set up output mixers (0x0c - 0x0f) | |
1da177e4 | 2979 | */ |
e9edcee0 TI |
2980 | /* set vol=0 to output mixers */ |
2981 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2982 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2983 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2984 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2985 | /* set up input amps for analog loopback */ | |
2986 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
05acb863 TI |
2987 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2988 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
2989 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2990 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
2991 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2992 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
2993 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2994 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
2995 | |
2996 | { } | |
2997 | }; | |
2998 | ||
e9edcee0 TI |
2999 | /* |
3000 | * 3-stack pin configuration: | |
3001 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
3002 | */ | |
3003 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
3004 | /* | |
3005 | * preset connection lists of input pins | |
3006 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
3007 | */ | |
3008 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3009 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3010 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3011 | ||
3012 | /* | |
3013 | * Set pin mode and muting | |
3014 | */ | |
3015 | /* set front pin widgets 0x14 for output */ | |
05acb863 | 3016 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
3017 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3018 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3019 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3020 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3021 | /* Mic2 (as headphone out) for HP output */ | |
3022 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3023 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1da177e4 | 3024 | /* Line In pin widget for input */ |
05acb863 | 3025 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
3026 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3027 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
3028 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3029 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1da177e4 | 3030 | /* CD pin widget for input */ |
05acb863 | 3031 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 3032 | |
e9edcee0 TI |
3033 | { } |
3034 | }; | |
1da177e4 | 3035 | |
e9edcee0 TI |
3036 | /* |
3037 | * 5-stack pin configuration: | |
3038 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
3039 | * line-in/side = 0x1a, f-mic = 0x1b | |
3040 | */ | |
3041 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
3042 | /* | |
3043 | * preset connection lists of input pins | |
3044 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1da177e4 | 3045 | */ |
e9edcee0 TI |
3046 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
3047 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
1da177e4 | 3048 | |
e9edcee0 TI |
3049 | /* |
3050 | * Set pin mode and muting | |
1da177e4 | 3051 | */ |
e9edcee0 TI |
3052 | /* set pin widgets 0x14-0x17 for output */ |
3053 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3055 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3056 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3057 | /* unmute pins for output (no gain on this amp) */ | |
3058 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3059 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3060 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3061 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3062 | ||
3063 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3064 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3065 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3066 | /* Mic2 (as headphone out) for HP output */ | |
3067 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3068 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3069 | /* Line In pin widget for input */ | |
3070 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3071 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3072 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
3073 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3074 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3075 | /* CD pin widget for input */ | |
3076 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1da177e4 LT |
3077 | |
3078 | { } | |
3079 | }; | |
3080 | ||
e9edcee0 TI |
3081 | /* |
3082 | * W810 pin configuration: | |
3083 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
3084 | */ | |
3085 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
3086 | /* hphone/speaker input selector: front DAC */ | |
3087 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
1da177e4 | 3088 | |
05acb863 | 3089 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3090 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 3091 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3092 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 3093 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3094 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 3095 | |
e9edcee0 | 3096 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
05acb863 | 3097 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1da177e4 | 3098 | |
1da177e4 LT |
3099 | { } |
3100 | }; | |
3101 | ||
e9edcee0 TI |
3102 | /* |
3103 | * Z71V pin configuration: | |
3104 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
3105 | */ | |
3106 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
05acb863 | 3107 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3108 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 3109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 3110 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
dfc0ff62 | 3111 | |
16ded525 | 3112 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3113 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 | 3114 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3115 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 TI |
3116 | |
3117 | { } | |
3118 | }; | |
3119 | ||
e9edcee0 TI |
3120 | /* |
3121 | * 6-stack pin configuration: | |
9c7f852e TI |
3122 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
3123 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
e9edcee0 TI |
3124 | */ |
3125 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
3126 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3127 | ||
16ded525 | 3128 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3129 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3130 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3131 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3132 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3133 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3134 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
3135 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3136 | ||
16ded525 | 3137 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3138 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3139 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3140 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3141 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 | 3142 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3143 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 3144 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3145 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 3146 | |
e9edcee0 TI |
3147 | { } |
3148 | }; | |
3149 | ||
ccc656ce KY |
3150 | /* |
3151 | * Uniwill pin configuration: | |
3152 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
3153 | * line = 0x1a | |
3154 | */ | |
3155 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
3156 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3157 | ||
3158 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3159 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3160 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3161 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3162 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3163 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3164 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3165 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3166 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3167 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3168 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3169 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3170 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3171 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3172 | ||
3173 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3174 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3175 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3176 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3177 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3178 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3179 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
3180 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
3181 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3182 | ||
3183 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3184 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
3185 | ||
3186 | { } | |
3187 | }; | |
3188 | ||
3189 | /* | |
3190 | * Uniwill P53 | |
ea1fb29a | 3191 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
ccc656ce KY |
3192 | */ |
3193 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
3194 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3195 | ||
3196 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3197 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3200 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3201 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3202 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3203 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3204 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3205 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3206 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3207 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3208 | ||
3209 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3210 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3211 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3212 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3213 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3214 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3215 | ||
3216 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3217 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
3218 | ||
3219 | { } | |
3220 | }; | |
3221 | ||
2cf9f0fc TD |
3222 | static struct hda_verb alc880_beep_init_verbs[] = { |
3223 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
3224 | { } | |
3225 | }; | |
3226 | ||
458a4fab TI |
3227 | /* auto-toggle front mic */ |
3228 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |
3229 | { | |
3230 | unsigned int present; | |
3231 | unsigned char bits; | |
ccc656ce | 3232 | |
864f92be | 3233 | present = snd_hda_jack_detect(codec, 0x18); |
47fd830a TI |
3234 | bits = present ? HDA_AMP_MUTE : 0; |
3235 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
458a4fab TI |
3236 | } |
3237 | ||
4f5d1706 | 3238 | static void alc880_uniwill_setup(struct hda_codec *codec) |
458a4fab | 3239 | { |
a9fd4f3f TI |
3240 | struct alc_spec *spec = codec->spec; |
3241 | ||
3242 | spec->autocfg.hp_pins[0] = 0x14; | |
3243 | spec->autocfg.speaker_pins[0] = 0x15; | |
3244 | spec->autocfg.speaker_pins[0] = 0x16; | |
4f5d1706 TI |
3245 | } |
3246 | ||
3247 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | |
3248 | { | |
a9fd4f3f | 3249 | alc_automute_amp(codec); |
458a4fab | 3250 | alc880_uniwill_mic_automute(codec); |
ccc656ce KY |
3251 | } |
3252 | ||
3253 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
3254 | unsigned int res) | |
3255 | { | |
3256 | /* Looks like the unsol event is incompatible with the standard | |
3257 | * definition. 4bit tag is placed at 28 bit! | |
3258 | */ | |
458a4fab | 3259 | switch (res >> 28) { |
458a4fab TI |
3260 | case ALC880_MIC_EVENT: |
3261 | alc880_uniwill_mic_automute(codec); | |
3262 | break; | |
a9fd4f3f TI |
3263 | default: |
3264 | alc_automute_amp_unsol_event(codec, res); | |
3265 | break; | |
458a4fab | 3266 | } |
ccc656ce KY |
3267 | } |
3268 | ||
4f5d1706 | 3269 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
ccc656ce | 3270 | { |
a9fd4f3f | 3271 | struct alc_spec *spec = codec->spec; |
ccc656ce | 3272 | |
a9fd4f3f TI |
3273 | spec->autocfg.hp_pins[0] = 0x14; |
3274 | spec->autocfg.speaker_pins[0] = 0x15; | |
ccc656ce KY |
3275 | } |
3276 | ||
3277 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
3278 | { | |
3279 | unsigned int present; | |
ea1fb29a | 3280 | |
ccc656ce | 3281 | present = snd_hda_codec_read(codec, 0x21, 0, |
47fd830a TI |
3282 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
3283 | present &= HDA_AMP_VOLMASK; | |
3284 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
3285 | HDA_AMP_VOLMASK, present); | |
3286 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
3287 | HDA_AMP_VOLMASK, present); | |
ccc656ce | 3288 | } |
47fd830a | 3289 | |
ccc656ce KY |
3290 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
3291 | unsigned int res) | |
3292 | { | |
3293 | /* Looks like the unsol event is incompatible with the standard | |
3294 | * definition. 4bit tag is placed at 28 bit! | |
3295 | */ | |
f12ab1e0 | 3296 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
ccc656ce | 3297 | alc880_uniwill_p53_dcvol_automute(codec); |
a9fd4f3f TI |
3298 | else |
3299 | alc_automute_amp_unsol_event(codec, res); | |
ccc656ce KY |
3300 | } |
3301 | ||
e9edcee0 TI |
3302 | /* |
3303 | * F1734 pin configuration: | |
3304 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
3305 | */ | |
3306 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
ee7a9c7c | 3307 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
16ded525 TI |
3308 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
3309 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3310 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3311 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3312 | ||
e9edcee0 | 3313 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
16ded525 | 3314 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
e9edcee0 | 3315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16ded525 | 3316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3317 | |
e9edcee0 TI |
3318 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3319 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
ee7a9c7c | 3320 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
e9edcee0 | 3321 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3322 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3323 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3324 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3325 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3326 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
dfc0ff62 | 3327 | |
937b4160 TI |
3328 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
3329 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
3330 | ||
dfc0ff62 TI |
3331 | { } |
3332 | }; | |
3333 | ||
e9edcee0 TI |
3334 | /* |
3335 | * ASUS pin configuration: | |
3336 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
3337 | */ | |
3338 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
16ded525 TI |
3339 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
3340 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3341 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3342 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3343 | ||
3344 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
e9edcee0 | 3345 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3346 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3347 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3348 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3349 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3350 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
3351 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3352 | ||
3353 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3354 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3355 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3356 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3357 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3358 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16ded525 | 3359 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3360 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3361 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 3362 | |
e9edcee0 TI |
3363 | { } |
3364 | }; | |
16ded525 | 3365 | |
e9edcee0 | 3366 | /* Enable GPIO mask and set output */ |
bc9f98a9 KY |
3367 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
3368 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
64a8be74 | 3369 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
df694daa KY |
3370 | |
3371 | /* Clevo m520g init */ | |
3372 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
3373 | /* headphone output */ | |
3374 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3375 | /* line-out */ | |
3376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3377 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3378 | /* Line-in */ | |
3379 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3380 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3381 | /* CD */ | |
3382 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3383 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3384 | /* Mic1 (rear panel) */ | |
3385 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3386 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3387 | /* Mic2 (front panel) */ | |
3388 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3389 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3390 | /* headphone */ | |
3391 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3392 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3393 | /* change to EAPD mode */ | |
3394 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3395 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3396 | ||
3397 | { } | |
16ded525 TI |
3398 | }; |
3399 | ||
df694daa | 3400 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
4b146cb0 TI |
3401 | /* change to EAPD mode */ |
3402 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3403 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3404 | ||
df694daa KY |
3405 | /* Headphone output */ |
3406 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3407 | /* Front output*/ | |
3408 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3409 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3410 | ||
3411 | /* Line In pin widget for input */ | |
3412 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3413 | /* CD pin widget for input */ | |
3414 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3415 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3416 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3417 | ||
3418 | /* change to EAPD mode */ | |
3419 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3420 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
3421 | ||
3422 | { } | |
3423 | }; | |
16ded525 | 3424 | |
e9edcee0 | 3425 | /* |
ae6b813a TI |
3426 | * LG m1 express dual |
3427 | * | |
3428 | * Pin assignment: | |
3429 | * Rear Line-In/Out (blue): 0x14 | |
3430 | * Build-in Mic-In: 0x15 | |
3431 | * Speaker-out: 0x17 | |
3432 | * HP-Out (green): 0x1b | |
3433 | * Mic-In/Out (red): 0x19 | |
3434 | * SPDIF-Out: 0x1e | |
3435 | */ | |
3436 | ||
3437 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
3438 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
3439 | 0x05, 0x02, 0x03 | |
3440 | }; | |
3441 | ||
3442 | /* seems analog CD is not working */ | |
3443 | static struct hda_input_mux alc880_lg_capture_source = { | |
3444 | .num_items = 3, | |
3445 | .items = { | |
3446 | { "Mic", 0x1 }, | |
3447 | { "Line", 0x5 }, | |
3448 | { "Internal Mic", 0x6 }, | |
3449 | }, | |
3450 | }; | |
3451 | ||
3452 | /* 2,4,6 channel modes */ | |
3453 | static struct hda_verb alc880_lg_ch2_init[] = { | |
3454 | /* set line-in and mic-in to input */ | |
3455 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
3456 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3457 | { } | |
3458 | }; | |
3459 | ||
3460 | static struct hda_verb alc880_lg_ch4_init[] = { | |
3461 | /* set line-in to out and mic-in to input */ | |
3462 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3463 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3464 | { } | |
3465 | }; | |
3466 | ||
3467 | static struct hda_verb alc880_lg_ch6_init[] = { | |
3468 | /* set line-in and mic-in to output */ | |
3469 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3470 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3471 | { } | |
3472 | }; | |
3473 | ||
3474 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
3475 | { 2, alc880_lg_ch2_init }, | |
3476 | { 4, alc880_lg_ch4_init }, | |
3477 | { 6, alc880_lg_ch6_init }, | |
3478 | }; | |
3479 | ||
3480 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
2134ea4f TI |
3481 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
3482 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
ae6b813a TI |
3483 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
3484 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
3485 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
3486 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
3487 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
3488 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
3489 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3490 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3491 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
3492 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
3493 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
3494 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
3495 | { | |
3496 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3497 | .name = "Channel Mode", | |
3498 | .info = alc_ch_mode_info, | |
3499 | .get = alc_ch_mode_get, | |
3500 | .put = alc_ch_mode_put, | |
3501 | }, | |
3502 | { } /* end */ | |
3503 | }; | |
3504 | ||
3505 | static struct hda_verb alc880_lg_init_verbs[] = { | |
3506 | /* set capture source to mic-in */ | |
3507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3508 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3509 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3510 | /* mute all amp mixer inputs */ | |
3511 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
cb53c626 TI |
3512 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
3513 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
ae6b813a TI |
3514 | /* line-in to input */ |
3515 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3516 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3517 | /* built-in mic */ | |
3518 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3519 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3520 | /* speaker-out */ | |
3521 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3522 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3523 | /* mic-in to input */ | |
3524 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3525 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3526 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3527 | /* HP-out */ | |
3528 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
3529 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3530 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3531 | /* jack sense */ | |
a9fd4f3f | 3532 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
ae6b813a TI |
3533 | { } |
3534 | }; | |
3535 | ||
3536 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 3537 | static void alc880_lg_setup(struct hda_codec *codec) |
ae6b813a | 3538 | { |
a9fd4f3f | 3539 | struct alc_spec *spec = codec->spec; |
ae6b813a | 3540 | |
a9fd4f3f TI |
3541 | spec->autocfg.hp_pins[0] = 0x1b; |
3542 | spec->autocfg.speaker_pins[0] = 0x17; | |
ae6b813a TI |
3543 | } |
3544 | ||
d681518a TI |
3545 | /* |
3546 | * LG LW20 | |
3547 | * | |
3548 | * Pin assignment: | |
3549 | * Speaker-out: 0x14 | |
3550 | * Mic-In: 0x18 | |
e4f41da9 CM |
3551 | * Built-in Mic-In: 0x19 |
3552 | * Line-In: 0x1b | |
3553 | * HP-Out: 0x1a | |
d681518a TI |
3554 | * SPDIF-Out: 0x1e |
3555 | */ | |
3556 | ||
d681518a | 3557 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
e4f41da9 | 3558 | .num_items = 3, |
d681518a TI |
3559 | .items = { |
3560 | { "Mic", 0x0 }, | |
3561 | { "Internal Mic", 0x1 }, | |
e4f41da9 | 3562 | { "Line In", 0x2 }, |
d681518a TI |
3563 | }, |
3564 | }; | |
3565 | ||
0a8c5da3 CM |
3566 | #define alc880_lg_lw_modes alc880_threestack_modes |
3567 | ||
d681518a | 3568 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
0a8c5da3 CM |
3569 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
3570 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
3571 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3572 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
3573 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
3574 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
3575 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
3576 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
3577 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
3578 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d681518a TI |
3579 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
3580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3581 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
3582 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
0a8c5da3 CM |
3583 | { |
3584 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3585 | .name = "Channel Mode", | |
3586 | .info = alc_ch_mode_info, | |
3587 | .get = alc_ch_mode_get, | |
3588 | .put = alc_ch_mode_put, | |
3589 | }, | |
d681518a TI |
3590 | { } /* end */ |
3591 | }; | |
3592 | ||
3593 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
0a8c5da3 CM |
3594 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
3595 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3596 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3597 | ||
d681518a TI |
3598 | /* set capture source to mic-in */ |
3599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3600 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3601 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
cb53c626 | 3602 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
d681518a TI |
3603 | /* speaker-out */ |
3604 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3606 | /* HP-out */ | |
d681518a TI |
3607 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
3608 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3609 | /* mic-in to input */ | |
3610 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3611 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3612 | /* built-in mic */ | |
3613 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3614 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3615 | /* jack sense */ | |
a9fd4f3f | 3616 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
d681518a TI |
3617 | { } |
3618 | }; | |
3619 | ||
3620 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 3621 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
d681518a | 3622 | { |
a9fd4f3f | 3623 | struct alc_spec *spec = codec->spec; |
d681518a | 3624 | |
a9fd4f3f TI |
3625 | spec->autocfg.hp_pins[0] = 0x1b; |
3626 | spec->autocfg.speaker_pins[0] = 0x14; | |
d681518a TI |
3627 | } |
3628 | ||
df99cd33 TI |
3629 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
3630 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3631 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
3632 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3633 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3634 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3635 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3636 | { } /* end */ | |
3637 | }; | |
3638 | ||
3639 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
3640 | .num_items = 2, | |
3641 | .items = { | |
3642 | { "Mic", 0x0 }, | |
3643 | { "Internal Mic", 0x1 }, | |
3644 | }, | |
3645 | }; | |
3646 | ||
3647 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
3648 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3649 | ||
3650 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3651 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3652 | ||
3653 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3654 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3655 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3656 | /* Mic2 (as headphone out) for HP output */ | |
3657 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3658 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3659 | /* Internal Speaker */ | |
3660 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3661 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3662 | ||
3663 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3664 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3665 | ||
3666 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3667 | { } | |
3668 | }; | |
3669 | ||
3670 | /* toggle speaker-output according to the hp-jack state */ | |
3671 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
3672 | { | |
a9fd4f3f TI |
3673 | struct alc_spec *spec = codec->spec; |
3674 | alc_automute_amp(codec); | |
3675 | /* toggle EAPD */ | |
3676 | if (spec->jack_present) | |
df99cd33 TI |
3677 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
3678 | else | |
3679 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
3680 | } | |
3681 | ||
3682 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
3683 | unsigned int res) | |
3684 | { | |
3685 | /* Looks like the unsol event is incompatible with the standard | |
3686 | * definition. 4bit tag is placed at 28 bit! | |
3687 | */ | |
3688 | if ((res >> 28) == ALC880_HP_EVENT) | |
3689 | alc880_medion_rim_automute(codec); | |
3690 | } | |
3691 | ||
4f5d1706 | 3692 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
a9fd4f3f TI |
3693 | { |
3694 | struct alc_spec *spec = codec->spec; | |
3695 | ||
3696 | spec->autocfg.hp_pins[0] = 0x14; | |
3697 | spec->autocfg.speaker_pins[0] = 0x1b; | |
a9fd4f3f TI |
3698 | } |
3699 | ||
cb53c626 TI |
3700 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3701 | static struct hda_amp_list alc880_loopbacks[] = { | |
3702 | { 0x0b, HDA_INPUT, 0 }, | |
3703 | { 0x0b, HDA_INPUT, 1 }, | |
3704 | { 0x0b, HDA_INPUT, 2 }, | |
3705 | { 0x0b, HDA_INPUT, 3 }, | |
3706 | { 0x0b, HDA_INPUT, 4 }, | |
3707 | { } /* end */ | |
3708 | }; | |
3709 | ||
3710 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
3711 | { 0x0b, HDA_INPUT, 1 }, | |
3712 | { 0x0b, HDA_INPUT, 6 }, | |
3713 | { 0x0b, HDA_INPUT, 7 }, | |
3714 | { } /* end */ | |
3715 | }; | |
3716 | #endif | |
3717 | ||
ae6b813a TI |
3718 | /* |
3719 | * Common callbacks | |
e9edcee0 TI |
3720 | */ |
3721 | ||
1da177e4 LT |
3722 | static int alc_init(struct hda_codec *codec) |
3723 | { | |
3724 | struct alc_spec *spec = codec->spec; | |
e9edcee0 TI |
3725 | unsigned int i; |
3726 | ||
2c3bf9ab | 3727 | alc_fix_pll(codec); |
4a79ba34 | 3728 | alc_auto_init_amp(codec, spec->init_amp); |
2c3bf9ab | 3729 | |
e9edcee0 TI |
3730 | for (i = 0; i < spec->num_init_verbs; i++) |
3731 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
ae6b813a TI |
3732 | |
3733 | if (spec->init_hook) | |
3734 | spec->init_hook(codec); | |
3735 | ||
9e5341b9 | 3736 | hda_call_check_power_status(codec, 0x01); |
1da177e4 LT |
3737 | return 0; |
3738 | } | |
3739 | ||
ae6b813a TI |
3740 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
3741 | { | |
3742 | struct alc_spec *spec = codec->spec; | |
3743 | ||
3744 | if (spec->unsol_event) | |
3745 | spec->unsol_event(codec, res); | |
3746 | } | |
3747 | ||
cb53c626 TI |
3748 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3749 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
3750 | { | |
3751 | struct alc_spec *spec = codec->spec; | |
3752 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
3753 | } | |
3754 | #endif | |
3755 | ||
1da177e4 LT |
3756 | /* |
3757 | * Analog playback callbacks | |
3758 | */ | |
3759 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3760 | struct hda_codec *codec, | |
c8b6bf9b | 3761 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3762 | { |
3763 | struct alc_spec *spec = codec->spec; | |
9a08160b TI |
3764 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
3765 | hinfo); | |
1da177e4 LT |
3766 | } |
3767 | ||
3768 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3769 | struct hda_codec *codec, | |
3770 | unsigned int stream_tag, | |
3771 | unsigned int format, | |
c8b6bf9b | 3772 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3773 | { |
3774 | struct alc_spec *spec = codec->spec; | |
9c7f852e TI |
3775 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
3776 | stream_tag, format, substream); | |
1da177e4 LT |
3777 | } |
3778 | ||
3779 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3780 | struct hda_codec *codec, | |
c8b6bf9b | 3781 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3782 | { |
3783 | struct alc_spec *spec = codec->spec; | |
3784 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
3785 | } | |
3786 | ||
3787 | /* | |
3788 | * Digital out | |
3789 | */ | |
3790 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3791 | struct hda_codec *codec, | |
c8b6bf9b | 3792 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3793 | { |
3794 | struct alc_spec *spec = codec->spec; | |
3795 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
3796 | } | |
3797 | ||
6b97eb45 TI |
3798 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
3799 | struct hda_codec *codec, | |
3800 | unsigned int stream_tag, | |
3801 | unsigned int format, | |
3802 | struct snd_pcm_substream *substream) | |
3803 | { | |
3804 | struct alc_spec *spec = codec->spec; | |
3805 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
3806 | stream_tag, format, substream); | |
3807 | } | |
3808 | ||
9b5f12e5 TI |
3809 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
3810 | struct hda_codec *codec, | |
3811 | struct snd_pcm_substream *substream) | |
3812 | { | |
3813 | struct alc_spec *spec = codec->spec; | |
3814 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | |
3815 | } | |
3816 | ||
1da177e4 LT |
3817 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
3818 | struct hda_codec *codec, | |
c8b6bf9b | 3819 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3820 | { |
3821 | struct alc_spec *spec = codec->spec; | |
3822 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
3823 | } | |
3824 | ||
3825 | /* | |
3826 | * Analog capture | |
3827 | */ | |
6330079f | 3828 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
1da177e4 LT |
3829 | struct hda_codec *codec, |
3830 | unsigned int stream_tag, | |
3831 | unsigned int format, | |
c8b6bf9b | 3832 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3833 | { |
3834 | struct alc_spec *spec = codec->spec; | |
3835 | ||
6330079f | 3836 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
1da177e4 LT |
3837 | stream_tag, 0, format); |
3838 | return 0; | |
3839 | } | |
3840 | ||
6330079f | 3841 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
1da177e4 | 3842 | struct hda_codec *codec, |
c8b6bf9b | 3843 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3844 | { |
3845 | struct alc_spec *spec = codec->spec; | |
3846 | ||
888afa15 TI |
3847 | snd_hda_codec_cleanup_stream(codec, |
3848 | spec->adc_nids[substream->number + 1]); | |
1da177e4 LT |
3849 | return 0; |
3850 | } | |
3851 | ||
840b64c0 TI |
3852 | /* analog capture with dynamic dual-adc changes */ |
3853 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3854 | struct hda_codec *codec, | |
3855 | unsigned int stream_tag, | |
3856 | unsigned int format, | |
3857 | struct snd_pcm_substream *substream) | |
3858 | { | |
3859 | struct alc_spec *spec = codec->spec; | |
3860 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; | |
3861 | spec->cur_adc_stream_tag = stream_tag; | |
3862 | spec->cur_adc_format = format; | |
3863 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); | |
3864 | return 0; | |
3865 | } | |
3866 | ||
3867 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3868 | struct hda_codec *codec, | |
3869 | struct snd_pcm_substream *substream) | |
3870 | { | |
3871 | struct alc_spec *spec = codec->spec; | |
3872 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); | |
3873 | spec->cur_adc = 0; | |
3874 | return 0; | |
3875 | } | |
3876 | ||
3877 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { | |
3878 | .substreams = 1, | |
3879 | .channels_min = 2, | |
3880 | .channels_max = 2, | |
3881 | .nid = 0, /* fill later */ | |
3882 | .ops = { | |
3883 | .prepare = dualmic_capture_pcm_prepare, | |
3884 | .cleanup = dualmic_capture_pcm_cleanup | |
3885 | }, | |
3886 | }; | |
1da177e4 LT |
3887 | |
3888 | /* | |
3889 | */ | |
3890 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
3891 | .substreams = 1, | |
3892 | .channels_min = 2, | |
3893 | .channels_max = 8, | |
e9edcee0 | 3894 | /* NID is set in alc_build_pcms */ |
1da177e4 LT |
3895 | .ops = { |
3896 | .open = alc880_playback_pcm_open, | |
3897 | .prepare = alc880_playback_pcm_prepare, | |
3898 | .cleanup = alc880_playback_pcm_cleanup | |
3899 | }, | |
3900 | }; | |
3901 | ||
3902 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
6330079f TI |
3903 | .substreams = 1, |
3904 | .channels_min = 2, | |
3905 | .channels_max = 2, | |
3906 | /* NID is set in alc_build_pcms */ | |
3907 | }; | |
3908 | ||
3909 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
3910 | .substreams = 1, | |
3911 | .channels_min = 2, | |
3912 | .channels_max = 2, | |
3913 | /* NID is set in alc_build_pcms */ | |
3914 | }; | |
3915 | ||
3916 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
3917 | .substreams = 2, /* can be overridden */ | |
1da177e4 LT |
3918 | .channels_min = 2, |
3919 | .channels_max = 2, | |
e9edcee0 | 3920 | /* NID is set in alc_build_pcms */ |
1da177e4 | 3921 | .ops = { |
6330079f TI |
3922 | .prepare = alc880_alt_capture_pcm_prepare, |
3923 | .cleanup = alc880_alt_capture_pcm_cleanup | |
1da177e4 LT |
3924 | }, |
3925 | }; | |
3926 | ||
3927 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
3928 | .substreams = 1, | |
3929 | .channels_min = 2, | |
3930 | .channels_max = 2, | |
3931 | /* NID is set in alc_build_pcms */ | |
3932 | .ops = { | |
3933 | .open = alc880_dig_playback_pcm_open, | |
6b97eb45 | 3934 | .close = alc880_dig_playback_pcm_close, |
9b5f12e5 TI |
3935 | .prepare = alc880_dig_playback_pcm_prepare, |
3936 | .cleanup = alc880_dig_playback_pcm_cleanup | |
1da177e4 LT |
3937 | }, |
3938 | }; | |
3939 | ||
3940 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
3941 | .substreams = 1, | |
3942 | .channels_min = 2, | |
3943 | .channels_max = 2, | |
3944 | /* NID is set in alc_build_pcms */ | |
3945 | }; | |
3946 | ||
4c5186ed | 3947 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
6330079f | 3948 | static struct hda_pcm_stream alc_pcm_null_stream = { |
4c5186ed JW |
3949 | .substreams = 0, |
3950 | .channels_min = 0, | |
3951 | .channels_max = 0, | |
3952 | }; | |
3953 | ||
1da177e4 LT |
3954 | static int alc_build_pcms(struct hda_codec *codec) |
3955 | { | |
3956 | struct alc_spec *spec = codec->spec; | |
3957 | struct hda_pcm *info = spec->pcm_rec; | |
3958 | int i; | |
3959 | ||
3960 | codec->num_pcms = 1; | |
3961 | codec->pcm_info = info; | |
3962 | ||
e64f14f4 TI |
3963 | if (spec->no_analog) |
3964 | goto skip_analog; | |
3965 | ||
812a2cca TI |
3966 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
3967 | "%s Analog", codec->chip_name); | |
1da177e4 | 3968 | info->name = spec->stream_name_analog; |
274693f3 | 3969 | |
4a471b7d | 3970 | if (spec->stream_analog_playback) { |
da3cec35 TI |
3971 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
3972 | return -EINVAL; | |
4a471b7d TI |
3973 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
3974 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
3975 | } | |
3976 | if (spec->stream_analog_capture) { | |
da3cec35 TI |
3977 | if (snd_BUG_ON(!spec->adc_nids)) |
3978 | return -EINVAL; | |
4a471b7d TI |
3979 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
3980 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
3981 | } | |
3982 | ||
3983 | if (spec->channel_mode) { | |
3984 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
3985 | for (i = 0; i < spec->num_channel_mode; i++) { | |
3986 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
3987 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
3988 | } | |
1da177e4 LT |
3989 | } |
3990 | } | |
3991 | ||
e64f14f4 | 3992 | skip_analog: |
e08a007d | 3993 | /* SPDIF for stream index #1 */ |
1da177e4 | 3994 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
812a2cca TI |
3995 | snprintf(spec->stream_name_digital, |
3996 | sizeof(spec->stream_name_digital), | |
3997 | "%s Digital", codec->chip_name); | |
e08a007d | 3998 | codec->num_pcms = 2; |
b25c9da1 | 3999 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
c06134d7 | 4000 | info = spec->pcm_rec + 1; |
1da177e4 | 4001 | info->name = spec->stream_name_digital; |
8c441982 TI |
4002 | if (spec->dig_out_type) |
4003 | info->pcm_type = spec->dig_out_type; | |
4004 | else | |
4005 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | |
4a471b7d TI |
4006 | if (spec->multiout.dig_out_nid && |
4007 | spec->stream_digital_playback) { | |
1da177e4 LT |
4008 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
4009 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
4010 | } | |
4a471b7d TI |
4011 | if (spec->dig_in_nid && |
4012 | spec->stream_digital_capture) { | |
1da177e4 LT |
4013 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
4014 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
4015 | } | |
963f803f TI |
4016 | /* FIXME: do we need this for all Realtek codec models? */ |
4017 | codec->spdif_status_reset = 1; | |
1da177e4 LT |
4018 | } |
4019 | ||
e64f14f4 TI |
4020 | if (spec->no_analog) |
4021 | return 0; | |
4022 | ||
e08a007d TI |
4023 | /* If the use of more than one ADC is requested for the current |
4024 | * model, configure a second analog capture-only PCM. | |
4025 | */ | |
4026 | /* Additional Analaog capture for index #2 */ | |
6330079f TI |
4027 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
4028 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
e08a007d | 4029 | codec->num_pcms = 3; |
c06134d7 | 4030 | info = spec->pcm_rec + 2; |
e08a007d | 4031 | info->name = spec->stream_name_analog; |
6330079f TI |
4032 | if (spec->alt_dac_nid) { |
4033 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
4034 | *spec->stream_analog_alt_playback; | |
4035 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
4036 | spec->alt_dac_nid; | |
4037 | } else { | |
4038 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
4039 | alc_pcm_null_stream; | |
4040 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
4041 | } | |
4042 | if (spec->num_adc_nids > 1) { | |
4043 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
4044 | *spec->stream_analog_alt_capture; | |
4045 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
4046 | spec->adc_nids[1]; | |
4047 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
4048 | spec->num_adc_nids - 1; | |
4049 | } else { | |
4050 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
4051 | alc_pcm_null_stream; | |
4052 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
e08a007d TI |
4053 | } |
4054 | } | |
4055 | ||
1da177e4 LT |
4056 | return 0; |
4057 | } | |
4058 | ||
a4e09aa3 TI |
4059 | static inline void alc_shutup(struct hda_codec *codec) |
4060 | { | |
4061 | snd_hda_shutup_pins(codec); | |
4062 | } | |
4063 | ||
603c4019 TI |
4064 | static void alc_free_kctls(struct hda_codec *codec) |
4065 | { | |
4066 | struct alc_spec *spec = codec->spec; | |
4067 | ||
4068 | if (spec->kctls.list) { | |
4069 | struct snd_kcontrol_new *kctl = spec->kctls.list; | |
4070 | int i; | |
4071 | for (i = 0; i < spec->kctls.used; i++) | |
4072 | kfree(kctl[i].name); | |
4073 | } | |
4074 | snd_array_free(&spec->kctls); | |
4075 | } | |
4076 | ||
1da177e4 LT |
4077 | static void alc_free(struct hda_codec *codec) |
4078 | { | |
e9edcee0 | 4079 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 4080 | |
f12ab1e0 | 4081 | if (!spec) |
e9edcee0 TI |
4082 | return; |
4083 | ||
a4e09aa3 | 4084 | alc_shutup(codec); |
603c4019 | 4085 | alc_free_kctls(codec); |
e9edcee0 | 4086 | kfree(spec); |
680cd536 | 4087 | snd_hda_detach_beep_device(codec); |
1da177e4 LT |
4088 | } |
4089 | ||
f5de24b0 | 4090 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
c97259df DC |
4091 | static void alc_power_eapd(struct hda_codec *codec) |
4092 | { | |
4093 | /* We currently only handle front, HP */ | |
4094 | switch (codec->vendor_id) { | |
4095 | case 0x10ec0260: | |
9e4c8496 TI |
4096 | set_eapd(codec, 0x0f, 0); |
4097 | set_eapd(codec, 0x10, 0); | |
c97259df DC |
4098 | break; |
4099 | case 0x10ec0262: | |
4100 | case 0x10ec0267: | |
4101 | case 0x10ec0268: | |
4102 | case 0x10ec0269: | |
9e4c8496 | 4103 | case 0x10ec0270: |
c97259df DC |
4104 | case 0x10ec0272: |
4105 | case 0x10ec0660: | |
4106 | case 0x10ec0662: | |
4107 | case 0x10ec0663: | |
4108 | case 0x10ec0862: | |
4109 | case 0x10ec0889: | |
9e4c8496 TI |
4110 | set_eapd(codec, 0x14, 0); |
4111 | set_eapd(codec, 0x15, 0); | |
c97259df DC |
4112 | break; |
4113 | } | |
4114 | } | |
4115 | ||
f5de24b0 HM |
4116 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
4117 | { | |
4118 | struct alc_spec *spec = codec->spec; | |
a4e09aa3 | 4119 | alc_shutup(codec); |
f5de24b0 | 4120 | if (spec && spec->power_hook) |
c97259df | 4121 | spec->power_hook(codec); |
f5de24b0 HM |
4122 | return 0; |
4123 | } | |
4124 | #endif | |
4125 | ||
e044c39a | 4126 | #ifdef SND_HDA_NEEDS_RESUME |
e044c39a TI |
4127 | static int alc_resume(struct hda_codec *codec) |
4128 | { | |
e044c39a TI |
4129 | codec->patch_ops.init(codec); |
4130 | snd_hda_codec_resume_amp(codec); | |
4131 | snd_hda_codec_resume_cache(codec); | |
9e5341b9 | 4132 | hda_call_check_power_status(codec, 0x01); |
e044c39a TI |
4133 | return 0; |
4134 | } | |
e044c39a TI |
4135 | #endif |
4136 | ||
1da177e4 LT |
4137 | /* |
4138 | */ | |
4139 | static struct hda_codec_ops alc_patch_ops = { | |
4140 | .build_controls = alc_build_controls, | |
4141 | .build_pcms = alc_build_pcms, | |
4142 | .init = alc_init, | |
4143 | .free = alc_free, | |
ae6b813a | 4144 | .unsol_event = alc_unsol_event, |
e044c39a TI |
4145 | #ifdef SND_HDA_NEEDS_RESUME |
4146 | .resume = alc_resume, | |
4147 | #endif | |
cb53c626 | 4148 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
f5de24b0 | 4149 | .suspend = alc_suspend, |
cb53c626 TI |
4150 | .check_power_status = alc_check_power_status, |
4151 | #endif | |
c97259df | 4152 | .reboot_notify = alc_shutup, |
1da177e4 LT |
4153 | }; |
4154 | ||
c027ddcd KY |
4155 | /* replace the codec chip_name with the given string */ |
4156 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | |
4157 | { | |
4158 | kfree(codec->chip_name); | |
4159 | codec->chip_name = kstrdup(name, GFP_KERNEL); | |
4160 | if (!codec->chip_name) { | |
4161 | alc_free(codec); | |
4162 | return -ENOMEM; | |
4163 | } | |
4164 | return 0; | |
4165 | } | |
4166 | ||
2fa522be TI |
4167 | /* |
4168 | * Test configuration for debugging | |
4169 | * | |
4170 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
4171 | * enum controls. | |
4172 | */ | |
4173 | #ifdef CONFIG_SND_DEBUG | |
4174 | static hda_nid_t alc880_test_dac_nids[4] = { | |
4175 | 0x02, 0x03, 0x04, 0x05 | |
4176 | }; | |
4177 | ||
4178 | static struct hda_input_mux alc880_test_capture_source = { | |
ae6b813a | 4179 | .num_items = 7, |
2fa522be TI |
4180 | .items = { |
4181 | { "In-1", 0x0 }, | |
4182 | { "In-2", 0x1 }, | |
4183 | { "In-3", 0x2 }, | |
4184 | { "In-4", 0x3 }, | |
4185 | { "CD", 0x4 }, | |
ae6b813a TI |
4186 | { "Front", 0x5 }, |
4187 | { "Surround", 0x6 }, | |
2fa522be TI |
4188 | }, |
4189 | }; | |
4190 | ||
d2a6d7dc | 4191 | static struct hda_channel_mode alc880_test_modes[4] = { |
2fa522be | 4192 | { 2, NULL }, |
fd2c326d | 4193 | { 4, NULL }, |
2fa522be | 4194 | { 6, NULL }, |
fd2c326d | 4195 | { 8, NULL }, |
2fa522be TI |
4196 | }; |
4197 | ||
9c7f852e TI |
4198 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
4199 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
4200 | { |
4201 | static char *texts[] = { | |
4202 | "N/A", "Line Out", "HP Out", | |
4203 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
4204 | }; | |
4205 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4206 | uinfo->count = 1; | |
4207 | uinfo->value.enumerated.items = 8; | |
4208 | if (uinfo->value.enumerated.item >= 8) | |
4209 | uinfo->value.enumerated.item = 7; | |
4210 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4211 | return 0; | |
4212 | } | |
4213 | ||
9c7f852e TI |
4214 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
4215 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4216 | { |
4217 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4218 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4219 | unsigned int pin_ctl, item = 0; | |
4220 | ||
4221 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
4222 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4223 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
4224 | if (pin_ctl & AC_PINCTL_HP_EN) | |
4225 | item = 2; | |
4226 | else | |
4227 | item = 1; | |
4228 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
4229 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
4230 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
4231 | case AC_PINCTL_VREF_50: item = 4; break; | |
4232 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
4233 | case AC_PINCTL_VREF_80: item = 6; break; | |
4234 | case AC_PINCTL_VREF_100: item = 7; break; | |
4235 | } | |
4236 | } | |
4237 | ucontrol->value.enumerated.item[0] = item; | |
4238 | return 0; | |
4239 | } | |
4240 | ||
9c7f852e TI |
4241 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
4242 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4243 | { |
4244 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4245 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4246 | static unsigned int ctls[] = { | |
4247 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
4248 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
4249 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
4250 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
4251 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
4252 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
4253 | }; | |
4254 | unsigned int old_ctl, new_ctl; | |
4255 | ||
4256 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
4257 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4258 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
4259 | if (old_ctl != new_ctl) { | |
82beb8fd TI |
4260 | int val; |
4261 | snd_hda_codec_write_cache(codec, nid, 0, | |
4262 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4263 | new_ctl); | |
47fd830a TI |
4264 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
4265 | HDA_AMP_MUTE : 0; | |
4266 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
4267 | HDA_AMP_MUTE, val); | |
2fa522be TI |
4268 | return 1; |
4269 | } | |
4270 | return 0; | |
4271 | } | |
4272 | ||
9c7f852e TI |
4273 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
4274 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
4275 | { |
4276 | static char *texts[] = { | |
4277 | "Front", "Surround", "CLFE", "Side" | |
4278 | }; | |
4279 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4280 | uinfo->count = 1; | |
4281 | uinfo->value.enumerated.items = 4; | |
4282 | if (uinfo->value.enumerated.item >= 4) | |
4283 | uinfo->value.enumerated.item = 3; | |
4284 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4285 | return 0; | |
4286 | } | |
4287 | ||
9c7f852e TI |
4288 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
4289 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4290 | { |
4291 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4292 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4293 | unsigned int sel; | |
4294 | ||
4295 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
4296 | ucontrol->value.enumerated.item[0] = sel & 3; | |
4297 | return 0; | |
4298 | } | |
4299 | ||
9c7f852e TI |
4300 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
4301 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4302 | { |
4303 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4304 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4305 | unsigned int sel; | |
4306 | ||
4307 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
4308 | if (ucontrol->value.enumerated.item[0] != sel) { | |
4309 | sel = ucontrol->value.enumerated.item[0] & 3; | |
82beb8fd TI |
4310 | snd_hda_codec_write_cache(codec, nid, 0, |
4311 | AC_VERB_SET_CONNECT_SEL, sel); | |
2fa522be TI |
4312 | return 1; |
4313 | } | |
4314 | return 0; | |
4315 | } | |
4316 | ||
4317 | #define PIN_CTL_TEST(xname,nid) { \ | |
4318 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4319 | .name = xname, \ | |
5b0cb1d8 | 4320 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
2fa522be TI |
4321 | .info = alc_test_pin_ctl_info, \ |
4322 | .get = alc_test_pin_ctl_get, \ | |
4323 | .put = alc_test_pin_ctl_put, \ | |
4324 | .private_value = nid \ | |
4325 | } | |
4326 | ||
4327 | #define PIN_SRC_TEST(xname,nid) { \ | |
4328 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4329 | .name = xname, \ | |
5b0cb1d8 | 4330 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
2fa522be TI |
4331 | .info = alc_test_pin_src_info, \ |
4332 | .get = alc_test_pin_src_get, \ | |
4333 | .put = alc_test_pin_src_put, \ | |
4334 | .private_value = nid \ | |
4335 | } | |
4336 | ||
c8b6bf9b | 4337 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
05acb863 TI |
4338 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
4339 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
4340 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
4341 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
985be54b TI |
4342 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
4343 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
4344 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
4345 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2fa522be TI |
4346 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
4347 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
4348 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
4349 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
4350 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
4351 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
4352 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
4353 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
4354 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
4355 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
4356 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
4357 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
4358 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4359 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4360 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
4361 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
4362 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
4363 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
4364 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
4365 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
4366 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
4367 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
2fa522be TI |
4368 | { |
4369 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4370 | .name = "Channel Mode", | |
df694daa KY |
4371 | .info = alc_ch_mode_info, |
4372 | .get = alc_ch_mode_get, | |
4373 | .put = alc_ch_mode_put, | |
2fa522be TI |
4374 | }, |
4375 | { } /* end */ | |
4376 | }; | |
4377 | ||
4378 | static struct hda_verb alc880_test_init_verbs[] = { | |
4379 | /* Unmute inputs of 0x0c - 0x0f */ | |
05acb863 TI |
4380 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4382 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4383 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4384 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4385 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4386 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4387 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2fa522be | 4388 | /* Vol output for 0x0c-0x0f */ |
05acb863 TI |
4389 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
4390 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4391 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4392 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2fa522be | 4393 | /* Set output pins 0x14-0x17 */ |
05acb863 TI |
4394 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
4395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4396 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4397 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2fa522be | 4398 | /* Unmute output pins 0x14-0x17 */ |
05acb863 TI |
4399 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
4400 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4401 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4402 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2fa522be | 4403 | /* Set input pins 0x18-0x1c */ |
16ded525 TI |
4404 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
4405 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
05acb863 TI |
4406 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
4407 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4408 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2fa522be | 4409 | /* Mute input pins 0x18-0x1b */ |
05acb863 TI |
4410 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4411 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4412 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4413 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
71fe7b82 | 4414 | /* ADC set up */ |
05acb863 | 4415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4416 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 4417 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4418 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 4419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4420 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
4421 | /* Analog input/passthru */ |
4422 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4423 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4424 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4425 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4426 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2fa522be TI |
4427 | { } |
4428 | }; | |
4429 | #endif | |
4430 | ||
1da177e4 LT |
4431 | /* |
4432 | */ | |
4433 | ||
f5fcc13c TI |
4434 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
4435 | [ALC880_3ST] = "3stack", | |
4436 | [ALC880_TCL_S700] = "tcl", | |
4437 | [ALC880_3ST_DIG] = "3stack-digout", | |
4438 | [ALC880_CLEVO] = "clevo", | |
4439 | [ALC880_5ST] = "5stack", | |
4440 | [ALC880_5ST_DIG] = "5stack-digout", | |
4441 | [ALC880_W810] = "w810", | |
4442 | [ALC880_Z71V] = "z71v", | |
4443 | [ALC880_6ST] = "6stack", | |
4444 | [ALC880_6ST_DIG] = "6stack-digout", | |
4445 | [ALC880_ASUS] = "asus", | |
4446 | [ALC880_ASUS_W1V] = "asus-w1v", | |
4447 | [ALC880_ASUS_DIG] = "asus-dig", | |
4448 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
4449 | [ALC880_UNIWILL_DIG] = "uniwill", | |
2cf9f0fc TD |
4450 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
4451 | [ALC880_FUJITSU] = "fujitsu", | |
f5fcc13c TI |
4452 | [ALC880_F1734] = "F1734", |
4453 | [ALC880_LG] = "lg", | |
4454 | [ALC880_LG_LW] = "lg-lw", | |
df99cd33 | 4455 | [ALC880_MEDION_RIM] = "medion", |
2fa522be | 4456 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 4457 | [ALC880_TEST] = "test", |
2fa522be | 4458 | #endif |
f5fcc13c TI |
4459 | [ALC880_AUTO] = "auto", |
4460 | }; | |
4461 | ||
4462 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
ac3e3741 | 4463 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
f5fcc13c TI |
4464 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
4465 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
4466 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
4467 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
4468 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
4469 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
4470 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
4471 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
f5fcc13c TI |
4472 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
4473 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
f5fcc13c TI |
4474 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
4475 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
4476 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
4477 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
4478 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
4479 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
4480 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
4481 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
4482 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
4483 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
186c3117 | 4484 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
f5fcc13c TI |
4485 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
4486 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
4487 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
dea0a509 | 4488 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
f5fcc13c | 4489 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
ac3e3741 TI |
4490 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
4491 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
4492 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
4493 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
4494 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
4495 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
4496 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
4497 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
ac3e3741 TI |
4498 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
4499 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
f5fcc13c | 4500 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
ac3e3741 | 4501 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
f5fcc13c | 4502 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
ac3e3741 | 4503 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
f5fcc13c TI |
4504 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
4505 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
ac3e3741 | 4506 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
df99cd33 | 4507 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
ac3e3741 | 4508 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
f5fcc13c | 4509 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
f5fcc13c | 4510 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
1d11604e | 4511 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
3353541f | 4512 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
2cf9f0fc | 4513 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
ac3e3741 | 4514 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
f5fcc13c TI |
4515 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
4516 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
f5fcc13c | 4517 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
ac3e3741 TI |
4518 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
4519 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
4520 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
4521 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
f5fcc13c TI |
4522 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
4523 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 | 4524 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
f5fcc13c | 4525 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
ac3e3741 TI |
4526 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
4527 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
f5fcc13c TI |
4528 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
4529 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
4530 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
dea0a509 TI |
4531 | /* default Intel */ |
4532 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), | |
ac3e3741 TI |
4533 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
4534 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
1da177e4 LT |
4535 | {} |
4536 | }; | |
4537 | ||
16ded525 | 4538 | /* |
df694daa | 4539 | * ALC880 codec presets |
16ded525 | 4540 | */ |
16ded525 TI |
4541 | static struct alc_config_preset alc880_presets[] = { |
4542 | [ALC880_3ST] = { | |
e9edcee0 | 4543 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
4544 | .init_verbs = { alc880_volume_init_verbs, |
4545 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 4546 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 | 4547 | .dac_nids = alc880_dac_nids, |
16ded525 TI |
4548 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
4549 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4550 | .need_dac_fix = 1, |
16ded525 TI |
4551 | .input_mux = &alc880_capture_source, |
4552 | }, | |
4553 | [ALC880_3ST_DIG] = { | |
e9edcee0 | 4554 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
4555 | .init_verbs = { alc880_volume_init_verbs, |
4556 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 4557 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 TI |
4558 | .dac_nids = alc880_dac_nids, |
4559 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4560 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
4561 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4562 | .need_dac_fix = 1, |
16ded525 TI |
4563 | .input_mux = &alc880_capture_source, |
4564 | }, | |
df694daa KY |
4565 | [ALC880_TCL_S700] = { |
4566 | .mixers = { alc880_tcl_s700_mixer }, | |
4567 | .init_verbs = { alc880_volume_init_verbs, | |
4568 | alc880_pin_tcl_S700_init_verbs, | |
4569 | alc880_gpio2_init_verbs }, | |
4570 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4571 | .dac_nids = alc880_dac_nids, | |
f9e336f6 TI |
4572 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
4573 | .num_adc_nids = 1, /* single ADC */ | |
df694daa KY |
4574 | .hp_nid = 0x03, |
4575 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4576 | .channel_mode = alc880_2_jack_modes, | |
4577 | .input_mux = &alc880_capture_source, | |
4578 | }, | |
16ded525 | 4579 | [ALC880_5ST] = { |
f12ab1e0 TI |
4580 | .mixers = { alc880_three_stack_mixer, |
4581 | alc880_five_stack_mixer}, | |
4582 | .init_verbs = { alc880_volume_init_verbs, | |
4583 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
4584 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
4585 | .dac_nids = alc880_dac_nids, | |
16ded525 TI |
4586 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
4587 | .channel_mode = alc880_fivestack_modes, | |
4588 | .input_mux = &alc880_capture_source, | |
4589 | }, | |
4590 | [ALC880_5ST_DIG] = { | |
f12ab1e0 TI |
4591 | .mixers = { alc880_three_stack_mixer, |
4592 | alc880_five_stack_mixer }, | |
4593 | .init_verbs = { alc880_volume_init_verbs, | |
4594 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
4595 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
4596 | .dac_nids = alc880_dac_nids, | |
4597 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4598 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
4599 | .channel_mode = alc880_fivestack_modes, | |
4600 | .input_mux = &alc880_capture_source, | |
4601 | }, | |
b6482d48 TI |
4602 | [ALC880_6ST] = { |
4603 | .mixers = { alc880_six_stack_mixer }, | |
f12ab1e0 TI |
4604 | .init_verbs = { alc880_volume_init_verbs, |
4605 | alc880_pin_6stack_init_verbs }, | |
b6482d48 TI |
4606 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
4607 | .dac_nids = alc880_6st_dac_nids, | |
4608 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4609 | .channel_mode = alc880_sixstack_modes, | |
4610 | .input_mux = &alc880_6stack_capture_source, | |
4611 | }, | |
16ded525 | 4612 | [ALC880_6ST_DIG] = { |
e9edcee0 | 4613 | .mixers = { alc880_six_stack_mixer }, |
f12ab1e0 TI |
4614 | .init_verbs = { alc880_volume_init_verbs, |
4615 | alc880_pin_6stack_init_verbs }, | |
16ded525 TI |
4616 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
4617 | .dac_nids = alc880_6st_dac_nids, | |
4618 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4619 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
4620 | .channel_mode = alc880_sixstack_modes, | |
4621 | .input_mux = &alc880_6stack_capture_source, | |
4622 | }, | |
4623 | [ALC880_W810] = { | |
e9edcee0 | 4624 | .mixers = { alc880_w810_base_mixer }, |
f12ab1e0 TI |
4625 | .init_verbs = { alc880_volume_init_verbs, |
4626 | alc880_pin_w810_init_verbs, | |
b0af0de5 | 4627 | alc880_gpio2_init_verbs }, |
16ded525 TI |
4628 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
4629 | .dac_nids = alc880_w810_dac_nids, | |
4630 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4631 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
4632 | .channel_mode = alc880_w810_modes, | |
4633 | .input_mux = &alc880_capture_source, | |
4634 | }, | |
4635 | [ALC880_Z71V] = { | |
e9edcee0 | 4636 | .mixers = { alc880_z71v_mixer }, |
f12ab1e0 TI |
4637 | .init_verbs = { alc880_volume_init_verbs, |
4638 | alc880_pin_z71v_init_verbs }, | |
16ded525 TI |
4639 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
4640 | .dac_nids = alc880_z71v_dac_nids, | |
4641 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4642 | .hp_nid = 0x03, | |
e9edcee0 TI |
4643 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
4644 | .channel_mode = alc880_2_jack_modes, | |
16ded525 TI |
4645 | .input_mux = &alc880_capture_source, |
4646 | }, | |
4647 | [ALC880_F1734] = { | |
e9edcee0 | 4648 | .mixers = { alc880_f1734_mixer }, |
f12ab1e0 TI |
4649 | .init_verbs = { alc880_volume_init_verbs, |
4650 | alc880_pin_f1734_init_verbs }, | |
e9edcee0 TI |
4651 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
4652 | .dac_nids = alc880_f1734_dac_nids, | |
4653 | .hp_nid = 0x02, | |
4654 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4655 | .channel_mode = alc880_2_jack_modes, | |
937b4160 TI |
4656 | .input_mux = &alc880_f1734_capture_source, |
4657 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4658 | .setup = alc880_uniwill_p53_setup, |
4659 | .init_hook = alc_automute_amp, | |
16ded525 TI |
4660 | }, |
4661 | [ALC880_ASUS] = { | |
e9edcee0 | 4662 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
4663 | .init_verbs = { alc880_volume_init_verbs, |
4664 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4665 | alc880_gpio1_init_verbs }, |
4666 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4667 | .dac_nids = alc880_asus_dac_nids, | |
4668 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4669 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4670 | .need_dac_fix = 1, |
16ded525 TI |
4671 | .input_mux = &alc880_capture_source, |
4672 | }, | |
4673 | [ALC880_ASUS_DIG] = { | |
e9edcee0 | 4674 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
4675 | .init_verbs = { alc880_volume_init_verbs, |
4676 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4677 | alc880_gpio1_init_verbs }, |
4678 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4679 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4680 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4681 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4682 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4683 | .need_dac_fix = 1, |
16ded525 TI |
4684 | .input_mux = &alc880_capture_source, |
4685 | }, | |
df694daa KY |
4686 | [ALC880_ASUS_DIG2] = { |
4687 | .mixers = { alc880_asus_mixer }, | |
f12ab1e0 TI |
4688 | .init_verbs = { alc880_volume_init_verbs, |
4689 | alc880_pin_asus_init_verbs, | |
df694daa KY |
4690 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
4691 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4692 | .dac_nids = alc880_asus_dac_nids, | |
4693 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4694 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4695 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4696 | .need_dac_fix = 1, |
df694daa KY |
4697 | .input_mux = &alc880_capture_source, |
4698 | }, | |
16ded525 | 4699 | [ALC880_ASUS_W1V] = { |
e9edcee0 | 4700 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
f12ab1e0 TI |
4701 | .init_verbs = { alc880_volume_init_verbs, |
4702 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4703 | alc880_gpio1_init_verbs }, |
4704 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4705 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4706 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4707 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4708 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4709 | .need_dac_fix = 1, |
16ded525 TI |
4710 | .input_mux = &alc880_capture_source, |
4711 | }, | |
4712 | [ALC880_UNIWILL_DIG] = { | |
45bdd1c1 | 4713 | .mixers = { alc880_asus_mixer }, |
ccc656ce KY |
4714 | .init_verbs = { alc880_volume_init_verbs, |
4715 | alc880_pin_asus_init_verbs }, | |
e9edcee0 TI |
4716 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
4717 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4718 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4719 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4720 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4721 | .need_dac_fix = 1, |
16ded525 TI |
4722 | .input_mux = &alc880_capture_source, |
4723 | }, | |
ccc656ce KY |
4724 | [ALC880_UNIWILL] = { |
4725 | .mixers = { alc880_uniwill_mixer }, | |
4726 | .init_verbs = { alc880_volume_init_verbs, | |
4727 | alc880_uniwill_init_verbs }, | |
4728 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4729 | .dac_nids = alc880_asus_dac_nids, | |
4730 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4731 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4732 | .channel_mode = alc880_threestack_modes, | |
4733 | .need_dac_fix = 1, | |
4734 | .input_mux = &alc880_capture_source, | |
4735 | .unsol_event = alc880_uniwill_unsol_event, | |
4f5d1706 | 4736 | .setup = alc880_uniwill_setup, |
a9fd4f3f | 4737 | .init_hook = alc880_uniwill_init_hook, |
ccc656ce KY |
4738 | }, |
4739 | [ALC880_UNIWILL_P53] = { | |
4740 | .mixers = { alc880_uniwill_p53_mixer }, | |
4741 | .init_verbs = { alc880_volume_init_verbs, | |
4742 | alc880_uniwill_p53_init_verbs }, | |
4743 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4744 | .dac_nids = alc880_asus_dac_nids, | |
4745 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
2cf9f0fc TD |
4746 | .channel_mode = alc880_threestack_modes, |
4747 | .input_mux = &alc880_capture_source, | |
4748 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4749 | .setup = alc880_uniwill_p53_setup, |
4750 | .init_hook = alc_automute_amp, | |
2cf9f0fc TD |
4751 | }, |
4752 | [ALC880_FUJITSU] = { | |
45bdd1c1 | 4753 | .mixers = { alc880_fujitsu_mixer }, |
2cf9f0fc TD |
4754 | .init_verbs = { alc880_volume_init_verbs, |
4755 | alc880_uniwill_p53_init_verbs, | |
4756 | alc880_beep_init_verbs }, | |
4757 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4758 | .dac_nids = alc880_dac_nids, | |
d53d7d9e | 4759 | .dig_out_nid = ALC880_DIGOUT_NID, |
2cf9f0fc TD |
4760 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
4761 | .channel_mode = alc880_2_jack_modes, | |
ccc656ce KY |
4762 | .input_mux = &alc880_capture_source, |
4763 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4764 | .setup = alc880_uniwill_p53_setup, |
4765 | .init_hook = alc_automute_amp, | |
ccc656ce | 4766 | }, |
df694daa KY |
4767 | [ALC880_CLEVO] = { |
4768 | .mixers = { alc880_three_stack_mixer }, | |
4769 | .init_verbs = { alc880_volume_init_verbs, | |
4770 | alc880_pin_clevo_init_verbs }, | |
4771 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4772 | .dac_nids = alc880_dac_nids, | |
4773 | .hp_nid = 0x03, | |
4774 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4775 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4776 | .need_dac_fix = 1, |
df694daa KY |
4777 | .input_mux = &alc880_capture_source, |
4778 | }, | |
ae6b813a TI |
4779 | [ALC880_LG] = { |
4780 | .mixers = { alc880_lg_mixer }, | |
4781 | .init_verbs = { alc880_volume_init_verbs, | |
4782 | alc880_lg_init_verbs }, | |
4783 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
4784 | .dac_nids = alc880_lg_dac_nids, | |
4785 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4786 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
4787 | .channel_mode = alc880_lg_ch_modes, | |
4e195a7b | 4788 | .need_dac_fix = 1, |
ae6b813a | 4789 | .input_mux = &alc880_lg_capture_source, |
a9fd4f3f | 4790 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
4791 | .setup = alc880_lg_setup, |
4792 | .init_hook = alc_automute_amp, | |
cb53c626 TI |
4793 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4794 | .loopbacks = alc880_lg_loopbacks, | |
4795 | #endif | |
ae6b813a | 4796 | }, |
d681518a TI |
4797 | [ALC880_LG_LW] = { |
4798 | .mixers = { alc880_lg_lw_mixer }, | |
4799 | .init_verbs = { alc880_volume_init_verbs, | |
4800 | alc880_lg_lw_init_verbs }, | |
0a8c5da3 | 4801 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
d681518a TI |
4802 | .dac_nids = alc880_dac_nids, |
4803 | .dig_out_nid = ALC880_DIGOUT_NID, | |
0a8c5da3 CM |
4804 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
4805 | .channel_mode = alc880_lg_lw_modes, | |
d681518a | 4806 | .input_mux = &alc880_lg_lw_capture_source, |
a9fd4f3f | 4807 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
4808 | .setup = alc880_lg_lw_setup, |
4809 | .init_hook = alc_automute_amp, | |
d681518a | 4810 | }, |
df99cd33 TI |
4811 | [ALC880_MEDION_RIM] = { |
4812 | .mixers = { alc880_medion_rim_mixer }, | |
4813 | .init_verbs = { alc880_volume_init_verbs, | |
4814 | alc880_medion_rim_init_verbs, | |
4815 | alc_gpio2_init_verbs }, | |
4816 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4817 | .dac_nids = alc880_dac_nids, | |
4818 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4819 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4820 | .channel_mode = alc880_2_jack_modes, | |
4821 | .input_mux = &alc880_medion_rim_capture_source, | |
4822 | .unsol_event = alc880_medion_rim_unsol_event, | |
4f5d1706 TI |
4823 | .setup = alc880_medion_rim_setup, |
4824 | .init_hook = alc880_medion_rim_automute, | |
df99cd33 | 4825 | }, |
16ded525 TI |
4826 | #ifdef CONFIG_SND_DEBUG |
4827 | [ALC880_TEST] = { | |
e9edcee0 TI |
4828 | .mixers = { alc880_test_mixer }, |
4829 | .init_verbs = { alc880_test_init_verbs }, | |
16ded525 TI |
4830 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
4831 | .dac_nids = alc880_test_dac_nids, | |
4832 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4833 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
4834 | .channel_mode = alc880_test_modes, | |
4835 | .input_mux = &alc880_test_capture_source, | |
4836 | }, | |
4837 | #endif | |
4838 | }; | |
4839 | ||
e9edcee0 TI |
4840 | /* |
4841 | * Automatic parse of I/O pins from the BIOS configuration | |
4842 | */ | |
4843 | ||
e9edcee0 TI |
4844 | enum { |
4845 | ALC_CTL_WIDGET_VOL, | |
4846 | ALC_CTL_WIDGET_MUTE, | |
4847 | ALC_CTL_BIND_MUTE, | |
4848 | }; | |
c8b6bf9b | 4849 | static struct snd_kcontrol_new alc880_control_templates[] = { |
e9edcee0 TI |
4850 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
4851 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
985be54b | 4852 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
e9edcee0 TI |
4853 | }; |
4854 | ||
4855 | /* add dynamic controls */ | |
f12ab1e0 | 4856 | static int add_control(struct alc_spec *spec, int type, const char *name, |
66ceeb6b | 4857 | int cidx, unsigned long val) |
e9edcee0 | 4858 | { |
c8b6bf9b | 4859 | struct snd_kcontrol_new *knew; |
e9edcee0 | 4860 | |
603c4019 TI |
4861 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
4862 | knew = snd_array_new(&spec->kctls); | |
4863 | if (!knew) | |
4864 | return -ENOMEM; | |
e9edcee0 | 4865 | *knew = alc880_control_templates[type]; |
543537bd | 4866 | knew->name = kstrdup(name, GFP_KERNEL); |
f12ab1e0 | 4867 | if (!knew->name) |
e9edcee0 | 4868 | return -ENOMEM; |
66ceeb6b | 4869 | knew->index = cidx; |
4d02d1b6 | 4870 | if (get_amp_nid_(val)) |
5e26dfd0 | 4871 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
e9edcee0 | 4872 | knew->private_value = val; |
e9edcee0 TI |
4873 | return 0; |
4874 | } | |
4875 | ||
0afe5f89 TI |
4876 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
4877 | const char *pfx, const char *dir, | |
66ceeb6b | 4878 | const char *sfx, int cidx, unsigned long val) |
0afe5f89 TI |
4879 | { |
4880 | char name[32]; | |
4881 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); | |
66ceeb6b | 4882 | return add_control(spec, type, name, cidx, val); |
0afe5f89 TI |
4883 | } |
4884 | ||
66ceeb6b TI |
4885 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
4886 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) | |
4887 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ | |
4888 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) | |
4889 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ | |
4890 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) | |
4891 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ | |
4892 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) | |
0afe5f89 | 4893 | |
e9edcee0 TI |
4894 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
4895 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
4896 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
4897 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
e9edcee0 TI |
4898 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
4899 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
4900 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
4901 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
4902 | #define ALC880_PIN_CD_NID 0x1c | |
4903 | ||
4904 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
4905 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
4906 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
4907 | { |
4908 | hda_nid_t nid; | |
4909 | int assigned[4]; | |
4910 | int i, j; | |
4911 | ||
4912 | memset(assigned, 0, sizeof(assigned)); | |
b0af0de5 | 4913 | spec->multiout.dac_nids = spec->private_dac_nids; |
e9edcee0 TI |
4914 | |
4915 | /* check the pins hardwired to audio widget */ | |
4916 | for (i = 0; i < cfg->line_outs; i++) { | |
4917 | nid = cfg->line_out_pins[i]; | |
4918 | if (alc880_is_fixed_pin(nid)) { | |
4919 | int idx = alc880_fixed_pin_idx(nid); | |
5014f193 | 4920 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
e9edcee0 TI |
4921 | assigned[idx] = 1; |
4922 | } | |
4923 | } | |
4924 | /* left pins can be connect to any audio widget */ | |
4925 | for (i = 0; i < cfg->line_outs; i++) { | |
4926 | nid = cfg->line_out_pins[i]; | |
4927 | if (alc880_is_fixed_pin(nid)) | |
4928 | continue; | |
4929 | /* search for an empty channel */ | |
4930 | for (j = 0; j < cfg->line_outs; j++) { | |
f12ab1e0 TI |
4931 | if (!assigned[j]) { |
4932 | spec->multiout.dac_nids[i] = | |
4933 | alc880_idx_to_dac(j); | |
e9edcee0 TI |
4934 | assigned[j] = 1; |
4935 | break; | |
4936 | } | |
4937 | } | |
4938 | } | |
4939 | spec->multiout.num_dacs = cfg->line_outs; | |
4940 | return 0; | |
4941 | } | |
4942 | ||
4943 | /* add playback controls from the parsed DAC table */ | |
df694daa KY |
4944 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
4945 | const struct auto_pin_cfg *cfg) | |
e9edcee0 | 4946 | { |
f12ab1e0 TI |
4947 | static const char *chname[4] = { |
4948 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
4949 | }; | |
e9edcee0 TI |
4950 | hda_nid_t nid; |
4951 | int i, err; | |
4952 | ||
4953 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 4954 | if (!spec->multiout.dac_nids[i]) |
e9edcee0 TI |
4955 | continue; |
4956 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
4957 | if (i == 2) { | |
4958 | /* Center/LFE */ | |
0afe5f89 TI |
4959 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
4960 | "Center", | |
f12ab1e0 TI |
4961 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
4962 | HDA_OUTPUT)); | |
4963 | if (err < 0) | |
e9edcee0 | 4964 | return err; |
0afe5f89 TI |
4965 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
4966 | "LFE", | |
f12ab1e0 TI |
4967 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
4968 | HDA_OUTPUT)); | |
4969 | if (err < 0) | |
e9edcee0 | 4970 | return err; |
0afe5f89 TI |
4971 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
4972 | "Center", | |
f12ab1e0 TI |
4973 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
4974 | HDA_INPUT)); | |
4975 | if (err < 0) | |
e9edcee0 | 4976 | return err; |
0afe5f89 TI |
4977 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
4978 | "LFE", | |
f12ab1e0 TI |
4979 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
4980 | HDA_INPUT)); | |
4981 | if (err < 0) | |
e9edcee0 TI |
4982 | return err; |
4983 | } else { | |
cb162b6b TI |
4984 | const char *pfx; |
4985 | if (cfg->line_outs == 1 && | |
4986 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
4987 | pfx = "Speaker"; | |
4988 | else | |
4989 | pfx = chname[i]; | |
0afe5f89 | 4990 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
4991 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
4992 | HDA_OUTPUT)); | |
4993 | if (err < 0) | |
e9edcee0 | 4994 | return err; |
0afe5f89 | 4995 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
4996 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
4997 | HDA_INPUT)); | |
4998 | if (err < 0) | |
e9edcee0 TI |
4999 | return err; |
5000 | } | |
5001 | } | |
e9edcee0 TI |
5002 | return 0; |
5003 | } | |
5004 | ||
8d88bc3d TI |
5005 | /* add playback controls for speaker and HP outputs */ |
5006 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
5007 | const char *pfx) | |
e9edcee0 TI |
5008 | { |
5009 | hda_nid_t nid; | |
5010 | int err; | |
5011 | ||
f12ab1e0 | 5012 | if (!pin) |
e9edcee0 TI |
5013 | return 0; |
5014 | ||
5015 | if (alc880_is_fixed_pin(pin)) { | |
5016 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
82bc955f | 5017 | /* specify the DAC as the extra output */ |
f12ab1e0 | 5018 | if (!spec->multiout.hp_nid) |
e9edcee0 | 5019 | spec->multiout.hp_nid = nid; |
82bc955f TI |
5020 | else |
5021 | spec->multiout.extra_out_nid[0] = nid; | |
e9edcee0 TI |
5022 | /* control HP volume/switch on the output mixer amp */ |
5023 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
0afe5f89 | 5024 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
5025 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
5026 | if (err < 0) | |
e9edcee0 | 5027 | return err; |
0afe5f89 | 5028 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
5029 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
5030 | if (err < 0) | |
e9edcee0 TI |
5031 | return err; |
5032 | } else if (alc880_is_multi_pin(pin)) { | |
5033 | /* set manual connection */ | |
e9edcee0 | 5034 | /* we have only a switch on HP-out PIN */ |
0afe5f89 | 5035 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
f12ab1e0 TI |
5036 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
5037 | if (err < 0) | |
e9edcee0 TI |
5038 | return err; |
5039 | } | |
5040 | return 0; | |
5041 | } | |
5042 | ||
5043 | /* create input playback/capture controls for the given pin */ | |
f12ab1e0 | 5044 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
66ceeb6b | 5045 | const char *ctlname, int ctlidx, |
df694daa | 5046 | int idx, hda_nid_t mix_nid) |
e9edcee0 | 5047 | { |
df694daa | 5048 | int err; |
e9edcee0 | 5049 | |
66ceeb6b | 5050 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
f12ab1e0 TI |
5051 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
5052 | if (err < 0) | |
e9edcee0 | 5053 | return err; |
66ceeb6b | 5054 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
f12ab1e0 TI |
5055 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
5056 | if (err < 0) | |
e9edcee0 TI |
5057 | return err; |
5058 | return 0; | |
5059 | } | |
5060 | ||
05f5f477 TI |
5061 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
5062 | { | |
5063 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | |
5064 | return (pincap & AC_PINCAP_IN) != 0; | |
5065 | } | |
5066 | ||
e9edcee0 | 5067 | /* create playback/capture controls for input pins */ |
05f5f477 TI |
5068 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
5069 | const struct auto_pin_cfg *cfg, | |
5070 | hda_nid_t mixer, | |
5071 | hda_nid_t cap1, hda_nid_t cap2) | |
e9edcee0 | 5072 | { |
05f5f477 | 5073 | struct alc_spec *spec = codec->spec; |
61b9b9b1 | 5074 | struct hda_input_mux *imux = &spec->private_imux[0]; |
66ceeb6b | 5075 | int i, err, idx, type, type_idx = 0; |
e9edcee0 | 5076 | |
66ceeb6b | 5077 | for (i = 0; i < cfg->num_inputs; i++) { |
05f5f477 | 5078 | hda_nid_t pin; |
10a20af7 | 5079 | const char *label; |
05f5f477 | 5080 | |
66ceeb6b | 5081 | pin = cfg->inputs[i].pin; |
05f5f477 TI |
5082 | if (!alc_is_input_pin(codec, pin)) |
5083 | continue; | |
5084 | ||
66ceeb6b TI |
5085 | type = cfg->inputs[i].type; |
5086 | if (i > 0 && type == cfg->inputs[i - 1].type) | |
5087 | type_idx++; | |
5088 | else | |
5089 | type_idx = 0; | |
10a20af7 | 5090 | label = hda_get_autocfg_input_label(codec, cfg, i); |
05f5f477 TI |
5091 | if (mixer) { |
5092 | idx = get_connection_index(codec, mixer, pin); | |
5093 | if (idx >= 0) { | |
5094 | err = new_analog_input(spec, pin, | |
10a20af7 TI |
5095 | label, type_idx, |
5096 | idx, mixer); | |
05f5f477 TI |
5097 | if (err < 0) |
5098 | return err; | |
5099 | } | |
5100 | } | |
5101 | ||
5102 | if (!cap1) | |
5103 | continue; | |
5104 | idx = get_connection_index(codec, cap1, pin); | |
5105 | if (idx < 0 && cap2) | |
5106 | idx = get_connection_index(codec, cap2, pin); | |
10a20af7 TI |
5107 | if (idx >= 0) |
5108 | snd_hda_add_imux_item(imux, label, idx, NULL); | |
e9edcee0 TI |
5109 | } |
5110 | return 0; | |
5111 | } | |
5112 | ||
05f5f477 TI |
5113 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
5114 | const struct auto_pin_cfg *cfg) | |
5115 | { | |
5116 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | |
5117 | } | |
5118 | ||
f6c7e546 TI |
5119 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
5120 | unsigned int pin_type) | |
5121 | { | |
5122 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5123 | pin_type); | |
5124 | /* unmute pin */ | |
d260cdf6 TI |
5125 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
5126 | AMP_OUT_UNMUTE); | |
f6c7e546 TI |
5127 | } |
5128 | ||
df694daa KY |
5129 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
5130 | hda_nid_t nid, int pin_type, | |
e9edcee0 TI |
5131 | int dac_idx) |
5132 | { | |
f6c7e546 | 5133 | alc_set_pin_output(codec, nid, pin_type); |
e9edcee0 TI |
5134 | /* need the manual connection? */ |
5135 | if (alc880_is_multi_pin(nid)) { | |
5136 | struct alc_spec *spec = codec->spec; | |
5137 | int idx = alc880_multi_pin_idx(nid); | |
5138 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
5139 | AC_VERB_SET_CONNECT_SEL, | |
5140 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
5141 | } | |
5142 | } | |
5143 | ||
baba8ee9 TI |
5144 | static int get_pin_type(int line_out_type) |
5145 | { | |
5146 | if (line_out_type == AUTO_PIN_HP_OUT) | |
5147 | return PIN_HP; | |
5148 | else | |
5149 | return PIN_OUT; | |
5150 | } | |
5151 | ||
e9edcee0 TI |
5152 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
5153 | { | |
5154 | struct alc_spec *spec = codec->spec; | |
5155 | int i; | |
ea1fb29a | 5156 | |
e9edcee0 TI |
5157 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
5158 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 TI |
5159 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
5160 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
e9edcee0 TI |
5161 | } |
5162 | } | |
5163 | ||
8d88bc3d | 5164 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
e9edcee0 TI |
5165 | { |
5166 | struct alc_spec *spec = codec->spec; | |
5167 | hda_nid_t pin; | |
5168 | ||
82bc955f | 5169 | pin = spec->autocfg.speaker_pins[0]; |
8d88bc3d TI |
5170 | if (pin) /* connect to front */ |
5171 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
eb06ed8f | 5172 | pin = spec->autocfg.hp_pins[0]; |
e9edcee0 TI |
5173 | if (pin) /* connect to front */ |
5174 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
5175 | } | |
5176 | ||
5177 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
5178 | { | |
5179 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5180 | struct auto_pin_cfg *cfg = &spec->autocfg; |
e9edcee0 TI |
5181 | int i; |
5182 | ||
66ceeb6b TI |
5183 | for (i = 0; i < cfg->num_inputs; i++) { |
5184 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 5185 | if (alc_is_input_pin(codec, nid)) { |
30ea098f | 5186 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
e82c025b TI |
5187 | if (nid != ALC880_PIN_CD_NID && |
5188 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f12ab1e0 TI |
5189 | snd_hda_codec_write(codec, nid, 0, |
5190 | AC_VERB_SET_AMP_GAIN_MUTE, | |
e9edcee0 TI |
5191 | AMP_OUT_MUTE); |
5192 | } | |
5193 | } | |
5194 | } | |
5195 | ||
7f311a46 TI |
5196 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
5197 | { | |
5198 | struct alc_spec *spec = codec->spec; | |
5199 | int c; | |
5200 | ||
5201 | for (c = 0; c < spec->num_adc_nids; c++) { | |
5202 | unsigned int mux_idx; | |
5203 | const struct hda_input_mux *imux; | |
5204 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
5205 | imux = &spec->input_mux[mux_idx]; | |
5206 | if (!imux->num_items && mux_idx > 0) | |
5207 | imux = &spec->input_mux[0]; | |
5208 | if (imux) | |
5209 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, | |
5210 | AC_VERB_SET_CONNECT_SEL, | |
5211 | imux->items[0].index); | |
5212 | } | |
5213 | } | |
5214 | ||
e9edcee0 | 5215 | /* parse the BIOS configuration and set up the alc_spec */ |
f12ab1e0 TI |
5216 | /* return 1 if successful, 0 if the proper config is not found, |
5217 | * or a negative error code | |
5218 | */ | |
e9edcee0 TI |
5219 | static int alc880_parse_auto_config(struct hda_codec *codec) |
5220 | { | |
5221 | struct alc_spec *spec = codec->spec; | |
757899ac | 5222 | int err; |
df694daa | 5223 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
e9edcee0 | 5224 | |
f12ab1e0 TI |
5225 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
5226 | alc880_ignore); | |
5227 | if (err < 0) | |
e9edcee0 | 5228 | return err; |
f12ab1e0 | 5229 | if (!spec->autocfg.line_outs) |
e9edcee0 | 5230 | return 0; /* can't find valid BIOS pin config */ |
df694daa | 5231 | |
f12ab1e0 TI |
5232 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
5233 | if (err < 0) | |
5234 | return err; | |
5235 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
5236 | if (err < 0) | |
5237 | return err; | |
5238 | err = alc880_auto_create_extra_out(spec, | |
5239 | spec->autocfg.speaker_pins[0], | |
5240 | "Speaker"); | |
5241 | if (err < 0) | |
5242 | return err; | |
5243 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
5244 | "Headphone"); | |
5245 | if (err < 0) | |
5246 | return err; | |
05f5f477 | 5247 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 5248 | if (err < 0) |
e9edcee0 TI |
5249 | return err; |
5250 | ||
5251 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
5252 | ||
757899ac | 5253 | alc_auto_parse_digital(codec); |
e9edcee0 | 5254 | |
603c4019 | 5255 | if (spec->kctls.list) |
d88897ea | 5256 | add_mixer(spec, spec->kctls.list); |
e9edcee0 | 5257 | |
d88897ea | 5258 | add_verb(spec, alc880_volume_init_verbs); |
e9edcee0 | 5259 | |
a1e8d2da | 5260 | spec->num_mux_defs = 1; |
61b9b9b1 | 5261 | spec->input_mux = &spec->private_imux[0]; |
e9edcee0 | 5262 | |
6227cdce | 5263 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 5264 | |
e9edcee0 TI |
5265 | return 1; |
5266 | } | |
5267 | ||
ae6b813a TI |
5268 | /* additional initialization for auto-configuration model */ |
5269 | static void alc880_auto_init(struct hda_codec *codec) | |
e9edcee0 | 5270 | { |
f6c7e546 | 5271 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 5272 | alc880_auto_init_multi_out(codec); |
8d88bc3d | 5273 | alc880_auto_init_extra_out(codec); |
e9edcee0 | 5274 | alc880_auto_init_analog_input(codec); |
7f311a46 | 5275 | alc880_auto_init_input_src(codec); |
757899ac | 5276 | alc_auto_init_digital(codec); |
f6c7e546 | 5277 | if (spec->unsol_event) |
7fb0d78f | 5278 | alc_inithook(codec); |
e9edcee0 TI |
5279 | } |
5280 | ||
b59bdf3b TI |
5281 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
5282 | * one of two digital mic pins, e.g. on ALC272 | |
5283 | */ | |
5284 | static void fixup_automic_adc(struct hda_codec *codec) | |
5285 | { | |
5286 | struct alc_spec *spec = codec->spec; | |
5287 | int i; | |
5288 | ||
5289 | for (i = 0; i < spec->num_adc_nids; i++) { | |
5290 | hda_nid_t cap = spec->capsrc_nids ? | |
5291 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5292 | int iidx, eidx; | |
5293 | ||
5294 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | |
5295 | if (iidx < 0) | |
5296 | continue; | |
5297 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | |
5298 | if (eidx < 0) | |
5299 | continue; | |
5300 | spec->int_mic.mux_idx = iidx; | |
5301 | spec->ext_mic.mux_idx = eidx; | |
5302 | if (spec->capsrc_nids) | |
5303 | spec->capsrc_nids += i; | |
5304 | spec->adc_nids += i; | |
5305 | spec->num_adc_nids = 1; | |
5306 | return; | |
5307 | } | |
5308 | snd_printd(KERN_INFO "hda_codec: %s: " | |
5309 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | |
5310 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | |
5311 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | |
5312 | } | |
5313 | ||
748cce43 TI |
5314 | /* select or unmute the given capsrc route */ |
5315 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, | |
5316 | int idx) | |
5317 | { | |
5318 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | |
5319 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | |
5320 | HDA_AMP_MUTE, 0); | |
5321 | } else { | |
5322 | snd_hda_codec_write_cache(codec, cap, 0, | |
5323 | AC_VERB_SET_CONNECT_SEL, idx); | |
5324 | } | |
5325 | } | |
5326 | ||
840b64c0 TI |
5327 | /* set the default connection to that pin */ |
5328 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |
eaa9b3a7 TI |
5329 | { |
5330 | struct alc_spec *spec = codec->spec; | |
eaa9b3a7 TI |
5331 | int i; |
5332 | ||
eaa9b3a7 TI |
5333 | for (i = 0; i < spec->num_adc_nids; i++) { |
5334 | hda_nid_t cap = spec->capsrc_nids ? | |
5335 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5336 | int idx; | |
5337 | ||
5338 | idx = get_connection_index(codec, cap, pin); | |
5339 | if (idx < 0) | |
5340 | continue; | |
748cce43 | 5341 | select_or_unmute_capsrc(codec, cap, idx); |
840b64c0 TI |
5342 | return i; /* return the found index */ |
5343 | } | |
5344 | return -1; /* not found */ | |
5345 | } | |
5346 | ||
5347 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | |
5348 | static void fixup_single_adc(struct hda_codec *codec) | |
5349 | { | |
5350 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5351 | struct auto_pin_cfg *cfg = &spec->autocfg; |
840b64c0 TI |
5352 | int i; |
5353 | ||
5354 | /* search for the input pin; there must be only one */ | |
66ceeb6b | 5355 | if (cfg->num_inputs != 1) |
eaa9b3a7 | 5356 | return; |
66ceeb6b | 5357 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
840b64c0 TI |
5358 | if (i >= 0) { |
5359 | /* use only this ADC */ | |
5360 | if (spec->capsrc_nids) | |
5361 | spec->capsrc_nids += i; | |
5362 | spec->adc_nids += i; | |
5363 | spec->num_adc_nids = 1; | |
eaa9b3a7 TI |
5364 | } |
5365 | } | |
5366 | ||
840b64c0 TI |
5367 | /* initialize dual adcs */ |
5368 | static void fixup_dual_adc_switch(struct hda_codec *codec) | |
5369 | { | |
5370 | struct alc_spec *spec = codec->spec; | |
5371 | init_capsrc_for_pin(codec, spec->ext_mic.pin); | |
5372 | init_capsrc_for_pin(codec, spec->int_mic.pin); | |
5373 | } | |
5374 | ||
b59bdf3b | 5375 | static void set_capture_mixer(struct hda_codec *codec) |
f9e336f6 | 5376 | { |
b59bdf3b | 5377 | struct alc_spec *spec = codec->spec; |
a23b688f TI |
5378 | static struct snd_kcontrol_new *caps[2][3] = { |
5379 | { alc_capture_mixer_nosrc1, | |
5380 | alc_capture_mixer_nosrc2, | |
5381 | alc_capture_mixer_nosrc3 }, | |
5382 | { alc_capture_mixer1, | |
5383 | alc_capture_mixer2, | |
5384 | alc_capture_mixer3 }, | |
f9e336f6 | 5385 | }; |
a23b688f | 5386 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
eaa9b3a7 | 5387 | int mux = 0; |
840b64c0 TI |
5388 | int num_adcs = spec->num_adc_nids; |
5389 | if (spec->dual_adc_switch) | |
5390 | fixup_dual_adc_switch(codec); | |
5391 | else if (spec->auto_mic) | |
b59bdf3b | 5392 | fixup_automic_adc(codec); |
eaa9b3a7 TI |
5393 | else if (spec->input_mux) { |
5394 | if (spec->input_mux->num_items > 1) | |
5395 | mux = 1; | |
5396 | else if (spec->input_mux->num_items == 1) | |
5397 | fixup_single_adc(codec); | |
5398 | } | |
840b64c0 TI |
5399 | if (spec->dual_adc_switch) |
5400 | num_adcs = 1; | |
5401 | spec->cap_mixer = caps[mux][num_adcs - 1]; | |
a23b688f | 5402 | } |
f9e336f6 TI |
5403 | } |
5404 | ||
6694635d TI |
5405 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
5406 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | |
5407 | int num_nids) | |
5408 | { | |
5409 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5410 | struct auto_pin_cfg *cfg = &spec->autocfg; |
6694635d TI |
5411 | int n; |
5412 | hda_nid_t fallback_adc = 0, fallback_cap = 0; | |
5413 | ||
5414 | for (n = 0; n < num_nids; n++) { | |
5415 | hda_nid_t adc, cap; | |
5416 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
5417 | int nconns, i, j; | |
5418 | ||
5419 | adc = nids[n]; | |
5420 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) | |
5421 | continue; | |
5422 | cap = adc; | |
5423 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5424 | ARRAY_SIZE(conn)); | |
5425 | if (nconns == 1) { | |
5426 | cap = conn[0]; | |
5427 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5428 | ARRAY_SIZE(conn)); | |
5429 | } | |
5430 | if (nconns <= 0) | |
5431 | continue; | |
5432 | if (!fallback_adc) { | |
5433 | fallback_adc = adc; | |
5434 | fallback_cap = cap; | |
5435 | } | |
66ceeb6b TI |
5436 | for (i = 0; i < cfg->num_inputs; i++) { |
5437 | hda_nid_t nid = cfg->inputs[i].pin; | |
6694635d TI |
5438 | for (j = 0; j < nconns; j++) { |
5439 | if (conn[j] == nid) | |
5440 | break; | |
5441 | } | |
5442 | if (j >= nconns) | |
5443 | break; | |
5444 | } | |
66ceeb6b | 5445 | if (i >= cfg->num_inputs) { |
6694635d TI |
5446 | int num_adcs = spec->num_adc_nids; |
5447 | spec->private_adc_nids[num_adcs] = adc; | |
5448 | spec->private_capsrc_nids[num_adcs] = cap; | |
5449 | spec->num_adc_nids++; | |
5450 | spec->adc_nids = spec->private_adc_nids; | |
5451 | if (adc != cap) | |
5452 | spec->capsrc_nids = spec->private_capsrc_nids; | |
5453 | } | |
5454 | } | |
5455 | if (!spec->num_adc_nids) { | |
5456 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" | |
1f85d72d TI |
5457 | " using fallback 0x%x\n", |
5458 | codec->chip_name, fallback_adc); | |
6694635d TI |
5459 | spec->private_adc_nids[0] = fallback_adc; |
5460 | spec->adc_nids = spec->private_adc_nids; | |
5461 | if (fallback_adc != fallback_cap) { | |
5462 | spec->private_capsrc_nids[0] = fallback_cap; | |
5463 | spec->capsrc_nids = spec->private_adc_nids; | |
5464 | } | |
5465 | } | |
5466 | } | |
5467 | ||
67d634c0 | 5468 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
5469 | #define set_beep_amp(spec, nid, idx, dir) \ |
5470 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | |
dc1eae25 TI |
5471 | |
5472 | static struct snd_pci_quirk beep_white_list[] = { | |
5473 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), | |
080dc7bc | 5474 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
e096c8e6 | 5475 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
dc1eae25 TI |
5476 | {} |
5477 | }; | |
5478 | ||
5479 | static inline int has_cdefine_beep(struct hda_codec *codec) | |
5480 | { | |
5481 | struct alc_spec *spec = codec->spec; | |
5482 | const struct snd_pci_quirk *q; | |
5483 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); | |
5484 | if (q) | |
5485 | return q->value; | |
5486 | return spec->cdefine.enable_pcbeep; | |
5487 | } | |
67d634c0 TI |
5488 | #else |
5489 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | |
dc1eae25 | 5490 | #define has_cdefine_beep(codec) 0 |
67d634c0 | 5491 | #endif |
45bdd1c1 TI |
5492 | |
5493 | /* | |
5494 | * OK, here we have finally the patch for ALC880 | |
5495 | */ | |
5496 | ||
1da177e4 LT |
5497 | static int patch_alc880(struct hda_codec *codec) |
5498 | { | |
5499 | struct alc_spec *spec; | |
5500 | int board_config; | |
df694daa | 5501 | int err; |
1da177e4 | 5502 | |
e560d8d8 | 5503 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
5504 | if (spec == NULL) |
5505 | return -ENOMEM; | |
5506 | ||
5507 | codec->spec = spec; | |
5508 | ||
f5fcc13c TI |
5509 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
5510 | alc880_models, | |
5511 | alc880_cfg_tbl); | |
5512 | if (board_config < 0) { | |
9a11f1aa TI |
5513 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5514 | codec->chip_name); | |
e9edcee0 | 5515 | board_config = ALC880_AUTO; |
1da177e4 | 5516 | } |
1da177e4 | 5517 | |
e9edcee0 TI |
5518 | if (board_config == ALC880_AUTO) { |
5519 | /* automatic parse from the BIOS config */ | |
5520 | err = alc880_parse_auto_config(codec); | |
5521 | if (err < 0) { | |
5522 | alc_free(codec); | |
5523 | return err; | |
f12ab1e0 | 5524 | } else if (!err) { |
9c7f852e TI |
5525 | printk(KERN_INFO |
5526 | "hda_codec: Cannot set up configuration " | |
5527 | "from BIOS. Using 3-stack mode...\n"); | |
e9edcee0 TI |
5528 | board_config = ALC880_3ST; |
5529 | } | |
1da177e4 LT |
5530 | } |
5531 | ||
680cd536 KK |
5532 | err = snd_hda_attach_beep_device(codec, 0x1); |
5533 | if (err < 0) { | |
5534 | alc_free(codec); | |
5535 | return err; | |
5536 | } | |
5537 | ||
df694daa | 5538 | if (board_config != ALC880_AUTO) |
e9c364c0 | 5539 | setup_preset(codec, &alc880_presets[board_config]); |
1da177e4 | 5540 | |
1da177e4 LT |
5541 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
5542 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
6330079f | 5543 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
1da177e4 | 5544 | |
1da177e4 LT |
5545 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
5546 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
5547 | ||
f12ab1e0 | 5548 | if (!spec->adc_nids && spec->input_mux) { |
e9edcee0 | 5549 | /* check whether NID 0x07 is valid */ |
54d17403 | 5550 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
f12ab1e0 | 5551 | /* get type */ |
a22d543a | 5552 | wcap = get_wcaps_type(wcap); |
e9edcee0 TI |
5553 | if (wcap != AC_WID_AUD_IN) { |
5554 | spec->adc_nids = alc880_adc_nids_alt; | |
5555 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
e9edcee0 TI |
5556 | } else { |
5557 | spec->adc_nids = alc880_adc_nids; | |
5558 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
e9edcee0 TI |
5559 | } |
5560 | } | |
b59bdf3b | 5561 | set_capture_mixer(codec); |
45bdd1c1 | 5562 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
1da177e4 | 5563 | |
2134ea4f TI |
5564 | spec->vmaster_nid = 0x0c; |
5565 | ||
1da177e4 | 5566 | codec->patch_ops = alc_patch_ops; |
e9edcee0 | 5567 | if (board_config == ALC880_AUTO) |
ae6b813a | 5568 | spec->init_hook = alc880_auto_init; |
cb53c626 TI |
5569 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5570 | if (!spec->loopback.amplist) | |
5571 | spec->loopback.amplist = alc880_loopbacks; | |
5572 | #endif | |
1da177e4 LT |
5573 | |
5574 | return 0; | |
5575 | } | |
5576 | ||
e9edcee0 | 5577 | |
1da177e4 LT |
5578 | /* |
5579 | * ALC260 support | |
5580 | */ | |
5581 | ||
e9edcee0 TI |
5582 | static hda_nid_t alc260_dac_nids[1] = { |
5583 | /* front */ | |
5584 | 0x02, | |
5585 | }; | |
5586 | ||
5587 | static hda_nid_t alc260_adc_nids[1] = { | |
5588 | /* ADC0 */ | |
5589 | 0x04, | |
5590 | }; | |
5591 | ||
df694daa | 5592 | static hda_nid_t alc260_adc_nids_alt[1] = { |
e9edcee0 TI |
5593 | /* ADC1 */ |
5594 | 0x05, | |
5595 | }; | |
5596 | ||
d57fdac0 JW |
5597 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
5598 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
5599 | */ | |
5600 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
4c5186ed JW |
5601 | /* ADC0, ADC1 */ |
5602 | 0x04, 0x05 | |
5603 | }; | |
5604 | ||
e9edcee0 TI |
5605 | #define ALC260_DIGOUT_NID 0x03 |
5606 | #define ALC260_DIGIN_NID 0x06 | |
5607 | ||
5608 | static struct hda_input_mux alc260_capture_source = { | |
5609 | .num_items = 4, | |
5610 | .items = { | |
5611 | { "Mic", 0x0 }, | |
5612 | { "Front Mic", 0x1 }, | |
5613 | { "Line", 0x2 }, | |
5614 | { "CD", 0x4 }, | |
5615 | }, | |
5616 | }; | |
5617 | ||
17e7aec6 | 5618 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
a1e8d2da JW |
5619 | * headphone jack and the internal CD lines since these are the only pins at |
5620 | * which audio can appear. For flexibility, also allow the option of | |
5621 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
5622 | * connection to the mixer output). | |
a9430dd8 | 5623 | */ |
a1e8d2da JW |
5624 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
5625 | { | |
5626 | .num_items = 3, | |
5627 | .items = { | |
5628 | { "Mic/Line", 0x0 }, | |
5629 | { "CD", 0x4 }, | |
5630 | { "Headphone", 0x2 }, | |
5631 | }, | |
a9430dd8 | 5632 | }, |
a1e8d2da JW |
5633 | { |
5634 | .num_items = 4, | |
5635 | .items = { | |
5636 | { "Mic/Line", 0x0 }, | |
5637 | { "CD", 0x4 }, | |
5638 | { "Headphone", 0x2 }, | |
5639 | { "Mixer", 0x5 }, | |
5640 | }, | |
5641 | }, | |
5642 | ||
a9430dd8 JW |
5643 | }; |
5644 | ||
a1e8d2da JW |
5645 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
5646 | * the Fujitsu S702x, but jacks are marked differently. | |
0bfc90e9 | 5647 | */ |
a1e8d2da JW |
5648 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
5649 | { | |
5650 | .num_items = 4, | |
5651 | .items = { | |
5652 | { "Mic", 0x0 }, | |
5653 | { "Line", 0x2 }, | |
5654 | { "CD", 0x4 }, | |
5655 | { "Headphone", 0x5 }, | |
5656 | }, | |
5657 | }, | |
5658 | { | |
5659 | .num_items = 5, | |
5660 | .items = { | |
5661 | { "Mic", 0x0 }, | |
5662 | { "Line", 0x2 }, | |
5663 | { "CD", 0x4 }, | |
5664 | { "Headphone", 0x6 }, | |
5665 | { "Mixer", 0x5 }, | |
5666 | }, | |
0bfc90e9 JW |
5667 | }, |
5668 | }; | |
cc959489 MS |
5669 | |
5670 | /* Maxdata Favorit 100XS */ | |
5671 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { | |
5672 | { | |
5673 | .num_items = 2, | |
5674 | .items = { | |
5675 | { "Line/Mic", 0x0 }, | |
5676 | { "CD", 0x4 }, | |
5677 | }, | |
5678 | }, | |
5679 | { | |
5680 | .num_items = 3, | |
5681 | .items = { | |
5682 | { "Line/Mic", 0x0 }, | |
5683 | { "CD", 0x4 }, | |
5684 | { "Mixer", 0x5 }, | |
5685 | }, | |
5686 | }, | |
5687 | }; | |
5688 | ||
1da177e4 LT |
5689 | /* |
5690 | * This is just place-holder, so there's something for alc_build_pcms to look | |
5691 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
5692 | * element which allows changing the channel mode, so the verb list is | |
5693 | * never used. | |
5694 | */ | |
d2a6d7dc | 5695 | static struct hda_channel_mode alc260_modes[1] = { |
1da177e4 LT |
5696 | { 2, NULL }, |
5697 | }; | |
5698 | ||
df694daa KY |
5699 | |
5700 | /* Mixer combinations | |
5701 | * | |
5702 | * basic: base_output + input + pc_beep + capture | |
5703 | * HP: base_output + input + capture_alt | |
5704 | * HP_3013: hp_3013 + input + capture | |
5705 | * fujitsu: fujitsu + capture | |
0bfc90e9 | 5706 | * acer: acer + capture |
df694daa KY |
5707 | */ |
5708 | ||
5709 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
05acb863 | 5710 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 5711 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
05acb863 | 5712 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
985be54b | 5713 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
05acb863 | 5714 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
985be54b | 5715 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
1da177e4 | 5716 | { } /* end */ |
f12ab1e0 | 5717 | }; |
1da177e4 | 5718 | |
df694daa | 5719 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
16ded525 TI |
5720 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
5721 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5722 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5723 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5724 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5725 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5726 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
5727 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
df694daa KY |
5728 | { } /* end */ |
5729 | }; | |
5730 | ||
bec15c3a TI |
5731 | /* update HP, line and mono out pins according to the master switch */ |
5732 | static void alc260_hp_master_update(struct hda_codec *codec, | |
5733 | hda_nid_t hp, hda_nid_t line, | |
5734 | hda_nid_t mono) | |
5735 | { | |
5736 | struct alc_spec *spec = codec->spec; | |
5737 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
5738 | /* change HP and line-out pins */ | |
30cde0aa | 5739 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a | 5740 | val); |
30cde0aa | 5741 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a TI |
5742 | val); |
5743 | /* mono (speaker) depending on the HP jack sense */ | |
5744 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
30cde0aa | 5745 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a TI |
5746 | val); |
5747 | } | |
5748 | ||
5749 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
5750 | struct snd_ctl_elem_value *ucontrol) | |
5751 | { | |
5752 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5753 | struct alc_spec *spec = codec->spec; | |
5754 | *ucontrol->value.integer.value = spec->master_sw; | |
5755 | return 0; | |
5756 | } | |
5757 | ||
5758 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
5759 | struct snd_ctl_elem_value *ucontrol) | |
5760 | { | |
5761 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5762 | struct alc_spec *spec = codec->spec; | |
5763 | int val = !!*ucontrol->value.integer.value; | |
5764 | hda_nid_t hp, line, mono; | |
5765 | ||
5766 | if (val == spec->master_sw) | |
5767 | return 0; | |
5768 | spec->master_sw = val; | |
5769 | hp = (kcontrol->private_value >> 16) & 0xff; | |
5770 | line = (kcontrol->private_value >> 8) & 0xff; | |
5771 | mono = kcontrol->private_value & 0xff; | |
5772 | alc260_hp_master_update(codec, hp, line, mono); | |
5773 | return 1; | |
5774 | } | |
5775 | ||
5776 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
5777 | { | |
5778 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5779 | .name = "Master Playback Switch", | |
5b0cb1d8 | 5780 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
bec15c3a TI |
5781 | .info = snd_ctl_boolean_mono_info, |
5782 | .get = alc260_hp_master_sw_get, | |
5783 | .put = alc260_hp_master_sw_put, | |
5784 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
5785 | }, | |
5786 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5787 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
5788 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5789 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
5790 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
5791 | HDA_OUTPUT), | |
5792 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5793 | { } /* end */ | |
5794 | }; | |
5795 | ||
5796 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
5797 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5798 | {}, | |
5799 | }; | |
5800 | ||
5801 | static void alc260_hp_automute(struct hda_codec *codec) | |
5802 | { | |
5803 | struct alc_spec *spec = codec->spec; | |
bec15c3a | 5804 | |
864f92be | 5805 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
bec15c3a TI |
5806 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
5807 | } | |
5808 | ||
5809 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
5810 | { | |
5811 | if ((res >> 26) == ALC880_HP_EVENT) | |
5812 | alc260_hp_automute(codec); | |
5813 | } | |
5814 | ||
df694daa | 5815 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
bec15c3a TI |
5816 | { |
5817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5818 | .name = "Master Playback Switch", | |
5b0cb1d8 | 5819 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
bec15c3a TI |
5820 | .info = snd_ctl_boolean_mono_info, |
5821 | .get = alc260_hp_master_sw_get, | |
5822 | .put = alc260_hp_master_sw_put, | |
30cde0aa | 5823 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
bec15c3a | 5824 | }, |
df694daa KY |
5825 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
5826 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5827 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
5828 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
5829 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5830 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
5831 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
5832 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
16ded525 TI |
5833 | { } /* end */ |
5834 | }; | |
5835 | ||
3f878308 KY |
5836 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
5837 | .ops = &snd_hda_bind_vol, | |
5838 | .values = { | |
5839 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | |
5840 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | |
5841 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | |
5842 | 0 | |
5843 | }, | |
5844 | }; | |
5845 | ||
5846 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | |
5847 | .ops = &snd_hda_bind_sw, | |
5848 | .values = { | |
5849 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | |
5850 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
5851 | 0 | |
5852 | }, | |
5853 | }; | |
5854 | ||
5855 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | |
5856 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | |
5857 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | |
5858 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | |
5859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5860 | { } /* end */ | |
5861 | }; | |
5862 | ||
bec15c3a TI |
5863 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
5864 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5865 | {}, | |
5866 | }; | |
5867 | ||
5868 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
5869 | { | |
5870 | struct alc_spec *spec = codec->spec; | |
bec15c3a | 5871 | |
864f92be | 5872 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
30cde0aa | 5873 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
bec15c3a TI |
5874 | } |
5875 | ||
5876 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
5877 | unsigned int res) | |
5878 | { | |
5879 | if ((res >> 26) == ALC880_HP_EVENT) | |
5880 | alc260_hp_3013_automute(codec); | |
5881 | } | |
5882 | ||
3f878308 KY |
5883 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
5884 | { | |
864f92be | 5885 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
3f878308 | 5886 | |
3f878308 KY |
5887 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
5888 | bits); | |
5889 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5890 | bits); | |
5891 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5892 | bits); | |
5893 | } | |
5894 | ||
5895 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | |
5896 | unsigned int res) | |
5897 | { | |
5898 | if ((res >> 26) == ALC880_HP_EVENT) | |
5899 | alc260_hp_3012_automute(codec); | |
5900 | } | |
5901 | ||
5902 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | |
a1e8d2da JW |
5903 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
5904 | */ | |
c8b6bf9b | 5905 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
a9430dd8 | 5906 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 5907 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
4c5186ed | 5908 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
a9430dd8 JW |
5909 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
5910 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5911 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5912 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4c5186ed | 5913 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
31bffaa9 TI |
5914 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
5915 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
df694daa KY |
5916 | { } /* end */ |
5917 | }; | |
5918 | ||
a1e8d2da JW |
5919 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
5920 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
5921 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
5922 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
5923 | * whether this behaviour is intentional or is a hardware bug in chip | |
5924 | * revisions available in early 2006. Therefore for now allow the | |
5925 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
5926 | * that the lack of mic bias for this NID is intentional we could change the | |
5927 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
5928 | * | |
5929 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
5930 | * don't appear to make the mic bias available from the "line" jack, even | |
5931 | * though the NID used for this jack (0x14) can supply it. The theory is | |
5932 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
5933 | * and the output jack. If this turns out to be the case for all such | |
5934 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
5935 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
bd869485 JW |
5936 | * |
5937 | * The C20x Tablet series have a mono internal speaker which is controlled | |
5938 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
5939 | * controls for such models. On models without a "mono speaker" the control | |
5940 | * won't do anything. | |
a1e8d2da | 5941 | */ |
0bfc90e9 JW |
5942 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
5943 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5944 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
a1e8d2da | 5945 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
31bffaa9 | 5946 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
bd869485 | 5947 | HDA_OUTPUT), |
31bffaa9 | 5948 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
bd869485 | 5949 | HDA_INPUT), |
0bfc90e9 JW |
5950 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
5951 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5952 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5953 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5954 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5955 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5956 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5957 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
0bfc90e9 JW |
5958 | { } /* end */ |
5959 | }; | |
5960 | ||
cc959489 MS |
5961 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
5962 | */ | |
5963 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { | |
5964 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5965 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
5966 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
5967 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5968 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5969 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5970 | { } /* end */ | |
5971 | }; | |
5972 | ||
bc9f98a9 KY |
5973 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
5974 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
5975 | */ | |
5976 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
5977 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5978 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
5979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5981 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5982 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5983 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5984 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
5985 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5986 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
bc9f98a9 KY |
5987 | { } /* end */ |
5988 | }; | |
5989 | ||
5990 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
5991 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
5992 | */ | |
5993 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
5994 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5995 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
5996 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5998 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
5999 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
6000 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
6001 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6002 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6003 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
6004 | { } /* end */ | |
6005 | }; | |
6006 | ||
df694daa KY |
6007 | /* |
6008 | * initialization verbs | |
6009 | */ | |
1da177e4 LT |
6010 | static struct hda_verb alc260_init_verbs[] = { |
6011 | /* Line In pin widget for input */ | |
05acb863 | 6012 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 6013 | /* CD pin widget for input */ |
05acb863 | 6014 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 6015 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
16ded525 | 6016 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 6017 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
16ded525 | 6018 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 6019 | /* LINE-2 is used for line-out in rear */ |
05acb863 | 6020 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 6021 | /* select line-out */ |
fd56f2db | 6022 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 | 6023 | /* LINE-OUT pin */ |
05acb863 | 6024 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 6025 | /* enable HP */ |
05acb863 | 6026 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1da177e4 | 6027 | /* enable Mono */ |
05acb863 TI |
6028 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
6029 | /* mute capture amp left and right */ | |
16ded525 | 6030 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 LT |
6031 | /* set connection select to line in (default select for this ADC) */ |
6032 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16ded525 TI |
6033 | /* mute capture amp left and right */ |
6034 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6035 | /* set connection select to line in (default select for this ADC) */ | |
6036 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
05acb863 TI |
6037 | /* set vol=0 Line-Out mixer amp left and right */ |
6038 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6039 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6040 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6041 | /* set vol=0 HP mixer amp left and right */ | |
6042 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6043 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6044 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6045 | /* set vol=0 Mono mixer amp left and right */ | |
6046 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6047 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6048 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6049 | /* unmute LINE-2 out pin */ | |
6050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f12ab1e0 TI |
6051 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
6052 | * Line In 2 = 0x03 | |
6053 | */ | |
cb53c626 TI |
6054 | /* mute analog inputs */ |
6055 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6056 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6057 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6058 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6059 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 6060 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
05acb863 TI |
6061 | /* mute Front out path */ |
6062 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6063 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6064 | /* mute Headphone out path */ | |
6065 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6066 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6067 | /* mute Mono out path */ | |
6068 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6069 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
6070 | { } |
6071 | }; | |
6072 | ||
474167d6 | 6073 | #if 0 /* should be identical with alc260_init_verbs? */ |
df694daa KY |
6074 | static struct hda_verb alc260_hp_init_verbs[] = { |
6075 | /* Headphone and output */ | |
6076 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
6077 | /* mono output */ | |
6078 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6079 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
6080 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6081 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
6082 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6083 | /* Line In pin widget for input */ | |
6084 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6085 | /* Line-2 pin widget for output */ | |
6086 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6087 | /* CD pin widget for input */ | |
6088 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6089 | /* unmute amp left and right */ | |
6090 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
6091 | /* set connection select to line in (default select for this ADC) */ | |
6092 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6093 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
6094 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6095 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6096 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6097 | /* unmute HP mixer amp left and right (volume = 0) */ | |
6098 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6099 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6100 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
6101 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
6102 | * Line In 2 = 0x03 | |
6103 | */ | |
cb53c626 TI |
6104 | /* mute analog inputs */ |
6105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6106 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6107 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6108 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6109 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
6110 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
6111 | /* Unmute Front out path */ | |
6112 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6113 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6114 | /* Unmute Headphone out path */ | |
6115 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6116 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6117 | /* Unmute Mono out path */ | |
6118 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6119 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6120 | { } | |
6121 | }; | |
474167d6 | 6122 | #endif |
df694daa KY |
6123 | |
6124 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
6125 | /* Line out and output */ | |
6126 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6127 | /* mono output */ | |
6128 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6129 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
6130 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6131 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
6132 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6133 | /* Line In pin widget for input */ | |
6134 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6135 | /* Headphone pin widget for output */ | |
6136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
6137 | /* CD pin widget for input */ | |
6138 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6139 | /* unmute amp left and right */ | |
6140 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
6141 | /* set connection select to line in (default select for this ADC) */ | |
6142 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6143 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
6144 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6145 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6146 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6147 | /* unmute HP mixer amp left and right (volume = 0) */ | |
6148 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6149 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6150 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
6151 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
6152 | * Line In 2 = 0x03 | |
6153 | */ | |
cb53c626 TI |
6154 | /* mute analog inputs */ |
6155 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6156 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6158 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6159 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
6160 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
6161 | /* Unmute Front out path */ | |
6162 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6163 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6164 | /* Unmute Headphone out path */ | |
6165 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6166 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6167 | /* Unmute Mono out path */ | |
6168 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6169 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6170 | { } | |
6171 | }; | |
6172 | ||
a9430dd8 | 6173 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
a1e8d2da JW |
6174 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
6175 | * audio = 0x16, internal speaker = 0x10. | |
a9430dd8 JW |
6176 | */ |
6177 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
6178 | /* Disable all GPIOs */ | |
6179 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
6180 | /* Internal speaker is connected to headphone pin */ | |
6181 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6182 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
6183 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
f7ace40d JW |
6184 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
6185 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6186 | /* Ensure all other unused pins are disabled and muted. */ | |
6187 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6188 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a9430dd8 | 6189 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d | 6190 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
a9430dd8 | 6191 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d JW |
6192 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6194 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6195 | ||
6196 | /* Disable digital (SPDIF) pins */ | |
6197 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6198 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
a9430dd8 | 6199 | |
ea1fb29a | 6200 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
f7ace40d JW |
6201 | * when acting as an output. |
6202 | */ | |
6203 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4c5186ed | 6204 | |
f7ace40d | 6205 | /* Start with output sum widgets muted and their output gains at min */ |
8b33a5aa TI |
6206 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6207 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6208 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6209 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6210 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6211 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6212 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6213 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6214 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a9430dd8 | 6215 | |
f7ace40d JW |
6216 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
6217 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6218 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
6219 | * If the pin mode is changed by the user the pin mode control will | |
6220 | * take care of enabling the pin's input/output buffers as needed. | |
6221 | * Therefore there's no need to enable the input buffer at this | |
6222 | * stage. | |
cdcd9268 | 6223 | */ |
f7ace40d | 6224 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
ea1fb29a | 6225 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
cdcd9268 JW |
6226 | * mixer ctrl) |
6227 | */ | |
f7ace40d JW |
6228 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
6229 | ||
6230 | /* Mute capture amp left and right */ | |
6231 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 6232 | /* Set ADC connection select to match default mixer setting - line |
f7ace40d JW |
6233 | * in (on mic1 pin) |
6234 | */ | |
6235 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6236 | ||
6237 | /* Do the same for the second ADC: mute capture input amp and | |
6238 | * set ADC connection to line in (on mic1 pin) | |
6239 | */ | |
6240 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6241 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6242 | ||
6243 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6244 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4a471b7d TI |
6252 | |
6253 | { } | |
a9430dd8 JW |
6254 | }; |
6255 | ||
0bfc90e9 JW |
6256 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
6257 | * similar laptops (adapted from Fujitsu init verbs). | |
6258 | */ | |
6259 | static struct hda_verb alc260_acer_init_verbs[] = { | |
6260 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
6261 | * the headphone jack. Turn this on and rely on the standard mute | |
6262 | * methods whenever the user wants to turn these outputs off. | |
6263 | */ | |
6264 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6265 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6266 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6267 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
6268 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6269 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
6270 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6271 | /* Line In jack is connected to Line1 pin */ | |
6272 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
bd869485 JW |
6273 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
6274 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
0bfc90e9 JW |
6275 | /* Ensure all other unused pins are disabled and muted. */ |
6276 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6277 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
0bfc90e9 JW |
6278 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
6279 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6280 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6281 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6282 | /* Disable digital (SPDIF) pins */ | |
6283 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6284 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6285 | ||
ea1fb29a | 6286 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
0bfc90e9 JW |
6287 | * bus when acting as outputs. |
6288 | */ | |
6289 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6290 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6291 | ||
6292 | /* Start with output sum widgets muted and their output gains at min */ | |
6293 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6294 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6295 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6296 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6297 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6298 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6299 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6300 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6301 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6302 | ||
f12ab1e0 TI |
6303 | /* Unmute Line-out pin widget amp left and right |
6304 | * (no equiv mixer ctrl) | |
6305 | */ | |
0bfc90e9 | 6306 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
bd869485 JW |
6307 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
6308 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
0bfc90e9 JW |
6309 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
6310 | * inputs. If the pin mode is changed by the user the pin mode control | |
6311 | * will take care of enabling the pin's input/output buffers as needed. | |
6312 | * Therefore there's no need to enable the input buffer at this | |
6313 | * stage. | |
6314 | */ | |
6315 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6316 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6317 | ||
6318 | /* Mute capture amp left and right */ | |
6319 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6320 | /* Set ADC connection select to match default mixer setting - mic | |
6321 | * (on mic1 pin) | |
6322 | */ | |
6323 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6324 | ||
6325 | /* Do similar with the second ADC: mute capture input amp and | |
a1e8d2da | 6326 | * set ADC connection to mic to match ALSA's default state. |
0bfc90e9 JW |
6327 | */ |
6328 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a1e8d2da | 6329 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
0bfc90e9 JW |
6330 | |
6331 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6337 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6338 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6339 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6340 | ||
6341 | { } | |
6342 | }; | |
6343 | ||
cc959489 MS |
6344 | /* Initialisation sequence for Maxdata Favorit 100XS |
6345 | * (adapted from Acer init verbs). | |
6346 | */ | |
6347 | static struct hda_verb alc260_favorit100_init_verbs[] = { | |
6348 | /* GPIO 0 enables the output jack. | |
6349 | * Turn this on and rely on the standard mute | |
6350 | * methods whenever the user wants to turn these outputs off. | |
6351 | */ | |
6352 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6353 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6354 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6355 | /* Line/Mic input jack is connected to Mic1 pin */ | |
6356 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6357 | /* Ensure all other unused pins are disabled and muted. */ | |
6358 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6359 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6360 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6361 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6362 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6363 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6365 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6367 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6368 | /* Disable digital (SPDIF) pins */ | |
6369 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6370 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6371 | ||
6372 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
6373 | * bus when acting as outputs. | |
6374 | */ | |
6375 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6376 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6377 | ||
6378 | /* Start with output sum widgets muted and their output gains at min */ | |
6379 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6380 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6381 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6382 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6383 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6384 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6385 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6386 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6387 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6388 | ||
6389 | /* Unmute Line-out pin widget amp left and right | |
6390 | * (no equiv mixer ctrl) | |
6391 | */ | |
6392 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6393 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
6394 | * inputs. If the pin mode is changed by the user the pin mode control | |
6395 | * will take care of enabling the pin's input/output buffers as needed. | |
6396 | * Therefore there's no need to enable the input buffer at this | |
6397 | * stage. | |
6398 | */ | |
6399 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6400 | ||
6401 | /* Mute capture amp left and right */ | |
6402 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6403 | /* Set ADC connection select to match default mixer setting - mic | |
6404 | * (on mic1 pin) | |
6405 | */ | |
6406 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6407 | ||
6408 | /* Do similar with the second ADC: mute capture input amp and | |
6409 | * set ADC connection to mic to match ALSA's default state. | |
6410 | */ | |
6411 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6412 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6413 | ||
6414 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6416 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6417 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6418 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6419 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6420 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6422 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6423 | ||
6424 | { } | |
6425 | }; | |
6426 | ||
bc9f98a9 KY |
6427 | static struct hda_verb alc260_will_verbs[] = { |
6428 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6429 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6430 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6431 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6432 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6433 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
6434 | {} | |
6435 | }; | |
6436 | ||
6437 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
6438 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6439 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6440 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
6441 | ||
6442 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6443 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6444 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6445 | ||
6446 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6447 | {} | |
6448 | }; | |
6449 | ||
6450 | /* toggle speaker-output according to the hp-jack state */ | |
6451 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
6452 | { | |
6453 | unsigned int present; | |
6454 | ||
6455 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
864f92be | 6456 | present = snd_hda_jack_detect(codec, 0x0f); |
bc9f98a9 | 6457 | if (present) { |
82beb8fd TI |
6458 | snd_hda_codec_write_cache(codec, 0x01, 0, |
6459 | AC_VERB_SET_GPIO_DATA, 1); | |
6460 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6461 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6462 | PIN_HP); | |
bc9f98a9 | 6463 | } else { |
82beb8fd TI |
6464 | snd_hda_codec_write_cache(codec, 0x01, 0, |
6465 | AC_VERB_SET_GPIO_DATA, 0); | |
6466 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6467 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6468 | PIN_OUT); | |
bc9f98a9 KY |
6469 | } |
6470 | } | |
6471 | ||
6472 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
6473 | unsigned int res) | |
6474 | { | |
6475 | if ((res >> 26) == ALC880_HP_EVENT) | |
6476 | alc260_replacer_672v_automute(codec); | |
6477 | } | |
6478 | ||
3f878308 KY |
6479 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
6480 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6481 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6482 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6483 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6484 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6485 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6486 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6487 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6488 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6489 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6490 | {} | |
6491 | }; | |
6492 | ||
7cf51e48 JW |
6493 | /* Test configuration for debugging, modelled after the ALC880 test |
6494 | * configuration. | |
6495 | */ | |
6496 | #ifdef CONFIG_SND_DEBUG | |
6497 | static hda_nid_t alc260_test_dac_nids[1] = { | |
6498 | 0x02, | |
6499 | }; | |
6500 | static hda_nid_t alc260_test_adc_nids[2] = { | |
6501 | 0x04, 0x05, | |
6502 | }; | |
a1e8d2da | 6503 | /* For testing the ALC260, each input MUX needs its own definition since |
ea1fb29a | 6504 | * the signal assignments are different. This assumes that the first ADC |
a1e8d2da | 6505 | * is NID 0x04. |
17e7aec6 | 6506 | */ |
a1e8d2da JW |
6507 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
6508 | { | |
6509 | .num_items = 7, | |
6510 | .items = { | |
6511 | { "MIC1 pin", 0x0 }, | |
6512 | { "MIC2 pin", 0x1 }, | |
6513 | { "LINE1 pin", 0x2 }, | |
6514 | { "LINE2 pin", 0x3 }, | |
6515 | { "CD pin", 0x4 }, | |
6516 | { "LINE-OUT pin", 0x5 }, | |
6517 | { "HP-OUT pin", 0x6 }, | |
6518 | }, | |
6519 | }, | |
6520 | { | |
6521 | .num_items = 8, | |
6522 | .items = { | |
6523 | { "MIC1 pin", 0x0 }, | |
6524 | { "MIC2 pin", 0x1 }, | |
6525 | { "LINE1 pin", 0x2 }, | |
6526 | { "LINE2 pin", 0x3 }, | |
6527 | { "CD pin", 0x4 }, | |
6528 | { "Mixer", 0x5 }, | |
6529 | { "LINE-OUT pin", 0x6 }, | |
6530 | { "HP-OUT pin", 0x7 }, | |
6531 | }, | |
7cf51e48 JW |
6532 | }, |
6533 | }; | |
6534 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
6535 | /* Output driver widgets */ | |
6536 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
6537 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
6538 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
6539 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
6540 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6541 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
6542 | ||
a1e8d2da JW |
6543 | /* Modes for retasking pin widgets |
6544 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
6545 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
6546 | * mention this restriction. At this stage it's not clear whether | |
6547 | * this behaviour is intentional or is a hardware bug in chip | |
6548 | * revisions available at least up until early 2006. Therefore for | |
6549 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
6550 | * choices, but if it turns out that the lack of mic bias for these | |
6551 | * NIDs is intentional we could change their modes from | |
6552 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
6553 | */ | |
7cf51e48 JW |
6554 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
6555 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
6556 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
6557 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
6558 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
6559 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
6560 | ||
6561 | /* Loopback mixer controls */ | |
6562 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
6563 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
6564 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
6565 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
6566 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6567 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6568 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
6569 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
6570 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6571 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
7cf51e48 JW |
6572 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
6573 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
6574 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
6575 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
5c8f858d JW |
6576 | |
6577 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
6578 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
6579 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
6580 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
6581 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
6582 | ||
92621f13 JW |
6583 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
6584 | * is ambigious as to which NID is which; testing on laptops which | |
ea1fb29a | 6585 | * make this output available should provide clarification. |
92621f13 JW |
6586 | */ |
6587 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
6588 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
6589 | ||
f8225f6d JW |
6590 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
6591 | * this output to turn on an external amplifier. | |
6592 | */ | |
6593 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
6594 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
6595 | ||
7cf51e48 JW |
6596 | { } /* end */ |
6597 | }; | |
6598 | static struct hda_verb alc260_test_init_verbs[] = { | |
5c8f858d JW |
6599 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
6600 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
6601 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6602 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
6603 | ||
7cf51e48 JW |
6604 | /* Enable retasking pins as output, initially without power amp */ |
6605 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6606 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6607 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6608 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6609 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6610 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6611 | ||
92621f13 JW |
6612 | /* Disable digital (SPDIF) pins initially, but users can enable |
6613 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
6614 | * payload also sets the generation to 0, output to be in "consumer" | |
6615 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
6616 | * control. | |
6617 | */ | |
7cf51e48 JW |
6618 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
6619 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6620 | ||
ea1fb29a | 6621 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
7cf51e48 JW |
6622 | * OUT1 sum bus when acting as an output. |
6623 | */ | |
6624 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6625 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
6626 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6627 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
6628 | ||
6629 | /* Start with output sum widgets muted and their output gains at min */ | |
6630 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6631 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6632 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6633 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6634 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6635 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6636 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6637 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6638 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6639 | ||
cdcd9268 JW |
6640 | /* Unmute retasking pin widget output buffers since the default |
6641 | * state appears to be output. As the pin mode is changed by the | |
6642 | * user the pin mode control will take care of enabling the pin's | |
6643 | * input/output buffers as needed. | |
6644 | */ | |
7cf51e48 JW |
6645 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
6646 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6648 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6649 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6650 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6651 | /* Also unmute the mono-out pin widget */ | |
6652 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6653 | ||
7cf51e48 JW |
6654 | /* Mute capture amp left and right */ |
6655 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
f7ace40d JW |
6656 | /* Set ADC connection select to match default mixer setting (mic1 |
6657 | * pin) | |
7cf51e48 JW |
6658 | */ |
6659 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6660 | ||
6661 | /* Do the same for the second ADC: mute capture input amp and | |
f7ace40d | 6662 | * set ADC connection to mic1 pin |
7cf51e48 JW |
6663 | */ |
6664 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6665 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6666 | ||
6667 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6668 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6669 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6670 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6671 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6672 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6673 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6674 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6676 | ||
6677 | { } | |
6678 | }; | |
6679 | #endif | |
6680 | ||
6330079f TI |
6681 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
6682 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
1da177e4 | 6683 | |
a3bcba38 TI |
6684 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
6685 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
6686 | ||
df694daa KY |
6687 | /* |
6688 | * for BIOS auto-configuration | |
6689 | */ | |
16ded525 | 6690 | |
df694daa | 6691 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
863b4518 | 6692 | const char *pfx, int *vol_bits) |
df694daa KY |
6693 | { |
6694 | hda_nid_t nid_vol; | |
6695 | unsigned long vol_val, sw_val; | |
df694daa KY |
6696 | int err; |
6697 | ||
6698 | if (nid >= 0x0f && nid < 0x11) { | |
6699 | nid_vol = nid - 0x7; | |
6700 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6701 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6702 | } else if (nid == 0x11) { | |
6703 | nid_vol = nid - 0x7; | |
6704 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
6705 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
6706 | } else if (nid >= 0x12 && nid <= 0x15) { | |
6707 | nid_vol = 0x08; | |
6708 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6709 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6710 | } else | |
6711 | return 0; /* N/A */ | |
ea1fb29a | 6712 | |
863b4518 TI |
6713 | if (!(*vol_bits & (1 << nid_vol))) { |
6714 | /* first control for the volume widget */ | |
0afe5f89 | 6715 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); |
863b4518 TI |
6716 | if (err < 0) |
6717 | return err; | |
6718 | *vol_bits |= (1 << nid_vol); | |
6719 | } | |
0afe5f89 | 6720 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); |
f12ab1e0 | 6721 | if (err < 0) |
df694daa KY |
6722 | return err; |
6723 | return 1; | |
6724 | } | |
6725 | ||
6726 | /* add playback controls from the parsed DAC table */ | |
6727 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
6728 | const struct auto_pin_cfg *cfg) | |
6729 | { | |
6730 | hda_nid_t nid; | |
6731 | int err; | |
863b4518 | 6732 | int vols = 0; |
df694daa KY |
6733 | |
6734 | spec->multiout.num_dacs = 1; | |
6735 | spec->multiout.dac_nids = spec->private_dac_nids; | |
6736 | spec->multiout.dac_nids[0] = 0x02; | |
6737 | ||
6738 | nid = cfg->line_out_pins[0]; | |
6739 | if (nid) { | |
23112d6d TI |
6740 | const char *pfx; |
6741 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | |
6742 | pfx = "Master"; | |
6743 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
6744 | pfx = "Speaker"; | |
6745 | else | |
6746 | pfx = "Front"; | |
6747 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | |
df694daa KY |
6748 | if (err < 0) |
6749 | return err; | |
6750 | } | |
6751 | ||
82bc955f | 6752 | nid = cfg->speaker_pins[0]; |
df694daa | 6753 | if (nid) { |
863b4518 | 6754 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
df694daa KY |
6755 | if (err < 0) |
6756 | return err; | |
6757 | } | |
6758 | ||
eb06ed8f | 6759 | nid = cfg->hp_pins[0]; |
df694daa | 6760 | if (nid) { |
863b4518 TI |
6761 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
6762 | &vols); | |
df694daa KY |
6763 | if (err < 0) |
6764 | return err; | |
6765 | } | |
f12ab1e0 | 6766 | return 0; |
df694daa KY |
6767 | } |
6768 | ||
6769 | /* create playback/capture controls for input pins */ | |
05f5f477 | 6770 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
df694daa KY |
6771 | const struct auto_pin_cfg *cfg) |
6772 | { | |
05f5f477 | 6773 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
df694daa KY |
6774 | } |
6775 | ||
6776 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
6777 | hda_nid_t nid, int pin_type, | |
6778 | int sel_idx) | |
6779 | { | |
f6c7e546 | 6780 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
6781 | /* need the manual connection? */ |
6782 | if (nid >= 0x12) { | |
6783 | int idx = nid - 0x12; | |
6784 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
6785 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
df694daa KY |
6786 | } |
6787 | } | |
6788 | ||
6789 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
6790 | { | |
6791 | struct alc_spec *spec = codec->spec; | |
6792 | hda_nid_t nid; | |
6793 | ||
f12ab1e0 | 6794 | nid = spec->autocfg.line_out_pins[0]; |
baba8ee9 TI |
6795 | if (nid) { |
6796 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
6797 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
6798 | } | |
ea1fb29a | 6799 | |
82bc955f | 6800 | nid = spec->autocfg.speaker_pins[0]; |
df694daa KY |
6801 | if (nid) |
6802 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
6803 | ||
eb06ed8f | 6804 | nid = spec->autocfg.hp_pins[0]; |
df694daa | 6805 | if (nid) |
baba8ee9 | 6806 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
f12ab1e0 | 6807 | } |
df694daa KY |
6808 | |
6809 | #define ALC260_PIN_CD_NID 0x16 | |
6810 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
6811 | { | |
6812 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 6813 | struct auto_pin_cfg *cfg = &spec->autocfg; |
df694daa KY |
6814 | int i; |
6815 | ||
66ceeb6b TI |
6816 | for (i = 0; i < cfg->num_inputs; i++) { |
6817 | hda_nid_t nid = cfg->inputs[i].pin; | |
df694daa | 6818 | if (nid >= 0x12) { |
30ea098f | 6819 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
e82c025b TI |
6820 | if (nid != ALC260_PIN_CD_NID && |
6821 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f12ab1e0 TI |
6822 | snd_hda_codec_write(codec, nid, 0, |
6823 | AC_VERB_SET_AMP_GAIN_MUTE, | |
df694daa KY |
6824 | AMP_OUT_MUTE); |
6825 | } | |
6826 | } | |
6827 | } | |
6828 | ||
7f311a46 TI |
6829 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
6830 | ||
df694daa KY |
6831 | /* |
6832 | * generic initialization of ADC, input mixers and output mixers | |
6833 | */ | |
6834 | static struct hda_verb alc260_volume_init_verbs[] = { | |
6835 | /* | |
6836 | * Unmute ADC0-1 and set the default input to mic-in | |
6837 | */ | |
6838 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6839 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6840 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6841 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 6842 | |
df694daa KY |
6843 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
6844 | * mixer widget | |
f12ab1e0 TI |
6845 | * Note: PASD motherboards uses the Line In 2 as the input for |
6846 | * front panel mic (mic 2) | |
df694daa KY |
6847 | */ |
6848 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
6849 | /* mute analog inputs */ |
6850 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6851 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6854 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
6855 | |
6856 | /* | |
6857 | * Set up output mixers (0x08 - 0x0a) | |
6858 | */ | |
6859 | /* set vol=0 to output mixers */ | |
6860 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6861 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6862 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6863 | /* set up input amps for analog loopback */ | |
6864 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6865 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6866 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6867 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6868 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6869 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6870 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 6871 | |
df694daa KY |
6872 | { } |
6873 | }; | |
6874 | ||
6875 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
6876 | { | |
6877 | struct alc_spec *spec = codec->spec; | |
df694daa KY |
6878 | int err; |
6879 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
6880 | ||
f12ab1e0 TI |
6881 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
6882 | alc260_ignore); | |
6883 | if (err < 0) | |
df694daa | 6884 | return err; |
f12ab1e0 TI |
6885 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
6886 | if (err < 0) | |
4a471b7d | 6887 | return err; |
603c4019 | 6888 | if (!spec->kctls.list) |
df694daa | 6889 | return 0; /* can't find valid BIOS pin config */ |
05f5f477 | 6890 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 6891 | if (err < 0) |
df694daa KY |
6892 | return err; |
6893 | ||
6894 | spec->multiout.max_channels = 2; | |
6895 | ||
0852d7a6 | 6896 | if (spec->autocfg.dig_outs) |
df694daa | 6897 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
603c4019 | 6898 | if (spec->kctls.list) |
d88897ea | 6899 | add_mixer(spec, spec->kctls.list); |
df694daa | 6900 | |
d88897ea | 6901 | add_verb(spec, alc260_volume_init_verbs); |
df694daa | 6902 | |
a1e8d2da | 6903 | spec->num_mux_defs = 1; |
61b9b9b1 | 6904 | spec->input_mux = &spec->private_imux[0]; |
df694daa | 6905 | |
6227cdce | 6906 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
4a79ba34 | 6907 | |
df694daa KY |
6908 | return 1; |
6909 | } | |
6910 | ||
ae6b813a TI |
6911 | /* additional initialization for auto-configuration model */ |
6912 | static void alc260_auto_init(struct hda_codec *codec) | |
df694daa | 6913 | { |
f6c7e546 | 6914 | struct alc_spec *spec = codec->spec; |
df694daa KY |
6915 | alc260_auto_init_multi_out(codec); |
6916 | alc260_auto_init_analog_input(codec); | |
7f311a46 | 6917 | alc260_auto_init_input_src(codec); |
757899ac | 6918 | alc_auto_init_digital(codec); |
f6c7e546 | 6919 | if (spec->unsol_event) |
7fb0d78f | 6920 | alc_inithook(codec); |
df694daa KY |
6921 | } |
6922 | ||
cb53c626 TI |
6923 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6924 | static struct hda_amp_list alc260_loopbacks[] = { | |
6925 | { 0x07, HDA_INPUT, 0 }, | |
6926 | { 0x07, HDA_INPUT, 1 }, | |
6927 | { 0x07, HDA_INPUT, 2 }, | |
6928 | { 0x07, HDA_INPUT, 3 }, | |
6929 | { 0x07, HDA_INPUT, 4 }, | |
6930 | { } /* end */ | |
6931 | }; | |
6932 | #endif | |
6933 | ||
fc091769 TI |
6934 | /* |
6935 | * Pin config fixes | |
6936 | */ | |
6937 | enum { | |
6938 | PINFIX_HP_DC5750, | |
6939 | }; | |
6940 | ||
fc091769 TI |
6941 | static const struct alc_fixup alc260_fixups[] = { |
6942 | [PINFIX_HP_DC5750] = { | |
73413b12 TI |
6943 | .pins = (const struct alc_pincfg[]) { |
6944 | { 0x11, 0x90130110 }, /* speaker */ | |
6945 | { } | |
6946 | } | |
fc091769 TI |
6947 | }, |
6948 | }; | |
6949 | ||
6950 | static struct snd_pci_quirk alc260_fixup_tbl[] = { | |
6951 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), | |
6952 | {} | |
6953 | }; | |
6954 | ||
df694daa KY |
6955 | /* |
6956 | * ALC260 configurations | |
6957 | */ | |
f5fcc13c TI |
6958 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
6959 | [ALC260_BASIC] = "basic", | |
6960 | [ALC260_HP] = "hp", | |
6961 | [ALC260_HP_3013] = "hp-3013", | |
2922c9af | 6962 | [ALC260_HP_DC7600] = "hp-dc7600", |
f5fcc13c TI |
6963 | [ALC260_FUJITSU_S702X] = "fujitsu", |
6964 | [ALC260_ACER] = "acer", | |
bc9f98a9 KY |
6965 | [ALC260_WILL] = "will", |
6966 | [ALC260_REPLACER_672V] = "replacer", | |
cc959489 | 6967 | [ALC260_FAVORIT100] = "favorit100", |
7cf51e48 | 6968 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 6969 | [ALC260_TEST] = "test", |
7cf51e48 | 6970 | #endif |
f5fcc13c TI |
6971 | [ALC260_AUTO] = "auto", |
6972 | }; | |
6973 | ||
6974 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
bd869485 | 6975 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
950200e2 | 6976 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
f5fcc13c | 6977 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
cc959489 | 6978 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
9720b718 | 6979 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
4ac55982 | 6980 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
f5fcc13c | 6981 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
34ec8a0a | 6982 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
3f878308 | 6983 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
f5fcc13c TI |
6984 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
6985 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
6986 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
6987 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
6988 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
6989 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
6990 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
6991 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
6992 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
bc9f98a9 | 6993 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
ac3e3741 | 6994 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
df694daa KY |
6995 | {} |
6996 | }; | |
6997 | ||
6998 | static struct alc_config_preset alc260_presets[] = { | |
6999 | [ALC260_BASIC] = { | |
7000 | .mixers = { alc260_base_output_mixer, | |
45bdd1c1 | 7001 | alc260_input_mixer }, |
df694daa KY |
7002 | .init_verbs = { alc260_init_verbs }, |
7003 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7004 | .dac_nids = alc260_dac_nids, | |
f9e336f6 | 7005 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
9c4cc0bd | 7006 | .adc_nids = alc260_dual_adc_nids, |
df694daa KY |
7007 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7008 | .channel_mode = alc260_modes, | |
7009 | .input_mux = &alc260_capture_source, | |
7010 | }, | |
7011 | [ALC260_HP] = { | |
bec15c3a | 7012 | .mixers = { alc260_hp_output_mixer, |
f9e336f6 | 7013 | alc260_input_mixer }, |
bec15c3a TI |
7014 | .init_verbs = { alc260_init_verbs, |
7015 | alc260_hp_unsol_verbs }, | |
df694daa KY |
7016 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
7017 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
7018 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
7019 | .adc_nids = alc260_adc_nids_alt, | |
df694daa KY |
7020 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7021 | .channel_mode = alc260_modes, | |
7022 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
7023 | .unsol_event = alc260_hp_unsol_event, |
7024 | .init_hook = alc260_hp_automute, | |
df694daa | 7025 | }, |
3f878308 KY |
7026 | [ALC260_HP_DC7600] = { |
7027 | .mixers = { alc260_hp_dc7600_mixer, | |
f9e336f6 | 7028 | alc260_input_mixer }, |
3f878308 KY |
7029 | .init_verbs = { alc260_init_verbs, |
7030 | alc260_hp_dc7600_verbs }, | |
7031 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7032 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
7033 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
7034 | .adc_nids = alc260_adc_nids_alt, | |
3f878308 KY |
7035 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7036 | .channel_mode = alc260_modes, | |
7037 | .input_mux = &alc260_capture_source, | |
7038 | .unsol_event = alc260_hp_3012_unsol_event, | |
7039 | .init_hook = alc260_hp_3012_automute, | |
7040 | }, | |
df694daa KY |
7041 | [ALC260_HP_3013] = { |
7042 | .mixers = { alc260_hp_3013_mixer, | |
f9e336f6 | 7043 | alc260_input_mixer }, |
bec15c3a TI |
7044 | .init_verbs = { alc260_hp_3013_init_verbs, |
7045 | alc260_hp_3013_unsol_verbs }, | |
df694daa KY |
7046 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
7047 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
7048 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
7049 | .adc_nids = alc260_adc_nids_alt, | |
df694daa KY |
7050 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7051 | .channel_mode = alc260_modes, | |
7052 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
7053 | .unsol_event = alc260_hp_3013_unsol_event, |
7054 | .init_hook = alc260_hp_3013_automute, | |
df694daa KY |
7055 | }, |
7056 | [ALC260_FUJITSU_S702X] = { | |
f9e336f6 | 7057 | .mixers = { alc260_fujitsu_mixer }, |
df694daa KY |
7058 | .init_verbs = { alc260_fujitsu_init_verbs }, |
7059 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7060 | .dac_nids = alc260_dac_nids, | |
d57fdac0 JW |
7061 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
7062 | .adc_nids = alc260_dual_adc_nids, | |
df694daa KY |
7063 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7064 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
7065 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
7066 | .input_mux = alc260_fujitsu_capture_sources, | |
df694daa | 7067 | }, |
0bfc90e9 | 7068 | [ALC260_ACER] = { |
f9e336f6 | 7069 | .mixers = { alc260_acer_mixer }, |
0bfc90e9 JW |
7070 | .init_verbs = { alc260_acer_init_verbs }, |
7071 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7072 | .dac_nids = alc260_dac_nids, | |
7073 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
7074 | .adc_nids = alc260_dual_adc_nids, | |
7075 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7076 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
7077 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
7078 | .input_mux = alc260_acer_capture_sources, | |
0bfc90e9 | 7079 | }, |
cc959489 MS |
7080 | [ALC260_FAVORIT100] = { |
7081 | .mixers = { alc260_favorit100_mixer }, | |
7082 | .init_verbs = { alc260_favorit100_init_verbs }, | |
7083 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7084 | .dac_nids = alc260_dac_nids, | |
7085 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
7086 | .adc_nids = alc260_dual_adc_nids, | |
7087 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7088 | .channel_mode = alc260_modes, | |
7089 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), | |
7090 | .input_mux = alc260_favorit100_capture_sources, | |
7091 | }, | |
bc9f98a9 | 7092 | [ALC260_WILL] = { |
f9e336f6 | 7093 | .mixers = { alc260_will_mixer }, |
bc9f98a9 KY |
7094 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
7095 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7096 | .dac_nids = alc260_dac_nids, | |
7097 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
7098 | .adc_nids = alc260_adc_nids, | |
7099 | .dig_out_nid = ALC260_DIGOUT_NID, | |
7100 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7101 | .channel_mode = alc260_modes, | |
7102 | .input_mux = &alc260_capture_source, | |
7103 | }, | |
7104 | [ALC260_REPLACER_672V] = { | |
f9e336f6 | 7105 | .mixers = { alc260_replacer_672v_mixer }, |
bc9f98a9 KY |
7106 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
7107 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7108 | .dac_nids = alc260_dac_nids, | |
7109 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
7110 | .adc_nids = alc260_adc_nids, | |
7111 | .dig_out_nid = ALC260_DIGOUT_NID, | |
7112 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7113 | .channel_mode = alc260_modes, | |
7114 | .input_mux = &alc260_capture_source, | |
7115 | .unsol_event = alc260_replacer_672v_unsol_event, | |
7116 | .init_hook = alc260_replacer_672v_automute, | |
7117 | }, | |
7cf51e48 JW |
7118 | #ifdef CONFIG_SND_DEBUG |
7119 | [ALC260_TEST] = { | |
f9e336f6 | 7120 | .mixers = { alc260_test_mixer }, |
7cf51e48 JW |
7121 | .init_verbs = { alc260_test_init_verbs }, |
7122 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
7123 | .dac_nids = alc260_test_dac_nids, | |
7124 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
7125 | .adc_nids = alc260_test_adc_nids, | |
7126 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7127 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
7128 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
7129 | .input_mux = alc260_test_capture_sources, | |
7cf51e48 JW |
7130 | }, |
7131 | #endif | |
df694daa KY |
7132 | }; |
7133 | ||
7134 | static int patch_alc260(struct hda_codec *codec) | |
1da177e4 LT |
7135 | { |
7136 | struct alc_spec *spec; | |
df694daa | 7137 | int err, board_config; |
1da177e4 | 7138 | |
e560d8d8 | 7139 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
7140 | if (spec == NULL) |
7141 | return -ENOMEM; | |
7142 | ||
7143 | codec->spec = spec; | |
7144 | ||
f5fcc13c TI |
7145 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
7146 | alc260_models, | |
7147 | alc260_cfg_tbl); | |
7148 | if (board_config < 0) { | |
9a11f1aa | 7149 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
6c627f39 | 7150 | codec->chip_name); |
df694daa | 7151 | board_config = ALC260_AUTO; |
16ded525 | 7152 | } |
1da177e4 | 7153 | |
fc091769 TI |
7154 | if (board_config == ALC260_AUTO) |
7155 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); | |
7156 | ||
df694daa KY |
7157 | if (board_config == ALC260_AUTO) { |
7158 | /* automatic parse from the BIOS config */ | |
7159 | err = alc260_parse_auto_config(codec); | |
7160 | if (err < 0) { | |
7161 | alc_free(codec); | |
7162 | return err; | |
f12ab1e0 | 7163 | } else if (!err) { |
9c7f852e TI |
7164 | printk(KERN_INFO |
7165 | "hda_codec: Cannot set up configuration " | |
7166 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
7167 | board_config = ALC260_BASIC; |
7168 | } | |
a9430dd8 | 7169 | } |
e9edcee0 | 7170 | |
680cd536 KK |
7171 | err = snd_hda_attach_beep_device(codec, 0x1); |
7172 | if (err < 0) { | |
7173 | alc_free(codec); | |
7174 | return err; | |
7175 | } | |
7176 | ||
df694daa | 7177 | if (board_config != ALC260_AUTO) |
e9c364c0 | 7178 | setup_preset(codec, &alc260_presets[board_config]); |
1da177e4 | 7179 | |
1da177e4 LT |
7180 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
7181 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
53bacfbb | 7182 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
1da177e4 | 7183 | |
a3bcba38 TI |
7184 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
7185 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
7186 | ||
4ef0ef19 TI |
7187 | if (!spec->adc_nids && spec->input_mux) { |
7188 | /* check whether NID 0x04 is valid */ | |
7189 | unsigned int wcap = get_wcaps(codec, 0x04); | |
a22d543a | 7190 | wcap = get_wcaps_type(wcap); |
4ef0ef19 TI |
7191 | /* get type */ |
7192 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
7193 | spec->adc_nids = alc260_adc_nids_alt; | |
7194 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
7195 | } else { | |
7196 | spec->adc_nids = alc260_adc_nids; | |
7197 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
7198 | } | |
7199 | } | |
b59bdf3b | 7200 | set_capture_mixer(codec); |
45bdd1c1 | 7201 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
f9e336f6 | 7202 | |
fc091769 TI |
7203 | if (board_config == ALC260_AUTO) |
7204 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); | |
7205 | ||
2134ea4f TI |
7206 | spec->vmaster_nid = 0x08; |
7207 | ||
1da177e4 | 7208 | codec->patch_ops = alc_patch_ops; |
df694daa | 7209 | if (board_config == ALC260_AUTO) |
ae6b813a | 7210 | spec->init_hook = alc260_auto_init; |
cb53c626 TI |
7211 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
7212 | if (!spec->loopback.amplist) | |
7213 | spec->loopback.amplist = alc260_loopbacks; | |
7214 | #endif | |
1da177e4 LT |
7215 | |
7216 | return 0; | |
7217 | } | |
7218 | ||
e9edcee0 | 7219 | |
1da177e4 | 7220 | /* |
4953550a | 7221 | * ALC882/883/885/888/889 support |
1da177e4 LT |
7222 | * |
7223 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
7224 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
7225 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
7226 | * 6-channel independent captures. | |
7227 | * | |
7228 | * In addition, an independent DAC for the multi-playback (not used in this | |
7229 | * driver yet). | |
7230 | */ | |
df694daa KY |
7231 | #define ALC882_DIGOUT_NID 0x06 |
7232 | #define ALC882_DIGIN_NID 0x0a | |
4953550a TI |
7233 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
7234 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | |
7235 | #define ALC1200_DIGOUT_NID 0x10 | |
7236 | ||
1da177e4 | 7237 | |
d2a6d7dc | 7238 | static struct hda_channel_mode alc882_ch_modes[1] = { |
1da177e4 LT |
7239 | { 8, NULL } |
7240 | }; | |
7241 | ||
4953550a | 7242 | /* DACs */ |
1da177e4 LT |
7243 | static hda_nid_t alc882_dac_nids[4] = { |
7244 | /* front, rear, clfe, rear_surr */ | |
7245 | 0x02, 0x03, 0x04, 0x05 | |
7246 | }; | |
4953550a | 7247 | #define alc883_dac_nids alc882_dac_nids |
1da177e4 | 7248 | |
4953550a | 7249 | /* ADCs */ |
df694daa KY |
7250 | #define alc882_adc_nids alc880_adc_nids |
7251 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
4953550a TI |
7252 | #define alc883_adc_nids alc882_adc_nids_alt |
7253 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | |
7254 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | |
7255 | #define alc889_adc_nids alc880_adc_nids | |
1da177e4 | 7256 | |
e1406348 TI |
7257 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
7258 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
4953550a TI |
7259 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
7260 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | |
7261 | #define alc889_capsrc_nids alc882_capsrc_nids | |
e1406348 | 7262 | |
1da177e4 LT |
7263 | /* input MUX */ |
7264 | /* FIXME: should be a matrix-type input source selection */ | |
7265 | ||
7266 | static struct hda_input_mux alc882_capture_source = { | |
7267 | .num_items = 4, | |
7268 | .items = { | |
7269 | { "Mic", 0x0 }, | |
7270 | { "Front Mic", 0x1 }, | |
7271 | { "Line", 0x2 }, | |
7272 | { "CD", 0x4 }, | |
7273 | }, | |
7274 | }; | |
41d5545d | 7275 | |
4953550a TI |
7276 | #define alc883_capture_source alc882_capture_source |
7277 | ||
87a8c370 JK |
7278 | static struct hda_input_mux alc889_capture_source = { |
7279 | .num_items = 3, | |
7280 | .items = { | |
7281 | { "Front Mic", 0x0 }, | |
7282 | { "Mic", 0x3 }, | |
7283 | { "Line", 0x2 }, | |
7284 | }, | |
7285 | }; | |
7286 | ||
41d5545d KS |
7287 | static struct hda_input_mux mb5_capture_source = { |
7288 | .num_items = 3, | |
7289 | .items = { | |
7290 | { "Mic", 0x1 }, | |
b8f171e7 | 7291 | { "Line", 0x7 }, |
41d5545d KS |
7292 | { "CD", 0x4 }, |
7293 | }, | |
7294 | }; | |
7295 | ||
e458b1fa LY |
7296 | static struct hda_input_mux macmini3_capture_source = { |
7297 | .num_items = 2, | |
7298 | .items = { | |
7299 | { "Line", 0x2 }, | |
7300 | { "CD", 0x4 }, | |
7301 | }, | |
7302 | }; | |
7303 | ||
4953550a TI |
7304 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
7305 | .num_items = 4, | |
7306 | .items = { | |
7307 | { "Mic", 0x1 }, | |
7308 | { "Front Mic", 0x0 }, | |
7309 | { "Line", 0x2 }, | |
7310 | { "CD", 0x4 }, | |
7311 | }, | |
7312 | }; | |
7313 | ||
7314 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | |
7315 | .num_items = 2, | |
7316 | .items = { | |
7317 | { "Mic", 0x1 }, | |
7318 | { "Line", 0x2 }, | |
7319 | }, | |
7320 | }; | |
7321 | ||
7322 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | |
7323 | .num_items = 4, | |
7324 | .items = { | |
7325 | { "Mic", 0x0 }, | |
150b432f | 7326 | { "Int Mic", 0x1 }, |
4953550a TI |
7327 | { "Line", 0x2 }, |
7328 | { "CD", 0x4 }, | |
7329 | }, | |
7330 | }; | |
7331 | ||
7332 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | |
7333 | .num_items = 2, | |
7334 | .items = { | |
7335 | { "Mic", 0x0 }, | |
7336 | { "Int Mic", 0x1 }, | |
7337 | }, | |
7338 | }; | |
7339 | ||
7340 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | |
7341 | .num_items = 3, | |
7342 | .items = { | |
7343 | { "Mic", 0x0 }, | |
7344 | { "Front Mic", 0x1 }, | |
7345 | { "Line", 0x4 }, | |
7346 | }, | |
7347 | }; | |
7348 | ||
7349 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | |
7350 | .num_items = 2, | |
7351 | .items = { | |
7352 | { "Mic", 0x0 }, | |
7353 | { "Line", 0x2 }, | |
7354 | }, | |
7355 | }; | |
7356 | ||
7357 | static struct hda_input_mux alc889A_mb31_capture_source = { | |
7358 | .num_items = 2, | |
7359 | .items = { | |
7360 | { "Mic", 0x0 }, | |
7361 | /* Front Mic (0x01) unused */ | |
7362 | { "Line", 0x2 }, | |
7363 | /* Line 2 (0x03) unused */ | |
af901ca1 | 7364 | /* CD (0x04) unused? */ |
4953550a TI |
7365 | }, |
7366 | }; | |
7367 | ||
b7cccc52 JM |
7368 | static struct hda_input_mux alc889A_imac91_capture_source = { |
7369 | .num_items = 2, | |
7370 | .items = { | |
7371 | { "Mic", 0x01 }, | |
7372 | { "Line", 0x2 }, /* Not sure! */ | |
7373 | }, | |
7374 | }; | |
7375 | ||
4953550a TI |
7376 | /* |
7377 | * 2ch mode | |
7378 | */ | |
7379 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
7380 | { 2, NULL } | |
7381 | }; | |
7382 | ||
272a527c KY |
7383 | /* |
7384 | * 2ch mode | |
7385 | */ | |
7386 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
7387 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7388 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7389 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7390 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7391 | { } /* end */ | |
7392 | }; | |
7393 | ||
4953550a TI |
7394 | /* |
7395 | * 4ch mode | |
7396 | */ | |
7397 | static struct hda_verb alc882_3ST_ch4_init[] = { | |
7398 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7399 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7400 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7401 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7402 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7403 | { } /* end */ | |
7404 | }; | |
7405 | ||
272a527c KY |
7406 | /* |
7407 | * 6ch mode | |
7408 | */ | |
7409 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
7410 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7411 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7412 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7413 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7414 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7415 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7416 | { } /* end */ | |
7417 | }; | |
7418 | ||
4953550a | 7419 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
272a527c | 7420 | { 2, alc882_3ST_ch2_init }, |
4953550a | 7421 | { 4, alc882_3ST_ch4_init }, |
272a527c KY |
7422 | { 6, alc882_3ST_ch6_init }, |
7423 | }; | |
7424 | ||
4953550a TI |
7425 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
7426 | ||
a65cc60f | 7427 | /* |
7428 | * 2ch mode | |
7429 | */ | |
7430 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | |
7431 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
7432 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7433 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7434 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7435 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7436 | { } /* end */ | |
7437 | }; | |
7438 | ||
7439 | /* | |
7440 | * 4ch mode | |
7441 | */ | |
7442 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | |
7443 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7444 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7445 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7446 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7447 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7448 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7449 | { } /* end */ | |
7450 | }; | |
7451 | ||
7452 | /* | |
7453 | * 6ch mode | |
7454 | */ | |
7455 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | |
7456 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7457 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7458 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7459 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7461 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7462 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7463 | { } /* end */ | |
7464 | }; | |
7465 | ||
7466 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | |
7467 | { 2, alc883_3ST_ch2_clevo_init }, | |
7468 | { 4, alc883_3ST_ch4_clevo_init }, | |
7469 | { 6, alc883_3ST_ch6_clevo_init }, | |
7470 | }; | |
7471 | ||
7472 | ||
df694daa KY |
7473 | /* |
7474 | * 6ch mode | |
7475 | */ | |
7476 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
7477 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7478 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7479 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7480 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7481 | { } /* end */ | |
7482 | }; | |
7483 | ||
7484 | /* | |
7485 | * 8ch mode | |
7486 | */ | |
7487 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
7488 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7489 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7490 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7491 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7492 | { } /* end */ | |
7493 | }; | |
7494 | ||
7495 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
7496 | { 6, alc882_sixstack_ch6_init }, | |
7497 | { 8, alc882_sixstack_ch8_init }, | |
7498 | }; | |
7499 | ||
76e6f5a9 RH |
7500 | |
7501 | /* Macbook Air 2,1 */ | |
7502 | ||
7503 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { | |
7504 | { 2, NULL }, | |
7505 | }; | |
7506 | ||
87350ad0 | 7507 | /* |
def319f9 | 7508 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
87350ad0 TI |
7509 | */ |
7510 | ||
7511 | /* | |
7512 | * 2ch mode | |
7513 | */ | |
7514 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
7515 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7516 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7517 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7518 | { } /* end */ | |
7519 | }; | |
7520 | ||
7521 | /* | |
a3f730af | 7522 | * 4ch mode |
87350ad0 | 7523 | */ |
a3f730af | 7524 | static struct hda_verb alc885_mbp_ch4_init[] = { |
87350ad0 TI |
7525 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7526 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7527 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7528 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7529 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7530 | { } /* end */ | |
7531 | }; | |
7532 | ||
a3f730af | 7533 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
87350ad0 | 7534 | { 2, alc885_mbp_ch2_init }, |
a3f730af | 7535 | { 4, alc885_mbp_ch4_init }, |
87350ad0 TI |
7536 | }; |
7537 | ||
92b9de83 KS |
7538 | /* |
7539 | * 2ch | |
7540 | * Speakers/Woofer/HP = Front | |
7541 | * LineIn = Input | |
7542 | */ | |
7543 | static struct hda_verb alc885_mb5_ch2_init[] = { | |
7544 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7545 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7546 | { } /* end */ | |
7547 | }; | |
7548 | ||
7549 | /* | |
7550 | * 6ch mode | |
7551 | * Speakers/HP = Front | |
7552 | * Woofer = LFE | |
7553 | * LineIn = Surround | |
7554 | */ | |
7555 | static struct hda_verb alc885_mb5_ch6_init[] = { | |
7556 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7557 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7558 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7559 | { } /* end */ | |
7560 | }; | |
7561 | ||
7562 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |
7563 | { 2, alc885_mb5_ch2_init }, | |
7564 | { 6, alc885_mb5_ch6_init }, | |
7565 | }; | |
87350ad0 | 7566 | |
d01aecdf | 7567 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
4953550a TI |
7568 | |
7569 | /* | |
7570 | * 2ch mode | |
7571 | */ | |
7572 | static struct hda_verb alc883_4ST_ch2_init[] = { | |
7573 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7574 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7575 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7576 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7577 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7578 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7579 | { } /* end */ | |
7580 | }; | |
7581 | ||
7582 | /* | |
7583 | * 4ch mode | |
7584 | */ | |
7585 | static struct hda_verb alc883_4ST_ch4_init[] = { | |
7586 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7587 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7588 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7589 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7590 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7591 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7592 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7593 | { } /* end */ | |
7594 | }; | |
7595 | ||
7596 | /* | |
7597 | * 6ch mode | |
7598 | */ | |
7599 | static struct hda_verb alc883_4ST_ch6_init[] = { | |
7600 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7601 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7602 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7603 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7604 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7605 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7606 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7607 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7608 | { } /* end */ | |
7609 | }; | |
7610 | ||
7611 | /* | |
7612 | * 8ch mode | |
7613 | */ | |
7614 | static struct hda_verb alc883_4ST_ch8_init[] = { | |
7615 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7616 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7617 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7618 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7619 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7620 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7621 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7622 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7623 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7624 | { } /* end */ | |
7625 | }; | |
7626 | ||
7627 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | |
7628 | { 2, alc883_4ST_ch2_init }, | |
7629 | { 4, alc883_4ST_ch4_init }, | |
7630 | { 6, alc883_4ST_ch6_init }, | |
7631 | { 8, alc883_4ST_ch8_init }, | |
7632 | }; | |
7633 | ||
7634 | ||
7635 | /* | |
7636 | * 2ch mode | |
7637 | */ | |
7638 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
7639 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7640 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7641 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7642 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7643 | { } /* end */ | |
7644 | }; | |
7645 | ||
7646 | /* | |
7647 | * 4ch mode | |
7648 | */ | |
7649 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
7650 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7651 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7652 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7653 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7654 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7655 | { } /* end */ | |
7656 | }; | |
7657 | ||
7658 | /* | |
7659 | * 6ch mode | |
7660 | */ | |
7661 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
7662 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7663 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7664 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7665 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7666 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7667 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7668 | { } /* end */ | |
7669 | }; | |
7670 | ||
7671 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
7672 | { 2, alc883_3ST_ch2_intel_init }, | |
7673 | { 4, alc883_3ST_ch4_intel_init }, | |
7674 | { 6, alc883_3ST_ch6_intel_init }, | |
7675 | }; | |
7676 | ||
dd7714c9 WF |
7677 | /* |
7678 | * 2ch mode | |
7679 | */ | |
7680 | static struct hda_verb alc889_ch2_intel_init[] = { | |
7681 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7682 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7683 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7684 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7685 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7686 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7687 | { } /* end */ | |
7688 | }; | |
7689 | ||
87a8c370 JK |
7690 | /* |
7691 | * 6ch mode | |
7692 | */ | |
7693 | static struct hda_verb alc889_ch6_intel_init[] = { | |
dd7714c9 WF |
7694 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7695 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7696 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7697 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7698 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
87a8c370 JK |
7699 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
7700 | { } /* end */ | |
7701 | }; | |
7702 | ||
7703 | /* | |
7704 | * 8ch mode | |
7705 | */ | |
7706 | static struct hda_verb alc889_ch8_intel_init[] = { | |
dd7714c9 WF |
7707 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7708 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7709 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7710 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7711 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
87a8c370 JK |
7712 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7713 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
87a8c370 JK |
7714 | { } /* end */ |
7715 | }; | |
7716 | ||
dd7714c9 WF |
7717 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
7718 | { 2, alc889_ch2_intel_init }, | |
87a8c370 JK |
7719 | { 6, alc889_ch6_intel_init }, |
7720 | { 8, alc889_ch8_intel_init }, | |
7721 | }; | |
7722 | ||
4953550a TI |
7723 | /* |
7724 | * 6ch mode | |
7725 | */ | |
7726 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
7727 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7728 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7729 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7730 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7731 | { } /* end */ | |
7732 | }; | |
7733 | ||
7734 | /* | |
7735 | * 8ch mode | |
7736 | */ | |
7737 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
7738 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7739 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7740 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7741 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7742 | { } /* end */ | |
7743 | }; | |
7744 | ||
7745 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
7746 | { 6, alc883_sixstack_ch6_init }, | |
7747 | { 8, alc883_sixstack_ch8_init }, | |
7748 | }; | |
7749 | ||
7750 | ||
1da177e4 LT |
7751 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
7752 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
7753 | */ | |
c8b6bf9b | 7754 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
05acb863 | 7755 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 7756 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 7757 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 7758 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
05acb863 TI |
7759 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
7760 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
7761 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
7762 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
05acb863 | 7763 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 7764 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1da177e4 LT |
7765 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
7766 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7767 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7768 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7769 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7770 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7771 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
1da177e4 LT |
7772 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7773 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7774 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
1da177e4 | 7775 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
1da177e4 LT |
7776 | { } /* end */ |
7777 | }; | |
7778 | ||
76e6f5a9 RH |
7779 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
7780 | ||
7781 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { | |
7782 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7783 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), | |
7784 | { } | |
7785 | }; | |
7786 | ||
7787 | ||
87350ad0 | 7788 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
a3f730af TI |
7789 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7790 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7791 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7792 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7793 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
2134ea4f TI |
7794 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7795 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
87350ad0 TI |
7796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
7797 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
2134ea4f | 7798 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
87350ad0 TI |
7799 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
7800 | { } /* end */ | |
7801 | }; | |
41d5545d KS |
7802 | |
7803 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |
92b9de83 KS |
7804 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7805 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7806 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7807 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7808 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7809 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
a76221d4 AM |
7810 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
7811 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
b8f171e7 AM |
7812 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
7813 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
41d5545d KS |
7814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
7815 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
7816 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7817 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), | |
7818 | { } /* end */ | |
7819 | }; | |
92b9de83 | 7820 | |
e458b1fa LY |
7821 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
7822 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7823 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7824 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7825 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7826 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7827 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7828 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | |
7829 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
7830 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
7831 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
7832 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7833 | { } /* end */ | |
7834 | }; | |
7835 | ||
4b7e1803 | 7836 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
b7cccc52 JM |
7837 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7838 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
4b7e1803 JM |
7839 | { } /* end */ |
7840 | }; | |
7841 | ||
7842 | ||
bdd148a3 KY |
7843 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
7844 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7845 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7846 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7847 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7848 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7849 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7851 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7852 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
bdd148a3 KY |
7853 | { } /* end */ |
7854 | }; | |
7855 | ||
272a527c KY |
7856 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
7857 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7858 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7860 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7861 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7862 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7863 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7864 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7865 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 7866 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
7867 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7868 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
96fe7cc8 | 7869 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
272a527c KY |
7870 | { } /* end */ |
7871 | }; | |
7872 | ||
7873 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
7874 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
7875 | */ | |
7876 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
7877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7878 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7880 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
7881 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7882 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7883 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7884 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7885 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
7886 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
7887 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7888 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 7889 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
7890 | { } /* end */ |
7891 | }; | |
7892 | ||
914759b7 TI |
7893 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
7894 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7895 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7896 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7897 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7898 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7899 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7900 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7901 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7902 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
914759b7 TI |
7904 | { } /* end */ |
7905 | }; | |
7906 | ||
df694daa KY |
7907 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
7908 | { | |
7909 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7910 | .name = "Channel Mode", | |
7911 | .info = alc_ch_mode_info, | |
7912 | .get = alc_ch_mode_get, | |
7913 | .put = alc_ch_mode_put, | |
7914 | }, | |
7915 | { } /* end */ | |
7916 | }; | |
7917 | ||
4953550a | 7918 | static struct hda_verb alc882_base_init_verbs[] = { |
1da177e4 | 7919 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
05acb863 TI |
7920 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 7922 | /* Rear mixer */ |
05acb863 TI |
7923 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7924 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 7925 | /* CLFE mixer */ |
05acb863 TI |
7926 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7927 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 7928 | /* Side mixer */ |
05acb863 TI |
7929 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
7930 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 7931 | |
e9edcee0 | 7932 | /* Front Pin: output 0 (0x0c) */ |
05acb863 | 7933 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 7934 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 7935 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 7936 | /* Rear Pin: output 1 (0x0d) */ |
05acb863 | 7937 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 7938 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 7939 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
e9edcee0 | 7940 | /* CLFE Pin: output 2 (0x0e) */ |
05acb863 | 7941 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 7942 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 7943 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
e9edcee0 | 7944 | /* Side Pin: output 3 (0x0f) */ |
05acb863 | 7945 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 7946 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 7947 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
e9edcee0 | 7948 | /* Mic (rear) pin: input vref at 80% */ |
16ded525 | 7949 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
7950 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
7951 | /* Front Mic pin: input vref at 80% */ | |
16ded525 | 7952 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
7953 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
7954 | /* Line In pin: input */ | |
05acb863 | 7955 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
7956 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
7957 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
7958 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7959 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7960 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1da177e4 | 7961 | /* CD pin widget for input */ |
05acb863 | 7962 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 LT |
7963 | |
7964 | /* FIXME: use matrix-type input source selection */ | |
7965 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
1da177e4 | 7966 | /* Input mixer2 */ |
05acb863 | 7967 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 7968 | /* Input mixer3 */ |
05acb863 | 7969 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
05acb863 TI |
7970 | /* ADC2: mute amp left and right */ |
7971 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 7972 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
7973 | /* ADC3: mute amp left and right */ |
7974 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 7975 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 LT |
7976 | |
7977 | { } | |
7978 | }; | |
7979 | ||
4953550a TI |
7980 | static struct hda_verb alc882_adc1_init_verbs[] = { |
7981 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
7982 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7983 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7984 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
7986 | /* ADC1: mute amp left and right */ | |
7987 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7988 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7989 | { } | |
7990 | }; | |
7991 | ||
4b146cb0 TI |
7992 | static struct hda_verb alc882_eapd_verbs[] = { |
7993 | /* change to EAPD mode */ | |
7994 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
b373bdeb | 7995 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
f12ab1e0 | 7996 | { } |
4b146cb0 TI |
7997 | }; |
7998 | ||
87a8c370 JK |
7999 | static struct hda_verb alc889_eapd_verbs[] = { |
8000 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
8001 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
8002 | { } | |
8003 | }; | |
8004 | ||
6732bd0d WF |
8005 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
8006 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
8007 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8008 | {} | |
8009 | }; | |
87a8c370 JK |
8010 | |
8011 | static struct hda_verb alc885_init_verbs[] = { | |
8012 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
88102f3f KY |
8013 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8014 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 8015 | /* Rear mixer */ |
88102f3f KY |
8016 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8017 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 8018 | /* CLFE mixer */ |
88102f3f KY |
8019 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8020 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 8021 | /* Side mixer */ |
88102f3f KY |
8022 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8023 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 JK |
8024 | |
8025 | /* Front HP Pin: output 0 (0x0c) */ | |
6732bd0d | 8026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
87a8c370 JK |
8027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
8028 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8029 | /* Front Pin: output 0 (0x0c) */ | |
8030 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8031 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8032 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8033 | /* Rear Pin: output 1 (0x0d) */ | |
8034 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8035 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8036 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8037 | /* CLFE Pin: output 2 (0x0e) */ | |
8038 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8039 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8040 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8041 | /* Side Pin: output 3 (0x0f) */ | |
8042 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8043 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8044 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8045 | /* Mic (rear) pin: input vref at 80% */ | |
8046 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8047 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8048 | /* Front Mic pin: input vref at 80% */ | |
8049 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8050 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8051 | /* Line In pin: input */ | |
8052 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8053 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8054 | ||
8055 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | |
8056 | /* Input mixer1 */ | |
88102f3f | 8057 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
87a8c370 JK |
8058 | /* Input mixer2 */ |
8059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
87a8c370 | 8060 | /* Input mixer3 */ |
88102f3f | 8061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
87a8c370 JK |
8062 | /* ADC2: mute amp left and right */ |
8063 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8064 | /* ADC3: mute amp left and right */ | |
8065 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8066 | ||
8067 | { } | |
8068 | }; | |
8069 | ||
8070 | static struct hda_verb alc885_init_input_verbs[] = { | |
8071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
8073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
8074 | { } | |
8075 | }; | |
8076 | ||
8077 | ||
8078 | /* Unmute Selector 24h and set the default input to front mic */ | |
8079 | static struct hda_verb alc889_init_input_verbs[] = { | |
8080 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8082 | { } | |
8083 | }; | |
8084 | ||
8085 | ||
4953550a TI |
8086 | #define alc883_init_verbs alc882_base_init_verbs |
8087 | ||
9102cd1c TD |
8088 | /* Mac Pro test */ |
8089 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
8090 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8091 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8092 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
8093 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
8094 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
45bdd1c1 | 8095 | /* FIXME: this looks suspicious... |
d355c82a JK |
8096 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8097 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
45bdd1c1 | 8098 | */ |
9102cd1c TD |
8099 | { } /* end */ |
8100 | }; | |
8101 | ||
8102 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
8103 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8104 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8105 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8106 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8107 | /* Front Pin: output 0 (0x0c) */ | |
8108 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8111 | /* Front Mic pin: input vref at 80% */ | |
8112 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8113 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8114 | /* Speaker: output */ | |
8115 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8116 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8117 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
8118 | /* Headphone output (output 0 - 0x0c) */ | |
8119 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8120 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8121 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8122 | ||
8123 | /* FIXME: use matrix-type input source selection */ | |
8124 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8125 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8126 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8127 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8128 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8129 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8130 | /* Input mixer2 */ | |
8131 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8132 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8133 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8134 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8135 | /* Input mixer3 */ | |
8136 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8137 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8138 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8139 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8140 | /* ADC1: mute amp left and right */ | |
8141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8142 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8143 | /* ADC2: mute amp left and right */ | |
8144 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8145 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8146 | /* ADC3: mute amp left and right */ | |
8147 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8148 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8149 | ||
8150 | { } | |
8151 | }; | |
f12ab1e0 | 8152 | |
41d5545d KS |
8153 | /* Macbook 5,1 */ |
8154 | static struct hda_verb alc885_mb5_init_verbs[] = { | |
92b9de83 KS |
8155 | /* DACs */ |
8156 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8157 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8158 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8159 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
41d5545d | 8160 | /* Front mixer */ |
41d5545d KS |
8161 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
8162 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
92b9de83 KS |
8164 | /* Surround mixer */ |
8165 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8166 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8167 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8168 | /* LFE mixer */ | |
8169 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8170 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8171 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8172 | /* HP mixer */ | |
8173 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8174 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8175 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8176 | /* Front Pin (0x0c) */ | |
41d5545d KS |
8177 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
8178 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
92b9de83 KS |
8179 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8180 | /* LFE Pin (0x0e) */ | |
8181 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8182 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8183 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8184 | /* HP Pin (0x0f) */ | |
41d5545d KS |
8185 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
8186 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
92b9de83 | 8187 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
a76221d4 | 8188 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
41d5545d KS |
8189 | /* Front Mic pin: input vref at 80% */ |
8190 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8191 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8192 | /* Line In pin */ | |
8193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8194 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8195 | ||
b8f171e7 AM |
8196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
8197 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, | |
8198 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, | |
41d5545d KS |
8199 | { } |
8200 | }; | |
8201 | ||
e458b1fa LY |
8202 | /* Macmini 3,1 */ |
8203 | static struct hda_verb alc885_macmini3_init_verbs[] = { | |
8204 | /* DACs */ | |
8205 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8206 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8207 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8208 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8209 | /* Front mixer */ | |
8210 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8211 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8212 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8213 | /* Surround mixer */ | |
8214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8215 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8216 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8217 | /* LFE mixer */ | |
8218 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8219 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8220 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8221 | /* HP mixer */ | |
8222 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8223 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8224 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8225 | /* Front Pin (0x0c) */ | |
8226 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8227 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8228 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8229 | /* LFE Pin (0x0e) */ | |
8230 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8231 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8232 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8233 | /* HP Pin (0x0f) */ | |
8234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8235 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8236 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8237 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8238 | /* Line In pin */ | |
8239 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8240 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8241 | ||
8242 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8243 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8244 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8245 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8246 | { } | |
8247 | }; | |
8248 | ||
76e6f5a9 RH |
8249 | |
8250 | static struct hda_verb alc885_mba21_init_verbs[] = { | |
8251 | /*Internal and HP Speaker Mixer*/ | |
8252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8253 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8254 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8255 | /*Internal Speaker Pin (0x0c)*/ | |
8256 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8257 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8258 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8259 | /* HP Pin: output 0 (0x0e) */ | |
8260 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
8261 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8262 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8263 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | |
8264 | /* Line in (is hp when jack connected)*/ | |
8265 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
8266 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8267 | ||
8268 | { } | |
8269 | }; | |
8270 | ||
8271 | ||
87350ad0 TI |
8272 | /* Macbook Pro rev3 */ |
8273 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
8274 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8275 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8276 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8277 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8278 | /* Rear mixer */ | |
8279 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8280 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8281 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a3f730af TI |
8282 | /* HP mixer */ |
8283 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8284 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8285 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
87350ad0 TI |
8286 | /* Front Pin: output 0 (0x0c) */ |
8287 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8288 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8289 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
a3f730af | 8290 | /* HP Pin: output 0 (0x0e) */ |
87350ad0 | 8291 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
a3f730af TI |
8292 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
8293 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
87350ad0 TI |
8294 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
8295 | /* Mic (rear) pin: input vref at 80% */ | |
8296 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8297 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8298 | /* Front Mic pin: input vref at 80% */ | |
8299 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8300 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8301 | /* Line In pin: use output 1 when in LineOut mode */ | |
8302 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8303 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8304 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8305 | ||
8306 | /* FIXME: use matrix-type input source selection */ | |
8307 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8308 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8309 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8310 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8311 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8312 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8313 | /* Input mixer2 */ | |
8314 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8315 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8316 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8317 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8318 | /* Input mixer3 */ | |
8319 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8320 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8321 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8322 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8323 | /* ADC1: mute amp left and right */ | |
8324 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8325 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8326 | /* ADC2: mute amp left and right */ | |
8327 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8328 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8329 | /* ADC3: mute amp left and right */ | |
8330 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8331 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8332 | ||
8333 | { } | |
8334 | }; | |
8335 | ||
4b7e1803 JM |
8336 | /* iMac 9,1 */ |
8337 | static struct hda_verb alc885_imac91_init_verbs[] = { | |
b7cccc52 JM |
8338 | /* Internal Speaker Pin (0x0c) */ |
8339 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8340 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8341 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8342 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8343 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8344 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8345 | /* HP Pin: Rear */ | |
4b7e1803 JM |
8346 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
8347 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8348 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 JM |
8349 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
8350 | /* Line in Rear */ | |
8351 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
4b7e1803 | 8352 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4b7e1803 JM |
8353 | /* Front Mic pin: input vref at 80% */ |
8354 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8355 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
b7cccc52 JM |
8356 | /* Rear mixer */ |
8357 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8358 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8359 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8360 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | |
8361 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8364 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
4b7e1803 JM |
8365 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8366 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8367 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8368 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8369 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
4b7e1803 JM |
8370 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8371 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8372 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8373 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8374 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
4b7e1803 JM |
8375 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8376 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8377 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8378 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8379 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8380 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8381 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 | 8382 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8383 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8384 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 | 8385 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8386 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8387 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4b7e1803 JM |
8388 | { } |
8389 | }; | |
8390 | ||
c54728d8 NF |
8391 | /* iMac 24 mixer. */ |
8392 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
8393 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8394 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
8395 | { } /* end */ | |
8396 | }; | |
8397 | ||
8398 | /* iMac 24 init verbs. */ | |
8399 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
8400 | /* Internal speakers: output 0 (0x0c) */ | |
8401 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8402 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8403 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8404 | /* Internal speakers: output 0 (0x0c) */ | |
8405 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8406 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8407 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8408 | /* Headphone: output 0 (0x0c) */ | |
8409 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8410 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8411 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8412 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8413 | /* Front Mic: input vref at 80% */ | |
8414 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8415 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8416 | { } | |
8417 | }; | |
8418 | ||
8419 | /* Toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 8420 | static void alc885_imac24_setup(struct hda_codec *codec) |
c54728d8 | 8421 | { |
a9fd4f3f | 8422 | struct alc_spec *spec = codec->spec; |
c54728d8 | 8423 | |
a9fd4f3f TI |
8424 | spec->autocfg.hp_pins[0] = 0x14; |
8425 | spec->autocfg.speaker_pins[0] = 0x18; | |
8426 | spec->autocfg.speaker_pins[1] = 0x1a; | |
c54728d8 NF |
8427 | } |
8428 | ||
9d54f08b TI |
8429 | #define alc885_mb5_setup alc885_imac24_setup |
8430 | #define alc885_macmini3_setup alc885_imac24_setup | |
8431 | ||
76e6f5a9 RH |
8432 | /* Macbook Air 2,1 */ |
8433 | static void alc885_mba21_setup(struct hda_codec *codec) | |
8434 | { | |
8435 | struct alc_spec *spec = codec->spec; | |
8436 | ||
8437 | spec->autocfg.hp_pins[0] = 0x14; | |
8438 | spec->autocfg.speaker_pins[0] = 0x18; | |
8439 | } | |
8440 | ||
8441 | ||
8442 | ||
4f5d1706 | 8443 | static void alc885_mbp3_setup(struct hda_codec *codec) |
87350ad0 | 8444 | { |
a9fd4f3f | 8445 | struct alc_spec *spec = codec->spec; |
87350ad0 | 8446 | |
a9fd4f3f TI |
8447 | spec->autocfg.hp_pins[0] = 0x15; |
8448 | spec->autocfg.speaker_pins[0] = 0x14; | |
87350ad0 TI |
8449 | } |
8450 | ||
9d54f08b | 8451 | static void alc885_imac91_setup(struct hda_codec *codec) |
a76221d4 | 8452 | { |
9d54f08b | 8453 | struct alc_spec *spec = codec->spec; |
4b7e1803 | 8454 | |
9d54f08b | 8455 | spec->autocfg.hp_pins[0] = 0x14; |
b7cccc52 | 8456 | spec->autocfg.speaker_pins[0] = 0x18; |
9d54f08b | 8457 | spec->autocfg.speaker_pins[1] = 0x1a; |
4b7e1803 | 8458 | } |
87350ad0 | 8459 | |
272a527c KY |
8460 | static struct hda_verb alc882_targa_verbs[] = { |
8461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8463 | ||
8464 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8465 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8466 | |
272a527c KY |
8467 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
8468 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8469 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8470 | ||
8471 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
272a527c KY |
8472 | { } /* end */ |
8473 | }; | |
8474 | ||
8475 | /* toggle speaker-output according to the hp-jack state */ | |
8476 | static void alc882_targa_automute(struct hda_codec *codec) | |
8477 | { | |
a9fd4f3f TI |
8478 | struct alc_spec *spec = codec->spec; |
8479 | alc_automute_amp(codec); | |
82beb8fd | 8480 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
a9fd4f3f TI |
8481 | spec->jack_present ? 1 : 3); |
8482 | } | |
8483 | ||
4f5d1706 | 8484 | static void alc882_targa_setup(struct hda_codec *codec) |
a9fd4f3f TI |
8485 | { |
8486 | struct alc_spec *spec = codec->spec; | |
8487 | ||
8488 | spec->autocfg.hp_pins[0] = 0x14; | |
8489 | spec->autocfg.speaker_pins[0] = 0x1b; | |
272a527c KY |
8490 | } |
8491 | ||
8492 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
8493 | { | |
a9fd4f3f | 8494 | if ((res >> 26) == ALC880_HP_EVENT) |
272a527c | 8495 | alc882_targa_automute(codec); |
272a527c KY |
8496 | } |
8497 | ||
8498 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
8499 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8500 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8501 | ||
8502 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8503 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8504 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8505 | |
272a527c KY |
8506 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
8507 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8508 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8509 | ||
8510 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8511 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8512 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8513 | { } /* end */ | |
8514 | }; | |
8515 | ||
914759b7 TI |
8516 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
8517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8519 | ||
8520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8521 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8522 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8523 | |
914759b7 TI |
8524 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
8525 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8526 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8527 | ||
8528 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8529 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8530 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8531 | { } /* end */ | |
8532 | }; | |
8533 | ||
9102cd1c TD |
8534 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
8535 | { | |
8536 | unsigned int gpiostate, gpiomask, gpiodir; | |
8537 | ||
8538 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
8539 | AC_VERB_GET_GPIO_DATA, 0); | |
8540 | ||
8541 | if (!muted) | |
8542 | gpiostate |= (1 << pin); | |
8543 | else | |
8544 | gpiostate &= ~(1 << pin); | |
8545 | ||
8546 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
8547 | AC_VERB_GET_GPIO_MASK, 0); | |
8548 | gpiomask |= (1 << pin); | |
8549 | ||
8550 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
8551 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
8552 | gpiodir |= (1 << pin); | |
8553 | ||
8554 | ||
8555 | snd_hda_codec_write(codec, codec->afg, 0, | |
8556 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
8557 | snd_hda_codec_write(codec, codec->afg, 0, | |
8558 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
8559 | ||
8560 | msleep(1); | |
8561 | ||
8562 | snd_hda_codec_write(codec, codec->afg, 0, | |
8563 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
8564 | } | |
8565 | ||
7debbe51 TI |
8566 | /* set up GPIO at initialization */ |
8567 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
8568 | { | |
8569 | alc882_gpio_mute(codec, 0, 0); | |
8570 | alc882_gpio_mute(codec, 1, 0); | |
8571 | } | |
8572 | ||
8573 | /* set up GPIO and update auto-muting at initialization */ | |
8574 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
8575 | { | |
8576 | alc885_macpro_init_hook(codec); | |
4f5d1706 | 8577 | alc_automute_amp(codec); |
7debbe51 TI |
8578 | } |
8579 | ||
df694daa KY |
8580 | /* |
8581 | * generic initialization of ADC, input mixers and output mixers | |
8582 | */ | |
4953550a | 8583 | static struct hda_verb alc883_auto_init_verbs[] = { |
df694daa KY |
8584 | /* |
8585 | * Unmute ADC0-2 and set the default input to mic-in | |
8586 | */ | |
4953550a TI |
8587 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8588 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8589 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8590 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17bba1b7 | 8591 | |
4953550a TI |
8592 | /* |
8593 | * Set up output mixers (0x0c - 0x0f) | |
8594 | */ | |
8595 | /* set vol=0 to output mixers */ | |
8596 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8597 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8598 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8599 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8600 | /* set up input amps for analog loopback */ | |
8601 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
8602 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8604 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8605 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8606 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8607 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8608 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8609 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8610 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8611 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9c7f852e | 8612 | |
4953550a TI |
8613 | /* FIXME: use matrix-type input source selection */ |
8614 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8615 | /* Input mixer2 */ | |
88102f3f | 8616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4953550a | 8617 | /* Input mixer3 */ |
88102f3f | 8618 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4953550a | 8619 | { } |
9c7f852e TI |
8620 | }; |
8621 | ||
eb4c41d3 TS |
8622 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
8623 | static struct hda_verb alc889A_mb31_ch2_init[] = { | |
8624 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8625 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8626 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8627 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8628 | { } /* end */ | |
8629 | }; | |
8630 | ||
8631 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ | |
8632 | static struct hda_verb alc889A_mb31_ch4_init[] = { | |
8633 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8634 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8635 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8636 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8637 | { } /* end */ | |
8638 | }; | |
8639 | ||
8640 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ | |
8641 | static struct hda_verb alc889A_mb31_ch5_init[] = { | |
8642 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ | |
8643 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8644 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8645 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8646 | { } /* end */ | |
8647 | }; | |
8648 | ||
8649 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ | |
8650 | static struct hda_verb alc889A_mb31_ch6_init[] = { | |
8651 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ | |
8652 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ | |
8653 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8654 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8655 | { } /* end */ | |
8656 | }; | |
8657 | ||
8658 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { | |
8659 | { 2, alc889A_mb31_ch2_init }, | |
8660 | { 4, alc889A_mb31_ch4_init }, | |
8661 | { 5, alc889A_mb31_ch5_init }, | |
8662 | { 6, alc889A_mb31_ch6_init }, | |
8663 | }; | |
8664 | ||
b373bdeb AN |
8665 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
8666 | /* eanable EAPD on medion laptop */ | |
8667 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
8668 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
8669 | { } | |
8670 | }; | |
8671 | ||
4953550a | 8672 | #define alc883_base_mixer alc882_base_mixer |
834be88d | 8673 | |
a8848bd6 AS |
8674 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
8675 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8676 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8677 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8678 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8679 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8680 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8681 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8682 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8683 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8684 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8685 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8686 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8687 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
a8848bd6 AS |
8688 | { } /* end */ |
8689 | }; | |
8690 | ||
0c4cc443 | 8691 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
368c7a95 J |
8692 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8693 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8694 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8695 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8696 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8697 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8698 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8699 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8700 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8701 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
368c7a95 J |
8702 | { } /* end */ |
8703 | }; | |
8704 | ||
fb97dc67 J |
8705 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
8706 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8707 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8708 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8709 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8710 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8711 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8712 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8713 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8714 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8715 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
fb97dc67 J |
8716 | { } /* end */ |
8717 | }; | |
8718 | ||
9c7f852e TI |
8719 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
8720 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8721 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8722 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8723 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8724 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8725 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8726 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8727 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8728 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8729 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8730 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8731 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8732 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
9c7f852e TI |
8733 | { } /* end */ |
8734 | }; | |
df694daa | 8735 | |
9c7f852e TI |
8736 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
8737 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8738 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8739 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8740 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8741 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8742 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8743 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8744 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8745 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8746 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8747 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8748 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8749 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8751 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8752 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8753 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8754 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8755 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
9c7f852e TI |
8756 | { } /* end */ |
8757 | }; | |
8758 | ||
17bba1b7 J |
8759 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
8760 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8761 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8762 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8763 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8764 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8765 | HDA_OUTPUT), | |
8766 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8767 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8768 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8769 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8770 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8771 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8773 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8774 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8775 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
8776 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8777 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8778 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8779 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17bba1b7 J |
8780 | { } /* end */ |
8781 | }; | |
8782 | ||
87a8c370 JK |
8783 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
8784 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8785 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8786 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8787 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8788 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8789 | HDA_OUTPUT), | |
8790 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8791 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8792 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8793 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8794 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | |
8795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8796 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8797 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
8799 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), | |
8800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
8801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8802 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8803 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8804 | { } /* end */ | |
8805 | }; | |
8806 | ||
d1d985f0 | 8807 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
c07584c8 | 8808 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
0701e064 | 8809 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
c07584c8 | 8810 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
0701e064 | 8811 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
c07584c8 TD |
8812 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
8813 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
0701e064 TI |
8814 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
8815 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
c07584c8 TD |
8816 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8817 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8818 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8819 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8820 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8822 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c07584c8 TD |
8823 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8824 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8825 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
c07584c8 | 8826 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
c07584c8 TD |
8827 | { } /* end */ |
8828 | }; | |
8829 | ||
c259249f | 8830 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
ccc656ce | 8831 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
b99dba34 | 8832 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
ccc656ce | 8833 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
b99dba34 | 8834 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
ccc656ce KY |
8835 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
8836 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8837 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8838 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8839 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8840 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8841 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8842 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8843 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8844 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8846 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 8847 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
ccc656ce | 8848 | { } /* end */ |
f12ab1e0 | 8849 | }; |
ccc656ce | 8850 | |
c259249f | 8851 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
ccc656ce | 8852 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
b99dba34 | 8853 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
ccc656ce | 8854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
b99dba34 | 8855 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
ccc656ce KY |
8856 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
8857 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8858 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8859 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 8860 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
4383fae0 J |
8861 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
8862 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8863 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce | 8864 | { } /* end */ |
f12ab1e0 | 8865 | }; |
ccc656ce | 8866 | |
b99dba34 TI |
8867 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
8868 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8869 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
8870 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8871 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8872 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8873 | { } /* end */ | |
8874 | }; | |
8875 | ||
bc9f98a9 KY |
8876 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
8877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8878 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
86cd9298 TI |
8879 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
8880 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
bc9f98a9 KY |
8881 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8883 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8884 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 | 8885 | { } /* end */ |
f12ab1e0 | 8886 | }; |
bc9f98a9 | 8887 | |
272a527c KY |
8888 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
8889 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8890 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
8891 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8892 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8893 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
150b432f DH |
8896 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
8897 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
272a527c KY |
8898 | { } /* end */ |
8899 | }; | |
8900 | ||
8901 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |
8902 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8903 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8904 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8905 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8906 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8908 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8909 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8910 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
272a527c | 8911 | { } /* end */ |
ea1fb29a | 8912 | }; |
272a527c | 8913 | |
7ad7b218 MC |
8914 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
8915 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8916 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8917 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8918 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | |
8919 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | |
8920 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | |
8921 | { } /* end */ | |
8922 | }; | |
8923 | ||
8924 | static struct hda_verb alc883_medion_wim2160_verbs[] = { | |
8925 | /* Unmute front mixer */ | |
8926 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8927 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8928 | ||
8929 | /* Set speaker pin to front mixer */ | |
8930 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8931 | ||
8932 | /* Init headphone pin */ | |
8933 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8934 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8935 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8936 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8937 | ||
8938 | { } /* end */ | |
8939 | }; | |
8940 | ||
8941 | /* toggle speaker-output according to the hp-jack state */ | |
8942 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | |
8943 | { | |
8944 | struct alc_spec *spec = codec->spec; | |
8945 | ||
8946 | spec->autocfg.hp_pins[0] = 0x1a; | |
8947 | spec->autocfg.speaker_pins[0] = 0x15; | |
8948 | } | |
8949 | ||
2880a867 | 8950 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
d1a991a6 KY |
8951 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8952 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2880a867 | 8953 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
2880a867 TD |
8954 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8955 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d1a991a6 KY |
8956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
8957 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2880a867 | 8959 | { } /* end */ |
d1a991a6 | 8960 | }; |
2880a867 | 8961 | |
d2fd4b09 TV |
8962 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
8963 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
d2fd4b09 | 8964 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
684a8842 TV |
8965 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8966 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d2fd4b09 TV |
8967 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
8968 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8970 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8971 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8972 | { } /* end */ | |
8973 | }; | |
8974 | ||
e2757d5e KY |
8975 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
8976 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8977 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8978 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
8979 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | |
8980 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | |
8981 | 0x0d, 1, 0x0, HDA_OUTPUT), | |
8982 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
8983 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
8984 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
8985 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8986 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
e2757d5e KY |
8987 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
8988 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8989 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8990 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8991 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8992 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8993 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8994 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8995 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e2757d5e KY |
8997 | { } /* end */ |
8998 | }; | |
8999 | ||
eb4c41d3 TS |
9000 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
9001 | /* Output mixers */ | |
9002 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
9003 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
9004 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
9005 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
9006 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, | |
9007 | HDA_OUTPUT), | |
9008 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), | |
9009 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), | |
9010 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), | |
9011 | /* Output switches */ | |
9012 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), | |
9013 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), | |
9014 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), | |
9015 | /* Boost mixers */ | |
9016 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | |
9017 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | |
9018 | /* Input mixers */ | |
9019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
9020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
9021 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9022 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9023 | { } /* end */ | |
9024 | }; | |
9025 | ||
3e1647c5 GG |
9026 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
9027 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9028 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9029 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9031 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
9032 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9033 | { } /* end */ | |
9034 | }; | |
9035 | ||
e2757d5e KY |
9036 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
9037 | .ops = &snd_hda_bind_vol, | |
9038 | .values = { | |
9039 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
9040 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
9041 | 0 | |
9042 | }, | |
9043 | }; | |
9044 | ||
9045 | static struct hda_bind_ctls alc883_bind_cap_switch = { | |
9046 | .ops = &snd_hda_bind_sw, | |
9047 | .values = { | |
9048 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
9049 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
9050 | 0 | |
9051 | }, | |
9052 | }; | |
9053 | ||
9054 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | |
9055 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9056 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9058 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9059 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4953550a TI |
9061 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9062 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9063 | { } /* end */ | |
9064 | }; | |
df694daa | 9065 | |
4953550a TI |
9066 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
9067 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | |
9068 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | |
9069 | { | |
9070 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9071 | /* .name = "Capture Source", */ | |
9072 | .name = "Input Source", | |
9073 | .count = 1, | |
9074 | .info = alc_mux_enum_info, | |
9075 | .get = alc_mux_enum_get, | |
9076 | .put = alc_mux_enum_put, | |
9077 | }, | |
9078 | { } /* end */ | |
9079 | }; | |
9c7f852e | 9080 | |
4953550a TI |
9081 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
9082 | { | |
9083 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9084 | .name = "Channel Mode", | |
9085 | .info = alc_ch_mode_info, | |
9086 | .get = alc_ch_mode_get, | |
9087 | .put = alc_ch_mode_put, | |
9088 | }, | |
9089 | { } /* end */ | |
9c7f852e TI |
9090 | }; |
9091 | ||
a8848bd6 | 9092 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 9093 | static void alc883_mitac_setup(struct hda_codec *codec) |
a8848bd6 | 9094 | { |
a9fd4f3f | 9095 | struct alc_spec *spec = codec->spec; |
a8848bd6 | 9096 | |
a9fd4f3f TI |
9097 | spec->autocfg.hp_pins[0] = 0x15; |
9098 | spec->autocfg.speaker_pins[0] = 0x14; | |
9099 | spec->autocfg.speaker_pins[1] = 0x17; | |
a8848bd6 AS |
9100 | } |
9101 | ||
9102 | /* auto-toggle front mic */ | |
9103 | /* | |
9104 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | |
9105 | { | |
864f92be | 9106 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; |
a8848bd6 | 9107 | |
a8848bd6 AS |
9108 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
9109 | } | |
9110 | */ | |
9111 | ||
a8848bd6 AS |
9112 | static struct hda_verb alc883_mitac_verbs[] = { |
9113 | /* HP */ | |
9114 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9115 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9116 | /* Subwoofer */ | |
9117 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9118 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9119 | ||
9120 | /* enable unsolicited event */ | |
9121 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9122 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
9123 | ||
9124 | { } /* end */ | |
9125 | }; | |
9126 | ||
a65cc60f | 9127 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
9128 | /* HP */ | |
9129 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9130 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9131 | /* Int speaker */ | |
9132 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | |
9133 | ||
9134 | /* enable unsolicited event */ | |
9135 | /* | |
9136 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9137 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9138 | */ | |
9139 | ||
9140 | { } /* end */ | |
9141 | }; | |
9142 | ||
0c4cc443 | 9143 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
368c7a95 J |
9144 | /* HP */ |
9145 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9146 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9147 | /* Int speaker */ | |
9148 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9149 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9150 | ||
9151 | /* enable unsolicited event */ | |
9152 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
0c4cc443 | 9153 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
368c7a95 J |
9154 | |
9155 | { } /* end */ | |
9156 | }; | |
9157 | ||
fb97dc67 J |
9158 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
9159 | /* HP */ | |
9160 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9162 | /* Subwoofer */ | |
9163 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9164 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9165 | ||
9166 | /* enable unsolicited event */ | |
9167 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9168 | ||
9169 | { } /* end */ | |
9170 | }; | |
9171 | ||
c259249f | 9172 | static struct hda_verb alc883_targa_verbs[] = { |
ccc656ce KY |
9173 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
9174 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9175 | ||
9176 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9177 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 9178 | |
64a8be74 DH |
9179 | /* Connect Line-Out side jack (SPDIF) to Side */ |
9180 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9181 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9182 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
9183 | /* Connect Mic jack to CLFE */ | |
9184 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9185 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9186 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9187 | /* Connect Line-in jack to Surround */ | |
9188 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9189 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9190 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9191 | /* Connect HP out jack to Front */ | |
9192 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9193 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9194 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
ccc656ce KY |
9195 | |
9196 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
ccc656ce KY |
9197 | |
9198 | { } /* end */ | |
9199 | }; | |
9200 | ||
bc9f98a9 KY |
9201 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
9202 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9203 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
9204 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
9205 | { } /* end */ | |
9206 | }; | |
9207 | ||
272a527c KY |
9208 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
9209 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9210 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9211 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9212 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9213 | { } /* end */ | |
9214 | }; | |
9215 | ||
9216 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
9217 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9218 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9219 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9220 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
9221 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9222 | { } /* end */ | |
9223 | }; | |
9224 | ||
189609ae KY |
9225 | static struct hda_verb alc883_haier_w66_verbs[] = { |
9226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9227 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9228 | ||
9229 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9230 | ||
9231 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9232 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9233 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9234 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9235 | { } /* end */ | |
9236 | }; | |
9237 | ||
e2757d5e KY |
9238 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
9239 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9240 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9241 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9242 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9243 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9244 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9245 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9246 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9247 | { } /* end */ | |
9248 | }; | |
9249 | ||
8718b700 HRK |
9250 | static struct hda_verb alc888_6st_dell_verbs[] = { |
9251 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9252 | { } | |
9253 | }; | |
9254 | ||
3e1647c5 GG |
9255 | static struct hda_verb alc883_vaiott_verbs[] = { |
9256 | /* HP */ | |
9257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9259 | ||
9260 | /* enable unsolicited event */ | |
9261 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9262 | ||
9263 | { } /* end */ | |
9264 | }; | |
9265 | ||
4f5d1706 | 9266 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
8718b700 | 9267 | { |
a9fd4f3f | 9268 | struct alc_spec *spec = codec->spec; |
8718b700 | 9269 | |
a9fd4f3f TI |
9270 | spec->autocfg.hp_pins[0] = 0x1b; |
9271 | spec->autocfg.speaker_pins[0] = 0x14; | |
9272 | spec->autocfg.speaker_pins[1] = 0x16; | |
9273 | spec->autocfg.speaker_pins[2] = 0x18; | |
8718b700 HRK |
9274 | } |
9275 | ||
4723c022 | 9276 | static struct hda_verb alc888_3st_hp_verbs[] = { |
8341de60 | 9277 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
f32a19e3 HRK |
9278 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
9279 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
5795b9e6 | 9280 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
8718b700 | 9281 | { } /* end */ |
5795b9e6 CM |
9282 | }; |
9283 | ||
3ea0d7cf HRK |
9284 | /* |
9285 | * 2ch mode | |
9286 | */ | |
4723c022 | 9287 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
8341de60 CM |
9288 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
9289 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9290 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
9291 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
3ea0d7cf | 9292 | { } /* end */ |
8341de60 CM |
9293 | }; |
9294 | ||
3ea0d7cf HRK |
9295 | /* |
9296 | * 4ch mode | |
9297 | */ | |
9298 | static struct hda_verb alc888_3st_hp_4ch_init[] = { | |
9299 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
9300 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9301 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9302 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9303 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
9304 | { } /* end */ | |
9305 | }; | |
9306 | ||
9307 | /* | |
9308 | * 6ch mode | |
9309 | */ | |
4723c022 | 9310 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
8341de60 CM |
9311 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
9312 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
3ea0d7cf | 9313 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
8341de60 CM |
9314 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
9315 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
3ea0d7cf HRK |
9316 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
9317 | { } /* end */ | |
8341de60 CM |
9318 | }; |
9319 | ||
3ea0d7cf | 9320 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
4723c022 | 9321 | { 2, alc888_3st_hp_2ch_init }, |
3ea0d7cf | 9322 | { 4, alc888_3st_hp_4ch_init }, |
4723c022 | 9323 | { 6, alc888_3st_hp_6ch_init }, |
8341de60 CM |
9324 | }; |
9325 | ||
272a527c KY |
9326 | /* toggle front-jack and RCA according to the hp-jack state */ |
9327 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
9328 | { | |
864f92be | 9329 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
ea1fb29a | 9330 | |
47fd830a TI |
9331 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9332 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9333 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9334 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
9335 | } |
9336 | ||
9337 | /* toggle RCA according to the front-jack state */ | |
9338 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
9339 | { | |
864f92be | 9340 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
ea1fb29a | 9341 | |
47fd830a TI |
9342 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9343 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c | 9344 | } |
47fd830a | 9345 | |
272a527c KY |
9346 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
9347 | unsigned int res) | |
9348 | { | |
9349 | if ((res >> 26) == ALC880_HP_EVENT) | |
9350 | alc888_lenovo_ms7195_front_automute(codec); | |
9351 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9352 | alc888_lenovo_ms7195_rca_automute(codec); | |
9353 | } | |
9354 | ||
9355 | static struct hda_verb alc883_medion_md2_verbs[] = { | |
9356 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9357 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9358 | ||
9359 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9360 | ||
9361 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9362 | { } /* end */ | |
9363 | }; | |
9364 | ||
9365 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 9366 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
272a527c | 9367 | { |
a9fd4f3f | 9368 | struct alc_spec *spec = codec->spec; |
272a527c | 9369 | |
a9fd4f3f TI |
9370 | spec->autocfg.hp_pins[0] = 0x14; |
9371 | spec->autocfg.speaker_pins[0] = 0x15; | |
272a527c KY |
9372 | } |
9373 | ||
ccc656ce | 9374 | /* toggle speaker-output according to the hp-jack state */ |
c259249f SA |
9375 | #define alc883_targa_init_hook alc882_targa_init_hook |
9376 | #define alc883_targa_unsol_event alc882_targa_unsol_event | |
368c7a95 | 9377 | |
0c4cc443 HRK |
9378 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
9379 | { | |
9380 | unsigned int present; | |
9381 | ||
d56757ab | 9382 | present = snd_hda_jack_detect(codec, 0x18); |
0c4cc443 HRK |
9383 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
9384 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9385 | } | |
9386 | ||
4f5d1706 | 9387 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
0c4cc443 | 9388 | { |
a9fd4f3f TI |
9389 | struct alc_spec *spec = codec->spec; |
9390 | ||
9391 | spec->autocfg.hp_pins[0] = 0x15; | |
9392 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
9393 | } |
9394 | ||
9395 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | |
9396 | { | |
a9fd4f3f | 9397 | alc_automute_amp(codec); |
0c4cc443 HRK |
9398 | alc883_clevo_m720_mic_automute(codec); |
9399 | } | |
9400 | ||
9401 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
368c7a95 J |
9402 | unsigned int res) |
9403 | { | |
0c4cc443 | 9404 | switch (res >> 26) { |
0c4cc443 HRK |
9405 | case ALC880_MIC_EVENT: |
9406 | alc883_clevo_m720_mic_automute(codec); | |
9407 | break; | |
a9fd4f3f TI |
9408 | default: |
9409 | alc_automute_amp_unsol_event(codec, res); | |
9410 | break; | |
0c4cc443 | 9411 | } |
368c7a95 J |
9412 | } |
9413 | ||
fb97dc67 | 9414 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 9415 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
fb97dc67 | 9416 | { |
a9fd4f3f | 9417 | struct alc_spec *spec = codec->spec; |
fb97dc67 | 9418 | |
a9fd4f3f TI |
9419 | spec->autocfg.hp_pins[0] = 0x14; |
9420 | spec->autocfg.speaker_pins[0] = 0x15; | |
fb97dc67 J |
9421 | } |
9422 | ||
4f5d1706 | 9423 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
fb97dc67 | 9424 | { |
a9fd4f3f | 9425 | struct alc_spec *spec = codec->spec; |
189609ae | 9426 | |
a9fd4f3f TI |
9427 | spec->autocfg.hp_pins[0] = 0x1b; |
9428 | spec->autocfg.speaker_pins[0] = 0x14; | |
189609ae KY |
9429 | } |
9430 | ||
bc9f98a9 KY |
9431 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
9432 | { | |
864f92be | 9433 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
bc9f98a9 | 9434 | |
47fd830a TI |
9435 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9436 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
9437 | } |
9438 | ||
9439 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
9440 | { | |
864f92be | 9441 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
bc9f98a9 | 9442 | |
47fd830a TI |
9443 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9444 | HDA_AMP_MUTE, bits); | |
9445 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9446 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
9447 | } |
9448 | ||
9449 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
9450 | unsigned int res) | |
9451 | { | |
9452 | if ((res >> 26) == ALC880_HP_EVENT) | |
9453 | alc883_lenovo_101e_all_automute(codec); | |
9454 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9455 | alc883_lenovo_101e_ispeaker_automute(codec); | |
9456 | } | |
9457 | ||
676a9b53 | 9458 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 9459 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
676a9b53 | 9460 | { |
a9fd4f3f | 9461 | struct alc_spec *spec = codec->spec; |
676a9b53 | 9462 | |
a9fd4f3f TI |
9463 | spec->autocfg.hp_pins[0] = 0x14; |
9464 | spec->autocfg.speaker_pins[0] = 0x15; | |
9465 | spec->autocfg.speaker_pins[1] = 0x16; | |
676a9b53 TI |
9466 | } |
9467 | ||
d1a991a6 KY |
9468 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
9469 | /* HP Pin: output 0 (0x0c) */ | |
9470 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9471 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9472 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9473 | /* Front Pin: output 0 (0x0c) */ | |
676a9b53 TI |
9474 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
9475 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1a991a6 | 9476 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
d1a991a6 KY |
9477 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9478 | /* eanable EAPD on medion laptop */ | |
9479 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9480 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
676a9b53 TI |
9481 | /* enable unsolicited event */ |
9482 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
d1a991a6 KY |
9483 | { } |
9484 | }; | |
9485 | ||
fc86f954 DK |
9486 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
9487 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9488 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9489 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9490 | { } /* end */ | |
9491 | }; | |
9492 | ||
4f5d1706 | 9493 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
5795b9e6 | 9494 | { |
a9fd4f3f | 9495 | struct alc_spec *spec = codec->spec; |
5795b9e6 | 9496 | |
a9fd4f3f TI |
9497 | spec->autocfg.hp_pins[0] = 0x1b; |
9498 | spec->autocfg.speaker_pins[0] = 0x14; | |
9499 | spec->autocfg.speaker_pins[1] = 0x15; | |
9500 | spec->autocfg.speaker_pins[2] = 0x16; | |
9501 | spec->autocfg.speaker_pins[3] = 0x17; | |
5795b9e6 CM |
9502 | } |
9503 | ||
4f5d1706 | 9504 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
e2757d5e | 9505 | { |
a9fd4f3f | 9506 | struct alc_spec *spec = codec->spec; |
e2757d5e | 9507 | |
a9fd4f3f TI |
9508 | spec->autocfg.hp_pins[0] = 0x1b; |
9509 | spec->autocfg.speaker_pins[0] = 0x14; | |
9510 | spec->autocfg.speaker_pins[1] = 0x15; | |
9511 | spec->autocfg.speaker_pins[2] = 0x16; | |
9512 | spec->autocfg.speaker_pins[3] = 0x17; | |
9513 | spec->autocfg.speaker_pins[4] = 0x1a; | |
e2757d5e KY |
9514 | } |
9515 | ||
4f5d1706 | 9516 | static void alc883_vaiott_setup(struct hda_codec *codec) |
3e1647c5 GG |
9517 | { |
9518 | struct alc_spec *spec = codec->spec; | |
9519 | ||
9520 | spec->autocfg.hp_pins[0] = 0x15; | |
9521 | spec->autocfg.speaker_pins[0] = 0x14; | |
9522 | spec->autocfg.speaker_pins[1] = 0x17; | |
3e1647c5 GG |
9523 | } |
9524 | ||
e2757d5e KY |
9525 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
9526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9527 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9528 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9529 | /* enable unsolicited event */ | |
9530 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9531 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9532 | { } /* end */ | |
9533 | }; | |
9534 | ||
4f5d1706 | 9535 | static void alc883_mode2_setup(struct hda_codec *codec) |
e2757d5e | 9536 | { |
a9fd4f3f | 9537 | struct alc_spec *spec = codec->spec; |
e2757d5e | 9538 | |
a9fd4f3f TI |
9539 | spec->autocfg.hp_pins[0] = 0x1b; |
9540 | spec->autocfg.speaker_pins[0] = 0x14; | |
9541 | spec->autocfg.speaker_pins[1] = 0x15; | |
9542 | spec->autocfg.speaker_pins[2] = 0x16; | |
4f5d1706 TI |
9543 | spec->ext_mic.pin = 0x18; |
9544 | spec->int_mic.pin = 0x19; | |
9545 | spec->ext_mic.mux_idx = 0; | |
9546 | spec->int_mic.mux_idx = 1; | |
9547 | spec->auto_mic = 1; | |
e2757d5e KY |
9548 | } |
9549 | ||
9550 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | |
9551 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9552 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9553 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9554 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9555 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9556 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
9557 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | |
9558 | /* enable unsolicited event */ | |
9559 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9560 | { } /* end */ | |
9561 | }; | |
9562 | ||
e2757d5e KY |
9563 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
9564 | { | |
a9fd4f3f TI |
9565 | struct alc_spec *spec = codec->spec; |
9566 | ||
9567 | spec->autocfg.hp_pins[0] = 0x14; | |
9568 | spec->autocfg.speaker_pins[0] = 0x1b; | |
9569 | alc_automute_pin(codec); | |
e2757d5e KY |
9570 | } |
9571 | ||
eb4c41d3 TS |
9572 | static struct hda_verb alc889A_mb31_verbs[] = { |
9573 | /* Init rear pin (used as headphone output) */ | |
9574 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ | |
9575 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ | |
9576 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9577 | /* Init line pin (used as output in 4ch and 6ch mode) */ | |
9578 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ | |
9579 | /* Init line 2 pin (used as headphone out by default) */ | |
9580 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ | |
9581 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ | |
9582 | { } /* end */ | |
9583 | }; | |
9584 | ||
9585 | /* Mute speakers according to the headphone jack state */ | |
9586 | static void alc889A_mb31_automute(struct hda_codec *codec) | |
9587 | { | |
9588 | unsigned int present; | |
9589 | ||
9590 | /* Mute only in 2ch or 4ch mode */ | |
9591 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) | |
9592 | == 0x00) { | |
864f92be | 9593 | present = snd_hda_jack_detect(codec, 0x15); |
eb4c41d3 TS |
9594 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9595 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9596 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9597 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9598 | } | |
9599 | } | |
9600 | ||
9601 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |
9602 | { | |
9603 | if ((res >> 26) == ALC880_HP_EVENT) | |
9604 | alc889A_mb31_automute(codec); | |
9605 | } | |
9606 | ||
4953550a | 9607 | |
cb53c626 | 9608 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4953550a | 9609 | #define alc882_loopbacks alc880_loopbacks |
cb53c626 TI |
9610 | #endif |
9611 | ||
def319f9 | 9612 | /* pcm configuration: identical with ALC880 */ |
4953550a TI |
9613 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
9614 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
9615 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
9616 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
9617 | ||
9618 | static hda_nid_t alc883_slave_dig_outs[] = { | |
9619 | ALC1200_DIGOUT_NID, 0, | |
9620 | }; | |
9621 | ||
9622 | static hda_nid_t alc1200_slave_dig_outs[] = { | |
9623 | ALC883_DIGOUT_NID, 0, | |
9624 | }; | |
9c7f852e TI |
9625 | |
9626 | /* | |
9627 | * configuration and preset | |
9628 | */ | |
4953550a TI |
9629 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
9630 | [ALC882_3ST_DIG] = "3stack-dig", | |
9631 | [ALC882_6ST_DIG] = "6stack-dig", | |
9632 | [ALC882_ARIMA] = "arima", | |
9633 | [ALC882_W2JC] = "w2jc", | |
9634 | [ALC882_TARGA] = "targa", | |
9635 | [ALC882_ASUS_A7J] = "asus-a7j", | |
9636 | [ALC882_ASUS_A7M] = "asus-a7m", | |
9637 | [ALC885_MACPRO] = "macpro", | |
9638 | [ALC885_MB5] = "mb5", | |
e458b1fa | 9639 | [ALC885_MACMINI3] = "macmini3", |
76e6f5a9 | 9640 | [ALC885_MBA21] = "mba21", |
4953550a TI |
9641 | [ALC885_MBP3] = "mbp3", |
9642 | [ALC885_IMAC24] = "imac24", | |
4b7e1803 | 9643 | [ALC885_IMAC91] = "imac91", |
4953550a | 9644 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
f5fcc13c TI |
9645 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
9646 | [ALC883_3ST_6ch] = "3stack-6ch", | |
4953550a | 9647 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
f5fcc13c TI |
9648 | [ALC883_TARGA_DIG] = "targa-dig", |
9649 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
64a8be74 | 9650 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
f5fcc13c | 9651 | [ALC883_ACER] = "acer", |
2880a867 | 9652 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
5b2d1eca | 9653 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
b1a91469 | 9654 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
3b315d70 | 9655 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
fc86f954 | 9656 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
f5fcc13c | 9657 | [ALC883_MEDION] = "medion", |
272a527c | 9658 | [ALC883_MEDION_MD2] = "medion-md2", |
7ad7b218 | 9659 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
f5fcc13c | 9660 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
bc9f98a9 | 9661 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
272a527c KY |
9662 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
9663 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
e2757d5e | 9664 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
189609ae | 9665 | [ALC883_HAIER_W66] = "haier-w66", |
4723c022 | 9666 | [ALC888_3ST_HP] = "3stack-hp", |
5795b9e6 | 9667 | [ALC888_6ST_DELL] = "6stack-dell", |
a8848bd6 | 9668 | [ALC883_MITAC] = "mitac", |
a65cc60f | 9669 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
0c4cc443 | 9670 | [ALC883_CLEVO_M720] = "clevo-m720", |
fb97dc67 | 9671 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
ef8ef5fb | 9672 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
17bba1b7 | 9673 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
87a8c370 JK |
9674 | [ALC889A_INTEL] = "intel-alc889a", |
9675 | [ALC889_INTEL] = "intel-x58", | |
3ab90935 | 9676 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
eb4c41d3 | 9677 | [ALC889A_MB31] = "mb31", |
3e1647c5 | 9678 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
4953550a | 9679 | [ALC882_AUTO] = "auto", |
f5fcc13c TI |
9680 | }; |
9681 | ||
4953550a TI |
9682 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
9683 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
9684 | ||
ac3e3741 | 9685 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
69e50282 | 9686 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
9b6682ff | 9687 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
ac3e3741 TI |
9688 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
9689 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
0b18cb18 | 9690 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
5b2d1eca VP |
9691 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
9692 | ALC888_ACER_ASPIRE_4930G), | |
a8e4f9dd | 9693 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
83dd7408 | 9694 | ALC888_ACER_ASPIRE_4930G), |
3b315d70 HM |
9695 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
9696 | ALC888_ACER_ASPIRE_8930G), | |
e46b0c8c TI |
9697 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
9698 | ALC888_ACER_ASPIRE_8930G), | |
4953550a TI |
9699 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
9700 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), | |
a8e4f9dd | 9701 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
dde65356 | 9702 | ALC888_ACER_ASPIRE_6530G), |
cc374c47 | 9703 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
d2fd4b09 | 9704 | ALC888_ACER_ASPIRE_6530G), |
fc86f954 DK |
9705 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
9706 | ALC888_ACER_ASPIRE_7730G), | |
22b530e0 TI |
9707 | /* default Acer -- disabled as it causes more problems. |
9708 | * model=auto should work fine now | |
9709 | */ | |
9710 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | |
4953550a | 9711 | |
5795b9e6 | 9712 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
4953550a | 9713 | |
febe3375 | 9714 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
ac3e3741 TI |
9715 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
9716 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
5d85f8d0 | 9717 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
06bf3e15 | 9718 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
7ec30f0e | 9719 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
4953550a TI |
9720 | |
9721 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | |
9722 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | |
9723 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | |
a01c30cb | 9724 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
4953550a TI |
9725 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
9726 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | |
9727 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | |
ac3e3741 | 9728 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
44a678d0 | 9729 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
3ab90935 | 9730 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
e2757d5e | 9731 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
4953550a TI |
9732 | |
9733 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | |
97ec710c | 9734 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
4953550a | 9735 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
2de686d2 | 9736 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
ac3e3741 TI |
9737 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
9738 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
e2757d5e | 9739 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
ac3e3741 | 9740 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
4953550a TI |
9741 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
9742 | ||
6f3bf657 | 9743 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
bba8dee7 | 9744 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 9745 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
4953550a | 9746 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
2fef62c8 | 9747 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
4953550a | 9748 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
dd146a60 | 9749 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
82808236 | 9750 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
f5fcc13c | 9751 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 9752 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
9753 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
9754 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 | 9755 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
64ca1c29 | 9756 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
b1e4422f | 9757 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
9758 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
9759 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
9760 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
b43f6e5e | 9761 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
64a8be74 | 9762 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
ac3e3741 TI |
9763 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
9764 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
9765 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
ee09543c | 9766 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
86d34b7e | 9767 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
ac3e3741 TI |
9768 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
9769 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
df01b8af | 9770 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
b43f6e5e | 9771 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
f5fcc13c | 9772 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
b1e4422f | 9773 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
4953550a | 9774 | |
ac3e3741 | 9775 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
d1501ea8 | 9776 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), |
0c4cc443 HRK |
9777 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
9778 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
a65cc60f | 9779 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
dea0a509 | 9780 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
e60623b4 | 9781 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
4953550a | 9782 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
f5fcc13c | 9783 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
bfb53037 | 9784 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
f67d8176 | 9785 | ALC883_FUJITSU_PI2515), |
bfb53037 | 9786 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
ef8ef5fb | 9787 | ALC888_FUJITSU_XA3530), |
272a527c | 9788 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
272a527c | 9789 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
ac3e3741 TI |
9790 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
9791 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
e2757d5e | 9792 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
272a527c | 9793 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
959973b9 | 9794 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
0b167bf4 | 9795 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
189609ae | 9796 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
4953550a | 9797 | |
17bba1b7 J |
9798 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
9799 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
2de686d2 | 9800 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
87a8c370 JK |
9801 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
9802 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | |
9803 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | |
572c0e3c | 9804 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
9c7f852e | 9805 | |
4953550a | 9806 | {} |
f3cd3f5d WF |
9807 | }; |
9808 | ||
4953550a TI |
9809 | /* codec SSID table for Intel Mac */ |
9810 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |
9811 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | |
9812 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | |
9813 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | |
9814 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | |
9815 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | |
9816 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | |
9817 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | |
26fd74fc | 9818 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
ab669967 | 9819 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), |
f53dae28 | 9820 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
6e12970b | 9821 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
4953550a TI |
9822 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
9823 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | |
9824 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | |
4b7e1803 | 9825 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
4953550a | 9826 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
3bfea98f | 9827 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
46ef6ec9 DC |
9828 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
9829 | * so apparently no perfect solution yet | |
4953550a TI |
9830 | */ |
9831 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | |
46ef6ec9 | 9832 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
e458b1fa | 9833 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
4953550a | 9834 | {} /* terminator */ |
b25c9da1 WF |
9835 | }; |
9836 | ||
4953550a TI |
9837 | static struct alc_config_preset alc882_presets[] = { |
9838 | [ALC882_3ST_DIG] = { | |
9839 | .mixers = { alc882_base_mixer }, | |
8ab9e0af TI |
9840 | .init_verbs = { alc882_base_init_verbs, |
9841 | alc882_adc1_init_verbs }, | |
4953550a TI |
9842 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9843 | .dac_nids = alc882_dac_nids, | |
9844 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9845 | .dig_in_nid = ALC882_DIGIN_NID, | |
9846 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9847 | .channel_mode = alc882_ch_modes, | |
9848 | .need_dac_fix = 1, | |
9849 | .input_mux = &alc882_capture_source, | |
9850 | }, | |
9851 | [ALC882_6ST_DIG] = { | |
9852 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9853 | .init_verbs = { alc882_base_init_verbs, |
9854 | alc882_adc1_init_verbs }, | |
4953550a TI |
9855 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9856 | .dac_nids = alc882_dac_nids, | |
9857 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9858 | .dig_in_nid = ALC882_DIGIN_NID, | |
9859 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9860 | .channel_mode = alc882_sixstack_modes, | |
9861 | .input_mux = &alc882_capture_source, | |
9862 | }, | |
9863 | [ALC882_ARIMA] = { | |
9864 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9865 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
9866 | alc882_eapd_verbs }, | |
4953550a TI |
9867 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9868 | .dac_nids = alc882_dac_nids, | |
9869 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9870 | .channel_mode = alc882_sixstack_modes, | |
9871 | .input_mux = &alc882_capture_source, | |
9872 | }, | |
9873 | [ALC882_W2JC] = { | |
9874 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9875 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
9876 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | |
4953550a TI |
9877 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9878 | .dac_nids = alc882_dac_nids, | |
9879 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
9880 | .channel_mode = alc880_threestack_modes, | |
9881 | .need_dac_fix = 1, | |
9882 | .input_mux = &alc882_capture_source, | |
9883 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9884 | }, | |
76e6f5a9 RH |
9885 | [ALC885_MBA21] = { |
9886 | .mixers = { alc885_mba21_mixer }, | |
9887 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, | |
9888 | .num_dacs = 2, | |
9889 | .dac_nids = alc882_dac_nids, | |
9890 | .channel_mode = alc885_mba21_ch_modes, | |
9891 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
9892 | .input_mux = &alc882_capture_source, | |
9893 | .unsol_event = alc_automute_amp_unsol_event, | |
9894 | .setup = alc885_mba21_setup, | |
9895 | .init_hook = alc_automute_amp, | |
9896 | }, | |
4953550a TI |
9897 | [ALC885_MBP3] = { |
9898 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
9899 | .init_verbs = { alc885_mbp3_init_verbs, | |
9900 | alc880_gpio1_init_verbs }, | |
be0ae923 | 9901 | .num_dacs = 2, |
4953550a | 9902 | .dac_nids = alc882_dac_nids, |
be0ae923 TI |
9903 | .hp_nid = 0x04, |
9904 | .channel_mode = alc885_mbp_4ch_modes, | |
9905 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | |
4953550a TI |
9906 | .input_mux = &alc882_capture_source, |
9907 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9908 | .dig_in_nid = ALC882_DIGIN_NID, | |
9909 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 TI |
9910 | .setup = alc885_mbp3_setup, |
9911 | .init_hook = alc_automute_amp, | |
4953550a TI |
9912 | }, |
9913 | [ALC885_MB5] = { | |
9914 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | |
9915 | .init_verbs = { alc885_mb5_init_verbs, | |
9916 | alc880_gpio1_init_verbs }, | |
9917 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9918 | .dac_nids = alc882_dac_nids, | |
9919 | .channel_mode = alc885_mb5_6ch_modes, | |
9920 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | |
9921 | .input_mux = &mb5_capture_source, | |
9922 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9923 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
9924 | .unsol_event = alc_automute_amp_unsol_event, |
9925 | .setup = alc885_mb5_setup, | |
9926 | .init_hook = alc_automute_amp, | |
4953550a | 9927 | }, |
e458b1fa LY |
9928 | [ALC885_MACMINI3] = { |
9929 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, | |
9930 | .init_verbs = { alc885_macmini3_init_verbs, | |
9931 | alc880_gpio1_init_verbs }, | |
9932 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9933 | .dac_nids = alc882_dac_nids, | |
9934 | .channel_mode = alc885_macmini3_6ch_modes, | |
9935 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), | |
9936 | .input_mux = &macmini3_capture_source, | |
9937 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9938 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
9939 | .unsol_event = alc_automute_amp_unsol_event, |
9940 | .setup = alc885_macmini3_setup, | |
9941 | .init_hook = alc_automute_amp, | |
e458b1fa | 9942 | }, |
4953550a TI |
9943 | [ALC885_MACPRO] = { |
9944 | .mixers = { alc882_macpro_mixer }, | |
9945 | .init_verbs = { alc882_macpro_init_verbs }, | |
9946 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9947 | .dac_nids = alc882_dac_nids, | |
9948 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9949 | .dig_in_nid = ALC882_DIGIN_NID, | |
9950 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9951 | .channel_mode = alc882_ch_modes, | |
9952 | .input_mux = &alc882_capture_source, | |
9953 | .init_hook = alc885_macpro_init_hook, | |
9954 | }, | |
9955 | [ALC885_IMAC24] = { | |
9956 | .mixers = { alc885_imac24_mixer }, | |
9957 | .init_verbs = { alc885_imac24_init_verbs }, | |
9958 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9959 | .dac_nids = alc882_dac_nids, | |
9960 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9961 | .dig_in_nid = ALC882_DIGIN_NID, | |
9962 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9963 | .channel_mode = alc882_ch_modes, | |
9964 | .input_mux = &alc882_capture_source, | |
9965 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 | 9966 | .setup = alc885_imac24_setup, |
4953550a TI |
9967 | .init_hook = alc885_imac24_init_hook, |
9968 | }, | |
4b7e1803 | 9969 | [ALC885_IMAC91] = { |
b7cccc52 | 9970 | .mixers = {alc885_imac91_mixer}, |
4b7e1803 JM |
9971 | .init_verbs = { alc885_imac91_init_verbs, |
9972 | alc880_gpio1_init_verbs }, | |
9973 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9974 | .dac_nids = alc882_dac_nids, | |
b7cccc52 JM |
9975 | .channel_mode = alc885_mba21_ch_modes, |
9976 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
9977 | .input_mux = &alc889A_imac91_capture_source, | |
4b7e1803 JM |
9978 | .dig_out_nid = ALC882_DIGOUT_NID, |
9979 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
9980 | .unsol_event = alc_automute_amp_unsol_event, |
9981 | .setup = alc885_imac91_setup, | |
9982 | .init_hook = alc_automute_amp, | |
4b7e1803 | 9983 | }, |
4953550a TI |
9984 | [ALC882_TARGA] = { |
9985 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | |
8ab9e0af | 9986 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
31909b83 | 9987 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
4953550a TI |
9988 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9989 | .dac_nids = alc882_dac_nids, | |
9990 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9991 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
9992 | .adc_nids = alc882_adc_nids, | |
9993 | .capsrc_nids = alc882_capsrc_nids, | |
9994 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
9995 | .channel_mode = alc882_3ST_6ch_modes, | |
9996 | .need_dac_fix = 1, | |
9997 | .input_mux = &alc882_capture_source, | |
9998 | .unsol_event = alc882_targa_unsol_event, | |
4f5d1706 TI |
9999 | .setup = alc882_targa_setup, |
10000 | .init_hook = alc882_targa_automute, | |
4953550a TI |
10001 | }, |
10002 | [ALC882_ASUS_A7J] = { | |
10003 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
10004 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
10005 | alc882_asus_a7j_verbs}, | |
4953550a TI |
10006 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
10007 | .dac_nids = alc882_dac_nids, | |
10008 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10009 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
10010 | .adc_nids = alc882_adc_nids, | |
10011 | .capsrc_nids = alc882_capsrc_nids, | |
10012 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
10013 | .channel_mode = alc882_3ST_6ch_modes, | |
10014 | .need_dac_fix = 1, | |
10015 | .input_mux = &alc882_capture_source, | |
10016 | }, | |
10017 | [ALC882_ASUS_A7M] = { | |
10018 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
10019 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
10020 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | |
4953550a TI |
10021 | alc882_asus_a7m_verbs }, |
10022 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10023 | .dac_nids = alc882_dac_nids, | |
10024 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10025 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
10026 | .channel_mode = alc880_threestack_modes, | |
10027 | .need_dac_fix = 1, | |
10028 | .input_mux = &alc882_capture_source, | |
10029 | }, | |
9c7f852e TI |
10030 | [ALC883_3ST_2ch_DIG] = { |
10031 | .mixers = { alc883_3ST_2ch_mixer }, | |
10032 | .init_verbs = { alc883_init_verbs }, | |
10033 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10034 | .dac_nids = alc883_dac_nids, | |
10035 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
10036 | .dig_in_nid = ALC883_DIGIN_NID, |
10037 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10038 | .channel_mode = alc883_3ST_2ch_modes, | |
10039 | .input_mux = &alc883_capture_source, | |
10040 | }, | |
10041 | [ALC883_3ST_6ch_DIG] = { | |
10042 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10043 | .init_verbs = { alc883_init_verbs }, | |
10044 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10045 | .dac_nids = alc883_dac_nids, | |
10046 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
10047 | .dig_in_nid = ALC883_DIGIN_NID, |
10048 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10049 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 10050 | .need_dac_fix = 1, |
9c7f852e | 10051 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 10052 | }, |
9c7f852e TI |
10053 | [ALC883_3ST_6ch] = { |
10054 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10055 | .init_verbs = { alc883_init_verbs }, | |
10056 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10057 | .dac_nids = alc883_dac_nids, | |
9c7f852e TI |
10058 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
10059 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 10060 | .need_dac_fix = 1, |
9c7f852e | 10061 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 10062 | }, |
17bba1b7 J |
10063 | [ALC883_3ST_6ch_INTEL] = { |
10064 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
10065 | .init_verbs = { alc883_init_verbs }, | |
10066 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10067 | .dac_nids = alc883_dac_nids, | |
10068 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10069 | .dig_in_nid = ALC883_DIGIN_NID, | |
f3cd3f5d | 10070 | .slave_dig_outs = alc883_slave_dig_outs, |
17bba1b7 J |
10071 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
10072 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
10073 | .need_dac_fix = 1, | |
10074 | .input_mux = &alc883_3stack_6ch_intel, | |
10075 | }, | |
87a8c370 JK |
10076 | [ALC889A_INTEL] = { |
10077 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
6732bd0d WF |
10078 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
10079 | alc_hp15_unsol_verbs }, | |
87a8c370 JK |
10080 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10081 | .dac_nids = alc883_dac_nids, | |
10082 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
10083 | .adc_nids = alc889_adc_nids, | |
10084 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10085 | .dig_in_nid = ALC883_DIGIN_NID, | |
10086 | .slave_dig_outs = alc883_slave_dig_outs, | |
10087 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
10088 | .channel_mode = alc889_8ch_intel_modes, | |
10089 | .capsrc_nids = alc889_capsrc_nids, | |
10090 | .input_mux = &alc889_capture_source, | |
4f5d1706 TI |
10091 | .setup = alc889_automute_setup, |
10092 | .init_hook = alc_automute_amp, | |
6732bd0d | 10093 | .unsol_event = alc_automute_amp_unsol_event, |
87a8c370 JK |
10094 | .need_dac_fix = 1, |
10095 | }, | |
10096 | [ALC889_INTEL] = { | |
10097 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
10098 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | |
6732bd0d | 10099 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
87a8c370 JK |
10100 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10101 | .dac_nids = alc883_dac_nids, | |
10102 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
10103 | .adc_nids = alc889_adc_nids, | |
10104 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10105 | .dig_in_nid = ALC883_DIGIN_NID, | |
10106 | .slave_dig_outs = alc883_slave_dig_outs, | |
10107 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
10108 | .channel_mode = alc889_8ch_intel_modes, | |
10109 | .capsrc_nids = alc889_capsrc_nids, | |
10110 | .input_mux = &alc889_capture_source, | |
4f5d1706 | 10111 | .setup = alc889_automute_setup, |
6732bd0d WF |
10112 | .init_hook = alc889_intel_init_hook, |
10113 | .unsol_event = alc_automute_amp_unsol_event, | |
87a8c370 JK |
10114 | .need_dac_fix = 1, |
10115 | }, | |
9c7f852e TI |
10116 | [ALC883_6ST_DIG] = { |
10117 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10118 | .init_verbs = { alc883_init_verbs }, | |
10119 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10120 | .dac_nids = alc883_dac_nids, | |
10121 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
10122 | .dig_in_nid = ALC883_DIGIN_NID, |
10123 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10124 | .channel_mode = alc883_sixstack_modes, | |
10125 | .input_mux = &alc883_capture_source, | |
10126 | }, | |
ccc656ce | 10127 | [ALC883_TARGA_DIG] = { |
c259249f | 10128 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
005b1076 DH |
10129 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
10130 | alc883_targa_verbs}, | |
ccc656ce KY |
10131 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10132 | .dac_nids = alc883_dac_nids, | |
10133 | .dig_out_nid = ALC883_DIGOUT_NID, | |
ccc656ce KY |
10134 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
10135 | .channel_mode = alc883_3ST_6ch_modes, | |
10136 | .need_dac_fix = 1, | |
10137 | .input_mux = &alc883_capture_source, | |
c259249f | 10138 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10139 | .setup = alc882_targa_setup, |
10140 | .init_hook = alc882_targa_automute, | |
ccc656ce KY |
10141 | }, |
10142 | [ALC883_TARGA_2ch_DIG] = { | |
c259249f | 10143 | .mixers = { alc883_targa_2ch_mixer}, |
005b1076 DH |
10144 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
10145 | alc883_targa_verbs}, | |
ccc656ce KY |
10146 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10147 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10148 | .adc_nids = alc883_adc_nids_alt, |
10149 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10150 | .capsrc_nids = alc883_capsrc_nids, |
ccc656ce | 10151 | .dig_out_nid = ALC883_DIGOUT_NID, |
ccc656ce KY |
10152 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10153 | .channel_mode = alc883_3ST_2ch_modes, | |
10154 | .input_mux = &alc883_capture_source, | |
c259249f | 10155 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10156 | .setup = alc882_targa_setup, |
10157 | .init_hook = alc882_targa_automute, | |
ccc656ce | 10158 | }, |
64a8be74 | 10159 | [ALC883_TARGA_8ch_DIG] = { |
b99dba34 TI |
10160 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
10161 | alc883_chmode_mixer }, | |
64a8be74 | 10162 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
c259249f | 10163 | alc883_targa_verbs }, |
64a8be74 DH |
10164 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10165 | .dac_nids = alc883_dac_nids, | |
10166 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10167 | .adc_nids = alc883_adc_nids_rev, | |
10168 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10169 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10170 | .dig_in_nid = ALC883_DIGIN_NID, | |
10171 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), | |
10172 | .channel_mode = alc883_4ST_8ch_modes, | |
10173 | .need_dac_fix = 1, | |
10174 | .input_mux = &alc883_capture_source, | |
c259249f | 10175 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10176 | .setup = alc882_targa_setup, |
10177 | .init_hook = alc882_targa_automute, | |
64a8be74 | 10178 | }, |
bab282b9 | 10179 | [ALC883_ACER] = { |
676a9b53 | 10180 | .mixers = { alc883_base_mixer }, |
bab282b9 VA |
10181 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
10182 | * and the headphone jack. Turn this on and rely on the | |
10183 | * standard mute methods whenever the user wants to turn | |
10184 | * these outputs off. | |
10185 | */ | |
10186 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
10187 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10188 | .dac_nids = alc883_dac_nids, | |
bab282b9 VA |
10189 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10190 | .channel_mode = alc883_3ST_2ch_modes, | |
10191 | .input_mux = &alc883_capture_source, | |
10192 | }, | |
2880a867 | 10193 | [ALC883_ACER_ASPIRE] = { |
676a9b53 | 10194 | .mixers = { alc883_acer_aspire_mixer }, |
d1a991a6 | 10195 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
2880a867 TD |
10196 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10197 | .dac_nids = alc883_dac_nids, | |
10198 | .dig_out_nid = ALC883_DIGOUT_NID, | |
2880a867 TD |
10199 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10200 | .channel_mode = alc883_3ST_2ch_modes, | |
10201 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10202 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10203 | .setup = alc883_acer_aspire_setup, |
10204 | .init_hook = alc_automute_amp, | |
d1a991a6 | 10205 | }, |
5b2d1eca | 10206 | [ALC888_ACER_ASPIRE_4930G] = { |
ef8ef5fb | 10207 | .mixers = { alc888_base_mixer, |
5b2d1eca VP |
10208 | alc883_chmode_mixer }, |
10209 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10210 | alc888_acer_aspire_4930g_verbs }, | |
10211 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10212 | .dac_nids = alc883_dac_nids, | |
10213 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10214 | .adc_nids = alc883_adc_nids_rev, | |
10215 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10216 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10217 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10218 | .channel_mode = alc883_3ST_6ch_modes, | |
10219 | .need_dac_fix = 1, | |
973b8cb0 | 10220 | .const_channel_count = 6, |
5b2d1eca | 10221 | .num_mux_defs = |
ef8ef5fb VP |
10222 | ARRAY_SIZE(alc888_2_capture_sources), |
10223 | .input_mux = alc888_2_capture_sources, | |
d2fd4b09 | 10224 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10225 | .setup = alc888_acer_aspire_4930g_setup, |
10226 | .init_hook = alc_automute_amp, | |
d2fd4b09 TV |
10227 | }, |
10228 | [ALC888_ACER_ASPIRE_6530G] = { | |
10229 | .mixers = { alc888_acer_aspire_6530_mixer }, | |
10230 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10231 | alc888_acer_aspire_6530g_verbs }, | |
10232 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10233 | .dac_nids = alc883_dac_nids, | |
10234 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10235 | .adc_nids = alc883_adc_nids_rev, | |
10236 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10237 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10238 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10239 | .channel_mode = alc883_3ST_2ch_modes, | |
10240 | .num_mux_defs = | |
10241 | ARRAY_SIZE(alc888_2_capture_sources), | |
10242 | .input_mux = alc888_acer_aspire_6530_sources, | |
a9fd4f3f | 10243 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10244 | .setup = alc888_acer_aspire_6530g_setup, |
10245 | .init_hook = alc_automute_amp, | |
5b2d1eca | 10246 | }, |
3b315d70 | 10247 | [ALC888_ACER_ASPIRE_8930G] = { |
556eea9a | 10248 | .mixers = { alc889_acer_aspire_8930g_mixer, |
3b315d70 HM |
10249 | alc883_chmode_mixer }, |
10250 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
0f86a228 HM |
10251 | alc889_acer_aspire_8930g_verbs, |
10252 | alc889_eapd_verbs}, | |
3b315d70 HM |
10253 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10254 | .dac_nids = alc883_dac_nids, | |
018df418 HM |
10255 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
10256 | .adc_nids = alc889_adc_nids, | |
10257 | .capsrc_nids = alc889_capsrc_nids, | |
3b315d70 HM |
10258 | .dig_out_nid = ALC883_DIGOUT_NID, |
10259 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10260 | .channel_mode = alc883_3ST_6ch_modes, | |
10261 | .need_dac_fix = 1, | |
10262 | .const_channel_count = 6, | |
10263 | .num_mux_defs = | |
018df418 HM |
10264 | ARRAY_SIZE(alc889_capture_sources), |
10265 | .input_mux = alc889_capture_sources, | |
3b315d70 | 10266 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10267 | .setup = alc889_acer_aspire_8930g_setup, |
10268 | .init_hook = alc_automute_amp, | |
f5de24b0 | 10269 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
c97259df | 10270 | .power_hook = alc_power_eapd, |
f5de24b0 | 10271 | #endif |
3b315d70 | 10272 | }, |
fc86f954 DK |
10273 | [ALC888_ACER_ASPIRE_7730G] = { |
10274 | .mixers = { alc883_3ST_6ch_mixer, | |
10275 | alc883_chmode_mixer }, | |
10276 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10277 | alc888_acer_aspire_7730G_verbs }, | |
10278 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10279 | .dac_nids = alc883_dac_nids, | |
10280 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10281 | .adc_nids = alc883_adc_nids_rev, | |
10282 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10283 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10284 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10285 | .channel_mode = alc883_3ST_6ch_modes, | |
10286 | .need_dac_fix = 1, | |
10287 | .const_channel_count = 6, | |
10288 | .input_mux = &alc883_capture_source, | |
10289 | .unsol_event = alc_automute_amp_unsol_event, | |
10290 | .setup = alc888_acer_aspire_6530g_setup, | |
10291 | .init_hook = alc_automute_amp, | |
10292 | }, | |
c07584c8 TD |
10293 | [ALC883_MEDION] = { |
10294 | .mixers = { alc883_fivestack_mixer, | |
10295 | alc883_chmode_mixer }, | |
10296 | .init_verbs = { alc883_init_verbs, | |
b373bdeb | 10297 | alc883_medion_eapd_verbs }, |
c07584c8 TD |
10298 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10299 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10300 | .adc_nids = alc883_adc_nids_alt, |
10301 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10302 | .capsrc_nids = alc883_capsrc_nids, |
c07584c8 TD |
10303 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10304 | .channel_mode = alc883_sixstack_modes, | |
10305 | .input_mux = &alc883_capture_source, | |
b373bdeb | 10306 | }, |
272a527c KY |
10307 | [ALC883_MEDION_MD2] = { |
10308 | .mixers = { alc883_medion_md2_mixer}, | |
10309 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, | |
10310 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10311 | .dac_nids = alc883_dac_nids, | |
10312 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
10313 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10314 | .channel_mode = alc883_3ST_2ch_modes, | |
10315 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10316 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10317 | .setup = alc883_medion_md2_setup, |
10318 | .init_hook = alc_automute_amp, | |
ea1fb29a | 10319 | }, |
7ad7b218 MC |
10320 | [ALC883_MEDION_WIM2160] = { |
10321 | .mixers = { alc883_medion_wim2160_mixer }, | |
10322 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | |
10323 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10324 | .dac_nids = alc883_dac_nids, | |
10325 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10326 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
10327 | .adc_nids = alc883_adc_nids, | |
10328 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10329 | .channel_mode = alc883_3ST_2ch_modes, | |
10330 | .input_mux = &alc883_capture_source, | |
10331 | .unsol_event = alc_automute_amp_unsol_event, | |
10332 | .setup = alc883_medion_wim2160_setup, | |
10333 | .init_hook = alc_automute_amp, | |
10334 | }, | |
b373bdeb | 10335 | [ALC883_LAPTOP_EAPD] = { |
676a9b53 | 10336 | .mixers = { alc883_base_mixer }, |
b373bdeb AN |
10337 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
10338 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10339 | .dac_nids = alc883_dac_nids, | |
b373bdeb AN |
10340 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10341 | .channel_mode = alc883_3ST_2ch_modes, | |
10342 | .input_mux = &alc883_capture_source, | |
10343 | }, | |
a65cc60f | 10344 | [ALC883_CLEVO_M540R] = { |
10345 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10346 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | |
10347 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10348 | .dac_nids = alc883_dac_nids, | |
10349 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10350 | .dig_in_nid = ALC883_DIGIN_NID, | |
10351 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | |
10352 | .channel_mode = alc883_3ST_6ch_clevo_modes, | |
10353 | .need_dac_fix = 1, | |
10354 | .input_mux = &alc883_capture_source, | |
10355 | /* This machine has the hardware HP auto-muting, thus | |
10356 | * we need no software mute via unsol event | |
10357 | */ | |
10358 | }, | |
0c4cc443 HRK |
10359 | [ALC883_CLEVO_M720] = { |
10360 | .mixers = { alc883_clevo_m720_mixer }, | |
10361 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
368c7a95 J |
10362 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10363 | .dac_nids = alc883_dac_nids, | |
10364 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10365 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10366 | .channel_mode = alc883_3ST_2ch_modes, | |
10367 | .input_mux = &alc883_capture_source, | |
0c4cc443 | 10368 | .unsol_event = alc883_clevo_m720_unsol_event, |
4f5d1706 | 10369 | .setup = alc883_clevo_m720_setup, |
a9fd4f3f | 10370 | .init_hook = alc883_clevo_m720_init_hook, |
368c7a95 | 10371 | }, |
bc9f98a9 KY |
10372 | [ALC883_LENOVO_101E_2ch] = { |
10373 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
10374 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
10375 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10376 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10377 | .adc_nids = alc883_adc_nids_alt, |
10378 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10379 | .capsrc_nids = alc883_capsrc_nids, |
bc9f98a9 KY |
10380 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10381 | .channel_mode = alc883_3ST_2ch_modes, | |
10382 | .input_mux = &alc883_lenovo_101e_capture_source, | |
10383 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
10384 | .init_hook = alc883_lenovo_101e_all_automute, | |
10385 | }, | |
272a527c KY |
10386 | [ALC883_LENOVO_NB0763] = { |
10387 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
10388 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
10389 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10390 | .dac_nids = alc883_dac_nids, | |
272a527c KY |
10391 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10392 | .channel_mode = alc883_3ST_2ch_modes, | |
10393 | .need_dac_fix = 1, | |
10394 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
a9fd4f3f | 10395 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10396 | .setup = alc883_medion_md2_setup, |
10397 | .init_hook = alc_automute_amp, | |
272a527c KY |
10398 | }, |
10399 | [ALC888_LENOVO_MS7195_DIG] = { | |
10400 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10401 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
10402 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10403 | .dac_nids = alc883_dac_nids, | |
10404 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
10405 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
10406 | .channel_mode = alc883_3ST_6ch_modes, | |
10407 | .need_dac_fix = 1, | |
10408 | .input_mux = &alc883_capture_source, | |
10409 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
10410 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
189609ae KY |
10411 | }, |
10412 | [ALC883_HAIER_W66] = { | |
c259249f | 10413 | .mixers = { alc883_targa_2ch_mixer}, |
189609ae KY |
10414 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
10415 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10416 | .dac_nids = alc883_dac_nids, | |
10417 | .dig_out_nid = ALC883_DIGOUT_NID, | |
189609ae KY |
10418 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10419 | .channel_mode = alc883_3ST_2ch_modes, | |
10420 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10421 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10422 | .setup = alc883_haier_w66_setup, |
10423 | .init_hook = alc_automute_amp, | |
eea6419e | 10424 | }, |
4723c022 | 10425 | [ALC888_3ST_HP] = { |
eea6419e | 10426 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
4723c022 | 10427 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
8341de60 CM |
10428 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10429 | .dac_nids = alc883_dac_nids, | |
4723c022 CM |
10430 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
10431 | .channel_mode = alc888_3st_hp_modes, | |
8341de60 CM |
10432 | .need_dac_fix = 1, |
10433 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10434 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10435 | .setup = alc888_3st_hp_setup, |
10436 | .init_hook = alc_automute_amp, | |
8341de60 | 10437 | }, |
5795b9e6 | 10438 | [ALC888_6ST_DELL] = { |
f24dbdc6 | 10439 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
5795b9e6 CM |
10440 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
10441 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10442 | .dac_nids = alc883_dac_nids, | |
10443 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5795b9e6 CM |
10444 | .dig_in_nid = ALC883_DIGIN_NID, |
10445 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10446 | .channel_mode = alc883_sixstack_modes, | |
10447 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10448 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10449 | .setup = alc888_6st_dell_setup, |
10450 | .init_hook = alc_automute_amp, | |
5795b9e6 | 10451 | }, |
a8848bd6 AS |
10452 | [ALC883_MITAC] = { |
10453 | .mixers = { alc883_mitac_mixer }, | |
10454 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
10455 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10456 | .dac_nids = alc883_dac_nids, | |
a8848bd6 AS |
10457 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10458 | .channel_mode = alc883_3ST_2ch_modes, | |
10459 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10460 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10461 | .setup = alc883_mitac_setup, |
10462 | .init_hook = alc_automute_amp, | |
a8848bd6 | 10463 | }, |
fb97dc67 J |
10464 | [ALC883_FUJITSU_PI2515] = { |
10465 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
10466 | .init_verbs = { alc883_init_verbs, | |
10467 | alc883_2ch_fujitsu_pi2515_verbs}, | |
10468 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10469 | .dac_nids = alc883_dac_nids, | |
10470 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10471 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10472 | .channel_mode = alc883_3ST_2ch_modes, | |
10473 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
a9fd4f3f | 10474 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10475 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
10476 | .init_hook = alc_automute_amp, | |
fb97dc67 | 10477 | }, |
ef8ef5fb VP |
10478 | [ALC888_FUJITSU_XA3530] = { |
10479 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | |
10480 | .init_verbs = { alc883_init_verbs, | |
10481 | alc888_fujitsu_xa3530_verbs }, | |
10482 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10483 | .dac_nids = alc883_dac_nids, | |
10484 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10485 | .adc_nids = alc883_adc_nids_rev, | |
10486 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10487 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10488 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), | |
10489 | .channel_mode = alc888_4ST_8ch_intel_modes, | |
10490 | .num_mux_defs = | |
10491 | ARRAY_SIZE(alc888_2_capture_sources), | |
10492 | .input_mux = alc888_2_capture_sources, | |
a9fd4f3f | 10493 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10494 | .setup = alc888_fujitsu_xa3530_setup, |
10495 | .init_hook = alc_automute_amp, | |
ef8ef5fb | 10496 | }, |
e2757d5e KY |
10497 | [ALC888_LENOVO_SKY] = { |
10498 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | |
10499 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | |
10500 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10501 | .dac_nids = alc883_dac_nids, | |
10502 | .dig_out_nid = ALC883_DIGOUT_NID, | |
e2757d5e KY |
10503 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10504 | .channel_mode = alc883_sixstack_modes, | |
10505 | .need_dac_fix = 1, | |
10506 | .input_mux = &alc883_lenovo_sky_capture_source, | |
a9fd4f3f | 10507 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10508 | .setup = alc888_lenovo_sky_setup, |
10509 | .init_hook = alc_automute_amp, | |
e2757d5e KY |
10510 | }, |
10511 | [ALC888_ASUS_M90V] = { | |
10512 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10513 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | |
10514 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10515 | .dac_nids = alc883_dac_nids, | |
10516 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10517 | .dig_in_nid = ALC883_DIGIN_NID, | |
10518 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10519 | .channel_mode = alc883_3ST_6ch_modes, | |
10520 | .need_dac_fix = 1, | |
10521 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
4f5d1706 TI |
10522 | .unsol_event = alc_sku_unsol_event, |
10523 | .setup = alc883_mode2_setup, | |
10524 | .init_hook = alc_inithook, | |
e2757d5e KY |
10525 | }, |
10526 | [ALC888_ASUS_EEE1601] = { | |
10527 | .mixers = { alc883_asus_eee1601_mixer }, | |
f9e336f6 | 10528 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
e2757d5e KY |
10529 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
10530 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10531 | .dac_nids = alc883_dac_nids, | |
10532 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10533 | .dig_in_nid = ALC883_DIGIN_NID, | |
10534 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10535 | .channel_mode = alc883_3ST_2ch_modes, | |
10536 | .need_dac_fix = 1, | |
10537 | .input_mux = &alc883_asus_eee1601_capture_source, | |
a9fd4f3f | 10538 | .unsol_event = alc_sku_unsol_event, |
e2757d5e KY |
10539 | .init_hook = alc883_eee1601_inithook, |
10540 | }, | |
3ab90935 WF |
10541 | [ALC1200_ASUS_P5Q] = { |
10542 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10543 | .init_verbs = { alc883_init_verbs }, | |
10544 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10545 | .dac_nids = alc883_dac_nids, | |
10546 | .dig_out_nid = ALC1200_DIGOUT_NID, | |
10547 | .dig_in_nid = ALC883_DIGIN_NID, | |
b25c9da1 | 10548 | .slave_dig_outs = alc1200_slave_dig_outs, |
3ab90935 WF |
10549 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10550 | .channel_mode = alc883_sixstack_modes, | |
10551 | .input_mux = &alc883_capture_source, | |
10552 | }, | |
eb4c41d3 TS |
10553 | [ALC889A_MB31] = { |
10554 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, | |
10555 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, | |
10556 | alc880_gpio1_init_verbs }, | |
10557 | .adc_nids = alc883_adc_nids, | |
10558 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
035eb0cf | 10559 | .capsrc_nids = alc883_capsrc_nids, |
eb4c41d3 TS |
10560 | .dac_nids = alc883_dac_nids, |
10561 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10562 | .channel_mode = alc889A_mb31_6ch_modes, | |
10563 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), | |
10564 | .input_mux = &alc889A_mb31_capture_source, | |
10565 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10566 | .unsol_event = alc889A_mb31_unsol_event, | |
10567 | .init_hook = alc889A_mb31_automute, | |
10568 | }, | |
3e1647c5 GG |
10569 | [ALC883_SONY_VAIO_TT] = { |
10570 | .mixers = { alc883_vaiott_mixer }, | |
10571 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, | |
10572 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10573 | .dac_nids = alc883_dac_nids, | |
10574 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10575 | .channel_mode = alc883_3ST_2ch_modes, | |
10576 | .input_mux = &alc883_capture_source, | |
10577 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 TI |
10578 | .setup = alc883_vaiott_setup, |
10579 | .init_hook = alc_automute_amp, | |
3e1647c5 | 10580 | }, |
9c7f852e TI |
10581 | }; |
10582 | ||
10583 | ||
4953550a TI |
10584 | /* |
10585 | * Pin config fixes | |
10586 | */ | |
10587 | enum { | |
954a29c8 TI |
10588 | PINFIX_ABIT_AW9D_MAX, |
10589 | PINFIX_PB_M5210, | |
4953550a TI |
10590 | }; |
10591 | ||
f8f25ba3 TI |
10592 | static const struct alc_fixup alc882_fixups[] = { |
10593 | [PINFIX_ABIT_AW9D_MAX] = { | |
73413b12 TI |
10594 | .pins = (const struct alc_pincfg[]) { |
10595 | { 0x15, 0x01080104 }, /* side */ | |
10596 | { 0x16, 0x01011012 }, /* rear */ | |
10597 | { 0x17, 0x01016011 }, /* clfe */ | |
10598 | { } | |
10599 | } | |
f8f25ba3 | 10600 | }, |
954a29c8 | 10601 | [PINFIX_PB_M5210] = { |
73413b12 TI |
10602 | .verbs = (const struct hda_verb[]) { |
10603 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | |
10604 | {} | |
10605 | } | |
954a29c8 | 10606 | }, |
4953550a TI |
10607 | }; |
10608 | ||
f8f25ba3 | 10609 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
954a29c8 | 10610 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
4953550a TI |
10611 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
10612 | {} | |
10613 | }; | |
10614 | ||
9c7f852e TI |
10615 | /* |
10616 | * BIOS auto configuration | |
10617 | */ | |
05f5f477 TI |
10618 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
10619 | const struct auto_pin_cfg *cfg) | |
10620 | { | |
10621 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | |
10622 | } | |
10623 | ||
4953550a | 10624 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
9c7f852e | 10625 | hda_nid_t nid, int pin_type, |
489008cd | 10626 | hda_nid_t dac) |
9c7f852e | 10627 | { |
f12ab1e0 TI |
10628 | int idx; |
10629 | ||
489008cd | 10630 | /* set as output */ |
f6c7e546 | 10631 | alc_set_pin_output(codec, nid, pin_type); |
489008cd TI |
10632 | |
10633 | if (dac == 0x25) | |
9c7f852e | 10634 | idx = 4; |
489008cd TI |
10635 | else if (dac >= 0x02 && dac <= 0x05) |
10636 | idx = dac - 2; | |
f9700d5a | 10637 | else |
489008cd | 10638 | return; |
9c7f852e | 10639 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
9c7f852e TI |
10640 | } |
10641 | ||
4953550a | 10642 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
9c7f852e TI |
10643 | { |
10644 | struct alc_spec *spec = codec->spec; | |
10645 | int i; | |
10646 | ||
10647 | for (i = 0; i <= HDA_SIDE; i++) { | |
f12ab1e0 | 10648 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 10649 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
9c7f852e | 10650 | if (nid) |
4953550a | 10651 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
489008cd | 10652 | spec->multiout.dac_nids[i]); |
9c7f852e TI |
10653 | } |
10654 | } | |
10655 | ||
4953550a | 10656 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
9c7f852e TI |
10657 | { |
10658 | struct alc_spec *spec = codec->spec; | |
489008cd | 10659 | hda_nid_t pin, dac; |
5855fb80 | 10660 | int i; |
9c7f852e | 10661 | |
5855fb80 TI |
10662 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
10663 | pin = spec->autocfg.hp_pins[i]; | |
10664 | if (!pin) | |
10665 | break; | |
489008cd TI |
10666 | dac = spec->multiout.hp_nid; |
10667 | if (!dac) | |
10668 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10669 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | |
10670 | } | |
5855fb80 TI |
10671 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
10672 | pin = spec->autocfg.speaker_pins[i]; | |
10673 | if (!pin) | |
10674 | break; | |
489008cd TI |
10675 | dac = spec->multiout.extra_out_nid[0]; |
10676 | if (!dac) | |
10677 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10678 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | |
10679 | } | |
9c7f852e TI |
10680 | } |
10681 | ||
4953550a | 10682 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
9c7f852e TI |
10683 | { |
10684 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 10685 | struct auto_pin_cfg *cfg = &spec->autocfg; |
9c7f852e TI |
10686 | int i; |
10687 | ||
66ceeb6b TI |
10688 | for (i = 0; i < cfg->num_inputs; i++) { |
10689 | hda_nid_t nid = cfg->inputs[i].pin; | |
30ea098f | 10690 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
4953550a TI |
10691 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
10692 | snd_hda_codec_write(codec, nid, 0, | |
10693 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10694 | AMP_OUT_MUTE); | |
10695 | } | |
10696 | } | |
10697 | ||
10698 | static void alc882_auto_init_input_src(struct hda_codec *codec) | |
10699 | { | |
10700 | struct alc_spec *spec = codec->spec; | |
10701 | int c; | |
10702 | ||
10703 | for (c = 0; c < spec->num_adc_nids; c++) { | |
10704 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | |
10705 | hda_nid_t nid = spec->capsrc_nids[c]; | |
10706 | unsigned int mux_idx; | |
10707 | const struct hda_input_mux *imux; | |
10708 | int conns, mute, idx, item; | |
10709 | ||
10710 | conns = snd_hda_get_connections(codec, nid, conn_list, | |
10711 | ARRAY_SIZE(conn_list)); | |
10712 | if (conns < 0) | |
10713 | continue; | |
10714 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
10715 | imux = &spec->input_mux[mux_idx]; | |
5311114d TI |
10716 | if (!imux->num_items && mux_idx > 0) |
10717 | imux = &spec->input_mux[0]; | |
4953550a TI |
10718 | for (idx = 0; idx < conns; idx++) { |
10719 | /* if the current connection is the selected one, | |
10720 | * unmute it as default - otherwise mute it | |
10721 | */ | |
10722 | mute = AMP_IN_MUTE(idx); | |
10723 | for (item = 0; item < imux->num_items; item++) { | |
10724 | if (imux->items[item].index == idx) { | |
10725 | if (spec->cur_mux[c] == item) | |
10726 | mute = AMP_IN_UNMUTE(idx); | |
10727 | break; | |
10728 | } | |
10729 | } | |
10730 | /* check if we have a selector or mixer | |
10731 | * we could check for the widget type instead, but | |
10732 | * just check for Amp-In presence (in case of mixer | |
10733 | * without amp-in there is something wrong, this | |
10734 | * function shouldn't be used or capsrc nid is wrong) | |
10735 | */ | |
10736 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | |
9c7f852e TI |
10737 | snd_hda_codec_write(codec, nid, 0, |
10738 | AC_VERB_SET_AMP_GAIN_MUTE, | |
4953550a TI |
10739 | mute); |
10740 | else if (mute != AMP_IN_MUTE(idx)) | |
10741 | snd_hda_codec_write(codec, nid, 0, | |
10742 | AC_VERB_SET_CONNECT_SEL, | |
10743 | idx); | |
9c7f852e TI |
10744 | } |
10745 | } | |
10746 | } | |
10747 | ||
4953550a TI |
10748 | /* add mic boosts if needed */ |
10749 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
10750 | { | |
10751 | struct alc_spec *spec = codec->spec; | |
66ceeb6b TI |
10752 | struct auto_pin_cfg *cfg = &spec->autocfg; |
10753 | int i, err; | |
4953550a TI |
10754 | hda_nid_t nid; |
10755 | ||
66ceeb6b | 10756 | for (i = 0; i < cfg->num_inputs; i++) { |
86e2959a | 10757 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
66ceeb6b TI |
10758 | break; |
10759 | nid = cfg->inputs[i].pin; | |
10760 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { | |
10a20af7 TI |
10761 | char label[32]; |
10762 | snprintf(label, sizeof(label), "%s Boost", | |
10763 | hda_get_autocfg_input_label(codec, cfg, i)); | |
66ceeb6b | 10764 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, |
4953550a | 10765 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
66ceeb6b TI |
10766 | if (err < 0) |
10767 | return err; | |
10768 | } | |
4953550a TI |
10769 | } |
10770 | return 0; | |
10771 | } | |
f511b01c | 10772 | |
9c7f852e | 10773 | /* almost identical with ALC880 parser... */ |
4953550a | 10774 | static int alc882_parse_auto_config(struct hda_codec *codec) |
9c7f852e TI |
10775 | { |
10776 | struct alc_spec *spec = codec->spec; | |
05f5f477 | 10777 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
757899ac | 10778 | int err; |
9c7f852e | 10779 | |
05f5f477 TI |
10780 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
10781 | alc882_ignore); | |
9c7f852e TI |
10782 | if (err < 0) |
10783 | return err; | |
05f5f477 TI |
10784 | if (!spec->autocfg.line_outs) |
10785 | return 0; /* can't find valid BIOS pin config */ | |
776e184e | 10786 | |
05f5f477 TI |
10787 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
10788 | if (err < 0) | |
10789 | return err; | |
10790 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
489008cd TI |
10791 | if (err < 0) |
10792 | return err; | |
10793 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
10794 | "Headphone"); | |
05f5f477 TI |
10795 | if (err < 0) |
10796 | return err; | |
10797 | err = alc880_auto_create_extra_out(spec, | |
10798 | spec->autocfg.speaker_pins[0], | |
10799 | "Speaker"); | |
10800 | if (err < 0) | |
10801 | return err; | |
05f5f477 | 10802 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
776e184e TI |
10803 | if (err < 0) |
10804 | return err; | |
10805 | ||
05f5f477 TI |
10806 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
10807 | ||
757899ac | 10808 | alc_auto_parse_digital(codec); |
05f5f477 TI |
10809 | |
10810 | if (spec->kctls.list) | |
10811 | add_mixer(spec, spec->kctls.list); | |
10812 | ||
10813 | add_verb(spec, alc883_auto_init_verbs); | |
4953550a | 10814 | /* if ADC 0x07 is available, initialize it, too */ |
05f5f477 | 10815 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
4953550a | 10816 | add_verb(spec, alc882_adc1_init_verbs); |
776e184e | 10817 | |
05f5f477 TI |
10818 | spec->num_mux_defs = 1; |
10819 | spec->input_mux = &spec->private_imux[0]; | |
10820 | ||
6227cdce | 10821 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
05f5f477 TI |
10822 | |
10823 | err = alc_auto_add_mic_boost(codec); | |
10824 | if (err < 0) | |
10825 | return err; | |
61b9b9b1 | 10826 | |
776e184e | 10827 | return 1; /* config found */ |
9c7f852e TI |
10828 | } |
10829 | ||
10830 | /* additional initialization for auto-configuration model */ | |
4953550a | 10831 | static void alc882_auto_init(struct hda_codec *codec) |
9c7f852e | 10832 | { |
f6c7e546 | 10833 | struct alc_spec *spec = codec->spec; |
4953550a TI |
10834 | alc882_auto_init_multi_out(codec); |
10835 | alc882_auto_init_hp_out(codec); | |
10836 | alc882_auto_init_analog_input(codec); | |
10837 | alc882_auto_init_input_src(codec); | |
757899ac | 10838 | alc_auto_init_digital(codec); |
f6c7e546 | 10839 | if (spec->unsol_event) |
7fb0d78f | 10840 | alc_inithook(codec); |
9c7f852e TI |
10841 | } |
10842 | ||
4953550a | 10843 | static int patch_alc882(struct hda_codec *codec) |
9c7f852e TI |
10844 | { |
10845 | struct alc_spec *spec; | |
10846 | int err, board_config; | |
10847 | ||
10848 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
10849 | if (spec == NULL) | |
10850 | return -ENOMEM; | |
10851 | ||
10852 | codec->spec = spec; | |
10853 | ||
da00c244 KY |
10854 | alc_auto_parse_customize_define(codec); |
10855 | ||
4953550a TI |
10856 | switch (codec->vendor_id) { |
10857 | case 0x10ec0882: | |
10858 | case 0x10ec0885: | |
10859 | break; | |
10860 | default: | |
10861 | /* ALC883 and variants */ | |
10862 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
10863 | break; | |
10864 | } | |
2c3bf9ab | 10865 | |
4953550a TI |
10866 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
10867 | alc882_models, | |
10868 | alc882_cfg_tbl); | |
10869 | ||
10870 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) | |
10871 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
10872 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); | |
10873 | ||
10874 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
9a11f1aa | 10875 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
4953550a TI |
10876 | codec->chip_name); |
10877 | board_config = ALC882_AUTO; | |
9c7f852e TI |
10878 | } |
10879 | ||
7fa90e87 TI |
10880 | if (board_config == ALC882_AUTO) |
10881 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); | |
4953550a TI |
10882 | |
10883 | if (board_config == ALC882_AUTO) { | |
9c7f852e | 10884 | /* automatic parse from the BIOS config */ |
4953550a | 10885 | err = alc882_parse_auto_config(codec); |
9c7f852e TI |
10886 | if (err < 0) { |
10887 | alc_free(codec); | |
10888 | return err; | |
f12ab1e0 | 10889 | } else if (!err) { |
9c7f852e TI |
10890 | printk(KERN_INFO |
10891 | "hda_codec: Cannot set up configuration " | |
10892 | "from BIOS. Using base mode...\n"); | |
4953550a | 10893 | board_config = ALC882_3ST_DIG; |
9c7f852e TI |
10894 | } |
10895 | } | |
10896 | ||
dc1eae25 | 10897 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
10898 | err = snd_hda_attach_beep_device(codec, 0x1); |
10899 | if (err < 0) { | |
10900 | alc_free(codec); | |
10901 | return err; | |
10902 | } | |
680cd536 KK |
10903 | } |
10904 | ||
4953550a | 10905 | if (board_config != ALC882_AUTO) |
e9c364c0 | 10906 | setup_preset(codec, &alc882_presets[board_config]); |
9c7f852e | 10907 | |
4953550a TI |
10908 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
10909 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
10910 | /* FIXME: setup DAC5 */ | |
10911 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
10912 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
10913 | ||
10914 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | |
10915 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
10916 | ||
4953550a | 10917 | if (!spec->adc_nids && spec->input_mux) { |
d11f74c6 | 10918 | int i, j; |
4953550a TI |
10919 | spec->num_adc_nids = 0; |
10920 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | |
d11f74c6 | 10921 | const struct hda_input_mux *imux = spec->input_mux; |
4953550a | 10922 | hda_nid_t cap; |
d11f74c6 | 10923 | hda_nid_t items[16]; |
4953550a TI |
10924 | hda_nid_t nid = alc882_adc_nids[i]; |
10925 | unsigned int wcap = get_wcaps(codec, nid); | |
10926 | /* get type */ | |
a22d543a | 10927 | wcap = get_wcaps_type(wcap); |
4953550a TI |
10928 | if (wcap != AC_WID_AUD_IN) |
10929 | continue; | |
10930 | spec->private_adc_nids[spec->num_adc_nids] = nid; | |
10931 | err = snd_hda_get_connections(codec, nid, &cap, 1); | |
10932 | if (err < 0) | |
10933 | continue; | |
d11f74c6 TI |
10934 | err = snd_hda_get_connections(codec, cap, items, |
10935 | ARRAY_SIZE(items)); | |
10936 | if (err < 0) | |
10937 | continue; | |
10938 | for (j = 0; j < imux->num_items; j++) | |
10939 | if (imux->items[j].index >= err) | |
10940 | break; | |
10941 | if (j < imux->num_items) | |
10942 | continue; | |
4953550a TI |
10943 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
10944 | spec->num_adc_nids++; | |
61b9b9b1 | 10945 | } |
4953550a TI |
10946 | spec->adc_nids = spec->private_adc_nids; |
10947 | spec->capsrc_nids = spec->private_capsrc_nids; | |
2f893286 KY |
10948 | } |
10949 | ||
b59bdf3b | 10950 | set_capture_mixer(codec); |
da00c244 | 10951 | |
dc1eae25 | 10952 | if (has_cdefine_beep(codec)) |
da00c244 | 10953 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
9c7f852e | 10954 | |
7fa90e87 TI |
10955 | if (board_config == ALC882_AUTO) |
10956 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); | |
10957 | ||
2134ea4f TI |
10958 | spec->vmaster_nid = 0x0c; |
10959 | ||
9c7f852e | 10960 | codec->patch_ops = alc_patch_ops; |
4953550a TI |
10961 | if (board_config == ALC882_AUTO) |
10962 | spec->init_hook = alc882_auto_init; | |
cb53c626 TI |
10963 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
10964 | if (!spec->loopback.amplist) | |
4953550a | 10965 | spec->loopback.amplist = alc882_loopbacks; |
cb53c626 | 10966 | #endif |
9c7f852e TI |
10967 | |
10968 | return 0; | |
10969 | } | |
10970 | ||
4953550a | 10971 | |
9c7f852e TI |
10972 | /* |
10973 | * ALC262 support | |
10974 | */ | |
10975 | ||
10976 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
10977 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
10978 | ||
10979 | #define alc262_dac_nids alc260_dac_nids | |
10980 | #define alc262_adc_nids alc882_adc_nids | |
10981 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
88c71a99 TI |
10982 | #define alc262_capsrc_nids alc882_capsrc_nids |
10983 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
9c7f852e TI |
10984 | |
10985 | #define alc262_modes alc260_modes | |
10986 | #define alc262_capture_source alc882_capture_source | |
10987 | ||
4e555fe5 KY |
10988 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
10989 | /* ADC0 */ | |
10990 | 0x09 | |
10991 | }; | |
10992 | ||
10993 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | |
10994 | ||
9c7f852e TI |
10995 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
10996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
10997 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10998 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
10999 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11000 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11001 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11002 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11003 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 11004 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
11005 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11006 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 11007 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
11008 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
11009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11010 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
11011 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
11012 | { } /* end */ | |
11013 | }; | |
11014 | ||
ce875f07 TI |
11015 | /* update HP, line and mono-out pins according to the master switch */ |
11016 | static void alc262_hp_master_update(struct hda_codec *codec) | |
11017 | { | |
11018 | struct alc_spec *spec = codec->spec; | |
11019 | int val = spec->master_sw; | |
11020 | ||
11021 | /* HP & line-out */ | |
11022 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
11023 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11024 | val ? PIN_HP : 0); | |
11025 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
11026 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11027 | val ? PIN_HP : 0); | |
11028 | /* mono (speaker) depending on the HP jack sense */ | |
11029 | val = val && !spec->jack_present; | |
11030 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
11031 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11032 | val ? PIN_OUT : 0); | |
11033 | } | |
11034 | ||
11035 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
11036 | { | |
11037 | struct alc_spec *spec = codec->spec; | |
864f92be WF |
11038 | |
11039 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
ce875f07 TI |
11040 | alc262_hp_master_update(codec); |
11041 | } | |
11042 | ||
11043 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
11044 | { | |
11045 | if ((res >> 26) != ALC880_HP_EVENT) | |
11046 | return; | |
11047 | alc262_hp_bpc_automute(codec); | |
11048 | } | |
11049 | ||
11050 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
11051 | { | |
11052 | struct alc_spec *spec = codec->spec; | |
864f92be WF |
11053 | |
11054 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
ce875f07 TI |
11055 | alc262_hp_master_update(codec); |
11056 | } | |
11057 | ||
11058 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
11059 | unsigned int res) | |
11060 | { | |
11061 | if ((res >> 26) != ALC880_HP_EVENT) | |
11062 | return; | |
11063 | alc262_hp_wildwest_automute(codec); | |
11064 | } | |
11065 | ||
b72519b5 | 11066 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
ce875f07 TI |
11067 | |
11068 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
11069 | struct snd_ctl_elem_value *ucontrol) | |
11070 | { | |
11071 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11072 | struct alc_spec *spec = codec->spec; | |
11073 | int val = !!*ucontrol->value.integer.value; | |
11074 | ||
11075 | if (val == spec->master_sw) | |
11076 | return 0; | |
11077 | spec->master_sw = val; | |
11078 | alc262_hp_master_update(codec); | |
11079 | return 1; | |
11080 | } | |
11081 | ||
b72519b5 TI |
11082 | #define ALC262_HP_MASTER_SWITCH \ |
11083 | { \ | |
11084 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
11085 | .name = "Master Playback Switch", \ | |
11086 | .info = snd_ctl_boolean_mono_info, \ | |
11087 | .get = alc262_hp_master_sw_get, \ | |
11088 | .put = alc262_hp_master_sw_put, \ | |
5b0cb1d8 JK |
11089 | }, \ |
11090 | { \ | |
11091 | .iface = NID_MAPPING, \ | |
11092 | .name = "Master Playback Switch", \ | |
11093 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ | |
b72519b5 TI |
11094 | } |
11095 | ||
5b0cb1d8 | 11096 | |
9c7f852e | 11097 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
b72519b5 | 11098 | ALC262_HP_MASTER_SWITCH, |
9c7f852e TI |
11099 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11100 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11101 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
11102 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
11103 | HDA_OUTPUT), | |
11104 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
11105 | HDA_OUTPUT), | |
9c7f852e TI |
11106 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11107 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 11108 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
11109 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11110 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 11111 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
11112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
11113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11114 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11115 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9c7f852e TI |
11116 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
11117 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
11118 | { } /* end */ | |
11119 | }; | |
11120 | ||
cd7509a4 | 11121 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
b72519b5 | 11122 | ALC262_HP_MASTER_SWITCH, |
cd7509a4 KY |
11123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11124 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
11125 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11126 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
11127 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
11128 | HDA_OUTPUT), | |
11129 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
11130 | HDA_OUTPUT), | |
cd7509a4 KY |
11131 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
11132 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
cc69d12d | 11133 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
cd7509a4 KY |
11134 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11135 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11136 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11137 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
cd7509a4 KY |
11138 | { } /* end */ |
11139 | }; | |
11140 | ||
11141 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
11142 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11143 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 11144 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
cd7509a4 KY |
11145 | { } /* end */ |
11146 | }; | |
11147 | ||
66d2a9d6 | 11148 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
4f5d1706 | 11149 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
66d2a9d6 KY |
11150 | { |
11151 | struct alc_spec *spec = codec->spec; | |
66d2a9d6 | 11152 | |
a9fd4f3f | 11153 | spec->autocfg.hp_pins[0] = 0x15; |
dc99be47 | 11154 | spec->autocfg.speaker_pins[0] = 0x14; |
66d2a9d6 KY |
11155 | } |
11156 | ||
66d2a9d6 | 11157 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
86cd9298 TI |
11158 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11159 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
66d2a9d6 KY |
11160 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
11161 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11164 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11165 | { } /* end */ | |
11166 | }; | |
11167 | ||
11168 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
11169 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11170 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11171 | ||
11172 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11173 | { } | |
11174 | }; | |
11175 | ||
8c427226 | 11176 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
f2f48e18 TI |
11177 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11178 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
11179 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
11180 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
8c427226 KY |
11181 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11182 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11183 | { } /* end */ | |
11184 | }; | |
11185 | ||
11186 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
11187 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11188 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11189 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11190 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11191 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11192 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11193 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11195 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11197 | {} | |
11198 | }; | |
11199 | ||
11200 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
11201 | .num_items = 1, | |
11202 | .items = { | |
11203 | { "Line", 0x1 }, | |
11204 | }, | |
11205 | }; | |
11206 | ||
42171c17 TI |
11207 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
11208 | static void alc262_hippo_master_update(struct hda_codec *codec) | |
0724ea2a | 11209 | { |
42171c17 TI |
11210 | struct alc_spec *spec = codec->spec; |
11211 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11212 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
11213 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
11214 | unsigned int mute; | |
0724ea2a | 11215 | |
42171c17 TI |
11216 | /* HP */ |
11217 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; | |
11218 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, | |
11219 | HDA_AMP_MUTE, mute); | |
11220 | /* mute internal speaker per jack sense */ | |
11221 | if (spec->jack_present) | |
11222 | mute = HDA_AMP_MUTE; | |
11223 | if (line_nid) | |
11224 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, | |
11225 | HDA_AMP_MUTE, mute); | |
11226 | if (speaker_nid && speaker_nid != line_nid) | |
11227 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, | |
0724ea2a | 11228 | HDA_AMP_MUTE, mute); |
42171c17 TI |
11229 | } |
11230 | ||
11231 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get | |
11232 | ||
11233 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | |
11234 | struct snd_ctl_elem_value *ucontrol) | |
11235 | { | |
11236 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11237 | struct alc_spec *spec = codec->spec; | |
11238 | int val = !!*ucontrol->value.integer.value; | |
11239 | ||
11240 | if (val == spec->master_sw) | |
11241 | return 0; | |
11242 | spec->master_sw = val; | |
11243 | alc262_hippo_master_update(codec); | |
11244 | return 1; | |
11245 | } | |
11246 | ||
11247 | #define ALC262_HIPPO_MASTER_SWITCH \ | |
11248 | { \ | |
11249 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
11250 | .name = "Master Playback Switch", \ | |
11251 | .info = snd_ctl_boolean_mono_info, \ | |
11252 | .get = alc262_hippo_master_sw_get, \ | |
11253 | .put = alc262_hippo_master_sw_put, \ | |
5b0cb1d8 JK |
11254 | }, \ |
11255 | { \ | |
11256 | .iface = NID_MAPPING, \ | |
11257 | .name = "Master Playback Switch", \ | |
11258 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ | |
11259 | (SUBDEV_SPEAKER(0) << 16), \ | |
0724ea2a | 11260 | } |
42171c17 TI |
11261 | |
11262 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { | |
11263 | ALC262_HIPPO_MASTER_SWITCH, | |
11264 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11265 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11266 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11267 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11268 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11269 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11270 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11271 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11272 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11273 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11274 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11275 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11276 | { } /* end */ | |
11277 | }; | |
11278 | ||
11279 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | |
11280 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11281 | ALC262_HIPPO_MASTER_SWITCH, | |
11282 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11283 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11284 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11285 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11288 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11289 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11290 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11291 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11292 | { } /* end */ | |
11293 | }; | |
11294 | ||
11295 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11296 | static void alc262_hippo_automute(struct hda_codec *codec) | |
11297 | { | |
11298 | struct alc_spec *spec = codec->spec; | |
11299 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
42171c17 | 11300 | |
864f92be | 11301 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
42171c17 | 11302 | alc262_hippo_master_update(codec); |
0724ea2a | 11303 | } |
5b31954e | 11304 | |
42171c17 TI |
11305 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
11306 | { | |
11307 | if ((res >> 26) != ALC880_HP_EVENT) | |
11308 | return; | |
11309 | alc262_hippo_automute(codec); | |
11310 | } | |
11311 | ||
4f5d1706 | 11312 | static void alc262_hippo_setup(struct hda_codec *codec) |
42171c17 TI |
11313 | { |
11314 | struct alc_spec *spec = codec->spec; | |
11315 | ||
11316 | spec->autocfg.hp_pins[0] = 0x15; | |
11317 | spec->autocfg.speaker_pins[0] = 0x14; | |
42171c17 TI |
11318 | } |
11319 | ||
4f5d1706 | 11320 | static void alc262_hippo1_setup(struct hda_codec *codec) |
42171c17 TI |
11321 | { |
11322 | struct alc_spec *spec = codec->spec; | |
11323 | ||
11324 | spec->autocfg.hp_pins[0] = 0x1b; | |
11325 | spec->autocfg.speaker_pins[0] = 0x14; | |
42171c17 TI |
11326 | } |
11327 | ||
11328 | ||
272a527c | 11329 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
0724ea2a | 11330 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
42171c17 | 11331 | ALC262_HIPPO_MASTER_SWITCH, |
272a527c KY |
11332 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11333 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11334 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11335 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11336 | { } /* end */ | |
11337 | }; | |
11338 | ||
83c34218 | 11339 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
42171c17 TI |
11340 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11341 | ALC262_HIPPO_MASTER_SWITCH, | |
83c34218 KY |
11342 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
11343 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11344 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11345 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11346 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11347 | { } /* end */ | |
11348 | }; | |
272a527c | 11349 | |
ba340e82 TV |
11350 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
11351 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11352 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
11353 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
11354 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
11355 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11356 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11358 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11359 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11360 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11361 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11362 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11363 | { } /* end */ | |
11364 | }; | |
11365 | ||
11366 | static struct hda_verb alc262_tyan_verbs[] = { | |
11367 | /* Headphone automute */ | |
11368 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11369 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11371 | ||
11372 | /* P11 AUX_IN, white 4-pin connector */ | |
11373 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11374 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | |
11375 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | |
11376 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | |
11377 | ||
11378 | {} | |
11379 | }; | |
11380 | ||
11381 | /* unsolicited event for HP jack sensing */ | |
4f5d1706 | 11382 | static void alc262_tyan_setup(struct hda_codec *codec) |
ba340e82 | 11383 | { |
a9fd4f3f | 11384 | struct alc_spec *spec = codec->spec; |
ba340e82 | 11385 | |
a9fd4f3f TI |
11386 | spec->autocfg.hp_pins[0] = 0x1b; |
11387 | spec->autocfg.speaker_pins[0] = 0x15; | |
ba340e82 TV |
11388 | } |
11389 | ||
ba340e82 | 11390 | |
9c7f852e TI |
11391 | #define alc262_capture_mixer alc882_capture_mixer |
11392 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
11393 | ||
11394 | /* | |
11395 | * generic initialization of ADC, input mixers and output mixers | |
11396 | */ | |
11397 | static struct hda_verb alc262_init_verbs[] = { | |
11398 | /* | |
11399 | * Unmute ADC0-2 and set the default input to mic-in | |
11400 | */ | |
11401 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11403 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11404 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11405 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11406 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11407 | ||
cb53c626 | 11408 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 11409 | * mixer widget |
f12ab1e0 TI |
11410 | * Note: PASD motherboards uses the Line In 2 as the input for |
11411 | * front panel mic (mic 2) | |
9c7f852e TI |
11412 | */ |
11413 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
11414 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
11415 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11416 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11417 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11418 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
11419 | |
11420 | /* | |
df694daa KY |
11421 | * Set up output mixers (0x0c - 0x0e) |
11422 | */ | |
11423 | /* set vol=0 to output mixers */ | |
11424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11425 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11426 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11427 | /* set up input amps for analog loopback */ | |
11428 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11429 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11431 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11432 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11433 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11434 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11435 | ||
11436 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11437 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11438 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11439 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11440 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11441 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11442 | ||
11443 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11444 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11445 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11446 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11447 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
ea1fb29a | 11448 | |
df694daa KY |
11449 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
11450 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
ea1fb29a | 11451 | |
df694daa KY |
11452 | /* FIXME: use matrix-type input source selection */ |
11453 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11454 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11455 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11456 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11457 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11459 | /* Input mixer2 */ | |
11460 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11461 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11462 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11463 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11464 | /* Input mixer3 */ | |
11465 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11466 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11467 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
f12ab1e0 | 11468 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
df694daa KY |
11469 | |
11470 | { } | |
11471 | }; | |
1da177e4 | 11472 | |
4e555fe5 KY |
11473 | static struct hda_verb alc262_eapd_verbs[] = { |
11474 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11475 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11476 | { } | |
11477 | }; | |
11478 | ||
ccc656ce KY |
11479 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
11480 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11481 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11482 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11483 | ||
11484 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11485 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11486 | {} | |
11487 | }; | |
11488 | ||
272a527c KY |
11489 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
11490 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11491 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11492 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
11493 | ||
11494 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11495 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7b1e8795 | 11496 | {} |
272a527c KY |
11497 | }; |
11498 | ||
4e555fe5 KY |
11499 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
11500 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11501 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11502 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11503 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11504 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4e555fe5 KY |
11505 | { } /* end */ |
11506 | }; | |
11507 | ||
11508 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | |
11509 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11510 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11511 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11512 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11513 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | |
11514 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11515 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11516 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11517 | {} | |
11518 | }; | |
11519 | ||
4f5d1706 | 11520 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
4e555fe5 | 11521 | { |
a9fd4f3f TI |
11522 | struct alc_spec *spec = codec->spec; |
11523 | ||
11524 | spec->autocfg.hp_pins[0] = 0x15; | |
11525 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
11526 | spec->ext_mic.pin = 0x18; |
11527 | spec->ext_mic.mux_idx = 0; | |
11528 | spec->int_mic.pin = 0x12; | |
11529 | spec->int_mic.mux_idx = 9; | |
11530 | spec->auto_mic = 1; | |
4e555fe5 KY |
11531 | } |
11532 | ||
e8f9ae2a PT |
11533 | /* |
11534 | * nec model | |
11535 | * 0x15 = headphone | |
11536 | * 0x16 = internal speaker | |
11537 | * 0x18 = external mic | |
11538 | */ | |
11539 | ||
11540 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | |
11541 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
11542 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | |
11543 | ||
11544 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11546 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11547 | ||
11548 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11549 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11550 | { } /* end */ | |
11551 | }; | |
11552 | ||
11553 | static struct hda_verb alc262_nec_verbs[] = { | |
11554 | /* Unmute Speaker */ | |
11555 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11556 | ||
11557 | /* Headphone */ | |
11558 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11559 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11560 | ||
11561 | /* External mic to headphone */ | |
11562 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11563 | /* External mic to speaker */ | |
11564 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11565 | {} | |
11566 | }; | |
11567 | ||
834be88d TI |
11568 | /* |
11569 | * fujitsu model | |
5d9fab2d TV |
11570 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
11571 | * 0x1b = port replicator headphone out | |
834be88d TI |
11572 | */ |
11573 | ||
11574 | #define ALC_HP_EVENT 0x37 | |
11575 | ||
11576 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
11577 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11578 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5d9fab2d TV |
11579 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
11580 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
834be88d TI |
11581 | {} |
11582 | }; | |
11583 | ||
0e31daf7 J |
11584 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
11585 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11586 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11587 | {} | |
11588 | }; | |
11589 | ||
e2595322 DC |
11590 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
11591 | /* Front Mic pin: input vref at 50% */ | |
11592 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
11593 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11594 | {} | |
11595 | }; | |
11596 | ||
834be88d | 11597 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
39d3ed38 | 11598 | .num_items = 3, |
834be88d TI |
11599 | .items = { |
11600 | { "Mic", 0x0 }, | |
39d3ed38 | 11601 | { "Int Mic", 0x1 }, |
834be88d TI |
11602 | { "CD", 0x4 }, |
11603 | }, | |
11604 | }; | |
11605 | ||
9c7f852e TI |
11606 | static struct hda_input_mux alc262_HP_capture_source = { |
11607 | .num_items = 5, | |
11608 | .items = { | |
11609 | { "Mic", 0x0 }, | |
accbe498 | 11610 | { "Front Mic", 0x1 }, |
9c7f852e TI |
11611 | { "Line", 0x2 }, |
11612 | { "CD", 0x4 }, | |
11613 | { "AUX IN", 0x6 }, | |
11614 | }, | |
11615 | }; | |
11616 | ||
accbe498 | 11617 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
11618 | .num_items = 4, | |
11619 | .items = { | |
11620 | { "Mic", 0x0 }, | |
11621 | { "Front Mic", 0x2 }, | |
11622 | { "Line", 0x1 }, | |
11623 | { "CD", 0x4 }, | |
11624 | }, | |
11625 | }; | |
11626 | ||
ebc7a406 | 11627 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
834be88d TI |
11628 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
11629 | { | |
11630 | struct alc_spec *spec = codec->spec; | |
11631 | unsigned int mute; | |
11632 | ||
f12ab1e0 | 11633 | if (force || !spec->sense_updated) { |
864f92be WF |
11634 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
11635 | snd_hda_jack_detect(codec, 0x1b); | |
834be88d TI |
11636 | spec->sense_updated = 1; |
11637 | } | |
ebc7a406 TI |
11638 | /* unmute internal speaker only if both HPs are unplugged and |
11639 | * master switch is on | |
11640 | */ | |
11641 | if (spec->jack_present) | |
11642 | mute = HDA_AMP_MUTE; | |
11643 | else | |
834be88d | 11644 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
ebc7a406 TI |
11645 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
11646 | HDA_AMP_MUTE, mute); | |
834be88d TI |
11647 | } |
11648 | ||
11649 | /* unsolicited event for HP jack sensing */ | |
11650 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
11651 | unsigned int res) | |
11652 | { | |
11653 | if ((res >> 26) != ALC_HP_EVENT) | |
11654 | return; | |
11655 | alc262_fujitsu_automute(codec, 1); | |
11656 | } | |
11657 | ||
ebc7a406 TI |
11658 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
11659 | { | |
11660 | alc262_fujitsu_automute(codec, 1); | |
11661 | } | |
11662 | ||
834be88d | 11663 | /* bind volumes of both NID 0x0c and 0x0d */ |
cca3b371 TI |
11664 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
11665 | .ops = &snd_hda_bind_vol, | |
11666 | .values = { | |
11667 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
11668 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
11669 | 0 | |
11670 | }, | |
11671 | }; | |
834be88d | 11672 | |
0e31daf7 J |
11673 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
11674 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
11675 | { | |
11676 | struct alc_spec *spec = codec->spec; | |
11677 | unsigned int mute; | |
11678 | ||
11679 | if (force || !spec->sense_updated) { | |
864f92be | 11680 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
0e31daf7 J |
11681 | spec->sense_updated = 1; |
11682 | } | |
11683 | if (spec->jack_present) { | |
11684 | /* mute internal speaker */ | |
11685 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11686 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11687 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11688 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11689 | } else { | |
11690 | /* unmute internal speaker if necessary */ | |
11691 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
11692 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11693 | HDA_AMP_MUTE, mute); | |
11694 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11695 | HDA_AMP_MUTE, mute); | |
11696 | } | |
11697 | } | |
11698 | ||
11699 | /* unsolicited event for HP jack sensing */ | |
11700 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
11701 | unsigned int res) | |
11702 | { | |
11703 | if ((res >> 26) != ALC_HP_EVENT) | |
11704 | return; | |
11705 | alc262_lenovo_3000_automute(codec, 1); | |
11706 | } | |
11707 | ||
8de56b7d TI |
11708 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
11709 | int dir, int idx, long *valp) | |
11710 | { | |
11711 | int i, change = 0; | |
11712 | ||
11713 | for (i = 0; i < 2; i++, valp++) | |
11714 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, | |
11715 | HDA_AMP_MUTE, | |
11716 | *valp ? 0 : HDA_AMP_MUTE); | |
11717 | return change; | |
11718 | } | |
11719 | ||
834be88d TI |
11720 | /* bind hp and internal speaker mute (with plug check) */ |
11721 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
11722 | struct snd_ctl_elem_value *ucontrol) | |
11723 | { | |
11724 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11725 | long *valp = ucontrol->value.integer.value; | |
11726 | int change; | |
11727 | ||
8de56b7d TI |
11728 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
11729 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
82beb8fd TI |
11730 | if (change) |
11731 | alc262_fujitsu_automute(codec, 0); | |
834be88d TI |
11732 | return change; |
11733 | } | |
11734 | ||
11735 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
cca3b371 | 11736 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
834be88d TI |
11737 | { |
11738 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11739 | .name = "Master Playback Switch", | |
5e26dfd0 | 11740 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
834be88d TI |
11741 | .info = snd_hda_mixer_amp_switch_info, |
11742 | .get = snd_hda_mixer_amp_switch_get, | |
11743 | .put = alc262_fujitsu_master_sw_put, | |
11744 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
11745 | }, | |
5b0cb1d8 JK |
11746 | { |
11747 | .iface = NID_MAPPING, | |
11748 | .name = "Master Playback Switch", | |
11749 | .private_value = 0x1b, | |
11750 | }, | |
834be88d TI |
11751 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
11752 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11753 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11754 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11755 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
39d3ed38 TI |
11756 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
11757 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11758 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
834be88d TI |
11759 | { } /* end */ |
11760 | }; | |
11761 | ||
0e31daf7 J |
11762 | /* bind hp and internal speaker mute (with plug check) */ |
11763 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
11764 | struct snd_ctl_elem_value *ucontrol) | |
11765 | { | |
11766 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11767 | long *valp = ucontrol->value.integer.value; | |
11768 | int change; | |
11769 | ||
8de56b7d | 11770 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
0e31daf7 J |
11771 | if (change) |
11772 | alc262_lenovo_3000_automute(codec, 0); | |
11773 | return change; | |
11774 | } | |
11775 | ||
11776 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
11777 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11778 | { | |
11779 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11780 | .name = "Master Playback Switch", | |
5e26dfd0 | 11781 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
0e31daf7 J |
11782 | .info = snd_hda_mixer_amp_switch_info, |
11783 | .get = snd_hda_mixer_amp_switch_get, | |
11784 | .put = alc262_lenovo_3000_master_sw_put, | |
11785 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
11786 | }, | |
11787 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11788 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11789 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11790 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11791 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11792 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
11793 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11794 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
11795 | { } /* end */ | |
11796 | }; | |
11797 | ||
9f99a638 HM |
11798 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
11799 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
42171c17 | 11800 | ALC262_HIPPO_MASTER_SWITCH, |
9f99a638 HM |
11801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11802 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11803 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11804 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11805 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11806 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11807 | { } /* end */ | |
11808 | }; | |
11809 | ||
304dcaac TI |
11810 | /* additional init verbs for Benq laptops */ |
11811 | static struct hda_verb alc262_EAPD_verbs[] = { | |
11812 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11813 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
11814 | {} | |
11815 | }; | |
11816 | ||
83c34218 KY |
11817 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
11818 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11819 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11820 | ||
11821 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11822 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
11823 | {} | |
11824 | }; | |
11825 | ||
f651b50b TD |
11826 | /* Samsung Q1 Ultra Vista model setup */ |
11827 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
bb9f76cd TI |
11828 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11829 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
f651b50b TD |
11830 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11831 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11832 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
bb9f76cd | 11833 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
f651b50b TD |
11834 | { } /* end */ |
11835 | }; | |
11836 | ||
11837 | static struct hda_verb alc262_ultra_verbs[] = { | |
bb9f76cd TI |
11838 | /* output mixer */ |
11839 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11840 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11841 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11842 | /* speaker */ | |
11843 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11844 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11845 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11846 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11847 | /* HP */ | |
f651b50b | 11848 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
bb9f76cd TI |
11849 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11850 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11851 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11852 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11853 | /* internal mic */ | |
11854 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
11855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11856 | /* ADC, choose mic */ | |
11857 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11858 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11860 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11862 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11863 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
11864 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
11865 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
11866 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
f651b50b TD |
11867 | {} |
11868 | }; | |
11869 | ||
f651b50b TD |
11870 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
11871 | static void alc262_ultra_automute(struct hda_codec *codec) | |
11872 | { | |
11873 | struct alc_spec *spec = codec->spec; | |
11874 | unsigned int mute; | |
f651b50b | 11875 | |
bb9f76cd TI |
11876 | mute = 0; |
11877 | /* auto-mute only when HP is used as HP */ | |
11878 | if (!spec->cur_mux[0]) { | |
864f92be | 11879 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
bb9f76cd TI |
11880 | if (spec->jack_present) |
11881 | mute = HDA_AMP_MUTE; | |
f651b50b | 11882 | } |
bb9f76cd TI |
11883 | /* mute/unmute internal speaker */ |
11884 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11885 | HDA_AMP_MUTE, mute); | |
11886 | /* mute/unmute HP */ | |
11887 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
11888 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
f651b50b TD |
11889 | } |
11890 | ||
11891 | /* unsolicited event for HP jack sensing */ | |
11892 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
11893 | unsigned int res) | |
11894 | { | |
11895 | if ((res >> 26) != ALC880_HP_EVENT) | |
11896 | return; | |
11897 | alc262_ultra_automute(codec); | |
11898 | } | |
11899 | ||
bb9f76cd TI |
11900 | static struct hda_input_mux alc262_ultra_capture_source = { |
11901 | .num_items = 2, | |
11902 | .items = { | |
11903 | { "Mic", 0x1 }, | |
11904 | { "Headphone", 0x7 }, | |
11905 | }, | |
11906 | }; | |
11907 | ||
11908 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
11909 | struct snd_ctl_elem_value *ucontrol) | |
11910 | { | |
11911 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11912 | struct alc_spec *spec = codec->spec; | |
11913 | int ret; | |
11914 | ||
54cbc9ab | 11915 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
bb9f76cd TI |
11916 | if (!ret) |
11917 | return 0; | |
11918 | /* reprogram the HP pin as mic or HP according to the input source */ | |
11919 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
11920 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11921 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
11922 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
11923 | return ret; | |
11924 | } | |
11925 | ||
11926 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
11927 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
11928 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
11929 | { | |
11930 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11931 | .name = "Capture Source", | |
54cbc9ab TI |
11932 | .info = alc_mux_enum_info, |
11933 | .get = alc_mux_enum_get, | |
bb9f76cd TI |
11934 | .put = alc262_ultra_mux_enum_put, |
11935 | }, | |
5b0cb1d8 JK |
11936 | { |
11937 | .iface = NID_MAPPING, | |
11938 | .name = "Capture Source", | |
11939 | .private_value = 0x15, | |
11940 | }, | |
bb9f76cd TI |
11941 | { } /* end */ |
11942 | }; | |
11943 | ||
c3fc1f50 TI |
11944 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
11945 | * and thus it's bound with a different mixer. | |
11946 | * This function returns which mixer amp should be used. | |
11947 | */ | |
11948 | static int alc262_check_volbit(hda_nid_t nid) | |
11949 | { | |
11950 | if (!nid) | |
11951 | return 0; | |
11952 | else if (nid == 0x16) | |
11953 | return 2; | |
11954 | else | |
11955 | return 1; | |
11956 | } | |
11957 | ||
11958 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | |
033688a5 | 11959 | const char *pfx, int *vbits, int idx) |
c3fc1f50 | 11960 | { |
c3fc1f50 TI |
11961 | unsigned long val; |
11962 | int vbit; | |
11963 | ||
11964 | vbit = alc262_check_volbit(nid); | |
11965 | if (!vbit) | |
11966 | return 0; | |
11967 | if (*vbits & vbit) /* a volume control for this mixer already there */ | |
11968 | return 0; | |
11969 | *vbits |= vbit; | |
c3fc1f50 TI |
11970 | if (vbit == 2) |
11971 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | |
11972 | else | |
11973 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | |
033688a5 | 11974 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val); |
c3fc1f50 TI |
11975 | } |
11976 | ||
11977 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | |
033688a5 | 11978 | const char *pfx, int idx) |
c3fc1f50 | 11979 | { |
c3fc1f50 TI |
11980 | unsigned long val; |
11981 | ||
11982 | if (!nid) | |
11983 | return 0; | |
c3fc1f50 TI |
11984 | if (nid == 0x16) |
11985 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
11986 | else | |
11987 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
033688a5 | 11988 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val); |
c3fc1f50 TI |
11989 | } |
11990 | ||
df694daa | 11991 | /* add playback controls from the parsed DAC table */ |
f12ab1e0 TI |
11992 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
11993 | const struct auto_pin_cfg *cfg) | |
df694daa | 11994 | { |
c3fc1f50 TI |
11995 | const char *pfx; |
11996 | int vbits; | |
033688a5 | 11997 | int i, err; |
df694daa KY |
11998 | |
11999 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
12000 | spec->multiout.dac_nids = spec->private_dac_nids; | |
12001 | spec->multiout.dac_nids[0] = 2; | |
12002 | ||
c3fc1f50 TI |
12003 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
12004 | pfx = "Master"; | |
12005 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
12006 | pfx = "Speaker"; | |
033688a5 TI |
12007 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) |
12008 | pfx = "Headphone"; | |
c3fc1f50 TI |
12009 | else |
12010 | pfx = "Front"; | |
033688a5 TI |
12011 | for (i = 0; i < 2; i++) { |
12012 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); | |
12013 | if (err < 0) | |
12014 | return err; | |
12015 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | |
12016 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], | |
12017 | "Speaker", i); | |
12018 | if (err < 0) | |
12019 | return err; | |
12020 | } | |
12021 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | |
12022 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], | |
12023 | "Headphone", i); | |
12024 | if (err < 0) | |
12025 | return err; | |
12026 | } | |
12027 | } | |
df694daa | 12028 | |
c3fc1f50 TI |
12029 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
12030 | alc262_check_volbit(cfg->speaker_pins[0]) | | |
12031 | alc262_check_volbit(cfg->hp_pins[0]); | |
12032 | if (vbits == 1 || vbits == 2) | |
12033 | pfx = "Master"; /* only one mixer is used */ | |
c3fc1f50 | 12034 | vbits = 0; |
033688a5 TI |
12035 | for (i = 0; i < 2; i++) { |
12036 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, | |
12037 | &vbits, i); | |
12038 | if (err < 0) | |
12039 | return err; | |
12040 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | |
12041 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], | |
12042 | "Speaker", &vbits, i); | |
12043 | if (err < 0) | |
12044 | return err; | |
12045 | } | |
12046 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | |
12047 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], | |
12048 | "Headphone", &vbits, i); | |
12049 | if (err < 0) | |
12050 | return err; | |
12051 | } | |
12052 | } | |
f12ab1e0 | 12053 | return 0; |
df694daa KY |
12054 | } |
12055 | ||
05f5f477 | 12056 | #define alc262_auto_create_input_ctls \ |
eaa9b3a7 | 12057 | alc882_auto_create_input_ctls |
df694daa KY |
12058 | |
12059 | /* | |
12060 | * generic initialization of ADC, input mixers and output mixers | |
12061 | */ | |
12062 | static struct hda_verb alc262_volume_init_verbs[] = { | |
12063 | /* | |
12064 | * Unmute ADC0-2 and set the default input to mic-in | |
12065 | */ | |
12066 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12067 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12068 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12070 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12071 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12072 | ||
cb53c626 | 12073 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 12074 | * mixer widget |
f12ab1e0 TI |
12075 | * Note: PASD motherboards uses the Line In 2 as the input for |
12076 | * front panel mic (mic 2) | |
df694daa KY |
12077 | */ |
12078 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12079 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12080 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12081 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12082 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12083 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
12084 | |
12085 | /* | |
12086 | * Set up output mixers (0x0c - 0x0f) | |
12087 | */ | |
12088 | /* set vol=0 to output mixers */ | |
12089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12090 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12091 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
ea1fb29a | 12092 | |
df694daa KY |
12093 | /* set up input amps for analog loopback */ |
12094 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12095 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12096 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12097 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12098 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12099 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12100 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12101 | ||
12102 | /* FIXME: use matrix-type input source selection */ | |
12103 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
12104 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12105 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12106 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12107 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12108 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12109 | /* Input mixer2 */ | |
12110 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12111 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12112 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12113 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12114 | /* Input mixer3 */ | |
12115 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12116 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12119 | ||
12120 | { } | |
12121 | }; | |
12122 | ||
9c7f852e TI |
12123 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
12124 | /* | |
12125 | * Unmute ADC0-2 and set the default input to mic-in | |
12126 | */ | |
12127 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12129 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12130 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12131 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12132 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12133 | ||
cb53c626 | 12134 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 12135 | * mixer widget |
f12ab1e0 TI |
12136 | * Note: PASD motherboards uses the Line In 2 as the input for |
12137 | * front panel mic (mic 2) | |
9c7f852e TI |
12138 | */ |
12139 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12141 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12142 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12143 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12144 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12145 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12146 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
ea1fb29a | 12147 | |
9c7f852e TI |
12148 | /* |
12149 | * Set up output mixers (0x0c - 0x0e) | |
12150 | */ | |
12151 | /* set vol=0 to output mixers */ | |
12152 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12153 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12154 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12155 | ||
12156 | /* set up input amps for analog loopback */ | |
12157 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12158 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12159 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12160 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12161 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12162 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12163 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12164 | ||
ce875f07 | 12165 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
9c7f852e TI |
12166 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
12167 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12168 | ||
12169 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12170 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12171 | ||
12172 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12173 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12174 | ||
12175 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12176 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12177 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12178 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12179 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12180 | ||
0e4835c1 | 12181 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
9c7f852e TI |
12182 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
12183 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
0e4835c1 | 12184 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
9c7f852e TI |
12185 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
12186 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12187 | ||
12188 | ||
12189 | /* FIXME: use matrix-type input source selection */ | |
0e4835c1 JK |
12190 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
12191 | /* Input mixer1: only unmute Mic */ | |
9c7f852e | 12192 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
0e4835c1 JK |
12193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12197 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12198 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12200 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e TI |
12201 | /* Input mixer2 */ |
12202 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
0e4835c1 JK |
12203 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12204 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12205 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12206 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12207 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12208 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12209 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e TI |
12211 | /* Input mixer3 */ |
12212 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
0e4835c1 JK |
12213 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12214 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12215 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12216 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12217 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12218 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12219 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12220 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e | 12221 | |
ce875f07 TI |
12222 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12223 | ||
9c7f852e TI |
12224 | { } |
12225 | }; | |
12226 | ||
cd7509a4 KY |
12227 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
12228 | /* | |
12229 | * Unmute ADC0-2 and set the default input to mic-in | |
12230 | */ | |
12231 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12232 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12233 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12234 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12235 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12236 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12237 | ||
cb53c626 | 12238 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
cd7509a4 KY |
12239 | * mixer widget |
12240 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
12241 | * panel mic (mic 2) | |
12242 | */ | |
12243 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12244 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12246 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12247 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12248 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12249 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12250 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
12251 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
cd7509a4 KY |
12252 | /* |
12253 | * Set up output mixers (0x0c - 0x0e) | |
12254 | */ | |
12255 | /* set vol=0 to output mixers */ | |
12256 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12257 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12258 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12259 | ||
12260 | /* set up input amps for analog loopback */ | |
12261 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12264 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12265 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12266 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12267 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12268 | ||
12269 | ||
12270 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
12271 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
12272 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
12273 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
12274 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12275 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
12276 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
12277 | ||
12278 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12279 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12280 | ||
12281 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12282 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12283 | ||
12284 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
12285 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12286 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12287 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
12288 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12289 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12290 | ||
12291 | /* FIXME: use matrix-type input source selection */ | |
12292 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
12293 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12294 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
12295 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
12296 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
12297 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
12298 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
12299 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12300 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
12301 | /* Input mixer2 */ | |
12302 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12303 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12304 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12305 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12306 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12307 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12309 | /* Input mixer3 */ | |
12310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12311 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12312 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12313 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12314 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12315 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12316 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12317 | ||
ce875f07 TI |
12318 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12319 | ||
cd7509a4 KY |
12320 | { } |
12321 | }; | |
12322 | ||
9f99a638 HM |
12323 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
12324 | ||
12325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | |
12326 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12327 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12328 | ||
12329 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | |
12330 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12331 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12332 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12333 | ||
12334 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | |
12335 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12336 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
12337 | {} | |
12338 | }; | |
12339 | ||
18675e42 TI |
12340 | /* |
12341 | * Pin config fixes | |
12342 | */ | |
12343 | enum { | |
12344 | PINFIX_FSC_H270, | |
12345 | }; | |
12346 | ||
12347 | static const struct alc_fixup alc262_fixups[] = { | |
12348 | [PINFIX_FSC_H270] = { | |
12349 | .pins = (const struct alc_pincfg[]) { | |
12350 | { 0x14, 0x99130110 }, /* speaker */ | |
12351 | { 0x15, 0x0221142f }, /* front HP */ | |
12352 | { 0x1b, 0x0121141f }, /* rear HP */ | |
12353 | { } | |
12354 | } | |
12355 | }, | |
12356 | [PINFIX_PB_M5210] = { | |
12357 | .verbs = (const struct hda_verb[]) { | |
12358 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | |
12359 | {} | |
12360 | } | |
12361 | }, | |
12362 | }; | |
12363 | ||
12364 | static struct snd_pci_quirk alc262_fixup_tbl[] = { | |
12365 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), | |
12366 | {} | |
12367 | }; | |
12368 | ||
9f99a638 | 12369 | |
cb53c626 TI |
12370 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12371 | #define alc262_loopbacks alc880_loopbacks | |
12372 | #endif | |
12373 | ||
def319f9 | 12374 | /* pcm configuration: identical with ALC880 */ |
df694daa KY |
12375 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
12376 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
12377 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
12378 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
12379 | ||
12380 | /* | |
12381 | * BIOS auto configuration | |
12382 | */ | |
12383 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
12384 | { | |
12385 | struct alc_spec *spec = codec->spec; | |
12386 | int err; | |
12387 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
12388 | ||
f12ab1e0 TI |
12389 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
12390 | alc262_ignore); | |
12391 | if (err < 0) | |
df694daa | 12392 | return err; |
e64f14f4 | 12393 | if (!spec->autocfg.line_outs) { |
0852d7a6 | 12394 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
e64f14f4 TI |
12395 | spec->multiout.max_channels = 2; |
12396 | spec->no_analog = 1; | |
12397 | goto dig_only; | |
12398 | } | |
df694daa | 12399 | return 0; /* can't find valid BIOS pin config */ |
e64f14f4 | 12400 | } |
f12ab1e0 TI |
12401 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
12402 | if (err < 0) | |
12403 | return err; | |
05f5f477 | 12404 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 12405 | if (err < 0) |
df694daa KY |
12406 | return err; |
12407 | ||
12408 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
12409 | ||
e64f14f4 | 12410 | dig_only: |
757899ac | 12411 | alc_auto_parse_digital(codec); |
df694daa | 12412 | |
603c4019 | 12413 | if (spec->kctls.list) |
d88897ea | 12414 | add_mixer(spec, spec->kctls.list); |
df694daa | 12415 | |
d88897ea | 12416 | add_verb(spec, alc262_volume_init_verbs); |
a1e8d2da | 12417 | spec->num_mux_defs = 1; |
61b9b9b1 | 12418 | spec->input_mux = &spec->private_imux[0]; |
df694daa | 12419 | |
776e184e TI |
12420 | err = alc_auto_add_mic_boost(codec); |
12421 | if (err < 0) | |
12422 | return err; | |
12423 | ||
6227cdce | 12424 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 12425 | |
df694daa KY |
12426 | return 1; |
12427 | } | |
12428 | ||
12429 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
12430 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
12431 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
f511b01c | 12432 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
df694daa KY |
12433 | |
12434 | ||
12435 | /* init callback for auto-configuration model -- overriding the default init */ | |
ae6b813a | 12436 | static void alc262_auto_init(struct hda_codec *codec) |
df694daa | 12437 | { |
f6c7e546 | 12438 | struct alc_spec *spec = codec->spec; |
df694daa KY |
12439 | alc262_auto_init_multi_out(codec); |
12440 | alc262_auto_init_hp_out(codec); | |
12441 | alc262_auto_init_analog_input(codec); | |
f511b01c | 12442 | alc262_auto_init_input_src(codec); |
757899ac | 12443 | alc_auto_init_digital(codec); |
f6c7e546 | 12444 | if (spec->unsol_event) |
7fb0d78f | 12445 | alc_inithook(codec); |
df694daa KY |
12446 | } |
12447 | ||
12448 | /* | |
12449 | * configuration and preset | |
12450 | */ | |
f5fcc13c TI |
12451 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
12452 | [ALC262_BASIC] = "basic", | |
12453 | [ALC262_HIPPO] = "hippo", | |
12454 | [ALC262_HIPPO_1] = "hippo_1", | |
12455 | [ALC262_FUJITSU] = "fujitsu", | |
12456 | [ALC262_HP_BPC] = "hp-bpc", | |
cd7509a4 | 12457 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
61dc35de | 12458 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
8c427226 | 12459 | [ALC262_HP_RP5700] = "hp-rp5700", |
f5fcc13c | 12460 | [ALC262_BENQ_ED8] = "benq", |
0f40502e TI |
12461 | [ALC262_BENQ_T31] = "benq-t31", |
12462 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
2922c9af | 12463 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
9f99a638 | 12464 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
f651b50b | 12465 | [ALC262_ULTRA] = "ultra", |
0e31daf7 | 12466 | [ALC262_LENOVO_3000] = "lenovo-3000", |
e8f9ae2a | 12467 | [ALC262_NEC] = "nec", |
ba340e82 | 12468 | [ALC262_TYAN] = "tyan", |
f5fcc13c TI |
12469 | [ALC262_AUTO] = "auto", |
12470 | }; | |
12471 | ||
12472 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
12473 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
e8f9ae2a | 12474 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
dea0a509 TI |
12475 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
12476 | ALC262_HP_BPC), | |
12477 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", | |
12478 | ALC262_HP_BPC), | |
53eff7e1 TI |
12479 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
12480 | ALC262_HP_BPC), | |
cd7509a4 | 12481 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12482 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12483 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12484 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12485 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12486 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12487 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12488 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 TI |
12489 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
12490 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
12491 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
66d2a9d6 KY |
12492 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
12493 | ALC262_HP_TC_T5735), | |
8c427226 | 12494 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
ac3e3741 | 12495 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
f5fcc13c | 12496 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
5b31954e | 12497 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
bd6afe3f | 12498 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
376b508f | 12499 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
95491d90 | 12500 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
12929bae | 12501 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
c5b5165c | 12502 | #if 0 /* disable the quirk since model=auto works better in recent versions */ |
f872a919 TI |
12503 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
12504 | ALC262_SONY_ASSAMD), | |
c5b5165c | 12505 | #endif |
36ca6e13 | 12506 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
9f99a638 | 12507 | ALC262_TOSHIBA_RX1), |
80ffe869 | 12508 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
ac3e3741 | 12509 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
3f1eeaed | 12510 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
ba340e82 | 12511 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
dea0a509 TI |
12512 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
12513 | ALC262_ULTRA), | |
3e420e78 | 12514 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
0e31daf7 | 12515 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
ac3e3741 TI |
12516 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
12517 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
12518 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
df694daa KY |
12519 | {} |
12520 | }; | |
12521 | ||
12522 | static struct alc_config_preset alc262_presets[] = { | |
12523 | [ALC262_BASIC] = { | |
12524 | .mixers = { alc262_base_mixer }, | |
12525 | .init_verbs = { alc262_init_verbs }, | |
12526 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12527 | .dac_nids = alc262_dac_nids, | |
12528 | .hp_nid = 0x03, | |
12529 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12530 | .channel_mode = alc262_modes, | |
a3bcba38 | 12531 | .input_mux = &alc262_capture_source, |
df694daa | 12532 | }, |
ccc656ce | 12533 | [ALC262_HIPPO] = { |
42171c17 | 12534 | .mixers = { alc262_hippo_mixer }, |
6732bd0d | 12535 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
ccc656ce KY |
12536 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12537 | .dac_nids = alc262_dac_nids, | |
12538 | .hp_nid = 0x03, | |
12539 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12540 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12541 | .channel_mode = alc262_modes, | |
12542 | .input_mux = &alc262_capture_source, | |
12543 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12544 | .setup = alc262_hippo_setup, |
12545 | .init_hook = alc262_hippo_automute, | |
ccc656ce KY |
12546 | }, |
12547 | [ALC262_HIPPO_1] = { | |
12548 | .mixers = { alc262_hippo1_mixer }, | |
12549 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
12550 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12551 | .dac_nids = alc262_dac_nids, | |
12552 | .hp_nid = 0x02, | |
12553 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12554 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12555 | .channel_mode = alc262_modes, | |
12556 | .input_mux = &alc262_capture_source, | |
42171c17 | 12557 | .unsol_event = alc262_hippo_unsol_event, |
4f5d1706 TI |
12558 | .setup = alc262_hippo1_setup, |
12559 | .init_hook = alc262_hippo_automute, | |
ccc656ce | 12560 | }, |
834be88d TI |
12561 | [ALC262_FUJITSU] = { |
12562 | .mixers = { alc262_fujitsu_mixer }, | |
39d3ed38 TI |
12563 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
12564 | alc262_fujitsu_unsol_verbs }, | |
834be88d TI |
12565 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12566 | .dac_nids = alc262_dac_nids, | |
12567 | .hp_nid = 0x03, | |
12568 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12569 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12570 | .channel_mode = alc262_modes, | |
12571 | .input_mux = &alc262_fujitsu_capture_source, | |
ae6b813a | 12572 | .unsol_event = alc262_fujitsu_unsol_event, |
ebc7a406 | 12573 | .init_hook = alc262_fujitsu_init_hook, |
834be88d | 12574 | }, |
9c7f852e TI |
12575 | [ALC262_HP_BPC] = { |
12576 | .mixers = { alc262_HP_BPC_mixer }, | |
12577 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
12578 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12579 | .dac_nids = alc262_dac_nids, | |
12580 | .hp_nid = 0x03, | |
12581 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12582 | .channel_mode = alc262_modes, | |
12583 | .input_mux = &alc262_HP_capture_source, | |
ce875f07 TI |
12584 | .unsol_event = alc262_hp_bpc_unsol_event, |
12585 | .init_hook = alc262_hp_bpc_automute, | |
f12ab1e0 | 12586 | }, |
cd7509a4 KY |
12587 | [ALC262_HP_BPC_D7000_WF] = { |
12588 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
12589 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12590 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12591 | .dac_nids = alc262_dac_nids, | |
12592 | .hp_nid = 0x03, | |
12593 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12594 | .channel_mode = alc262_modes, | |
accbe498 | 12595 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
12596 | .unsol_event = alc262_hp_wildwest_unsol_event, |
12597 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 12598 | }, |
cd7509a4 KY |
12599 | [ALC262_HP_BPC_D7000_WL] = { |
12600 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
12601 | alc262_HP_BPC_WildWest_option_mixer }, | |
12602 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12603 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12604 | .dac_nids = alc262_dac_nids, | |
12605 | .hp_nid = 0x03, | |
12606 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12607 | .channel_mode = alc262_modes, | |
accbe498 | 12608 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
12609 | .unsol_event = alc262_hp_wildwest_unsol_event, |
12610 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 12611 | }, |
66d2a9d6 KY |
12612 | [ALC262_HP_TC_T5735] = { |
12613 | .mixers = { alc262_hp_t5735_mixer }, | |
12614 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
12615 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12616 | .dac_nids = alc262_dac_nids, | |
12617 | .hp_nid = 0x03, | |
12618 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12619 | .channel_mode = alc262_modes, | |
12620 | .input_mux = &alc262_capture_source, | |
dc99be47 | 12621 | .unsol_event = alc_sku_unsol_event, |
4f5d1706 | 12622 | .setup = alc262_hp_t5735_setup, |
dc99be47 | 12623 | .init_hook = alc_inithook, |
8c427226 KY |
12624 | }, |
12625 | [ALC262_HP_RP5700] = { | |
12626 | .mixers = { alc262_hp_rp5700_mixer }, | |
12627 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
12628 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12629 | .dac_nids = alc262_dac_nids, | |
12630 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12631 | .channel_mode = alc262_modes, | |
12632 | .input_mux = &alc262_hp_rp5700_capture_source, | |
66d2a9d6 | 12633 | }, |
304dcaac TI |
12634 | [ALC262_BENQ_ED8] = { |
12635 | .mixers = { alc262_base_mixer }, | |
12636 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
12637 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12638 | .dac_nids = alc262_dac_nids, | |
12639 | .hp_nid = 0x03, | |
12640 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12641 | .channel_mode = alc262_modes, | |
12642 | .input_mux = &alc262_capture_source, | |
f12ab1e0 | 12643 | }, |
272a527c KY |
12644 | [ALC262_SONY_ASSAMD] = { |
12645 | .mixers = { alc262_sony_mixer }, | |
12646 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
12647 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12648 | .dac_nids = alc262_dac_nids, | |
12649 | .hp_nid = 0x02, | |
12650 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12651 | .channel_mode = alc262_modes, | |
12652 | .input_mux = &alc262_capture_source, | |
12653 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12654 | .setup = alc262_hippo_setup, |
12655 | .init_hook = alc262_hippo_automute, | |
83c34218 KY |
12656 | }, |
12657 | [ALC262_BENQ_T31] = { | |
12658 | .mixers = { alc262_benq_t31_mixer }, | |
6732bd0d WF |
12659 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
12660 | alc_hp15_unsol_verbs }, | |
83c34218 KY |
12661 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12662 | .dac_nids = alc262_dac_nids, | |
12663 | .hp_nid = 0x03, | |
12664 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12665 | .channel_mode = alc262_modes, | |
12666 | .input_mux = &alc262_capture_source, | |
12667 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12668 | .setup = alc262_hippo_setup, |
12669 | .init_hook = alc262_hippo_automute, | |
ea1fb29a | 12670 | }, |
f651b50b | 12671 | [ALC262_ULTRA] = { |
f9e336f6 TI |
12672 | .mixers = { alc262_ultra_mixer }, |
12673 | .cap_mixer = alc262_ultra_capture_mixer, | |
bb9f76cd | 12674 | .init_verbs = { alc262_ultra_verbs }, |
f651b50b TD |
12675 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12676 | .dac_nids = alc262_dac_nids, | |
f651b50b TD |
12677 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
12678 | .channel_mode = alc262_modes, | |
12679 | .input_mux = &alc262_ultra_capture_source, | |
bb9f76cd TI |
12680 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
12681 | .capsrc_nids = alc262_capsrc_nids, | |
12682 | .num_adc_nids = 1, /* single ADC */ | |
f651b50b TD |
12683 | .unsol_event = alc262_ultra_unsol_event, |
12684 | .init_hook = alc262_ultra_automute, | |
12685 | }, | |
0e31daf7 J |
12686 | [ALC262_LENOVO_3000] = { |
12687 | .mixers = { alc262_lenovo_3000_mixer }, | |
12688 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
e2595322 DC |
12689 | alc262_lenovo_3000_unsol_verbs, |
12690 | alc262_lenovo_3000_init_verbs }, | |
0e31daf7 J |
12691 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12692 | .dac_nids = alc262_dac_nids, | |
12693 | .hp_nid = 0x03, | |
12694 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12695 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12696 | .channel_mode = alc262_modes, | |
12697 | .input_mux = &alc262_fujitsu_capture_source, | |
12698 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
12699 | }, | |
e8f9ae2a PT |
12700 | [ALC262_NEC] = { |
12701 | .mixers = { alc262_nec_mixer }, | |
12702 | .init_verbs = { alc262_nec_verbs }, | |
12703 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12704 | .dac_nids = alc262_dac_nids, | |
12705 | .hp_nid = 0x03, | |
12706 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12707 | .channel_mode = alc262_modes, | |
12708 | .input_mux = &alc262_capture_source, | |
12709 | }, | |
4e555fe5 KY |
12710 | [ALC262_TOSHIBA_S06] = { |
12711 | .mixers = { alc262_toshiba_s06_mixer }, | |
12712 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | |
12713 | alc262_eapd_verbs }, | |
12714 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12715 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
12716 | .dac_nids = alc262_dac_nids, | |
12717 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | |
ae14ef68 | 12718 | .num_adc_nids = 1, /* single ADC */ |
4e555fe5 KY |
12719 | .dig_out_nid = ALC262_DIGOUT_NID, |
12720 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12721 | .channel_mode = alc262_modes, | |
4f5d1706 TI |
12722 | .unsol_event = alc_sku_unsol_event, |
12723 | .setup = alc262_toshiba_s06_setup, | |
12724 | .init_hook = alc_inithook, | |
4e555fe5 | 12725 | }, |
9f99a638 HM |
12726 | [ALC262_TOSHIBA_RX1] = { |
12727 | .mixers = { alc262_toshiba_rx1_mixer }, | |
12728 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | |
12729 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12730 | .dac_nids = alc262_dac_nids, | |
12731 | .hp_nid = 0x03, | |
12732 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12733 | .channel_mode = alc262_modes, | |
12734 | .input_mux = &alc262_capture_source, | |
12735 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12736 | .setup = alc262_hippo_setup, |
12737 | .init_hook = alc262_hippo_automute, | |
9f99a638 | 12738 | }, |
ba340e82 TV |
12739 | [ALC262_TYAN] = { |
12740 | .mixers = { alc262_tyan_mixer }, | |
12741 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | |
12742 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12743 | .dac_nids = alc262_dac_nids, | |
12744 | .hp_nid = 0x02, | |
12745 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12746 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12747 | .channel_mode = alc262_modes, | |
12748 | .input_mux = &alc262_capture_source, | |
a9fd4f3f | 12749 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
12750 | .setup = alc262_tyan_setup, |
12751 | .init_hook = alc_automute_amp, | |
ba340e82 | 12752 | }, |
df694daa KY |
12753 | }; |
12754 | ||
12755 | static int patch_alc262(struct hda_codec *codec) | |
12756 | { | |
12757 | struct alc_spec *spec; | |
12758 | int board_config; | |
12759 | int err; | |
12760 | ||
dc041e0b | 12761 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
12762 | if (spec == NULL) |
12763 | return -ENOMEM; | |
12764 | ||
12765 | codec->spec = spec; | |
12766 | #if 0 | |
f12ab1e0 TI |
12767 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
12768 | * under-run | |
12769 | */ | |
df694daa KY |
12770 | { |
12771 | int tmp; | |
12772 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12773 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
12774 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12775 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
12776 | } | |
12777 | #endif | |
da00c244 | 12778 | alc_auto_parse_customize_define(codec); |
df694daa | 12779 | |
2c3bf9ab TI |
12780 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
12781 | ||
f5fcc13c TI |
12782 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
12783 | alc262_models, | |
12784 | alc262_cfg_tbl); | |
cd7509a4 | 12785 | |
f5fcc13c | 12786 | if (board_config < 0) { |
9a11f1aa TI |
12787 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
12788 | codec->chip_name); | |
df694daa KY |
12789 | board_config = ALC262_AUTO; |
12790 | } | |
12791 | ||
18675e42 TI |
12792 | if (board_config == ALC262_AUTO) |
12793 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); | |
12794 | ||
df694daa KY |
12795 | if (board_config == ALC262_AUTO) { |
12796 | /* automatic parse from the BIOS config */ | |
12797 | err = alc262_parse_auto_config(codec); | |
12798 | if (err < 0) { | |
12799 | alc_free(codec); | |
12800 | return err; | |
f12ab1e0 | 12801 | } else if (!err) { |
9c7f852e TI |
12802 | printk(KERN_INFO |
12803 | "hda_codec: Cannot set up configuration " | |
12804 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
12805 | board_config = ALC262_BASIC; |
12806 | } | |
12807 | } | |
12808 | ||
dc1eae25 | 12809 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
07eba61d TI |
12810 | err = snd_hda_attach_beep_device(codec, 0x1); |
12811 | if (err < 0) { | |
12812 | alc_free(codec); | |
12813 | return err; | |
12814 | } | |
680cd536 KK |
12815 | } |
12816 | ||
df694daa | 12817 | if (board_config != ALC262_AUTO) |
e9c364c0 | 12818 | setup_preset(codec, &alc262_presets[board_config]); |
df694daa | 12819 | |
df694daa KY |
12820 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
12821 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
ea1fb29a | 12822 | |
df694daa KY |
12823 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
12824 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
12825 | ||
f12ab1e0 | 12826 | if (!spec->adc_nids && spec->input_mux) { |
8c927b4a TI |
12827 | int i; |
12828 | /* check whether the digital-mic has to be supported */ | |
12829 | for (i = 0; i < spec->input_mux->num_items; i++) { | |
12830 | if (spec->input_mux->items[i].index >= 9) | |
12831 | break; | |
12832 | } | |
12833 | if (i < spec->input_mux->num_items) { | |
12834 | /* use only ADC0 */ | |
12835 | spec->adc_nids = alc262_dmic_adc_nids; | |
12836 | spec->num_adc_nids = 1; | |
12837 | spec->capsrc_nids = alc262_dmic_capsrc_nids; | |
df694daa | 12838 | } else { |
8c927b4a TI |
12839 | /* all analog inputs */ |
12840 | /* check whether NID 0x07 is valid */ | |
12841 | unsigned int wcap = get_wcaps(codec, 0x07); | |
12842 | ||
12843 | /* get type */ | |
a22d543a | 12844 | wcap = get_wcaps_type(wcap); |
8c927b4a TI |
12845 | if (wcap != AC_WID_AUD_IN) { |
12846 | spec->adc_nids = alc262_adc_nids_alt; | |
12847 | spec->num_adc_nids = | |
12848 | ARRAY_SIZE(alc262_adc_nids_alt); | |
12849 | spec->capsrc_nids = alc262_capsrc_nids_alt; | |
12850 | } else { | |
12851 | spec->adc_nids = alc262_adc_nids; | |
12852 | spec->num_adc_nids = | |
12853 | ARRAY_SIZE(alc262_adc_nids); | |
12854 | spec->capsrc_nids = alc262_capsrc_nids; | |
12855 | } | |
df694daa KY |
12856 | } |
12857 | } | |
e64f14f4 | 12858 | if (!spec->cap_mixer && !spec->no_analog) |
b59bdf3b | 12859 | set_capture_mixer(codec); |
dc1eae25 | 12860 | if (!spec->no_analog && has_cdefine_beep(codec)) |
07eba61d | 12861 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
df694daa | 12862 | |
18675e42 TI |
12863 | if (board_config == ALC262_AUTO) |
12864 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); | |
12865 | ||
2134ea4f TI |
12866 | spec->vmaster_nid = 0x0c; |
12867 | ||
df694daa KY |
12868 | codec->patch_ops = alc_patch_ops; |
12869 | if (board_config == ALC262_AUTO) | |
ae6b813a | 12870 | spec->init_hook = alc262_auto_init; |
cb53c626 TI |
12871 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12872 | if (!spec->loopback.amplist) | |
12873 | spec->loopback.amplist = alc262_loopbacks; | |
12874 | #endif | |
ea1fb29a | 12875 | |
df694daa KY |
12876 | return 0; |
12877 | } | |
12878 | ||
a361d84b KY |
12879 | /* |
12880 | * ALC268 channel source setting (2 channel) | |
12881 | */ | |
12882 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
12883 | #define alc268_modes alc260_modes | |
ea1fb29a | 12884 | |
a361d84b KY |
12885 | static hda_nid_t alc268_dac_nids[2] = { |
12886 | /* front, hp */ | |
12887 | 0x02, 0x03 | |
12888 | }; | |
12889 | ||
12890 | static hda_nid_t alc268_adc_nids[2] = { | |
12891 | /* ADC0-1 */ | |
12892 | 0x08, 0x07 | |
12893 | }; | |
12894 | ||
12895 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
12896 | /* ADC0 */ | |
12897 | 0x08 | |
12898 | }; | |
12899 | ||
e1406348 TI |
12900 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
12901 | ||
a361d84b KY |
12902 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
12903 | /* output mixer control */ | |
12904 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12905 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12906 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
33bf17ab TI |
12908 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
12909 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12910 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
a361d84b KY |
12911 | { } |
12912 | }; | |
12913 | ||
42171c17 TI |
12914 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
12915 | /* output mixer control */ | |
12916 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12917 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12918 | ALC262_HIPPO_MASTER_SWITCH, | |
12919 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12920 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12921 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12922 | { } | |
12923 | }; | |
12924 | ||
aef9d318 TI |
12925 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
12926 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
12927 | .ops = &snd_hda_bind_sw, | |
12928 | .values = { | |
12929 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
12930 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
12931 | 0 | |
12932 | }, | |
12933 | }; | |
12934 | ||
12935 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
12936 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
12937 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
12938 | { } | |
12939 | }; | |
12940 | ||
d1a991a6 KY |
12941 | static struct hda_verb alc268_eapd_verbs[] = { |
12942 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12943 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12944 | { } | |
12945 | }; | |
12946 | ||
d273809e | 12947 | /* Toshiba specific */ |
d273809e TI |
12948 | static struct hda_verb alc268_toshiba_verbs[] = { |
12949 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
12950 | { } /* end */ | |
12951 | }; | |
12952 | ||
12953 | /* Acer specific */ | |
889c4395 | 12954 | /* bind volumes of both NID 0x02 and 0x03 */ |
6bc96857 TI |
12955 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
12956 | .ops = &snd_hda_bind_vol, | |
12957 | .values = { | |
12958 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
12959 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
12960 | 0 | |
12961 | }, | |
12962 | }; | |
12963 | ||
889c4395 TI |
12964 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
12965 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
12966 | { | |
12967 | struct alc_spec *spec = codec->spec; | |
12968 | unsigned int mute; | |
12969 | ||
12970 | if (force || !spec->sense_updated) { | |
864f92be | 12971 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
889c4395 TI |
12972 | spec->sense_updated = 1; |
12973 | } | |
12974 | if (spec->jack_present) | |
12975 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
12976 | else /* unmute internal speaker if necessary */ | |
12977 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
12978 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
12979 | HDA_AMP_MUTE, mute); | |
12980 | } | |
12981 | ||
12982 | ||
12983 | /* bind hp and internal speaker mute (with plug check) */ | |
12984 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
12985 | struct snd_ctl_elem_value *ucontrol) | |
12986 | { | |
12987 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
12988 | long *valp = ucontrol->value.integer.value; | |
12989 | int change; | |
12990 | ||
8de56b7d | 12991 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
889c4395 TI |
12992 | if (change) |
12993 | alc268_acer_automute(codec, 0); | |
12994 | return change; | |
12995 | } | |
d273809e | 12996 | |
8ef355da KY |
12997 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
12998 | /* output mixer control */ | |
12999 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13000 | { | |
13001 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13002 | .name = "Master Playback Switch", | |
5e26dfd0 | 13003 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
8ef355da KY |
13004 | .info = snd_hda_mixer_amp_switch_info, |
13005 | .get = snd_hda_mixer_amp_switch_get, | |
13006 | .put = alc268_acer_master_sw_put, | |
13007 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13008 | }, | |
13009 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | |
13010 | { } | |
13011 | }; | |
13012 | ||
d273809e TI |
13013 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
13014 | /* output mixer control */ | |
13015 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13016 | { | |
13017 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13018 | .name = "Master Playback Switch", | |
5e26dfd0 | 13019 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
d273809e TI |
13020 | .info = snd_hda_mixer_amp_switch_info, |
13021 | .get = snd_hda_mixer_amp_switch_get, | |
13022 | .put = alc268_acer_master_sw_put, | |
13023 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13024 | }, | |
33bf17ab TI |
13025 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
13026 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13027 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
d273809e TI |
13028 | { } |
13029 | }; | |
13030 | ||
c238b4f4 TI |
13031 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
13032 | /* output mixer control */ | |
13033 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13034 | { | |
13035 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13036 | .name = "Master Playback Switch", | |
5e26dfd0 | 13037 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
c238b4f4 TI |
13038 | .info = snd_hda_mixer_amp_switch_info, |
13039 | .get = snd_hda_mixer_amp_switch_get, | |
13040 | .put = alc268_acer_master_sw_put, | |
13041 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13042 | }, | |
13043 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13044 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
13045 | { } | |
13046 | }; | |
13047 | ||
8ef355da KY |
13048 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
13049 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13050 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13051 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13052 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13053 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
13054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | |
13055 | { } | |
13056 | }; | |
13057 | ||
d273809e | 13058 | static struct hda_verb alc268_acer_verbs[] = { |
0ccb541c TI |
13059 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
13060 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d273809e TI |
13061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
13062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
0ccb541c TI |
13063 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
13064 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
d273809e TI |
13065 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
13066 | { } | |
13067 | }; | |
13068 | ||
13069 | /* unsolicited event for HP jack sensing */ | |
42171c17 | 13070 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
4f5d1706 TI |
13071 | #define alc268_toshiba_setup alc262_hippo_setup |
13072 | #define alc268_toshiba_automute alc262_hippo_automute | |
d273809e TI |
13073 | |
13074 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
13075 | unsigned int res) | |
13076 | { | |
889c4395 | 13077 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
13078 | return; |
13079 | alc268_acer_automute(codec, 1); | |
13080 | } | |
13081 | ||
889c4395 TI |
13082 | static void alc268_acer_init_hook(struct hda_codec *codec) |
13083 | { | |
13084 | alc268_acer_automute(codec, 1); | |
13085 | } | |
13086 | ||
8ef355da KY |
13087 | /* toggle speaker-output according to the hp-jack state */ |
13088 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |
13089 | { | |
13090 | unsigned int present; | |
13091 | unsigned char bits; | |
13092 | ||
864f92be | 13093 | present = snd_hda_jack_detect(codec, 0x15); |
5dbd5ec6 | 13094 | bits = present ? HDA_AMP_MUTE : 0; |
8ef355da | 13095 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
5dbd5ec6 | 13096 | HDA_AMP_MUTE, bits); |
8ef355da | 13097 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
5dbd5ec6 | 13098 | HDA_AMP_MUTE, bits); |
8ef355da KY |
13099 | } |
13100 | ||
8ef355da KY |
13101 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
13102 | unsigned int res) | |
13103 | { | |
4f5d1706 TI |
13104 | switch (res >> 26) { |
13105 | case ALC880_HP_EVENT: | |
8ef355da | 13106 | alc268_aspire_one_speaker_automute(codec); |
4f5d1706 TI |
13107 | break; |
13108 | case ALC880_MIC_EVENT: | |
13109 | alc_mic_automute(codec); | |
13110 | break; | |
13111 | } | |
13112 | } | |
13113 | ||
13114 | static void alc268_acer_lc_setup(struct hda_codec *codec) | |
13115 | { | |
13116 | struct alc_spec *spec = codec->spec; | |
13117 | spec->ext_mic.pin = 0x18; | |
13118 | spec->ext_mic.mux_idx = 0; | |
13119 | spec->int_mic.pin = 0x12; | |
13120 | spec->int_mic.mux_idx = 6; | |
13121 | spec->auto_mic = 1; | |
8ef355da KY |
13122 | } |
13123 | ||
13124 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | |
13125 | { | |
13126 | alc268_aspire_one_speaker_automute(codec); | |
4f5d1706 | 13127 | alc_mic_automute(codec); |
8ef355da KY |
13128 | } |
13129 | ||
3866f0b0 TI |
13130 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
13131 | /* output mixer control */ | |
13132 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13133 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13134 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13135 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13136 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13137 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13138 | { } | |
13139 | }; | |
13140 | ||
13141 | static struct hda_verb alc268_dell_verbs[] = { | |
13142 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13143 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13144 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
4f5d1706 | 13145 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
3866f0b0 TI |
13146 | { } |
13147 | }; | |
13148 | ||
13149 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
4f5d1706 | 13150 | static void alc268_dell_setup(struct hda_codec *codec) |
3866f0b0 | 13151 | { |
a9fd4f3f | 13152 | struct alc_spec *spec = codec->spec; |
3866f0b0 | 13153 | |
a9fd4f3f TI |
13154 | spec->autocfg.hp_pins[0] = 0x15; |
13155 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
13156 | spec->ext_mic.pin = 0x18; |
13157 | spec->ext_mic.mux_idx = 0; | |
13158 | spec->int_mic.pin = 0x19; | |
13159 | spec->int_mic.mux_idx = 1; | |
13160 | spec->auto_mic = 1; | |
3866f0b0 TI |
13161 | } |
13162 | ||
eb5a6621 HRK |
13163 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
13164 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
13165 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13166 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
13167 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13168 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13169 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13170 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
13171 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
13172 | { } | |
13173 | }; | |
13174 | ||
13175 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
13176 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13177 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
13178 | { } | |
13179 | }; | |
13180 | ||
4f5d1706 | 13181 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
eb5a6621 | 13182 | { |
a9fd4f3f | 13183 | struct alc_spec *spec = codec->spec; |
a9fd4f3f TI |
13184 | spec->autocfg.hp_pins[0] = 0x15; |
13185 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
13186 | spec->ext_mic.pin = 0x18; |
13187 | spec->ext_mic.mux_idx = 0; | |
13188 | spec->int_mic.pin = 0x19; | |
13189 | spec->int_mic.mux_idx = 1; | |
13190 | spec->auto_mic = 1; | |
eb5a6621 HRK |
13191 | } |
13192 | ||
a361d84b KY |
13193 | /* |
13194 | * generic initialization of ADC, input mixers and output mixers | |
13195 | */ | |
13196 | static struct hda_verb alc268_base_init_verbs[] = { | |
13197 | /* Unmute DAC0-1 and set vol = 0 */ | |
13198 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a361d84b | 13199 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
a361d84b KY |
13200 | |
13201 | /* | |
13202 | * Set up output mixers (0x0c - 0x0e) | |
13203 | */ | |
13204 | /* set vol=0 to output mixers */ | |
13205 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
a361d84b KY |
13206 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
13207 | ||
13208 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13209 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13210 | ||
13211 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13212 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
13213 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13214 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13215 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13216 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13217 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13218 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13219 | ||
13220 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13221 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13222 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13223 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
a361d84b | 13224 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
aef9d318 TI |
13225 | |
13226 | /* set PCBEEP vol = 0, mute connections */ | |
13227 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13228 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13229 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b | 13230 | |
a9b3aa8a | 13231 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
ea1fb29a | 13232 | |
a9b3aa8a JZ |
13233 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
13234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13235 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13236 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
a361d84b | 13237 | |
a361d84b KY |
13238 | { } |
13239 | }; | |
13240 | ||
13241 | /* | |
13242 | * generic initialization of ADC, input mixers and output mixers | |
13243 | */ | |
13244 | static struct hda_verb alc268_volume_init_verbs[] = { | |
13245 | /* set output DAC */ | |
4cfb91c6 TI |
13246 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
13247 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a361d84b KY |
13248 | |
13249 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13250 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13251 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13252 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13253 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13254 | ||
a361d84b | 13255 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
a361d84b KY |
13256 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
13257 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13258 | ||
13259 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
a361d84b | 13260 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
a361d84b | 13261 | |
aef9d318 TI |
13262 | /* set PCBEEP vol = 0, mute connections */ |
13263 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13264 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13265 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b KY |
13266 | |
13267 | { } | |
13268 | }; | |
13269 | ||
fdbc6626 TI |
13270 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
13271 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13272 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13273 | { } /* end */ | |
13274 | }; | |
13275 | ||
a361d84b KY |
13276 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
13277 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13278 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
fdbc6626 | 13279 | _DEFINE_CAPSRC(1), |
a361d84b KY |
13280 | { } /* end */ |
13281 | }; | |
13282 | ||
13283 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
13284 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13285 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13286 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
13287 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
fdbc6626 | 13288 | _DEFINE_CAPSRC(2), |
a361d84b KY |
13289 | { } /* end */ |
13290 | }; | |
13291 | ||
13292 | static struct hda_input_mux alc268_capture_source = { | |
13293 | .num_items = 4, | |
13294 | .items = { | |
13295 | { "Mic", 0x0 }, | |
13296 | { "Front Mic", 0x1 }, | |
13297 | { "Line", 0x2 }, | |
13298 | { "CD", 0x3 }, | |
13299 | }, | |
13300 | }; | |
13301 | ||
0ccb541c | 13302 | static struct hda_input_mux alc268_acer_capture_source = { |
c238b4f4 TI |
13303 | .num_items = 3, |
13304 | .items = { | |
13305 | { "Mic", 0x0 }, | |
13306 | { "Internal Mic", 0x1 }, | |
13307 | { "Line", 0x2 }, | |
13308 | }, | |
13309 | }; | |
13310 | ||
13311 | static struct hda_input_mux alc268_acer_dmic_capture_source = { | |
0ccb541c TI |
13312 | .num_items = 3, |
13313 | .items = { | |
13314 | { "Mic", 0x0 }, | |
13315 | { "Internal Mic", 0x6 }, | |
13316 | { "Line", 0x2 }, | |
13317 | }, | |
13318 | }; | |
13319 | ||
86c53bd2 JW |
13320 | #ifdef CONFIG_SND_DEBUG |
13321 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
86c53bd2 JW |
13322 | /* Volume widgets */ |
13323 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13324 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13325 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
13326 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
13327 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
13328 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
13329 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
13330 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
13331 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
13332 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
13333 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
13334 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
13335 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
f0747ee6 TI |
13336 | /* The below appears problematic on some hardwares */ |
13337 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
86c53bd2 JW |
13338 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
13339 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13340 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
13341 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
13342 | ||
13343 | /* Modes for retasking pin widgets */ | |
13344 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
13345 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
13346 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
13347 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
13348 | ||
13349 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
13350 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
13351 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
13352 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
13353 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
13354 | ||
13355 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
13356 | * The ALC268 does not have an SPDIF input. | |
13357 | */ | |
13358 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
13359 | ||
13360 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
13361 | * this output to turn on an external amplifier. | |
13362 | */ | |
13363 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
13364 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
13365 | ||
13366 | { } /* end */ | |
13367 | }; | |
13368 | #endif | |
13369 | ||
a361d84b KY |
13370 | /* create input playback/capture controls for the given pin */ |
13371 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
13372 | const char *ctlname, int idx) | |
13373 | { | |
3f3b7c1a | 13374 | hda_nid_t dac; |
a361d84b KY |
13375 | int err; |
13376 | ||
3f3b7c1a TI |
13377 | switch (nid) { |
13378 | case 0x14: | |
13379 | case 0x16: | |
13380 | dac = 0x02; | |
13381 | break; | |
13382 | case 0x15: | |
b08b1637 TI |
13383 | case 0x1a: /* ALC259/269 only */ |
13384 | case 0x1b: /* ALC259/269 only */ | |
531d8791 | 13385 | case 0x21: /* ALC269vb has this pin, too */ |
3f3b7c1a TI |
13386 | dac = 0x03; |
13387 | break; | |
13388 | default: | |
c7a9434d TI |
13389 | snd_printd(KERN_WARNING "hda_codec: " |
13390 | "ignoring pin 0x%x as unknown\n", nid); | |
3f3b7c1a TI |
13391 | return 0; |
13392 | } | |
13393 | if (spec->multiout.dac_nids[0] != dac && | |
13394 | spec->multiout.dac_nids[1] != dac) { | |
0afe5f89 | 13395 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
3f3b7c1a | 13396 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
a361d84b KY |
13397 | HDA_OUTPUT)); |
13398 | if (err < 0) | |
13399 | return err; | |
3f3b7c1a TI |
13400 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
13401 | } | |
13402 | ||
3f3b7c1a | 13403 | if (nid != 0x16) |
0afe5f89 | 13404 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
a361d84b | 13405 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
3f3b7c1a | 13406 | else /* mono */ |
0afe5f89 | 13407 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
3f3b7c1a | 13408 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
a361d84b KY |
13409 | if (err < 0) |
13410 | return err; | |
13411 | return 0; | |
13412 | } | |
13413 | ||
13414 | /* add playback controls from the parsed DAC table */ | |
13415 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
13416 | const struct auto_pin_cfg *cfg) | |
13417 | { | |
13418 | hda_nid_t nid; | |
13419 | int err; | |
13420 | ||
a361d84b | 13421 | spec->multiout.dac_nids = spec->private_dac_nids; |
a361d84b KY |
13422 | |
13423 | nid = cfg->line_out_pins[0]; | |
3f3b7c1a TI |
13424 | if (nid) { |
13425 | const char *name; | |
13426 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
13427 | name = "Speaker"; | |
13428 | else | |
13429 | name = "Front"; | |
13430 | err = alc268_new_analog_output(spec, nid, name, 0); | |
13431 | if (err < 0) | |
13432 | return err; | |
13433 | } | |
a361d84b KY |
13434 | |
13435 | nid = cfg->speaker_pins[0]; | |
13436 | if (nid == 0x1d) { | |
0afe5f89 | 13437 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
a361d84b KY |
13438 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
13439 | if (err < 0) | |
13440 | return err; | |
7bfb9c03 | 13441 | } else if (nid) { |
3f3b7c1a TI |
13442 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
13443 | if (err < 0) | |
13444 | return err; | |
a361d84b KY |
13445 | } |
13446 | nid = cfg->hp_pins[0]; | |
3f3b7c1a TI |
13447 | if (nid) { |
13448 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); | |
13449 | if (err < 0) | |
13450 | return err; | |
13451 | } | |
a361d84b KY |
13452 | |
13453 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
13454 | if (nid == 0x16) { | |
0afe5f89 | 13455 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
3f3b7c1a | 13456 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
a361d84b KY |
13457 | if (err < 0) |
13458 | return err; | |
13459 | } | |
ea1fb29a | 13460 | return 0; |
a361d84b KY |
13461 | } |
13462 | ||
13463 | /* create playback/capture controls for input pins */ | |
05f5f477 | 13464 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
a361d84b KY |
13465 | const struct auto_pin_cfg *cfg) |
13466 | { | |
05f5f477 | 13467 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
a361d84b KY |
13468 | } |
13469 | ||
e9af4f36 TI |
13470 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
13471 | hda_nid_t nid, int pin_type) | |
13472 | { | |
13473 | int idx; | |
13474 | ||
13475 | alc_set_pin_output(codec, nid, pin_type); | |
13476 | if (nid == 0x14 || nid == 0x16) | |
13477 | idx = 0; | |
13478 | else | |
13479 | idx = 1; | |
13480 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
13481 | } | |
13482 | ||
13483 | static void alc268_auto_init_multi_out(struct hda_codec *codec) | |
13484 | { | |
13485 | struct alc_spec *spec = codec->spec; | |
e1ca7b4e TI |
13486 | int i; |
13487 | ||
13488 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
13489 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
e9af4f36 TI |
13490 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
13491 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); | |
13492 | } | |
13493 | } | |
13494 | ||
13495 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | |
13496 | { | |
13497 | struct alc_spec *spec = codec->spec; | |
13498 | hda_nid_t pin; | |
e1ca7b4e | 13499 | int i; |
e9af4f36 | 13500 | |
e1ca7b4e TI |
13501 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
13502 | pin = spec->autocfg.hp_pins[i]; | |
e9af4f36 | 13503 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
e1ca7b4e TI |
13504 | } |
13505 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { | |
13506 | pin = spec->autocfg.speaker_pins[i]; | |
e9af4f36 | 13507 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
e1ca7b4e TI |
13508 | } |
13509 | if (spec->autocfg.mono_out_pin) | |
13510 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, | |
13511 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
e9af4f36 TI |
13512 | } |
13513 | ||
a361d84b KY |
13514 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
13515 | { | |
13516 | struct alc_spec *spec = codec->spec; | |
13517 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
13518 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
13519 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
13520 | unsigned int dac_vol1, dac_vol2; | |
13521 | ||
e9af4f36 | 13522 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
a361d84b KY |
13523 | snd_hda_codec_write(codec, speaker_nid, 0, |
13524 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
e9af4f36 | 13525 | /* mute mixer inputs from 0x1d */ |
a361d84b KY |
13526 | snd_hda_codec_write(codec, 0x0f, 0, |
13527 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13528 | AMP_IN_UNMUTE(1)); | |
13529 | snd_hda_codec_write(codec, 0x10, 0, | |
13530 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13531 | AMP_IN_UNMUTE(1)); | |
13532 | } else { | |
e9af4f36 | 13533 | /* unmute mixer inputs from 0x1d */ |
a361d84b KY |
13534 | snd_hda_codec_write(codec, 0x0f, 0, |
13535 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13536 | snd_hda_codec_write(codec, 0x10, 0, | |
13537 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13538 | } | |
13539 | ||
13540 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
ea1fb29a | 13541 | if (line_nid == 0x14) |
a361d84b KY |
13542 | dac_vol2 = AMP_OUT_ZERO; |
13543 | else if (line_nid == 0x15) | |
13544 | dac_vol1 = AMP_OUT_ZERO; | |
ea1fb29a | 13545 | if (hp_nid == 0x14) |
a361d84b KY |
13546 | dac_vol2 = AMP_OUT_ZERO; |
13547 | else if (hp_nid == 0x15) | |
13548 | dac_vol1 = AMP_OUT_ZERO; | |
13549 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
13550 | spec->autocfg.line_out_pins[1] != 0x16 || | |
13551 | spec->autocfg.line_out_pins[2] != 0x16) | |
13552 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
13553 | ||
13554 | snd_hda_codec_write(codec, 0x02, 0, | |
13555 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
13556 | snd_hda_codec_write(codec, 0x03, 0, | |
13557 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
13558 | } | |
13559 | ||
def319f9 | 13560 | /* pcm configuration: identical with ALC880 */ |
a361d84b KY |
13561 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
13562 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 13563 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
a361d84b KY |
13564 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
13565 | ||
13566 | /* | |
13567 | * BIOS auto configuration | |
13568 | */ | |
13569 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
13570 | { | |
13571 | struct alc_spec *spec = codec->spec; | |
13572 | int err; | |
13573 | static hda_nid_t alc268_ignore[] = { 0 }; | |
13574 | ||
13575 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
13576 | alc268_ignore); | |
13577 | if (err < 0) | |
13578 | return err; | |
7e0e44d4 TI |
13579 | if (!spec->autocfg.line_outs) { |
13580 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
13581 | spec->multiout.max_channels = 2; | |
13582 | spec->no_analog = 1; | |
13583 | goto dig_only; | |
13584 | } | |
a361d84b | 13585 | return 0; /* can't find valid BIOS pin config */ |
7e0e44d4 | 13586 | } |
a361d84b KY |
13587 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
13588 | if (err < 0) | |
13589 | return err; | |
05f5f477 | 13590 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
a361d84b KY |
13591 | if (err < 0) |
13592 | return err; | |
13593 | ||
13594 | spec->multiout.max_channels = 2; | |
13595 | ||
7e0e44d4 | 13596 | dig_only: |
a361d84b | 13597 | /* digital only support output */ |
757899ac | 13598 | alc_auto_parse_digital(codec); |
603c4019 | 13599 | if (spec->kctls.list) |
d88897ea | 13600 | add_mixer(spec, spec->kctls.list); |
a361d84b | 13601 | |
892981ff | 13602 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
d88897ea | 13603 | add_mixer(spec, alc268_beep_mixer); |
aef9d318 | 13604 | |
d88897ea | 13605 | add_verb(spec, alc268_volume_init_verbs); |
5908589f | 13606 | spec->num_mux_defs = 2; |
61b9b9b1 | 13607 | spec->input_mux = &spec->private_imux[0]; |
a361d84b | 13608 | |
776e184e TI |
13609 | err = alc_auto_add_mic_boost(codec); |
13610 | if (err < 0) | |
13611 | return err; | |
13612 | ||
6227cdce | 13613 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
1d955ebd | 13614 | |
a361d84b KY |
13615 | return 1; |
13616 | } | |
13617 | ||
a361d84b KY |
13618 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
13619 | ||
13620 | /* init callback for auto-configuration model -- overriding the default init */ | |
13621 | static void alc268_auto_init(struct hda_codec *codec) | |
13622 | { | |
f6c7e546 | 13623 | struct alc_spec *spec = codec->spec; |
a361d84b KY |
13624 | alc268_auto_init_multi_out(codec); |
13625 | alc268_auto_init_hp_out(codec); | |
13626 | alc268_auto_init_mono_speaker_out(codec); | |
13627 | alc268_auto_init_analog_input(codec); | |
757899ac | 13628 | alc_auto_init_digital(codec); |
f6c7e546 | 13629 | if (spec->unsol_event) |
7fb0d78f | 13630 | alc_inithook(codec); |
a361d84b KY |
13631 | } |
13632 | ||
13633 | /* | |
13634 | * configuration and preset | |
13635 | */ | |
13636 | static const char *alc268_models[ALC268_MODEL_LAST] = { | |
eb5a6621 | 13637 | [ALC267_QUANTA_IL1] = "quanta-il1", |
a361d84b | 13638 | [ALC268_3ST] = "3stack", |
983f8ae4 | 13639 | [ALC268_TOSHIBA] = "toshiba", |
d273809e | 13640 | [ALC268_ACER] = "acer", |
c238b4f4 | 13641 | [ALC268_ACER_DMIC] = "acer-dmic", |
8ef355da | 13642 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
3866f0b0 | 13643 | [ALC268_DELL] = "dell", |
f12462c5 | 13644 | [ALC268_ZEPTO] = "zepto", |
86c53bd2 JW |
13645 | #ifdef CONFIG_SND_DEBUG |
13646 | [ALC268_TEST] = "test", | |
13647 | #endif | |
a361d84b KY |
13648 | [ALC268_AUTO] = "auto", |
13649 | }; | |
13650 | ||
13651 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
a0b8f7d8 | 13652 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
ac3e3741 | 13653 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
dafc8357 | 13654 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
ac3e3741 | 13655 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
29a52c24 | 13656 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
8ef355da KY |
13657 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
13658 | ALC268_ACER_ASPIRE_ONE), | |
3866f0b0 | 13659 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
a1bf8088 DC |
13660 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
13661 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), | |
33d78674 TI |
13662 | /* almost compatible with toshiba but with optional digital outs; |
13663 | * auto-probing seems working fine | |
13664 | */ | |
8871e5b9 | 13665 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
33d78674 | 13666 | ALC268_AUTO), |
a361d84b | 13667 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
8871e5b9 | 13668 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
378bd6a5 | 13669 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
b875bf3a | 13670 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
eb5a6621 | 13671 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
a361d84b KY |
13672 | {} |
13673 | }; | |
13674 | ||
3abf2f36 TI |
13675 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
13676 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | |
13677 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | |
13678 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | |
13679 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | |
13680 | ALC268_TOSHIBA), | |
13681 | {} | |
13682 | }; | |
13683 | ||
a361d84b | 13684 | static struct alc_config_preset alc268_presets[] = { |
eb5a6621 | 13685 | [ALC267_QUANTA_IL1] = { |
fdbc6626 TI |
13686 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
13687 | alc268_capture_nosrc_mixer }, | |
eb5a6621 HRK |
13688 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13689 | alc267_quanta_il1_verbs }, | |
13690 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13691 | .dac_nids = alc268_dac_nids, | |
13692 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13693 | .adc_nids = alc268_adc_nids_alt, | |
13694 | .hp_nid = 0x03, | |
13695 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13696 | .channel_mode = alc268_modes, | |
4f5d1706 TI |
13697 | .unsol_event = alc_sku_unsol_event, |
13698 | .setup = alc267_quanta_il1_setup, | |
13699 | .init_hook = alc_inithook, | |
eb5a6621 | 13700 | }, |
a361d84b | 13701 | [ALC268_3ST] = { |
aef9d318 TI |
13702 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
13703 | alc268_beep_mixer }, | |
a361d84b KY |
13704 | .init_verbs = { alc268_base_init_verbs }, |
13705 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13706 | .dac_nids = alc268_dac_nids, | |
13707 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13708 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13709 | .capsrc_nids = alc268_capsrc_nids, |
a361d84b KY |
13710 | .hp_nid = 0x03, |
13711 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13712 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13713 | .channel_mode = alc268_modes, | |
13714 | .input_mux = &alc268_capture_source, | |
13715 | }, | |
d1a991a6 | 13716 | [ALC268_TOSHIBA] = { |
42171c17 | 13717 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
aef9d318 | 13718 | alc268_beep_mixer }, |
d273809e TI |
13719 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13720 | alc268_toshiba_verbs }, | |
d1a991a6 KY |
13721 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
13722 | .dac_nids = alc268_dac_nids, | |
13723 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13724 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13725 | .capsrc_nids = alc268_capsrc_nids, |
d1a991a6 KY |
13726 | .hp_nid = 0x03, |
13727 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13728 | .channel_mode = alc268_modes, | |
13729 | .input_mux = &alc268_capture_source, | |
d273809e | 13730 | .unsol_event = alc268_toshiba_unsol_event, |
4f5d1706 TI |
13731 | .setup = alc268_toshiba_setup, |
13732 | .init_hook = alc268_toshiba_automute, | |
d273809e TI |
13733 | }, |
13734 | [ALC268_ACER] = { | |
432fd133 | 13735 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
aef9d318 | 13736 | alc268_beep_mixer }, |
d273809e TI |
13737 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13738 | alc268_acer_verbs }, | |
13739 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13740 | .dac_nids = alc268_dac_nids, | |
13741 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13742 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13743 | .capsrc_nids = alc268_capsrc_nids, |
d273809e TI |
13744 | .hp_nid = 0x02, |
13745 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13746 | .channel_mode = alc268_modes, | |
0ccb541c | 13747 | .input_mux = &alc268_acer_capture_source, |
d273809e | 13748 | .unsol_event = alc268_acer_unsol_event, |
889c4395 | 13749 | .init_hook = alc268_acer_init_hook, |
d1a991a6 | 13750 | }, |
c238b4f4 TI |
13751 | [ALC268_ACER_DMIC] = { |
13752 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, | |
13753 | alc268_beep_mixer }, | |
13754 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13755 | alc268_acer_verbs }, | |
13756 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13757 | .dac_nids = alc268_dac_nids, | |
13758 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13759 | .adc_nids = alc268_adc_nids_alt, | |
13760 | .capsrc_nids = alc268_capsrc_nids, | |
13761 | .hp_nid = 0x02, | |
13762 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13763 | .channel_mode = alc268_modes, | |
13764 | .input_mux = &alc268_acer_dmic_capture_source, | |
13765 | .unsol_event = alc268_acer_unsol_event, | |
13766 | .init_hook = alc268_acer_init_hook, | |
13767 | }, | |
8ef355da KY |
13768 | [ALC268_ACER_ASPIRE_ONE] = { |
13769 | .mixers = { alc268_acer_aspire_one_mixer, | |
22971e3a | 13770 | alc268_beep_mixer, |
fdbc6626 | 13771 | alc268_capture_nosrc_mixer }, |
8ef355da KY |
13772 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13773 | alc268_acer_aspire_one_verbs }, | |
13774 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13775 | .dac_nids = alc268_dac_nids, | |
13776 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13777 | .adc_nids = alc268_adc_nids_alt, | |
13778 | .capsrc_nids = alc268_capsrc_nids, | |
13779 | .hp_nid = 0x03, | |
13780 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13781 | .channel_mode = alc268_modes, | |
8ef355da | 13782 | .unsol_event = alc268_acer_lc_unsol_event, |
4f5d1706 | 13783 | .setup = alc268_acer_lc_setup, |
8ef355da KY |
13784 | .init_hook = alc268_acer_lc_init_hook, |
13785 | }, | |
3866f0b0 | 13786 | [ALC268_DELL] = { |
fdbc6626 TI |
13787 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
13788 | alc268_capture_nosrc_mixer }, | |
3866f0b0 TI |
13789 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13790 | alc268_dell_verbs }, | |
13791 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13792 | .dac_nids = alc268_dac_nids, | |
fdbc6626 TI |
13793 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
13794 | .adc_nids = alc268_adc_nids_alt, | |
13795 | .capsrc_nids = alc268_capsrc_nids, | |
3866f0b0 TI |
13796 | .hp_nid = 0x02, |
13797 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13798 | .channel_mode = alc268_modes, | |
a9fd4f3f | 13799 | .unsol_event = alc_sku_unsol_event, |
4f5d1706 TI |
13800 | .setup = alc268_dell_setup, |
13801 | .init_hook = alc_inithook, | |
3866f0b0 | 13802 | }, |
f12462c5 | 13803 | [ALC268_ZEPTO] = { |
aef9d318 TI |
13804 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
13805 | alc268_beep_mixer }, | |
f12462c5 MT |
13806 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13807 | alc268_toshiba_verbs }, | |
13808 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13809 | .dac_nids = alc268_dac_nids, | |
13810 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13811 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13812 | .capsrc_nids = alc268_capsrc_nids, |
f12462c5 MT |
13813 | .hp_nid = 0x03, |
13814 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13815 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13816 | .channel_mode = alc268_modes, | |
13817 | .input_mux = &alc268_capture_source, | |
4f5d1706 TI |
13818 | .setup = alc268_toshiba_setup, |
13819 | .init_hook = alc268_toshiba_automute, | |
f12462c5 | 13820 | }, |
86c53bd2 JW |
13821 | #ifdef CONFIG_SND_DEBUG |
13822 | [ALC268_TEST] = { | |
13823 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
13824 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13825 | alc268_volume_init_verbs }, | |
13826 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13827 | .dac_nids = alc268_dac_nids, | |
13828 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13829 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13830 | .capsrc_nids = alc268_capsrc_nids, |
86c53bd2 JW |
13831 | .hp_nid = 0x03, |
13832 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13833 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13834 | .channel_mode = alc268_modes, | |
13835 | .input_mux = &alc268_capture_source, | |
13836 | }, | |
13837 | #endif | |
a361d84b KY |
13838 | }; |
13839 | ||
13840 | static int patch_alc268(struct hda_codec *codec) | |
13841 | { | |
13842 | struct alc_spec *spec; | |
13843 | int board_config; | |
22971e3a | 13844 | int i, has_beep, err; |
a361d84b | 13845 | |
ef86f581 | 13846 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
a361d84b KY |
13847 | if (spec == NULL) |
13848 | return -ENOMEM; | |
13849 | ||
13850 | codec->spec = spec; | |
13851 | ||
13852 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
13853 | alc268_models, | |
13854 | alc268_cfg_tbl); | |
13855 | ||
3abf2f36 TI |
13856 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
13857 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
50ae0aa8 | 13858 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
3abf2f36 | 13859 | |
a361d84b | 13860 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
9a11f1aa TI |
13861 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
13862 | codec->chip_name); | |
a361d84b KY |
13863 | board_config = ALC268_AUTO; |
13864 | } | |
13865 | ||
13866 | if (board_config == ALC268_AUTO) { | |
13867 | /* automatic parse from the BIOS config */ | |
13868 | err = alc268_parse_auto_config(codec); | |
13869 | if (err < 0) { | |
13870 | alc_free(codec); | |
13871 | return err; | |
13872 | } else if (!err) { | |
13873 | printk(KERN_INFO | |
13874 | "hda_codec: Cannot set up configuration " | |
13875 | "from BIOS. Using base mode...\n"); | |
13876 | board_config = ALC268_3ST; | |
13877 | } | |
13878 | } | |
13879 | ||
13880 | if (board_config != ALC268_AUTO) | |
e9c364c0 | 13881 | setup_preset(codec, &alc268_presets[board_config]); |
a361d84b | 13882 | |
a361d84b KY |
13883 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
13884 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
6330079f | 13885 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
a361d84b | 13886 | |
a361d84b KY |
13887 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
13888 | ||
22971e3a TI |
13889 | has_beep = 0; |
13890 | for (i = 0; i < spec->num_mixers; i++) { | |
13891 | if (spec->mixers[i] == alc268_beep_mixer) { | |
13892 | has_beep = 1; | |
13893 | break; | |
13894 | } | |
13895 | } | |
13896 | ||
13897 | if (has_beep) { | |
13898 | err = snd_hda_attach_beep_device(codec, 0x1); | |
13899 | if (err < 0) { | |
13900 | alc_free(codec); | |
13901 | return err; | |
13902 | } | |
13903 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | |
13904 | /* override the amp caps for beep generator */ | |
13905 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
aef9d318 TI |
13906 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
13907 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
13908 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
13909 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
22971e3a | 13910 | } |
aef9d318 | 13911 | |
7e0e44d4 | 13912 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
3866f0b0 TI |
13913 | /* check whether NID 0x07 is valid */ |
13914 | unsigned int wcap = get_wcaps(codec, 0x07); | |
85860c06 | 13915 | int i; |
3866f0b0 | 13916 | |
defb5ab2 | 13917 | spec->capsrc_nids = alc268_capsrc_nids; |
3866f0b0 | 13918 | /* get type */ |
a22d543a | 13919 | wcap = get_wcaps_type(wcap); |
fdbc6626 TI |
13920 | if (spec->auto_mic || |
13921 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
3866f0b0 TI |
13922 | spec->adc_nids = alc268_adc_nids_alt; |
13923 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
defb5ab2 TI |
13924 | if (spec->auto_mic) |
13925 | fixup_automic_adc(codec); | |
fdbc6626 TI |
13926 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
13927 | add_mixer(spec, alc268_capture_nosrc_mixer); | |
13928 | else | |
13929 | add_mixer(spec, alc268_capture_alt_mixer); | |
3866f0b0 TI |
13930 | } else { |
13931 | spec->adc_nids = alc268_adc_nids; | |
13932 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
d88897ea | 13933 | add_mixer(spec, alc268_capture_mixer); |
a361d84b | 13934 | } |
85860c06 TI |
13935 | /* set default input source */ |
13936 | for (i = 0; i < spec->num_adc_nids; i++) | |
13937 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
13938 | 0, AC_VERB_SET_CONNECT_SEL, | |
5908589f HRK |
13939 | i < spec->num_mux_defs ? |
13940 | spec->input_mux[i].items[0].index : | |
85860c06 | 13941 | spec->input_mux->items[0].index); |
a361d84b | 13942 | } |
2134ea4f TI |
13943 | |
13944 | spec->vmaster_nid = 0x02; | |
13945 | ||
a361d84b KY |
13946 | codec->patch_ops = alc_patch_ops; |
13947 | if (board_config == ALC268_AUTO) | |
13948 | spec->init_hook = alc268_auto_init; | |
ea1fb29a | 13949 | |
a361d84b KY |
13950 | return 0; |
13951 | } | |
13952 | ||
f6a92248 KY |
13953 | /* |
13954 | * ALC269 channel source setting (2 channel) | |
13955 | */ | |
13956 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
13957 | ||
13958 | #define alc269_dac_nids alc260_dac_nids | |
13959 | ||
13960 | static hda_nid_t alc269_adc_nids[1] = { | |
13961 | /* ADC1 */ | |
f53281e6 KY |
13962 | 0x08, |
13963 | }; | |
13964 | ||
e01bf509 TI |
13965 | static hda_nid_t alc269_capsrc_nids[1] = { |
13966 | 0x23, | |
13967 | }; | |
13968 | ||
84898e87 KY |
13969 | static hda_nid_t alc269vb_adc_nids[1] = { |
13970 | /* ADC1 */ | |
13971 | 0x09, | |
13972 | }; | |
13973 | ||
13974 | static hda_nid_t alc269vb_capsrc_nids[1] = { | |
13975 | 0x22, | |
13976 | }; | |
13977 | ||
6694635d TI |
13978 | static hda_nid_t alc269_adc_candidates[] = { |
13979 | 0x08, 0x09, 0x07, | |
13980 | }; | |
e01bf509 | 13981 | |
f6a92248 KY |
13982 | #define alc269_modes alc260_modes |
13983 | #define alc269_capture_source alc880_lg_lw_capture_source | |
13984 | ||
13985 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
13986 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13987 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13988 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13989 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13992 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13993 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
13994 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
13995 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13996 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13997 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
13998 | { } /* end */ | |
13999 | }; | |
14000 | ||
60db6b53 KY |
14001 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
14002 | /* output mixer control */ | |
14003 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
14004 | { | |
14005 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14006 | .name = "Master Playback Switch", | |
5e26dfd0 | 14007 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
60db6b53 KY |
14008 | .info = snd_hda_mixer_amp_switch_info, |
14009 | .get = snd_hda_mixer_amp_switch_get, | |
14010 | .put = alc268_acer_master_sw_put, | |
14011 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14012 | }, | |
14013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14015 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14016 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
14017 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
14018 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
60db6b53 KY |
14019 | { } |
14020 | }; | |
14021 | ||
64154835 TV |
14022 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
14023 | /* output mixer control */ | |
14024 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
14025 | { | |
14026 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14027 | .name = "Master Playback Switch", | |
5e26dfd0 | 14028 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
64154835 TV |
14029 | .info = snd_hda_mixer_amp_switch_info, |
14030 | .get = snd_hda_mixer_amp_switch_get, | |
14031 | .put = alc268_acer_master_sw_put, | |
14032 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14033 | }, | |
14034 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14035 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14036 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14037 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
14038 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
14039 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
14040 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
14041 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
14042 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), | |
64154835 TV |
14043 | { } |
14044 | }; | |
14045 | ||
84898e87 | 14046 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
aa202455 | 14047 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
508f7110 | 14048 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
aa202455 | 14049 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
508f7110 | 14050 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
f53281e6 KY |
14051 | { } /* end */ |
14052 | }; | |
14053 | ||
84898e87 KY |
14054 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
14055 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14056 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
14058 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
14059 | { } /* end */ | |
14060 | }; | |
14061 | ||
fe3eb0a7 KY |
14062 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
14063 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14064 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
14065 | { } /* end */ | |
14066 | }; | |
14067 | ||
f53281e6 | 14068 | /* capture mixer elements */ |
84898e87 KY |
14069 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
14070 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
14071 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
14072 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14073 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | |
14074 | { } /* end */ | |
14075 | }; | |
14076 | ||
14077 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { | |
f53281e6 KY |
14078 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
14079 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
26f5df26 TI |
14080 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
14081 | { } /* end */ | |
14082 | }; | |
14083 | ||
84898e87 KY |
14084 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
14085 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
14086 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
14087 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14088 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | |
14089 | { } /* end */ | |
14090 | }; | |
14091 | ||
14092 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { | |
14093 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
14094 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
14095 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14096 | { } /* end */ | |
14097 | }; | |
14098 | ||
26f5df26 | 14099 | /* FSC amilo */ |
84898e87 | 14100 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
f53281e6 | 14101 | |
60db6b53 KY |
14102 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
14103 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14104 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14105 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14106 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14107 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14108 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14109 | { } | |
14110 | }; | |
f6a92248 | 14111 | |
64154835 TV |
14112 | static struct hda_verb alc269_lifebook_verbs[] = { |
14113 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14114 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14115 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14116 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14117 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14118 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14119 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14120 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14121 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14122 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14123 | { } | |
14124 | }; | |
14125 | ||
60db6b53 KY |
14126 | /* toggle speaker-output according to the hp-jack state */ |
14127 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |
14128 | { | |
14129 | unsigned int present; | |
14130 | unsigned char bits; | |
f6a92248 | 14131 | |
864f92be | 14132 | present = snd_hda_jack_detect(codec, 0x15); |
5dbd5ec6 | 14133 | bits = present ? HDA_AMP_MUTE : 0; |
60db6b53 | 14134 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 14135 | HDA_AMP_MUTE, bits); |
60db6b53 | 14136 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 14137 | HDA_AMP_MUTE, bits); |
f6a92248 | 14138 | |
60db6b53 KY |
14139 | snd_hda_codec_write(codec, 0x20, 0, |
14140 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14141 | snd_hda_codec_write(codec, 0x20, 0, | |
14142 | AC_VERB_SET_PROC_COEF, 0x680); | |
f6a92248 | 14143 | |
60db6b53 KY |
14144 | snd_hda_codec_write(codec, 0x20, 0, |
14145 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14146 | snd_hda_codec_write(codec, 0x20, 0, | |
14147 | AC_VERB_SET_PROC_COEF, 0x480); | |
14148 | } | |
f6a92248 | 14149 | |
64154835 TV |
14150 | /* toggle speaker-output according to the hp-jacks state */ |
14151 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |
14152 | { | |
14153 | unsigned int present; | |
14154 | unsigned char bits; | |
14155 | ||
14156 | /* Check laptop headphone socket */ | |
864f92be | 14157 | present = snd_hda_jack_detect(codec, 0x15); |
64154835 TV |
14158 | |
14159 | /* Check port replicator headphone socket */ | |
864f92be | 14160 | present |= snd_hda_jack_detect(codec, 0x1a); |
64154835 | 14161 | |
5dbd5ec6 | 14162 | bits = present ? HDA_AMP_MUTE : 0; |
64154835 | 14163 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 14164 | HDA_AMP_MUTE, bits); |
64154835 | 14165 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 14166 | HDA_AMP_MUTE, bits); |
64154835 TV |
14167 | |
14168 | snd_hda_codec_write(codec, 0x20, 0, | |
14169 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14170 | snd_hda_codec_write(codec, 0x20, 0, | |
14171 | AC_VERB_SET_PROC_COEF, 0x680); | |
14172 | ||
14173 | snd_hda_codec_write(codec, 0x20, 0, | |
14174 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14175 | snd_hda_codec_write(codec, 0x20, 0, | |
14176 | AC_VERB_SET_PROC_COEF, 0x480); | |
14177 | } | |
14178 | ||
64154835 TV |
14179 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
14180 | { | |
14181 | unsigned int present_laptop; | |
14182 | unsigned int present_dock; | |
14183 | ||
864f92be WF |
14184 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
14185 | present_dock = snd_hda_jack_detect(codec, 0x1b); | |
64154835 TV |
14186 | |
14187 | /* Laptop mic port overrides dock mic port, design decision */ | |
14188 | if (present_dock) | |
14189 | snd_hda_codec_write(codec, 0x23, 0, | |
14190 | AC_VERB_SET_CONNECT_SEL, 0x3); | |
14191 | if (present_laptop) | |
14192 | snd_hda_codec_write(codec, 0x23, 0, | |
14193 | AC_VERB_SET_CONNECT_SEL, 0x0); | |
14194 | if (!present_dock && !present_laptop) | |
14195 | snd_hda_codec_write(codec, 0x23, 0, | |
14196 | AC_VERB_SET_CONNECT_SEL, 0x1); | |
14197 | } | |
14198 | ||
60db6b53 KY |
14199 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
14200 | unsigned int res) | |
14201 | { | |
4f5d1706 TI |
14202 | switch (res >> 26) { |
14203 | case ALC880_HP_EVENT: | |
60db6b53 | 14204 | alc269_quanta_fl1_speaker_automute(codec); |
4f5d1706 TI |
14205 | break; |
14206 | case ALC880_MIC_EVENT: | |
14207 | alc_mic_automute(codec); | |
14208 | break; | |
14209 | } | |
60db6b53 | 14210 | } |
f6a92248 | 14211 | |
64154835 TV |
14212 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
14213 | unsigned int res) | |
14214 | { | |
14215 | if ((res >> 26) == ALC880_HP_EVENT) | |
14216 | alc269_lifebook_speaker_automute(codec); | |
14217 | if ((res >> 26) == ALC880_MIC_EVENT) | |
14218 | alc269_lifebook_mic_autoswitch(codec); | |
14219 | } | |
14220 | ||
4f5d1706 TI |
14221 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
14222 | { | |
14223 | struct alc_spec *spec = codec->spec; | |
20645d70 TI |
14224 | spec->autocfg.hp_pins[0] = 0x15; |
14225 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
14226 | spec->ext_mic.pin = 0x18; |
14227 | spec->ext_mic.mux_idx = 0; | |
14228 | spec->int_mic.pin = 0x19; | |
14229 | spec->int_mic.mux_idx = 1; | |
14230 | spec->auto_mic = 1; | |
14231 | } | |
14232 | ||
60db6b53 KY |
14233 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
14234 | { | |
14235 | alc269_quanta_fl1_speaker_automute(codec); | |
4f5d1706 | 14236 | alc_mic_automute(codec); |
60db6b53 | 14237 | } |
f6a92248 | 14238 | |
64154835 TV |
14239 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
14240 | { | |
14241 | alc269_lifebook_speaker_automute(codec); | |
14242 | alc269_lifebook_mic_autoswitch(codec); | |
14243 | } | |
14244 | ||
84898e87 | 14245 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
f53281e6 KY |
14246 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
14247 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | |
14248 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14250 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14251 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14252 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14253 | {} | |
14254 | }; | |
14255 | ||
84898e87 | 14256 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
f53281e6 KY |
14257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
14258 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14259 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14260 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | |
14261 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14262 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14263 | {} | |
14264 | }; | |
14265 | ||
84898e87 KY |
14266 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
14267 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14268 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
14269 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14271 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14272 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14273 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14274 | {} | |
14275 | }; | |
14276 | ||
14277 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { | |
14278 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14279 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14280 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14281 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14282 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14283 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14284 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14285 | {} | |
14286 | }; | |
14287 | ||
fe3eb0a7 KY |
14288 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
14289 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | |
14290 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | |
14291 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14293 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14294 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14295 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14296 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14297 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14298 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, | |
14299 | { } | |
14300 | }; | |
14301 | ||
f53281e6 KY |
14302 | /* toggle speaker-output according to the hp-jack state */ |
14303 | static void alc269_speaker_automute(struct hda_codec *codec) | |
14304 | { | |
ebb83eeb KY |
14305 | struct alc_spec *spec = codec->spec; |
14306 | unsigned int nid = spec->autocfg.hp_pins[0]; | |
f53281e6 | 14307 | unsigned int present; |
60db6b53 | 14308 | unsigned char bits; |
f53281e6 | 14309 | |
ebb83eeb | 14310 | present = snd_hda_jack_detect(codec, nid); |
5dbd5ec6 | 14311 | bits = present ? HDA_AMP_MUTE : 0; |
f53281e6 | 14312 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 14313 | HDA_AMP_MUTE, bits); |
f53281e6 | 14314 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 14315 | HDA_AMP_MUTE, bits); |
f53281e6 KY |
14316 | } |
14317 | ||
f53281e6 | 14318 | /* unsolicited event for HP jack sensing */ |
84898e87 | 14319 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
60db6b53 | 14320 | unsigned int res) |
f53281e6 | 14321 | { |
4f5d1706 TI |
14322 | switch (res >> 26) { |
14323 | case ALC880_HP_EVENT: | |
f53281e6 | 14324 | alc269_speaker_automute(codec); |
4f5d1706 TI |
14325 | break; |
14326 | case ALC880_MIC_EVENT: | |
14327 | alc_mic_automute(codec); | |
14328 | break; | |
14329 | } | |
f53281e6 KY |
14330 | } |
14331 | ||
226b1ec8 | 14332 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
f53281e6 | 14333 | { |
4f5d1706 | 14334 | struct alc_spec *spec = codec->spec; |
20645d70 TI |
14335 | spec->autocfg.hp_pins[0] = 0x15; |
14336 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
14337 | spec->ext_mic.pin = 0x18; |
14338 | spec->ext_mic.mux_idx = 0; | |
226b1ec8 KY |
14339 | spec->int_mic.pin = 0x19; |
14340 | spec->int_mic.mux_idx = 1; | |
4f5d1706 | 14341 | spec->auto_mic = 1; |
f53281e6 KY |
14342 | } |
14343 | ||
226b1ec8 | 14344 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
84898e87 KY |
14345 | { |
14346 | struct alc_spec *spec = codec->spec; | |
20645d70 TI |
14347 | spec->autocfg.hp_pins[0] = 0x15; |
14348 | spec->autocfg.speaker_pins[0] = 0x14; | |
84898e87 KY |
14349 | spec->ext_mic.pin = 0x18; |
14350 | spec->ext_mic.mux_idx = 0; | |
14351 | spec->int_mic.pin = 0x12; | |
226b1ec8 | 14352 | spec->int_mic.mux_idx = 5; |
84898e87 KY |
14353 | spec->auto_mic = 1; |
14354 | } | |
14355 | ||
226b1ec8 | 14356 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
f53281e6 | 14357 | { |
4f5d1706 | 14358 | struct alc_spec *spec = codec->spec; |
226b1ec8 | 14359 | spec->autocfg.hp_pins[0] = 0x21; |
20645d70 | 14360 | spec->autocfg.speaker_pins[0] = 0x14; |
4f5d1706 TI |
14361 | spec->ext_mic.pin = 0x18; |
14362 | spec->ext_mic.mux_idx = 0; | |
14363 | spec->int_mic.pin = 0x19; | |
14364 | spec->int_mic.mux_idx = 1; | |
14365 | spec->auto_mic = 1; | |
f53281e6 KY |
14366 | } |
14367 | ||
226b1ec8 KY |
14368 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
14369 | { | |
14370 | struct alc_spec *spec = codec->spec; | |
14371 | spec->autocfg.hp_pins[0] = 0x21; | |
14372 | spec->autocfg.speaker_pins[0] = 0x14; | |
14373 | spec->ext_mic.pin = 0x18; | |
14374 | spec->ext_mic.mux_idx = 0; | |
14375 | spec->int_mic.pin = 0x12; | |
14376 | spec->int_mic.mux_idx = 6; | |
14377 | spec->auto_mic = 1; | |
14378 | } | |
14379 | ||
84898e87 | 14380 | static void alc269_laptop_inithook(struct hda_codec *codec) |
f53281e6 KY |
14381 | { |
14382 | alc269_speaker_automute(codec); | |
4f5d1706 | 14383 | alc_mic_automute(codec); |
f53281e6 KY |
14384 | } |
14385 | ||
60db6b53 KY |
14386 | /* |
14387 | * generic initialization of ADC, input mixers and output mixers | |
14388 | */ | |
14389 | static struct hda_verb alc269_init_verbs[] = { | |
14390 | /* | |
14391 | * Unmute ADC0 and set the default input to mic-in | |
14392 | */ | |
84898e87 | 14393 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
60db6b53 KY |
14394 | |
14395 | /* | |
84898e87 | 14396 | * Set up output mixers (0x02 - 0x03) |
60db6b53 KY |
14397 | */ |
14398 | /* set vol=0 to output mixers */ | |
14399 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14400 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14401 | ||
14402 | /* set up input amps for analog loopback */ | |
14403 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14404 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14405 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14406 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14407 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14408 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14409 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14410 | ||
14411 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14412 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14413 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14414 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14415 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14416 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14417 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14418 | ||
14419 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
60db6b53 | 14421 | |
84898e87 KY |
14422 | /* FIXME: use Mux-type input source selection */ |
14423 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
14424 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
14425 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
60db6b53 | 14426 | |
84898e87 KY |
14427 | /* set EAPD */ |
14428 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14429 | { } | |
14430 | }; | |
14431 | ||
14432 | static struct hda_verb alc269vb_init_verbs[] = { | |
14433 | /* | |
14434 | * Unmute ADC0 and set the default input to mic-in | |
14435 | */ | |
14436 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14437 | ||
14438 | /* | |
14439 | * Set up output mixers (0x02 - 0x03) | |
14440 | */ | |
14441 | /* set vol=0 to output mixers */ | |
14442 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14443 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14444 | ||
14445 | /* set up input amps for analog loopback */ | |
14446 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14447 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14448 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14449 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14450 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14451 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14452 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14453 | ||
14454 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14455 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14456 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14457 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14458 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14459 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14460 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14461 | ||
14462 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14463 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14464 | ||
14465 | /* FIXME: use Mux-type input source selection */ | |
60db6b53 KY |
14466 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
14467 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
84898e87 | 14468 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
60db6b53 KY |
14469 | |
14470 | /* set EAPD */ | |
14471 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
60db6b53 KY |
14472 | { } |
14473 | }; | |
14474 | ||
9d0b71b1 TI |
14475 | #define alc269_auto_create_multi_out_ctls \ |
14476 | alc268_auto_create_multi_out_ctls | |
05f5f477 TI |
14477 | #define alc269_auto_create_input_ctls \ |
14478 | alc268_auto_create_input_ctls | |
f6a92248 KY |
14479 | |
14480 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14481 | #define alc269_loopbacks alc880_loopbacks | |
14482 | #endif | |
14483 | ||
def319f9 | 14484 | /* pcm configuration: identical with ALC880 */ |
f6a92248 KY |
14485 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
14486 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
14487 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
14488 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
14489 | ||
f03d3115 TI |
14490 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
14491 | .substreams = 1, | |
14492 | .channels_min = 2, | |
14493 | .channels_max = 8, | |
14494 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14495 | /* NID is set in alc_build_pcms */ | |
14496 | .ops = { | |
14497 | .open = alc880_playback_pcm_open, | |
14498 | .prepare = alc880_playback_pcm_prepare, | |
14499 | .cleanup = alc880_playback_pcm_cleanup | |
14500 | }, | |
14501 | }; | |
14502 | ||
14503 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { | |
14504 | .substreams = 1, | |
14505 | .channels_min = 2, | |
14506 | .channels_max = 2, | |
14507 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14508 | /* NID is set in alc_build_pcms */ | |
14509 | }; | |
14510 | ||
ad35879a TI |
14511 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14512 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) | |
14513 | { | |
14514 | switch (codec->subsystem_id) { | |
14515 | case 0x103c1586: | |
14516 | return 1; | |
14517 | } | |
14518 | return 0; | |
14519 | } | |
14520 | ||
14521 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) | |
14522 | { | |
14523 | /* update mute-LED according to the speaker mute state */ | |
14524 | if (nid == 0x01 || nid == 0x14) { | |
14525 | int pinval; | |
14526 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & | |
14527 | HDA_AMP_MUTE) | |
14528 | pinval = 0x24; | |
14529 | else | |
14530 | pinval = 0x20; | |
14531 | /* mic2 vref pin is used for mute LED control */ | |
a68d5a54 TI |
14532 | snd_hda_codec_update_cache(codec, 0x19, 0, |
14533 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14534 | pinval); | |
ad35879a TI |
14535 | } |
14536 | return alc_check_power_status(codec, nid); | |
14537 | } | |
14538 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | |
14539 | ||
840b64c0 TI |
14540 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
14541 | { | |
14542 | struct alc_spec *spec = codec->spec; | |
14543 | ||
14544 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) | |
14545 | return 0; | |
14546 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || | |
14547 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { | |
14548 | if (spec->ext_mic.pin <= 0x12) { | |
14549 | spec->private_adc_nids[0] = 0x08; | |
14550 | spec->private_adc_nids[1] = 0x11; | |
14551 | spec->private_capsrc_nids[0] = 0x23; | |
14552 | spec->private_capsrc_nids[1] = 0x22; | |
14553 | } else { | |
14554 | spec->private_adc_nids[0] = 0x11; | |
14555 | spec->private_adc_nids[1] = 0x08; | |
14556 | spec->private_capsrc_nids[0] = 0x22; | |
14557 | spec->private_capsrc_nids[1] = 0x23; | |
14558 | } | |
14559 | spec->adc_nids = spec->private_adc_nids; | |
14560 | spec->capsrc_nids = spec->private_capsrc_nids; | |
14561 | spec->num_adc_nids = 2; | |
14562 | spec->dual_adc_switch = 1; | |
14563 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", | |
14564 | spec->adc_nids[0], spec->adc_nids[1]); | |
14565 | return 1; | |
14566 | } | |
14567 | return 0; | |
14568 | } | |
14569 | ||
d433a678 TI |
14570 | /* different alc269-variants */ |
14571 | enum { | |
14572 | ALC269_TYPE_NORMAL, | |
14573 | ALC269_TYPE_ALC259, | |
14574 | ALC269_TYPE_ALC271X, | |
14575 | }; | |
14576 | ||
f6a92248 KY |
14577 | /* |
14578 | * BIOS auto configuration | |
14579 | */ | |
14580 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
14581 | { | |
14582 | struct alc_spec *spec = codec->spec; | |
cfb9fb55 | 14583 | int err; |
f6a92248 KY |
14584 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
14585 | ||
14586 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
14587 | alc269_ignore); | |
14588 | if (err < 0) | |
14589 | return err; | |
14590 | ||
14591 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
14592 | if (err < 0) | |
14593 | return err; | |
f3550d1b TI |
14594 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
14595 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); | |
14596 | else | |
14597 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, | |
14598 | 0x22, 0); | |
f6a92248 KY |
14599 | if (err < 0) |
14600 | return err; | |
14601 | ||
14602 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14603 | ||
757899ac | 14604 | alc_auto_parse_digital(codec); |
f6a92248 | 14605 | |
603c4019 | 14606 | if (spec->kctls.list) |
d88897ea | 14607 | add_mixer(spec, spec->kctls.list); |
f6a92248 | 14608 | |
d433a678 | 14609 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
84898e87 | 14610 | add_verb(spec, alc269vb_init_verbs); |
6227cdce | 14611 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
84898e87 KY |
14612 | } else { |
14613 | add_verb(spec, alc269_init_verbs); | |
6227cdce | 14614 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
84898e87 KY |
14615 | } |
14616 | ||
f6a92248 | 14617 | spec->num_mux_defs = 1; |
61b9b9b1 | 14618 | spec->input_mux = &spec->private_imux[0]; |
840b64c0 TI |
14619 | |
14620 | if (!alc275_setup_dual_adc(codec)) | |
14621 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | |
14622 | sizeof(alc269_adc_candidates)); | |
6694635d | 14623 | |
e01bf509 | 14624 | /* set default input source */ |
840b64c0 | 14625 | if (!spec->dual_adc_switch) |
748cce43 TI |
14626 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
14627 | spec->input_mux->items[0].index); | |
f6a92248 KY |
14628 | |
14629 | err = alc_auto_add_mic_boost(codec); | |
14630 | if (err < 0) | |
14631 | return err; | |
14632 | ||
7e0e44d4 | 14633 | if (!spec->cap_mixer && !spec->no_analog) |
b59bdf3b | 14634 | set_capture_mixer(codec); |
f53281e6 | 14635 | |
f6a92248 KY |
14636 | return 1; |
14637 | } | |
14638 | ||
e9af4f36 TI |
14639 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
14640 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out | |
f6a92248 KY |
14641 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
14642 | ||
14643 | ||
14644 | /* init callback for auto-configuration model -- overriding the default init */ | |
14645 | static void alc269_auto_init(struct hda_codec *codec) | |
14646 | { | |
f6c7e546 | 14647 | struct alc_spec *spec = codec->spec; |
f6a92248 KY |
14648 | alc269_auto_init_multi_out(codec); |
14649 | alc269_auto_init_hp_out(codec); | |
14650 | alc269_auto_init_analog_input(codec); | |
757899ac | 14651 | alc_auto_init_digital(codec); |
9ad0e496 | 14652 | alc_init_jacks(codec); |
f6c7e546 | 14653 | if (spec->unsol_event) |
7fb0d78f | 14654 | alc_inithook(codec); |
f6a92248 KY |
14655 | } |
14656 | ||
0ec33d1f TI |
14657 | #ifdef SND_HDA_NEEDS_RESUME |
14658 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) | |
14659 | { | |
14660 | int val = alc_read_coef_idx(codec, 0x04); | |
14661 | if (power_up) | |
14662 | val |= 1 << 11; | |
14663 | else | |
14664 | val &= ~(1 << 11); | |
14665 | alc_write_coef_idx(codec, 0x04, val); | |
14666 | } | |
14667 | ||
977ddd6b KY |
14668 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14669 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) | |
14670 | { | |
14671 | struct alc_spec *spec = codec->spec; | |
977ddd6b | 14672 | |
0ec33d1f TI |
14673 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
14674 | alc269_toggle_power_output(codec, 0); | |
977ddd6b | 14675 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
0ec33d1f | 14676 | alc269_toggle_power_output(codec, 0); |
977ddd6b KY |
14677 | msleep(150); |
14678 | } | |
14679 | ||
14680 | alc_shutup(codec); | |
14681 | if (spec && spec->power_hook) | |
14682 | spec->power_hook(codec); | |
14683 | return 0; | |
14684 | } | |
0ec33d1f TI |
14685 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
14686 | ||
977ddd6b KY |
14687 | static int alc269_resume(struct hda_codec *codec) |
14688 | { | |
977ddd6b | 14689 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
0ec33d1f | 14690 | alc269_toggle_power_output(codec, 0); |
977ddd6b KY |
14691 | msleep(150); |
14692 | } | |
14693 | ||
14694 | codec->patch_ops.init(codec); | |
14695 | ||
14696 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { | |
0ec33d1f | 14697 | alc269_toggle_power_output(codec, 1); |
977ddd6b KY |
14698 | msleep(200); |
14699 | } | |
14700 | ||
0ec33d1f TI |
14701 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
14702 | alc269_toggle_power_output(codec, 1); | |
977ddd6b KY |
14703 | |
14704 | snd_hda_codec_resume_amp(codec); | |
14705 | snd_hda_codec_resume_cache(codec); | |
9e5341b9 | 14706 | hda_call_check_power_status(codec, 0x01); |
977ddd6b KY |
14707 | return 0; |
14708 | } | |
0ec33d1f | 14709 | #endif /* SND_HDA_NEEDS_RESUME */ |
977ddd6b | 14710 | |
ff818c24 TI |
14711 | enum { |
14712 | ALC269_FIXUP_SONY_VAIO, | |
145a902b | 14713 | ALC269_FIXUP_DELL_M101Z, |
ff818c24 TI |
14714 | }; |
14715 | ||
ff818c24 TI |
14716 | static const struct alc_fixup alc269_fixups[] = { |
14717 | [ALC269_FIXUP_SONY_VAIO] = { | |
73413b12 TI |
14718 | .verbs = (const struct hda_verb[]) { |
14719 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, | |
14720 | {} | |
14721 | } | |
ff818c24 | 14722 | }, |
145a902b DH |
14723 | [ALC269_FIXUP_DELL_M101Z] = { |
14724 | .verbs = (const struct hda_verb[]) { | |
14725 | /* Enables internal speaker */ | |
14726 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, | |
14727 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, | |
14728 | {} | |
14729 | } | |
14730 | }, | |
ff818c24 TI |
14731 | }; |
14732 | ||
14733 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | |
14734 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | |
dbbcbc07 | 14735 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
145a902b | 14736 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
ff818c24 TI |
14737 | {} |
14738 | }; | |
14739 | ||
14740 | ||
f6a92248 KY |
14741 | /* |
14742 | * configuration and preset | |
14743 | */ | |
14744 | static const char *alc269_models[ALC269_MODEL_LAST] = { | |
60db6b53 | 14745 | [ALC269_BASIC] = "basic", |
2922c9af | 14746 | [ALC269_QUANTA_FL1] = "quanta", |
84898e87 KY |
14747 | [ALC269_AMIC] = "laptop-amic", |
14748 | [ALC269_DMIC] = "laptop-dmic", | |
64154835 | 14749 | [ALC269_FUJITSU] = "fujitsu", |
3d3792cb TI |
14750 | [ALC269_LIFEBOOK] = "lifebook", |
14751 | [ALC269_AUTO] = "auto", | |
f6a92248 KY |
14752 | }; |
14753 | ||
14754 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
60db6b53 | 14755 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
fe3eb0a7 | 14756 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
f53281e6 | 14757 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
84898e87 KY |
14758 | ALC269_AMIC), |
14759 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), | |
14760 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), | |
14761 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), | |
14762 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), | |
14763 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), | |
14764 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), | |
14765 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), | |
14766 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), | |
14767 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), | |
14768 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), | |
14769 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), | |
14770 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), | |
14771 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), | |
14772 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), | |
14773 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), | |
14774 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), | |
14775 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), | |
14776 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), | |
14777 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), | |
14778 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), | |
14779 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), | |
14780 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), | |
14781 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), | |
14782 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), | |
14783 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), | |
14784 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), | |
14785 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), | |
14786 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), | |
14787 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), | |
14788 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), | |
14789 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), | |
14790 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), | |
14791 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), | |
14792 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), | |
14793 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), | |
14794 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), | |
f53281e6 | 14795 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
84898e87 | 14796 | ALC269_DMIC), |
60db6b53 | 14797 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
84898e87 KY |
14798 | ALC269_DMIC), |
14799 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), | |
14800 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), | |
ff818c24 | 14801 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
64154835 | 14802 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
61c2d2b5 KY |
14803 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
14804 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | |
14805 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), | |
14806 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), | |
14807 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), | |
14808 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), | |
f6a92248 KY |
14809 | {} |
14810 | }; | |
14811 | ||
14812 | static struct alc_config_preset alc269_presets[] = { | |
14813 | [ALC269_BASIC] = { | |
f9e336f6 | 14814 | .mixers = { alc269_base_mixer }, |
f6a92248 KY |
14815 | .init_verbs = { alc269_init_verbs }, |
14816 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14817 | .dac_nids = alc269_dac_nids, | |
14818 | .hp_nid = 0x03, | |
14819 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14820 | .channel_mode = alc269_modes, | |
14821 | .input_mux = &alc269_capture_source, | |
14822 | }, | |
60db6b53 KY |
14823 | [ALC269_QUANTA_FL1] = { |
14824 | .mixers = { alc269_quanta_fl1_mixer }, | |
14825 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | |
14826 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14827 | .dac_nids = alc269_dac_nids, | |
14828 | .hp_nid = 0x03, | |
14829 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14830 | .channel_mode = alc269_modes, | |
14831 | .input_mux = &alc269_capture_source, | |
14832 | .unsol_event = alc269_quanta_fl1_unsol_event, | |
4f5d1706 | 14833 | .setup = alc269_quanta_fl1_setup, |
60db6b53 KY |
14834 | .init_hook = alc269_quanta_fl1_init_hook, |
14835 | }, | |
84898e87 KY |
14836 | [ALC269_AMIC] = { |
14837 | .mixers = { alc269_laptop_mixer }, | |
14838 | .cap_mixer = alc269_laptop_analog_capture_mixer, | |
f53281e6 | 14839 | .init_verbs = { alc269_init_verbs, |
84898e87 | 14840 | alc269_laptop_amic_init_verbs }, |
f53281e6 KY |
14841 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14842 | .dac_nids = alc269_dac_nids, | |
14843 | .hp_nid = 0x03, | |
14844 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14845 | .channel_mode = alc269_modes, | |
84898e87 KY |
14846 | .unsol_event = alc269_laptop_unsol_event, |
14847 | .setup = alc269_laptop_amic_setup, | |
14848 | .init_hook = alc269_laptop_inithook, | |
f53281e6 | 14849 | }, |
84898e87 KY |
14850 | [ALC269_DMIC] = { |
14851 | .mixers = { alc269_laptop_mixer }, | |
14852 | .cap_mixer = alc269_laptop_digital_capture_mixer, | |
f53281e6 | 14853 | .init_verbs = { alc269_init_verbs, |
84898e87 KY |
14854 | alc269_laptop_dmic_init_verbs }, |
14855 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14856 | .dac_nids = alc269_dac_nids, | |
14857 | .hp_nid = 0x03, | |
14858 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14859 | .channel_mode = alc269_modes, | |
14860 | .unsol_event = alc269_laptop_unsol_event, | |
14861 | .setup = alc269_laptop_dmic_setup, | |
14862 | .init_hook = alc269_laptop_inithook, | |
14863 | }, | |
14864 | [ALC269VB_AMIC] = { | |
14865 | .mixers = { alc269vb_laptop_mixer }, | |
14866 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, | |
14867 | .init_verbs = { alc269vb_init_verbs, | |
14868 | alc269vb_laptop_amic_init_verbs }, | |
f53281e6 KY |
14869 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14870 | .dac_nids = alc269_dac_nids, | |
14871 | .hp_nid = 0x03, | |
14872 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14873 | .channel_mode = alc269_modes, | |
84898e87 | 14874 | .unsol_event = alc269_laptop_unsol_event, |
226b1ec8 | 14875 | .setup = alc269vb_laptop_amic_setup, |
84898e87 KY |
14876 | .init_hook = alc269_laptop_inithook, |
14877 | }, | |
14878 | [ALC269VB_DMIC] = { | |
14879 | .mixers = { alc269vb_laptop_mixer }, | |
14880 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
14881 | .init_verbs = { alc269vb_init_verbs, | |
14882 | alc269vb_laptop_dmic_init_verbs }, | |
14883 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14884 | .dac_nids = alc269_dac_nids, | |
14885 | .hp_nid = 0x03, | |
14886 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14887 | .channel_mode = alc269_modes, | |
14888 | .unsol_event = alc269_laptop_unsol_event, | |
14889 | .setup = alc269vb_laptop_dmic_setup, | |
14890 | .init_hook = alc269_laptop_inithook, | |
f53281e6 | 14891 | }, |
26f5df26 | 14892 | [ALC269_FUJITSU] = { |
45bdd1c1 | 14893 | .mixers = { alc269_fujitsu_mixer }, |
84898e87 | 14894 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
26f5df26 | 14895 | .init_verbs = { alc269_init_verbs, |
84898e87 | 14896 | alc269_laptop_dmic_init_verbs }, |
26f5df26 TI |
14897 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14898 | .dac_nids = alc269_dac_nids, | |
14899 | .hp_nid = 0x03, | |
14900 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14901 | .channel_mode = alc269_modes, | |
84898e87 KY |
14902 | .unsol_event = alc269_laptop_unsol_event, |
14903 | .setup = alc269_laptop_dmic_setup, | |
14904 | .init_hook = alc269_laptop_inithook, | |
26f5df26 | 14905 | }, |
64154835 TV |
14906 | [ALC269_LIFEBOOK] = { |
14907 | .mixers = { alc269_lifebook_mixer }, | |
14908 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | |
14909 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14910 | .dac_nids = alc269_dac_nids, | |
14911 | .hp_nid = 0x03, | |
14912 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14913 | .channel_mode = alc269_modes, | |
14914 | .input_mux = &alc269_capture_source, | |
14915 | .unsol_event = alc269_lifebook_unsol_event, | |
14916 | .init_hook = alc269_lifebook_init_hook, | |
14917 | }, | |
fe3eb0a7 KY |
14918 | [ALC271_ACER] = { |
14919 | .mixers = { alc269_asus_mixer }, | |
14920 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
14921 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, | |
14922 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14923 | .dac_nids = alc269_dac_nids, | |
14924 | .adc_nids = alc262_dmic_adc_nids, | |
14925 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), | |
14926 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
14927 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14928 | .channel_mode = alc269_modes, | |
14929 | .input_mux = &alc269_capture_source, | |
14930 | .dig_out_nid = ALC880_DIGOUT_NID, | |
14931 | .unsol_event = alc_sku_unsol_event, | |
14932 | .setup = alc269vb_laptop_dmic_setup, | |
14933 | .init_hook = alc_inithook, | |
14934 | }, | |
f6a92248 KY |
14935 | }; |
14936 | ||
977ddd6b KY |
14937 | static int alc269_fill_coef(struct hda_codec *codec) |
14938 | { | |
14939 | int val; | |
14940 | ||
14941 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { | |
14942 | alc_write_coef_idx(codec, 0xf, 0x960b); | |
14943 | alc_write_coef_idx(codec, 0xe, 0x8817); | |
14944 | } | |
14945 | ||
14946 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { | |
14947 | alc_write_coef_idx(codec, 0xf, 0x960b); | |
14948 | alc_write_coef_idx(codec, 0xe, 0x8814); | |
14949 | } | |
14950 | ||
14951 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { | |
14952 | val = alc_read_coef_idx(codec, 0x04); | |
14953 | /* Power up output pin */ | |
14954 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | |
14955 | } | |
14956 | ||
14957 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { | |
14958 | val = alc_read_coef_idx(codec, 0xd); | |
14959 | if ((val & 0x0c00) >> 10 != 0x1) { | |
14960 | /* Capless ramp up clock control */ | |
14961 | alc_write_coef_idx(codec, 0xd, val | 1<<10); | |
14962 | } | |
14963 | val = alc_read_coef_idx(codec, 0x17); | |
14964 | if ((val & 0x01c0) >> 6 != 0x4) { | |
14965 | /* Class D power on reset */ | |
14966 | alc_write_coef_idx(codec, 0x17, val | 1<<7); | |
14967 | } | |
14968 | } | |
14969 | return 0; | |
14970 | } | |
14971 | ||
f6a92248 KY |
14972 | static int patch_alc269(struct hda_codec *codec) |
14973 | { | |
14974 | struct alc_spec *spec; | |
14975 | int board_config; | |
14976 | int err; | |
14977 | ||
14978 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
14979 | if (spec == NULL) | |
14980 | return -ENOMEM; | |
14981 | ||
14982 | codec->spec = spec; | |
14983 | ||
da00c244 KY |
14984 | alc_auto_parse_customize_define(codec); |
14985 | ||
274693f3 | 14986 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
c027ddcd | 14987 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
d433a678 | 14988 | spec->cdefine.platform_type == 1) { |
c027ddcd | 14989 | alc_codec_rename(codec, "ALC271X"); |
d433a678 TI |
14990 | spec->codec_variant = ALC269_TYPE_ALC271X; |
14991 | } else { | |
c027ddcd | 14992 | alc_codec_rename(codec, "ALC259"); |
d433a678 TI |
14993 | spec->codec_variant = ALC269_TYPE_ALC259; |
14994 | } | |
c027ddcd KY |
14995 | } else |
14996 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
274693f3 | 14997 | |
977ddd6b KY |
14998 | alc269_fill_coef(codec); |
14999 | ||
f6a92248 KY |
15000 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
15001 | alc269_models, | |
15002 | alc269_cfg_tbl); | |
15003 | ||
15004 | if (board_config < 0) { | |
9a11f1aa TI |
15005 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
15006 | codec->chip_name); | |
f6a92248 KY |
15007 | board_config = ALC269_AUTO; |
15008 | } | |
15009 | ||
ff818c24 TI |
15010 | if (board_config == ALC269_AUTO) |
15011 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); | |
15012 | ||
f6a92248 KY |
15013 | if (board_config == ALC269_AUTO) { |
15014 | /* automatic parse from the BIOS config */ | |
15015 | err = alc269_parse_auto_config(codec); | |
15016 | if (err < 0) { | |
15017 | alc_free(codec); | |
15018 | return err; | |
15019 | } else if (!err) { | |
15020 | printk(KERN_INFO | |
15021 | "hda_codec: Cannot set up configuration " | |
15022 | "from BIOS. Using base mode...\n"); | |
15023 | board_config = ALC269_BASIC; | |
15024 | } | |
15025 | } | |
15026 | ||
dc1eae25 | 15027 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
15028 | err = snd_hda_attach_beep_device(codec, 0x1); |
15029 | if (err < 0) { | |
15030 | alc_free(codec); | |
15031 | return err; | |
15032 | } | |
680cd536 KK |
15033 | } |
15034 | ||
f6a92248 | 15035 | if (board_config != ALC269_AUTO) |
e9c364c0 | 15036 | setup_preset(codec, &alc269_presets[board_config]); |
f6a92248 | 15037 | |
84898e87 | 15038 | if (board_config == ALC269_QUANTA_FL1) { |
f03d3115 TI |
15039 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
15040 | * fix the sample rate of analog I/O to 44.1kHz | |
15041 | */ | |
15042 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; | |
15043 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; | |
840b64c0 TI |
15044 | } else if (spec->dual_adc_switch) { |
15045 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
15046 | /* switch ADC dynamically */ | |
15047 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; | |
f03d3115 TI |
15048 | } else { |
15049 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
15050 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
15051 | } | |
f6a92248 KY |
15052 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
15053 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
15054 | ||
6694635d | 15055 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
d433a678 | 15056 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
6694635d TI |
15057 | spec->adc_nids = alc269_adc_nids; |
15058 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
15059 | spec->capsrc_nids = alc269_capsrc_nids; | |
15060 | } else { | |
15061 | spec->adc_nids = alc269vb_adc_nids; | |
15062 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); | |
15063 | spec->capsrc_nids = alc269vb_capsrc_nids; | |
15064 | } | |
84898e87 KY |
15065 | } |
15066 | ||
f9e336f6 | 15067 | if (!spec->cap_mixer) |
b59bdf3b | 15068 | set_capture_mixer(codec); |
dc1eae25 | 15069 | if (has_cdefine_beep(codec)) |
da00c244 | 15070 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
f6a92248 | 15071 | |
ff818c24 TI |
15072 | if (board_config == ALC269_AUTO) |
15073 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); | |
15074 | ||
100d5eb3 TI |
15075 | spec->vmaster_nid = 0x02; |
15076 | ||
f6a92248 | 15077 | codec->patch_ops = alc_patch_ops; |
977ddd6b KY |
15078 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15079 | codec->patch_ops.suspend = alc269_suspend; | |
15080 | #endif | |
15081 | #ifdef SND_HDA_NEEDS_RESUME | |
15082 | codec->patch_ops.resume = alc269_resume; | |
15083 | #endif | |
f6a92248 KY |
15084 | if (board_config == ALC269_AUTO) |
15085 | spec->init_hook = alc269_auto_init; | |
15086 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
15087 | if (!spec->loopback.amplist) | |
15088 | spec->loopback.amplist = alc269_loopbacks; | |
ad35879a TI |
15089 | if (alc269_mic2_for_mute_led(codec)) |
15090 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; | |
f6a92248 KY |
15091 | #endif |
15092 | ||
15093 | return 0; | |
15094 | } | |
15095 | ||
df694daa KY |
15096 | /* |
15097 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
15098 | */ | |
15099 | ||
15100 | /* | |
15101 | * set the path ways for 2 channel output | |
15102 | * need to set the codec line out and mic 1 pin widgets to inputs | |
15103 | */ | |
15104 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
15105 | /* set pin widget 1Ah (line in) for input */ | |
15106 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
15107 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
15108 | * the vref | |
15109 | */ | |
df694daa KY |
15110 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
15111 | ||
9c7f852e TI |
15112 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
15113 | #if 0 | |
15114 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15115 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
15116 | #endif | |
df694daa KY |
15117 | { } /* end */ |
15118 | }; | |
15119 | /* | |
15120 | * 6ch mode | |
15121 | * need to set the codec line out and mic 1 pin widgets to outputs | |
15122 | */ | |
15123 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
15124 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
15125 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15126 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
15127 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15128 | ||
15129 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
9c7f852e | 15130 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa | 15131 | |
9c7f852e TI |
15132 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
15133 | #if 0 | |
15134 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15135 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
15136 | #endif | |
df694daa KY |
15137 | { } /* end */ |
15138 | }; | |
15139 | ||
15140 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
15141 | { 2, alc861_threestack_ch2_init }, | |
15142 | { 6, alc861_threestack_ch6_init }, | |
15143 | }; | |
22309c3e TI |
15144 | /* Set mic1 as input and unmute the mixer */ |
15145 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
15146 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15147 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15148 | { } /* end */ | |
15149 | }; | |
15150 | /* Set mic1 as output and mute mixer */ | |
15151 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
15152 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15153 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15154 | { } /* end */ | |
15155 | }; | |
15156 | ||
15157 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
15158 | { 2, alc861_uniwill_m31_ch2_init }, | |
15159 | { 4, alc861_uniwill_m31_ch4_init }, | |
15160 | }; | |
df694daa | 15161 | |
7cdbff94 MD |
15162 | /* Set mic1 and line-in as input and unmute the mixer */ |
15163 | static struct hda_verb alc861_asus_ch2_init[] = { | |
15164 | /* set pin widget 1Ah (line in) for input */ | |
15165 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
15166 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
15167 | * the vref | |
15168 | */ | |
7cdbff94 MD |
15169 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
15170 | ||
15171 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
15172 | #if 0 | |
15173 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15174 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
15175 | #endif | |
15176 | { } /* end */ | |
15177 | }; | |
15178 | /* Set mic1 nad line-in as output and mute mixer */ | |
15179 | static struct hda_verb alc861_asus_ch6_init[] = { | |
15180 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
15181 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15182 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
15183 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
15184 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15185 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
15186 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15187 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15188 | ||
15189 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
15190 | #if 0 | |
15191 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15192 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
15193 | #endif | |
15194 | { } /* end */ | |
15195 | }; | |
15196 | ||
15197 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
15198 | { 2, alc861_asus_ch2_init }, | |
15199 | { 6, alc861_asus_ch6_init }, | |
15200 | }; | |
15201 | ||
df694daa KY |
15202 | /* patch-ALC861 */ |
15203 | ||
15204 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
15205 | /* output mixer control */ | |
15206 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15207 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15208 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15209 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15210 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
15211 | ||
15212 | /*Input mixer control */ | |
15213 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15214 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15215 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15216 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15217 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15218 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15221 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15222 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 15223 | |
df694daa KY |
15224 | { } /* end */ |
15225 | }; | |
15226 | ||
15227 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
15228 | /* output mixer control */ | |
15229 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15230 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15231 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15232 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15233 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
15234 | ||
15235 | /* Input mixer control */ | |
15236 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15237 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15239 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15240 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15241 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15242 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15243 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15244 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15245 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 15246 | |
df694daa KY |
15247 | { |
15248 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15249 | .name = "Channel Mode", | |
15250 | .info = alc_ch_mode_info, | |
15251 | .get = alc_ch_mode_get, | |
15252 | .put = alc_ch_mode_put, | |
15253 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
15254 | }, | |
15255 | { } /* end */ | |
a53d1aec TD |
15256 | }; |
15257 | ||
d1d985f0 | 15258 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
a53d1aec TD |
15259 | /* output mixer control */ |
15260 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15261 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15262 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
ea1fb29a | 15263 | |
a53d1aec | 15264 | { } /* end */ |
f12ab1e0 | 15265 | }; |
a53d1aec | 15266 | |
22309c3e TI |
15267 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
15268 | /* output mixer control */ | |
15269 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15270 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15271 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15272 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15273 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
15274 | ||
15275 | /* Input mixer control */ | |
15276 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15277 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15278 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15279 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15280 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15281 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15282 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15283 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15284 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15285 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 15286 | |
22309c3e TI |
15287 | { |
15288 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15289 | .name = "Channel Mode", | |
15290 | .info = alc_ch_mode_info, | |
15291 | .get = alc_ch_mode_get, | |
15292 | .put = alc_ch_mode_put, | |
15293 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
15294 | }, | |
15295 | { } /* end */ | |
f12ab1e0 | 15296 | }; |
7cdbff94 MD |
15297 | |
15298 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
15299 | /* output mixer control */ | |
15300 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15301 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15302 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15303 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15304 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
15305 | ||
15306 | /* Input mixer control */ | |
15307 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15308 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
15309 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15310 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15311 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15312 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15313 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15314 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15315 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
f12ab1e0 TI |
15316 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
15317 | ||
7cdbff94 MD |
15318 | { |
15319 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15320 | .name = "Channel Mode", | |
15321 | .info = alc_ch_mode_info, | |
15322 | .get = alc_ch_mode_get, | |
15323 | .put = alc_ch_mode_put, | |
15324 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
15325 | }, | |
15326 | { } | |
56bb0cab TI |
15327 | }; |
15328 | ||
15329 | /* additional mixer */ | |
d1d985f0 | 15330 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
56bb0cab TI |
15331 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
15332 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
56bb0cab TI |
15333 | { } |
15334 | }; | |
7cdbff94 | 15335 | |
df694daa KY |
15336 | /* |
15337 | * generic initialization of ADC, input mixers and output mixers | |
15338 | */ | |
15339 | static struct hda_verb alc861_base_init_verbs[] = { | |
15340 | /* | |
15341 | * Unmute ADC0 and set the default input to mic-in | |
15342 | */ | |
15343 | /* port-A for surround (rear panel) */ | |
15344 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15345 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15346 | /* port-B for mic-in (rear panel) with vref */ | |
15347 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15348 | /* port-C for line-in (rear panel) */ | |
15349 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15350 | /* port-D for Front */ | |
15351 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15352 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15353 | /* port-E for HP out (front panel) */ | |
15354 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15355 | /* route front PCM to HP */ | |
9dece1d7 | 15356 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
15357 | /* port-F for mic-in (front panel) with vref */ |
15358 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15359 | /* port-G for CLFE (rear panel) */ | |
15360 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15361 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15362 | /* port-H for side (rear panel) */ | |
15363 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15364 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15365 | /* CD-in */ | |
15366 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15367 | /* route front mic to ADC1*/ | |
15368 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15369 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 15370 | |
df694daa KY |
15371 | /* Unmute DAC0~3 & spdif out*/ |
15372 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15373 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15374 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15375 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15376 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15377 | |
df694daa KY |
15378 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15379 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15380 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15381 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15382 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15383 | |
df694daa KY |
15384 | /* Unmute Stereo Mixer 15 */ |
15385 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15386 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15387 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15388 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
15389 | |
15390 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15391 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15392 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15393 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15394 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15395 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15396 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15397 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15398 | /* hp used DAC 3 (Front) */ |
15399 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
15400 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15401 | ||
15402 | { } | |
15403 | }; | |
15404 | ||
15405 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
15406 | /* | |
15407 | * Unmute ADC0 and set the default input to mic-in | |
15408 | */ | |
15409 | /* port-A for surround (rear panel) */ | |
15410 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15411 | /* port-B for mic-in (rear panel) with vref */ | |
15412 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15413 | /* port-C for line-in (rear panel) */ | |
15414 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15415 | /* port-D for Front */ | |
15416 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15417 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15418 | /* port-E for HP out (front panel) */ | |
15419 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15420 | /* route front PCM to HP */ | |
9dece1d7 | 15421 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
15422 | /* port-F for mic-in (front panel) with vref */ |
15423 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15424 | /* port-G for CLFE (rear panel) */ | |
15425 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15426 | /* port-H for side (rear panel) */ | |
15427 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15428 | /* CD-in */ | |
15429 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15430 | /* route front mic to ADC1*/ | |
15431 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15432 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15433 | /* Unmute DAC0~3 & spdif out*/ | |
15434 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15435 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15436 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15437 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15438 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15439 | |
df694daa KY |
15440 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15441 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15442 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15443 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15444 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15445 | |
df694daa KY |
15446 | /* Unmute Stereo Mixer 15 */ |
15447 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
15451 | |
15452 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15453 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15454 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15455 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15456 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15457 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15458 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15459 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15460 | /* hp used DAC 3 (Front) */ |
15461 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
15462 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15463 | { } | |
15464 | }; | |
22309c3e TI |
15465 | |
15466 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
15467 | /* | |
15468 | * Unmute ADC0 and set the default input to mic-in | |
15469 | */ | |
15470 | /* port-A for surround (rear panel) */ | |
15471 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15472 | /* port-B for mic-in (rear panel) with vref */ | |
15473 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15474 | /* port-C for line-in (rear panel) */ | |
15475 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15476 | /* port-D for Front */ | |
15477 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15478 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15479 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
15480 | /* this has to be set to VREF80 */ |
15481 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
22309c3e | 15482 | /* route front PCM to HP */ |
9dece1d7 | 15483 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
22309c3e TI |
15484 | /* port-F for mic-in (front panel) with vref */ |
15485 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15486 | /* port-G for CLFE (rear panel) */ | |
15487 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15488 | /* port-H for side (rear panel) */ | |
15489 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15490 | /* CD-in */ | |
15491 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15492 | /* route front mic to ADC1*/ | |
15493 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15494 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15495 | /* Unmute DAC0~3 & spdif out*/ | |
15496 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15497 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15498 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15499 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15501 | |
22309c3e TI |
15502 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15503 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15504 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15505 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15506 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15507 | |
22309c3e TI |
15508 | /* Unmute Stereo Mixer 15 */ |
15509 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15510 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15511 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15512 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
22309c3e TI |
15513 | |
15514 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15515 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15516 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15517 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15518 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15519 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15520 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15521 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15522 | /* hp used DAC 3 (Front) */ |
15523 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
22309c3e TI |
15524 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15525 | { } | |
15526 | }; | |
15527 | ||
7cdbff94 MD |
15528 | static struct hda_verb alc861_asus_init_verbs[] = { |
15529 | /* | |
15530 | * Unmute ADC0 and set the default input to mic-in | |
15531 | */ | |
f12ab1e0 TI |
15532 | /* port-A for surround (rear panel) |
15533 | * according to codec#0 this is the HP jack | |
15534 | */ | |
7cdbff94 MD |
15535 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
15536 | /* route front PCM to HP */ | |
15537 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
15538 | /* port-B for mic-in (rear panel) with vref */ | |
15539 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15540 | /* port-C for line-in (rear panel) */ | |
15541 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15542 | /* port-D for Front */ | |
15543 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15544 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15545 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
15546 | /* this has to be set to VREF80 */ |
15547 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7cdbff94 | 15548 | /* route front PCM to HP */ |
9dece1d7 | 15549 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7cdbff94 MD |
15550 | /* port-F for mic-in (front panel) with vref */ |
15551 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15552 | /* port-G for CLFE (rear panel) */ | |
15553 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15554 | /* port-H for side (rear panel) */ | |
15555 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15556 | /* CD-in */ | |
15557 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15558 | /* route front mic to ADC1*/ | |
15559 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15560 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15561 | /* Unmute DAC0~3 & spdif out*/ | |
15562 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15563 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15564 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15565 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15566 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15567 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15568 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15569 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15570 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15571 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15572 | |
7cdbff94 MD |
15573 | /* Unmute Stereo Mixer 15 */ |
15574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15575 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15576 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15577 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
7cdbff94 MD |
15578 | |
15579 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15580 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15581 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15582 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15583 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15584 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15585 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15586 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15587 | /* hp used DAC 3 (Front) */ |
15588 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7cdbff94 MD |
15589 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15590 | { } | |
15591 | }; | |
15592 | ||
56bb0cab TI |
15593 | /* additional init verbs for ASUS laptops */ |
15594 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
15595 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
15596 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
15597 | { } | |
15598 | }; | |
7cdbff94 | 15599 | |
df694daa KY |
15600 | /* |
15601 | * generic initialization of ADC, input mixers and output mixers | |
15602 | */ | |
15603 | static struct hda_verb alc861_auto_init_verbs[] = { | |
15604 | /* | |
15605 | * Unmute ADC0 and set the default input to mic-in | |
15606 | */ | |
f12ab1e0 | 15607 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
df694daa | 15608 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
ea1fb29a | 15609 | |
df694daa KY |
15610 | /* Unmute DAC0~3 & spdif out*/ |
15611 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15612 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15613 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15614 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15616 | |
df694daa KY |
15617 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15618 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15619 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15620 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15621 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15622 | |
df694daa KY |
15623 | /* Unmute Stereo Mixer 15 */ |
15624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15626 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15627 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
15628 | ||
1c20930a TI |
15629 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
15630 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15631 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15632 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15633 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15634 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15635 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15636 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
df694daa KY |
15637 | |
15638 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15639 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1c20930a TI |
15640 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
15641 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
df694daa KY |
15642 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
15643 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1c20930a TI |
15644 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
15645 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
df694daa | 15646 | |
f12ab1e0 | 15647 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
df694daa KY |
15648 | |
15649 | { } | |
15650 | }; | |
15651 | ||
a53d1aec TD |
15652 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
15653 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f12ab1e0 | 15654 | |
a53d1aec TD |
15655 | { } |
15656 | }; | |
15657 | ||
15658 | /* toggle speaker-output according to the hp-jack state */ | |
15659 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
15660 | { | |
864f92be | 15661 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
a53d1aec | 15662 | |
47fd830a TI |
15663 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
15664 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
15665 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
15666 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
a53d1aec TD |
15667 | } |
15668 | ||
15669 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
15670 | unsigned int res) | |
15671 | { | |
a53d1aec TD |
15672 | if ((res >> 26) == ALC880_HP_EVENT) |
15673 | alc861_toshiba_automute(codec); | |
15674 | } | |
15675 | ||
def319f9 | 15676 | /* pcm configuration: identical with ALC880 */ |
df694daa KY |
15677 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
15678 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
15679 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
15680 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
15681 | ||
15682 | ||
15683 | #define ALC861_DIGOUT_NID 0x07 | |
15684 | ||
15685 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
15686 | { 8, NULL } | |
15687 | }; | |
15688 | ||
15689 | static hda_nid_t alc861_dac_nids[4] = { | |
15690 | /* front, surround, clfe, side */ | |
15691 | 0x03, 0x06, 0x05, 0x04 | |
15692 | }; | |
15693 | ||
9c7f852e TI |
15694 | static hda_nid_t alc660_dac_nids[3] = { |
15695 | /* front, clfe, surround */ | |
15696 | 0x03, 0x05, 0x06 | |
15697 | }; | |
15698 | ||
df694daa KY |
15699 | static hda_nid_t alc861_adc_nids[1] = { |
15700 | /* ADC0-2 */ | |
15701 | 0x08, | |
15702 | }; | |
15703 | ||
15704 | static struct hda_input_mux alc861_capture_source = { | |
15705 | .num_items = 5, | |
15706 | .items = { | |
15707 | { "Mic", 0x0 }, | |
15708 | { "Front Mic", 0x3 }, | |
15709 | { "Line", 0x1 }, | |
15710 | { "CD", 0x4 }, | |
15711 | { "Mixer", 0x5 }, | |
15712 | }, | |
15713 | }; | |
15714 | ||
1c20930a TI |
15715 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
15716 | { | |
15717 | struct alc_spec *spec = codec->spec; | |
15718 | hda_nid_t mix, srcs[5]; | |
15719 | int i, j, num; | |
15720 | ||
15721 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | |
15722 | return 0; | |
15723 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15724 | if (num < 0) | |
15725 | return 0; | |
15726 | for (i = 0; i < num; i++) { | |
15727 | unsigned int type; | |
a22d543a | 15728 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
1c20930a TI |
15729 | if (type != AC_WID_AUD_OUT) |
15730 | continue; | |
15731 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
15732 | if (spec->multiout.dac_nids[j] == srcs[i]) | |
15733 | break; | |
15734 | if (j >= spec->multiout.num_dacs) | |
15735 | return srcs[i]; | |
15736 | } | |
15737 | return 0; | |
15738 | } | |
15739 | ||
df694daa | 15740 | /* fill in the dac_nids table from the parsed pin configuration */ |
1c20930a | 15741 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
f12ab1e0 | 15742 | const struct auto_pin_cfg *cfg) |
df694daa | 15743 | { |
1c20930a | 15744 | struct alc_spec *spec = codec->spec; |
df694daa | 15745 | int i; |
1c20930a | 15746 | hda_nid_t nid, dac; |
df694daa KY |
15747 | |
15748 | spec->multiout.dac_nids = spec->private_dac_nids; | |
15749 | for (i = 0; i < cfg->line_outs; i++) { | |
15750 | nid = cfg->line_out_pins[i]; | |
1c20930a TI |
15751 | dac = alc861_look_for_dac(codec, nid); |
15752 | if (!dac) | |
15753 | continue; | |
15754 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
df694daa | 15755 | } |
df694daa KY |
15756 | return 0; |
15757 | } | |
15758 | ||
1c20930a TI |
15759 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
15760 | hda_nid_t nid, unsigned int chs) | |
15761 | { | |
0afe5f89 | 15762 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
1c20930a TI |
15763 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
15764 | } | |
15765 | ||
df694daa | 15766 | /* add playback controls from the parsed DAC table */ |
1c20930a | 15767 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
df694daa KY |
15768 | const struct auto_pin_cfg *cfg) |
15769 | { | |
1c20930a | 15770 | struct alc_spec *spec = codec->spec; |
f12ab1e0 TI |
15771 | static const char *chname[4] = { |
15772 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
15773 | }; | |
df694daa | 15774 | hda_nid_t nid; |
1c20930a TI |
15775 | int i, err; |
15776 | ||
15777 | if (cfg->line_outs == 1) { | |
15778 | const char *pfx = NULL; | |
15779 | if (!cfg->hp_outs) | |
15780 | pfx = "Master"; | |
15781 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
15782 | pfx = "Speaker"; | |
15783 | if (pfx) { | |
15784 | nid = spec->multiout.dac_nids[0]; | |
15785 | return alc861_create_out_sw(codec, pfx, nid, 3); | |
15786 | } | |
15787 | } | |
df694daa KY |
15788 | |
15789 | for (i = 0; i < cfg->line_outs; i++) { | |
15790 | nid = spec->multiout.dac_nids[i]; | |
f12ab1e0 | 15791 | if (!nid) |
df694daa | 15792 | continue; |
1c20930a | 15793 | if (i == 2) { |
df694daa | 15794 | /* Center/LFE */ |
1c20930a | 15795 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
f12ab1e0 | 15796 | if (err < 0) |
df694daa | 15797 | return err; |
1c20930a | 15798 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
f12ab1e0 | 15799 | if (err < 0) |
df694daa KY |
15800 | return err; |
15801 | } else { | |
1c20930a | 15802 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
f12ab1e0 | 15803 | if (err < 0) |
df694daa KY |
15804 | return err; |
15805 | } | |
15806 | } | |
15807 | return 0; | |
15808 | } | |
15809 | ||
1c20930a | 15810 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
df694daa | 15811 | { |
1c20930a | 15812 | struct alc_spec *spec = codec->spec; |
df694daa KY |
15813 | int err; |
15814 | hda_nid_t nid; | |
15815 | ||
f12ab1e0 | 15816 | if (!pin) |
df694daa KY |
15817 | return 0; |
15818 | ||
15819 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
1c20930a TI |
15820 | nid = alc861_look_for_dac(codec, pin); |
15821 | if (nid) { | |
15822 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); | |
15823 | if (err < 0) | |
15824 | return err; | |
15825 | spec->multiout.hp_nid = nid; | |
15826 | } | |
df694daa KY |
15827 | } |
15828 | return 0; | |
15829 | } | |
15830 | ||
15831 | /* create playback/capture controls for input pins */ | |
05f5f477 | 15832 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
f12ab1e0 | 15833 | const struct auto_pin_cfg *cfg) |
df694daa | 15834 | { |
05f5f477 | 15835 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
df694daa KY |
15836 | } |
15837 | ||
f12ab1e0 TI |
15838 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
15839 | hda_nid_t nid, | |
1c20930a | 15840 | int pin_type, hda_nid_t dac) |
df694daa | 15841 | { |
1c20930a TI |
15842 | hda_nid_t mix, srcs[5]; |
15843 | int i, num; | |
15844 | ||
564c5bea JL |
15845 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
15846 | pin_type); | |
1c20930a | 15847 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
564c5bea | 15848 | AMP_OUT_UNMUTE); |
1c20930a TI |
15849 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
15850 | return; | |
15851 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15852 | if (num < 0) | |
15853 | return; | |
15854 | for (i = 0; i < num; i++) { | |
15855 | unsigned int mute; | |
15856 | if (srcs[i] == dac || srcs[i] == 0x15) | |
15857 | mute = AMP_IN_UNMUTE(i); | |
15858 | else | |
15859 | mute = AMP_IN_MUTE(i); | |
15860 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15861 | mute); | |
15862 | } | |
df694daa KY |
15863 | } |
15864 | ||
15865 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
15866 | { | |
15867 | struct alc_spec *spec = codec->spec; | |
15868 | int i; | |
15869 | ||
15870 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
15871 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 15872 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 15873 | if (nid) |
baba8ee9 | 15874 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 15875 | spec->multiout.dac_nids[i]); |
df694daa KY |
15876 | } |
15877 | } | |
15878 | ||
15879 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
15880 | { | |
15881 | struct alc_spec *spec = codec->spec; | |
df694daa | 15882 | |
15870f05 TI |
15883 | if (spec->autocfg.hp_outs) |
15884 | alc861_auto_set_output_and_unmute(codec, | |
15885 | spec->autocfg.hp_pins[0], | |
15886 | PIN_HP, | |
1c20930a | 15887 | spec->multiout.hp_nid); |
15870f05 TI |
15888 | if (spec->autocfg.speaker_outs) |
15889 | alc861_auto_set_output_and_unmute(codec, | |
15890 | spec->autocfg.speaker_pins[0], | |
15891 | PIN_OUT, | |
1c20930a | 15892 | spec->multiout.dac_nids[0]); |
df694daa KY |
15893 | } |
15894 | ||
15895 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
15896 | { | |
15897 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 15898 | struct auto_pin_cfg *cfg = &spec->autocfg; |
df694daa KY |
15899 | int i; |
15900 | ||
66ceeb6b TI |
15901 | for (i = 0; i < cfg->num_inputs; i++) { |
15902 | hda_nid_t nid = cfg->inputs[i].pin; | |
23f0c048 | 15903 | if (nid >= 0x0c && nid <= 0x11) |
30ea098f | 15904 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
df694daa KY |
15905 | } |
15906 | } | |
15907 | ||
15908 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
15909 | /* return 1 if successful, 0 if the proper config is not found, |
15910 | * or a negative error code | |
15911 | */ | |
df694daa KY |
15912 | static int alc861_parse_auto_config(struct hda_codec *codec) |
15913 | { | |
15914 | struct alc_spec *spec = codec->spec; | |
15915 | int err; | |
15916 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
15917 | ||
f12ab1e0 TI |
15918 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
15919 | alc861_ignore); | |
15920 | if (err < 0) | |
df694daa | 15921 | return err; |
f12ab1e0 | 15922 | if (!spec->autocfg.line_outs) |
df694daa KY |
15923 | return 0; /* can't find valid BIOS pin config */ |
15924 | ||
1c20930a | 15925 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
f12ab1e0 TI |
15926 | if (err < 0) |
15927 | return err; | |
1c20930a | 15928 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
f12ab1e0 TI |
15929 | if (err < 0) |
15930 | return err; | |
1c20930a | 15931 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
f12ab1e0 TI |
15932 | if (err < 0) |
15933 | return err; | |
05f5f477 | 15934 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 15935 | if (err < 0) |
df694daa KY |
15936 | return err; |
15937 | ||
15938 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
15939 | ||
757899ac | 15940 | alc_auto_parse_digital(codec); |
df694daa | 15941 | |
603c4019 | 15942 | if (spec->kctls.list) |
d88897ea | 15943 | add_mixer(spec, spec->kctls.list); |
df694daa | 15944 | |
d88897ea | 15945 | add_verb(spec, alc861_auto_init_verbs); |
df694daa | 15946 | |
a1e8d2da | 15947 | spec->num_mux_defs = 1; |
61b9b9b1 | 15948 | spec->input_mux = &spec->private_imux[0]; |
df694daa KY |
15949 | |
15950 | spec->adc_nids = alc861_adc_nids; | |
15951 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
b59bdf3b | 15952 | set_capture_mixer(codec); |
df694daa | 15953 | |
6227cdce | 15954 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
4a79ba34 | 15955 | |
df694daa KY |
15956 | return 1; |
15957 | } | |
15958 | ||
ae6b813a TI |
15959 | /* additional initialization for auto-configuration model */ |
15960 | static void alc861_auto_init(struct hda_codec *codec) | |
df694daa | 15961 | { |
f6c7e546 | 15962 | struct alc_spec *spec = codec->spec; |
df694daa KY |
15963 | alc861_auto_init_multi_out(codec); |
15964 | alc861_auto_init_hp_out(codec); | |
15965 | alc861_auto_init_analog_input(codec); | |
757899ac | 15966 | alc_auto_init_digital(codec); |
f6c7e546 | 15967 | if (spec->unsol_event) |
7fb0d78f | 15968 | alc_inithook(codec); |
df694daa KY |
15969 | } |
15970 | ||
cb53c626 TI |
15971 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15972 | static struct hda_amp_list alc861_loopbacks[] = { | |
15973 | { 0x15, HDA_INPUT, 0 }, | |
15974 | { 0x15, HDA_INPUT, 1 }, | |
15975 | { 0x15, HDA_INPUT, 2 }, | |
15976 | { 0x15, HDA_INPUT, 3 }, | |
15977 | { } /* end */ | |
15978 | }; | |
15979 | #endif | |
15980 | ||
df694daa KY |
15981 | |
15982 | /* | |
15983 | * configuration and preset | |
15984 | */ | |
f5fcc13c TI |
15985 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
15986 | [ALC861_3ST] = "3stack", | |
15987 | [ALC660_3ST] = "3stack-660", | |
15988 | [ALC861_3ST_DIG] = "3stack-dig", | |
15989 | [ALC861_6ST_DIG] = "6stack-dig", | |
15990 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
15991 | [ALC861_TOSHIBA] = "toshiba", | |
15992 | [ALC861_ASUS] = "asus", | |
15993 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
15994 | [ALC861_AUTO] = "auto", | |
15995 | }; | |
15996 | ||
15997 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
687a47bd | 15998 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
f5fcc13c TI |
15999 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
16000 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
16001 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
ac3e3741 | 16002 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
83c34218 | 16003 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
ad5e7737 | 16004 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
341d4eb0 TI |
16005 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
16006 | * Any other models that need this preset? | |
16007 | */ | |
16008 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
ac3e3741 TI |
16009 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
16010 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
4147dab6 | 16011 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
ac3e3741 TI |
16012 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
16013 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
16014 | /* FIXME: the below seems conflict */ | |
16015 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
07e038b3 | 16016 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
f5fcc13c | 16017 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
df694daa KY |
16018 | {} |
16019 | }; | |
16020 | ||
16021 | static struct alc_config_preset alc861_presets[] = { | |
16022 | [ALC861_3ST] = { | |
16023 | .mixers = { alc861_3ST_mixer }, | |
16024 | .init_verbs = { alc861_threestack_init_verbs }, | |
16025 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16026 | .dac_nids = alc861_dac_nids, | |
16027 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16028 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 16029 | .need_dac_fix = 1, |
df694daa KY |
16030 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
16031 | .adc_nids = alc861_adc_nids, | |
16032 | .input_mux = &alc861_capture_source, | |
16033 | }, | |
16034 | [ALC861_3ST_DIG] = { | |
16035 | .mixers = { alc861_base_mixer }, | |
16036 | .init_verbs = { alc861_threestack_init_verbs }, | |
16037 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16038 | .dac_nids = alc861_dac_nids, | |
16039 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16040 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16041 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 16042 | .need_dac_fix = 1, |
df694daa KY |
16043 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
16044 | .adc_nids = alc861_adc_nids, | |
16045 | .input_mux = &alc861_capture_source, | |
16046 | }, | |
16047 | [ALC861_6ST_DIG] = { | |
16048 | .mixers = { alc861_base_mixer }, | |
16049 | .init_verbs = { alc861_base_init_verbs }, | |
16050 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16051 | .dac_nids = alc861_dac_nids, | |
16052 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16053 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
16054 | .channel_mode = alc861_8ch_modes, | |
16055 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16056 | .adc_nids = alc861_adc_nids, | |
16057 | .input_mux = &alc861_capture_source, | |
16058 | }, | |
9c7f852e TI |
16059 | [ALC660_3ST] = { |
16060 | .mixers = { alc861_3ST_mixer }, | |
16061 | .init_verbs = { alc861_threestack_init_verbs }, | |
16062 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
16063 | .dac_nids = alc660_dac_nids, | |
16064 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16065 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 16066 | .need_dac_fix = 1, |
9c7f852e TI |
16067 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
16068 | .adc_nids = alc861_adc_nids, | |
16069 | .input_mux = &alc861_capture_source, | |
16070 | }, | |
22309c3e TI |
16071 | [ALC861_UNIWILL_M31] = { |
16072 | .mixers = { alc861_uniwill_m31_mixer }, | |
16073 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
16074 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16075 | .dac_nids = alc861_dac_nids, | |
16076 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16077 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
16078 | .channel_mode = alc861_uniwill_m31_modes, | |
16079 | .need_dac_fix = 1, | |
16080 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16081 | .adc_nids = alc861_adc_nids, | |
16082 | .input_mux = &alc861_capture_source, | |
16083 | }, | |
a53d1aec TD |
16084 | [ALC861_TOSHIBA] = { |
16085 | .mixers = { alc861_toshiba_mixer }, | |
f12ab1e0 TI |
16086 | .init_verbs = { alc861_base_init_verbs, |
16087 | alc861_toshiba_init_verbs }, | |
a53d1aec TD |
16088 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
16089 | .dac_nids = alc861_dac_nids, | |
16090 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
16091 | .channel_mode = alc883_3ST_2ch_modes, | |
16092 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16093 | .adc_nids = alc861_adc_nids, | |
16094 | .input_mux = &alc861_capture_source, | |
16095 | .unsol_event = alc861_toshiba_unsol_event, | |
16096 | .init_hook = alc861_toshiba_automute, | |
16097 | }, | |
7cdbff94 MD |
16098 | [ALC861_ASUS] = { |
16099 | .mixers = { alc861_asus_mixer }, | |
16100 | .init_verbs = { alc861_asus_init_verbs }, | |
16101 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16102 | .dac_nids = alc861_dac_nids, | |
16103 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16104 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
16105 | .channel_mode = alc861_asus_modes, | |
16106 | .need_dac_fix = 1, | |
16107 | .hp_nid = 0x06, | |
16108 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16109 | .adc_nids = alc861_adc_nids, | |
16110 | .input_mux = &alc861_capture_source, | |
16111 | }, | |
56bb0cab TI |
16112 | [ALC861_ASUS_LAPTOP] = { |
16113 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
16114 | .init_verbs = { alc861_asus_init_verbs, | |
16115 | alc861_asus_laptop_init_verbs }, | |
16116 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16117 | .dac_nids = alc861_dac_nids, | |
16118 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16119 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
16120 | .channel_mode = alc883_3ST_2ch_modes, | |
16121 | .need_dac_fix = 1, | |
16122 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16123 | .adc_nids = alc861_adc_nids, | |
16124 | .input_mux = &alc861_capture_source, | |
16125 | }, | |
16126 | }; | |
df694daa | 16127 | |
cfc9b06f TI |
16128 | /* Pin config fixes */ |
16129 | enum { | |
16130 | PINFIX_FSC_AMILO_PI1505, | |
16131 | }; | |
16132 | ||
cfc9b06f TI |
16133 | static const struct alc_fixup alc861_fixups[] = { |
16134 | [PINFIX_FSC_AMILO_PI1505] = { | |
73413b12 TI |
16135 | .pins = (const struct alc_pincfg[]) { |
16136 | { 0x0b, 0x0221101f }, /* HP */ | |
16137 | { 0x0f, 0x90170310 }, /* speaker */ | |
16138 | { } | |
16139 | } | |
cfc9b06f TI |
16140 | }, |
16141 | }; | |
16142 | ||
16143 | static struct snd_pci_quirk alc861_fixup_tbl[] = { | |
16144 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), | |
16145 | {} | |
16146 | }; | |
df694daa KY |
16147 | |
16148 | static int patch_alc861(struct hda_codec *codec) | |
16149 | { | |
16150 | struct alc_spec *spec; | |
16151 | int board_config; | |
16152 | int err; | |
16153 | ||
dc041e0b | 16154 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
16155 | if (spec == NULL) |
16156 | return -ENOMEM; | |
16157 | ||
f12ab1e0 | 16158 | codec->spec = spec; |
df694daa | 16159 | |
f5fcc13c TI |
16160 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
16161 | alc861_models, | |
16162 | alc861_cfg_tbl); | |
9c7f852e | 16163 | |
f5fcc13c | 16164 | if (board_config < 0) { |
9a11f1aa TI |
16165 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
16166 | codec->chip_name); | |
df694daa KY |
16167 | board_config = ALC861_AUTO; |
16168 | } | |
16169 | ||
7fa90e87 TI |
16170 | if (board_config == ALC861_AUTO) |
16171 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); | |
cfc9b06f | 16172 | |
df694daa KY |
16173 | if (board_config == ALC861_AUTO) { |
16174 | /* automatic parse from the BIOS config */ | |
16175 | err = alc861_parse_auto_config(codec); | |
16176 | if (err < 0) { | |
16177 | alc_free(codec); | |
16178 | return err; | |
f12ab1e0 | 16179 | } else if (!err) { |
9c7f852e TI |
16180 | printk(KERN_INFO |
16181 | "hda_codec: Cannot set up configuration " | |
16182 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
16183 | board_config = ALC861_3ST_DIG; |
16184 | } | |
16185 | } | |
16186 | ||
680cd536 KK |
16187 | err = snd_hda_attach_beep_device(codec, 0x23); |
16188 | if (err < 0) { | |
16189 | alc_free(codec); | |
16190 | return err; | |
16191 | } | |
16192 | ||
df694daa | 16193 | if (board_config != ALC861_AUTO) |
e9c364c0 | 16194 | setup_preset(codec, &alc861_presets[board_config]); |
df694daa | 16195 | |
df694daa KY |
16196 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
16197 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
16198 | ||
df694daa KY |
16199 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
16200 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
16201 | ||
c7a8eb10 TI |
16202 | if (!spec->cap_mixer) |
16203 | set_capture_mixer(codec); | |
45bdd1c1 TI |
16204 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
16205 | ||
2134ea4f TI |
16206 | spec->vmaster_nid = 0x03; |
16207 | ||
7fa90e87 TI |
16208 | if (board_config == ALC861_AUTO) |
16209 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); | |
16210 | ||
df694daa | 16211 | codec->patch_ops = alc_patch_ops; |
c97259df | 16212 | if (board_config == ALC861_AUTO) { |
ae6b813a | 16213 | spec->init_hook = alc861_auto_init; |
c97259df DC |
16214 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16215 | spec->power_hook = alc_power_eapd; | |
16216 | #endif | |
16217 | } | |
cb53c626 TI |
16218 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16219 | if (!spec->loopback.amplist) | |
16220 | spec->loopback.amplist = alc861_loopbacks; | |
16221 | #endif | |
ea1fb29a | 16222 | |
1da177e4 LT |
16223 | return 0; |
16224 | } | |
16225 | ||
f32610ed JS |
16226 | /* |
16227 | * ALC861-VD support | |
16228 | * | |
16229 | * Based on ALC882 | |
16230 | * | |
16231 | * In addition, an independent DAC | |
16232 | */ | |
16233 | #define ALC861VD_DIGOUT_NID 0x06 | |
16234 | ||
16235 | static hda_nid_t alc861vd_dac_nids[4] = { | |
16236 | /* front, surr, clfe, side surr */ | |
16237 | 0x02, 0x03, 0x04, 0x05 | |
16238 | }; | |
16239 | ||
16240 | /* dac_nids for ALC660vd are in a different order - according to | |
16241 | * Realtek's driver. | |
def319f9 | 16242 | * This should probably result in a different mixer for 6stack models |
f32610ed JS |
16243 | * of ALC660vd codecs, but for now there is only 3stack mixer |
16244 | * - and it is the same as in 861vd. | |
16245 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
16246 | */ | |
16247 | static hda_nid_t alc660vd_dac_nids[3] = { | |
16248 | /* front, rear, clfe, rear_surr */ | |
16249 | 0x02, 0x04, 0x03 | |
16250 | }; | |
16251 | ||
16252 | static hda_nid_t alc861vd_adc_nids[1] = { | |
16253 | /* ADC0 */ | |
16254 | 0x09, | |
16255 | }; | |
16256 | ||
e1406348 TI |
16257 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
16258 | ||
f32610ed JS |
16259 | /* input MUX */ |
16260 | /* FIXME: should be a matrix-type input source selection */ | |
16261 | static struct hda_input_mux alc861vd_capture_source = { | |
16262 | .num_items = 4, | |
16263 | .items = { | |
16264 | { "Mic", 0x0 }, | |
16265 | { "Front Mic", 0x1 }, | |
16266 | { "Line", 0x2 }, | |
16267 | { "CD", 0x4 }, | |
16268 | }, | |
16269 | }; | |
16270 | ||
272a527c | 16271 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
b419f346 | 16272 | .num_items = 2, |
272a527c | 16273 | .items = { |
b419f346 TD |
16274 | { "Ext Mic", 0x0 }, |
16275 | { "Int Mic", 0x1 }, | |
272a527c KY |
16276 | }, |
16277 | }; | |
16278 | ||
d1a991a6 KY |
16279 | static struct hda_input_mux alc861vd_hp_capture_source = { |
16280 | .num_items = 2, | |
16281 | .items = { | |
16282 | { "Front Mic", 0x0 }, | |
16283 | { "ATAPI Mic", 0x1 }, | |
16284 | }, | |
16285 | }; | |
16286 | ||
f32610ed JS |
16287 | /* |
16288 | * 2ch mode | |
16289 | */ | |
16290 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
16291 | { 2, NULL } | |
16292 | }; | |
16293 | ||
16294 | /* | |
16295 | * 6ch mode | |
16296 | */ | |
16297 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
16298 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
16299 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16300 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16301 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16302 | { } /* end */ | |
16303 | }; | |
16304 | ||
16305 | /* | |
16306 | * 8ch mode | |
16307 | */ | |
16308 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
16309 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16310 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16311 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16312 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16313 | { } /* end */ | |
16314 | }; | |
16315 | ||
16316 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
16317 | { 6, alc861vd_6stack_ch6_init }, | |
16318 | { 8, alc861vd_6stack_ch8_init }, | |
16319 | }; | |
16320 | ||
16321 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
16322 | { | |
16323 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
16324 | .name = "Channel Mode", | |
16325 | .info = alc_ch_mode_info, | |
16326 | .get = alc_ch_mode_get, | |
16327 | .put = alc_ch_mode_put, | |
16328 | }, | |
16329 | { } /* end */ | |
16330 | }; | |
16331 | ||
f32610ed JS |
16332 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
16333 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
16334 | */ | |
16335 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
16336 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16337 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16338 | ||
16339 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16340 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
16341 | ||
16342 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
16343 | HDA_OUTPUT), | |
16344 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
16345 | HDA_OUTPUT), | |
16346 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
16347 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16348 | ||
16349 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
16350 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
16351 | ||
16352 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16353 | ||
16354 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16355 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16356 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16357 | ||
16358 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16359 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16360 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16361 | ||
16362 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16363 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16364 | ||
16365 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16366 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16367 | ||
f32610ed JS |
16368 | { } /* end */ |
16369 | }; | |
16370 | ||
16371 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
16372 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16373 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16374 | ||
16375 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16376 | ||
16377 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16380 | ||
16381 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16382 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16383 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16384 | ||
16385 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16386 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16387 | ||
16388 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16389 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16390 | ||
f32610ed JS |
16391 | { } /* end */ |
16392 | }; | |
16393 | ||
bdd148a3 KY |
16394 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
16395 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16396 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
16397 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
16398 | ||
16399 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16400 | ||
16401 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16402 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16403 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16404 | ||
16405 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16406 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16407 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16408 | ||
16409 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16410 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16411 | ||
16412 | { } /* end */ | |
16413 | }; | |
16414 | ||
b419f346 TD |
16415 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
16416 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
272a527c KY |
16417 | */ |
16418 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
b419f346 TD |
16419 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
16420 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
272a527c KY |
16421 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
16422 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
b419f346 TD |
16423 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
16424 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16425 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16426 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
16427 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16428 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
272a527c KY |
16429 | { } /* end */ |
16430 | }; | |
16431 | ||
d1a991a6 KY |
16432 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
16433 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
16434 | */ | |
16435 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
16436 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16437 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16438 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16439 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
16440 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16441 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16442 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16443 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ea1fb29a | 16444 | |
d1a991a6 KY |
16445 | { } /* end */ |
16446 | }; | |
16447 | ||
f32610ed JS |
16448 | /* |
16449 | * generic initialization of ADC, input mixers and output mixers | |
16450 | */ | |
16451 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
16452 | /* | |
16453 | * Unmute ADC0 and set the default input to mic-in | |
16454 | */ | |
16455 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16456 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16457 | ||
16458 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
16459 | * the analog-loopback mixer widget | |
16460 | */ | |
16461 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
16462 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
16463 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16464 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16465 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16466 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
f32610ed JS |
16467 | |
16468 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
bdd148a3 KY |
16469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
16470 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16471 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f32610ed | 16472 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
f32610ed JS |
16473 | |
16474 | /* | |
16475 | * Set up output mixers (0x02 - 0x05) | |
16476 | */ | |
16477 | /* set vol=0 to output mixers */ | |
16478 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16479 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16480 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16481 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16482 | ||
16483 | /* set up input amps for analog loopback */ | |
16484 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
16485 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16486 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16487 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16488 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16489 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16490 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16491 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16492 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16493 | ||
16494 | { } | |
16495 | }; | |
16496 | ||
16497 | /* | |
16498 | * 3-stack pin configuration: | |
16499 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
16500 | */ | |
16501 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
16502 | /* | |
16503 | * Set pin mode and muting | |
16504 | */ | |
16505 | /* set front pin widgets 0x14 for output */ | |
16506 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16507 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16508 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16509 | ||
16510 | /* Mic (rear) pin: input vref at 80% */ | |
16511 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16512 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16513 | /* Front Mic pin: input vref at 80% */ | |
16514 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16515 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16516 | /* Line In pin: input */ | |
16517 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16518 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16519 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16520 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16521 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16522 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16523 | /* CD pin widget for input */ | |
16524 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16525 | ||
16526 | { } | |
16527 | }; | |
16528 | ||
16529 | /* | |
16530 | * 6-stack pin configuration: | |
16531 | */ | |
16532 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
16533 | /* | |
16534 | * Set pin mode and muting | |
16535 | */ | |
16536 | /* set front pin widgets 0x14 for output */ | |
16537 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16538 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16539 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16540 | ||
16541 | /* Rear Pin: output 1 (0x0d) */ | |
16542 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16543 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16544 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
16545 | /* CLFE Pin: output 2 (0x0e) */ | |
16546 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16547 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16548 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16549 | /* Side Pin: output 3 (0x0f) */ | |
16550 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16551 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16552 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
16553 | ||
16554 | /* Mic (rear) pin: input vref at 80% */ | |
16555 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16556 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16557 | /* Front Mic pin: input vref at 80% */ | |
16558 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16559 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16560 | /* Line In pin: input */ | |
16561 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16562 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16563 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16564 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16565 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16566 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16567 | /* CD pin widget for input */ | |
16568 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16569 | ||
16570 | { } | |
16571 | }; | |
16572 | ||
bdd148a3 KY |
16573 | static struct hda_verb alc861vd_eapd_verbs[] = { |
16574 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16575 | { } | |
16576 | }; | |
16577 | ||
f9423e7a KY |
16578 | static struct hda_verb alc660vd_eapd_verbs[] = { |
16579 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16580 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16581 | { } | |
16582 | }; | |
16583 | ||
bdd148a3 KY |
16584 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
16585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
16588 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
ea1fb29a | 16589 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
bdd148a3 KY |
16590 | {} |
16591 | }; | |
16592 | ||
bdd148a3 KY |
16593 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
16594 | { | |
16595 | unsigned int present; | |
16596 | unsigned char bits; | |
16597 | ||
864f92be | 16598 | present = snd_hda_jack_detect(codec, 0x18); |
47fd830a | 16599 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 16600 | |
47fd830a TI |
16601 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
16602 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
16603 | } |
16604 | ||
4f5d1706 | 16605 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
bdd148a3 | 16606 | { |
a9fd4f3f | 16607 | struct alc_spec *spec = codec->spec; |
a9fd4f3f TI |
16608 | spec->autocfg.hp_pins[0] = 0x1b; |
16609 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
16610 | } |
16611 | ||
16612 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | |
16613 | { | |
a9fd4f3f | 16614 | alc_automute_amp(codec); |
bdd148a3 KY |
16615 | alc861vd_lenovo_mic_automute(codec); |
16616 | } | |
16617 | ||
16618 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
16619 | unsigned int res) | |
16620 | { | |
16621 | switch (res >> 26) { | |
bdd148a3 KY |
16622 | case ALC880_MIC_EVENT: |
16623 | alc861vd_lenovo_mic_automute(codec); | |
16624 | break; | |
a9fd4f3f TI |
16625 | default: |
16626 | alc_automute_amp_unsol_event(codec, res); | |
16627 | break; | |
bdd148a3 KY |
16628 | } |
16629 | } | |
16630 | ||
272a527c KY |
16631 | static struct hda_verb alc861vd_dallas_verbs[] = { |
16632 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16633 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16634 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16635 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16636 | ||
16637 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16638 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16639 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16640 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16641 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16642 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16643 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16644 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
ea1fb29a | 16645 | |
272a527c KY |
16646 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16647 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16648 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16649 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16650 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16651 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16652 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16653 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16654 | ||
16655 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16656 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16657 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16658 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16659 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16660 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16661 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16662 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16663 | ||
16664 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16665 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16668 | ||
16669 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 16670 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
272a527c KY |
16671 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
16672 | ||
16673 | { } /* end */ | |
16674 | }; | |
16675 | ||
16676 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 16677 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
272a527c | 16678 | { |
a9fd4f3f | 16679 | struct alc_spec *spec = codec->spec; |
272a527c | 16680 | |
a9fd4f3f TI |
16681 | spec->autocfg.hp_pins[0] = 0x15; |
16682 | spec->autocfg.speaker_pins[0] = 0x14; | |
272a527c KY |
16683 | } |
16684 | ||
cb53c626 TI |
16685 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16686 | #define alc861vd_loopbacks alc880_loopbacks | |
16687 | #endif | |
16688 | ||
def319f9 | 16689 | /* pcm configuration: identical with ALC880 */ |
f32610ed JS |
16690 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
16691 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
16692 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
16693 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
16694 | ||
16695 | /* | |
16696 | * configuration and preset | |
16697 | */ | |
16698 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |
16699 | [ALC660VD_3ST] = "3stack-660", | |
983f8ae4 | 16700 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
13c94744 | 16701 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
f32610ed JS |
16702 | [ALC861VD_3ST] = "3stack", |
16703 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
16704 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
bdd148a3 | 16705 | [ALC861VD_LENOVO] = "lenovo", |
272a527c | 16706 | [ALC861VD_DALLAS] = "dallas", |
983f8ae4 | 16707 | [ALC861VD_HP] = "hp", |
f32610ed JS |
16708 | [ALC861VD_AUTO] = "auto", |
16709 | }; | |
16710 | ||
16711 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
ac3e3741 TI |
16712 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
16713 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
07e038b3 | 16714 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
f8f25ba3 | 16715 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
13c94744 | 16716 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
6963f84c | 16717 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
f32610ed | 16718 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
ac3e3741 | 16719 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
38baf5ad | 16720 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
ce577e8c | 16721 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
542d7c66 | 16722 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
b419f346 | 16723 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
39c5d41f | 16724 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
dea0a509 | 16725 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
625dc0bf | 16726 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
f32610ed JS |
16727 | {} |
16728 | }; | |
16729 | ||
16730 | static struct alc_config_preset alc861vd_presets[] = { | |
16731 | [ALC660VD_3ST] = { | |
16732 | .mixers = { alc861vd_3st_mixer }, | |
16733 | .init_verbs = { alc861vd_volume_init_verbs, | |
16734 | alc861vd_3stack_init_verbs }, | |
16735 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16736 | .dac_nids = alc660vd_dac_nids, | |
f32610ed JS |
16737 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16738 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16739 | .input_mux = &alc861vd_capture_source, | |
16740 | }, | |
6963f84c MC |
16741 | [ALC660VD_3ST_DIG] = { |
16742 | .mixers = { alc861vd_3st_mixer }, | |
16743 | .init_verbs = { alc861vd_volume_init_verbs, | |
16744 | alc861vd_3stack_init_verbs }, | |
16745 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16746 | .dac_nids = alc660vd_dac_nids, | |
16747 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
6963f84c MC |
16748 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16749 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16750 | .input_mux = &alc861vd_capture_source, | |
16751 | }, | |
f32610ed JS |
16752 | [ALC861VD_3ST] = { |
16753 | .mixers = { alc861vd_3st_mixer }, | |
16754 | .init_verbs = { alc861vd_volume_init_verbs, | |
16755 | alc861vd_3stack_init_verbs }, | |
16756 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16757 | .dac_nids = alc861vd_dac_nids, | |
16758 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16759 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16760 | .input_mux = &alc861vd_capture_source, | |
16761 | }, | |
16762 | [ALC861VD_3ST_DIG] = { | |
16763 | .mixers = { alc861vd_3st_mixer }, | |
16764 | .init_verbs = { alc861vd_volume_init_verbs, | |
16765 | alc861vd_3stack_init_verbs }, | |
16766 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16767 | .dac_nids = alc861vd_dac_nids, | |
16768 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16769 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16770 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16771 | .input_mux = &alc861vd_capture_source, | |
16772 | }, | |
16773 | [ALC861VD_6ST_DIG] = { | |
16774 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
16775 | .init_verbs = { alc861vd_volume_init_verbs, | |
16776 | alc861vd_6stack_init_verbs }, | |
16777 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16778 | .dac_nids = alc861vd_dac_nids, | |
16779 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16780 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
16781 | .channel_mode = alc861vd_6stack_modes, | |
16782 | .input_mux = &alc861vd_capture_source, | |
16783 | }, | |
bdd148a3 KY |
16784 | [ALC861VD_LENOVO] = { |
16785 | .mixers = { alc861vd_lenovo_mixer }, | |
16786 | .init_verbs = { alc861vd_volume_init_verbs, | |
16787 | alc861vd_3stack_init_verbs, | |
16788 | alc861vd_eapd_verbs, | |
16789 | alc861vd_lenovo_unsol_verbs }, | |
16790 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16791 | .dac_nids = alc660vd_dac_nids, | |
bdd148a3 KY |
16792 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16793 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16794 | .input_mux = &alc861vd_capture_source, | |
16795 | .unsol_event = alc861vd_lenovo_unsol_event, | |
4f5d1706 | 16796 | .setup = alc861vd_lenovo_setup, |
a9fd4f3f | 16797 | .init_hook = alc861vd_lenovo_init_hook, |
bdd148a3 | 16798 | }, |
272a527c KY |
16799 | [ALC861VD_DALLAS] = { |
16800 | .mixers = { alc861vd_dallas_mixer }, | |
16801 | .init_verbs = { alc861vd_dallas_verbs }, | |
16802 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16803 | .dac_nids = alc861vd_dac_nids, | |
272a527c KY |
16804 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16805 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16806 | .input_mux = &alc861vd_dallas_capture_source, | |
a9fd4f3f | 16807 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
16808 | .setup = alc861vd_dallas_setup, |
16809 | .init_hook = alc_automute_amp, | |
d1a991a6 KY |
16810 | }, |
16811 | [ALC861VD_HP] = { | |
16812 | .mixers = { alc861vd_hp_mixer }, | |
16813 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
16814 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16815 | .dac_nids = alc861vd_dac_nids, | |
d1a991a6 | 16816 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
d1a991a6 KY |
16817 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16818 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16819 | .input_mux = &alc861vd_hp_capture_source, | |
a9fd4f3f | 16820 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
16821 | .setup = alc861vd_dallas_setup, |
16822 | .init_hook = alc_automute_amp, | |
ea1fb29a | 16823 | }, |
13c94744 TI |
16824 | [ALC660VD_ASUS_V1S] = { |
16825 | .mixers = { alc861vd_lenovo_mixer }, | |
16826 | .init_verbs = { alc861vd_volume_init_verbs, | |
16827 | alc861vd_3stack_init_verbs, | |
16828 | alc861vd_eapd_verbs, | |
16829 | alc861vd_lenovo_unsol_verbs }, | |
16830 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16831 | .dac_nids = alc660vd_dac_nids, | |
16832 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16833 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16834 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16835 | .input_mux = &alc861vd_capture_source, | |
16836 | .unsol_event = alc861vd_lenovo_unsol_event, | |
4f5d1706 | 16837 | .setup = alc861vd_lenovo_setup, |
a9fd4f3f | 16838 | .init_hook = alc861vd_lenovo_init_hook, |
13c94744 | 16839 | }, |
f32610ed JS |
16840 | }; |
16841 | ||
16842 | /* | |
16843 | * BIOS auto configuration | |
16844 | */ | |
05f5f477 TI |
16845 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
16846 | const struct auto_pin_cfg *cfg) | |
16847 | { | |
6227cdce | 16848 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
05f5f477 TI |
16849 | } |
16850 | ||
16851 | ||
f32610ed JS |
16852 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
16853 | hda_nid_t nid, int pin_type, int dac_idx) | |
16854 | { | |
f6c7e546 | 16855 | alc_set_pin_output(codec, nid, pin_type); |
f32610ed JS |
16856 | } |
16857 | ||
16858 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
16859 | { | |
16860 | struct alc_spec *spec = codec->spec; | |
16861 | int i; | |
16862 | ||
16863 | for (i = 0; i <= HDA_SIDE; i++) { | |
16864 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 16865 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
f32610ed JS |
16866 | if (nid) |
16867 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
baba8ee9 | 16868 | pin_type, i); |
f32610ed JS |
16869 | } |
16870 | } | |
16871 | ||
16872 | ||
16873 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
16874 | { | |
16875 | struct alc_spec *spec = codec->spec; | |
16876 | hda_nid_t pin; | |
16877 | ||
16878 | pin = spec->autocfg.hp_pins[0]; | |
def319f9 | 16879 | if (pin) /* connect to front and use dac 0 */ |
f32610ed | 16880 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
f6c7e546 TI |
16881 | pin = spec->autocfg.speaker_pins[0]; |
16882 | if (pin) | |
16883 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
f32610ed JS |
16884 | } |
16885 | ||
f32610ed JS |
16886 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
16887 | ||
16888 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
16889 | { | |
16890 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 16891 | struct auto_pin_cfg *cfg = &spec->autocfg; |
f32610ed JS |
16892 | int i; |
16893 | ||
66ceeb6b TI |
16894 | for (i = 0; i < cfg->num_inputs; i++) { |
16895 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 16896 | if (alc_is_input_pin(codec, nid)) { |
30ea098f | 16897 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
e82c025b TI |
16898 | if (nid != ALC861VD_PIN_CD_NID && |
16899 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f32610ed JS |
16900 | snd_hda_codec_write(codec, nid, 0, |
16901 | AC_VERB_SET_AMP_GAIN_MUTE, | |
16902 | AMP_OUT_MUTE); | |
16903 | } | |
16904 | } | |
16905 | } | |
16906 | ||
f511b01c TI |
16907 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
16908 | ||
f32610ed JS |
16909 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
16910 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
16911 | ||
16912 | /* add playback controls from the parsed DAC table */ | |
16913 | /* Based on ALC880 version. But ALC861VD has separate, | |
16914 | * different NIDs for mute/unmute switch and volume control */ | |
16915 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
16916 | const struct auto_pin_cfg *cfg) | |
16917 | { | |
f32610ed JS |
16918 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
16919 | hda_nid_t nid_v, nid_s; | |
16920 | int i, err; | |
16921 | ||
16922 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 16923 | if (!spec->multiout.dac_nids[i]) |
f32610ed JS |
16924 | continue; |
16925 | nid_v = alc861vd_idx_to_mixer_vol( | |
16926 | alc880_dac_to_idx( | |
16927 | spec->multiout.dac_nids[i])); | |
16928 | nid_s = alc861vd_idx_to_mixer_switch( | |
16929 | alc880_dac_to_idx( | |
16930 | spec->multiout.dac_nids[i])); | |
16931 | ||
16932 | if (i == 2) { | |
16933 | /* Center/LFE */ | |
0afe5f89 TI |
16934 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
16935 | "Center", | |
f12ab1e0 TI |
16936 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
16937 | HDA_OUTPUT)); | |
16938 | if (err < 0) | |
f32610ed | 16939 | return err; |
0afe5f89 TI |
16940 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
16941 | "LFE", | |
f12ab1e0 TI |
16942 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
16943 | HDA_OUTPUT)); | |
16944 | if (err < 0) | |
f32610ed | 16945 | return err; |
0afe5f89 TI |
16946 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
16947 | "Center", | |
f12ab1e0 TI |
16948 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
16949 | HDA_INPUT)); | |
16950 | if (err < 0) | |
f32610ed | 16951 | return err; |
0afe5f89 TI |
16952 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
16953 | "LFE", | |
f12ab1e0 TI |
16954 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
16955 | HDA_INPUT)); | |
16956 | if (err < 0) | |
f32610ed JS |
16957 | return err; |
16958 | } else { | |
a4fcd491 TI |
16959 | const char *pfx; |
16960 | if (cfg->line_outs == 1 && | |
16961 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
16962 | if (!cfg->hp_pins) | |
16963 | pfx = "Speaker"; | |
16964 | else | |
16965 | pfx = "PCM"; | |
16966 | } else | |
16967 | pfx = chname[i]; | |
0afe5f89 | 16968 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
16969 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
16970 | HDA_OUTPUT)); | |
16971 | if (err < 0) | |
f32610ed | 16972 | return err; |
a4fcd491 TI |
16973 | if (cfg->line_outs == 1 && |
16974 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
16975 | pfx = "Speaker"; | |
0afe5f89 | 16976 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
bdd148a3 | 16977 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
f12ab1e0 TI |
16978 | HDA_INPUT)); |
16979 | if (err < 0) | |
f32610ed JS |
16980 | return err; |
16981 | } | |
16982 | } | |
16983 | return 0; | |
16984 | } | |
16985 | ||
16986 | /* add playback controls for speaker and HP outputs */ | |
16987 | /* Based on ALC880 version. But ALC861VD has separate, | |
16988 | * different NIDs for mute/unmute switch and volume control */ | |
16989 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
16990 | hda_nid_t pin, const char *pfx) | |
16991 | { | |
16992 | hda_nid_t nid_v, nid_s; | |
16993 | int err; | |
f32610ed | 16994 | |
f12ab1e0 | 16995 | if (!pin) |
f32610ed JS |
16996 | return 0; |
16997 | ||
16998 | if (alc880_is_fixed_pin(pin)) { | |
16999 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
17000 | /* specify the DAC as the extra output */ | |
f12ab1e0 | 17001 | if (!spec->multiout.hp_nid) |
f32610ed JS |
17002 | spec->multiout.hp_nid = nid_v; |
17003 | else | |
17004 | spec->multiout.extra_out_nid[0] = nid_v; | |
17005 | /* control HP volume/switch on the output mixer amp */ | |
17006 | nid_v = alc861vd_idx_to_mixer_vol( | |
17007 | alc880_fixed_pin_idx(pin)); | |
17008 | nid_s = alc861vd_idx_to_mixer_switch( | |
17009 | alc880_fixed_pin_idx(pin)); | |
17010 | ||
0afe5f89 | 17011 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
17012 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
17013 | if (err < 0) | |
f32610ed | 17014 | return err; |
0afe5f89 | 17015 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
17016 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
17017 | if (err < 0) | |
f32610ed JS |
17018 | return err; |
17019 | } else if (alc880_is_multi_pin(pin)) { | |
17020 | /* set manual connection */ | |
17021 | /* we have only a switch on HP-out PIN */ | |
0afe5f89 | 17022 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
f12ab1e0 TI |
17023 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
17024 | if (err < 0) | |
f32610ed JS |
17025 | return err; |
17026 | } | |
17027 | return 0; | |
17028 | } | |
17029 | ||
17030 | /* parse the BIOS configuration and set up the alc_spec | |
17031 | * return 1 if successful, 0 if the proper config is not found, | |
17032 | * or a negative error code | |
17033 | * Based on ALC880 version - had to change it to override | |
17034 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
17035 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
17036 | { | |
17037 | struct alc_spec *spec = codec->spec; | |
17038 | int err; | |
17039 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
17040 | ||
f12ab1e0 TI |
17041 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
17042 | alc861vd_ignore); | |
17043 | if (err < 0) | |
f32610ed | 17044 | return err; |
f12ab1e0 | 17045 | if (!spec->autocfg.line_outs) |
f32610ed JS |
17046 | return 0; /* can't find valid BIOS pin config */ |
17047 | ||
f12ab1e0 TI |
17048 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
17049 | if (err < 0) | |
17050 | return err; | |
17051 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
17052 | if (err < 0) | |
17053 | return err; | |
17054 | err = alc861vd_auto_create_extra_out(spec, | |
17055 | spec->autocfg.speaker_pins[0], | |
17056 | "Speaker"); | |
17057 | if (err < 0) | |
17058 | return err; | |
17059 | err = alc861vd_auto_create_extra_out(spec, | |
17060 | spec->autocfg.hp_pins[0], | |
17061 | "Headphone"); | |
17062 | if (err < 0) | |
17063 | return err; | |
05f5f477 | 17064 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 17065 | if (err < 0) |
f32610ed JS |
17066 | return err; |
17067 | ||
17068 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
17069 | ||
757899ac | 17070 | alc_auto_parse_digital(codec); |
f32610ed | 17071 | |
603c4019 | 17072 | if (spec->kctls.list) |
d88897ea | 17073 | add_mixer(spec, spec->kctls.list); |
f32610ed | 17074 | |
d88897ea | 17075 | add_verb(spec, alc861vd_volume_init_verbs); |
f32610ed JS |
17076 | |
17077 | spec->num_mux_defs = 1; | |
61b9b9b1 | 17078 | spec->input_mux = &spec->private_imux[0]; |
f32610ed | 17079 | |
776e184e TI |
17080 | err = alc_auto_add_mic_boost(codec); |
17081 | if (err < 0) | |
17082 | return err; | |
17083 | ||
6227cdce | 17084 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 17085 | |
f32610ed JS |
17086 | return 1; |
17087 | } | |
17088 | ||
17089 | /* additional initialization for auto-configuration model */ | |
17090 | static void alc861vd_auto_init(struct hda_codec *codec) | |
17091 | { | |
f6c7e546 | 17092 | struct alc_spec *spec = codec->spec; |
f32610ed JS |
17093 | alc861vd_auto_init_multi_out(codec); |
17094 | alc861vd_auto_init_hp_out(codec); | |
17095 | alc861vd_auto_init_analog_input(codec); | |
f511b01c | 17096 | alc861vd_auto_init_input_src(codec); |
757899ac | 17097 | alc_auto_init_digital(codec); |
f6c7e546 | 17098 | if (spec->unsol_event) |
7fb0d78f | 17099 | alc_inithook(codec); |
f32610ed JS |
17100 | } |
17101 | ||
f8f25ba3 TI |
17102 | enum { |
17103 | ALC660VD_FIX_ASUS_GPIO1 | |
17104 | }; | |
17105 | ||
17106 | /* reset GPIO1 */ | |
f8f25ba3 TI |
17107 | static const struct alc_fixup alc861vd_fixups[] = { |
17108 | [ALC660VD_FIX_ASUS_GPIO1] = { | |
73413b12 TI |
17109 | .verbs = (const struct hda_verb[]) { |
17110 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
17111 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
17112 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
17113 | { } | |
17114 | } | |
f8f25ba3 TI |
17115 | }, |
17116 | }; | |
17117 | ||
17118 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | |
17119 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | |
17120 | {} | |
17121 | }; | |
17122 | ||
f32610ed JS |
17123 | static int patch_alc861vd(struct hda_codec *codec) |
17124 | { | |
17125 | struct alc_spec *spec; | |
17126 | int err, board_config; | |
17127 | ||
17128 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
17129 | if (spec == NULL) | |
17130 | return -ENOMEM; | |
17131 | ||
17132 | codec->spec = spec; | |
17133 | ||
17134 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
17135 | alc861vd_models, | |
17136 | alc861vd_cfg_tbl); | |
17137 | ||
17138 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
9a11f1aa TI |
17139 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
17140 | codec->chip_name); | |
f32610ed JS |
17141 | board_config = ALC861VD_AUTO; |
17142 | } | |
17143 | ||
7fa90e87 TI |
17144 | if (board_config == ALC861VD_AUTO) |
17145 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); | |
f8f25ba3 | 17146 | |
f32610ed JS |
17147 | if (board_config == ALC861VD_AUTO) { |
17148 | /* automatic parse from the BIOS config */ | |
17149 | err = alc861vd_parse_auto_config(codec); | |
17150 | if (err < 0) { | |
17151 | alc_free(codec); | |
17152 | return err; | |
f12ab1e0 | 17153 | } else if (!err) { |
f32610ed JS |
17154 | printk(KERN_INFO |
17155 | "hda_codec: Cannot set up configuration " | |
17156 | "from BIOS. Using base mode...\n"); | |
17157 | board_config = ALC861VD_3ST; | |
17158 | } | |
17159 | } | |
17160 | ||
680cd536 KK |
17161 | err = snd_hda_attach_beep_device(codec, 0x23); |
17162 | if (err < 0) { | |
17163 | alc_free(codec); | |
17164 | return err; | |
17165 | } | |
17166 | ||
f32610ed | 17167 | if (board_config != ALC861VD_AUTO) |
e9c364c0 | 17168 | setup_preset(codec, &alc861vd_presets[board_config]); |
f32610ed | 17169 | |
2f893286 | 17170 | if (codec->vendor_id == 0x10ec0660) { |
f9423e7a | 17171 | /* always turn on EAPD */ |
d88897ea | 17172 | add_verb(spec, alc660vd_eapd_verbs); |
2f893286 KY |
17173 | } |
17174 | ||
f32610ed JS |
17175 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
17176 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
17177 | ||
f32610ed JS |
17178 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
17179 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
17180 | ||
dd704698 TI |
17181 | if (!spec->adc_nids) { |
17182 | spec->adc_nids = alc861vd_adc_nids; | |
17183 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
17184 | } | |
17185 | if (!spec->capsrc_nids) | |
17186 | spec->capsrc_nids = alc861vd_capsrc_nids; | |
f32610ed | 17187 | |
b59bdf3b | 17188 | set_capture_mixer(codec); |
45bdd1c1 | 17189 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
f32610ed | 17190 | |
2134ea4f TI |
17191 | spec->vmaster_nid = 0x02; |
17192 | ||
7fa90e87 TI |
17193 | if (board_config == ALC861VD_AUTO) |
17194 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); | |
17195 | ||
f32610ed JS |
17196 | codec->patch_ops = alc_patch_ops; |
17197 | ||
17198 | if (board_config == ALC861VD_AUTO) | |
17199 | spec->init_hook = alc861vd_auto_init; | |
cb53c626 TI |
17200 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
17201 | if (!spec->loopback.amplist) | |
17202 | spec->loopback.amplist = alc861vd_loopbacks; | |
17203 | #endif | |
f32610ed JS |
17204 | |
17205 | return 0; | |
17206 | } | |
17207 | ||
bc9f98a9 KY |
17208 | /* |
17209 | * ALC662 support | |
17210 | * | |
17211 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
17212 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
17213 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
17214 | * 6-channel independent captures. | |
17215 | * | |
17216 | * In addition, an independent DAC for the multi-playback (not used in this | |
17217 | * driver yet). | |
17218 | */ | |
17219 | #define ALC662_DIGOUT_NID 0x06 | |
17220 | #define ALC662_DIGIN_NID 0x0a | |
17221 | ||
17222 | static hda_nid_t alc662_dac_nids[4] = { | |
17223 | /* front, rear, clfe, rear_surr */ | |
17224 | 0x02, 0x03, 0x04 | |
17225 | }; | |
17226 | ||
622e84cd KY |
17227 | static hda_nid_t alc272_dac_nids[2] = { |
17228 | 0x02, 0x03 | |
17229 | }; | |
17230 | ||
b59bdf3b | 17231 | static hda_nid_t alc662_adc_nids[2] = { |
bc9f98a9 | 17232 | /* ADC1-2 */ |
b59bdf3b | 17233 | 0x09, 0x08 |
bc9f98a9 | 17234 | }; |
e1406348 | 17235 | |
622e84cd KY |
17236 | static hda_nid_t alc272_adc_nids[1] = { |
17237 | /* ADC1-2 */ | |
17238 | 0x08, | |
17239 | }; | |
17240 | ||
b59bdf3b | 17241 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
622e84cd KY |
17242 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
17243 | ||
e1406348 | 17244 | |
bc9f98a9 KY |
17245 | /* input MUX */ |
17246 | /* FIXME: should be a matrix-type input source selection */ | |
bc9f98a9 KY |
17247 | static struct hda_input_mux alc662_capture_source = { |
17248 | .num_items = 4, | |
17249 | .items = { | |
17250 | { "Mic", 0x0 }, | |
17251 | { "Front Mic", 0x1 }, | |
17252 | { "Line", 0x2 }, | |
17253 | { "CD", 0x4 }, | |
17254 | }, | |
17255 | }; | |
17256 | ||
17257 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
17258 | .num_items = 2, | |
17259 | .items = { | |
17260 | { "Mic", 0x1 }, | |
17261 | { "Line", 0x2 }, | |
17262 | }, | |
17263 | }; | |
291702f0 | 17264 | |
6dda9f4a KY |
17265 | static struct hda_input_mux alc663_capture_source = { |
17266 | .num_items = 3, | |
17267 | .items = { | |
17268 | { "Mic", 0x0 }, | |
17269 | { "Front Mic", 0x1 }, | |
17270 | { "Line", 0x2 }, | |
17271 | }, | |
17272 | }; | |
17273 | ||
4f5d1706 | 17274 | #if 0 /* set to 1 for testing other input sources below */ |
9541ba1d CP |
17275 | static struct hda_input_mux alc272_nc10_capture_source = { |
17276 | .num_items = 16, | |
17277 | .items = { | |
17278 | { "Autoselect Mic", 0x0 }, | |
17279 | { "Internal Mic", 0x1 }, | |
17280 | { "In-0x02", 0x2 }, | |
17281 | { "In-0x03", 0x3 }, | |
17282 | { "In-0x04", 0x4 }, | |
17283 | { "In-0x05", 0x5 }, | |
17284 | { "In-0x06", 0x6 }, | |
17285 | { "In-0x07", 0x7 }, | |
17286 | { "In-0x08", 0x8 }, | |
17287 | { "In-0x09", 0x9 }, | |
17288 | { "In-0x0a", 0x0a }, | |
17289 | { "In-0x0b", 0x0b }, | |
17290 | { "In-0x0c", 0x0c }, | |
17291 | { "In-0x0d", 0x0d }, | |
17292 | { "In-0x0e", 0x0e }, | |
17293 | { "In-0x0f", 0x0f }, | |
17294 | }, | |
17295 | }; | |
17296 | #endif | |
17297 | ||
bc9f98a9 KY |
17298 | /* |
17299 | * 2ch mode | |
17300 | */ | |
17301 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
17302 | { 2, NULL } | |
17303 | }; | |
17304 | ||
17305 | /* | |
17306 | * 2ch mode | |
17307 | */ | |
17308 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
17309 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
17310 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17311 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
17312 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17313 | { } /* end */ | |
17314 | }; | |
17315 | ||
17316 | /* | |
17317 | * 6ch mode | |
17318 | */ | |
17319 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
17320 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17321 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17322 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
17323 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17324 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17325 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
17326 | { } /* end */ | |
17327 | }; | |
17328 | ||
17329 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
17330 | { 2, alc662_3ST_ch2_init }, | |
17331 | { 6, alc662_3ST_ch6_init }, | |
17332 | }; | |
17333 | ||
17334 | /* | |
17335 | * 2ch mode | |
17336 | */ | |
17337 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
17338 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17339 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17340 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17341 | { } /* end */ | |
17342 | }; | |
17343 | ||
17344 | /* | |
17345 | * 6ch mode | |
17346 | */ | |
17347 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
17348 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17349 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17350 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17351 | { } /* end */ | |
17352 | }; | |
17353 | ||
17354 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
17355 | { 2, alc662_sixstack_ch6_init }, | |
17356 | { 6, alc662_sixstack_ch8_init }, | |
17357 | }; | |
17358 | ||
17359 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
17360 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
17361 | */ | |
17362 | ||
17363 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
17364 | /* output mixer control */ | |
17365 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
7055ad8a | 17366 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 17367 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
7055ad8a | 17368 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17369 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17370 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
17371 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
17372 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
17373 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17374 | ||
17375 | /*Input mixer control */ | |
17376 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
17377 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
17378 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
17379 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
17380 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
17381 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
17382 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
17383 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
bc9f98a9 KY |
17384 | { } /* end */ |
17385 | }; | |
17386 | ||
17387 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
17388 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 17389 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17390 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17391 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17392 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17393 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17394 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17395 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17396 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17397 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17398 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17399 | { } /* end */ |
17400 | }; | |
17401 | ||
17402 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
17403 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 17404 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 17405 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
7055ad8a | 17406 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17407 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17408 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
17409 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
17410 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
17411 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17412 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17413 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17414 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17415 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17416 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17417 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17418 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17419 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17420 | { } /* end */ |
17421 | }; | |
17422 | ||
17423 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
17424 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17425 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
86cd9298 TI |
17426 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
17427 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
bc9f98a9 KY |
17428 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17429 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17430 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17431 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17432 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17433 | { } /* end */ |
17434 | }; | |
17435 | ||
291702f0 | 17436 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
42171c17 TI |
17437 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
17438 | ALC262_HIPPO_MASTER_SWITCH, | |
291702f0 KY |
17439 | |
17440 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | |
17441 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17442 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17443 | ||
17444 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
17445 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17446 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17447 | { } /* end */ | |
17448 | }; | |
17449 | ||
8c427226 | 17450 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
42171c17 TI |
17451 | ALC262_HIPPO_MASTER_SWITCH, |
17452 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
8c427226 | 17453 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
8c427226 KY |
17454 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17455 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
8c427226 KY |
17456 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
17457 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17458 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17459 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17460 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17461 | { } /* end */ | |
17462 | }; | |
17463 | ||
f1d4e28b KY |
17464 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
17465 | .ops = &snd_hda_bind_vol, | |
17466 | .values = { | |
17467 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17468 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
17469 | 0 | |
17470 | }, | |
17471 | }; | |
17472 | ||
17473 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | |
17474 | .ops = &snd_hda_bind_sw, | |
17475 | .values = { | |
17476 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17477 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17478 | 0 | |
17479 | }, | |
17480 | }; | |
17481 | ||
6dda9f4a | 17482 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
f1d4e28b KY |
17483 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
17484 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | |
17485 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17486 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17487 | { } /* end */ | |
17488 | }; | |
17489 | ||
17490 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | |
17491 | .ops = &snd_hda_bind_sw, | |
17492 | .values = { | |
17493 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17494 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17495 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17496 | 0 | |
17497 | }, | |
17498 | }; | |
17499 | ||
17500 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | |
17501 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17502 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | |
17503 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17504 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17505 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17506 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17507 | ||
17508 | { } /* end */ | |
17509 | }; | |
17510 | ||
17511 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | |
17512 | .ops = &snd_hda_bind_sw, | |
17513 | .values = { | |
17514 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17515 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17516 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17517 | 0 | |
17518 | }, | |
17519 | }; | |
17520 | ||
17521 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | |
17522 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17523 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | |
17524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17526 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17527 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17528 | { } /* end */ | |
17529 | }; | |
17530 | ||
17531 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | |
6dda9f4a KY |
17532 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
17533 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
f1d4e28b KY |
17534 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17535 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17536 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17537 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17538 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17539 | { } /* end */ | |
17540 | }; | |
17541 | ||
17542 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | |
17543 | .ops = &snd_hda_bind_vol, | |
17544 | .values = { | |
17545 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17546 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | |
17547 | 0 | |
17548 | }, | |
17549 | }; | |
17550 | ||
17551 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | |
17552 | .ops = &snd_hda_bind_sw, | |
17553 | .values = { | |
17554 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17555 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | |
17556 | 0 | |
17557 | }, | |
17558 | }; | |
17559 | ||
17560 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | |
17561 | HDA_BIND_VOL("Master Playback Volume", | |
17562 | &alc663_asus_two_bind_master_vol), | |
17563 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17564 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
6dda9f4a KY |
17565 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
17566 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17567 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
f1d4e28b KY |
17568 | { } /* end */ |
17569 | }; | |
17570 | ||
17571 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | |
17572 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17573 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17574 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17575 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17577 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6dda9f4a KY |
17578 | { } /* end */ |
17579 | }; | |
17580 | ||
17581 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
17582 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17583 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17584 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17585 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17586 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17587 | ||
17588 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17589 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17590 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17591 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17592 | { } /* end */ | |
17593 | }; | |
17594 | ||
17595 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
17596 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17597 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17598 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17599 | ||
17600 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17601 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17602 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17603 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17604 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17605 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17606 | { } /* end */ | |
17607 | }; | |
17608 | ||
ebb83eeb KY |
17609 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
17610 | .ops = &snd_hda_bind_sw, | |
17611 | .values = { | |
17612 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17613 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17614 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17615 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17616 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17617 | 0 | |
17618 | }, | |
17619 | }; | |
17620 | ||
17621 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | |
17622 | .ops = &snd_hda_bind_sw, | |
17623 | .values = { | |
17624 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17625 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17626 | 0 | |
17627 | }, | |
17628 | }; | |
17629 | ||
17630 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | |
17631 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17632 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17633 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17634 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17635 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17636 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17637 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17640 | { } /* end */ | |
17641 | }; | |
17642 | ||
17643 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | |
17644 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17645 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17646 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17647 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17648 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17649 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17650 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17651 | { } /* end */ | |
17652 | }; | |
17653 | ||
17654 | ||
bc9f98a9 KY |
17655 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
17656 | { | |
17657 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
17658 | .name = "Channel Mode", | |
17659 | .info = alc_ch_mode_info, | |
17660 | .get = alc_ch_mode_get, | |
17661 | .put = alc_ch_mode_put, | |
17662 | }, | |
17663 | { } /* end */ | |
17664 | }; | |
17665 | ||
17666 | static struct hda_verb alc662_init_verbs[] = { | |
17667 | /* ADC: mute amp left and right */ | |
17668 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17669 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
bc9f98a9 | 17670 | |
b60dd394 KY |
17671 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
17672 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17673 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17674 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17675 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17676 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
17677 | |
17678 | /* Front Pin: output 0 (0x0c) */ | |
17679 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17680 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17681 | ||
17682 | /* Rear Pin: output 1 (0x0d) */ | |
17683 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17685 | ||
17686 | /* CLFE Pin: output 2 (0x0e) */ | |
17687 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17688 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17689 | ||
17690 | /* Mic (rear) pin: input vref at 80% */ | |
17691 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17692 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17693 | /* Front Mic pin: input vref at 80% */ | |
17694 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17695 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17696 | /* Line In pin: input */ | |
17697 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17698 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17699 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
17700 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17701 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17702 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
17703 | /* CD pin widget for input */ | |
17704 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17705 | ||
17706 | /* FIXME: use matrix-type input source selection */ | |
17707 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
17708 | /* Input mixer */ | |
17709 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
291702f0 | 17710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
6dda9f4a KY |
17711 | |
17712 | /* always trun on EAPD */ | |
17713 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17714 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17715 | ||
bc9f98a9 KY |
17716 | { } |
17717 | }; | |
17718 | ||
cec27c89 KY |
17719 | static struct hda_verb alc663_init_verbs[] = { |
17720 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17721 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17722 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17723 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17724 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17725 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17726 | { } | |
17727 | }; | |
17728 | ||
17729 | static struct hda_verb alc272_init_verbs[] = { | |
17730 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17731 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17732 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17733 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17734 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17735 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17736 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17737 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17738 | { } | |
17739 | }; | |
17740 | ||
bc9f98a9 KY |
17741 | static struct hda_verb alc662_sue_init_verbs[] = { |
17742 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17743 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
291702f0 KY |
17744 | {} |
17745 | }; | |
17746 | ||
17747 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
17748 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17749 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17750 | {} | |
bc9f98a9 KY |
17751 | }; |
17752 | ||
8c427226 KY |
17753 | /* Set Unsolicited Event*/ |
17754 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
17755 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17756 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17757 | {} | |
17758 | }; | |
17759 | ||
6dda9f4a | 17760 | static struct hda_verb alc663_m51va_init_verbs[] = { |
f1d4e28b KY |
17761 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
17762 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6dda9f4a KY |
17763 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
17764 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f1d4e28b KY |
17765 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
17766 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17767 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17768 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17769 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17770 | {} | |
17771 | }; | |
17772 | ||
17773 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | |
17774 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17775 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17776 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17777 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17778 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17779 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17780 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17781 | {} | |
17782 | }; | |
17783 | ||
17784 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | |
17785 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17786 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17787 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17788 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17789 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17790 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17791 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17792 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17793 | {} | |
17794 | }; | |
6dda9f4a | 17795 | |
f1d4e28b KY |
17796 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
17797 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17798 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17799 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17800 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17802 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17803 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17804 | {} | |
17805 | }; | |
6dda9f4a | 17806 | |
f1d4e28b KY |
17807 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
17808 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17809 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17810 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17811 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
17812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17814 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
17815 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6dda9f4a KY |
17817 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
17818 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f1d4e28b KY |
17819 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
17820 | {} | |
17821 | }; | |
17822 | ||
17823 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | |
17824 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17825 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17826 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17827 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17828 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17829 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17830 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17831 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17832 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17833 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17834 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17835 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6dda9f4a KY |
17836 | {} |
17837 | }; | |
17838 | ||
17839 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
17840 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17841 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
17842 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
17843 | ||
17844 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17845 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17846 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17847 | ||
17848 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17849 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
17850 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
17851 | {} | |
17852 | }; | |
17853 | ||
17854 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
17855 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17856 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17857 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17858 | ||
17859 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17860 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17861 | {} | |
17862 | }; | |
17863 | ||
f1d4e28b KY |
17864 | static struct hda_verb alc662_ecs_init_verbs[] = { |
17865 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | |
17866 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17867 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17868 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17869 | {} | |
17870 | }; | |
17871 | ||
622e84cd KY |
17872 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
17873 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17874 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17875 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17876 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17877 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17878 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17879 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17880 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17881 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17882 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17883 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17884 | {} | |
17885 | }; | |
17886 | ||
17887 | static struct hda_verb alc272_dell_init_verbs[] = { | |
17888 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17889 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17890 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17891 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17892 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17893 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17894 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17895 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17896 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17897 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17898 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17899 | {} | |
17900 | }; | |
17901 | ||
ebb83eeb KY |
17902 | static struct hda_verb alc663_mode7_init_verbs[] = { |
17903 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17904 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17905 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17906 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17907 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17908 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17909 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
17910 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17911 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17912 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17913 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17914 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17915 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17916 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17917 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17918 | {} | |
17919 | }; | |
17920 | ||
17921 | static struct hda_verb alc663_mode8_init_verbs[] = { | |
17922 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17925 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
17926 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17927 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17928 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17929 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17930 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17931 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17932 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17934 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17935 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17936 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17937 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17938 | {} | |
17939 | }; | |
17940 | ||
f1d4e28b KY |
17941 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
17942 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
17943 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
17944 | { } /* end */ | |
17945 | }; | |
17946 | ||
622e84cd KY |
17947 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
17948 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
17949 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
17950 | { } /* end */ | |
17951 | }; | |
17952 | ||
bc9f98a9 KY |
17953 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
17954 | { | |
17955 | unsigned int present; | |
f12ab1e0 | 17956 | unsigned char bits; |
bc9f98a9 | 17957 | |
864f92be | 17958 | present = snd_hda_jack_detect(codec, 0x14); |
47fd830a | 17959 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 17960 | |
47fd830a TI |
17961 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
17962 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
17963 | } |
17964 | ||
17965 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
17966 | { | |
17967 | unsigned int present; | |
f12ab1e0 | 17968 | unsigned char bits; |
bc9f98a9 | 17969 | |
864f92be | 17970 | present = snd_hda_jack_detect(codec, 0x1b); |
47fd830a | 17971 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 17972 | |
47fd830a TI |
17973 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
17974 | HDA_AMP_MUTE, bits); | |
17975 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
17976 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
17977 | } |
17978 | ||
17979 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
17980 | unsigned int res) | |
17981 | { | |
17982 | if ((res >> 26) == ALC880_HP_EVENT) | |
17983 | alc662_lenovo_101e_all_automute(codec); | |
17984 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
17985 | alc662_lenovo_101e_ispeaker_automute(codec); | |
17986 | } | |
17987 | ||
291702f0 KY |
17988 | /* unsolicited event for HP jack sensing */ |
17989 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
17990 | unsigned int res) | |
17991 | { | |
291702f0 | 17992 | if ((res >> 26) == ALC880_MIC_EVENT) |
4f5d1706 | 17993 | alc_mic_automute(codec); |
42171c17 TI |
17994 | else |
17995 | alc262_hippo_unsol_event(codec, res); | |
291702f0 KY |
17996 | } |
17997 | ||
4f5d1706 TI |
17998 | static void alc662_eeepc_setup(struct hda_codec *codec) |
17999 | { | |
18000 | struct alc_spec *spec = codec->spec; | |
18001 | ||
18002 | alc262_hippo1_setup(codec); | |
18003 | spec->ext_mic.pin = 0x18; | |
18004 | spec->ext_mic.mux_idx = 0; | |
18005 | spec->int_mic.pin = 0x19; | |
18006 | spec->int_mic.mux_idx = 1; | |
18007 | spec->auto_mic = 1; | |
18008 | } | |
18009 | ||
291702f0 KY |
18010 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
18011 | { | |
4f5d1706 TI |
18012 | alc262_hippo_automute(codec); |
18013 | alc_mic_automute(codec); | |
291702f0 KY |
18014 | } |
18015 | ||
4f5d1706 | 18016 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
8c427226 | 18017 | { |
42171c17 TI |
18018 | struct alc_spec *spec = codec->spec; |
18019 | ||
18020 | spec->autocfg.hp_pins[0] = 0x14; | |
18021 | spec->autocfg.speaker_pins[0] = 0x1b; | |
8c427226 KY |
18022 | } |
18023 | ||
4f5d1706 TI |
18024 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
18025 | ||
6dda9f4a KY |
18026 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
18027 | { | |
18028 | unsigned int present; | |
18029 | unsigned char bits; | |
18030 | ||
864f92be | 18031 | present = snd_hda_jack_detect(codec, 0x21); |
6dda9f4a | 18032 | bits = present ? HDA_AMP_MUTE : 0; |
f1d4e28b | 18033 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 18034 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18035 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18036 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
18037 | } |
18038 | ||
18039 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |
18040 | { | |
18041 | unsigned int present; | |
18042 | unsigned char bits; | |
18043 | ||
864f92be | 18044 | present = snd_hda_jack_detect(codec, 0x21); |
f1d4e28b KY |
18045 | bits = present ? HDA_AMP_MUTE : 0; |
18046 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 18047 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18048 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18049 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18050 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
5dbd5ec6 | 18051 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18052 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
5dbd5ec6 | 18053 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
18054 | } |
18055 | ||
18056 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |
18057 | { | |
18058 | unsigned int present; | |
18059 | unsigned char bits; | |
18060 | ||
864f92be | 18061 | present = snd_hda_jack_detect(codec, 0x15); |
f1d4e28b KY |
18062 | bits = present ? HDA_AMP_MUTE : 0; |
18063 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 18064 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18065 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18066 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18067 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
5dbd5ec6 | 18068 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18069 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
5dbd5ec6 | 18070 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
18071 | } |
18072 | ||
18073 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | |
18074 | { | |
18075 | unsigned int present; | |
18076 | unsigned char bits; | |
18077 | ||
864f92be | 18078 | present = snd_hda_jack_detect(codec, 0x1b); |
f1d4e28b KY |
18079 | bits = present ? 0 : PIN_OUT; |
18080 | snd_hda_codec_write(codec, 0x14, 0, | |
18081 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
18082 | } | |
18083 | ||
18084 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | |
18085 | { | |
18086 | unsigned int present1, present2; | |
18087 | ||
864f92be WF |
18088 | present1 = snd_hda_jack_detect(codec, 0x21); |
18089 | present2 = snd_hda_jack_detect(codec, 0x15); | |
f1d4e28b KY |
18090 | |
18091 | if (present1 || present2) { | |
18092 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18093 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18094 | } else { | |
18095 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18096 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18097 | } | |
18098 | } | |
18099 | ||
18100 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |
18101 | { | |
18102 | unsigned int present1, present2; | |
18103 | ||
864f92be WF |
18104 | present1 = snd_hda_jack_detect(codec, 0x1b); |
18105 | present2 = snd_hda_jack_detect(codec, 0x15); | |
f1d4e28b KY |
18106 | |
18107 | if (present1 || present2) { | |
18108 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 18109 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
f1d4e28b | 18110 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18111 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
f1d4e28b KY |
18112 | } else { |
18113 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 18114 | HDA_AMP_MUTE, 0); |
f1d4e28b | 18115 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18116 | HDA_AMP_MUTE, 0); |
f1d4e28b | 18117 | } |
6dda9f4a KY |
18118 | } |
18119 | ||
ebb83eeb KY |
18120 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
18121 | { | |
18122 | unsigned int present1, present2; | |
18123 | ||
18124 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | |
18125 | AC_VERB_GET_PIN_SENSE, 0) | |
18126 | & AC_PINSENSE_PRESENCE; | |
18127 | present2 = snd_hda_codec_read(codec, 0x21, 0, | |
18128 | AC_VERB_GET_PIN_SENSE, 0) | |
18129 | & AC_PINSENSE_PRESENCE; | |
18130 | ||
18131 | if (present1 || present2) { | |
18132 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18133 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18134 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18135 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18136 | } else { | |
18137 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18138 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18139 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18140 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18141 | } | |
18142 | } | |
18143 | ||
18144 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | |
18145 | { | |
18146 | unsigned int present1, present2; | |
18147 | ||
18148 | present1 = snd_hda_codec_read(codec, 0x21, 0, | |
18149 | AC_VERB_GET_PIN_SENSE, 0) | |
18150 | & AC_PINSENSE_PRESENCE; | |
18151 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
18152 | AC_VERB_GET_PIN_SENSE, 0) | |
18153 | & AC_PINSENSE_PRESENCE; | |
18154 | ||
18155 | if (present1 || present2) { | |
18156 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18157 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18158 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18159 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18160 | } else { | |
18161 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18162 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18163 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18164 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18165 | } | |
18166 | } | |
18167 | ||
6dda9f4a KY |
18168 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
18169 | unsigned int res) | |
18170 | { | |
18171 | switch (res >> 26) { | |
18172 | case ALC880_HP_EVENT: | |
18173 | alc663_m51va_speaker_automute(codec); | |
18174 | break; | |
18175 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18176 | alc_mic_automute(codec); |
6dda9f4a KY |
18177 | break; |
18178 | } | |
18179 | } | |
18180 | ||
4f5d1706 TI |
18181 | static void alc663_m51va_setup(struct hda_codec *codec) |
18182 | { | |
18183 | struct alc_spec *spec = codec->spec; | |
18184 | spec->ext_mic.pin = 0x18; | |
18185 | spec->ext_mic.mux_idx = 0; | |
18186 | spec->int_mic.pin = 0x12; | |
ebb83eeb | 18187 | spec->int_mic.mux_idx = 9; |
4f5d1706 TI |
18188 | spec->auto_mic = 1; |
18189 | } | |
18190 | ||
6dda9f4a KY |
18191 | static void alc663_m51va_inithook(struct hda_codec *codec) |
18192 | { | |
18193 | alc663_m51va_speaker_automute(codec); | |
4f5d1706 | 18194 | alc_mic_automute(codec); |
6dda9f4a KY |
18195 | } |
18196 | ||
f1d4e28b | 18197 | /* ***************** Mode1 ******************************/ |
4f5d1706 | 18198 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
ebb83eeb KY |
18199 | |
18200 | static void alc663_mode1_setup(struct hda_codec *codec) | |
18201 | { | |
18202 | struct alc_spec *spec = codec->spec; | |
18203 | spec->ext_mic.pin = 0x18; | |
18204 | spec->ext_mic.mux_idx = 0; | |
18205 | spec->int_mic.pin = 0x19; | |
18206 | spec->int_mic.mux_idx = 1; | |
18207 | spec->auto_mic = 1; | |
18208 | } | |
18209 | ||
4f5d1706 | 18210 | #define alc663_mode1_inithook alc663_m51va_inithook |
f1d4e28b | 18211 | |
f1d4e28b KY |
18212 | /* ***************** Mode2 ******************************/ |
18213 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | |
18214 | unsigned int res) | |
18215 | { | |
18216 | switch (res >> 26) { | |
18217 | case ALC880_HP_EVENT: | |
18218 | alc662_f5z_speaker_automute(codec); | |
18219 | break; | |
18220 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18221 | alc_mic_automute(codec); |
f1d4e28b KY |
18222 | break; |
18223 | } | |
18224 | } | |
18225 | ||
ebb83eeb | 18226 | #define alc662_mode2_setup alc663_mode1_setup |
4f5d1706 | 18227 | |
f1d4e28b KY |
18228 | static void alc662_mode2_inithook(struct hda_codec *codec) |
18229 | { | |
18230 | alc662_f5z_speaker_automute(codec); | |
4f5d1706 | 18231 | alc_mic_automute(codec); |
f1d4e28b KY |
18232 | } |
18233 | /* ***************** Mode3 ******************************/ | |
18234 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | |
18235 | unsigned int res) | |
18236 | { | |
18237 | switch (res >> 26) { | |
18238 | case ALC880_HP_EVENT: | |
18239 | alc663_two_hp_m1_speaker_automute(codec); | |
18240 | break; | |
18241 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18242 | alc_mic_automute(codec); |
f1d4e28b KY |
18243 | break; |
18244 | } | |
18245 | } | |
18246 | ||
ebb83eeb | 18247 | #define alc663_mode3_setup alc663_mode1_setup |
4f5d1706 | 18248 | |
f1d4e28b KY |
18249 | static void alc663_mode3_inithook(struct hda_codec *codec) |
18250 | { | |
18251 | alc663_two_hp_m1_speaker_automute(codec); | |
4f5d1706 | 18252 | alc_mic_automute(codec); |
f1d4e28b KY |
18253 | } |
18254 | /* ***************** Mode4 ******************************/ | |
18255 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | |
18256 | unsigned int res) | |
18257 | { | |
18258 | switch (res >> 26) { | |
18259 | case ALC880_HP_EVENT: | |
18260 | alc663_21jd_two_speaker_automute(codec); | |
18261 | break; | |
18262 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18263 | alc_mic_automute(codec); |
f1d4e28b KY |
18264 | break; |
18265 | } | |
18266 | } | |
18267 | ||
ebb83eeb | 18268 | #define alc663_mode4_setup alc663_mode1_setup |
4f5d1706 | 18269 | |
f1d4e28b KY |
18270 | static void alc663_mode4_inithook(struct hda_codec *codec) |
18271 | { | |
18272 | alc663_21jd_two_speaker_automute(codec); | |
4f5d1706 | 18273 | alc_mic_automute(codec); |
f1d4e28b KY |
18274 | } |
18275 | /* ***************** Mode5 ******************************/ | |
18276 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | |
18277 | unsigned int res) | |
18278 | { | |
18279 | switch (res >> 26) { | |
18280 | case ALC880_HP_EVENT: | |
18281 | alc663_15jd_two_speaker_automute(codec); | |
18282 | break; | |
18283 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18284 | alc_mic_automute(codec); |
f1d4e28b KY |
18285 | break; |
18286 | } | |
18287 | } | |
18288 | ||
ebb83eeb | 18289 | #define alc663_mode5_setup alc663_mode1_setup |
4f5d1706 | 18290 | |
f1d4e28b KY |
18291 | static void alc663_mode5_inithook(struct hda_codec *codec) |
18292 | { | |
18293 | alc663_15jd_two_speaker_automute(codec); | |
4f5d1706 | 18294 | alc_mic_automute(codec); |
f1d4e28b KY |
18295 | } |
18296 | /* ***************** Mode6 ******************************/ | |
18297 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | |
18298 | unsigned int res) | |
18299 | { | |
18300 | switch (res >> 26) { | |
18301 | case ALC880_HP_EVENT: | |
18302 | alc663_two_hp_m2_speaker_automute(codec); | |
18303 | break; | |
18304 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18305 | alc_mic_automute(codec); |
f1d4e28b KY |
18306 | break; |
18307 | } | |
18308 | } | |
18309 | ||
ebb83eeb | 18310 | #define alc663_mode6_setup alc663_mode1_setup |
4f5d1706 | 18311 | |
f1d4e28b KY |
18312 | static void alc663_mode6_inithook(struct hda_codec *codec) |
18313 | { | |
18314 | alc663_two_hp_m2_speaker_automute(codec); | |
4f5d1706 | 18315 | alc_mic_automute(codec); |
f1d4e28b KY |
18316 | } |
18317 | ||
ebb83eeb KY |
18318 | /* ***************** Mode7 ******************************/ |
18319 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | |
18320 | unsigned int res) | |
18321 | { | |
18322 | switch (res >> 26) { | |
18323 | case ALC880_HP_EVENT: | |
18324 | alc663_two_hp_m7_speaker_automute(codec); | |
18325 | break; | |
18326 | case ALC880_MIC_EVENT: | |
18327 | alc_mic_automute(codec); | |
18328 | break; | |
18329 | } | |
18330 | } | |
18331 | ||
18332 | #define alc663_mode7_setup alc663_mode1_setup | |
18333 | ||
18334 | static void alc663_mode7_inithook(struct hda_codec *codec) | |
18335 | { | |
18336 | alc663_two_hp_m7_speaker_automute(codec); | |
18337 | alc_mic_automute(codec); | |
18338 | } | |
18339 | ||
18340 | /* ***************** Mode8 ******************************/ | |
18341 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | |
18342 | unsigned int res) | |
18343 | { | |
18344 | switch (res >> 26) { | |
18345 | case ALC880_HP_EVENT: | |
18346 | alc663_two_hp_m8_speaker_automute(codec); | |
18347 | break; | |
18348 | case ALC880_MIC_EVENT: | |
18349 | alc_mic_automute(codec); | |
18350 | break; | |
18351 | } | |
18352 | } | |
18353 | ||
18354 | #define alc663_mode8_setup alc663_m51va_setup | |
18355 | ||
18356 | static void alc663_mode8_inithook(struct hda_codec *codec) | |
18357 | { | |
18358 | alc663_two_hp_m8_speaker_automute(codec); | |
18359 | alc_mic_automute(codec); | |
18360 | } | |
18361 | ||
6dda9f4a KY |
18362 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
18363 | { | |
18364 | unsigned int present; | |
18365 | unsigned char bits; | |
18366 | ||
864f92be | 18367 | present = snd_hda_jack_detect(codec, 0x21); |
6dda9f4a KY |
18368 | bits = present ? HDA_AMP_MUTE : 0; |
18369 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
18370 | HDA_AMP_MUTE, bits); | |
18371 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18372 | HDA_AMP_MUTE, bits); | |
18373 | } | |
18374 | ||
18375 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
18376 | { | |
18377 | unsigned int present; | |
18378 | unsigned char bits; | |
18379 | ||
864f92be | 18380 | present = snd_hda_jack_detect(codec, 0x15); |
6dda9f4a KY |
18381 | bits = present ? HDA_AMP_MUTE : 0; |
18382 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18383 | HDA_AMP_MUTE, bits); | |
18384 | } | |
18385 | ||
18386 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
18387 | unsigned int res) | |
18388 | { | |
18389 | switch (res >> 26) { | |
18390 | case ALC880_HP_EVENT: | |
18391 | alc663_g71v_hp_automute(codec); | |
18392 | break; | |
18393 | case ALC880_FRONT_EVENT: | |
18394 | alc663_g71v_front_automute(codec); | |
18395 | break; | |
18396 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18397 | alc_mic_automute(codec); |
6dda9f4a KY |
18398 | break; |
18399 | } | |
18400 | } | |
18401 | ||
4f5d1706 TI |
18402 | #define alc663_g71v_setup alc663_m51va_setup |
18403 | ||
6dda9f4a KY |
18404 | static void alc663_g71v_inithook(struct hda_codec *codec) |
18405 | { | |
18406 | alc663_g71v_front_automute(codec); | |
18407 | alc663_g71v_hp_automute(codec); | |
4f5d1706 | 18408 | alc_mic_automute(codec); |
6dda9f4a KY |
18409 | } |
18410 | ||
18411 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
18412 | unsigned int res) | |
18413 | { | |
18414 | switch (res >> 26) { | |
18415 | case ALC880_HP_EVENT: | |
18416 | alc663_m51va_speaker_automute(codec); | |
18417 | break; | |
18418 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18419 | alc_mic_automute(codec); |
6dda9f4a KY |
18420 | break; |
18421 | } | |
18422 | } | |
18423 | ||
4f5d1706 TI |
18424 | #define alc663_g50v_setup alc663_m51va_setup |
18425 | ||
6dda9f4a KY |
18426 | static void alc663_g50v_inithook(struct hda_codec *codec) |
18427 | { | |
18428 | alc663_m51va_speaker_automute(codec); | |
4f5d1706 | 18429 | alc_mic_automute(codec); |
6dda9f4a KY |
18430 | } |
18431 | ||
f1d4e28b KY |
18432 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
18433 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
42171c17 | 18434 | ALC262_HIPPO_MASTER_SWITCH, |
f1d4e28b KY |
18435 | |
18436 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | |
18437 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18438 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18439 | ||
18440 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
18441 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18442 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18443 | { } /* end */ | |
18444 | }; | |
18445 | ||
9541ba1d CP |
18446 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
18447 | /* Master Playback automatically created from Speaker and Headphone */ | |
18448 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
18449 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
18450 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
18451 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
18452 | ||
18453 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18454 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18455 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
18456 | ||
18457 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18458 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18459 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
18460 | { } /* end */ | |
18461 | }; | |
18462 | ||
cb53c626 TI |
18463 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
18464 | #define alc662_loopbacks alc880_loopbacks | |
18465 | #endif | |
18466 | ||
bc9f98a9 | 18467 | |
def319f9 | 18468 | /* pcm configuration: identical with ALC880 */ |
bc9f98a9 KY |
18469 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
18470 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
18471 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
18472 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
18473 | ||
18474 | /* | |
18475 | * configuration and preset | |
18476 | */ | |
18477 | static const char *alc662_models[ALC662_MODEL_LAST] = { | |
18478 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
18479 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
18480 | [ALC662_3ST_6ch] = "3stack-6ch", | |
18481 | [ALC662_5ST_DIG] = "6stack-dig", | |
18482 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
b995d76d | 18483 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
8c427226 | 18484 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
f1d4e28b | 18485 | [ALC662_ECS] = "ecs", |
6dda9f4a KY |
18486 | [ALC663_ASUS_M51VA] = "m51va", |
18487 | [ALC663_ASUS_G71V] = "g71v", | |
18488 | [ALC663_ASUS_H13] = "h13", | |
18489 | [ALC663_ASUS_G50V] = "g50v", | |
f1d4e28b KY |
18490 | [ALC663_ASUS_MODE1] = "asus-mode1", |
18491 | [ALC662_ASUS_MODE2] = "asus-mode2", | |
18492 | [ALC663_ASUS_MODE3] = "asus-mode3", | |
18493 | [ALC663_ASUS_MODE4] = "asus-mode4", | |
18494 | [ALC663_ASUS_MODE5] = "asus-mode5", | |
18495 | [ALC663_ASUS_MODE6] = "asus-mode6", | |
ebb83eeb KY |
18496 | [ALC663_ASUS_MODE7] = "asus-mode7", |
18497 | [ALC663_ASUS_MODE8] = "asus-mode8", | |
01f2bd48 TI |
18498 | [ALC272_DELL] = "dell", |
18499 | [ALC272_DELL_ZM1] = "dell-zm1", | |
9541ba1d | 18500 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
bc9f98a9 KY |
18501 | [ALC662_AUTO] = "auto", |
18502 | }; | |
18503 | ||
18504 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
dea0a509 | 18505 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
622e84cd KY |
18506 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
18507 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), | |
f1d4e28b | 18508 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
dea0a509 | 18509 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
cec27c89 | 18510 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
dea0a509 | 18511 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
f1d4e28b | 18512 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
dea0a509 | 18513 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
f1d4e28b | 18514 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
ebb83eeb KY |
18515 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
18516 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | |
f1d4e28b | 18517 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
ebb83eeb KY |
18518 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
18519 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | |
18520 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | |
18521 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | |
18522 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | |
dea0a509 | 18523 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
ebb83eeb KY |
18524 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
18525 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | |
dea0a509 TI |
18526 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
18527 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | |
18528 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | |
18529 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | |
ebb83eeb | 18530 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
622e84cd KY |
18531 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
18532 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | |
18533 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | |
f1d4e28b | 18534 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
dea0a509 TI |
18535 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
18536 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | |
18537 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | |
622e84cd | 18538 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
f1d4e28b | 18539 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
dea0a509 TI |
18540 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
18541 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | |
18542 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ | |
f1d4e28b | 18543 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
f1d4e28b | 18544 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
622e84cd | 18545 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
cec27c89 | 18546 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
622e84cd KY |
18547 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
18548 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), | |
dea0a509 TI |
18549 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
18550 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | |
18551 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | |
622e84cd | 18552 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
dea0a509 TI |
18553 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
18554 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | |
622e84cd | 18555 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
dea0a509 TI |
18556 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
18557 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | |
18558 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | |
18559 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | |
18560 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | |
622e84cd | 18561 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
dea0a509 | 18562 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
f1d4e28b | 18563 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
dea0a509 TI |
18564 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
18565 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | |
18566 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | |
18567 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | |
95fe5f2c HRK |
18568 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
18569 | ALC662_3ST_6ch_DIG), | |
4dee8baa | 18570 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
9541ba1d | 18571 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
cb55974c HRK |
18572 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
18573 | ALC662_3ST_6ch_DIG), | |
6227cdce | 18574 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
19c009aa | 18575 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
5bd3729f | 18576 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
dea0a509 | 18577 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
238713d4 | 18578 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
19c009aa | 18579 | ALC662_3ST_6ch_DIG), |
dea0a509 TI |
18580 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
18581 | ALC663_ASUS_H13), | |
bc9f98a9 KY |
18582 | {} |
18583 | }; | |
18584 | ||
18585 | static struct alc_config_preset alc662_presets[] = { | |
18586 | [ALC662_3ST_2ch_DIG] = { | |
f9e336f6 | 18587 | .mixers = { alc662_3ST_2ch_mixer }, |
bc9f98a9 KY |
18588 | .init_verbs = { alc662_init_verbs }, |
18589 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18590 | .dac_nids = alc662_dac_nids, | |
18591 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18592 | .dig_in_nid = ALC662_DIGIN_NID, |
18593 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18594 | .channel_mode = alc662_3ST_2ch_modes, | |
18595 | .input_mux = &alc662_capture_source, | |
18596 | }, | |
18597 | [ALC662_3ST_6ch_DIG] = { | |
f9e336f6 | 18598 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18599 | .init_verbs = { alc662_init_verbs }, |
18600 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18601 | .dac_nids = alc662_dac_nids, | |
18602 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18603 | .dig_in_nid = ALC662_DIGIN_NID, |
18604 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18605 | .channel_mode = alc662_3ST_6ch_modes, | |
18606 | .need_dac_fix = 1, | |
18607 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 18608 | }, |
bc9f98a9 | 18609 | [ALC662_3ST_6ch] = { |
f9e336f6 | 18610 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18611 | .init_verbs = { alc662_init_verbs }, |
18612 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18613 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
18614 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
18615 | .channel_mode = alc662_3ST_6ch_modes, | |
18616 | .need_dac_fix = 1, | |
18617 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 18618 | }, |
bc9f98a9 | 18619 | [ALC662_5ST_DIG] = { |
f9e336f6 | 18620 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18621 | .init_verbs = { alc662_init_verbs }, |
18622 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18623 | .dac_nids = alc662_dac_nids, | |
18624 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18625 | .dig_in_nid = ALC662_DIGIN_NID, |
18626 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
18627 | .channel_mode = alc662_5stack_modes, | |
18628 | .input_mux = &alc662_capture_source, | |
18629 | }, | |
18630 | [ALC662_LENOVO_101E] = { | |
f9e336f6 | 18631 | .mixers = { alc662_lenovo_101e_mixer }, |
bc9f98a9 KY |
18632 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
18633 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18634 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
18635 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
18636 | .channel_mode = alc662_3ST_2ch_modes, | |
18637 | .input_mux = &alc662_lenovo_101e_capture_source, | |
18638 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
18639 | .init_hook = alc662_lenovo_101e_all_automute, | |
18640 | }, | |
291702f0 | 18641 | [ALC662_ASUS_EEEPC_P701] = { |
f9e336f6 | 18642 | .mixers = { alc662_eeepc_p701_mixer }, |
291702f0 KY |
18643 | .init_verbs = { alc662_init_verbs, |
18644 | alc662_eeepc_sue_init_verbs }, | |
18645 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18646 | .dac_nids = alc662_dac_nids, | |
291702f0 KY |
18647 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
18648 | .channel_mode = alc662_3ST_2ch_modes, | |
291702f0 | 18649 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18650 | .setup = alc662_eeepc_setup, |
291702f0 KY |
18651 | .init_hook = alc662_eeepc_inithook, |
18652 | }, | |
8c427226 | 18653 | [ALC662_ASUS_EEEPC_EP20] = { |
f9e336f6 | 18654 | .mixers = { alc662_eeepc_ep20_mixer, |
8c427226 KY |
18655 | alc662_chmode_mixer }, |
18656 | .init_verbs = { alc662_init_verbs, | |
18657 | alc662_eeepc_ep20_sue_init_verbs }, | |
18658 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18659 | .dac_nids = alc662_dac_nids, | |
8c427226 KY |
18660 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
18661 | .channel_mode = alc662_3ST_6ch_modes, | |
18662 | .input_mux = &alc662_lenovo_101e_capture_source, | |
42171c17 | 18663 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18664 | .setup = alc662_eeepc_ep20_setup, |
8c427226 KY |
18665 | .init_hook = alc662_eeepc_ep20_inithook, |
18666 | }, | |
f1d4e28b | 18667 | [ALC662_ECS] = { |
f9e336f6 | 18668 | .mixers = { alc662_ecs_mixer }, |
f1d4e28b KY |
18669 | .init_verbs = { alc662_init_verbs, |
18670 | alc662_ecs_init_verbs }, | |
18671 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18672 | .dac_nids = alc662_dac_nids, | |
18673 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18674 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18675 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18676 | .setup = alc662_eeepc_setup, |
f1d4e28b KY |
18677 | .init_hook = alc662_eeepc_inithook, |
18678 | }, | |
6dda9f4a | 18679 | [ALC663_ASUS_M51VA] = { |
f9e336f6 | 18680 | .mixers = { alc663_m51va_mixer }, |
6dda9f4a KY |
18681 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
18682 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18683 | .dac_nids = alc662_dac_nids, | |
18684 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18685 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18686 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a | 18687 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18688 | .setup = alc663_m51va_setup, |
6dda9f4a KY |
18689 | .init_hook = alc663_m51va_inithook, |
18690 | }, | |
18691 | [ALC663_ASUS_G71V] = { | |
f9e336f6 | 18692 | .mixers = { alc663_g71v_mixer }, |
6dda9f4a KY |
18693 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
18694 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18695 | .dac_nids = alc662_dac_nids, | |
18696 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18697 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18698 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a | 18699 | .unsol_event = alc663_g71v_unsol_event, |
4f5d1706 | 18700 | .setup = alc663_g71v_setup, |
6dda9f4a KY |
18701 | .init_hook = alc663_g71v_inithook, |
18702 | }, | |
18703 | [ALC663_ASUS_H13] = { | |
f9e336f6 | 18704 | .mixers = { alc663_m51va_mixer }, |
6dda9f4a KY |
18705 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
18706 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18707 | .dac_nids = alc662_dac_nids, | |
18708 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18709 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a KY |
18710 | .unsol_event = alc663_m51va_unsol_event, |
18711 | .init_hook = alc663_m51va_inithook, | |
18712 | }, | |
18713 | [ALC663_ASUS_G50V] = { | |
f9e336f6 | 18714 | .mixers = { alc663_g50v_mixer }, |
6dda9f4a KY |
18715 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
18716 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18717 | .dac_nids = alc662_dac_nids, | |
18718 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18719 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18720 | .channel_mode = alc662_3ST_6ch_modes, | |
18721 | .input_mux = &alc663_capture_source, | |
18722 | .unsol_event = alc663_g50v_unsol_event, | |
4f5d1706 | 18723 | .setup = alc663_g50v_setup, |
6dda9f4a KY |
18724 | .init_hook = alc663_g50v_inithook, |
18725 | }, | |
f1d4e28b | 18726 | [ALC663_ASUS_MODE1] = { |
f9e336f6 TI |
18727 | .mixers = { alc663_m51va_mixer }, |
18728 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18729 | .init_verbs = { alc662_init_verbs, |
18730 | alc663_21jd_amic_init_verbs }, | |
18731 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18732 | .hp_nid = 0x03, | |
18733 | .dac_nids = alc662_dac_nids, | |
18734 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18735 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18736 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18737 | .unsol_event = alc663_mode1_unsol_event, |
4f5d1706 | 18738 | .setup = alc663_mode1_setup, |
f1d4e28b KY |
18739 | .init_hook = alc663_mode1_inithook, |
18740 | }, | |
18741 | [ALC662_ASUS_MODE2] = { | |
f9e336f6 TI |
18742 | .mixers = { alc662_1bjd_mixer }, |
18743 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18744 | .init_verbs = { alc662_init_verbs, |
18745 | alc662_1bjd_amic_init_verbs }, | |
18746 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18747 | .dac_nids = alc662_dac_nids, | |
18748 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18749 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18750 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18751 | .unsol_event = alc662_mode2_unsol_event, |
4f5d1706 | 18752 | .setup = alc662_mode2_setup, |
f1d4e28b KY |
18753 | .init_hook = alc662_mode2_inithook, |
18754 | }, | |
18755 | [ALC663_ASUS_MODE3] = { | |
f9e336f6 TI |
18756 | .mixers = { alc663_two_hp_m1_mixer }, |
18757 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18758 | .init_verbs = { alc662_init_verbs, |
18759 | alc663_two_hp_amic_m1_init_verbs }, | |
18760 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18761 | .hp_nid = 0x03, | |
18762 | .dac_nids = alc662_dac_nids, | |
18763 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18764 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18765 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18766 | .unsol_event = alc663_mode3_unsol_event, |
4f5d1706 | 18767 | .setup = alc663_mode3_setup, |
f1d4e28b KY |
18768 | .init_hook = alc663_mode3_inithook, |
18769 | }, | |
18770 | [ALC663_ASUS_MODE4] = { | |
f9e336f6 TI |
18771 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
18772 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18773 | .init_verbs = { alc662_init_verbs, |
18774 | alc663_21jd_amic_init_verbs}, | |
18775 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18776 | .hp_nid = 0x03, | |
18777 | .dac_nids = alc662_dac_nids, | |
18778 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18779 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18780 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18781 | .unsol_event = alc663_mode4_unsol_event, |
4f5d1706 | 18782 | .setup = alc663_mode4_setup, |
f1d4e28b KY |
18783 | .init_hook = alc663_mode4_inithook, |
18784 | }, | |
18785 | [ALC663_ASUS_MODE5] = { | |
f9e336f6 TI |
18786 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
18787 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18788 | .init_verbs = { alc662_init_verbs, |
18789 | alc663_15jd_amic_init_verbs }, | |
18790 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18791 | .hp_nid = 0x03, | |
18792 | .dac_nids = alc662_dac_nids, | |
18793 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18794 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18795 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18796 | .unsol_event = alc663_mode5_unsol_event, |
4f5d1706 | 18797 | .setup = alc663_mode5_setup, |
f1d4e28b KY |
18798 | .init_hook = alc663_mode5_inithook, |
18799 | }, | |
18800 | [ALC663_ASUS_MODE6] = { | |
f9e336f6 TI |
18801 | .mixers = { alc663_two_hp_m2_mixer }, |
18802 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18803 | .init_verbs = { alc662_init_verbs, |
18804 | alc663_two_hp_amic_m2_init_verbs }, | |
18805 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18806 | .hp_nid = 0x03, | |
18807 | .dac_nids = alc662_dac_nids, | |
18808 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18809 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18810 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18811 | .unsol_event = alc663_mode6_unsol_event, |
4f5d1706 | 18812 | .setup = alc663_mode6_setup, |
f1d4e28b KY |
18813 | .init_hook = alc663_mode6_inithook, |
18814 | }, | |
ebb83eeb KY |
18815 | [ALC663_ASUS_MODE7] = { |
18816 | .mixers = { alc663_mode7_mixer }, | |
18817 | .cap_mixer = alc662_auto_capture_mixer, | |
18818 | .init_verbs = { alc662_init_verbs, | |
18819 | alc663_mode7_init_verbs }, | |
18820 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18821 | .hp_nid = 0x03, | |
18822 | .dac_nids = alc662_dac_nids, | |
18823 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18824 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18825 | .channel_mode = alc662_3ST_2ch_modes, | |
18826 | .unsol_event = alc663_mode7_unsol_event, | |
18827 | .setup = alc663_mode7_setup, | |
18828 | .init_hook = alc663_mode7_inithook, | |
18829 | }, | |
18830 | [ALC663_ASUS_MODE8] = { | |
18831 | .mixers = { alc663_mode8_mixer }, | |
18832 | .cap_mixer = alc662_auto_capture_mixer, | |
18833 | .init_verbs = { alc662_init_verbs, | |
18834 | alc663_mode8_init_verbs }, | |
18835 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18836 | .hp_nid = 0x03, | |
18837 | .dac_nids = alc662_dac_nids, | |
18838 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18839 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18840 | .channel_mode = alc662_3ST_2ch_modes, | |
18841 | .unsol_event = alc663_mode8_unsol_event, | |
18842 | .setup = alc663_mode8_setup, | |
18843 | .init_hook = alc663_mode8_inithook, | |
18844 | }, | |
622e84cd KY |
18845 | [ALC272_DELL] = { |
18846 | .mixers = { alc663_m51va_mixer }, | |
18847 | .cap_mixer = alc272_auto_capture_mixer, | |
18848 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, | |
18849 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18850 | .dac_nids = alc662_dac_nids, | |
18851 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18852 | .adc_nids = alc272_adc_nids, | |
18853 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | |
18854 | .capsrc_nids = alc272_capsrc_nids, | |
18855 | .channel_mode = alc662_3ST_2ch_modes, | |
622e84cd | 18856 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18857 | .setup = alc663_m51va_setup, |
622e84cd KY |
18858 | .init_hook = alc663_m51va_inithook, |
18859 | }, | |
18860 | [ALC272_DELL_ZM1] = { | |
18861 | .mixers = { alc663_m51va_mixer }, | |
18862 | .cap_mixer = alc662_auto_capture_mixer, | |
18863 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, | |
18864 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18865 | .dac_nids = alc662_dac_nids, | |
18866 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18867 | .adc_nids = alc662_adc_nids, | |
b59bdf3b | 18868 | .num_adc_nids = 1, |
622e84cd KY |
18869 | .capsrc_nids = alc662_capsrc_nids, |
18870 | .channel_mode = alc662_3ST_2ch_modes, | |
622e84cd | 18871 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18872 | .setup = alc663_m51va_setup, |
622e84cd KY |
18873 | .init_hook = alc663_m51va_inithook, |
18874 | }, | |
9541ba1d CP |
18875 | [ALC272_SAMSUNG_NC10] = { |
18876 | .mixers = { alc272_nc10_mixer }, | |
18877 | .init_verbs = { alc662_init_verbs, | |
18878 | alc663_21jd_amic_init_verbs }, | |
18879 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18880 | .dac_nids = alc272_dac_nids, | |
18881 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18882 | .channel_mode = alc662_3ST_2ch_modes, | |
4f5d1706 | 18883 | /*.input_mux = &alc272_nc10_capture_source,*/ |
9541ba1d | 18884 | .unsol_event = alc663_mode4_unsol_event, |
4f5d1706 | 18885 | .setup = alc663_mode4_setup, |
9541ba1d CP |
18886 | .init_hook = alc663_mode4_inithook, |
18887 | }, | |
bc9f98a9 KY |
18888 | }; |
18889 | ||
18890 | ||
18891 | /* | |
18892 | * BIOS auto configuration | |
18893 | */ | |
18894 | ||
7085ec12 TI |
18895 | /* convert from MIX nid to DAC */ |
18896 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | |
18897 | { | |
18898 | if (nid == 0x0f) | |
18899 | return 0x02; | |
18900 | else if (nid >= 0x0c && nid <= 0x0e) | |
18901 | return nid - 0x0c + 0x02; | |
18902 | else | |
18903 | return 0; | |
18904 | } | |
18905 | ||
18906 | /* get MIX nid connected to the given pin targeted to DAC */ | |
18907 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | |
18908 | hda_nid_t dac) | |
18909 | { | |
18910 | hda_nid_t mix[4]; | |
18911 | int i, num; | |
18912 | ||
18913 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | |
18914 | for (i = 0; i < num; i++) { | |
18915 | if (alc662_mix_to_dac(mix[i]) == dac) | |
18916 | return mix[i]; | |
18917 | } | |
18918 | return 0; | |
18919 | } | |
18920 | ||
18921 | /* look for an empty DAC slot */ | |
18922 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
18923 | { | |
18924 | struct alc_spec *spec = codec->spec; | |
18925 | hda_nid_t srcs[5]; | |
18926 | int i, j, num; | |
18927 | ||
18928 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | |
18929 | if (num < 0) | |
18930 | return 0; | |
18931 | for (i = 0; i < num; i++) { | |
18932 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); | |
18933 | if (!nid) | |
18934 | continue; | |
18935 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
18936 | if (spec->multiout.dac_nids[j] == nid) | |
18937 | break; | |
18938 | if (j >= spec->multiout.num_dacs) | |
18939 | return nid; | |
18940 | } | |
18941 | return 0; | |
18942 | } | |
18943 | ||
18944 | /* fill in the dac_nids table from the parsed pin configuration */ | |
18945 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, | |
18946 | const struct auto_pin_cfg *cfg) | |
18947 | { | |
18948 | struct alc_spec *spec = codec->spec; | |
18949 | int i; | |
18950 | hda_nid_t dac; | |
18951 | ||
18952 | spec->multiout.dac_nids = spec->private_dac_nids; | |
18953 | for (i = 0; i < cfg->line_outs; i++) { | |
18954 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); | |
18955 | if (!dac) | |
18956 | continue; | |
18957 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
18958 | } | |
18959 | return 0; | |
18960 | } | |
18961 | ||
0afe5f89 | 18962 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
7085ec12 TI |
18963 | hda_nid_t nid, unsigned int chs) |
18964 | { | |
0afe5f89 | 18965 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
7085ec12 TI |
18966 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
18967 | } | |
18968 | ||
0afe5f89 | 18969 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
7085ec12 TI |
18970 | hda_nid_t nid, unsigned int chs) |
18971 | { | |
0afe5f89 | 18972 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
7085ec12 TI |
18973 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
18974 | } | |
18975 | ||
18976 | #define alc662_add_stereo_vol(spec, pfx, nid) \ | |
18977 | alc662_add_vol_ctl(spec, pfx, nid, 3) | |
18978 | #define alc662_add_stereo_sw(spec, pfx, nid) \ | |
18979 | alc662_add_sw_ctl(spec, pfx, nid, 3) | |
18980 | ||
bc9f98a9 | 18981 | /* add playback controls from the parsed DAC table */ |
7085ec12 | 18982 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
bc9f98a9 KY |
18983 | const struct auto_pin_cfg *cfg) |
18984 | { | |
7085ec12 | 18985 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
18986 | static const char *chname[4] = { |
18987 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
18988 | }; | |
7085ec12 | 18989 | hda_nid_t nid, mix; |
bc9f98a9 KY |
18990 | int i, err; |
18991 | ||
18992 | for (i = 0; i < cfg->line_outs; i++) { | |
7085ec12 TI |
18993 | nid = spec->multiout.dac_nids[i]; |
18994 | if (!nid) | |
18995 | continue; | |
18996 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); | |
18997 | if (!mix) | |
bc9f98a9 | 18998 | continue; |
bc9f98a9 KY |
18999 | if (i == 2) { |
19000 | /* Center/LFE */ | |
7085ec12 | 19001 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
bc9f98a9 KY |
19002 | if (err < 0) |
19003 | return err; | |
7085ec12 | 19004 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
bc9f98a9 KY |
19005 | if (err < 0) |
19006 | return err; | |
7085ec12 | 19007 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
bc9f98a9 KY |
19008 | if (err < 0) |
19009 | return err; | |
7085ec12 | 19010 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
bc9f98a9 KY |
19011 | if (err < 0) |
19012 | return err; | |
19013 | } else { | |
0d884cb9 TI |
19014 | const char *pfx; |
19015 | if (cfg->line_outs == 1 && | |
19016 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
7085ec12 | 19017 | if (cfg->hp_outs) |
0d884cb9 TI |
19018 | pfx = "Speaker"; |
19019 | else | |
19020 | pfx = "PCM"; | |
19021 | } else | |
19022 | pfx = chname[i]; | |
7085ec12 | 19023 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
bc9f98a9 KY |
19024 | if (err < 0) |
19025 | return err; | |
0d884cb9 TI |
19026 | if (cfg->line_outs == 1 && |
19027 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
19028 | pfx = "Speaker"; | |
7085ec12 | 19029 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
bc9f98a9 KY |
19030 | if (err < 0) |
19031 | return err; | |
19032 | } | |
19033 | } | |
19034 | return 0; | |
19035 | } | |
19036 | ||
19037 | /* add playback controls for speaker and HP outputs */ | |
7085ec12 TI |
19038 | /* return DAC nid if any new DAC is assigned */ |
19039 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |
bc9f98a9 KY |
19040 | const char *pfx) |
19041 | { | |
7085ec12 TI |
19042 | struct alc_spec *spec = codec->spec; |
19043 | hda_nid_t nid, mix; | |
bc9f98a9 | 19044 | int err; |
bc9f98a9 KY |
19045 | |
19046 | if (!pin) | |
19047 | return 0; | |
7085ec12 TI |
19048 | nid = alc662_look_for_dac(codec, pin); |
19049 | if (!nid) { | |
7085ec12 TI |
19050 | /* the corresponding DAC is already occupied */ |
19051 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | |
19052 | return 0; /* no way */ | |
19053 | /* create a switch only */ | |
0afe5f89 | 19054 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
7085ec12 | 19055 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
24fb9173 TI |
19056 | } |
19057 | ||
7085ec12 TI |
19058 | mix = alc662_dac_to_mix(codec, pin, nid); |
19059 | if (!mix) | |
19060 | return 0; | |
19061 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | |
19062 | if (err < 0) | |
19063 | return err; | |
19064 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | |
19065 | if (err < 0) | |
19066 | return err; | |
19067 | return nid; | |
bc9f98a9 KY |
19068 | } |
19069 | ||
19070 | /* create playback/capture controls for input pins */ | |
05f5f477 | 19071 | #define alc662_auto_create_input_ctls \ |
4b7348a1 | 19072 | alc882_auto_create_input_ctls |
bc9f98a9 KY |
19073 | |
19074 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
19075 | hda_nid_t nid, int pin_type, | |
7085ec12 | 19076 | hda_nid_t dac) |
bc9f98a9 | 19077 | { |
7085ec12 | 19078 | int i, num; |
ce503f38 | 19079 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
7085ec12 | 19080 | |
f6c7e546 | 19081 | alc_set_pin_output(codec, nid, pin_type); |
bc9f98a9 | 19082 | /* need the manual connection? */ |
7085ec12 TI |
19083 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
19084 | if (num <= 1) | |
19085 | return; | |
19086 | for (i = 0; i < num; i++) { | |
19087 | if (alc662_mix_to_dac(srcs[i]) != dac) | |
19088 | continue; | |
19089 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); | |
19090 | return; | |
bc9f98a9 KY |
19091 | } |
19092 | } | |
19093 | ||
19094 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
19095 | { | |
19096 | struct alc_spec *spec = codec->spec; | |
7085ec12 | 19097 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
bc9f98a9 KY |
19098 | int i; |
19099 | ||
19100 | for (i = 0; i <= HDA_SIDE; i++) { | |
19101 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
19102 | if (nid) | |
baba8ee9 | 19103 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
7085ec12 | 19104 | spec->multiout.dac_nids[i]); |
bc9f98a9 KY |
19105 | } |
19106 | } | |
19107 | ||
19108 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
19109 | { | |
19110 | struct alc_spec *spec = codec->spec; | |
19111 | hda_nid_t pin; | |
19112 | ||
19113 | pin = spec->autocfg.hp_pins[0]; | |
7085ec12 TI |
19114 | if (pin) |
19115 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, | |
19116 | spec->multiout.hp_nid); | |
f6c7e546 TI |
19117 | pin = spec->autocfg.speaker_pins[0]; |
19118 | if (pin) | |
7085ec12 TI |
19119 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
19120 | spec->multiout.extra_out_nid[0]); | |
bc9f98a9 KY |
19121 | } |
19122 | ||
bc9f98a9 KY |
19123 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
19124 | ||
19125 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
19126 | { | |
19127 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 19128 | struct auto_pin_cfg *cfg = &spec->autocfg; |
bc9f98a9 KY |
19129 | int i; |
19130 | ||
66ceeb6b TI |
19131 | for (i = 0; i < cfg->num_inputs; i++) { |
19132 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 19133 | if (alc_is_input_pin(codec, nid)) { |
30ea098f | 19134 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
52ca15b7 | 19135 | if (nid != ALC662_PIN_CD_NID && |
e82c025b | 19136 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
bc9f98a9 KY |
19137 | snd_hda_codec_write(codec, nid, 0, |
19138 | AC_VERB_SET_AMP_GAIN_MUTE, | |
19139 | AMP_OUT_MUTE); | |
19140 | } | |
19141 | } | |
19142 | } | |
19143 | ||
f511b01c TI |
19144 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
19145 | ||
bc9f98a9 KY |
19146 | static int alc662_parse_auto_config(struct hda_codec *codec) |
19147 | { | |
19148 | struct alc_spec *spec = codec->spec; | |
19149 | int err; | |
19150 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
19151 | ||
19152 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
19153 | alc662_ignore); | |
19154 | if (err < 0) | |
19155 | return err; | |
19156 | if (!spec->autocfg.line_outs) | |
19157 | return 0; /* can't find valid BIOS pin config */ | |
19158 | ||
7085ec12 | 19159 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
f12ab1e0 TI |
19160 | if (err < 0) |
19161 | return err; | |
7085ec12 | 19162 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
f12ab1e0 TI |
19163 | if (err < 0) |
19164 | return err; | |
7085ec12 | 19165 | err = alc662_auto_create_extra_out(codec, |
f12ab1e0 TI |
19166 | spec->autocfg.speaker_pins[0], |
19167 | "Speaker"); | |
19168 | if (err < 0) | |
19169 | return err; | |
7085ec12 TI |
19170 | if (err) |
19171 | spec->multiout.extra_out_nid[0] = err; | |
19172 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | |
f12ab1e0 TI |
19173 | "Headphone"); |
19174 | if (err < 0) | |
19175 | return err; | |
7085ec12 TI |
19176 | if (err) |
19177 | spec->multiout.hp_nid = err; | |
05f5f477 | 19178 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 19179 | if (err < 0) |
bc9f98a9 KY |
19180 | return err; |
19181 | ||
19182 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
19183 | ||
757899ac | 19184 | alc_auto_parse_digital(codec); |
bc9f98a9 | 19185 | |
603c4019 | 19186 | if (spec->kctls.list) |
d88897ea | 19187 | add_mixer(spec, spec->kctls.list); |
bc9f98a9 KY |
19188 | |
19189 | spec->num_mux_defs = 1; | |
61b9b9b1 | 19190 | spec->input_mux = &spec->private_imux[0]; |
ea1fb29a | 19191 | |
cec27c89 KY |
19192 | add_verb(spec, alc662_init_verbs); |
19193 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | |
d1eb57f4 | 19194 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
cec27c89 KY |
19195 | add_verb(spec, alc663_init_verbs); |
19196 | ||
19197 | if (codec->vendor_id == 0x10ec0272) | |
19198 | add_verb(spec, alc272_init_verbs); | |
ee979a14 TI |
19199 | |
19200 | err = alc_auto_add_mic_boost(codec); | |
19201 | if (err < 0) | |
19202 | return err; | |
19203 | ||
6227cdce KY |
19204 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
19205 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | |
19206 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); | |
19207 | else | |
19208 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
4a79ba34 | 19209 | |
8c87286f | 19210 | return 1; |
bc9f98a9 KY |
19211 | } |
19212 | ||
19213 | /* additional initialization for auto-configuration model */ | |
19214 | static void alc662_auto_init(struct hda_codec *codec) | |
19215 | { | |
f6c7e546 | 19216 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
19217 | alc662_auto_init_multi_out(codec); |
19218 | alc662_auto_init_hp_out(codec); | |
19219 | alc662_auto_init_analog_input(codec); | |
f511b01c | 19220 | alc662_auto_init_input_src(codec); |
757899ac | 19221 | alc_auto_init_digital(codec); |
f6c7e546 | 19222 | if (spec->unsol_event) |
7fb0d78f | 19223 | alc_inithook(codec); |
bc9f98a9 KY |
19224 | } |
19225 | ||
6cb3b707 DH |
19226 | enum { |
19227 | ALC662_FIXUP_IDEAPAD, | |
19228 | }; | |
19229 | ||
19230 | static const struct alc_fixup alc662_fixups[] = { | |
19231 | [ALC662_FIXUP_IDEAPAD] = { | |
19232 | .pins = (const struct alc_pincfg[]) { | |
19233 | { 0x17, 0x99130112 }, /* subwoofer */ | |
19234 | { } | |
19235 | } | |
19236 | }, | |
19237 | }; | |
19238 | ||
19239 | static struct snd_pci_quirk alc662_fixup_tbl[] = { | |
19240 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), | |
19241 | {} | |
19242 | }; | |
19243 | ||
19244 | ||
19245 | ||
bc9f98a9 KY |
19246 | static int patch_alc662(struct hda_codec *codec) |
19247 | { | |
19248 | struct alc_spec *spec; | |
19249 | int err, board_config; | |
19250 | ||
19251 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
19252 | if (!spec) | |
19253 | return -ENOMEM; | |
19254 | ||
19255 | codec->spec = spec; | |
19256 | ||
da00c244 KY |
19257 | alc_auto_parse_customize_define(codec); |
19258 | ||
2c3bf9ab TI |
19259 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
19260 | ||
c027ddcd KY |
19261 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
19262 | alc_codec_rename(codec, "ALC661"); | |
19263 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && | |
19264 | codec->bus->pci->subsystem_vendor == 0x1025 && | |
19265 | spec->cdefine.platform_type == 1) | |
19266 | alc_codec_rename(codec, "ALC272X"); | |
274693f3 | 19267 | |
bc9f98a9 KY |
19268 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
19269 | alc662_models, | |
19270 | alc662_cfg_tbl); | |
19271 | if (board_config < 0) { | |
9a11f1aa TI |
19272 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
19273 | codec->chip_name); | |
bc9f98a9 KY |
19274 | board_config = ALC662_AUTO; |
19275 | } | |
19276 | ||
19277 | if (board_config == ALC662_AUTO) { | |
6cb3b707 | 19278 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
bc9f98a9 KY |
19279 | /* automatic parse from the BIOS config */ |
19280 | err = alc662_parse_auto_config(codec); | |
19281 | if (err < 0) { | |
19282 | alc_free(codec); | |
19283 | return err; | |
8c87286f | 19284 | } else if (!err) { |
bc9f98a9 KY |
19285 | printk(KERN_INFO |
19286 | "hda_codec: Cannot set up configuration " | |
19287 | "from BIOS. Using base mode...\n"); | |
19288 | board_config = ALC662_3ST_2ch_DIG; | |
19289 | } | |
19290 | } | |
19291 | ||
dc1eae25 | 19292 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
19293 | err = snd_hda_attach_beep_device(codec, 0x1); |
19294 | if (err < 0) { | |
19295 | alc_free(codec); | |
19296 | return err; | |
19297 | } | |
680cd536 KK |
19298 | } |
19299 | ||
bc9f98a9 | 19300 | if (board_config != ALC662_AUTO) |
e9c364c0 | 19301 | setup_preset(codec, &alc662_presets[board_config]); |
bc9f98a9 | 19302 | |
bc9f98a9 KY |
19303 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
19304 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
19305 | ||
bc9f98a9 KY |
19306 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
19307 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
19308 | ||
dd704698 TI |
19309 | if (!spec->adc_nids) { |
19310 | spec->adc_nids = alc662_adc_nids; | |
19311 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
19312 | } | |
19313 | if (!spec->capsrc_nids) | |
19314 | spec->capsrc_nids = alc662_capsrc_nids; | |
bc9f98a9 | 19315 | |
f9e336f6 | 19316 | if (!spec->cap_mixer) |
b59bdf3b | 19317 | set_capture_mixer(codec); |
cec27c89 | 19318 | |
dc1eae25 | 19319 | if (has_cdefine_beep(codec)) { |
da00c244 KY |
19320 | switch (codec->vendor_id) { |
19321 | case 0x10ec0662: | |
19322 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
19323 | break; | |
19324 | case 0x10ec0272: | |
19325 | case 0x10ec0663: | |
19326 | case 0x10ec0665: | |
19327 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
19328 | break; | |
19329 | case 0x10ec0273: | |
19330 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); | |
19331 | break; | |
19332 | } | |
cec27c89 | 19333 | } |
2134ea4f TI |
19334 | spec->vmaster_nid = 0x02; |
19335 | ||
bc9f98a9 | 19336 | codec->patch_ops = alc_patch_ops; |
6cb3b707 | 19337 | if (board_config == ALC662_AUTO) { |
bc9f98a9 | 19338 | spec->init_hook = alc662_auto_init; |
6cb3b707 DH |
19339 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
19340 | } | |
19341 | ||
cb53c626 TI |
19342 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
19343 | if (!spec->loopback.amplist) | |
19344 | spec->loopback.amplist = alc662_loopbacks; | |
19345 | #endif | |
bc9f98a9 KY |
19346 | |
19347 | return 0; | |
19348 | } | |
19349 | ||
274693f3 KY |
19350 | static int patch_alc888(struct hda_codec *codec) |
19351 | { | |
19352 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | |
19353 | kfree(codec->chip_name); | |
19354 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | |
ac2c92e0 TI |
19355 | if (!codec->chip_name) { |
19356 | alc_free(codec); | |
274693f3 | 19357 | return -ENOMEM; |
ac2c92e0 TI |
19358 | } |
19359 | return patch_alc662(codec); | |
274693f3 | 19360 | } |
ac2c92e0 | 19361 | return patch_alc882(codec); |
274693f3 KY |
19362 | } |
19363 | ||
d1eb57f4 KY |
19364 | /* |
19365 | * ALC680 support | |
19366 | */ | |
c69aefab | 19367 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
d1eb57f4 KY |
19368 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
19369 | #define alc680_modes alc260_modes | |
19370 | ||
19371 | static hda_nid_t alc680_dac_nids[3] = { | |
19372 | /* Lout1, Lout2, hp */ | |
19373 | 0x02, 0x03, 0x04 | |
19374 | }; | |
19375 | ||
19376 | static hda_nid_t alc680_adc_nids[3] = { | |
19377 | /* ADC0-2 */ | |
19378 | /* DMIC, MIC, Line-in*/ | |
19379 | 0x07, 0x08, 0x09 | |
19380 | }; | |
19381 | ||
c69aefab KY |
19382 | /* |
19383 | * Analog capture ADC cgange | |
19384 | */ | |
66ceeb6b TI |
19385 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
19386 | { | |
19387 | struct alc_spec *spec = codec->spec; | |
19388 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
19389 | int pin_found = 0; | |
19390 | int type_found = AUTO_PIN_LAST; | |
19391 | hda_nid_t nid; | |
19392 | int i; | |
19393 | ||
19394 | for (i = 0; i < cfg->num_inputs; i++) { | |
19395 | nid = cfg->inputs[i].pin; | |
19396 | if (!(snd_hda_query_pin_caps(codec, nid) & | |
19397 | AC_PINCAP_PRES_DETECT)) | |
19398 | continue; | |
19399 | if (snd_hda_jack_detect(codec, nid)) { | |
19400 | if (cfg->inputs[i].type < type_found) { | |
19401 | type_found = cfg->inputs[i].type; | |
19402 | pin_found = nid; | |
19403 | } | |
19404 | } | |
19405 | } | |
19406 | ||
19407 | nid = 0x07; | |
19408 | if (pin_found) | |
19409 | snd_hda_get_connections(codec, pin_found, &nid, 1); | |
19410 | ||
19411 | if (nid != spec->cur_adc) | |
19412 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); | |
19413 | spec->cur_adc = nid; | |
19414 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, | |
19415 | spec->cur_adc_format); | |
19416 | } | |
19417 | ||
c69aefab KY |
19418 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
19419 | struct hda_codec *codec, | |
19420 | unsigned int stream_tag, | |
19421 | unsigned int format, | |
19422 | struct snd_pcm_substream *substream) | |
19423 | { | |
19424 | struct alc_spec *spec = codec->spec; | |
c69aefab | 19425 | |
66ceeb6b | 19426 | spec->cur_adc = 0x07; |
c69aefab KY |
19427 | spec->cur_adc_stream_tag = stream_tag; |
19428 | spec->cur_adc_format = format; | |
19429 | ||
66ceeb6b | 19430 | alc680_rec_autoswitch(codec); |
c69aefab KY |
19431 | return 0; |
19432 | } | |
19433 | ||
19434 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
19435 | struct hda_codec *codec, | |
19436 | struct snd_pcm_substream *substream) | |
19437 | { | |
19438 | snd_hda_codec_cleanup_stream(codec, 0x07); | |
19439 | snd_hda_codec_cleanup_stream(codec, 0x08); | |
19440 | snd_hda_codec_cleanup_stream(codec, 0x09); | |
19441 | return 0; | |
19442 | } | |
19443 | ||
19444 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { | |
19445 | .substreams = 1, /* can be overridden */ | |
19446 | .channels_min = 2, | |
19447 | .channels_max = 2, | |
19448 | /* NID is set in alc_build_pcms */ | |
19449 | .ops = { | |
19450 | .prepare = alc680_capture_pcm_prepare, | |
19451 | .cleanup = alc680_capture_pcm_cleanup | |
19452 | }, | |
19453 | }; | |
19454 | ||
d1eb57f4 KY |
19455 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
19456 | /* output mixer control */ | |
19457 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
19458 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
19459 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), | |
19460 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
c69aefab | 19461 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
d1eb57f4 | 19462 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c69aefab | 19463 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
d1eb57f4 KY |
19464 | { } |
19465 | }; | |
19466 | ||
c69aefab KY |
19467 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
19468 | .ops = &snd_hda_bind_vol, | |
19469 | .values = { | |
19470 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19471 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19472 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19473 | 0 | |
19474 | }, | |
19475 | }; | |
19476 | ||
19477 | static struct hda_bind_ctls alc680_bind_cap_switch = { | |
19478 | .ops = &snd_hda_bind_sw, | |
19479 | .values = { | |
19480 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19481 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19482 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19483 | 0 | |
19484 | }, | |
19485 | }; | |
19486 | ||
19487 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { | |
19488 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), | |
19489 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), | |
d1eb57f4 KY |
19490 | { } /* end */ |
19491 | }; | |
19492 | ||
19493 | /* | |
19494 | * generic initialization of ADC, input mixers and output mixers | |
19495 | */ | |
19496 | static struct hda_verb alc680_init_verbs[] = { | |
c69aefab KY |
19497 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
19498 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19499 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
d1eb57f4 | 19500 | |
c69aefab KY |
19501 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
19502 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19503 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19504 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
19505 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
19506 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d1eb57f4 KY |
19507 | |
19508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19509 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19510 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19511 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19512 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
c69aefab KY |
19513 | |
19514 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
19515 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
66ceeb6b | 19516 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
c69aefab | 19517 | |
d1eb57f4 KY |
19518 | { } |
19519 | }; | |
19520 | ||
c69aefab KY |
19521 | /* toggle speaker-output according to the hp-jack state */ |
19522 | static void alc680_base_setup(struct hda_codec *codec) | |
19523 | { | |
19524 | struct alc_spec *spec = codec->spec; | |
19525 | ||
19526 | spec->autocfg.hp_pins[0] = 0x16; | |
19527 | spec->autocfg.speaker_pins[0] = 0x14; | |
19528 | spec->autocfg.speaker_pins[1] = 0x15; | |
66ceeb6b TI |
19529 | spec->autocfg.num_inputs = 2; |
19530 | spec->autocfg.inputs[0].pin = 0x18; | |
19531 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; | |
19532 | spec->autocfg.inputs[1].pin = 0x19; | |
86e2959a | 19533 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
c69aefab KY |
19534 | } |
19535 | ||
19536 | static void alc680_unsol_event(struct hda_codec *codec, | |
19537 | unsigned int res) | |
19538 | { | |
19539 | if ((res >> 26) == ALC880_HP_EVENT) | |
19540 | alc_automute_amp(codec); | |
19541 | if ((res >> 26) == ALC880_MIC_EVENT) | |
19542 | alc680_rec_autoswitch(codec); | |
19543 | } | |
19544 | ||
19545 | static void alc680_inithook(struct hda_codec *codec) | |
19546 | { | |
19547 | alc_automute_amp(codec); | |
19548 | alc680_rec_autoswitch(codec); | |
19549 | } | |
19550 | ||
d1eb57f4 KY |
19551 | /* create input playback/capture controls for the given pin */ |
19552 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
19553 | const char *ctlname, int idx) | |
19554 | { | |
19555 | hda_nid_t dac; | |
19556 | int err; | |
19557 | ||
19558 | switch (nid) { | |
19559 | case 0x14: | |
19560 | dac = 0x02; | |
19561 | break; | |
19562 | case 0x15: | |
19563 | dac = 0x03; | |
19564 | break; | |
19565 | case 0x16: | |
19566 | dac = 0x04; | |
19567 | break; | |
19568 | default: | |
19569 | return 0; | |
19570 | } | |
19571 | if (spec->multiout.dac_nids[0] != dac && | |
19572 | spec->multiout.dac_nids[1] != dac) { | |
19573 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
19574 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | |
19575 | HDA_OUTPUT)); | |
19576 | if (err < 0) | |
19577 | return err; | |
19578 | ||
19579 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
19580 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
19581 | ||
19582 | if (err < 0) | |
19583 | return err; | |
19584 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
19585 | } | |
19586 | ||
19587 | return 0; | |
19588 | } | |
19589 | ||
19590 | /* add playback controls from the parsed DAC table */ | |
19591 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, | |
19592 | const struct auto_pin_cfg *cfg) | |
19593 | { | |
19594 | hda_nid_t nid; | |
19595 | int err; | |
19596 | ||
19597 | spec->multiout.dac_nids = spec->private_dac_nids; | |
19598 | ||
19599 | nid = cfg->line_out_pins[0]; | |
19600 | if (nid) { | |
19601 | const char *name; | |
19602 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
19603 | name = "Speaker"; | |
19604 | else | |
19605 | name = "Front"; | |
19606 | err = alc680_new_analog_output(spec, nid, name, 0); | |
19607 | if (err < 0) | |
19608 | return err; | |
19609 | } | |
19610 | ||
19611 | nid = cfg->speaker_pins[0]; | |
19612 | if (nid) { | |
19613 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); | |
19614 | if (err < 0) | |
19615 | return err; | |
19616 | } | |
19617 | nid = cfg->hp_pins[0]; | |
19618 | if (nid) { | |
19619 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); | |
19620 | if (err < 0) | |
19621 | return err; | |
19622 | } | |
19623 | ||
19624 | return 0; | |
19625 | } | |
19626 | ||
19627 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, | |
19628 | hda_nid_t nid, int pin_type) | |
19629 | { | |
19630 | alc_set_pin_output(codec, nid, pin_type); | |
19631 | } | |
19632 | ||
19633 | static void alc680_auto_init_multi_out(struct hda_codec *codec) | |
19634 | { | |
19635 | struct alc_spec *spec = codec->spec; | |
19636 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | |
19637 | if (nid) { | |
19638 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
19639 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); | |
19640 | } | |
19641 | } | |
19642 | ||
19643 | static void alc680_auto_init_hp_out(struct hda_codec *codec) | |
19644 | { | |
19645 | struct alc_spec *spec = codec->spec; | |
19646 | hda_nid_t pin; | |
19647 | ||
19648 | pin = spec->autocfg.hp_pins[0]; | |
19649 | if (pin) | |
19650 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
19651 | pin = spec->autocfg.speaker_pins[0]; | |
19652 | if (pin) | |
19653 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
19654 | } | |
19655 | ||
19656 | /* pcm configuration: identical with ALC880 */ | |
19657 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback | |
19658 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture | |
19659 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | |
19660 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback | |
c69aefab | 19661 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
d1eb57f4 KY |
19662 | |
19663 | /* | |
19664 | * BIOS auto configuration | |
19665 | */ | |
19666 | static int alc680_parse_auto_config(struct hda_codec *codec) | |
19667 | { | |
19668 | struct alc_spec *spec = codec->spec; | |
19669 | int err; | |
19670 | static hda_nid_t alc680_ignore[] = { 0 }; | |
19671 | ||
19672 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
19673 | alc680_ignore); | |
19674 | if (err < 0) | |
19675 | return err; | |
c69aefab | 19676 | |
d1eb57f4 KY |
19677 | if (!spec->autocfg.line_outs) { |
19678 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
19679 | spec->multiout.max_channels = 2; | |
19680 | spec->no_analog = 1; | |
19681 | goto dig_only; | |
19682 | } | |
19683 | return 0; /* can't find valid BIOS pin config */ | |
19684 | } | |
19685 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
19686 | if (err < 0) | |
19687 | return err; | |
19688 | ||
19689 | spec->multiout.max_channels = 2; | |
19690 | ||
19691 | dig_only: | |
19692 | /* digital only support output */ | |
757899ac | 19693 | alc_auto_parse_digital(codec); |
d1eb57f4 KY |
19694 | if (spec->kctls.list) |
19695 | add_mixer(spec, spec->kctls.list); | |
19696 | ||
19697 | add_verb(spec, alc680_init_verbs); | |
d1eb57f4 KY |
19698 | |
19699 | err = alc_auto_add_mic_boost(codec); | |
19700 | if (err < 0) | |
19701 | return err; | |
19702 | ||
19703 | return 1; | |
19704 | } | |
19705 | ||
19706 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input | |
19707 | ||
19708 | /* init callback for auto-configuration model -- overriding the default init */ | |
19709 | static void alc680_auto_init(struct hda_codec *codec) | |
19710 | { | |
19711 | struct alc_spec *spec = codec->spec; | |
19712 | alc680_auto_init_multi_out(codec); | |
19713 | alc680_auto_init_hp_out(codec); | |
19714 | alc680_auto_init_analog_input(codec); | |
757899ac | 19715 | alc_auto_init_digital(codec); |
d1eb57f4 KY |
19716 | if (spec->unsol_event) |
19717 | alc_inithook(codec); | |
19718 | } | |
19719 | ||
19720 | /* | |
19721 | * configuration and preset | |
19722 | */ | |
19723 | static const char *alc680_models[ALC680_MODEL_LAST] = { | |
d4a86d81 TI |
19724 | [ALC680_BASE] = "base", |
19725 | [ALC680_AUTO] = "auto", | |
d1eb57f4 KY |
19726 | }; |
19727 | ||
19728 | static struct snd_pci_quirk alc680_cfg_tbl[] = { | |
19729 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), | |
19730 | {} | |
19731 | }; | |
19732 | ||
19733 | static struct alc_config_preset alc680_presets[] = { | |
19734 | [ALC680_BASE] = { | |
19735 | .mixers = { alc680_base_mixer }, | |
c69aefab | 19736 | .cap_mixer = alc680_master_capture_mixer, |
d1eb57f4 KY |
19737 | .init_verbs = { alc680_init_verbs }, |
19738 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), | |
19739 | .dac_nids = alc680_dac_nids, | |
d1eb57f4 KY |
19740 | .dig_out_nid = ALC680_DIGOUT_NID, |
19741 | .num_channel_mode = ARRAY_SIZE(alc680_modes), | |
19742 | .channel_mode = alc680_modes, | |
c69aefab KY |
19743 | .unsol_event = alc680_unsol_event, |
19744 | .setup = alc680_base_setup, | |
19745 | .init_hook = alc680_inithook, | |
19746 | ||
d1eb57f4 KY |
19747 | }, |
19748 | }; | |
19749 | ||
19750 | static int patch_alc680(struct hda_codec *codec) | |
19751 | { | |
19752 | struct alc_spec *spec; | |
19753 | int board_config; | |
19754 | int err; | |
19755 | ||
19756 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
19757 | if (spec == NULL) | |
19758 | return -ENOMEM; | |
19759 | ||
19760 | codec->spec = spec; | |
19761 | ||
19762 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, | |
19763 | alc680_models, | |
19764 | alc680_cfg_tbl); | |
19765 | ||
19766 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { | |
19767 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
19768 | codec->chip_name); | |
19769 | board_config = ALC680_AUTO; | |
19770 | } | |
19771 | ||
19772 | if (board_config == ALC680_AUTO) { | |
19773 | /* automatic parse from the BIOS config */ | |
19774 | err = alc680_parse_auto_config(codec); | |
19775 | if (err < 0) { | |
19776 | alc_free(codec); | |
19777 | return err; | |
19778 | } else if (!err) { | |
19779 | printk(KERN_INFO | |
19780 | "hda_codec: Cannot set up configuration " | |
19781 | "from BIOS. Using base mode...\n"); | |
19782 | board_config = ALC680_BASE; | |
19783 | } | |
19784 | } | |
19785 | ||
19786 | if (board_config != ALC680_AUTO) | |
19787 | setup_preset(codec, &alc680_presets[board_config]); | |
19788 | ||
19789 | spec->stream_analog_playback = &alc680_pcm_analog_playback; | |
c69aefab | 19790 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
d1eb57f4 | 19791 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
c69aefab | 19792 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
d1eb57f4 KY |
19793 | |
19794 | if (!spec->adc_nids) { | |
19795 | spec->adc_nids = alc680_adc_nids; | |
19796 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); | |
19797 | } | |
19798 | ||
19799 | if (!spec->cap_mixer) | |
19800 | set_capture_mixer(codec); | |
19801 | ||
19802 | spec->vmaster_nid = 0x02; | |
19803 | ||
19804 | codec->patch_ops = alc_patch_ops; | |
19805 | if (board_config == ALC680_AUTO) | |
19806 | spec->init_hook = alc680_auto_init; | |
19807 | ||
19808 | return 0; | |
19809 | } | |
19810 | ||
1da177e4 LT |
19811 | /* |
19812 | * patch entries | |
19813 | */ | |
1289e9e8 | 19814 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
1da177e4 | 19815 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
df694daa | 19816 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
f6a92248 | 19817 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
a361d84b | 19818 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
f6a92248 | 19819 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
ebb83eeb | 19820 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
01afd41f | 19821 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
ebb83eeb | 19822 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
f32610ed | 19823 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
bc9f98a9 | 19824 | .patch = patch_alc861 }, |
f32610ed JS |
19825 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
19826 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
19827 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
bc9f98a9 | 19828 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
4953550a | 19829 | .patch = patch_alc882 }, |
bc9f98a9 KY |
19830 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
19831 | .patch = patch_alc662 }, | |
6dda9f4a | 19832 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
cec27c89 | 19833 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
6227cdce | 19834 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
d1eb57f4 | 19835 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
f32610ed | 19836 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
1da177e4 | 19837 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
4953550a | 19838 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
669faba2 | 19839 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
4953550a | 19840 | .patch = patch_alc882 }, |
cb308f97 | 19841 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
4953550a | 19842 | .patch = patch_alc882 }, |
df694daa | 19843 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
4953550a | 19844 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
4442608d | 19845 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
4953550a | 19846 | .patch = patch_alc882 }, |
274693f3 | 19847 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
4953550a | 19848 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
274693f3 | 19849 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
1da177e4 LT |
19850 | {} /* terminator */ |
19851 | }; | |
1289e9e8 TI |
19852 | |
19853 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | |
19854 | ||
19855 | MODULE_LICENSE("GPL"); | |
19856 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | |
19857 | ||
19858 | static struct hda_codec_preset_list realtek_list = { | |
19859 | .preset = snd_hda_preset_realtek, | |
19860 | .owner = THIS_MODULE, | |
19861 | }; | |
19862 | ||
19863 | static int __init patch_realtek_init(void) | |
19864 | { | |
19865 | return snd_hda_add_codec_preset(&realtek_list); | |
19866 | } | |
19867 | ||
19868 | static void __exit patch_realtek_exit(void) | |
19869 | { | |
19870 | snd_hda_delete_codec_preset(&realtek_list); | |
19871 | } | |
19872 | ||
19873 | module_init(patch_realtek_init) | |
19874 | module_exit(patch_realtek_exit) |