]>
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, |
7ad7b218 | 234 | ALC883_MEDION_WIM2160, |
b373bdeb | 235 | ALC883_LAPTOP_EAPD, |
bc9f98a9 | 236 | ALC883_LENOVO_101E_2ch, |
272a527c | 237 | ALC883_LENOVO_NB0763, |
189609ae | 238 | ALC888_LENOVO_MS7195_DIG, |
e2757d5e | 239 | ALC888_LENOVO_SKY, |
ea1fb29a | 240 | ALC883_HAIER_W66, |
4723c022 | 241 | ALC888_3ST_HP, |
5795b9e6 | 242 | ALC888_6ST_DELL, |
a8848bd6 | 243 | ALC883_MITAC, |
a65cc60f | 244 | ALC883_CLEVO_M540R, |
0c4cc443 | 245 | ALC883_CLEVO_M720, |
fb97dc67 | 246 | ALC883_FUJITSU_PI2515, |
ef8ef5fb | 247 | ALC888_FUJITSU_XA3530, |
17bba1b7 | 248 | ALC883_3ST_6ch_INTEL, |
87a8c370 JK |
249 | ALC889A_INTEL, |
250 | ALC889_INTEL, | |
e2757d5e KY |
251 | ALC888_ASUS_M90V, |
252 | ALC888_ASUS_EEE1601, | |
eb4c41d3 | 253 | ALC889A_MB31, |
3ab90935 | 254 | ALC1200_ASUS_P5Q, |
3e1647c5 | 255 | ALC883_SONY_VAIO_TT, |
4953550a TI |
256 | ALC882_AUTO, |
257 | ALC882_MODEL_LAST, | |
9c7f852e TI |
258 | }; |
259 | ||
d4a86d81 TI |
260 | /* ALC680 models */ |
261 | enum { | |
262 | ALC680_BASE, | |
263 | ALC680_AUTO, | |
264 | ALC680_MODEL_LAST, | |
265 | }; | |
266 | ||
df694daa KY |
267 | /* for GPIO Poll */ |
268 | #define GPIO_MASK 0x03 | |
269 | ||
4a79ba34 TI |
270 | /* extra amp-initialization sequence types */ |
271 | enum { | |
272 | ALC_INIT_NONE, | |
273 | ALC_INIT_DEFAULT, | |
274 | ALC_INIT_GPIO1, | |
275 | ALC_INIT_GPIO2, | |
276 | ALC_INIT_GPIO3, | |
277 | }; | |
278 | ||
6c819492 TI |
279 | struct alc_mic_route { |
280 | hda_nid_t pin; | |
281 | unsigned char mux_idx; | |
282 | unsigned char amix_idx; | |
283 | }; | |
284 | ||
9ad0e496 KY |
285 | struct alc_jack { |
286 | hda_nid_t nid; | |
287 | int type; | |
288 | struct snd_jack *jack; | |
289 | }; | |
290 | ||
6c819492 TI |
291 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
292 | ||
da00c244 KY |
293 | struct alc_customize_define { |
294 | unsigned int sku_cfg; | |
295 | unsigned char port_connectivity; | |
296 | unsigned char check_sum; | |
297 | unsigned char customization; | |
298 | unsigned char external_amp; | |
299 | unsigned int enable_pcbeep:1; | |
300 | unsigned int platform_type:1; | |
301 | unsigned int swap:1; | |
302 | unsigned int override:1; | |
90622917 | 303 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
da00c244 KY |
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 | ||
90622917 DH |
1467 | /* Could be any non-zero and even value. When used as fixup, tells |
1468 | * the driver to ignore any present sku defines. | |
1469 | */ | |
1470 | #define ALC_FIXUP_SKU_IGNORE (2) | |
1471 | ||
da00c244 KY |
1472 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
1473 | { | |
1474 | unsigned int ass, tmp, i; | |
7fb56223 | 1475 | unsigned nid = 0; |
da00c244 KY |
1476 | struct alc_spec *spec = codec->spec; |
1477 | ||
b6cbe517 TI |
1478 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
1479 | ||
90622917 DH |
1480 | if (spec->cdefine.fixup) { |
1481 | ass = spec->cdefine.sku_cfg; | |
1482 | if (ass == ALC_FIXUP_SKU_IGNORE) | |
1483 | return -1; | |
1484 | goto do_sku; | |
1485 | } | |
1486 | ||
da00c244 | 1487 | ass = codec->subsystem_id & 0xffff; |
b6cbe517 | 1488 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
da00c244 KY |
1489 | goto do_sku; |
1490 | ||
1491 | nid = 0x1d; | |
1492 | if (codec->vendor_id == 0x10ec0260) | |
1493 | nid = 0x17; | |
1494 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1495 | ||
1496 | if (!(ass & 1)) { | |
1497 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", | |
1498 | codec->chip_name, ass); | |
1499 | return -1; | |
1500 | } | |
1501 | ||
1502 | /* check sum */ | |
1503 | tmp = 0; | |
1504 | for (i = 1; i < 16; i++) { | |
1505 | if ((ass >> i) & 1) | |
1506 | tmp++; | |
1507 | } | |
1508 | if (((ass >> 16) & 0xf) != tmp) | |
1509 | return -1; | |
1510 | ||
1511 | spec->cdefine.port_connectivity = ass >> 30; | |
1512 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; | |
1513 | spec->cdefine.check_sum = (ass >> 16) & 0xf; | |
1514 | spec->cdefine.customization = ass >> 8; | |
1515 | do_sku: | |
1516 | spec->cdefine.sku_cfg = ass; | |
1517 | spec->cdefine.external_amp = (ass & 0x38) >> 3; | |
1518 | spec->cdefine.platform_type = (ass & 0x4) >> 2; | |
1519 | spec->cdefine.swap = (ass & 0x2) >> 1; | |
1520 | spec->cdefine.override = ass & 0x1; | |
1521 | ||
1522 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", | |
1523 | nid, spec->cdefine.sku_cfg); | |
1524 | snd_printd("SKU: port_connectivity=0x%x\n", | |
1525 | spec->cdefine.port_connectivity); | |
1526 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); | |
1527 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); | |
1528 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); | |
1529 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); | |
1530 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); | |
1531 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); | |
1532 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); | |
1533 | ||
1534 | return 0; | |
1535 | } | |
1536 | ||
4a79ba34 TI |
1537 | /* check subsystem ID and set up device-specific initialization; |
1538 | * return 1 if initialized, 0 if invalid SSID | |
1539 | */ | |
1540 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | |
1541 | * 31 ~ 16 : Manufacture ID | |
1542 | * 15 ~ 8 : SKU ID | |
1543 | * 7 ~ 0 : Assembly ID | |
1544 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
1545 | */ | |
1546 | static int alc_subsystem_id(struct hda_codec *codec, | |
1547 | hda_nid_t porta, hda_nid_t porte, | |
6227cdce | 1548 | hda_nid_t portd, hda_nid_t porti) |
4a79ba34 TI |
1549 | { |
1550 | unsigned int ass, tmp, i; | |
1551 | unsigned nid; | |
1552 | struct alc_spec *spec = codec->spec; | |
1553 | ||
90622917 DH |
1554 | if (spec->cdefine.fixup) { |
1555 | ass = spec->cdefine.sku_cfg; | |
1556 | if (ass == ALC_FIXUP_SKU_IGNORE) | |
1557 | return 0; | |
1558 | goto do_sku; | |
1559 | } | |
1560 | ||
4a79ba34 TI |
1561 | ass = codec->subsystem_id & 0xffff; |
1562 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
1563 | goto do_sku; | |
1564 | ||
1565 | /* invalid SSID, check the special NID pin defcfg instead */ | |
1566 | /* | |
def319f9 | 1567 | * 31~30 : port connectivity |
4a79ba34 TI |
1568 | * 29~21 : reserve |
1569 | * 20 : PCBEEP input | |
1570 | * 19~16 : Check sum (15:1) | |
1571 | * 15~1 : Custom | |
1572 | * 0 : override | |
1573 | */ | |
1574 | nid = 0x1d; | |
1575 | if (codec->vendor_id == 0x10ec0260) | |
1576 | nid = 0x17; | |
1577 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
1578 | snd_printd("realtek: No valid SSID, " | |
1579 | "checking pincfg 0x%08x for NID 0x%x\n", | |
cb6605c1 | 1580 | ass, nid); |
6227cdce | 1581 | if (!(ass & 1)) |
4a79ba34 TI |
1582 | return 0; |
1583 | if ((ass >> 30) != 1) /* no physical connection */ | |
1584 | return 0; | |
1585 | ||
1586 | /* check sum */ | |
1587 | tmp = 0; | |
1588 | for (i = 1; i < 16; i++) { | |
1589 | if ((ass >> i) & 1) | |
1590 | tmp++; | |
1591 | } | |
1592 | if (((ass >> 16) & 0xf) != tmp) | |
1593 | return 0; | |
1594 | do_sku: | |
1595 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", | |
1596 | ass & 0xffff, codec->vendor_id); | |
1597 | /* | |
1598 | * 0 : override | |
1599 | * 1 : Swap Jack | |
1600 | * 2 : 0 --> Desktop, 1 --> Laptop | |
1601 | * 3~5 : External Amplifier control | |
1602 | * 7~6 : Reserved | |
1603 | */ | |
1604 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | |
1605 | switch (tmp) { | |
1606 | case 1: | |
1607 | spec->init_amp = ALC_INIT_GPIO1; | |
1608 | break; | |
1609 | case 3: | |
1610 | spec->init_amp = ALC_INIT_GPIO2; | |
1611 | break; | |
1612 | case 7: | |
1613 | spec->init_amp = ALC_INIT_GPIO3; | |
1614 | break; | |
1615 | case 5: | |
5a8cfb4e | 1616 | default: |
4a79ba34 | 1617 | spec->init_amp = ALC_INIT_DEFAULT; |
bc9f98a9 KY |
1618 | break; |
1619 | } | |
ea1fb29a | 1620 | |
8c427226 | 1621 | /* is laptop or Desktop and enable the function "Mute internal speaker |
c9b58006 KY |
1622 | * when the external headphone out jack is plugged" |
1623 | */ | |
8c427226 | 1624 | if (!(ass & 0x8000)) |
4a79ba34 | 1625 | return 1; |
c9b58006 KY |
1626 | /* |
1627 | * 10~8 : Jack location | |
1628 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
1629 | * 14~13: Resvered | |
1630 | * 15 : 1 --> enable the function "Mute internal speaker | |
1631 | * when the external headphone out jack is plugged" | |
1632 | */ | |
c9b58006 | 1633 | if (!spec->autocfg.hp_pins[0]) { |
01d4825d | 1634 | hda_nid_t nid; |
c9b58006 KY |
1635 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
1636 | if (tmp == 0) | |
01d4825d | 1637 | nid = porta; |
c9b58006 | 1638 | else if (tmp == 1) |
01d4825d | 1639 | nid = porte; |
c9b58006 | 1640 | else if (tmp == 2) |
01d4825d | 1641 | nid = portd; |
6227cdce KY |
1642 | else if (tmp == 3) |
1643 | nid = porti; | |
c9b58006 | 1644 | else |
4a79ba34 | 1645 | return 1; |
01d4825d TI |
1646 | for (i = 0; i < spec->autocfg.line_outs; i++) |
1647 | if (spec->autocfg.line_out_pins[i] == nid) | |
1648 | return 1; | |
1649 | spec->autocfg.hp_pins[0] = nid; | |
c9b58006 KY |
1650 | } |
1651 | ||
4a79ba34 | 1652 | alc_init_auto_hp(codec); |
6c819492 | 1653 | alc_init_auto_mic(codec); |
4a79ba34 TI |
1654 | return 1; |
1655 | } | |
ea1fb29a | 1656 | |
4a79ba34 | 1657 | static void alc_ssid_check(struct hda_codec *codec, |
6227cdce KY |
1658 | hda_nid_t porta, hda_nid_t porte, |
1659 | hda_nid_t portd, hda_nid_t porti) | |
4a79ba34 | 1660 | { |
6227cdce | 1661 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
4a79ba34 TI |
1662 | struct alc_spec *spec = codec->spec; |
1663 | snd_printd("realtek: " | |
1664 | "Enable default setup for auto mode as fallback\n"); | |
1665 | spec->init_amp = ALC_INIT_DEFAULT; | |
1666 | alc_init_auto_hp(codec); | |
6c819492 | 1667 | alc_init_auto_mic(codec); |
4a79ba34 | 1668 | } |
bc9f98a9 KY |
1669 | } |
1670 | ||
f95474ec | 1671 | /* |
f8f25ba3 | 1672 | * Fix-up pin default configurations and add default verbs |
f95474ec TI |
1673 | */ |
1674 | ||
1675 | struct alc_pincfg { | |
1676 | hda_nid_t nid; | |
1677 | u32 val; | |
1678 | }; | |
1679 | ||
f8f25ba3 | 1680 | struct alc_fixup { |
90622917 | 1681 | unsigned int sku; |
f8f25ba3 TI |
1682 | const struct alc_pincfg *pins; |
1683 | const struct hda_verb *verbs; | |
9d57883f TI |
1684 | void (*func)(struct hda_codec *codec, const struct alc_fixup *fix, |
1685 | int pre_init); | |
f8f25ba3 TI |
1686 | }; |
1687 | ||
1688 | static void alc_pick_fixup(struct hda_codec *codec, | |
f95474ec | 1689 | const struct snd_pci_quirk *quirk, |
7fa90e87 TI |
1690 | const struct alc_fixup *fix, |
1691 | int pre_init) | |
f95474ec TI |
1692 | { |
1693 | const struct alc_pincfg *cfg; | |
90622917 | 1694 | struct alc_spec *spec; |
f95474ec TI |
1695 | |
1696 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
1697 | if (!quirk) | |
1698 | return; | |
f8f25ba3 TI |
1699 | fix += quirk->value; |
1700 | cfg = fix->pins; | |
90622917 DH |
1701 | if (pre_init && fix->sku) { |
1702 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1703 | snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", | |
1704 | codec->chip_name, quirk->name); | |
1705 | #endif | |
1706 | spec = codec->spec; | |
1707 | spec->cdefine.sku_cfg = fix->sku; | |
1708 | spec->cdefine.fixup = 1; | |
1709 | } | |
7fa90e87 TI |
1710 | if (pre_init && cfg) { |
1711 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1712 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", | |
1713 | codec->chip_name, quirk->name); | |
1714 | #endif | |
f8f25ba3 TI |
1715 | for (; cfg->nid; cfg++) |
1716 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | |
1717 | } | |
7fa90e87 TI |
1718 | if (!pre_init && fix->verbs) { |
1719 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1720 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", | |
1721 | codec->chip_name, quirk->name); | |
1722 | #endif | |
f8f25ba3 | 1723 | add_verb(codec->spec, fix->verbs); |
7fa90e87 | 1724 | } |
9d57883f TI |
1725 | if (fix->func) { |
1726 | #ifdef CONFIG_SND_DEBUG_VERBOSE | |
1727 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n", | |
1728 | codec->chip_name, quirk->name); | |
1729 | #endif | |
1730 | fix->func(codec, fix, pre_init); | |
1731 | } | |
f95474ec TI |
1732 | } |
1733 | ||
274693f3 KY |
1734 | static int alc_read_coef_idx(struct hda_codec *codec, |
1735 | unsigned int coef_idx) | |
1736 | { | |
1737 | unsigned int val; | |
1738 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1739 | coef_idx); | |
1740 | val = snd_hda_codec_read(codec, 0x20, 0, | |
1741 | AC_VERB_GET_PROC_COEF, 0); | |
1742 | return val; | |
1743 | } | |
1744 | ||
977ddd6b KY |
1745 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
1746 | unsigned int coef_val) | |
1747 | { | |
1748 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | |
1749 | coef_idx); | |
1750 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, | |
1751 | coef_val); | |
1752 | } | |
1753 | ||
757899ac TI |
1754 | /* set right pin controls for digital I/O */ |
1755 | static void alc_auto_init_digital(struct hda_codec *codec) | |
1756 | { | |
1757 | struct alc_spec *spec = codec->spec; | |
1758 | int i; | |
1759 | hda_nid_t pin; | |
1760 | ||
1761 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1762 | pin = spec->autocfg.dig_out_pins[i]; | |
1763 | if (pin) { | |
1764 | snd_hda_codec_write(codec, pin, 0, | |
1765 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1766 | PIN_OUT); | |
1767 | } | |
1768 | } | |
1769 | pin = spec->autocfg.dig_in_pin; | |
1770 | if (pin) | |
1771 | snd_hda_codec_write(codec, pin, 0, | |
1772 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
1773 | PIN_IN); | |
1774 | } | |
1775 | ||
1776 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ | |
1777 | static void alc_auto_parse_digital(struct hda_codec *codec) | |
1778 | { | |
1779 | struct alc_spec *spec = codec->spec; | |
1780 | int i, err; | |
1781 | hda_nid_t dig_nid; | |
1782 | ||
1783 | /* support multiple SPDIFs; the secondary is set up as a slave */ | |
1784 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | |
1785 | err = snd_hda_get_connections(codec, | |
1786 | spec->autocfg.dig_out_pins[i], | |
1787 | &dig_nid, 1); | |
1788 | if (err < 0) | |
1789 | continue; | |
1790 | if (!i) { | |
1791 | spec->multiout.dig_out_nid = dig_nid; | |
1792 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | |
1793 | } else { | |
1794 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | |
1795 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | |
1796 | break; | |
1797 | spec->slave_dig_outs[i - 1] = dig_nid; | |
1798 | } | |
1799 | } | |
1800 | ||
1801 | if (spec->autocfg.dig_in_pin) { | |
01fdf180 TI |
1802 | dig_nid = codec->start_nid; |
1803 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { | |
1804 | unsigned int wcaps = get_wcaps(codec, dig_nid); | |
1805 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) | |
1806 | continue; | |
1807 | if (!(wcaps & AC_WCAP_DIGITAL)) | |
1808 | continue; | |
1809 | if (!(wcaps & AC_WCAP_CONN_LIST)) | |
1810 | continue; | |
1811 | err = get_connection_index(codec, dig_nid, | |
1812 | spec->autocfg.dig_in_pin); | |
1813 | if (err >= 0) { | |
1814 | spec->dig_in_nid = dig_nid; | |
1815 | break; | |
1816 | } | |
1817 | } | |
757899ac TI |
1818 | } |
1819 | } | |
1820 | ||
ef8ef5fb VP |
1821 | /* |
1822 | * ALC888 | |
1823 | */ | |
1824 | ||
1825 | /* | |
1826 | * 2ch mode | |
1827 | */ | |
1828 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { | |
1829 | /* Mic-in jack as mic in */ | |
1830 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1831 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1832 | /* Line-in jack as Line in */ | |
1833 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1834 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1835 | /* Line-Out as Front */ | |
1836 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1837 | { } /* end */ | |
1838 | }; | |
1839 | ||
1840 | /* | |
1841 | * 4ch mode | |
1842 | */ | |
1843 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { | |
1844 | /* Mic-in jack as mic in */ | |
1845 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1846 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1847 | /* Line-in jack as Surround */ | |
1848 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1849 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1850 | /* Line-Out as Front */ | |
1851 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1852 | { } /* end */ | |
1853 | }; | |
1854 | ||
1855 | /* | |
1856 | * 6ch mode | |
1857 | */ | |
1858 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { | |
1859 | /* Mic-in jack as CLFE */ | |
1860 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1861 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1862 | /* Line-in jack as Surround */ | |
1863 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1864 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1865 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ | |
1866 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1867 | { } /* end */ | |
1868 | }; | |
1869 | ||
1870 | /* | |
1871 | * 8ch mode | |
1872 | */ | |
1873 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { | |
1874 | /* Mic-in jack as CLFE */ | |
1875 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1876 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1877 | /* Line-in jack as Surround */ | |
1878 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1879 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1880 | /* Line-Out as Side */ | |
1881 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1882 | { } /* end */ | |
1883 | }; | |
1884 | ||
1885 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { | |
1886 | { 2, alc888_4ST_ch2_intel_init }, | |
1887 | { 4, alc888_4ST_ch4_intel_init }, | |
1888 | { 6, alc888_4ST_ch6_intel_init }, | |
1889 | { 8, alc888_4ST_ch8_intel_init }, | |
1890 | }; | |
1891 | ||
1892 | /* | |
1893 | * ALC888 Fujitsu Siemens Amillo xa3530 | |
1894 | */ | |
1895 | ||
1896 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | |
1897 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1898 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1899 | /* Connect Internal HP to Front */ | |
1900 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1901 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1902 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1903 | /* Connect Bass HP to Front */ | |
1904 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1906 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1907 | /* Connect Line-Out side jack (SPDIF) to Side */ | |
1908 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1909 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1910 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
1911 | /* Connect Mic jack to CLFE */ | |
1912 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1913 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1914 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
1915 | /* Connect Line-in jack to Surround */ | |
1916 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1917 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1918 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
1919 | /* Connect HP out jack to Front */ | |
1920 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1921 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1922 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1923 | /* Enable unsolicited event for HP jack and Line-out jack */ | |
1924 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1925 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
1926 | {} | |
1927 | }; | |
1928 | ||
a9fd4f3f | 1929 | static void alc_automute_amp(struct hda_codec *codec) |
ef8ef5fb | 1930 | { |
bb35febd | 1931 | alc_automute_speaker(codec, 0); |
ef8ef5fb VP |
1932 | } |
1933 | ||
a9fd4f3f TI |
1934 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
1935 | unsigned int res) | |
ef8ef5fb | 1936 | { |
a9fd4f3f TI |
1937 | if (codec->vendor_id == 0x10ec0880) |
1938 | res >>= 28; | |
1939 | else | |
1940 | res >>= 26; | |
1941 | if (res == ALC880_HP_EVENT) | |
1942 | alc_automute_amp(codec); | |
ef8ef5fb VP |
1943 | } |
1944 | ||
4f5d1706 | 1945 | static void alc889_automute_setup(struct hda_codec *codec) |
6732bd0d WF |
1946 | { |
1947 | struct alc_spec *spec = codec->spec; | |
1948 | ||
1949 | spec->autocfg.hp_pins[0] = 0x15; | |
1950 | spec->autocfg.speaker_pins[0] = 0x14; | |
1951 | spec->autocfg.speaker_pins[1] = 0x16; | |
1952 | spec->autocfg.speaker_pins[2] = 0x17; | |
1953 | spec->autocfg.speaker_pins[3] = 0x19; | |
1954 | spec->autocfg.speaker_pins[4] = 0x1a; | |
6732bd0d WF |
1955 | } |
1956 | ||
1957 | static void alc889_intel_init_hook(struct hda_codec *codec) | |
1958 | { | |
1959 | alc889_coef_init(codec); | |
4f5d1706 | 1960 | alc_automute_amp(codec); |
6732bd0d WF |
1961 | } |
1962 | ||
4f5d1706 | 1963 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
a9fd4f3f TI |
1964 | { |
1965 | struct alc_spec *spec = codec->spec; | |
1966 | ||
1967 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ | |
1968 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | |
1969 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | |
1970 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | |
a9fd4f3f | 1971 | } |
ef8ef5fb | 1972 | |
5b2d1eca VP |
1973 | /* |
1974 | * ALC888 Acer Aspire 4930G model | |
1975 | */ | |
1976 | ||
1977 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | |
1978 | /* Front Mic: set to PIN_IN (empty by default) */ | |
1979 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1980 | /* Unselect Front Mic by default in input mixer 3 */ | |
1981 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
ef8ef5fb | 1982 | /* Enable unsolicited event for HP jack */ |
5b2d1eca VP |
1983 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
1984 | /* Connect Internal HP to front */ | |
1985 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1986 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1987 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1988 | /* Connect HP out to front */ | |
1989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1990 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1991 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1992 | { } | |
1993 | }; | |
1994 | ||
d2fd4b09 TV |
1995 | /* |
1996 | * ALC888 Acer Aspire 6530G model | |
1997 | */ | |
1998 | ||
1999 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | |
d1284182 TV |
2000 | /* Route to built-in subwoofer as well as speakers */ |
2001 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2002 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2003 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2004 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
d2fd4b09 TV |
2005 | /* Bias voltage on for external mic port */ |
2006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | |
320d5920 EL |
2007 | /* Front Mic: set to PIN_IN (empty by default) */ |
2008 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2009 | /* Unselect Front Mic by default in input mixer 3 */ | |
2010 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
d2fd4b09 TV |
2011 | /* Enable unsolicited event for HP jack */ |
2012 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2013 | /* Enable speaker output */ | |
2014 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2015 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
d1284182 | 2016 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
d2fd4b09 TV |
2017 | /* Enable headphone output */ |
2018 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
2019 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2020 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1284182 | 2021 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
d2fd4b09 TV |
2022 | { } |
2023 | }; | |
2024 | ||
d9477207 DK |
2025 | /* |
2026 | *ALC888 Acer Aspire 7730G model | |
2027 | */ | |
2028 | ||
2029 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { | |
2030 | /* Bias voltage on for external mic port */ | |
2031 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | |
2032 | /* Front Mic: set to PIN_IN (empty by default) */ | |
2033 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2034 | /* Unselect Front Mic by default in input mixer 3 */ | |
2035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
2036 | /* Enable unsolicited event for HP jack */ | |
2037 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2038 | /* Enable speaker output */ | |
2039 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2040 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2041 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2042 | /* Enable headphone output */ | |
2043 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | |
2044 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2045 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2046 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2047 | /*Enable internal subwoofer */ | |
2048 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2049 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2050 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
2051 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
2052 | { } | |
2053 | }; | |
2054 | ||
3b315d70 | 2055 | /* |
018df418 | 2056 | * ALC889 Acer Aspire 8930G model |
3b315d70 HM |
2057 | */ |
2058 | ||
018df418 | 2059 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
3b315d70 HM |
2060 | /* Front Mic: set to PIN_IN (empty by default) */ |
2061 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2062 | /* Unselect Front Mic by default in input mixer 3 */ | |
2063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | |
2064 | /* Enable unsolicited event for HP jack */ | |
2065 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
2066 | /* Connect Internal Front to Front */ | |
2067 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2068 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2069 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2070 | /* Connect Internal Rear to Rear */ | |
2071 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2072 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2073 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2074 | /* Connect Internal CLFE to CLFE */ | |
2075 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2076 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2077 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
2078 | /* Connect HP out to Front */ | |
018df418 | 2079 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
3b315d70 HM |
2080 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2081 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2082 | /* Enable all DACs */ | |
2083 | /* DAC DISABLE/MUTE 1? */ | |
2084 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ | |
2085 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, | |
2086 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
2087 | /* DAC DISABLE/MUTE 2? */ | |
2088 | /* some bit here disables the other DACs. Init=0x4900 */ | |
2089 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | |
2090 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | |
018df418 HM |
2091 | /* DMIC fix |
2092 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | |
2093 | * which makes the stereo useless. However, either the mic or the ALC889 | |
2094 | * makes the signal become a difference/sum signal instead of standard | |
2095 | * stereo, which is annoying. So instead we flip this bit which makes the | |
2096 | * codec replicate the sum signal to both channels, turning it into a | |
2097 | * normal mono mic. | |
2098 | */ | |
2099 | /* DMIC_CONTROL? Init value = 0x0001 */ | |
2100 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
2101 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, | |
3b315d70 HM |
2102 | { } |
2103 | }; | |
2104 | ||
ef8ef5fb | 2105 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
5b2d1eca VP |
2106 | /* Front mic only available on one ADC */ |
2107 | { | |
2108 | .num_items = 4, | |
2109 | .items = { | |
2110 | { "Mic", 0x0 }, | |
2111 | { "Line", 0x2 }, | |
2112 | { "CD", 0x4 }, | |
2113 | { "Front Mic", 0xb }, | |
2114 | }, | |
2115 | }, | |
2116 | { | |
2117 | .num_items = 3, | |
2118 | .items = { | |
2119 | { "Mic", 0x0 }, | |
2120 | { "Line", 0x2 }, | |
2121 | { "CD", 0x4 }, | |
2122 | }, | |
2123 | } | |
2124 | }; | |
2125 | ||
d2fd4b09 TV |
2126 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
2127 | /* Interal mic only available on one ADC */ | |
2128 | { | |
684a8842 | 2129 | .num_items = 5, |
d2fd4b09 TV |
2130 | .items = { |
2131 | { "Ext Mic", 0x0 }, | |
684a8842 | 2132 | { "Line In", 0x2 }, |
d2fd4b09 | 2133 | { "CD", 0x4 }, |
684a8842 | 2134 | { "Input Mix", 0xa }, |
d2fd4b09 TV |
2135 | { "Int Mic", 0xb }, |
2136 | }, | |
2137 | }, | |
2138 | { | |
684a8842 | 2139 | .num_items = 4, |
d2fd4b09 TV |
2140 | .items = { |
2141 | { "Ext Mic", 0x0 }, | |
684a8842 | 2142 | { "Line In", 0x2 }, |
d2fd4b09 | 2143 | { "CD", 0x4 }, |
684a8842 | 2144 | { "Input Mix", 0xa }, |
d2fd4b09 TV |
2145 | }, |
2146 | } | |
2147 | }; | |
2148 | ||
018df418 HM |
2149 | static struct hda_input_mux alc889_capture_sources[3] = { |
2150 | /* Digital mic only available on first "ADC" */ | |
2151 | { | |
2152 | .num_items = 5, | |
2153 | .items = { | |
2154 | { "Mic", 0x0 }, | |
2155 | { "Line", 0x2 }, | |
2156 | { "CD", 0x4 }, | |
2157 | { "Front Mic", 0xb }, | |
2158 | { "Input Mix", 0xa }, | |
2159 | }, | |
2160 | }, | |
2161 | { | |
2162 | .num_items = 4, | |
2163 | .items = { | |
2164 | { "Mic", 0x0 }, | |
2165 | { "Line", 0x2 }, | |
2166 | { "CD", 0x4 }, | |
2167 | { "Input Mix", 0xa }, | |
2168 | }, | |
2169 | }, | |
2170 | { | |
2171 | .num_items = 4, | |
2172 | .items = { | |
2173 | { "Mic", 0x0 }, | |
2174 | { "Line", 0x2 }, | |
2175 | { "CD", 0x4 }, | |
2176 | { "Input Mix", 0xa }, | |
2177 | }, | |
2178 | } | |
2179 | }; | |
2180 | ||
ef8ef5fb | 2181 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
5b2d1eca VP |
2182 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2183 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2184 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2185 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2186 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
2187 | HDA_OUTPUT), | |
2188 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2189 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2190 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2191 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2192 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2193 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2194 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2195 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2196 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2198 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
2199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5b2d1eca VP |
2200 | { } /* end */ |
2201 | }; | |
2202 | ||
556eea9a HM |
2203 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
2204 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2205 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2206 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2207 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
2208 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
2209 | HDA_OUTPUT), | |
2210 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2211 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2212 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2213 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2214 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2216 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
2217 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2218 | { } /* end */ | |
2219 | }; | |
2220 | ||
2221 | ||
4f5d1706 | 2222 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
5b2d1eca | 2223 | { |
a9fd4f3f | 2224 | struct alc_spec *spec = codec->spec; |
5b2d1eca | 2225 | |
a9fd4f3f TI |
2226 | spec->autocfg.hp_pins[0] = 0x15; |
2227 | spec->autocfg.speaker_pins[0] = 0x14; | |
7cef4cf1 ŁW |
2228 | spec->autocfg.speaker_pins[1] = 0x16; |
2229 | spec->autocfg.speaker_pins[2] = 0x17; | |
5b2d1eca VP |
2230 | } |
2231 | ||
4f5d1706 | 2232 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
320d5920 EL |
2233 | { |
2234 | struct alc_spec *spec = codec->spec; | |
2235 | ||
2236 | spec->autocfg.hp_pins[0] = 0x15; | |
2237 | spec->autocfg.speaker_pins[0] = 0x14; | |
2238 | spec->autocfg.speaker_pins[1] = 0x16; | |
2239 | spec->autocfg.speaker_pins[2] = 0x17; | |
320d5920 EL |
2240 | } |
2241 | ||
d9477207 DK |
2242 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
2243 | { | |
2244 | struct alc_spec *spec = codec->spec; | |
2245 | ||
2246 | spec->autocfg.hp_pins[0] = 0x15; | |
2247 | spec->autocfg.speaker_pins[0] = 0x14; | |
2248 | spec->autocfg.speaker_pins[1] = 0x16; | |
2249 | spec->autocfg.speaker_pins[2] = 0x17; | |
2250 | } | |
2251 | ||
4f5d1706 | 2252 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
3b315d70 HM |
2253 | { |
2254 | struct alc_spec *spec = codec->spec; | |
2255 | ||
2256 | spec->autocfg.hp_pins[0] = 0x15; | |
2257 | spec->autocfg.speaker_pins[0] = 0x14; | |
2258 | spec->autocfg.speaker_pins[1] = 0x16; | |
2259 | spec->autocfg.speaker_pins[2] = 0x1b; | |
3b315d70 HM |
2260 | } |
2261 | ||
1da177e4 | 2262 | /* |
e9edcee0 TI |
2263 | * ALC880 3-stack model |
2264 | * | |
2265 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
9c7f852e TI |
2266 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
2267 | * F-Mic = 0x1b, HP = 0x19 | |
1da177e4 LT |
2268 | */ |
2269 | ||
e9edcee0 TI |
2270 | static hda_nid_t alc880_dac_nids[4] = { |
2271 | /* front, rear, clfe, rear_surr */ | |
2272 | 0x02, 0x05, 0x04, 0x03 | |
2273 | }; | |
2274 | ||
2275 | static hda_nid_t alc880_adc_nids[3] = { | |
2276 | /* ADC0-2 */ | |
2277 | 0x07, 0x08, 0x09, | |
2278 | }; | |
2279 | ||
2280 | /* The datasheet says the node 0x07 is connected from inputs, | |
2281 | * but it shows zero connection in the real implementation on some devices. | |
df694daa | 2282 | * Note: this is a 915GAV bug, fixed on 915GLV |
1da177e4 | 2283 | */ |
e9edcee0 TI |
2284 | static hda_nid_t alc880_adc_nids_alt[2] = { |
2285 | /* ADC1-2 */ | |
2286 | 0x08, 0x09, | |
2287 | }; | |
2288 | ||
2289 | #define ALC880_DIGOUT_NID 0x06 | |
2290 | #define ALC880_DIGIN_NID 0x0a | |
2291 | ||
2292 | static struct hda_input_mux alc880_capture_source = { | |
2293 | .num_items = 4, | |
2294 | .items = { | |
2295 | { "Mic", 0x0 }, | |
2296 | { "Front Mic", 0x3 }, | |
2297 | { "Line", 0x2 }, | |
2298 | { "CD", 0x4 }, | |
2299 | }, | |
2300 | }; | |
2301 | ||
2302 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
2303 | /* 2ch mode */ | |
2304 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
2305 | /* set line-in to input, mute it */ | |
2306 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2307 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2308 | /* set mic-in to input vref 80%, mute it */ | |
2309 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2310 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
2311 | { } /* end */ | |
2312 | }; | |
2313 | ||
2314 | /* 6ch mode */ | |
2315 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
2316 | /* set line-in to output, unmute it */ | |
2317 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2318 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2319 | /* set mic-in to output, unmute it */ | |
2320 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2321 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2322 | { } /* end */ | |
2323 | }; | |
2324 | ||
d2a6d7dc | 2325 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
e9edcee0 TI |
2326 | { 2, alc880_threestack_ch2_init }, |
2327 | { 6, alc880_threestack_ch6_init }, | |
2328 | }; | |
2329 | ||
c8b6bf9b | 2330 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
05acb863 | 2331 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2332 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 2333 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 2334 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
05acb863 TI |
2335 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2336 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2337 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2338 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1da177e4 LT |
2339 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2340 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2341 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2342 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2343 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2344 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2345 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
2346 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
e9edcee0 TI |
2347 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
2348 | { | |
2349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2350 | .name = "Channel Mode", | |
df694daa KY |
2351 | .info = alc_ch_mode_info, |
2352 | .get = alc_ch_mode_get, | |
2353 | .put = alc_ch_mode_put, | |
e9edcee0 TI |
2354 | }, |
2355 | { } /* end */ | |
2356 | }; | |
2357 | ||
2358 | /* capture mixer elements */ | |
f9e336f6 TI |
2359 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
2360 | struct snd_ctl_elem_info *uinfo) | |
2361 | { | |
2362 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2363 | struct alc_spec *spec = codec->spec; | |
2364 | int err; | |
1da177e4 | 2365 | |
5a9e02e9 | 2366 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2367 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
2368 | HDA_INPUT); | |
2369 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | |
5a9e02e9 | 2370 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2371 | return err; |
2372 | } | |
2373 | ||
2374 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |
2375 | unsigned int size, unsigned int __user *tlv) | |
2376 | { | |
2377 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2378 | struct alc_spec *spec = codec->spec; | |
2379 | int err; | |
1da177e4 | 2380 | |
5a9e02e9 | 2381 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2382 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
2383 | HDA_INPUT); | |
2384 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | |
5a9e02e9 | 2385 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2386 | return err; |
2387 | } | |
2388 | ||
2389 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, | |
2390 | struct snd_ctl_elem_value *ucontrol); | |
2391 | ||
2392 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | |
2393 | struct snd_ctl_elem_value *ucontrol, | |
2394 | getput_call_t func) | |
2395 | { | |
2396 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2397 | struct alc_spec *spec = codec->spec; | |
2398 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
2399 | int err; | |
2400 | ||
5a9e02e9 | 2401 | mutex_lock(&codec->control_mutex); |
f9e336f6 TI |
2402 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
2403 | 3, 0, HDA_INPUT); | |
2404 | err = func(kcontrol, ucontrol); | |
5a9e02e9 | 2405 | mutex_unlock(&codec->control_mutex); |
f9e336f6 TI |
2406 | return err; |
2407 | } | |
2408 | ||
2409 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, | |
2410 | struct snd_ctl_elem_value *ucontrol) | |
2411 | { | |
2412 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2413 | snd_hda_mixer_amp_volume_get); | |
2414 | } | |
2415 | ||
2416 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, | |
2417 | struct snd_ctl_elem_value *ucontrol) | |
2418 | { | |
2419 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2420 | snd_hda_mixer_amp_volume_put); | |
2421 | } | |
2422 | ||
2423 | /* capture mixer elements */ | |
2424 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info | |
2425 | ||
2426 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, | |
2427 | struct snd_ctl_elem_value *ucontrol) | |
2428 | { | |
2429 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2430 | snd_hda_mixer_amp_switch_get); | |
2431 | } | |
2432 | ||
2433 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |
2434 | struct snd_ctl_elem_value *ucontrol) | |
2435 | { | |
2436 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
2437 | snd_hda_mixer_amp_switch_put); | |
2438 | } | |
2439 | ||
a23b688f | 2440 | #define _DEFINE_CAPMIX(num) \ |
f9e336f6 TI |
2441 | { \ |
2442 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2443 | .name = "Capture Switch", \ | |
2444 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | |
2445 | .count = num, \ | |
2446 | .info = alc_cap_sw_info, \ | |
2447 | .get = alc_cap_sw_get, \ | |
2448 | .put = alc_cap_sw_put, \ | |
2449 | }, \ | |
2450 | { \ | |
2451 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2452 | .name = "Capture Volume", \ | |
2453 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | |
2454 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | |
2455 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ | |
2456 | .count = num, \ | |
2457 | .info = alc_cap_vol_info, \ | |
2458 | .get = alc_cap_vol_get, \ | |
2459 | .put = alc_cap_vol_put, \ | |
2460 | .tlv = { .c = alc_cap_vol_tlv }, \ | |
a23b688f TI |
2461 | } |
2462 | ||
2463 | #define _DEFINE_CAPSRC(num) \ | |
3c3e9892 TI |
2464 | { \ |
2465 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
2466 | /* .name = "Capture Source", */ \ | |
2467 | .name = "Input Source", \ | |
2468 | .count = num, \ | |
2469 | .info = alc_mux_enum_info, \ | |
2470 | .get = alc_mux_enum_get, \ | |
2471 | .put = alc_mux_enum_put, \ | |
a23b688f TI |
2472 | } |
2473 | ||
2474 | #define DEFINE_CAPMIX(num) \ | |
2475 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |
2476 | _DEFINE_CAPMIX(num), \ | |
2477 | _DEFINE_CAPSRC(num), \ | |
2478 | { } /* end */ \ | |
2479 | } | |
2480 | ||
2481 | #define DEFINE_CAPMIX_NOSRC(num) \ | |
2482 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | |
2483 | _DEFINE_CAPMIX(num), \ | |
2484 | { } /* end */ \ | |
f9e336f6 TI |
2485 | } |
2486 | ||
2487 | /* up to three ADCs */ | |
2488 | DEFINE_CAPMIX(1); | |
2489 | DEFINE_CAPMIX(2); | |
2490 | DEFINE_CAPMIX(3); | |
a23b688f TI |
2491 | DEFINE_CAPMIX_NOSRC(1); |
2492 | DEFINE_CAPMIX_NOSRC(2); | |
2493 | DEFINE_CAPMIX_NOSRC(3); | |
e9edcee0 TI |
2494 | |
2495 | /* | |
2496 | * ALC880 5-stack model | |
2497 | * | |
9c7f852e TI |
2498 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
2499 | * Side = 0x02 (0xd) | |
e9edcee0 TI |
2500 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
2501 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
2502 | */ | |
2503 | ||
2504 | /* additional mixers to alc880_three_stack_mixer */ | |
c8b6bf9b | 2505 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
e9edcee0 | 2506 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2507 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
1da177e4 LT |
2508 | { } /* end */ |
2509 | }; | |
2510 | ||
e9edcee0 TI |
2511 | /* channel source setting (6/8 channel selection for 5-stack) */ |
2512 | /* 6ch mode */ | |
2513 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
2514 | /* set line-in to input, mute it */ | |
2515 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2516 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
dfc0ff62 TI |
2517 | { } /* end */ |
2518 | }; | |
2519 | ||
e9edcee0 TI |
2520 | /* 8ch mode */ |
2521 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
2522 | /* set line-in to output, unmute it */ | |
2523 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
2524 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
2525 | { } /* end */ | |
2526 | }; | |
2527 | ||
d2a6d7dc | 2528 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
e9edcee0 TI |
2529 | { 6, alc880_fivestack_ch6_init }, |
2530 | { 8, alc880_fivestack_ch8_init }, | |
2531 | }; | |
2532 | ||
2533 | ||
2534 | /* | |
2535 | * ALC880 6-stack model | |
2536 | * | |
9c7f852e TI |
2537 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
2538 | * Side = 0x05 (0x0f) | |
e9edcee0 TI |
2539 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
2540 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
2541 | */ | |
2542 | ||
2543 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
2544 | /* front, rear, clfe, rear_surr */ | |
2545 | 0x02, 0x03, 0x04, 0x05 | |
f12ab1e0 | 2546 | }; |
e9edcee0 TI |
2547 | |
2548 | static struct hda_input_mux alc880_6stack_capture_source = { | |
2549 | .num_items = 4, | |
2550 | .items = { | |
2551 | { "Mic", 0x0 }, | |
2552 | { "Front Mic", 0x1 }, | |
2553 | { "Line", 0x2 }, | |
2554 | { "CD", 0x4 }, | |
2555 | }, | |
2556 | }; | |
2557 | ||
2558 | /* fixed 8-channels */ | |
d2a6d7dc | 2559 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
e9edcee0 TI |
2560 | { 8, NULL }, |
2561 | }; | |
2562 | ||
c8b6bf9b | 2563 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
16ded525 | 2564 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2565 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2566 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2567 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2568 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2569 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2570 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2571 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 | 2572 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 2573 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
16ded525 TI |
2574 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2575 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2576 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2577 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2580 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2581 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16ded525 TI |
2582 | { |
2583 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2584 | .name = "Channel Mode", | |
df694daa KY |
2585 | .info = alc_ch_mode_info, |
2586 | .get = alc_ch_mode_get, | |
2587 | .put = alc_ch_mode_put, | |
16ded525 TI |
2588 | }, |
2589 | { } /* end */ | |
2590 | }; | |
2591 | ||
e9edcee0 TI |
2592 | |
2593 | /* | |
2594 | * ALC880 W810 model | |
2595 | * | |
2596 | * W810 has rear IO for: | |
2597 | * Front (DAC 02) | |
2598 | * Surround (DAC 03) | |
2599 | * Center/LFE (DAC 04) | |
2600 | * Digital out (06) | |
2601 | * | |
2602 | * The system also has a pair of internal speakers, and a headphone jack. | |
2603 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
ea1fb29a | 2604 | * |
e9edcee0 TI |
2605 | * There is a variable resistor to control the speaker or headphone |
2606 | * volume. This is a hardware-only device without a software API. | |
2607 | * | |
2608 | * Plugging headphones in will disable the internal speakers. This is | |
2609 | * implemented in hardware, not via the driver using jack sense. In | |
2610 | * a similar fashion, plugging into the rear socket marked "front" will | |
2611 | * disable both the speakers and headphones. | |
2612 | * | |
2613 | * For input, there's a microphone jack, and an "audio in" jack. | |
2614 | * These may not do anything useful with this driver yet, because I | |
2615 | * haven't setup any initialization verbs for these yet... | |
2616 | */ | |
2617 | ||
2618 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
2619 | /* front, rear/surround, clfe */ | |
2620 | 0x02, 0x03, 0x04 | |
16ded525 TI |
2621 | }; |
2622 | ||
e9edcee0 | 2623 | /* fixed 6 channels */ |
d2a6d7dc | 2624 | static struct hda_channel_mode alc880_w810_modes[1] = { |
e9edcee0 TI |
2625 | { 6, NULL } |
2626 | }; | |
2627 | ||
2628 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
c8b6bf9b | 2629 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
16ded525 | 2630 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2631 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2632 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2633 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2634 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2635 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2636 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2637 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
e9edcee0 TI |
2638 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
2639 | { } /* end */ | |
2640 | }; | |
2641 | ||
2642 | ||
2643 | /* | |
2644 | * Z710V model | |
2645 | * | |
2646 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
9c7f852e TI |
2647 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
2648 | * Line = 0x1a | |
e9edcee0 TI |
2649 | */ |
2650 | ||
2651 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
2652 | 0x02 | |
2653 | }; | |
2654 | #define ALC880_Z71V_HP_DAC 0x03 | |
2655 | ||
2656 | /* fixed 2 channels */ | |
d2a6d7dc | 2657 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
e9edcee0 TI |
2658 | { 2, NULL } |
2659 | }; | |
2660 | ||
c8b6bf9b | 2661 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
e9edcee0 | 2662 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2663 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
e9edcee0 | 2664 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2665 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2666 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2667 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16ded525 TI |
2668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
2670 | { } /* end */ |
2671 | }; | |
2672 | ||
e9edcee0 | 2673 | |
e9edcee0 TI |
2674 | /* |
2675 | * ALC880 F1734 model | |
2676 | * | |
2677 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
2678 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
2679 | */ | |
2680 | ||
2681 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
2682 | 0x03 | |
2683 | }; | |
2684 | #define ALC880_F1734_HP_DAC 0x02 | |
2685 | ||
c8b6bf9b | 2686 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
e9edcee0 | 2687 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2688 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
2134ea4f TI |
2689 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
2690 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
e9edcee0 TI |
2691 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2692 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
937b4160 TI |
2693 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
2694 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e9edcee0 TI |
2695 | { } /* end */ |
2696 | }; | |
2697 | ||
937b4160 TI |
2698 | static struct hda_input_mux alc880_f1734_capture_source = { |
2699 | .num_items = 2, | |
2700 | .items = { | |
2701 | { "Mic", 0x1 }, | |
2702 | { "CD", 0x4 }, | |
2703 | }, | |
2704 | }; | |
2705 | ||
e9edcee0 | 2706 | |
e9edcee0 TI |
2707 | /* |
2708 | * ALC880 ASUS model | |
2709 | * | |
2710 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2711 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2712 | * Mic = 0x18, Line = 0x1a | |
2713 | */ | |
2714 | ||
2715 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
2716 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
2717 | ||
c8b6bf9b | 2718 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
16ded525 | 2719 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 2720 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 2721 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 2722 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
2723 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2724 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
2725 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2726 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 TI |
2727 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2728 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2729 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2730 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16ded525 TI |
2731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
2733 | { |
2734 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2735 | .name = "Channel Mode", | |
df694daa KY |
2736 | .info = alc_ch_mode_info, |
2737 | .get = alc_ch_mode_get, | |
2738 | .put = alc_ch_mode_put, | |
16ded525 TI |
2739 | }, |
2740 | { } /* end */ | |
2741 | }; | |
e9edcee0 | 2742 | |
e9edcee0 TI |
2743 | /* |
2744 | * ALC880 ASUS W1V model | |
2745 | * | |
2746 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
2747 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
2748 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
2749 | */ | |
2750 | ||
2751 | /* additional mixers to alc880_asus_mixer */ | |
c8b6bf9b | 2752 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
e9edcee0 TI |
2753 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
2754 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
2755 | { } /* end */ | |
2756 | }; | |
2757 | ||
df694daa KY |
2758 | /* TCL S700 */ |
2759 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
2760 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2761 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
2762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
2763 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
2764 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
2765 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
2766 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
2767 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
2768 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
df694daa KY |
2769 | { } /* end */ |
2770 | }; | |
2771 | ||
ccc656ce KY |
2772 | /* Uniwill */ |
2773 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2134ea4f TI |
2774 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2775 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2776 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2777 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
2778 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2779 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2780 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2781 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2782 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2783 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2784 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2785 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
2786 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2787 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2788 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2789 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce KY |
2790 | { |
2791 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2792 | .name = "Channel Mode", | |
2793 | .info = alc_ch_mode_info, | |
2794 | .get = alc_ch_mode_get, | |
2795 | .put = alc_ch_mode_put, | |
2796 | }, | |
2797 | { } /* end */ | |
2798 | }; | |
2799 | ||
2cf9f0fc TD |
2800 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
2801 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2802 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2803 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2804 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
2805 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
2806 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
2807 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2808 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2809 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2810 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2811 | { } /* end */ | |
2812 | }; | |
2813 | ||
ccc656ce | 2814 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
2134ea4f TI |
2815 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2816 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
2817 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
2818 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
2819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2821 | { } /* end */ | |
2822 | }; | |
2823 | ||
2134ea4f TI |
2824 | /* |
2825 | * virtual master controls | |
2826 | */ | |
2827 | ||
2828 | /* | |
2829 | * slave controls for virtual master | |
2830 | */ | |
2831 | static const char *alc_slave_vols[] = { | |
2832 | "Front Playback Volume", | |
2833 | "Surround Playback Volume", | |
2834 | "Center Playback Volume", | |
2835 | "LFE Playback Volume", | |
2836 | "Side Playback Volume", | |
2837 | "Headphone Playback Volume", | |
2838 | "Speaker Playback Volume", | |
2839 | "Mono Playback Volume", | |
2134ea4f | 2840 | "Line-Out Playback Volume", |
26f5df26 | 2841 | "PCM Playback Volume", |
2134ea4f TI |
2842 | NULL, |
2843 | }; | |
2844 | ||
2845 | static const char *alc_slave_sws[] = { | |
2846 | "Front Playback Switch", | |
2847 | "Surround Playback Switch", | |
2848 | "Center Playback Switch", | |
2849 | "LFE Playback Switch", | |
2850 | "Side Playback Switch", | |
2851 | "Headphone Playback Switch", | |
2852 | "Speaker Playback Switch", | |
2853 | "Mono Playback Switch", | |
edb54a55 | 2854 | "IEC958 Playback Switch", |
23033b2b TI |
2855 | "Line-Out Playback Switch", |
2856 | "PCM Playback Switch", | |
2134ea4f TI |
2857 | NULL, |
2858 | }; | |
2859 | ||
1da177e4 | 2860 | /* |
e9edcee0 | 2861 | * build control elements |
1da177e4 | 2862 | */ |
603c4019 | 2863 | |
5b0cb1d8 JK |
2864 | #define NID_MAPPING (-1) |
2865 | ||
2866 | #define SUBDEV_SPEAKER_ (0 << 6) | |
2867 | #define SUBDEV_HP_ (1 << 6) | |
2868 | #define SUBDEV_LINE_ (2 << 6) | |
2869 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) | |
2870 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) | |
2871 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) | |
2872 | ||
603c4019 TI |
2873 | static void alc_free_kctls(struct hda_codec *codec); |
2874 | ||
67d634c0 | 2875 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
2876 | /* additional beep mixers; the actual parameters are overwritten at build */ |
2877 | static struct snd_kcontrol_new alc_beep_mixer[] = { | |
2878 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | |
123c07ae | 2879 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
45bdd1c1 TI |
2880 | { } /* end */ |
2881 | }; | |
67d634c0 | 2882 | #endif |
45bdd1c1 | 2883 | |
1da177e4 LT |
2884 | static int alc_build_controls(struct hda_codec *codec) |
2885 | { | |
2886 | struct alc_spec *spec = codec->spec; | |
2f44f847 | 2887 | struct snd_kcontrol *kctl = NULL; |
5b0cb1d8 JK |
2888 | struct snd_kcontrol_new *knew; |
2889 | int i, j, err; | |
2890 | unsigned int u; | |
2891 | hda_nid_t nid; | |
1da177e4 LT |
2892 | |
2893 | for (i = 0; i < spec->num_mixers; i++) { | |
2894 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
2895 | if (err < 0) | |
2896 | return err; | |
2897 | } | |
f9e336f6 TI |
2898 | if (spec->cap_mixer) { |
2899 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); | |
2900 | if (err < 0) | |
2901 | return err; | |
2902 | } | |
1da177e4 | 2903 | if (spec->multiout.dig_out_nid) { |
9c7f852e TI |
2904 | err = snd_hda_create_spdif_out_ctls(codec, |
2905 | spec->multiout.dig_out_nid); | |
1da177e4 LT |
2906 | if (err < 0) |
2907 | return err; | |
e64f14f4 TI |
2908 | if (!spec->no_analog) { |
2909 | err = snd_hda_create_spdif_share_sw(codec, | |
2910 | &spec->multiout); | |
2911 | if (err < 0) | |
2912 | return err; | |
2913 | spec->multiout.share_spdif = 1; | |
2914 | } | |
1da177e4 LT |
2915 | } |
2916 | if (spec->dig_in_nid) { | |
2917 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
2918 | if (err < 0) | |
2919 | return err; | |
2920 | } | |
2134ea4f | 2921 | |
67d634c0 | 2922 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
2923 | /* create beep controls if needed */ |
2924 | if (spec->beep_amp) { | |
2925 | struct snd_kcontrol_new *knew; | |
2926 | for (knew = alc_beep_mixer; knew->name; knew++) { | |
2927 | struct snd_kcontrol *kctl; | |
2928 | kctl = snd_ctl_new1(knew, codec); | |
2929 | if (!kctl) | |
2930 | return -ENOMEM; | |
2931 | kctl->private_value = spec->beep_amp; | |
5e26dfd0 | 2932 | err = snd_hda_ctl_add(codec, 0, kctl); |
45bdd1c1 TI |
2933 | if (err < 0) |
2934 | return err; | |
2935 | } | |
2936 | } | |
67d634c0 | 2937 | #endif |
45bdd1c1 | 2938 | |
2134ea4f | 2939 | /* if we have no master control, let's create it */ |
e64f14f4 TI |
2940 | if (!spec->no_analog && |
2941 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
1c82ed1b | 2942 | unsigned int vmaster_tlv[4]; |
2134ea4f | 2943 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
1c82ed1b | 2944 | HDA_OUTPUT, vmaster_tlv); |
2134ea4f | 2945 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1c82ed1b | 2946 | vmaster_tlv, alc_slave_vols); |
2134ea4f TI |
2947 | if (err < 0) |
2948 | return err; | |
2949 | } | |
e64f14f4 TI |
2950 | if (!spec->no_analog && |
2951 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
2134ea4f TI |
2952 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
2953 | NULL, alc_slave_sws); | |
2954 | if (err < 0) | |
2955 | return err; | |
2956 | } | |
2957 | ||
5b0cb1d8 | 2958 | /* assign Capture Source enums to NID */ |
fbe618f2 TI |
2959 | if (spec->capsrc_nids || spec->adc_nids) { |
2960 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | |
2961 | if (!kctl) | |
2962 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | |
2963 | for (i = 0; kctl && i < kctl->count; i++) { | |
2964 | hda_nid_t *nids = spec->capsrc_nids; | |
2965 | if (!nids) | |
2966 | nids = spec->adc_nids; | |
2967 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | |
2968 | if (err < 0) | |
2969 | return err; | |
2970 | } | |
5b0cb1d8 JK |
2971 | } |
2972 | if (spec->cap_mixer) { | |
2973 | const char *kname = kctl ? kctl->id.name : NULL; | |
2974 | for (knew = spec->cap_mixer; knew->name; knew++) { | |
2975 | if (kname && strcmp(knew->name, kname) == 0) | |
2976 | continue; | |
2977 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
2978 | for (i = 0; kctl && i < kctl->count; i++) { | |
2979 | err = snd_hda_add_nid(codec, kctl, i, | |
2980 | spec->adc_nids[i]); | |
2981 | if (err < 0) | |
2982 | return err; | |
2983 | } | |
2984 | } | |
2985 | } | |
2986 | ||
2987 | /* other nid->control mapping */ | |
2988 | for (i = 0; i < spec->num_mixers; i++) { | |
2989 | for (knew = spec->mixers[i]; knew->name; knew++) { | |
2990 | if (knew->iface != NID_MAPPING) | |
2991 | continue; | |
2992 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | |
2993 | if (kctl == NULL) | |
2994 | continue; | |
2995 | u = knew->subdevice; | |
2996 | for (j = 0; j < 4; j++, u >>= 8) { | |
2997 | nid = u & 0x3f; | |
2998 | if (nid == 0) | |
2999 | continue; | |
3000 | switch (u & 0xc0) { | |
3001 | case SUBDEV_SPEAKER_: | |
3002 | nid = spec->autocfg.speaker_pins[nid]; | |
3003 | break; | |
3004 | case SUBDEV_LINE_: | |
3005 | nid = spec->autocfg.line_out_pins[nid]; | |
3006 | break; | |
3007 | case SUBDEV_HP_: | |
3008 | nid = spec->autocfg.hp_pins[nid]; | |
3009 | break; | |
3010 | default: | |
3011 | continue; | |
3012 | } | |
3013 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
3014 | if (err < 0) | |
3015 | return err; | |
3016 | } | |
3017 | u = knew->private_value; | |
3018 | for (j = 0; j < 4; j++, u >>= 8) { | |
3019 | nid = u & 0xff; | |
3020 | if (nid == 0) | |
3021 | continue; | |
3022 | err = snd_hda_add_nid(codec, kctl, 0, nid); | |
3023 | if (err < 0) | |
3024 | return err; | |
3025 | } | |
3026 | } | |
3027 | } | |
bae84e70 TI |
3028 | |
3029 | alc_free_kctls(codec); /* no longer needed */ | |
3030 | ||
1da177e4 LT |
3031 | return 0; |
3032 | } | |
3033 | ||
e9edcee0 | 3034 | |
1da177e4 LT |
3035 | /* |
3036 | * initialize the codec volumes, etc | |
3037 | */ | |
3038 | ||
e9edcee0 TI |
3039 | /* |
3040 | * generic initialization of ADC, input mixers and output mixers | |
3041 | */ | |
3042 | static struct hda_verb alc880_volume_init_verbs[] = { | |
3043 | /* | |
3044 | * Unmute ADC0-2 and set the default input to mic-in | |
3045 | */ | |
71fe7b82 | 3046 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 3047 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 3048 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 3049 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 3050 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 3051 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 3052 | |
e9edcee0 TI |
3053 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
3054 | * mixer widget | |
9c7f852e TI |
3055 | * Note: PASD motherboards uses the Line In 2 as the input for front |
3056 | * panel mic (mic 2) | |
1da177e4 | 3057 | */ |
e9edcee0 | 3058 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
cb53c626 TI |
3059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3060 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3061 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
3062 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
3063 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
3064 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
3065 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
1da177e4 | 3066 | |
e9edcee0 TI |
3067 | /* |
3068 | * Set up output mixers (0x0c - 0x0f) | |
1da177e4 | 3069 | */ |
e9edcee0 TI |
3070 | /* set vol=0 to output mixers */ |
3071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3072 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3073 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3074 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3075 | /* set up input amps for analog loopback */ | |
3076 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
05acb863 TI |
3077 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3078 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
3079 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3080 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
3081 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3082 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
3083 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3084 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
3085 | |
3086 | { } | |
3087 | }; | |
3088 | ||
e9edcee0 TI |
3089 | /* |
3090 | * 3-stack pin configuration: | |
3091 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
3092 | */ | |
3093 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
3094 | /* | |
3095 | * preset connection lists of input pins | |
3096 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
3097 | */ | |
3098 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3099 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3100 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3101 | ||
3102 | /* | |
3103 | * Set pin mode and muting | |
3104 | */ | |
3105 | /* set front pin widgets 0x14 for output */ | |
05acb863 | 3106 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
3107 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3108 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3109 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3110 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3111 | /* Mic2 (as headphone out) for HP output */ | |
3112 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3113 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1da177e4 | 3114 | /* Line In pin widget for input */ |
05acb863 | 3115 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
3116 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3117 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
3118 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3119 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1da177e4 | 3120 | /* CD pin widget for input */ |
05acb863 | 3121 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 3122 | |
e9edcee0 TI |
3123 | { } |
3124 | }; | |
1da177e4 | 3125 | |
e9edcee0 TI |
3126 | /* |
3127 | * 5-stack pin configuration: | |
3128 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
3129 | * line-in/side = 0x1a, f-mic = 0x1b | |
3130 | */ | |
3131 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
3132 | /* | |
3133 | * preset connection lists of input pins | |
3134 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1da177e4 | 3135 | */ |
e9edcee0 TI |
3136 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
3137 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
1da177e4 | 3138 | |
e9edcee0 TI |
3139 | /* |
3140 | * Set pin mode and muting | |
1da177e4 | 3141 | */ |
e9edcee0 TI |
3142 | /* set pin widgets 0x14-0x17 for output */ |
3143 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3144 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3145 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3146 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3147 | /* unmute pins for output (no gain on this amp) */ | |
3148 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3149 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3150 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3151 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3152 | ||
3153 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3154 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3155 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3156 | /* Mic2 (as headphone out) for HP output */ | |
3157 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3158 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3159 | /* Line In pin widget for input */ | |
3160 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3161 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3162 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
3163 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3164 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3165 | /* CD pin widget for input */ | |
3166 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1da177e4 LT |
3167 | |
3168 | { } | |
3169 | }; | |
3170 | ||
e9edcee0 TI |
3171 | /* |
3172 | * W810 pin configuration: | |
3173 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
3174 | */ | |
3175 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
3176 | /* hphone/speaker input selector: front DAC */ | |
3177 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
1da177e4 | 3178 | |
05acb863 | 3179 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3180 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 3181 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3182 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 3183 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3184 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 3185 | |
e9edcee0 | 3186 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
05acb863 | 3187 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1da177e4 | 3188 | |
1da177e4 LT |
3189 | { } |
3190 | }; | |
3191 | ||
e9edcee0 TI |
3192 | /* |
3193 | * Z71V pin configuration: | |
3194 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
3195 | */ | |
3196 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
05acb863 | 3197 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3198 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 3199 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 3200 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
dfc0ff62 | 3201 | |
16ded525 | 3202 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3203 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 | 3204 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3205 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 TI |
3206 | |
3207 | { } | |
3208 | }; | |
3209 | ||
e9edcee0 TI |
3210 | /* |
3211 | * 6-stack pin configuration: | |
9c7f852e TI |
3212 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
3213 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
e9edcee0 TI |
3214 | */ |
3215 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
3216 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3217 | ||
16ded525 | 3218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3220 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3221 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3222 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3223 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3224 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
3225 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3226 | ||
16ded525 | 3227 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3228 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3229 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 3230 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3231 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 | 3232 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3233 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 3234 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3235 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 3236 | |
e9edcee0 TI |
3237 | { } |
3238 | }; | |
3239 | ||
ccc656ce KY |
3240 | /* |
3241 | * Uniwill pin configuration: | |
3242 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
3243 | * line = 0x1a | |
3244 | */ | |
3245 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
3246 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3247 | ||
3248 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3249 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3250 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3251 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3252 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3253 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3254 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3255 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3256 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3259 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3260 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3261 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3262 | ||
3263 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3264 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3265 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3266 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3267 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3268 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3269 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
3270 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
3271 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3272 | ||
3273 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3274 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
3275 | ||
3276 | { } | |
3277 | }; | |
3278 | ||
3279 | /* | |
3280 | * Uniwill P53 | |
ea1fb29a | 3281 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
ccc656ce KY |
3282 | */ |
3283 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
3284 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3285 | ||
3286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3287 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3288 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3289 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3290 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3291 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3292 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3293 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3294 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3295 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3296 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
3297 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
3298 | ||
3299 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3300 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3301 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3302 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3303 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3304 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3305 | ||
3306 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3307 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
3308 | ||
3309 | { } | |
3310 | }; | |
3311 | ||
2cf9f0fc TD |
3312 | static struct hda_verb alc880_beep_init_verbs[] = { |
3313 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
3314 | { } | |
3315 | }; | |
3316 | ||
458a4fab TI |
3317 | /* auto-toggle front mic */ |
3318 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |
3319 | { | |
3320 | unsigned int present; | |
3321 | unsigned char bits; | |
ccc656ce | 3322 | |
864f92be | 3323 | present = snd_hda_jack_detect(codec, 0x18); |
47fd830a TI |
3324 | bits = present ? HDA_AMP_MUTE : 0; |
3325 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
458a4fab TI |
3326 | } |
3327 | ||
4f5d1706 | 3328 | static void alc880_uniwill_setup(struct hda_codec *codec) |
458a4fab | 3329 | { |
a9fd4f3f TI |
3330 | struct alc_spec *spec = codec->spec; |
3331 | ||
3332 | spec->autocfg.hp_pins[0] = 0x14; | |
3333 | spec->autocfg.speaker_pins[0] = 0x15; | |
3334 | spec->autocfg.speaker_pins[0] = 0x16; | |
4f5d1706 TI |
3335 | } |
3336 | ||
3337 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | |
3338 | { | |
a9fd4f3f | 3339 | alc_automute_amp(codec); |
458a4fab | 3340 | alc880_uniwill_mic_automute(codec); |
ccc656ce KY |
3341 | } |
3342 | ||
3343 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
3344 | unsigned int res) | |
3345 | { | |
3346 | /* Looks like the unsol event is incompatible with the standard | |
3347 | * definition. 4bit tag is placed at 28 bit! | |
3348 | */ | |
458a4fab | 3349 | switch (res >> 28) { |
458a4fab TI |
3350 | case ALC880_MIC_EVENT: |
3351 | alc880_uniwill_mic_automute(codec); | |
3352 | break; | |
a9fd4f3f TI |
3353 | default: |
3354 | alc_automute_amp_unsol_event(codec, res); | |
3355 | break; | |
458a4fab | 3356 | } |
ccc656ce KY |
3357 | } |
3358 | ||
4f5d1706 | 3359 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
ccc656ce | 3360 | { |
a9fd4f3f | 3361 | struct alc_spec *spec = codec->spec; |
ccc656ce | 3362 | |
a9fd4f3f TI |
3363 | spec->autocfg.hp_pins[0] = 0x14; |
3364 | spec->autocfg.speaker_pins[0] = 0x15; | |
ccc656ce KY |
3365 | } |
3366 | ||
3367 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
3368 | { | |
3369 | unsigned int present; | |
ea1fb29a | 3370 | |
ccc656ce | 3371 | present = snd_hda_codec_read(codec, 0x21, 0, |
47fd830a TI |
3372 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
3373 | present &= HDA_AMP_VOLMASK; | |
3374 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
3375 | HDA_AMP_VOLMASK, present); | |
3376 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
3377 | HDA_AMP_VOLMASK, present); | |
ccc656ce | 3378 | } |
47fd830a | 3379 | |
ccc656ce KY |
3380 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
3381 | unsigned int res) | |
3382 | { | |
3383 | /* Looks like the unsol event is incompatible with the standard | |
3384 | * definition. 4bit tag is placed at 28 bit! | |
3385 | */ | |
f12ab1e0 | 3386 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
ccc656ce | 3387 | alc880_uniwill_p53_dcvol_automute(codec); |
a9fd4f3f TI |
3388 | else |
3389 | alc_automute_amp_unsol_event(codec, res); | |
ccc656ce KY |
3390 | } |
3391 | ||
e9edcee0 TI |
3392 | /* |
3393 | * F1734 pin configuration: | |
3394 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
3395 | */ | |
3396 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
ee7a9c7c | 3397 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
16ded525 TI |
3398 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
3399 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3400 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3401 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3402 | ||
e9edcee0 | 3403 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
16ded525 | 3404 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
e9edcee0 | 3405 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16ded525 | 3406 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3407 | |
e9edcee0 TI |
3408 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3409 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
ee7a9c7c | 3410 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
e9edcee0 | 3411 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 3412 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3413 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3414 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3415 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3416 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
dfc0ff62 | 3417 | |
937b4160 TI |
3418 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
3419 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
3420 | ||
dfc0ff62 TI |
3421 | { } |
3422 | }; | |
3423 | ||
e9edcee0 TI |
3424 | /* |
3425 | * ASUS pin configuration: | |
3426 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
3427 | */ | |
3428 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
16ded525 TI |
3429 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
3430 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3431 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3432 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3433 | ||
3434 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
e9edcee0 | 3435 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3436 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3437 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3438 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3439 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3440 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
3441 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3442 | ||
3443 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3444 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3445 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3446 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3447 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16ded525 | 3449 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 3450 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 3451 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 3452 | |
e9edcee0 TI |
3453 | { } |
3454 | }; | |
16ded525 | 3455 | |
e9edcee0 | 3456 | /* Enable GPIO mask and set output */ |
bc9f98a9 KY |
3457 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
3458 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
64a8be74 | 3459 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
df694daa KY |
3460 | |
3461 | /* Clevo m520g init */ | |
3462 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
3463 | /* headphone output */ | |
3464 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3465 | /* line-out */ | |
3466 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3467 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3468 | /* Line-in */ | |
3469 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3470 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3471 | /* CD */ | |
3472 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3473 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3474 | /* Mic1 (rear panel) */ | |
3475 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3476 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3477 | /* Mic2 (front panel) */ | |
3478 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3479 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3480 | /* headphone */ | |
3481 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3482 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3483 | /* change to EAPD mode */ | |
3484 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3485 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3486 | ||
3487 | { } | |
16ded525 TI |
3488 | }; |
3489 | ||
df694daa | 3490 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
4b146cb0 TI |
3491 | /* change to EAPD mode */ |
3492 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3493 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3494 | ||
df694daa KY |
3495 | /* Headphone output */ |
3496 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3497 | /* Front output*/ | |
3498 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3499 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
3500 | ||
3501 | /* Line In pin widget for input */ | |
3502 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3503 | /* CD pin widget for input */ | |
3504 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3505 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3506 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3507 | ||
3508 | /* change to EAPD mode */ | |
3509 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3510 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
3511 | ||
3512 | { } | |
3513 | }; | |
16ded525 | 3514 | |
e9edcee0 | 3515 | /* |
ae6b813a TI |
3516 | * LG m1 express dual |
3517 | * | |
3518 | * Pin assignment: | |
3519 | * Rear Line-In/Out (blue): 0x14 | |
3520 | * Build-in Mic-In: 0x15 | |
3521 | * Speaker-out: 0x17 | |
3522 | * HP-Out (green): 0x1b | |
3523 | * Mic-In/Out (red): 0x19 | |
3524 | * SPDIF-Out: 0x1e | |
3525 | */ | |
3526 | ||
3527 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
3528 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
3529 | 0x05, 0x02, 0x03 | |
3530 | }; | |
3531 | ||
3532 | /* seems analog CD is not working */ | |
3533 | static struct hda_input_mux alc880_lg_capture_source = { | |
3534 | .num_items = 3, | |
3535 | .items = { | |
3536 | { "Mic", 0x1 }, | |
3537 | { "Line", 0x5 }, | |
3538 | { "Internal Mic", 0x6 }, | |
3539 | }, | |
3540 | }; | |
3541 | ||
3542 | /* 2,4,6 channel modes */ | |
3543 | static struct hda_verb alc880_lg_ch2_init[] = { | |
3544 | /* set line-in and mic-in to input */ | |
3545 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
3546 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3547 | { } | |
3548 | }; | |
3549 | ||
3550 | static struct hda_verb alc880_lg_ch4_init[] = { | |
3551 | /* set line-in to out and mic-in to input */ | |
3552 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3553 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
3554 | { } | |
3555 | }; | |
3556 | ||
3557 | static struct hda_verb alc880_lg_ch6_init[] = { | |
3558 | /* set line-in and mic-in to output */ | |
3559 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3560 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
3561 | { } | |
3562 | }; | |
3563 | ||
3564 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
3565 | { 2, alc880_lg_ch2_init }, | |
3566 | { 4, alc880_lg_ch4_init }, | |
3567 | { 6, alc880_lg_ch6_init }, | |
3568 | }; | |
3569 | ||
3570 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
2134ea4f TI |
3571 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
3572 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
ae6b813a TI |
3573 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
3574 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
3575 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
3576 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
3577 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
3578 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
3579 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3581 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
3582 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
3583 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
3584 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
3585 | { | |
3586 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3587 | .name = "Channel Mode", | |
3588 | .info = alc_ch_mode_info, | |
3589 | .get = alc_ch_mode_get, | |
3590 | .put = alc_ch_mode_put, | |
3591 | }, | |
3592 | { } /* end */ | |
3593 | }; | |
3594 | ||
3595 | static struct hda_verb alc880_lg_init_verbs[] = { | |
3596 | /* set capture source to mic-in */ | |
3597 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3598 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3599 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3600 | /* mute all amp mixer inputs */ | |
3601 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
cb53c626 TI |
3602 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
3603 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
ae6b813a TI |
3604 | /* line-in to input */ |
3605 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3606 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3607 | /* built-in mic */ | |
3608 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3609 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3610 | /* speaker-out */ | |
3611 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3612 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3613 | /* mic-in to input */ | |
3614 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
3615 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3616 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3617 | /* HP-out */ | |
3618 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
3619 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3620 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3621 | /* jack sense */ | |
a9fd4f3f | 3622 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
ae6b813a TI |
3623 | { } |
3624 | }; | |
3625 | ||
3626 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 3627 | static void alc880_lg_setup(struct hda_codec *codec) |
ae6b813a | 3628 | { |
a9fd4f3f | 3629 | struct alc_spec *spec = codec->spec; |
ae6b813a | 3630 | |
a9fd4f3f TI |
3631 | spec->autocfg.hp_pins[0] = 0x1b; |
3632 | spec->autocfg.speaker_pins[0] = 0x17; | |
ae6b813a TI |
3633 | } |
3634 | ||
d681518a TI |
3635 | /* |
3636 | * LG LW20 | |
3637 | * | |
3638 | * Pin assignment: | |
3639 | * Speaker-out: 0x14 | |
3640 | * Mic-In: 0x18 | |
e4f41da9 CM |
3641 | * Built-in Mic-In: 0x19 |
3642 | * Line-In: 0x1b | |
3643 | * HP-Out: 0x1a | |
d681518a TI |
3644 | * SPDIF-Out: 0x1e |
3645 | */ | |
3646 | ||
d681518a | 3647 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
e4f41da9 | 3648 | .num_items = 3, |
d681518a TI |
3649 | .items = { |
3650 | { "Mic", 0x0 }, | |
3651 | { "Internal Mic", 0x1 }, | |
e4f41da9 | 3652 | { "Line In", 0x2 }, |
d681518a TI |
3653 | }, |
3654 | }; | |
3655 | ||
0a8c5da3 CM |
3656 | #define alc880_lg_lw_modes alc880_threestack_modes |
3657 | ||
d681518a | 3658 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
0a8c5da3 CM |
3659 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
3660 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
3661 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
3662 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
3663 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
3664 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
3665 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
3666 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
3667 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
3668 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d681518a TI |
3669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
3670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3671 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
3672 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
0a8c5da3 CM |
3673 | { |
3674 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3675 | .name = "Channel Mode", | |
3676 | .info = alc_ch_mode_info, | |
3677 | .get = alc_ch_mode_get, | |
3678 | .put = alc_ch_mode_put, | |
3679 | }, | |
d681518a TI |
3680 | { } /* end */ |
3681 | }; | |
3682 | ||
3683 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
0a8c5da3 CM |
3684 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
3685 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
3686 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
3687 | ||
d681518a TI |
3688 | /* set capture source to mic-in */ |
3689 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3690 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3691 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
cb53c626 | 3692 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
d681518a TI |
3693 | /* speaker-out */ |
3694 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3695 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3696 | /* HP-out */ | |
d681518a TI |
3697 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
3698 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3699 | /* mic-in to input */ | |
3700 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3701 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3702 | /* built-in mic */ | |
3703 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3704 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3705 | /* jack sense */ | |
a9fd4f3f | 3706 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
d681518a TI |
3707 | { } |
3708 | }; | |
3709 | ||
3710 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 3711 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
d681518a | 3712 | { |
a9fd4f3f | 3713 | struct alc_spec *spec = codec->spec; |
d681518a | 3714 | |
a9fd4f3f TI |
3715 | spec->autocfg.hp_pins[0] = 0x1b; |
3716 | spec->autocfg.speaker_pins[0] = 0x14; | |
d681518a TI |
3717 | } |
3718 | ||
df99cd33 TI |
3719 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
3720 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
3721 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
3722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3724 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3725 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3726 | { } /* end */ | |
3727 | }; | |
3728 | ||
3729 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
3730 | .num_items = 2, | |
3731 | .items = { | |
3732 | { "Mic", 0x0 }, | |
3733 | { "Internal Mic", 0x1 }, | |
3734 | }, | |
3735 | }; | |
3736 | ||
3737 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
3738 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
3739 | ||
3740 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3741 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3742 | ||
3743 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
3744 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
3745 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3746 | /* Mic2 (as headphone out) for HP output */ | |
3747 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
3748 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3749 | /* Internal Speaker */ | |
3750 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3751 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3752 | ||
3753 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
3754 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
3755 | ||
3756 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
3757 | { } | |
3758 | }; | |
3759 | ||
3760 | /* toggle speaker-output according to the hp-jack state */ | |
3761 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
3762 | { | |
a9fd4f3f TI |
3763 | struct alc_spec *spec = codec->spec; |
3764 | alc_automute_amp(codec); | |
3765 | /* toggle EAPD */ | |
3766 | if (spec->jack_present) | |
df99cd33 TI |
3767 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
3768 | else | |
3769 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
3770 | } | |
3771 | ||
3772 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
3773 | unsigned int res) | |
3774 | { | |
3775 | /* Looks like the unsol event is incompatible with the standard | |
3776 | * definition. 4bit tag is placed at 28 bit! | |
3777 | */ | |
3778 | if ((res >> 28) == ALC880_HP_EVENT) | |
3779 | alc880_medion_rim_automute(codec); | |
3780 | } | |
3781 | ||
4f5d1706 | 3782 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
a9fd4f3f TI |
3783 | { |
3784 | struct alc_spec *spec = codec->spec; | |
3785 | ||
3786 | spec->autocfg.hp_pins[0] = 0x14; | |
3787 | spec->autocfg.speaker_pins[0] = 0x1b; | |
a9fd4f3f TI |
3788 | } |
3789 | ||
cb53c626 TI |
3790 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3791 | static struct hda_amp_list alc880_loopbacks[] = { | |
3792 | { 0x0b, HDA_INPUT, 0 }, | |
3793 | { 0x0b, HDA_INPUT, 1 }, | |
3794 | { 0x0b, HDA_INPUT, 2 }, | |
3795 | { 0x0b, HDA_INPUT, 3 }, | |
3796 | { 0x0b, HDA_INPUT, 4 }, | |
3797 | { } /* end */ | |
3798 | }; | |
3799 | ||
3800 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
3801 | { 0x0b, HDA_INPUT, 1 }, | |
3802 | { 0x0b, HDA_INPUT, 6 }, | |
3803 | { 0x0b, HDA_INPUT, 7 }, | |
3804 | { } /* end */ | |
3805 | }; | |
3806 | #endif | |
3807 | ||
ae6b813a TI |
3808 | /* |
3809 | * Common callbacks | |
e9edcee0 TI |
3810 | */ |
3811 | ||
1da177e4 LT |
3812 | static int alc_init(struct hda_codec *codec) |
3813 | { | |
3814 | struct alc_spec *spec = codec->spec; | |
e9edcee0 TI |
3815 | unsigned int i; |
3816 | ||
2c3bf9ab | 3817 | alc_fix_pll(codec); |
4a79ba34 | 3818 | alc_auto_init_amp(codec, spec->init_amp); |
2c3bf9ab | 3819 | |
e9edcee0 TI |
3820 | for (i = 0; i < spec->num_init_verbs; i++) |
3821 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
ae6b813a TI |
3822 | |
3823 | if (spec->init_hook) | |
3824 | spec->init_hook(codec); | |
3825 | ||
9e5341b9 | 3826 | hda_call_check_power_status(codec, 0x01); |
1da177e4 LT |
3827 | return 0; |
3828 | } | |
3829 | ||
ae6b813a TI |
3830 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
3831 | { | |
3832 | struct alc_spec *spec = codec->spec; | |
3833 | ||
3834 | if (spec->unsol_event) | |
3835 | spec->unsol_event(codec, res); | |
3836 | } | |
3837 | ||
cb53c626 TI |
3838 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3839 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
3840 | { | |
3841 | struct alc_spec *spec = codec->spec; | |
3842 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
3843 | } | |
3844 | #endif | |
3845 | ||
1da177e4 LT |
3846 | /* |
3847 | * Analog playback callbacks | |
3848 | */ | |
3849 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3850 | struct hda_codec *codec, | |
c8b6bf9b | 3851 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3852 | { |
3853 | struct alc_spec *spec = codec->spec; | |
9a08160b TI |
3854 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
3855 | hinfo); | |
1da177e4 LT |
3856 | } |
3857 | ||
3858 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3859 | struct hda_codec *codec, | |
3860 | unsigned int stream_tag, | |
3861 | unsigned int format, | |
c8b6bf9b | 3862 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3863 | { |
3864 | struct alc_spec *spec = codec->spec; | |
9c7f852e TI |
3865 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
3866 | stream_tag, format, substream); | |
1da177e4 LT |
3867 | } |
3868 | ||
3869 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3870 | struct hda_codec *codec, | |
c8b6bf9b | 3871 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3872 | { |
3873 | struct alc_spec *spec = codec->spec; | |
3874 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
3875 | } | |
3876 | ||
3877 | /* | |
3878 | * Digital out | |
3879 | */ | |
3880 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
3881 | struct hda_codec *codec, | |
c8b6bf9b | 3882 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3883 | { |
3884 | struct alc_spec *spec = codec->spec; | |
3885 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
3886 | } | |
3887 | ||
6b97eb45 TI |
3888 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
3889 | struct hda_codec *codec, | |
3890 | unsigned int stream_tag, | |
3891 | unsigned int format, | |
3892 | struct snd_pcm_substream *substream) | |
3893 | { | |
3894 | struct alc_spec *spec = codec->spec; | |
3895 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
3896 | stream_tag, format, substream); | |
3897 | } | |
3898 | ||
9b5f12e5 TI |
3899 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
3900 | struct hda_codec *codec, | |
3901 | struct snd_pcm_substream *substream) | |
3902 | { | |
3903 | struct alc_spec *spec = codec->spec; | |
3904 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | |
3905 | } | |
3906 | ||
1da177e4 LT |
3907 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
3908 | struct hda_codec *codec, | |
c8b6bf9b | 3909 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3910 | { |
3911 | struct alc_spec *spec = codec->spec; | |
3912 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
3913 | } | |
3914 | ||
3915 | /* | |
3916 | * Analog capture | |
3917 | */ | |
6330079f | 3918 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
1da177e4 LT |
3919 | struct hda_codec *codec, |
3920 | unsigned int stream_tag, | |
3921 | unsigned int format, | |
c8b6bf9b | 3922 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3923 | { |
3924 | struct alc_spec *spec = codec->spec; | |
3925 | ||
6330079f | 3926 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
1da177e4 LT |
3927 | stream_tag, 0, format); |
3928 | return 0; | |
3929 | } | |
3930 | ||
6330079f | 3931 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
1da177e4 | 3932 | struct hda_codec *codec, |
c8b6bf9b | 3933 | struct snd_pcm_substream *substream) |
1da177e4 LT |
3934 | { |
3935 | struct alc_spec *spec = codec->spec; | |
3936 | ||
888afa15 TI |
3937 | snd_hda_codec_cleanup_stream(codec, |
3938 | spec->adc_nids[substream->number + 1]); | |
1da177e4 LT |
3939 | return 0; |
3940 | } | |
3941 | ||
840b64c0 TI |
3942 | /* analog capture with dynamic dual-adc changes */ |
3943 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |
3944 | struct hda_codec *codec, | |
3945 | unsigned int stream_tag, | |
3946 | unsigned int format, | |
3947 | struct snd_pcm_substream *substream) | |
3948 | { | |
3949 | struct alc_spec *spec = codec->spec; | |
3950 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; | |
3951 | spec->cur_adc_stream_tag = stream_tag; | |
3952 | spec->cur_adc_format = format; | |
3953 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); | |
3954 | return 0; | |
3955 | } | |
3956 | ||
3957 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
3958 | struct hda_codec *codec, | |
3959 | struct snd_pcm_substream *substream) | |
3960 | { | |
3961 | struct alc_spec *spec = codec->spec; | |
3962 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); | |
3963 | spec->cur_adc = 0; | |
3964 | return 0; | |
3965 | } | |
3966 | ||
3967 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { | |
3968 | .substreams = 1, | |
3969 | .channels_min = 2, | |
3970 | .channels_max = 2, | |
3971 | .nid = 0, /* fill later */ | |
3972 | .ops = { | |
3973 | .prepare = dualmic_capture_pcm_prepare, | |
3974 | .cleanup = dualmic_capture_pcm_cleanup | |
3975 | }, | |
3976 | }; | |
1da177e4 LT |
3977 | |
3978 | /* | |
3979 | */ | |
3980 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
3981 | .substreams = 1, | |
3982 | .channels_min = 2, | |
3983 | .channels_max = 8, | |
e9edcee0 | 3984 | /* NID is set in alc_build_pcms */ |
1da177e4 LT |
3985 | .ops = { |
3986 | .open = alc880_playback_pcm_open, | |
3987 | .prepare = alc880_playback_pcm_prepare, | |
3988 | .cleanup = alc880_playback_pcm_cleanup | |
3989 | }, | |
3990 | }; | |
3991 | ||
3992 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
6330079f TI |
3993 | .substreams = 1, |
3994 | .channels_min = 2, | |
3995 | .channels_max = 2, | |
3996 | /* NID is set in alc_build_pcms */ | |
3997 | }; | |
3998 | ||
3999 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
4000 | .substreams = 1, | |
4001 | .channels_min = 2, | |
4002 | .channels_max = 2, | |
4003 | /* NID is set in alc_build_pcms */ | |
4004 | }; | |
4005 | ||
4006 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
4007 | .substreams = 2, /* can be overridden */ | |
1da177e4 LT |
4008 | .channels_min = 2, |
4009 | .channels_max = 2, | |
e9edcee0 | 4010 | /* NID is set in alc_build_pcms */ |
1da177e4 | 4011 | .ops = { |
6330079f TI |
4012 | .prepare = alc880_alt_capture_pcm_prepare, |
4013 | .cleanup = alc880_alt_capture_pcm_cleanup | |
1da177e4 LT |
4014 | }, |
4015 | }; | |
4016 | ||
4017 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
4018 | .substreams = 1, | |
4019 | .channels_min = 2, | |
4020 | .channels_max = 2, | |
4021 | /* NID is set in alc_build_pcms */ | |
4022 | .ops = { | |
4023 | .open = alc880_dig_playback_pcm_open, | |
6b97eb45 | 4024 | .close = alc880_dig_playback_pcm_close, |
9b5f12e5 TI |
4025 | .prepare = alc880_dig_playback_pcm_prepare, |
4026 | .cleanup = alc880_dig_playback_pcm_cleanup | |
1da177e4 LT |
4027 | }, |
4028 | }; | |
4029 | ||
4030 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
4031 | .substreams = 1, | |
4032 | .channels_min = 2, | |
4033 | .channels_max = 2, | |
4034 | /* NID is set in alc_build_pcms */ | |
4035 | }; | |
4036 | ||
4c5186ed | 4037 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
6330079f | 4038 | static struct hda_pcm_stream alc_pcm_null_stream = { |
4c5186ed JW |
4039 | .substreams = 0, |
4040 | .channels_min = 0, | |
4041 | .channels_max = 0, | |
4042 | }; | |
4043 | ||
1da177e4 LT |
4044 | static int alc_build_pcms(struct hda_codec *codec) |
4045 | { | |
4046 | struct alc_spec *spec = codec->spec; | |
4047 | struct hda_pcm *info = spec->pcm_rec; | |
4048 | int i; | |
4049 | ||
4050 | codec->num_pcms = 1; | |
4051 | codec->pcm_info = info; | |
4052 | ||
e64f14f4 TI |
4053 | if (spec->no_analog) |
4054 | goto skip_analog; | |
4055 | ||
812a2cca TI |
4056 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
4057 | "%s Analog", codec->chip_name); | |
1da177e4 | 4058 | info->name = spec->stream_name_analog; |
274693f3 | 4059 | |
4a471b7d | 4060 | if (spec->stream_analog_playback) { |
da3cec35 TI |
4061 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
4062 | return -EINVAL; | |
4a471b7d TI |
4063 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
4064 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
4065 | } | |
4066 | if (spec->stream_analog_capture) { | |
da3cec35 TI |
4067 | if (snd_BUG_ON(!spec->adc_nids)) |
4068 | return -EINVAL; | |
4a471b7d TI |
4069 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
4070 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
4071 | } | |
4072 | ||
4073 | if (spec->channel_mode) { | |
4074 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
4075 | for (i = 0; i < spec->num_channel_mode; i++) { | |
4076 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
4077 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
4078 | } | |
1da177e4 LT |
4079 | } |
4080 | } | |
4081 | ||
e64f14f4 | 4082 | skip_analog: |
e08a007d | 4083 | /* SPDIF for stream index #1 */ |
1da177e4 | 4084 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
812a2cca TI |
4085 | snprintf(spec->stream_name_digital, |
4086 | sizeof(spec->stream_name_digital), | |
4087 | "%s Digital", codec->chip_name); | |
e08a007d | 4088 | codec->num_pcms = 2; |
b25c9da1 | 4089 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
c06134d7 | 4090 | info = spec->pcm_rec + 1; |
1da177e4 | 4091 | info->name = spec->stream_name_digital; |
8c441982 TI |
4092 | if (spec->dig_out_type) |
4093 | info->pcm_type = spec->dig_out_type; | |
4094 | else | |
4095 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | |
4a471b7d TI |
4096 | if (spec->multiout.dig_out_nid && |
4097 | spec->stream_digital_playback) { | |
1da177e4 LT |
4098 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
4099 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
4100 | } | |
4a471b7d TI |
4101 | if (spec->dig_in_nid && |
4102 | spec->stream_digital_capture) { | |
1da177e4 LT |
4103 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
4104 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
4105 | } | |
963f803f TI |
4106 | /* FIXME: do we need this for all Realtek codec models? */ |
4107 | codec->spdif_status_reset = 1; | |
1da177e4 LT |
4108 | } |
4109 | ||
e64f14f4 TI |
4110 | if (spec->no_analog) |
4111 | return 0; | |
4112 | ||
e08a007d TI |
4113 | /* If the use of more than one ADC is requested for the current |
4114 | * model, configure a second analog capture-only PCM. | |
4115 | */ | |
4116 | /* Additional Analaog capture for index #2 */ | |
6330079f TI |
4117 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
4118 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
e08a007d | 4119 | codec->num_pcms = 3; |
c06134d7 | 4120 | info = spec->pcm_rec + 2; |
e08a007d | 4121 | info->name = spec->stream_name_analog; |
6330079f TI |
4122 | if (spec->alt_dac_nid) { |
4123 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
4124 | *spec->stream_analog_alt_playback; | |
4125 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
4126 | spec->alt_dac_nid; | |
4127 | } else { | |
4128 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
4129 | alc_pcm_null_stream; | |
4130 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
4131 | } | |
4132 | if (spec->num_adc_nids > 1) { | |
4133 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
4134 | *spec->stream_analog_alt_capture; | |
4135 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
4136 | spec->adc_nids[1]; | |
4137 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
4138 | spec->num_adc_nids - 1; | |
4139 | } else { | |
4140 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
4141 | alc_pcm_null_stream; | |
4142 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
e08a007d TI |
4143 | } |
4144 | } | |
4145 | ||
1da177e4 LT |
4146 | return 0; |
4147 | } | |
4148 | ||
a4e09aa3 TI |
4149 | static inline void alc_shutup(struct hda_codec *codec) |
4150 | { | |
4151 | snd_hda_shutup_pins(codec); | |
4152 | } | |
4153 | ||
603c4019 TI |
4154 | static void alc_free_kctls(struct hda_codec *codec) |
4155 | { | |
4156 | struct alc_spec *spec = codec->spec; | |
4157 | ||
4158 | if (spec->kctls.list) { | |
4159 | struct snd_kcontrol_new *kctl = spec->kctls.list; | |
4160 | int i; | |
4161 | for (i = 0; i < spec->kctls.used; i++) | |
4162 | kfree(kctl[i].name); | |
4163 | } | |
4164 | snd_array_free(&spec->kctls); | |
4165 | } | |
4166 | ||
1da177e4 LT |
4167 | static void alc_free(struct hda_codec *codec) |
4168 | { | |
e9edcee0 | 4169 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 4170 | |
f12ab1e0 | 4171 | if (!spec) |
e9edcee0 TI |
4172 | return; |
4173 | ||
a4e09aa3 | 4174 | alc_shutup(codec); |
603c4019 | 4175 | alc_free_kctls(codec); |
e9edcee0 | 4176 | kfree(spec); |
680cd536 | 4177 | snd_hda_detach_beep_device(codec); |
1da177e4 LT |
4178 | } |
4179 | ||
f5de24b0 | 4180 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
c97259df DC |
4181 | static void alc_power_eapd(struct hda_codec *codec) |
4182 | { | |
4183 | /* We currently only handle front, HP */ | |
4184 | switch (codec->vendor_id) { | |
4185 | case 0x10ec0260: | |
9e4c8496 TI |
4186 | set_eapd(codec, 0x0f, 0); |
4187 | set_eapd(codec, 0x10, 0); | |
c97259df DC |
4188 | break; |
4189 | case 0x10ec0262: | |
4190 | case 0x10ec0267: | |
4191 | case 0x10ec0268: | |
4192 | case 0x10ec0269: | |
9e4c8496 | 4193 | case 0x10ec0270: |
c97259df DC |
4194 | case 0x10ec0272: |
4195 | case 0x10ec0660: | |
4196 | case 0x10ec0662: | |
4197 | case 0x10ec0663: | |
4198 | case 0x10ec0862: | |
4199 | case 0x10ec0889: | |
9e4c8496 TI |
4200 | set_eapd(codec, 0x14, 0); |
4201 | set_eapd(codec, 0x15, 0); | |
c97259df DC |
4202 | break; |
4203 | } | |
4204 | } | |
4205 | ||
f5de24b0 HM |
4206 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
4207 | { | |
4208 | struct alc_spec *spec = codec->spec; | |
a4e09aa3 | 4209 | alc_shutup(codec); |
f5de24b0 | 4210 | if (spec && spec->power_hook) |
c97259df | 4211 | spec->power_hook(codec); |
f5de24b0 HM |
4212 | return 0; |
4213 | } | |
4214 | #endif | |
4215 | ||
e044c39a | 4216 | #ifdef SND_HDA_NEEDS_RESUME |
e044c39a TI |
4217 | static int alc_resume(struct hda_codec *codec) |
4218 | { | |
e044c39a TI |
4219 | codec->patch_ops.init(codec); |
4220 | snd_hda_codec_resume_amp(codec); | |
4221 | snd_hda_codec_resume_cache(codec); | |
9e5341b9 | 4222 | hda_call_check_power_status(codec, 0x01); |
e044c39a TI |
4223 | return 0; |
4224 | } | |
e044c39a TI |
4225 | #endif |
4226 | ||
1da177e4 LT |
4227 | /* |
4228 | */ | |
4229 | static struct hda_codec_ops alc_patch_ops = { | |
4230 | .build_controls = alc_build_controls, | |
4231 | .build_pcms = alc_build_pcms, | |
4232 | .init = alc_init, | |
4233 | .free = alc_free, | |
ae6b813a | 4234 | .unsol_event = alc_unsol_event, |
e044c39a TI |
4235 | #ifdef SND_HDA_NEEDS_RESUME |
4236 | .resume = alc_resume, | |
4237 | #endif | |
cb53c626 | 4238 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
f5de24b0 | 4239 | .suspend = alc_suspend, |
cb53c626 TI |
4240 | .check_power_status = alc_check_power_status, |
4241 | #endif | |
c97259df | 4242 | .reboot_notify = alc_shutup, |
1da177e4 LT |
4243 | }; |
4244 | ||
c027ddcd KY |
4245 | /* replace the codec chip_name with the given string */ |
4246 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | |
4247 | { | |
4248 | kfree(codec->chip_name); | |
4249 | codec->chip_name = kstrdup(name, GFP_KERNEL); | |
4250 | if (!codec->chip_name) { | |
4251 | alc_free(codec); | |
4252 | return -ENOMEM; | |
4253 | } | |
4254 | return 0; | |
4255 | } | |
4256 | ||
2fa522be TI |
4257 | /* |
4258 | * Test configuration for debugging | |
4259 | * | |
4260 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
4261 | * enum controls. | |
4262 | */ | |
4263 | #ifdef CONFIG_SND_DEBUG | |
4264 | static hda_nid_t alc880_test_dac_nids[4] = { | |
4265 | 0x02, 0x03, 0x04, 0x05 | |
4266 | }; | |
4267 | ||
4268 | static struct hda_input_mux alc880_test_capture_source = { | |
ae6b813a | 4269 | .num_items = 7, |
2fa522be TI |
4270 | .items = { |
4271 | { "In-1", 0x0 }, | |
4272 | { "In-2", 0x1 }, | |
4273 | { "In-3", 0x2 }, | |
4274 | { "In-4", 0x3 }, | |
4275 | { "CD", 0x4 }, | |
ae6b813a TI |
4276 | { "Front", 0x5 }, |
4277 | { "Surround", 0x6 }, | |
2fa522be TI |
4278 | }, |
4279 | }; | |
4280 | ||
d2a6d7dc | 4281 | static struct hda_channel_mode alc880_test_modes[4] = { |
2fa522be | 4282 | { 2, NULL }, |
fd2c326d | 4283 | { 4, NULL }, |
2fa522be | 4284 | { 6, NULL }, |
fd2c326d | 4285 | { 8, NULL }, |
2fa522be TI |
4286 | }; |
4287 | ||
9c7f852e TI |
4288 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
4289 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
4290 | { |
4291 | static char *texts[] = { | |
4292 | "N/A", "Line Out", "HP Out", | |
4293 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
4294 | }; | |
4295 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4296 | uinfo->count = 1; | |
4297 | uinfo->value.enumerated.items = 8; | |
4298 | if (uinfo->value.enumerated.item >= 8) | |
4299 | uinfo->value.enumerated.item = 7; | |
4300 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4301 | return 0; | |
4302 | } | |
4303 | ||
9c7f852e TI |
4304 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
4305 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4306 | { |
4307 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4308 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4309 | unsigned int pin_ctl, item = 0; | |
4310 | ||
4311 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
4312 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4313 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
4314 | if (pin_ctl & AC_PINCTL_HP_EN) | |
4315 | item = 2; | |
4316 | else | |
4317 | item = 1; | |
4318 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
4319 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
4320 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
4321 | case AC_PINCTL_VREF_50: item = 4; break; | |
4322 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
4323 | case AC_PINCTL_VREF_80: item = 6; break; | |
4324 | case AC_PINCTL_VREF_100: item = 7; break; | |
4325 | } | |
4326 | } | |
4327 | ucontrol->value.enumerated.item[0] = item; | |
4328 | return 0; | |
4329 | } | |
4330 | ||
9c7f852e TI |
4331 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
4332 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4333 | { |
4334 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4335 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4336 | static unsigned int ctls[] = { | |
4337 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
4338 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
4339 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
4340 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
4341 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
4342 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
4343 | }; | |
4344 | unsigned int old_ctl, new_ctl; | |
4345 | ||
4346 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
4347 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
4348 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
4349 | if (old_ctl != new_ctl) { | |
82beb8fd TI |
4350 | int val; |
4351 | snd_hda_codec_write_cache(codec, nid, 0, | |
4352 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4353 | new_ctl); | |
47fd830a TI |
4354 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
4355 | HDA_AMP_MUTE : 0; | |
4356 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
4357 | HDA_AMP_MUTE, val); | |
2fa522be TI |
4358 | return 1; |
4359 | } | |
4360 | return 0; | |
4361 | } | |
4362 | ||
9c7f852e TI |
4363 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
4364 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
4365 | { |
4366 | static char *texts[] = { | |
4367 | "Front", "Surround", "CLFE", "Side" | |
4368 | }; | |
4369 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
4370 | uinfo->count = 1; | |
4371 | uinfo->value.enumerated.items = 4; | |
4372 | if (uinfo->value.enumerated.item >= 4) | |
4373 | uinfo->value.enumerated.item = 3; | |
4374 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
4375 | return 0; | |
4376 | } | |
4377 | ||
9c7f852e TI |
4378 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
4379 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4380 | { |
4381 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4382 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4383 | unsigned int sel; | |
4384 | ||
4385 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
4386 | ucontrol->value.enumerated.item[0] = sel & 3; | |
4387 | return 0; | |
4388 | } | |
4389 | ||
9c7f852e TI |
4390 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
4391 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
4392 | { |
4393 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4394 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
4395 | unsigned int sel; | |
4396 | ||
4397 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
4398 | if (ucontrol->value.enumerated.item[0] != sel) { | |
4399 | sel = ucontrol->value.enumerated.item[0] & 3; | |
82beb8fd TI |
4400 | snd_hda_codec_write_cache(codec, nid, 0, |
4401 | AC_VERB_SET_CONNECT_SEL, sel); | |
2fa522be TI |
4402 | return 1; |
4403 | } | |
4404 | return 0; | |
4405 | } | |
4406 | ||
4407 | #define PIN_CTL_TEST(xname,nid) { \ | |
4408 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4409 | .name = xname, \ | |
5b0cb1d8 | 4410 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
2fa522be TI |
4411 | .info = alc_test_pin_ctl_info, \ |
4412 | .get = alc_test_pin_ctl_get, \ | |
4413 | .put = alc_test_pin_ctl_put, \ | |
4414 | .private_value = nid \ | |
4415 | } | |
4416 | ||
4417 | #define PIN_SRC_TEST(xname,nid) { \ | |
4418 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
4419 | .name = xname, \ | |
5b0cb1d8 | 4420 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
2fa522be TI |
4421 | .info = alc_test_pin_src_info, \ |
4422 | .get = alc_test_pin_src_get, \ | |
4423 | .put = alc_test_pin_src_put, \ | |
4424 | .private_value = nid \ | |
4425 | } | |
4426 | ||
c8b6bf9b | 4427 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
05acb863 TI |
4428 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
4429 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
4430 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
4431 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
985be54b TI |
4432 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
4433 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
4434 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
4435 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2fa522be TI |
4436 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
4437 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
4438 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
4439 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
4440 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
4441 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
4442 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
4443 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
4444 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
4445 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
4446 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
4447 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
4448 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4449 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4450 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
4451 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
4452 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
4453 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
4454 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
4455 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
4456 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
4457 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
2fa522be TI |
4458 | { |
4459 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4460 | .name = "Channel Mode", | |
df694daa KY |
4461 | .info = alc_ch_mode_info, |
4462 | .get = alc_ch_mode_get, | |
4463 | .put = alc_ch_mode_put, | |
2fa522be TI |
4464 | }, |
4465 | { } /* end */ | |
4466 | }; | |
4467 | ||
4468 | static struct hda_verb alc880_test_init_verbs[] = { | |
4469 | /* Unmute inputs of 0x0c - 0x0f */ | |
05acb863 TI |
4470 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4471 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4472 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4473 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4474 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4475 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
4476 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4477 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2fa522be | 4478 | /* Vol output for 0x0c-0x0f */ |
05acb863 TI |
4479 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
4480 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4481 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4482 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2fa522be | 4483 | /* Set output pins 0x14-0x17 */ |
05acb863 TI |
4484 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
4485 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4486 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4487 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2fa522be | 4488 | /* Unmute output pins 0x14-0x17 */ |
05acb863 TI |
4489 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
4490 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4491 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4492 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2fa522be | 4493 | /* Set input pins 0x18-0x1c */ |
16ded525 TI |
4494 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
4495 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
05acb863 TI |
4496 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
4497 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4498 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2fa522be | 4499 | /* Mute input pins 0x18-0x1b */ |
05acb863 TI |
4500 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4501 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4502 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
4503 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
71fe7b82 | 4504 | /* ADC set up */ |
05acb863 | 4505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4506 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 4507 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4508 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 4509 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 4510 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
4511 | /* Analog input/passthru */ |
4512 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4513 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4514 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4515 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2fa522be TI |
4517 | { } |
4518 | }; | |
4519 | #endif | |
4520 | ||
1da177e4 LT |
4521 | /* |
4522 | */ | |
4523 | ||
f5fcc13c TI |
4524 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
4525 | [ALC880_3ST] = "3stack", | |
4526 | [ALC880_TCL_S700] = "tcl", | |
4527 | [ALC880_3ST_DIG] = "3stack-digout", | |
4528 | [ALC880_CLEVO] = "clevo", | |
4529 | [ALC880_5ST] = "5stack", | |
4530 | [ALC880_5ST_DIG] = "5stack-digout", | |
4531 | [ALC880_W810] = "w810", | |
4532 | [ALC880_Z71V] = "z71v", | |
4533 | [ALC880_6ST] = "6stack", | |
4534 | [ALC880_6ST_DIG] = "6stack-digout", | |
4535 | [ALC880_ASUS] = "asus", | |
4536 | [ALC880_ASUS_W1V] = "asus-w1v", | |
4537 | [ALC880_ASUS_DIG] = "asus-dig", | |
4538 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
4539 | [ALC880_UNIWILL_DIG] = "uniwill", | |
2cf9f0fc TD |
4540 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
4541 | [ALC880_FUJITSU] = "fujitsu", | |
f5fcc13c TI |
4542 | [ALC880_F1734] = "F1734", |
4543 | [ALC880_LG] = "lg", | |
4544 | [ALC880_LG_LW] = "lg-lw", | |
df99cd33 | 4545 | [ALC880_MEDION_RIM] = "medion", |
2fa522be | 4546 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 4547 | [ALC880_TEST] = "test", |
2fa522be | 4548 | #endif |
f5fcc13c TI |
4549 | [ALC880_AUTO] = "auto", |
4550 | }; | |
4551 | ||
4552 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
ac3e3741 | 4553 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
f5fcc13c TI |
4554 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
4555 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
4556 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
4557 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
4558 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
4559 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
4560 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
4561 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
f5fcc13c TI |
4562 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
4563 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
f5fcc13c TI |
4564 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
4565 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
4566 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
4567 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
4568 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
4569 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
4570 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
4571 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
4572 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
4573 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
186c3117 | 4574 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
f5fcc13c TI |
4575 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
4576 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
4577 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
dea0a509 | 4578 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
f5fcc13c | 4579 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
ac3e3741 TI |
4580 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
4581 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
4582 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
4583 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
4584 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
4585 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
4586 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
4587 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
ac3e3741 TI |
4588 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
4589 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
f5fcc13c | 4590 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
ac3e3741 | 4591 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
f5fcc13c | 4592 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
ac3e3741 | 4593 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
f5fcc13c TI |
4594 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
4595 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
ac3e3741 | 4596 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
df99cd33 | 4597 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
ac3e3741 | 4598 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
f5fcc13c | 4599 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
f5fcc13c | 4600 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
1d11604e | 4601 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
3353541f | 4602 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
2cf9f0fc | 4603 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
ac3e3741 | 4604 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
f5fcc13c | 4605 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
77c4d5cd | 4606 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
f5fcc13c | 4607 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
f5fcc13c | 4608 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
ac3e3741 TI |
4609 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
4610 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
4611 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
4612 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
f5fcc13c TI |
4613 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
4614 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 | 4615 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
f5fcc13c | 4616 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
ac3e3741 TI |
4617 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
4618 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
f5fcc13c TI |
4619 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
4620 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
4621 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
dea0a509 TI |
4622 | /* default Intel */ |
4623 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), | |
ac3e3741 TI |
4624 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
4625 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
1da177e4 LT |
4626 | {} |
4627 | }; | |
4628 | ||
16ded525 | 4629 | /* |
df694daa | 4630 | * ALC880 codec presets |
16ded525 | 4631 | */ |
16ded525 TI |
4632 | static struct alc_config_preset alc880_presets[] = { |
4633 | [ALC880_3ST] = { | |
e9edcee0 | 4634 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
4635 | .init_verbs = { alc880_volume_init_verbs, |
4636 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 4637 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 | 4638 | .dac_nids = alc880_dac_nids, |
16ded525 TI |
4639 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
4640 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4641 | .need_dac_fix = 1, |
16ded525 TI |
4642 | .input_mux = &alc880_capture_source, |
4643 | }, | |
4644 | [ALC880_3ST_DIG] = { | |
e9edcee0 | 4645 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
4646 | .init_verbs = { alc880_volume_init_verbs, |
4647 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 4648 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 TI |
4649 | .dac_nids = alc880_dac_nids, |
4650 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4651 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
4652 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4653 | .need_dac_fix = 1, |
16ded525 TI |
4654 | .input_mux = &alc880_capture_source, |
4655 | }, | |
df694daa KY |
4656 | [ALC880_TCL_S700] = { |
4657 | .mixers = { alc880_tcl_s700_mixer }, | |
4658 | .init_verbs = { alc880_volume_init_verbs, | |
4659 | alc880_pin_tcl_S700_init_verbs, | |
4660 | alc880_gpio2_init_verbs }, | |
4661 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4662 | .dac_nids = alc880_dac_nids, | |
f9e336f6 TI |
4663 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
4664 | .num_adc_nids = 1, /* single ADC */ | |
df694daa KY |
4665 | .hp_nid = 0x03, |
4666 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4667 | .channel_mode = alc880_2_jack_modes, | |
4668 | .input_mux = &alc880_capture_source, | |
4669 | }, | |
16ded525 | 4670 | [ALC880_5ST] = { |
f12ab1e0 TI |
4671 | .mixers = { alc880_three_stack_mixer, |
4672 | alc880_five_stack_mixer}, | |
4673 | .init_verbs = { alc880_volume_init_verbs, | |
4674 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
4675 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
4676 | .dac_nids = alc880_dac_nids, | |
16ded525 TI |
4677 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
4678 | .channel_mode = alc880_fivestack_modes, | |
4679 | .input_mux = &alc880_capture_source, | |
4680 | }, | |
4681 | [ALC880_5ST_DIG] = { | |
f12ab1e0 TI |
4682 | .mixers = { alc880_three_stack_mixer, |
4683 | alc880_five_stack_mixer }, | |
4684 | .init_verbs = { alc880_volume_init_verbs, | |
4685 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
4686 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
4687 | .dac_nids = alc880_dac_nids, | |
4688 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4689 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
4690 | .channel_mode = alc880_fivestack_modes, | |
4691 | .input_mux = &alc880_capture_source, | |
4692 | }, | |
b6482d48 TI |
4693 | [ALC880_6ST] = { |
4694 | .mixers = { alc880_six_stack_mixer }, | |
f12ab1e0 TI |
4695 | .init_verbs = { alc880_volume_init_verbs, |
4696 | alc880_pin_6stack_init_verbs }, | |
b6482d48 TI |
4697 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
4698 | .dac_nids = alc880_6st_dac_nids, | |
4699 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
4700 | .channel_mode = alc880_sixstack_modes, | |
4701 | .input_mux = &alc880_6stack_capture_source, | |
4702 | }, | |
16ded525 | 4703 | [ALC880_6ST_DIG] = { |
e9edcee0 | 4704 | .mixers = { alc880_six_stack_mixer }, |
f12ab1e0 TI |
4705 | .init_verbs = { alc880_volume_init_verbs, |
4706 | alc880_pin_6stack_init_verbs }, | |
16ded525 TI |
4707 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
4708 | .dac_nids = alc880_6st_dac_nids, | |
4709 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4710 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
4711 | .channel_mode = alc880_sixstack_modes, | |
4712 | .input_mux = &alc880_6stack_capture_source, | |
4713 | }, | |
4714 | [ALC880_W810] = { | |
e9edcee0 | 4715 | .mixers = { alc880_w810_base_mixer }, |
f12ab1e0 TI |
4716 | .init_verbs = { alc880_volume_init_verbs, |
4717 | alc880_pin_w810_init_verbs, | |
b0af0de5 | 4718 | alc880_gpio2_init_verbs }, |
16ded525 TI |
4719 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
4720 | .dac_nids = alc880_w810_dac_nids, | |
4721 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4722 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
4723 | .channel_mode = alc880_w810_modes, | |
4724 | .input_mux = &alc880_capture_source, | |
4725 | }, | |
4726 | [ALC880_Z71V] = { | |
e9edcee0 | 4727 | .mixers = { alc880_z71v_mixer }, |
f12ab1e0 TI |
4728 | .init_verbs = { alc880_volume_init_verbs, |
4729 | alc880_pin_z71v_init_verbs }, | |
16ded525 TI |
4730 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
4731 | .dac_nids = alc880_z71v_dac_nids, | |
4732 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4733 | .hp_nid = 0x03, | |
e9edcee0 TI |
4734 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
4735 | .channel_mode = alc880_2_jack_modes, | |
16ded525 TI |
4736 | .input_mux = &alc880_capture_source, |
4737 | }, | |
4738 | [ALC880_F1734] = { | |
e9edcee0 | 4739 | .mixers = { alc880_f1734_mixer }, |
f12ab1e0 TI |
4740 | .init_verbs = { alc880_volume_init_verbs, |
4741 | alc880_pin_f1734_init_verbs }, | |
e9edcee0 TI |
4742 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
4743 | .dac_nids = alc880_f1734_dac_nids, | |
4744 | .hp_nid = 0x02, | |
4745 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4746 | .channel_mode = alc880_2_jack_modes, | |
937b4160 TI |
4747 | .input_mux = &alc880_f1734_capture_source, |
4748 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4749 | .setup = alc880_uniwill_p53_setup, |
4750 | .init_hook = alc_automute_amp, | |
16ded525 TI |
4751 | }, |
4752 | [ALC880_ASUS] = { | |
e9edcee0 | 4753 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
4754 | .init_verbs = { alc880_volume_init_verbs, |
4755 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4756 | alc880_gpio1_init_verbs }, |
4757 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4758 | .dac_nids = alc880_asus_dac_nids, | |
4759 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4760 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4761 | .need_dac_fix = 1, |
16ded525 TI |
4762 | .input_mux = &alc880_capture_source, |
4763 | }, | |
4764 | [ALC880_ASUS_DIG] = { | |
e9edcee0 | 4765 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
4766 | .init_verbs = { alc880_volume_init_verbs, |
4767 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4768 | alc880_gpio1_init_verbs }, |
4769 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4770 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4771 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4772 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4773 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4774 | .need_dac_fix = 1, |
16ded525 TI |
4775 | .input_mux = &alc880_capture_source, |
4776 | }, | |
df694daa KY |
4777 | [ALC880_ASUS_DIG2] = { |
4778 | .mixers = { alc880_asus_mixer }, | |
f12ab1e0 TI |
4779 | .init_verbs = { alc880_volume_init_verbs, |
4780 | alc880_pin_asus_init_verbs, | |
df694daa KY |
4781 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
4782 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4783 | .dac_nids = alc880_asus_dac_nids, | |
4784 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4785 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
4786 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4787 | .need_dac_fix = 1, |
df694daa KY |
4788 | .input_mux = &alc880_capture_source, |
4789 | }, | |
16ded525 | 4790 | [ALC880_ASUS_W1V] = { |
e9edcee0 | 4791 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
f12ab1e0 TI |
4792 | .init_verbs = { alc880_volume_init_verbs, |
4793 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
4794 | alc880_gpio1_init_verbs }, |
4795 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4796 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4797 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4798 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4799 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4800 | .need_dac_fix = 1, |
16ded525 TI |
4801 | .input_mux = &alc880_capture_source, |
4802 | }, | |
4803 | [ALC880_UNIWILL_DIG] = { | |
45bdd1c1 | 4804 | .mixers = { alc880_asus_mixer }, |
ccc656ce KY |
4805 | .init_verbs = { alc880_volume_init_verbs, |
4806 | alc880_pin_asus_init_verbs }, | |
e9edcee0 TI |
4807 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
4808 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 4809 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
4810 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
4811 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 4812 | .need_dac_fix = 1, |
16ded525 TI |
4813 | .input_mux = &alc880_capture_source, |
4814 | }, | |
ccc656ce KY |
4815 | [ALC880_UNIWILL] = { |
4816 | .mixers = { alc880_uniwill_mixer }, | |
4817 | .init_verbs = { alc880_volume_init_verbs, | |
4818 | alc880_uniwill_init_verbs }, | |
4819 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4820 | .dac_nids = alc880_asus_dac_nids, | |
4821 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4822 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4823 | .channel_mode = alc880_threestack_modes, | |
4824 | .need_dac_fix = 1, | |
4825 | .input_mux = &alc880_capture_source, | |
4826 | .unsol_event = alc880_uniwill_unsol_event, | |
4f5d1706 | 4827 | .setup = alc880_uniwill_setup, |
a9fd4f3f | 4828 | .init_hook = alc880_uniwill_init_hook, |
ccc656ce KY |
4829 | }, |
4830 | [ALC880_UNIWILL_P53] = { | |
4831 | .mixers = { alc880_uniwill_p53_mixer }, | |
4832 | .init_verbs = { alc880_volume_init_verbs, | |
4833 | alc880_uniwill_p53_init_verbs }, | |
4834 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
4835 | .dac_nids = alc880_asus_dac_nids, | |
4836 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
2cf9f0fc TD |
4837 | .channel_mode = alc880_threestack_modes, |
4838 | .input_mux = &alc880_capture_source, | |
4839 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4840 | .setup = alc880_uniwill_p53_setup, |
4841 | .init_hook = alc_automute_amp, | |
2cf9f0fc TD |
4842 | }, |
4843 | [ALC880_FUJITSU] = { | |
45bdd1c1 | 4844 | .mixers = { alc880_fujitsu_mixer }, |
2cf9f0fc TD |
4845 | .init_verbs = { alc880_volume_init_verbs, |
4846 | alc880_uniwill_p53_init_verbs, | |
4847 | alc880_beep_init_verbs }, | |
4848 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4849 | .dac_nids = alc880_dac_nids, | |
d53d7d9e | 4850 | .dig_out_nid = ALC880_DIGOUT_NID, |
2cf9f0fc TD |
4851 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
4852 | .channel_mode = alc880_2_jack_modes, | |
ccc656ce KY |
4853 | .input_mux = &alc880_capture_source, |
4854 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
4f5d1706 TI |
4855 | .setup = alc880_uniwill_p53_setup, |
4856 | .init_hook = alc_automute_amp, | |
ccc656ce | 4857 | }, |
df694daa KY |
4858 | [ALC880_CLEVO] = { |
4859 | .mixers = { alc880_three_stack_mixer }, | |
4860 | .init_verbs = { alc880_volume_init_verbs, | |
4861 | alc880_pin_clevo_init_verbs }, | |
4862 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4863 | .dac_nids = alc880_dac_nids, | |
4864 | .hp_nid = 0x03, | |
4865 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
4866 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 4867 | .need_dac_fix = 1, |
df694daa KY |
4868 | .input_mux = &alc880_capture_source, |
4869 | }, | |
ae6b813a TI |
4870 | [ALC880_LG] = { |
4871 | .mixers = { alc880_lg_mixer }, | |
4872 | .init_verbs = { alc880_volume_init_verbs, | |
4873 | alc880_lg_init_verbs }, | |
4874 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
4875 | .dac_nids = alc880_lg_dac_nids, | |
4876 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4877 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
4878 | .channel_mode = alc880_lg_ch_modes, | |
4e195a7b | 4879 | .need_dac_fix = 1, |
ae6b813a | 4880 | .input_mux = &alc880_lg_capture_source, |
a9fd4f3f | 4881 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
4882 | .setup = alc880_lg_setup, |
4883 | .init_hook = alc_automute_amp, | |
cb53c626 TI |
4884 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4885 | .loopbacks = alc880_lg_loopbacks, | |
4886 | #endif | |
ae6b813a | 4887 | }, |
d681518a TI |
4888 | [ALC880_LG_LW] = { |
4889 | .mixers = { alc880_lg_lw_mixer }, | |
4890 | .init_verbs = { alc880_volume_init_verbs, | |
4891 | alc880_lg_lw_init_verbs }, | |
0a8c5da3 | 4892 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
d681518a TI |
4893 | .dac_nids = alc880_dac_nids, |
4894 | .dig_out_nid = ALC880_DIGOUT_NID, | |
0a8c5da3 CM |
4895 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
4896 | .channel_mode = alc880_lg_lw_modes, | |
d681518a | 4897 | .input_mux = &alc880_lg_lw_capture_source, |
a9fd4f3f | 4898 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
4899 | .setup = alc880_lg_lw_setup, |
4900 | .init_hook = alc_automute_amp, | |
d681518a | 4901 | }, |
df99cd33 TI |
4902 | [ALC880_MEDION_RIM] = { |
4903 | .mixers = { alc880_medion_rim_mixer }, | |
4904 | .init_verbs = { alc880_volume_init_verbs, | |
4905 | alc880_medion_rim_init_verbs, | |
4906 | alc_gpio2_init_verbs }, | |
4907 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
4908 | .dac_nids = alc880_dac_nids, | |
4909 | .dig_out_nid = ALC880_DIGOUT_NID, | |
4910 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
4911 | .channel_mode = alc880_2_jack_modes, | |
4912 | .input_mux = &alc880_medion_rim_capture_source, | |
4913 | .unsol_event = alc880_medion_rim_unsol_event, | |
4f5d1706 TI |
4914 | .setup = alc880_medion_rim_setup, |
4915 | .init_hook = alc880_medion_rim_automute, | |
df99cd33 | 4916 | }, |
16ded525 TI |
4917 | #ifdef CONFIG_SND_DEBUG |
4918 | [ALC880_TEST] = { | |
e9edcee0 TI |
4919 | .mixers = { alc880_test_mixer }, |
4920 | .init_verbs = { alc880_test_init_verbs }, | |
16ded525 TI |
4921 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
4922 | .dac_nids = alc880_test_dac_nids, | |
4923 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
4924 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
4925 | .channel_mode = alc880_test_modes, | |
4926 | .input_mux = &alc880_test_capture_source, | |
4927 | }, | |
4928 | #endif | |
4929 | }; | |
4930 | ||
e9edcee0 TI |
4931 | /* |
4932 | * Automatic parse of I/O pins from the BIOS configuration | |
4933 | */ | |
4934 | ||
e9edcee0 TI |
4935 | enum { |
4936 | ALC_CTL_WIDGET_VOL, | |
4937 | ALC_CTL_WIDGET_MUTE, | |
4938 | ALC_CTL_BIND_MUTE, | |
4939 | }; | |
c8b6bf9b | 4940 | static struct snd_kcontrol_new alc880_control_templates[] = { |
e9edcee0 TI |
4941 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
4942 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
985be54b | 4943 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
e9edcee0 TI |
4944 | }; |
4945 | ||
4946 | /* add dynamic controls */ | |
f12ab1e0 | 4947 | static int add_control(struct alc_spec *spec, int type, const char *name, |
66ceeb6b | 4948 | int cidx, unsigned long val) |
e9edcee0 | 4949 | { |
c8b6bf9b | 4950 | struct snd_kcontrol_new *knew; |
e9edcee0 | 4951 | |
603c4019 TI |
4952 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
4953 | knew = snd_array_new(&spec->kctls); | |
4954 | if (!knew) | |
4955 | return -ENOMEM; | |
e9edcee0 | 4956 | *knew = alc880_control_templates[type]; |
543537bd | 4957 | knew->name = kstrdup(name, GFP_KERNEL); |
f12ab1e0 | 4958 | if (!knew->name) |
e9edcee0 | 4959 | return -ENOMEM; |
66ceeb6b | 4960 | knew->index = cidx; |
4d02d1b6 | 4961 | if (get_amp_nid_(val)) |
5e26dfd0 | 4962 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
e9edcee0 | 4963 | knew->private_value = val; |
e9edcee0 TI |
4964 | return 0; |
4965 | } | |
4966 | ||
0afe5f89 TI |
4967 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
4968 | const char *pfx, const char *dir, | |
66ceeb6b | 4969 | const char *sfx, int cidx, unsigned long val) |
0afe5f89 TI |
4970 | { |
4971 | char name[32]; | |
4972 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); | |
66ceeb6b | 4973 | return add_control(spec, type, name, cidx, val); |
0afe5f89 TI |
4974 | } |
4975 | ||
66ceeb6b TI |
4976 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
4977 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) | |
4978 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ | |
4979 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) | |
4980 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ | |
4981 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) | |
4982 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ | |
4983 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) | |
0afe5f89 | 4984 | |
e9edcee0 TI |
4985 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
4986 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
4987 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
4988 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
e9edcee0 TI |
4989 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
4990 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
4991 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
4992 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
4993 | #define ALC880_PIN_CD_NID 0x1c | |
4994 | ||
4995 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
4996 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
4997 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
4998 | { |
4999 | hda_nid_t nid; | |
5000 | int assigned[4]; | |
5001 | int i, j; | |
5002 | ||
5003 | memset(assigned, 0, sizeof(assigned)); | |
b0af0de5 | 5004 | spec->multiout.dac_nids = spec->private_dac_nids; |
e9edcee0 TI |
5005 | |
5006 | /* check the pins hardwired to audio widget */ | |
5007 | for (i = 0; i < cfg->line_outs; i++) { | |
5008 | nid = cfg->line_out_pins[i]; | |
5009 | if (alc880_is_fixed_pin(nid)) { | |
5010 | int idx = alc880_fixed_pin_idx(nid); | |
5014f193 | 5011 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
e9edcee0 TI |
5012 | assigned[idx] = 1; |
5013 | } | |
5014 | } | |
5015 | /* left pins can be connect to any audio widget */ | |
5016 | for (i = 0; i < cfg->line_outs; i++) { | |
5017 | nid = cfg->line_out_pins[i]; | |
5018 | if (alc880_is_fixed_pin(nid)) | |
5019 | continue; | |
5020 | /* search for an empty channel */ | |
5021 | for (j = 0; j < cfg->line_outs; j++) { | |
f12ab1e0 TI |
5022 | if (!assigned[j]) { |
5023 | spec->multiout.dac_nids[i] = | |
5024 | alc880_idx_to_dac(j); | |
e9edcee0 TI |
5025 | assigned[j] = 1; |
5026 | break; | |
5027 | } | |
5028 | } | |
5029 | } | |
5030 | spec->multiout.num_dacs = cfg->line_outs; | |
5031 | return 0; | |
5032 | } | |
5033 | ||
5034 | /* add playback controls from the parsed DAC table */ | |
df694daa KY |
5035 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
5036 | const struct auto_pin_cfg *cfg) | |
e9edcee0 | 5037 | { |
f12ab1e0 TI |
5038 | static const char *chname[4] = { |
5039 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
5040 | }; | |
e9edcee0 TI |
5041 | hda_nid_t nid; |
5042 | int i, err; | |
5043 | ||
5044 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 5045 | if (!spec->multiout.dac_nids[i]) |
e9edcee0 TI |
5046 | continue; |
5047 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
5048 | if (i == 2) { | |
5049 | /* Center/LFE */ | |
0afe5f89 TI |
5050 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
5051 | "Center", | |
f12ab1e0 TI |
5052 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
5053 | HDA_OUTPUT)); | |
5054 | if (err < 0) | |
e9edcee0 | 5055 | return err; |
0afe5f89 TI |
5056 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
5057 | "LFE", | |
f12ab1e0 TI |
5058 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
5059 | HDA_OUTPUT)); | |
5060 | if (err < 0) | |
e9edcee0 | 5061 | return err; |
0afe5f89 TI |
5062 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
5063 | "Center", | |
f12ab1e0 TI |
5064 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
5065 | HDA_INPUT)); | |
5066 | if (err < 0) | |
e9edcee0 | 5067 | return err; |
0afe5f89 TI |
5068 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
5069 | "LFE", | |
f12ab1e0 TI |
5070 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
5071 | HDA_INPUT)); | |
5072 | if (err < 0) | |
e9edcee0 TI |
5073 | return err; |
5074 | } else { | |
cb162b6b TI |
5075 | const char *pfx; |
5076 | if (cfg->line_outs == 1 && | |
5077 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
5078 | pfx = "Speaker"; | |
5079 | else | |
5080 | pfx = chname[i]; | |
0afe5f89 | 5081 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
5082 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
5083 | HDA_OUTPUT)); | |
5084 | if (err < 0) | |
e9edcee0 | 5085 | return err; |
0afe5f89 | 5086 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
5087 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
5088 | HDA_INPUT)); | |
5089 | if (err < 0) | |
e9edcee0 TI |
5090 | return err; |
5091 | } | |
5092 | } | |
e9edcee0 TI |
5093 | return 0; |
5094 | } | |
5095 | ||
8d88bc3d TI |
5096 | /* add playback controls for speaker and HP outputs */ |
5097 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
5098 | const char *pfx) | |
e9edcee0 TI |
5099 | { |
5100 | hda_nid_t nid; | |
5101 | int err; | |
5102 | ||
f12ab1e0 | 5103 | if (!pin) |
e9edcee0 TI |
5104 | return 0; |
5105 | ||
5106 | if (alc880_is_fixed_pin(pin)) { | |
5107 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
82bc955f | 5108 | /* specify the DAC as the extra output */ |
f12ab1e0 | 5109 | if (!spec->multiout.hp_nid) |
e9edcee0 | 5110 | spec->multiout.hp_nid = nid; |
82bc955f TI |
5111 | else |
5112 | spec->multiout.extra_out_nid[0] = nid; | |
e9edcee0 TI |
5113 | /* control HP volume/switch on the output mixer amp */ |
5114 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
0afe5f89 | 5115 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
5116 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
5117 | if (err < 0) | |
e9edcee0 | 5118 | return err; |
0afe5f89 | 5119 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
5120 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
5121 | if (err < 0) | |
e9edcee0 TI |
5122 | return err; |
5123 | } else if (alc880_is_multi_pin(pin)) { | |
5124 | /* set manual connection */ | |
e9edcee0 | 5125 | /* we have only a switch on HP-out PIN */ |
0afe5f89 | 5126 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
f12ab1e0 TI |
5127 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
5128 | if (err < 0) | |
e9edcee0 TI |
5129 | return err; |
5130 | } | |
5131 | return 0; | |
5132 | } | |
5133 | ||
5134 | /* create input playback/capture controls for the given pin */ | |
f12ab1e0 | 5135 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
66ceeb6b | 5136 | const char *ctlname, int ctlidx, |
df694daa | 5137 | int idx, hda_nid_t mix_nid) |
e9edcee0 | 5138 | { |
df694daa | 5139 | int err; |
e9edcee0 | 5140 | |
66ceeb6b | 5141 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
f12ab1e0 TI |
5142 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
5143 | if (err < 0) | |
e9edcee0 | 5144 | return err; |
66ceeb6b | 5145 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
f12ab1e0 TI |
5146 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
5147 | if (err < 0) | |
e9edcee0 TI |
5148 | return err; |
5149 | return 0; | |
5150 | } | |
5151 | ||
05f5f477 TI |
5152 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
5153 | { | |
5154 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | |
5155 | return (pincap & AC_PINCAP_IN) != 0; | |
5156 | } | |
5157 | ||
e9edcee0 | 5158 | /* create playback/capture controls for input pins */ |
05f5f477 TI |
5159 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
5160 | const struct auto_pin_cfg *cfg, | |
5161 | hda_nid_t mixer, | |
5162 | hda_nid_t cap1, hda_nid_t cap2) | |
e9edcee0 | 5163 | { |
05f5f477 | 5164 | struct alc_spec *spec = codec->spec; |
61b9b9b1 | 5165 | struct hda_input_mux *imux = &spec->private_imux[0]; |
66ceeb6b | 5166 | int i, err, idx, type, type_idx = 0; |
e9edcee0 | 5167 | |
66ceeb6b | 5168 | for (i = 0; i < cfg->num_inputs; i++) { |
05f5f477 | 5169 | hda_nid_t pin; |
10a20af7 | 5170 | const char *label; |
05f5f477 | 5171 | |
66ceeb6b | 5172 | pin = cfg->inputs[i].pin; |
05f5f477 TI |
5173 | if (!alc_is_input_pin(codec, pin)) |
5174 | continue; | |
5175 | ||
66ceeb6b TI |
5176 | type = cfg->inputs[i].type; |
5177 | if (i > 0 && type == cfg->inputs[i - 1].type) | |
5178 | type_idx++; | |
5179 | else | |
5180 | type_idx = 0; | |
10a20af7 | 5181 | label = hda_get_autocfg_input_label(codec, cfg, i); |
05f5f477 TI |
5182 | if (mixer) { |
5183 | idx = get_connection_index(codec, mixer, pin); | |
5184 | if (idx >= 0) { | |
5185 | err = new_analog_input(spec, pin, | |
10a20af7 TI |
5186 | label, type_idx, |
5187 | idx, mixer); | |
05f5f477 TI |
5188 | if (err < 0) |
5189 | return err; | |
5190 | } | |
5191 | } | |
5192 | ||
5193 | if (!cap1) | |
5194 | continue; | |
5195 | idx = get_connection_index(codec, cap1, pin); | |
5196 | if (idx < 0 && cap2) | |
5197 | idx = get_connection_index(codec, cap2, pin); | |
10a20af7 TI |
5198 | if (idx >= 0) |
5199 | snd_hda_add_imux_item(imux, label, idx, NULL); | |
e9edcee0 TI |
5200 | } |
5201 | return 0; | |
5202 | } | |
5203 | ||
05f5f477 TI |
5204 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
5205 | const struct auto_pin_cfg *cfg) | |
5206 | { | |
5207 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | |
5208 | } | |
5209 | ||
f6c7e546 TI |
5210 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
5211 | unsigned int pin_type) | |
5212 | { | |
5213 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5214 | pin_type); | |
5215 | /* unmute pin */ | |
d260cdf6 TI |
5216 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
5217 | AMP_OUT_UNMUTE); | |
f6c7e546 TI |
5218 | } |
5219 | ||
df694daa KY |
5220 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
5221 | hda_nid_t nid, int pin_type, | |
e9edcee0 TI |
5222 | int dac_idx) |
5223 | { | |
f6c7e546 | 5224 | alc_set_pin_output(codec, nid, pin_type); |
e9edcee0 TI |
5225 | /* need the manual connection? */ |
5226 | if (alc880_is_multi_pin(nid)) { | |
5227 | struct alc_spec *spec = codec->spec; | |
5228 | int idx = alc880_multi_pin_idx(nid); | |
5229 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
5230 | AC_VERB_SET_CONNECT_SEL, | |
5231 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
5232 | } | |
5233 | } | |
5234 | ||
baba8ee9 TI |
5235 | static int get_pin_type(int line_out_type) |
5236 | { | |
5237 | if (line_out_type == AUTO_PIN_HP_OUT) | |
5238 | return PIN_HP; | |
5239 | else | |
5240 | return PIN_OUT; | |
5241 | } | |
5242 | ||
e9edcee0 TI |
5243 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
5244 | { | |
5245 | struct alc_spec *spec = codec->spec; | |
5246 | int i; | |
ea1fb29a | 5247 | |
e9edcee0 TI |
5248 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
5249 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 TI |
5250 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
5251 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
e9edcee0 TI |
5252 | } |
5253 | } | |
5254 | ||
8d88bc3d | 5255 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
e9edcee0 TI |
5256 | { |
5257 | struct alc_spec *spec = codec->spec; | |
5258 | hda_nid_t pin; | |
5259 | ||
82bc955f | 5260 | pin = spec->autocfg.speaker_pins[0]; |
8d88bc3d TI |
5261 | if (pin) /* connect to front */ |
5262 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
eb06ed8f | 5263 | pin = spec->autocfg.hp_pins[0]; |
e9edcee0 TI |
5264 | if (pin) /* connect to front */ |
5265 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
5266 | } | |
5267 | ||
5268 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
5269 | { | |
5270 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5271 | struct auto_pin_cfg *cfg = &spec->autocfg; |
e9edcee0 TI |
5272 | int i; |
5273 | ||
66ceeb6b TI |
5274 | for (i = 0; i < cfg->num_inputs; i++) { |
5275 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 5276 | if (alc_is_input_pin(codec, nid)) { |
30ea098f | 5277 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
e82c025b TI |
5278 | if (nid != ALC880_PIN_CD_NID && |
5279 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f12ab1e0 TI |
5280 | snd_hda_codec_write(codec, nid, 0, |
5281 | AC_VERB_SET_AMP_GAIN_MUTE, | |
e9edcee0 TI |
5282 | AMP_OUT_MUTE); |
5283 | } | |
5284 | } | |
5285 | } | |
5286 | ||
7f311a46 TI |
5287 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
5288 | { | |
5289 | struct alc_spec *spec = codec->spec; | |
5290 | int c; | |
5291 | ||
5292 | for (c = 0; c < spec->num_adc_nids; c++) { | |
5293 | unsigned int mux_idx; | |
5294 | const struct hda_input_mux *imux; | |
5295 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
5296 | imux = &spec->input_mux[mux_idx]; | |
5297 | if (!imux->num_items && mux_idx > 0) | |
5298 | imux = &spec->input_mux[0]; | |
5299 | if (imux) | |
5300 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, | |
5301 | AC_VERB_SET_CONNECT_SEL, | |
5302 | imux->items[0].index); | |
5303 | } | |
5304 | } | |
5305 | ||
e9edcee0 | 5306 | /* parse the BIOS configuration and set up the alc_spec */ |
f12ab1e0 TI |
5307 | /* return 1 if successful, 0 if the proper config is not found, |
5308 | * or a negative error code | |
5309 | */ | |
e9edcee0 TI |
5310 | static int alc880_parse_auto_config(struct hda_codec *codec) |
5311 | { | |
5312 | struct alc_spec *spec = codec->spec; | |
757899ac | 5313 | int err; |
df694daa | 5314 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
e9edcee0 | 5315 | |
f12ab1e0 TI |
5316 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
5317 | alc880_ignore); | |
5318 | if (err < 0) | |
e9edcee0 | 5319 | return err; |
f12ab1e0 | 5320 | if (!spec->autocfg.line_outs) |
e9edcee0 | 5321 | return 0; /* can't find valid BIOS pin config */ |
df694daa | 5322 | |
f12ab1e0 TI |
5323 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
5324 | if (err < 0) | |
5325 | return err; | |
5326 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
5327 | if (err < 0) | |
5328 | return err; | |
5329 | err = alc880_auto_create_extra_out(spec, | |
5330 | spec->autocfg.speaker_pins[0], | |
5331 | "Speaker"); | |
5332 | if (err < 0) | |
5333 | return err; | |
5334 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
5335 | "Headphone"); | |
5336 | if (err < 0) | |
5337 | return err; | |
05f5f477 | 5338 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 5339 | if (err < 0) |
e9edcee0 TI |
5340 | return err; |
5341 | ||
5342 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
5343 | ||
757899ac | 5344 | alc_auto_parse_digital(codec); |
e9edcee0 | 5345 | |
603c4019 | 5346 | if (spec->kctls.list) |
d88897ea | 5347 | add_mixer(spec, spec->kctls.list); |
e9edcee0 | 5348 | |
d88897ea | 5349 | add_verb(spec, alc880_volume_init_verbs); |
e9edcee0 | 5350 | |
a1e8d2da | 5351 | spec->num_mux_defs = 1; |
61b9b9b1 | 5352 | spec->input_mux = &spec->private_imux[0]; |
e9edcee0 | 5353 | |
6227cdce | 5354 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 5355 | |
e9edcee0 TI |
5356 | return 1; |
5357 | } | |
5358 | ||
ae6b813a TI |
5359 | /* additional initialization for auto-configuration model */ |
5360 | static void alc880_auto_init(struct hda_codec *codec) | |
e9edcee0 | 5361 | { |
f6c7e546 | 5362 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 5363 | alc880_auto_init_multi_out(codec); |
8d88bc3d | 5364 | alc880_auto_init_extra_out(codec); |
e9edcee0 | 5365 | alc880_auto_init_analog_input(codec); |
7f311a46 | 5366 | alc880_auto_init_input_src(codec); |
757899ac | 5367 | alc_auto_init_digital(codec); |
f6c7e546 | 5368 | if (spec->unsol_event) |
7fb0d78f | 5369 | alc_inithook(codec); |
e9edcee0 TI |
5370 | } |
5371 | ||
b59bdf3b TI |
5372 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
5373 | * one of two digital mic pins, e.g. on ALC272 | |
5374 | */ | |
5375 | static void fixup_automic_adc(struct hda_codec *codec) | |
5376 | { | |
5377 | struct alc_spec *spec = codec->spec; | |
5378 | int i; | |
5379 | ||
5380 | for (i = 0; i < spec->num_adc_nids; i++) { | |
5381 | hda_nid_t cap = spec->capsrc_nids ? | |
5382 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5383 | int iidx, eidx; | |
5384 | ||
5385 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | |
5386 | if (iidx < 0) | |
5387 | continue; | |
5388 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | |
5389 | if (eidx < 0) | |
5390 | continue; | |
5391 | spec->int_mic.mux_idx = iidx; | |
5392 | spec->ext_mic.mux_idx = eidx; | |
5393 | if (spec->capsrc_nids) | |
5394 | spec->capsrc_nids += i; | |
5395 | spec->adc_nids += i; | |
5396 | spec->num_adc_nids = 1; | |
5397 | return; | |
5398 | } | |
5399 | snd_printd(KERN_INFO "hda_codec: %s: " | |
5400 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | |
5401 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | |
5402 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | |
5403 | } | |
5404 | ||
748cce43 TI |
5405 | /* select or unmute the given capsrc route */ |
5406 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, | |
5407 | int idx) | |
5408 | { | |
5409 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | |
5410 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | |
5411 | HDA_AMP_MUTE, 0); | |
5412 | } else { | |
5413 | snd_hda_codec_write_cache(codec, cap, 0, | |
5414 | AC_VERB_SET_CONNECT_SEL, idx); | |
5415 | } | |
5416 | } | |
5417 | ||
840b64c0 TI |
5418 | /* set the default connection to that pin */ |
5419 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |
eaa9b3a7 TI |
5420 | { |
5421 | struct alc_spec *spec = codec->spec; | |
eaa9b3a7 TI |
5422 | int i; |
5423 | ||
eaa9b3a7 TI |
5424 | for (i = 0; i < spec->num_adc_nids; i++) { |
5425 | hda_nid_t cap = spec->capsrc_nids ? | |
5426 | spec->capsrc_nids[i] : spec->adc_nids[i]; | |
5427 | int idx; | |
5428 | ||
5429 | idx = get_connection_index(codec, cap, pin); | |
5430 | if (idx < 0) | |
5431 | continue; | |
748cce43 | 5432 | select_or_unmute_capsrc(codec, cap, idx); |
840b64c0 TI |
5433 | return i; /* return the found index */ |
5434 | } | |
5435 | return -1; /* not found */ | |
5436 | } | |
5437 | ||
5438 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | |
5439 | static void fixup_single_adc(struct hda_codec *codec) | |
5440 | { | |
5441 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5442 | struct auto_pin_cfg *cfg = &spec->autocfg; |
840b64c0 TI |
5443 | int i; |
5444 | ||
5445 | /* search for the input pin; there must be only one */ | |
66ceeb6b | 5446 | if (cfg->num_inputs != 1) |
eaa9b3a7 | 5447 | return; |
66ceeb6b | 5448 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
840b64c0 TI |
5449 | if (i >= 0) { |
5450 | /* use only this ADC */ | |
5451 | if (spec->capsrc_nids) | |
5452 | spec->capsrc_nids += i; | |
5453 | spec->adc_nids += i; | |
5454 | spec->num_adc_nids = 1; | |
eaa9b3a7 TI |
5455 | } |
5456 | } | |
5457 | ||
840b64c0 TI |
5458 | /* initialize dual adcs */ |
5459 | static void fixup_dual_adc_switch(struct hda_codec *codec) | |
5460 | { | |
5461 | struct alc_spec *spec = codec->spec; | |
5462 | init_capsrc_for_pin(codec, spec->ext_mic.pin); | |
5463 | init_capsrc_for_pin(codec, spec->int_mic.pin); | |
5464 | } | |
5465 | ||
b59bdf3b | 5466 | static void set_capture_mixer(struct hda_codec *codec) |
f9e336f6 | 5467 | { |
b59bdf3b | 5468 | struct alc_spec *spec = codec->spec; |
a23b688f TI |
5469 | static struct snd_kcontrol_new *caps[2][3] = { |
5470 | { alc_capture_mixer_nosrc1, | |
5471 | alc_capture_mixer_nosrc2, | |
5472 | alc_capture_mixer_nosrc3 }, | |
5473 | { alc_capture_mixer1, | |
5474 | alc_capture_mixer2, | |
5475 | alc_capture_mixer3 }, | |
f9e336f6 | 5476 | }; |
a23b688f | 5477 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
eaa9b3a7 | 5478 | int mux = 0; |
840b64c0 TI |
5479 | int num_adcs = spec->num_adc_nids; |
5480 | if (spec->dual_adc_switch) | |
5481 | fixup_dual_adc_switch(codec); | |
5482 | else if (spec->auto_mic) | |
b59bdf3b | 5483 | fixup_automic_adc(codec); |
eaa9b3a7 TI |
5484 | else if (spec->input_mux) { |
5485 | if (spec->input_mux->num_items > 1) | |
5486 | mux = 1; | |
5487 | else if (spec->input_mux->num_items == 1) | |
5488 | fixup_single_adc(codec); | |
5489 | } | |
840b64c0 TI |
5490 | if (spec->dual_adc_switch) |
5491 | num_adcs = 1; | |
5492 | spec->cap_mixer = caps[mux][num_adcs - 1]; | |
a23b688f | 5493 | } |
f9e336f6 TI |
5494 | } |
5495 | ||
6694635d TI |
5496 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
5497 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | |
5498 | int num_nids) | |
5499 | { | |
5500 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 5501 | struct auto_pin_cfg *cfg = &spec->autocfg; |
6694635d TI |
5502 | int n; |
5503 | hda_nid_t fallback_adc = 0, fallback_cap = 0; | |
5504 | ||
5505 | for (n = 0; n < num_nids; n++) { | |
5506 | hda_nid_t adc, cap; | |
5507 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | |
5508 | int nconns, i, j; | |
5509 | ||
5510 | adc = nids[n]; | |
5511 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) | |
5512 | continue; | |
5513 | cap = adc; | |
5514 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5515 | ARRAY_SIZE(conn)); | |
5516 | if (nconns == 1) { | |
5517 | cap = conn[0]; | |
5518 | nconns = snd_hda_get_connections(codec, cap, conn, | |
5519 | ARRAY_SIZE(conn)); | |
5520 | } | |
5521 | if (nconns <= 0) | |
5522 | continue; | |
5523 | if (!fallback_adc) { | |
5524 | fallback_adc = adc; | |
5525 | fallback_cap = cap; | |
5526 | } | |
66ceeb6b TI |
5527 | for (i = 0; i < cfg->num_inputs; i++) { |
5528 | hda_nid_t nid = cfg->inputs[i].pin; | |
6694635d TI |
5529 | for (j = 0; j < nconns; j++) { |
5530 | if (conn[j] == nid) | |
5531 | break; | |
5532 | } | |
5533 | if (j >= nconns) | |
5534 | break; | |
5535 | } | |
66ceeb6b | 5536 | if (i >= cfg->num_inputs) { |
6694635d TI |
5537 | int num_adcs = spec->num_adc_nids; |
5538 | spec->private_adc_nids[num_adcs] = adc; | |
5539 | spec->private_capsrc_nids[num_adcs] = cap; | |
5540 | spec->num_adc_nids++; | |
5541 | spec->adc_nids = spec->private_adc_nids; | |
5542 | if (adc != cap) | |
5543 | spec->capsrc_nids = spec->private_capsrc_nids; | |
5544 | } | |
5545 | } | |
5546 | if (!spec->num_adc_nids) { | |
5547 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" | |
1f85d72d TI |
5548 | " using fallback 0x%x\n", |
5549 | codec->chip_name, fallback_adc); | |
6694635d TI |
5550 | spec->private_adc_nids[0] = fallback_adc; |
5551 | spec->adc_nids = spec->private_adc_nids; | |
5552 | if (fallback_adc != fallback_cap) { | |
5553 | spec->private_capsrc_nids[0] = fallback_cap; | |
5554 | spec->capsrc_nids = spec->private_adc_nids; | |
5555 | } | |
5556 | } | |
5557 | } | |
5558 | ||
67d634c0 | 5559 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
5560 | #define set_beep_amp(spec, nid, idx, dir) \ |
5561 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | |
dc1eae25 TI |
5562 | |
5563 | static struct snd_pci_quirk beep_white_list[] = { | |
5564 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), | |
080dc7bc | 5565 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
e096c8e6 | 5566 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
dc1eae25 TI |
5567 | {} |
5568 | }; | |
5569 | ||
5570 | static inline int has_cdefine_beep(struct hda_codec *codec) | |
5571 | { | |
5572 | struct alc_spec *spec = codec->spec; | |
5573 | const struct snd_pci_quirk *q; | |
5574 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); | |
5575 | if (q) | |
5576 | return q->value; | |
5577 | return spec->cdefine.enable_pcbeep; | |
5578 | } | |
67d634c0 TI |
5579 | #else |
5580 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | |
dc1eae25 | 5581 | #define has_cdefine_beep(codec) 0 |
67d634c0 | 5582 | #endif |
45bdd1c1 TI |
5583 | |
5584 | /* | |
5585 | * OK, here we have finally the patch for ALC880 | |
5586 | */ | |
5587 | ||
1da177e4 LT |
5588 | static int patch_alc880(struct hda_codec *codec) |
5589 | { | |
5590 | struct alc_spec *spec; | |
5591 | int board_config; | |
df694daa | 5592 | int err; |
1da177e4 | 5593 | |
e560d8d8 | 5594 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
5595 | if (spec == NULL) |
5596 | return -ENOMEM; | |
5597 | ||
5598 | codec->spec = spec; | |
5599 | ||
f5fcc13c TI |
5600 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
5601 | alc880_models, | |
5602 | alc880_cfg_tbl); | |
5603 | if (board_config < 0) { | |
9a11f1aa TI |
5604 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
5605 | codec->chip_name); | |
e9edcee0 | 5606 | board_config = ALC880_AUTO; |
1da177e4 | 5607 | } |
1da177e4 | 5608 | |
e9edcee0 TI |
5609 | if (board_config == ALC880_AUTO) { |
5610 | /* automatic parse from the BIOS config */ | |
5611 | err = alc880_parse_auto_config(codec); | |
5612 | if (err < 0) { | |
5613 | alc_free(codec); | |
5614 | return err; | |
f12ab1e0 | 5615 | } else if (!err) { |
9c7f852e TI |
5616 | printk(KERN_INFO |
5617 | "hda_codec: Cannot set up configuration " | |
5618 | "from BIOS. Using 3-stack mode...\n"); | |
e9edcee0 TI |
5619 | board_config = ALC880_3ST; |
5620 | } | |
1da177e4 LT |
5621 | } |
5622 | ||
680cd536 KK |
5623 | err = snd_hda_attach_beep_device(codec, 0x1); |
5624 | if (err < 0) { | |
5625 | alc_free(codec); | |
5626 | return err; | |
5627 | } | |
5628 | ||
df694daa | 5629 | if (board_config != ALC880_AUTO) |
e9c364c0 | 5630 | setup_preset(codec, &alc880_presets[board_config]); |
1da177e4 | 5631 | |
1da177e4 LT |
5632 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
5633 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
6330079f | 5634 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
1da177e4 | 5635 | |
1da177e4 LT |
5636 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
5637 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
5638 | ||
f12ab1e0 | 5639 | if (!spec->adc_nids && spec->input_mux) { |
e9edcee0 | 5640 | /* check whether NID 0x07 is valid */ |
54d17403 | 5641 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
f12ab1e0 | 5642 | /* get type */ |
a22d543a | 5643 | wcap = get_wcaps_type(wcap); |
e9edcee0 TI |
5644 | if (wcap != AC_WID_AUD_IN) { |
5645 | spec->adc_nids = alc880_adc_nids_alt; | |
5646 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
e9edcee0 TI |
5647 | } else { |
5648 | spec->adc_nids = alc880_adc_nids; | |
5649 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
e9edcee0 TI |
5650 | } |
5651 | } | |
b59bdf3b | 5652 | set_capture_mixer(codec); |
45bdd1c1 | 5653 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
1da177e4 | 5654 | |
2134ea4f TI |
5655 | spec->vmaster_nid = 0x0c; |
5656 | ||
1da177e4 | 5657 | codec->patch_ops = alc_patch_ops; |
e9edcee0 | 5658 | if (board_config == ALC880_AUTO) |
ae6b813a | 5659 | spec->init_hook = alc880_auto_init; |
cb53c626 TI |
5660 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5661 | if (!spec->loopback.amplist) | |
5662 | spec->loopback.amplist = alc880_loopbacks; | |
5663 | #endif | |
1da177e4 LT |
5664 | |
5665 | return 0; | |
5666 | } | |
5667 | ||
e9edcee0 | 5668 | |
1da177e4 LT |
5669 | /* |
5670 | * ALC260 support | |
5671 | */ | |
5672 | ||
e9edcee0 TI |
5673 | static hda_nid_t alc260_dac_nids[1] = { |
5674 | /* front */ | |
5675 | 0x02, | |
5676 | }; | |
5677 | ||
5678 | static hda_nid_t alc260_adc_nids[1] = { | |
5679 | /* ADC0 */ | |
5680 | 0x04, | |
5681 | }; | |
5682 | ||
df694daa | 5683 | static hda_nid_t alc260_adc_nids_alt[1] = { |
e9edcee0 TI |
5684 | /* ADC1 */ |
5685 | 0x05, | |
5686 | }; | |
5687 | ||
d57fdac0 JW |
5688 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
5689 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
5690 | */ | |
5691 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
4c5186ed JW |
5692 | /* ADC0, ADC1 */ |
5693 | 0x04, 0x05 | |
5694 | }; | |
5695 | ||
e9edcee0 TI |
5696 | #define ALC260_DIGOUT_NID 0x03 |
5697 | #define ALC260_DIGIN_NID 0x06 | |
5698 | ||
5699 | static struct hda_input_mux alc260_capture_source = { | |
5700 | .num_items = 4, | |
5701 | .items = { | |
5702 | { "Mic", 0x0 }, | |
5703 | { "Front Mic", 0x1 }, | |
5704 | { "Line", 0x2 }, | |
5705 | { "CD", 0x4 }, | |
5706 | }, | |
5707 | }; | |
5708 | ||
17e7aec6 | 5709 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
a1e8d2da JW |
5710 | * headphone jack and the internal CD lines since these are the only pins at |
5711 | * which audio can appear. For flexibility, also allow the option of | |
5712 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
5713 | * connection to the mixer output). | |
a9430dd8 | 5714 | */ |
a1e8d2da JW |
5715 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
5716 | { | |
5717 | .num_items = 3, | |
5718 | .items = { | |
5719 | { "Mic/Line", 0x0 }, | |
5720 | { "CD", 0x4 }, | |
5721 | { "Headphone", 0x2 }, | |
5722 | }, | |
a9430dd8 | 5723 | }, |
a1e8d2da JW |
5724 | { |
5725 | .num_items = 4, | |
5726 | .items = { | |
5727 | { "Mic/Line", 0x0 }, | |
5728 | { "CD", 0x4 }, | |
5729 | { "Headphone", 0x2 }, | |
5730 | { "Mixer", 0x5 }, | |
5731 | }, | |
5732 | }, | |
5733 | ||
a9430dd8 JW |
5734 | }; |
5735 | ||
a1e8d2da JW |
5736 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
5737 | * the Fujitsu S702x, but jacks are marked differently. | |
0bfc90e9 | 5738 | */ |
a1e8d2da JW |
5739 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
5740 | { | |
5741 | .num_items = 4, | |
5742 | .items = { | |
5743 | { "Mic", 0x0 }, | |
5744 | { "Line", 0x2 }, | |
5745 | { "CD", 0x4 }, | |
5746 | { "Headphone", 0x5 }, | |
5747 | }, | |
5748 | }, | |
5749 | { | |
5750 | .num_items = 5, | |
5751 | .items = { | |
5752 | { "Mic", 0x0 }, | |
5753 | { "Line", 0x2 }, | |
5754 | { "CD", 0x4 }, | |
5755 | { "Headphone", 0x6 }, | |
5756 | { "Mixer", 0x5 }, | |
5757 | }, | |
0bfc90e9 JW |
5758 | }, |
5759 | }; | |
cc959489 MS |
5760 | |
5761 | /* Maxdata Favorit 100XS */ | |
5762 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { | |
5763 | { | |
5764 | .num_items = 2, | |
5765 | .items = { | |
5766 | { "Line/Mic", 0x0 }, | |
5767 | { "CD", 0x4 }, | |
5768 | }, | |
5769 | }, | |
5770 | { | |
5771 | .num_items = 3, | |
5772 | .items = { | |
5773 | { "Line/Mic", 0x0 }, | |
5774 | { "CD", 0x4 }, | |
5775 | { "Mixer", 0x5 }, | |
5776 | }, | |
5777 | }, | |
5778 | }; | |
5779 | ||
1da177e4 LT |
5780 | /* |
5781 | * This is just place-holder, so there's something for alc_build_pcms to look | |
5782 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
5783 | * element which allows changing the channel mode, so the verb list is | |
5784 | * never used. | |
5785 | */ | |
d2a6d7dc | 5786 | static struct hda_channel_mode alc260_modes[1] = { |
1da177e4 LT |
5787 | { 2, NULL }, |
5788 | }; | |
5789 | ||
df694daa KY |
5790 | |
5791 | /* Mixer combinations | |
5792 | * | |
5793 | * basic: base_output + input + pc_beep + capture | |
5794 | * HP: base_output + input + capture_alt | |
5795 | * HP_3013: hp_3013 + input + capture | |
5796 | * fujitsu: fujitsu + capture | |
0bfc90e9 | 5797 | * acer: acer + capture |
df694daa KY |
5798 | */ |
5799 | ||
5800 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
05acb863 | 5801 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 5802 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
05acb863 | 5803 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
985be54b | 5804 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
05acb863 | 5805 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
985be54b | 5806 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
1da177e4 | 5807 | { } /* end */ |
f12ab1e0 | 5808 | }; |
1da177e4 | 5809 | |
df694daa | 5810 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
16ded525 TI |
5811 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
5812 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5813 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5814 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5815 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
5816 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
5817 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
5818 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
df694daa KY |
5819 | { } /* end */ |
5820 | }; | |
5821 | ||
bec15c3a TI |
5822 | /* update HP, line and mono out pins according to the master switch */ |
5823 | static void alc260_hp_master_update(struct hda_codec *codec, | |
5824 | hda_nid_t hp, hda_nid_t line, | |
5825 | hda_nid_t mono) | |
5826 | { | |
5827 | struct alc_spec *spec = codec->spec; | |
5828 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
5829 | /* change HP and line-out pins */ | |
30cde0aa | 5830 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a | 5831 | val); |
30cde0aa | 5832 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a TI |
5833 | val); |
5834 | /* mono (speaker) depending on the HP jack sense */ | |
5835 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
30cde0aa | 5836 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a TI |
5837 | val); |
5838 | } | |
5839 | ||
5840 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
5841 | struct snd_ctl_elem_value *ucontrol) | |
5842 | { | |
5843 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5844 | struct alc_spec *spec = codec->spec; | |
5845 | *ucontrol->value.integer.value = spec->master_sw; | |
5846 | return 0; | |
5847 | } | |
5848 | ||
5849 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
5850 | struct snd_ctl_elem_value *ucontrol) | |
5851 | { | |
5852 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
5853 | struct alc_spec *spec = codec->spec; | |
5854 | int val = !!*ucontrol->value.integer.value; | |
5855 | hda_nid_t hp, line, mono; | |
5856 | ||
5857 | if (val == spec->master_sw) | |
5858 | return 0; | |
5859 | spec->master_sw = val; | |
5860 | hp = (kcontrol->private_value >> 16) & 0xff; | |
5861 | line = (kcontrol->private_value >> 8) & 0xff; | |
5862 | mono = kcontrol->private_value & 0xff; | |
5863 | alc260_hp_master_update(codec, hp, line, mono); | |
5864 | return 1; | |
5865 | } | |
5866 | ||
5867 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
5868 | { | |
5869 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5870 | .name = "Master Playback Switch", | |
5b0cb1d8 | 5871 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
bec15c3a TI |
5872 | .info = snd_ctl_boolean_mono_info, |
5873 | .get = alc260_hp_master_sw_get, | |
5874 | .put = alc260_hp_master_sw_put, | |
5875 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
5876 | }, | |
5877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5878 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
5879 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
5880 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
5881 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
5882 | HDA_OUTPUT), | |
5883 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
5884 | { } /* end */ | |
5885 | }; | |
5886 | ||
5887 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
5888 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5889 | {}, | |
5890 | }; | |
5891 | ||
5892 | static void alc260_hp_automute(struct hda_codec *codec) | |
5893 | { | |
5894 | struct alc_spec *spec = codec->spec; | |
bec15c3a | 5895 | |
864f92be | 5896 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
bec15c3a TI |
5897 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
5898 | } | |
5899 | ||
5900 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
5901 | { | |
5902 | if ((res >> 26) == ALC880_HP_EVENT) | |
5903 | alc260_hp_automute(codec); | |
5904 | } | |
5905 | ||
df694daa | 5906 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
bec15c3a TI |
5907 | { |
5908 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5909 | .name = "Master Playback Switch", | |
5b0cb1d8 | 5910 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
bec15c3a TI |
5911 | .info = snd_ctl_boolean_mono_info, |
5912 | .get = alc260_hp_master_sw_get, | |
5913 | .put = alc260_hp_master_sw_put, | |
30cde0aa | 5914 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
bec15c3a | 5915 | }, |
df694daa KY |
5916 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
5917 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5918 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
5919 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
5920 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
5921 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
5922 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
5923 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
16ded525 TI |
5924 | { } /* end */ |
5925 | }; | |
5926 | ||
3f878308 KY |
5927 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
5928 | .ops = &snd_hda_bind_vol, | |
5929 | .values = { | |
5930 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | |
5931 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | |
5932 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | |
5933 | 0 | |
5934 | }, | |
5935 | }; | |
5936 | ||
5937 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | |
5938 | .ops = &snd_hda_bind_sw, | |
5939 | .values = { | |
5940 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | |
5941 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
5942 | 0 | |
5943 | }, | |
5944 | }; | |
5945 | ||
5946 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | |
5947 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | |
5948 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | |
5949 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | |
5950 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
5951 | { } /* end */ | |
5952 | }; | |
5953 | ||
bec15c3a TI |
5954 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
5955 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
5956 | {}, | |
5957 | }; | |
5958 | ||
5959 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
5960 | { | |
5961 | struct alc_spec *spec = codec->spec; | |
bec15c3a | 5962 | |
864f92be | 5963 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
30cde0aa | 5964 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
bec15c3a TI |
5965 | } |
5966 | ||
5967 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
5968 | unsigned int res) | |
5969 | { | |
5970 | if ((res >> 26) == ALC880_HP_EVENT) | |
5971 | alc260_hp_3013_automute(codec); | |
5972 | } | |
5973 | ||
3f878308 KY |
5974 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
5975 | { | |
864f92be | 5976 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
3f878308 | 5977 | |
3f878308 KY |
5978 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
5979 | bits); | |
5980 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5981 | bits); | |
5982 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5983 | bits); | |
5984 | } | |
5985 | ||
5986 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | |
5987 | unsigned int res) | |
5988 | { | |
5989 | if ((res >> 26) == ALC880_HP_EVENT) | |
5990 | alc260_hp_3012_automute(codec); | |
5991 | } | |
5992 | ||
5993 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | |
a1e8d2da JW |
5994 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
5995 | */ | |
c8b6bf9b | 5996 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
a9430dd8 | 5997 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 5998 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
4c5186ed | 5999 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
a9430dd8 JW |
6000 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
6001 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
6002 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6003 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4c5186ed | 6004 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
31bffaa9 TI |
6005 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
6006 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
df694daa KY |
6007 | { } /* end */ |
6008 | }; | |
6009 | ||
a1e8d2da JW |
6010 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
6011 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
6012 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
6013 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
6014 | * whether this behaviour is intentional or is a hardware bug in chip | |
6015 | * revisions available in early 2006. Therefore for now allow the | |
6016 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
6017 | * that the lack of mic bias for this NID is intentional we could change the | |
6018 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
6019 | * | |
6020 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
6021 | * don't appear to make the mic bias available from the "line" jack, even | |
6022 | * though the NID used for this jack (0x14) can supply it. The theory is | |
6023 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
6024 | * and the output jack. If this turns out to be the case for all such | |
6025 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
6026 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
bd869485 JW |
6027 | * |
6028 | * The C20x Tablet series have a mono internal speaker which is controlled | |
6029 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
6030 | * controls for such models. On models without a "mono speaker" the control | |
6031 | * won't do anything. | |
a1e8d2da | 6032 | */ |
0bfc90e9 JW |
6033 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
6034 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6035 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
a1e8d2da | 6036 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
31bffaa9 | 6037 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
bd869485 | 6038 | HDA_OUTPUT), |
31bffaa9 | 6039 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
bd869485 | 6040 | HDA_INPUT), |
0bfc90e9 JW |
6041 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
6042 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
6043 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6044 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6045 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6046 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6047 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6048 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
0bfc90e9 JW |
6049 | { } /* end */ |
6050 | }; | |
6051 | ||
cc959489 MS |
6052 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
6053 | */ | |
6054 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { | |
6055 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6056 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
6057 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | |
6058 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6059 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6060 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6061 | { } /* end */ | |
6062 | }; | |
6063 | ||
bc9f98a9 KY |
6064 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
6065 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
6066 | */ | |
6067 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
6068 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6069 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
6070 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6071 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6072 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6073 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6074 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6075 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
6076 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6077 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
bc9f98a9 KY |
6078 | { } /* end */ |
6079 | }; | |
6080 | ||
6081 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
6082 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
6083 | */ | |
6084 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
6085 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6086 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
6087 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
6088 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
6089 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
6090 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
6091 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
6092 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6093 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6094 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
6095 | { } /* end */ | |
6096 | }; | |
6097 | ||
df694daa KY |
6098 | /* |
6099 | * initialization verbs | |
6100 | */ | |
1da177e4 LT |
6101 | static struct hda_verb alc260_init_verbs[] = { |
6102 | /* Line In pin widget for input */ | |
05acb863 | 6103 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 6104 | /* CD pin widget for input */ |
05acb863 | 6105 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 6106 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
16ded525 | 6107 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 6108 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
16ded525 | 6109 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 6110 | /* LINE-2 is used for line-out in rear */ |
05acb863 | 6111 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 6112 | /* select line-out */ |
fd56f2db | 6113 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 | 6114 | /* LINE-OUT pin */ |
05acb863 | 6115 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 6116 | /* enable HP */ |
05acb863 | 6117 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1da177e4 | 6118 | /* enable Mono */ |
05acb863 TI |
6119 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
6120 | /* mute capture amp left and right */ | |
16ded525 | 6121 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 LT |
6122 | /* set connection select to line in (default select for this ADC) */ |
6123 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16ded525 TI |
6124 | /* mute capture amp left and right */ |
6125 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6126 | /* set connection select to line in (default select for this ADC) */ | |
6127 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
05acb863 TI |
6128 | /* set vol=0 Line-Out mixer amp left and right */ |
6129 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6130 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6131 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6132 | /* set vol=0 HP mixer amp left and right */ | |
6133 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6134 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6135 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6136 | /* set vol=0 Mono mixer amp left and right */ | |
6137 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6138 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
6139 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6140 | /* unmute LINE-2 out pin */ | |
6141 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f12ab1e0 TI |
6142 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
6143 | * Line In 2 = 0x03 | |
6144 | */ | |
cb53c626 TI |
6145 | /* mute analog inputs */ |
6146 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6148 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6149 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6150 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 6151 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
05acb863 TI |
6152 | /* mute Front out path */ |
6153 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6154 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6155 | /* mute Headphone out path */ | |
6156 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6157 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6158 | /* mute Mono out path */ | |
6159 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6160 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
6161 | { } |
6162 | }; | |
6163 | ||
474167d6 | 6164 | #if 0 /* should be identical with alc260_init_verbs? */ |
df694daa KY |
6165 | static struct hda_verb alc260_hp_init_verbs[] = { |
6166 | /* Headphone and output */ | |
6167 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
6168 | /* mono output */ | |
6169 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6170 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
6171 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6172 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
6173 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6174 | /* Line In pin widget for input */ | |
6175 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6176 | /* Line-2 pin widget for output */ | |
6177 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6178 | /* CD pin widget for input */ | |
6179 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6180 | /* unmute amp left and right */ | |
6181 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
6182 | /* set connection select to line in (default select for this ADC) */ | |
6183 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6184 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
6185 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6186 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6188 | /* unmute HP mixer amp left and right (volume = 0) */ | |
6189 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6190 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6191 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
6192 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
6193 | * Line In 2 = 0x03 | |
6194 | */ | |
cb53c626 TI |
6195 | /* mute analog inputs */ |
6196 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6197 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
6201 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
6202 | /* Unmute Front out path */ | |
6203 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6204 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6205 | /* Unmute Headphone out path */ | |
6206 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6207 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6208 | /* Unmute Mono out path */ | |
6209 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6210 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6211 | { } | |
6212 | }; | |
474167d6 | 6213 | #endif |
df694daa KY |
6214 | |
6215 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
6216 | /* Line out and output */ | |
6217 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6218 | /* mono output */ | |
6219 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
6220 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
6221 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6222 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
6223 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
6224 | /* Line In pin widget for input */ | |
6225 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6226 | /* Headphone pin widget for output */ | |
6227 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
6228 | /* CD pin widget for input */ | |
6229 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
6230 | /* unmute amp left and right */ | |
6231 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
6232 | /* set connection select to line in (default select for this ADC) */ | |
6233 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
6234 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
6235 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6236 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
6238 | /* unmute HP mixer amp left and right (volume = 0) */ | |
6239 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
6240 | /* mute pin widget amp left and right (no gain on this amp) */ | |
6241 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
6242 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
6243 | * Line In 2 = 0x03 | |
6244 | */ | |
cb53c626 TI |
6245 | /* mute analog inputs */ |
6246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6247 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6248 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6249 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6250 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
6251 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
6252 | /* Unmute Front out path */ | |
6253 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6254 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6255 | /* Unmute Headphone out path */ | |
6256 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6258 | /* Unmute Mono out path */ | |
6259 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6260 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
6261 | { } | |
6262 | }; | |
6263 | ||
a9430dd8 | 6264 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
a1e8d2da JW |
6265 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
6266 | * audio = 0x16, internal speaker = 0x10. | |
a9430dd8 JW |
6267 | */ |
6268 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
6269 | /* Disable all GPIOs */ | |
6270 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
6271 | /* Internal speaker is connected to headphone pin */ | |
6272 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6273 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
6274 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
f7ace40d JW |
6275 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
6276 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6277 | /* Ensure all other unused pins are disabled and muted. */ | |
6278 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6279 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a9430dd8 | 6280 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d | 6281 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
a9430dd8 | 6282 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d JW |
6283 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6284 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6285 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6286 | ||
6287 | /* Disable digital (SPDIF) pins */ | |
6288 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6289 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
a9430dd8 | 6290 | |
ea1fb29a | 6291 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
f7ace40d JW |
6292 | * when acting as an output. |
6293 | */ | |
6294 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4c5186ed | 6295 | |
f7ace40d | 6296 | /* Start with output sum widgets muted and their output gains at min */ |
8b33a5aa TI |
6297 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6298 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6299 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6300 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6301 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6302 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6303 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6304 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6305 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a9430dd8 | 6306 | |
f7ace40d JW |
6307 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
6308 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6309 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
6310 | * If the pin mode is changed by the user the pin mode control will | |
6311 | * 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. | |
cdcd9268 | 6314 | */ |
f7ace40d | 6315 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
ea1fb29a | 6316 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
cdcd9268 JW |
6317 | * mixer ctrl) |
6318 | */ | |
f7ace40d JW |
6319 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
6320 | ||
6321 | /* Mute capture amp left and right */ | |
6322 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 6323 | /* Set ADC connection select to match default mixer setting - line |
f7ace40d JW |
6324 | * in (on mic1 pin) |
6325 | */ | |
6326 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6327 | ||
6328 | /* Do the same for the second ADC: mute capture input amp and | |
6329 | * set ADC connection to line in (on mic1 pin) | |
6330 | */ | |
6331 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6332 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6333 | ||
6334 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6337 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6338 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6339 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6340 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6341 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6342 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4a471b7d TI |
6343 | |
6344 | { } | |
a9430dd8 JW |
6345 | }; |
6346 | ||
0bfc90e9 JW |
6347 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
6348 | * similar laptops (adapted from Fujitsu init verbs). | |
6349 | */ | |
6350 | static struct hda_verb alc260_acer_init_verbs[] = { | |
6351 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
6352 | * the headphone jack. Turn this on and rely on the standard mute | |
6353 | * methods whenever the user wants to turn these outputs off. | |
6354 | */ | |
6355 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6356 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6357 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6358 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
6359 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6360 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
6361 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6362 | /* Line In jack is connected to Line1 pin */ | |
6363 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
bd869485 JW |
6364 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
6365 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
0bfc90e9 JW |
6366 | /* Ensure all other unused pins are disabled and muted. */ |
6367 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6368 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
0bfc90e9 JW |
6369 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
6370 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6371 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6372 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6373 | /* Disable digital (SPDIF) pins */ | |
6374 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6375 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6376 | ||
ea1fb29a | 6377 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
0bfc90e9 JW |
6378 | * bus when acting as outputs. |
6379 | */ | |
6380 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6381 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6382 | ||
6383 | /* Start with output sum widgets muted and their output gains at min */ | |
6384 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6385 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6386 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6387 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6388 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6389 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6390 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6391 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6392 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6393 | ||
f12ab1e0 TI |
6394 | /* Unmute Line-out pin widget amp left and right |
6395 | * (no equiv mixer ctrl) | |
6396 | */ | |
0bfc90e9 | 6397 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
bd869485 JW |
6398 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
6399 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
0bfc90e9 JW |
6400 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
6401 | * inputs. If the pin mode is changed by the user the pin mode control | |
6402 | * will take care of enabling the pin's input/output buffers as needed. | |
6403 | * Therefore there's no need to enable the input buffer at this | |
6404 | * stage. | |
6405 | */ | |
6406 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6407 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6408 | ||
6409 | /* Mute capture amp left and right */ | |
6410 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6411 | /* Set ADC connection select to match default mixer setting - mic | |
6412 | * (on mic1 pin) | |
6413 | */ | |
6414 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6415 | ||
6416 | /* Do similar with the second ADC: mute capture input amp and | |
a1e8d2da | 6417 | * set ADC connection to mic to match ALSA's default state. |
0bfc90e9 JW |
6418 | */ |
6419 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a1e8d2da | 6420 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
0bfc90e9 JW |
6421 | |
6422 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6423 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6424 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6425 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6426 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6427 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6428 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6429 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6430 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6431 | ||
6432 | { } | |
6433 | }; | |
6434 | ||
cc959489 MS |
6435 | /* Initialisation sequence for Maxdata Favorit 100XS |
6436 | * (adapted from Acer init verbs). | |
6437 | */ | |
6438 | static struct hda_verb alc260_favorit100_init_verbs[] = { | |
6439 | /* GPIO 0 enables the output jack. | |
6440 | * Turn this on and rely on the standard mute | |
6441 | * methods whenever the user wants to turn these outputs off. | |
6442 | */ | |
6443 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6444 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6445 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
6446 | /* Line/Mic input jack is connected to Mic1 pin */ | |
6447 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
6448 | /* Ensure all other unused pins are disabled and muted. */ | |
6449 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6450 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6451 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6452 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6453 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6454 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6455 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6456 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6457 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
6458 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6459 | /* Disable digital (SPDIF) pins */ | |
6460 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6461 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6462 | ||
6463 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | |
6464 | * bus when acting as outputs. | |
6465 | */ | |
6466 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6467 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6468 | ||
6469 | /* Start with output sum widgets muted and their output gains at min */ | |
6470 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6471 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6472 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6473 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6474 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6475 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6476 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6477 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6478 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6479 | ||
6480 | /* Unmute Line-out pin widget amp left and right | |
6481 | * (no equiv mixer ctrl) | |
6482 | */ | |
6483 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6484 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | |
6485 | * inputs. If the pin mode is changed by the user the pin mode control | |
6486 | * will take care of enabling the pin's input/output buffers as needed. | |
6487 | * Therefore there's no need to enable the input buffer at this | |
6488 | * stage. | |
6489 | */ | |
6490 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6491 | ||
6492 | /* Mute capture amp left and right */ | |
6493 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6494 | /* Set ADC connection select to match default mixer setting - mic | |
6495 | * (on mic1 pin) | |
6496 | */ | |
6497 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6498 | ||
6499 | /* Do similar with the second ADC: mute capture input amp and | |
6500 | * set ADC connection to mic to match ALSA's default state. | |
6501 | */ | |
6502 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6503 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6504 | ||
6505 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6506 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6509 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6510 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6511 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6512 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6513 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6514 | ||
6515 | { } | |
6516 | }; | |
6517 | ||
bc9f98a9 KY |
6518 | static struct hda_verb alc260_will_verbs[] = { |
6519 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6520 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6521 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6522 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6523 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6524 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
6525 | {} | |
6526 | }; | |
6527 | ||
6528 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
6529 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
6530 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
6531 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
6532 | ||
6533 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
6534 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
6535 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6536 | ||
6537 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6538 | {} | |
6539 | }; | |
6540 | ||
6541 | /* toggle speaker-output according to the hp-jack state */ | |
6542 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
6543 | { | |
6544 | unsigned int present; | |
6545 | ||
6546 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
864f92be | 6547 | present = snd_hda_jack_detect(codec, 0x0f); |
bc9f98a9 | 6548 | if (present) { |
82beb8fd TI |
6549 | snd_hda_codec_write_cache(codec, 0x01, 0, |
6550 | AC_VERB_SET_GPIO_DATA, 1); | |
6551 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6552 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6553 | PIN_HP); | |
bc9f98a9 | 6554 | } else { |
82beb8fd TI |
6555 | snd_hda_codec_write_cache(codec, 0x01, 0, |
6556 | AC_VERB_SET_GPIO_DATA, 0); | |
6557 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
6558 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
6559 | PIN_OUT); | |
bc9f98a9 KY |
6560 | } |
6561 | } | |
6562 | ||
6563 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
6564 | unsigned int res) | |
6565 | { | |
6566 | if ((res >> 26) == ALC880_HP_EVENT) | |
6567 | alc260_replacer_672v_automute(codec); | |
6568 | } | |
6569 | ||
3f878308 KY |
6570 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
6571 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6572 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6573 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6574 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6575 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6576 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6577 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6578 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6579 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6580 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6581 | {} | |
6582 | }; | |
6583 | ||
7cf51e48 JW |
6584 | /* Test configuration for debugging, modelled after the ALC880 test |
6585 | * configuration. | |
6586 | */ | |
6587 | #ifdef CONFIG_SND_DEBUG | |
6588 | static hda_nid_t alc260_test_dac_nids[1] = { | |
6589 | 0x02, | |
6590 | }; | |
6591 | static hda_nid_t alc260_test_adc_nids[2] = { | |
6592 | 0x04, 0x05, | |
6593 | }; | |
a1e8d2da | 6594 | /* For testing the ALC260, each input MUX needs its own definition since |
ea1fb29a | 6595 | * the signal assignments are different. This assumes that the first ADC |
a1e8d2da | 6596 | * is NID 0x04. |
17e7aec6 | 6597 | */ |
a1e8d2da JW |
6598 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
6599 | { | |
6600 | .num_items = 7, | |
6601 | .items = { | |
6602 | { "MIC1 pin", 0x0 }, | |
6603 | { "MIC2 pin", 0x1 }, | |
6604 | { "LINE1 pin", 0x2 }, | |
6605 | { "LINE2 pin", 0x3 }, | |
6606 | { "CD pin", 0x4 }, | |
6607 | { "LINE-OUT pin", 0x5 }, | |
6608 | { "HP-OUT pin", 0x6 }, | |
6609 | }, | |
6610 | }, | |
6611 | { | |
6612 | .num_items = 8, | |
6613 | .items = { | |
6614 | { "MIC1 pin", 0x0 }, | |
6615 | { "MIC2 pin", 0x1 }, | |
6616 | { "LINE1 pin", 0x2 }, | |
6617 | { "LINE2 pin", 0x3 }, | |
6618 | { "CD pin", 0x4 }, | |
6619 | { "Mixer", 0x5 }, | |
6620 | { "LINE-OUT pin", 0x6 }, | |
6621 | { "HP-OUT pin", 0x7 }, | |
6622 | }, | |
7cf51e48 JW |
6623 | }, |
6624 | }; | |
6625 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
6626 | /* Output driver widgets */ | |
6627 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
6628 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
6629 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
6630 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
6631 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
6632 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
6633 | ||
a1e8d2da JW |
6634 | /* Modes for retasking pin widgets |
6635 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
6636 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
6637 | * mention this restriction. At this stage it's not clear whether | |
6638 | * this behaviour is intentional or is a hardware bug in chip | |
6639 | * revisions available at least up until early 2006. Therefore for | |
6640 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
6641 | * choices, but if it turns out that the lack of mic bias for these | |
6642 | * NIDs is intentional we could change their modes from | |
6643 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
6644 | */ | |
7cf51e48 JW |
6645 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
6646 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
6647 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
6648 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
6649 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
6650 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
6651 | ||
6652 | /* Loopback mixer controls */ | |
6653 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
6654 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
6655 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
6656 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
6657 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
6658 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
6659 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
6660 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
6661 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
6662 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
7cf51e48 JW |
6663 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
6664 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
6665 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
6666 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
5c8f858d JW |
6667 | |
6668 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
6669 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
6670 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
6671 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
6672 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
6673 | ||
92621f13 JW |
6674 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
6675 | * is ambigious as to which NID is which; testing on laptops which | |
ea1fb29a | 6676 | * make this output available should provide clarification. |
92621f13 JW |
6677 | */ |
6678 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
6679 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
6680 | ||
f8225f6d JW |
6681 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
6682 | * this output to turn on an external amplifier. | |
6683 | */ | |
6684 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
6685 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
6686 | ||
7cf51e48 JW |
6687 | { } /* end */ |
6688 | }; | |
6689 | static struct hda_verb alc260_test_init_verbs[] = { | |
5c8f858d JW |
6690 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
6691 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
6692 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
6693 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
6694 | ||
7cf51e48 JW |
6695 | /* Enable retasking pins as output, initially without power amp */ |
6696 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6697 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6698 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6699 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6700 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6701 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6702 | ||
92621f13 JW |
6703 | /* Disable digital (SPDIF) pins initially, but users can enable |
6704 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
6705 | * payload also sets the generation to 0, output to be in "consumer" | |
6706 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
6707 | * control. | |
6708 | */ | |
7cf51e48 JW |
6709 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
6710 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
6711 | ||
ea1fb29a | 6712 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
7cf51e48 JW |
6713 | * OUT1 sum bus when acting as an output. |
6714 | */ | |
6715 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
6716 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
6717 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
6718 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
6719 | ||
6720 | /* Start with output sum widgets muted and their output gains at min */ | |
6721 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6722 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6723 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6724 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6725 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6726 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6727 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6728 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6729 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6730 | ||
cdcd9268 JW |
6731 | /* Unmute retasking pin widget output buffers since the default |
6732 | * state appears to be output. As the pin mode is changed by the | |
6733 | * user the pin mode control will take care of enabling the pin's | |
6734 | * input/output buffers as needed. | |
6735 | */ | |
7cf51e48 JW |
6736 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
6737 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6739 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6740 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6741 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6742 | /* Also unmute the mono-out pin widget */ | |
6743 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6744 | ||
7cf51e48 JW |
6745 | /* Mute capture amp left and right */ |
6746 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
f7ace40d JW |
6747 | /* Set ADC connection select to match default mixer setting (mic1 |
6748 | * pin) | |
7cf51e48 JW |
6749 | */ |
6750 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6751 | ||
6752 | /* Do the same for the second ADC: mute capture input amp and | |
f7ace40d | 6753 | * set ADC connection to mic1 pin |
7cf51e48 JW |
6754 | */ |
6755 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6756 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6757 | ||
6758 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
6759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
6760 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
6761 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
6762 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
6763 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
6764 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
6765 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
6766 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
6767 | ||
6768 | { } | |
6769 | }; | |
6770 | #endif | |
6771 | ||
6330079f TI |
6772 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
6773 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
1da177e4 | 6774 | |
a3bcba38 TI |
6775 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
6776 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
6777 | ||
df694daa KY |
6778 | /* |
6779 | * for BIOS auto-configuration | |
6780 | */ | |
16ded525 | 6781 | |
df694daa | 6782 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
863b4518 | 6783 | const char *pfx, int *vol_bits) |
df694daa KY |
6784 | { |
6785 | hda_nid_t nid_vol; | |
6786 | unsigned long vol_val, sw_val; | |
df694daa KY |
6787 | int err; |
6788 | ||
6789 | if (nid >= 0x0f && nid < 0x11) { | |
6790 | nid_vol = nid - 0x7; | |
6791 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6792 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6793 | } else if (nid == 0x11) { | |
6794 | nid_vol = nid - 0x7; | |
6795 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
6796 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
6797 | } else if (nid >= 0x12 && nid <= 0x15) { | |
6798 | nid_vol = 0x08; | |
6799 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
6800 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
6801 | } else | |
6802 | return 0; /* N/A */ | |
ea1fb29a | 6803 | |
863b4518 TI |
6804 | if (!(*vol_bits & (1 << nid_vol))) { |
6805 | /* first control for the volume widget */ | |
0afe5f89 | 6806 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); |
863b4518 TI |
6807 | if (err < 0) |
6808 | return err; | |
6809 | *vol_bits |= (1 << nid_vol); | |
6810 | } | |
0afe5f89 | 6811 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); |
f12ab1e0 | 6812 | if (err < 0) |
df694daa KY |
6813 | return err; |
6814 | return 1; | |
6815 | } | |
6816 | ||
6817 | /* add playback controls from the parsed DAC table */ | |
6818 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
6819 | const struct auto_pin_cfg *cfg) | |
6820 | { | |
6821 | hda_nid_t nid; | |
6822 | int err; | |
863b4518 | 6823 | int vols = 0; |
df694daa KY |
6824 | |
6825 | spec->multiout.num_dacs = 1; | |
6826 | spec->multiout.dac_nids = spec->private_dac_nids; | |
6827 | spec->multiout.dac_nids[0] = 0x02; | |
6828 | ||
6829 | nid = cfg->line_out_pins[0]; | |
6830 | if (nid) { | |
23112d6d TI |
6831 | const char *pfx; |
6832 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | |
6833 | pfx = "Master"; | |
6834 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
6835 | pfx = "Speaker"; | |
6836 | else | |
6837 | pfx = "Front"; | |
6838 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | |
df694daa KY |
6839 | if (err < 0) |
6840 | return err; | |
6841 | } | |
6842 | ||
82bc955f | 6843 | nid = cfg->speaker_pins[0]; |
df694daa | 6844 | if (nid) { |
863b4518 | 6845 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
df694daa KY |
6846 | if (err < 0) |
6847 | return err; | |
6848 | } | |
6849 | ||
eb06ed8f | 6850 | nid = cfg->hp_pins[0]; |
df694daa | 6851 | if (nid) { |
863b4518 TI |
6852 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
6853 | &vols); | |
df694daa KY |
6854 | if (err < 0) |
6855 | return err; | |
6856 | } | |
f12ab1e0 | 6857 | return 0; |
df694daa KY |
6858 | } |
6859 | ||
6860 | /* create playback/capture controls for input pins */ | |
05f5f477 | 6861 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
df694daa KY |
6862 | const struct auto_pin_cfg *cfg) |
6863 | { | |
05f5f477 | 6864 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
df694daa KY |
6865 | } |
6866 | ||
6867 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
6868 | hda_nid_t nid, int pin_type, | |
6869 | int sel_idx) | |
6870 | { | |
f6c7e546 | 6871 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
6872 | /* need the manual connection? */ |
6873 | if (nid >= 0x12) { | |
6874 | int idx = nid - 0x12; | |
6875 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
6876 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
df694daa KY |
6877 | } |
6878 | } | |
6879 | ||
6880 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
6881 | { | |
6882 | struct alc_spec *spec = codec->spec; | |
6883 | hda_nid_t nid; | |
6884 | ||
f12ab1e0 | 6885 | nid = spec->autocfg.line_out_pins[0]; |
baba8ee9 TI |
6886 | if (nid) { |
6887 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
6888 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
6889 | } | |
ea1fb29a | 6890 | |
82bc955f | 6891 | nid = spec->autocfg.speaker_pins[0]; |
df694daa KY |
6892 | if (nid) |
6893 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
6894 | ||
eb06ed8f | 6895 | nid = spec->autocfg.hp_pins[0]; |
df694daa | 6896 | if (nid) |
baba8ee9 | 6897 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
f12ab1e0 | 6898 | } |
df694daa KY |
6899 | |
6900 | #define ALC260_PIN_CD_NID 0x16 | |
6901 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
6902 | { | |
6903 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 6904 | struct auto_pin_cfg *cfg = &spec->autocfg; |
df694daa KY |
6905 | int i; |
6906 | ||
66ceeb6b TI |
6907 | for (i = 0; i < cfg->num_inputs; i++) { |
6908 | hda_nid_t nid = cfg->inputs[i].pin; | |
df694daa | 6909 | if (nid >= 0x12) { |
30ea098f | 6910 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
e82c025b TI |
6911 | if (nid != ALC260_PIN_CD_NID && |
6912 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f12ab1e0 TI |
6913 | snd_hda_codec_write(codec, nid, 0, |
6914 | AC_VERB_SET_AMP_GAIN_MUTE, | |
df694daa KY |
6915 | AMP_OUT_MUTE); |
6916 | } | |
6917 | } | |
6918 | } | |
6919 | ||
7f311a46 TI |
6920 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
6921 | ||
df694daa KY |
6922 | /* |
6923 | * generic initialization of ADC, input mixers and output mixers | |
6924 | */ | |
6925 | static struct hda_verb alc260_volume_init_verbs[] = { | |
6926 | /* | |
6927 | * Unmute ADC0-1 and set the default input to mic-in | |
6928 | */ | |
6929 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6930 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6931 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6932 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 6933 | |
df694daa KY |
6934 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
6935 | * mixer widget | |
f12ab1e0 TI |
6936 | * Note: PASD motherboards uses the Line In 2 as the input for |
6937 | * front panel mic (mic 2) | |
df694daa KY |
6938 | */ |
6939 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
6940 | /* mute analog inputs */ |
6941 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6942 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6943 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6944 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6945 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
6946 | |
6947 | /* | |
6948 | * Set up output mixers (0x08 - 0x0a) | |
6949 | */ | |
6950 | /* set vol=0 to output mixers */ | |
6951 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6952 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6953 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6954 | /* set up input amps for analog loopback */ | |
6955 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6956 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6957 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6958 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6959 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6960 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6961 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 6962 | |
df694daa KY |
6963 | { } |
6964 | }; | |
6965 | ||
6966 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
6967 | { | |
6968 | struct alc_spec *spec = codec->spec; | |
df694daa KY |
6969 | int err; |
6970 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
6971 | ||
f12ab1e0 TI |
6972 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
6973 | alc260_ignore); | |
6974 | if (err < 0) | |
df694daa | 6975 | return err; |
f12ab1e0 TI |
6976 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
6977 | if (err < 0) | |
4a471b7d | 6978 | return err; |
603c4019 | 6979 | if (!spec->kctls.list) |
df694daa | 6980 | return 0; /* can't find valid BIOS pin config */ |
05f5f477 | 6981 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 6982 | if (err < 0) |
df694daa KY |
6983 | return err; |
6984 | ||
6985 | spec->multiout.max_channels = 2; | |
6986 | ||
0852d7a6 | 6987 | if (spec->autocfg.dig_outs) |
df694daa | 6988 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
603c4019 | 6989 | if (spec->kctls.list) |
d88897ea | 6990 | add_mixer(spec, spec->kctls.list); |
df694daa | 6991 | |
d88897ea | 6992 | add_verb(spec, alc260_volume_init_verbs); |
df694daa | 6993 | |
a1e8d2da | 6994 | spec->num_mux_defs = 1; |
61b9b9b1 | 6995 | spec->input_mux = &spec->private_imux[0]; |
df694daa | 6996 | |
6227cdce | 6997 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
4a79ba34 | 6998 | |
df694daa KY |
6999 | return 1; |
7000 | } | |
7001 | ||
ae6b813a TI |
7002 | /* additional initialization for auto-configuration model */ |
7003 | static void alc260_auto_init(struct hda_codec *codec) | |
df694daa | 7004 | { |
f6c7e546 | 7005 | struct alc_spec *spec = codec->spec; |
df694daa KY |
7006 | alc260_auto_init_multi_out(codec); |
7007 | alc260_auto_init_analog_input(codec); | |
7f311a46 | 7008 | alc260_auto_init_input_src(codec); |
757899ac | 7009 | alc_auto_init_digital(codec); |
f6c7e546 | 7010 | if (spec->unsol_event) |
7fb0d78f | 7011 | alc_inithook(codec); |
df694daa KY |
7012 | } |
7013 | ||
cb53c626 TI |
7014 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
7015 | static struct hda_amp_list alc260_loopbacks[] = { | |
7016 | { 0x07, HDA_INPUT, 0 }, | |
7017 | { 0x07, HDA_INPUT, 1 }, | |
7018 | { 0x07, HDA_INPUT, 2 }, | |
7019 | { 0x07, HDA_INPUT, 3 }, | |
7020 | { 0x07, HDA_INPUT, 4 }, | |
7021 | { } /* end */ | |
7022 | }; | |
7023 | #endif | |
7024 | ||
fc091769 TI |
7025 | /* |
7026 | * Pin config fixes | |
7027 | */ | |
7028 | enum { | |
7029 | PINFIX_HP_DC5750, | |
7030 | }; | |
7031 | ||
fc091769 TI |
7032 | static const struct alc_fixup alc260_fixups[] = { |
7033 | [PINFIX_HP_DC5750] = { | |
73413b12 TI |
7034 | .pins = (const struct alc_pincfg[]) { |
7035 | { 0x11, 0x90130110 }, /* speaker */ | |
7036 | { } | |
7037 | } | |
fc091769 TI |
7038 | }, |
7039 | }; | |
7040 | ||
7041 | static struct snd_pci_quirk alc260_fixup_tbl[] = { | |
7042 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), | |
7043 | {} | |
7044 | }; | |
7045 | ||
df694daa KY |
7046 | /* |
7047 | * ALC260 configurations | |
7048 | */ | |
f5fcc13c TI |
7049 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
7050 | [ALC260_BASIC] = "basic", | |
7051 | [ALC260_HP] = "hp", | |
7052 | [ALC260_HP_3013] = "hp-3013", | |
2922c9af | 7053 | [ALC260_HP_DC7600] = "hp-dc7600", |
f5fcc13c TI |
7054 | [ALC260_FUJITSU_S702X] = "fujitsu", |
7055 | [ALC260_ACER] = "acer", | |
bc9f98a9 KY |
7056 | [ALC260_WILL] = "will", |
7057 | [ALC260_REPLACER_672V] = "replacer", | |
cc959489 | 7058 | [ALC260_FAVORIT100] = "favorit100", |
7cf51e48 | 7059 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 7060 | [ALC260_TEST] = "test", |
7cf51e48 | 7061 | #endif |
f5fcc13c TI |
7062 | [ALC260_AUTO] = "auto", |
7063 | }; | |
7064 | ||
7065 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
bd869485 | 7066 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
950200e2 | 7067 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
f5fcc13c | 7068 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
cc959489 | 7069 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
9720b718 | 7070 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
4ac55982 | 7071 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
f5fcc13c | 7072 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
34ec8a0a | 7073 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
3f878308 | 7074 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
f5fcc13c TI |
7075 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
7076 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
7077 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
7078 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
7079 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
7080 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
7081 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
7082 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
7083 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
bc9f98a9 | 7084 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
ac3e3741 | 7085 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
df694daa KY |
7086 | {} |
7087 | }; | |
7088 | ||
7089 | static struct alc_config_preset alc260_presets[] = { | |
7090 | [ALC260_BASIC] = { | |
7091 | .mixers = { alc260_base_output_mixer, | |
45bdd1c1 | 7092 | alc260_input_mixer }, |
df694daa KY |
7093 | .init_verbs = { alc260_init_verbs }, |
7094 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7095 | .dac_nids = alc260_dac_nids, | |
f9e336f6 | 7096 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
9c4cc0bd | 7097 | .adc_nids = alc260_dual_adc_nids, |
df694daa KY |
7098 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7099 | .channel_mode = alc260_modes, | |
7100 | .input_mux = &alc260_capture_source, | |
7101 | }, | |
7102 | [ALC260_HP] = { | |
bec15c3a | 7103 | .mixers = { alc260_hp_output_mixer, |
f9e336f6 | 7104 | alc260_input_mixer }, |
bec15c3a TI |
7105 | .init_verbs = { alc260_init_verbs, |
7106 | alc260_hp_unsol_verbs }, | |
df694daa KY |
7107 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
7108 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
7109 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
7110 | .adc_nids = alc260_adc_nids_alt, | |
df694daa KY |
7111 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7112 | .channel_mode = alc260_modes, | |
7113 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
7114 | .unsol_event = alc260_hp_unsol_event, |
7115 | .init_hook = alc260_hp_automute, | |
df694daa | 7116 | }, |
3f878308 KY |
7117 | [ALC260_HP_DC7600] = { |
7118 | .mixers = { alc260_hp_dc7600_mixer, | |
f9e336f6 | 7119 | alc260_input_mixer }, |
3f878308 KY |
7120 | .init_verbs = { alc260_init_verbs, |
7121 | alc260_hp_dc7600_verbs }, | |
7122 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7123 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
7124 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
7125 | .adc_nids = alc260_adc_nids_alt, | |
3f878308 KY |
7126 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7127 | .channel_mode = alc260_modes, | |
7128 | .input_mux = &alc260_capture_source, | |
7129 | .unsol_event = alc260_hp_3012_unsol_event, | |
7130 | .init_hook = alc260_hp_3012_automute, | |
7131 | }, | |
df694daa KY |
7132 | [ALC260_HP_3013] = { |
7133 | .mixers = { alc260_hp_3013_mixer, | |
f9e336f6 | 7134 | alc260_input_mixer }, |
bec15c3a TI |
7135 | .init_verbs = { alc260_hp_3013_init_verbs, |
7136 | alc260_hp_3013_unsol_verbs }, | |
df694daa KY |
7137 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
7138 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
7139 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
7140 | .adc_nids = alc260_adc_nids_alt, | |
df694daa KY |
7141 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7142 | .channel_mode = alc260_modes, | |
7143 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
7144 | .unsol_event = alc260_hp_3013_unsol_event, |
7145 | .init_hook = alc260_hp_3013_automute, | |
df694daa KY |
7146 | }, |
7147 | [ALC260_FUJITSU_S702X] = { | |
f9e336f6 | 7148 | .mixers = { alc260_fujitsu_mixer }, |
df694daa KY |
7149 | .init_verbs = { alc260_fujitsu_init_verbs }, |
7150 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7151 | .dac_nids = alc260_dac_nids, | |
d57fdac0 JW |
7152 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
7153 | .adc_nids = alc260_dual_adc_nids, | |
df694daa KY |
7154 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
7155 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
7156 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
7157 | .input_mux = alc260_fujitsu_capture_sources, | |
df694daa | 7158 | }, |
0bfc90e9 | 7159 | [ALC260_ACER] = { |
f9e336f6 | 7160 | .mixers = { alc260_acer_mixer }, |
0bfc90e9 JW |
7161 | .init_verbs = { alc260_acer_init_verbs }, |
7162 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7163 | .dac_nids = alc260_dac_nids, | |
7164 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
7165 | .adc_nids = alc260_dual_adc_nids, | |
7166 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7167 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
7168 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
7169 | .input_mux = alc260_acer_capture_sources, | |
0bfc90e9 | 7170 | }, |
cc959489 MS |
7171 | [ALC260_FAVORIT100] = { |
7172 | .mixers = { alc260_favorit100_mixer }, | |
7173 | .init_verbs = { alc260_favorit100_init_verbs }, | |
7174 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7175 | .dac_nids = alc260_dac_nids, | |
7176 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
7177 | .adc_nids = alc260_dual_adc_nids, | |
7178 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7179 | .channel_mode = alc260_modes, | |
7180 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), | |
7181 | .input_mux = alc260_favorit100_capture_sources, | |
7182 | }, | |
bc9f98a9 | 7183 | [ALC260_WILL] = { |
f9e336f6 | 7184 | .mixers = { alc260_will_mixer }, |
bc9f98a9 KY |
7185 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
7186 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7187 | .dac_nids = alc260_dac_nids, | |
7188 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
7189 | .adc_nids = alc260_adc_nids, | |
7190 | .dig_out_nid = ALC260_DIGOUT_NID, | |
7191 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7192 | .channel_mode = alc260_modes, | |
7193 | .input_mux = &alc260_capture_source, | |
7194 | }, | |
7195 | [ALC260_REPLACER_672V] = { | |
f9e336f6 | 7196 | .mixers = { alc260_replacer_672v_mixer }, |
bc9f98a9 KY |
7197 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
7198 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
7199 | .dac_nids = alc260_dac_nids, | |
7200 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
7201 | .adc_nids = alc260_adc_nids, | |
7202 | .dig_out_nid = ALC260_DIGOUT_NID, | |
7203 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7204 | .channel_mode = alc260_modes, | |
7205 | .input_mux = &alc260_capture_source, | |
7206 | .unsol_event = alc260_replacer_672v_unsol_event, | |
7207 | .init_hook = alc260_replacer_672v_automute, | |
7208 | }, | |
7cf51e48 JW |
7209 | #ifdef CONFIG_SND_DEBUG |
7210 | [ALC260_TEST] = { | |
f9e336f6 | 7211 | .mixers = { alc260_test_mixer }, |
7cf51e48 JW |
7212 | .init_verbs = { alc260_test_init_verbs }, |
7213 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
7214 | .dac_nids = alc260_test_dac_nids, | |
7215 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
7216 | .adc_nids = alc260_test_adc_nids, | |
7217 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
7218 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
7219 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
7220 | .input_mux = alc260_test_capture_sources, | |
7cf51e48 JW |
7221 | }, |
7222 | #endif | |
df694daa KY |
7223 | }; |
7224 | ||
7225 | static int patch_alc260(struct hda_codec *codec) | |
1da177e4 LT |
7226 | { |
7227 | struct alc_spec *spec; | |
df694daa | 7228 | int err, board_config; |
1da177e4 | 7229 | |
e560d8d8 | 7230 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
7231 | if (spec == NULL) |
7232 | return -ENOMEM; | |
7233 | ||
7234 | codec->spec = spec; | |
7235 | ||
f5fcc13c TI |
7236 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
7237 | alc260_models, | |
7238 | alc260_cfg_tbl); | |
7239 | if (board_config < 0) { | |
9a11f1aa | 7240 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
6c627f39 | 7241 | codec->chip_name); |
df694daa | 7242 | board_config = ALC260_AUTO; |
16ded525 | 7243 | } |
1da177e4 | 7244 | |
fc091769 TI |
7245 | if (board_config == ALC260_AUTO) |
7246 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); | |
7247 | ||
df694daa KY |
7248 | if (board_config == ALC260_AUTO) { |
7249 | /* automatic parse from the BIOS config */ | |
7250 | err = alc260_parse_auto_config(codec); | |
7251 | if (err < 0) { | |
7252 | alc_free(codec); | |
7253 | return err; | |
f12ab1e0 | 7254 | } else if (!err) { |
9c7f852e TI |
7255 | printk(KERN_INFO |
7256 | "hda_codec: Cannot set up configuration " | |
7257 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
7258 | board_config = ALC260_BASIC; |
7259 | } | |
a9430dd8 | 7260 | } |
e9edcee0 | 7261 | |
680cd536 KK |
7262 | err = snd_hda_attach_beep_device(codec, 0x1); |
7263 | if (err < 0) { | |
7264 | alc_free(codec); | |
7265 | return err; | |
7266 | } | |
7267 | ||
df694daa | 7268 | if (board_config != ALC260_AUTO) |
e9c364c0 | 7269 | setup_preset(codec, &alc260_presets[board_config]); |
1da177e4 | 7270 | |
1da177e4 LT |
7271 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
7272 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
53bacfbb | 7273 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
1da177e4 | 7274 | |
a3bcba38 TI |
7275 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
7276 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
7277 | ||
4ef0ef19 TI |
7278 | if (!spec->adc_nids && spec->input_mux) { |
7279 | /* check whether NID 0x04 is valid */ | |
7280 | unsigned int wcap = get_wcaps(codec, 0x04); | |
a22d543a | 7281 | wcap = get_wcaps_type(wcap); |
4ef0ef19 TI |
7282 | /* get type */ |
7283 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
7284 | spec->adc_nids = alc260_adc_nids_alt; | |
7285 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
7286 | } else { | |
7287 | spec->adc_nids = alc260_adc_nids; | |
7288 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
7289 | } | |
7290 | } | |
b59bdf3b | 7291 | set_capture_mixer(codec); |
45bdd1c1 | 7292 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
f9e336f6 | 7293 | |
fc091769 TI |
7294 | if (board_config == ALC260_AUTO) |
7295 | alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0); | |
7296 | ||
2134ea4f TI |
7297 | spec->vmaster_nid = 0x08; |
7298 | ||
1da177e4 | 7299 | codec->patch_ops = alc_patch_ops; |
df694daa | 7300 | if (board_config == ALC260_AUTO) |
ae6b813a | 7301 | spec->init_hook = alc260_auto_init; |
cb53c626 TI |
7302 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
7303 | if (!spec->loopback.amplist) | |
7304 | spec->loopback.amplist = alc260_loopbacks; | |
7305 | #endif | |
1da177e4 LT |
7306 | |
7307 | return 0; | |
7308 | } | |
7309 | ||
e9edcee0 | 7310 | |
1da177e4 | 7311 | /* |
4953550a | 7312 | * ALC882/883/885/888/889 support |
1da177e4 LT |
7313 | * |
7314 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
7315 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
7316 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
7317 | * 6-channel independent captures. | |
7318 | * | |
7319 | * In addition, an independent DAC for the multi-playback (not used in this | |
7320 | * driver yet). | |
7321 | */ | |
df694daa KY |
7322 | #define ALC882_DIGOUT_NID 0x06 |
7323 | #define ALC882_DIGIN_NID 0x0a | |
4953550a TI |
7324 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
7325 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | |
7326 | #define ALC1200_DIGOUT_NID 0x10 | |
7327 | ||
1da177e4 | 7328 | |
d2a6d7dc | 7329 | static struct hda_channel_mode alc882_ch_modes[1] = { |
1da177e4 LT |
7330 | { 8, NULL } |
7331 | }; | |
7332 | ||
4953550a | 7333 | /* DACs */ |
1da177e4 LT |
7334 | static hda_nid_t alc882_dac_nids[4] = { |
7335 | /* front, rear, clfe, rear_surr */ | |
7336 | 0x02, 0x03, 0x04, 0x05 | |
7337 | }; | |
4953550a | 7338 | #define alc883_dac_nids alc882_dac_nids |
1da177e4 | 7339 | |
4953550a | 7340 | /* ADCs */ |
df694daa KY |
7341 | #define alc882_adc_nids alc880_adc_nids |
7342 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
4953550a TI |
7343 | #define alc883_adc_nids alc882_adc_nids_alt |
7344 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | |
7345 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | |
7346 | #define alc889_adc_nids alc880_adc_nids | |
1da177e4 | 7347 | |
e1406348 TI |
7348 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
7349 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
4953550a TI |
7350 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
7351 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | |
7352 | #define alc889_capsrc_nids alc882_capsrc_nids | |
e1406348 | 7353 | |
1da177e4 LT |
7354 | /* input MUX */ |
7355 | /* FIXME: should be a matrix-type input source selection */ | |
7356 | ||
7357 | static struct hda_input_mux alc882_capture_source = { | |
7358 | .num_items = 4, | |
7359 | .items = { | |
7360 | { "Mic", 0x0 }, | |
7361 | { "Front Mic", 0x1 }, | |
7362 | { "Line", 0x2 }, | |
7363 | { "CD", 0x4 }, | |
7364 | }, | |
7365 | }; | |
41d5545d | 7366 | |
4953550a TI |
7367 | #define alc883_capture_source alc882_capture_source |
7368 | ||
87a8c370 JK |
7369 | static struct hda_input_mux alc889_capture_source = { |
7370 | .num_items = 3, | |
7371 | .items = { | |
7372 | { "Front Mic", 0x0 }, | |
7373 | { "Mic", 0x3 }, | |
7374 | { "Line", 0x2 }, | |
7375 | }, | |
7376 | }; | |
7377 | ||
41d5545d KS |
7378 | static struct hda_input_mux mb5_capture_source = { |
7379 | .num_items = 3, | |
7380 | .items = { | |
7381 | { "Mic", 0x1 }, | |
b8f171e7 | 7382 | { "Line", 0x7 }, |
41d5545d KS |
7383 | { "CD", 0x4 }, |
7384 | }, | |
7385 | }; | |
7386 | ||
e458b1fa LY |
7387 | static struct hda_input_mux macmini3_capture_source = { |
7388 | .num_items = 2, | |
7389 | .items = { | |
7390 | { "Line", 0x2 }, | |
7391 | { "CD", 0x4 }, | |
7392 | }, | |
7393 | }; | |
7394 | ||
4953550a TI |
7395 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
7396 | .num_items = 4, | |
7397 | .items = { | |
7398 | { "Mic", 0x1 }, | |
7399 | { "Front Mic", 0x0 }, | |
7400 | { "Line", 0x2 }, | |
7401 | { "CD", 0x4 }, | |
7402 | }, | |
7403 | }; | |
7404 | ||
7405 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | |
7406 | .num_items = 2, | |
7407 | .items = { | |
7408 | { "Mic", 0x1 }, | |
7409 | { "Line", 0x2 }, | |
7410 | }, | |
7411 | }; | |
7412 | ||
7413 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | |
7414 | .num_items = 4, | |
7415 | .items = { | |
7416 | { "Mic", 0x0 }, | |
150b432f | 7417 | { "Int Mic", 0x1 }, |
4953550a TI |
7418 | { "Line", 0x2 }, |
7419 | { "CD", 0x4 }, | |
7420 | }, | |
7421 | }; | |
7422 | ||
7423 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | |
7424 | .num_items = 2, | |
7425 | .items = { | |
7426 | { "Mic", 0x0 }, | |
7427 | { "Int Mic", 0x1 }, | |
7428 | }, | |
7429 | }; | |
7430 | ||
7431 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | |
7432 | .num_items = 3, | |
7433 | .items = { | |
7434 | { "Mic", 0x0 }, | |
7435 | { "Front Mic", 0x1 }, | |
7436 | { "Line", 0x4 }, | |
7437 | }, | |
7438 | }; | |
7439 | ||
7440 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | |
7441 | .num_items = 2, | |
7442 | .items = { | |
7443 | { "Mic", 0x0 }, | |
7444 | { "Line", 0x2 }, | |
7445 | }, | |
7446 | }; | |
7447 | ||
7448 | static struct hda_input_mux alc889A_mb31_capture_source = { | |
7449 | .num_items = 2, | |
7450 | .items = { | |
7451 | { "Mic", 0x0 }, | |
7452 | /* Front Mic (0x01) unused */ | |
7453 | { "Line", 0x2 }, | |
7454 | /* Line 2 (0x03) unused */ | |
af901ca1 | 7455 | /* CD (0x04) unused? */ |
4953550a TI |
7456 | }, |
7457 | }; | |
7458 | ||
b7cccc52 JM |
7459 | static struct hda_input_mux alc889A_imac91_capture_source = { |
7460 | .num_items = 2, | |
7461 | .items = { | |
7462 | { "Mic", 0x01 }, | |
7463 | { "Line", 0x2 }, /* Not sure! */ | |
7464 | }, | |
7465 | }; | |
7466 | ||
4953550a TI |
7467 | /* |
7468 | * 2ch mode | |
7469 | */ | |
7470 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
7471 | { 2, NULL } | |
7472 | }; | |
7473 | ||
272a527c KY |
7474 | /* |
7475 | * 2ch mode | |
7476 | */ | |
7477 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
7478 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7479 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7480 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7481 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7482 | { } /* end */ | |
7483 | }; | |
7484 | ||
4953550a TI |
7485 | /* |
7486 | * 4ch mode | |
7487 | */ | |
7488 | static struct hda_verb alc882_3ST_ch4_init[] = { | |
7489 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7490 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7491 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7492 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7493 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7494 | { } /* end */ | |
7495 | }; | |
7496 | ||
272a527c KY |
7497 | /* |
7498 | * 6ch mode | |
7499 | */ | |
7500 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
7501 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7502 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7503 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7504 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7505 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7506 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7507 | { } /* end */ | |
7508 | }; | |
7509 | ||
4953550a | 7510 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
272a527c | 7511 | { 2, alc882_3ST_ch2_init }, |
4953550a | 7512 | { 4, alc882_3ST_ch4_init }, |
272a527c KY |
7513 | { 6, alc882_3ST_ch6_init }, |
7514 | }; | |
7515 | ||
4953550a TI |
7516 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
7517 | ||
a65cc60f | 7518 | /* |
7519 | * 2ch mode | |
7520 | */ | |
7521 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | |
7522 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
7523 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7524 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7525 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7526 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7527 | { } /* end */ | |
7528 | }; | |
7529 | ||
7530 | /* | |
7531 | * 4ch mode | |
7532 | */ | |
7533 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | |
7534 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7535 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7536 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7537 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7538 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7539 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7540 | { } /* end */ | |
7541 | }; | |
7542 | ||
7543 | /* | |
7544 | * 6ch mode | |
7545 | */ | |
7546 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | |
7547 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7548 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7549 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7550 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7551 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7552 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7553 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7554 | { } /* end */ | |
7555 | }; | |
7556 | ||
7557 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | |
7558 | { 2, alc883_3ST_ch2_clevo_init }, | |
7559 | { 4, alc883_3ST_ch4_clevo_init }, | |
7560 | { 6, alc883_3ST_ch6_clevo_init }, | |
7561 | }; | |
7562 | ||
7563 | ||
df694daa KY |
7564 | /* |
7565 | * 6ch mode | |
7566 | */ | |
7567 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
7568 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7569 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7570 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7571 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7572 | { } /* end */ | |
7573 | }; | |
7574 | ||
7575 | /* | |
7576 | * 8ch mode | |
7577 | */ | |
7578 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
7579 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7580 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7581 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7582 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7583 | { } /* end */ | |
7584 | }; | |
7585 | ||
7586 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
7587 | { 6, alc882_sixstack_ch6_init }, | |
7588 | { 8, alc882_sixstack_ch8_init }, | |
7589 | }; | |
7590 | ||
76e6f5a9 RH |
7591 | |
7592 | /* Macbook Air 2,1 */ | |
7593 | ||
7594 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { | |
7595 | { 2, NULL }, | |
7596 | }; | |
7597 | ||
87350ad0 | 7598 | /* |
def319f9 | 7599 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
87350ad0 TI |
7600 | */ |
7601 | ||
7602 | /* | |
7603 | * 2ch mode | |
7604 | */ | |
7605 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
7606 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7607 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7608 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7609 | { } /* end */ | |
7610 | }; | |
7611 | ||
7612 | /* | |
a3f730af | 7613 | * 4ch mode |
87350ad0 | 7614 | */ |
a3f730af | 7615 | static struct hda_verb alc885_mbp_ch4_init[] = { |
87350ad0 TI |
7616 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7617 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7618 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7619 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7620 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7621 | { } /* end */ | |
7622 | }; | |
7623 | ||
a3f730af | 7624 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
87350ad0 | 7625 | { 2, alc885_mbp_ch2_init }, |
a3f730af | 7626 | { 4, alc885_mbp_ch4_init }, |
87350ad0 TI |
7627 | }; |
7628 | ||
92b9de83 KS |
7629 | /* |
7630 | * 2ch | |
7631 | * Speakers/Woofer/HP = Front | |
7632 | * LineIn = Input | |
7633 | */ | |
7634 | static struct hda_verb alc885_mb5_ch2_init[] = { | |
7635 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7637 | { } /* end */ | |
7638 | }; | |
7639 | ||
7640 | /* | |
7641 | * 6ch mode | |
7642 | * Speakers/HP = Front | |
7643 | * Woofer = LFE | |
7644 | * LineIn = Surround | |
7645 | */ | |
7646 | static struct hda_verb alc885_mb5_ch6_init[] = { | |
7647 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7649 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7650 | { } /* end */ | |
7651 | }; | |
7652 | ||
7653 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | |
7654 | { 2, alc885_mb5_ch2_init }, | |
7655 | { 6, alc885_mb5_ch6_init }, | |
7656 | }; | |
87350ad0 | 7657 | |
d01aecdf | 7658 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
4953550a TI |
7659 | |
7660 | /* | |
7661 | * 2ch mode | |
7662 | */ | |
7663 | static struct hda_verb alc883_4ST_ch2_init[] = { | |
7664 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7665 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7666 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7667 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7668 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7669 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7670 | { } /* end */ | |
7671 | }; | |
7672 | ||
7673 | /* | |
7674 | * 4ch mode | |
7675 | */ | |
7676 | static struct hda_verb alc883_4ST_ch4_init[] = { | |
7677 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7678 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7679 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7680 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7681 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7682 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7683 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7684 | { } /* end */ | |
7685 | }; | |
7686 | ||
7687 | /* | |
7688 | * 6ch mode | |
7689 | */ | |
7690 | static struct hda_verb alc883_4ST_ch6_init[] = { | |
7691 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7692 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7693 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7694 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7695 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7696 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7697 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7698 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7699 | { } /* end */ | |
7700 | }; | |
7701 | ||
7702 | /* | |
7703 | * 8ch mode | |
7704 | */ | |
7705 | static struct hda_verb alc883_4ST_ch8_init[] = { | |
7706 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7707 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7708 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7709 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7710 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7711 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7712 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7713 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7714 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7715 | { } /* end */ | |
7716 | }; | |
7717 | ||
7718 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | |
7719 | { 2, alc883_4ST_ch2_init }, | |
7720 | { 4, alc883_4ST_ch4_init }, | |
7721 | { 6, alc883_4ST_ch6_init }, | |
7722 | { 8, alc883_4ST_ch8_init }, | |
7723 | }; | |
7724 | ||
7725 | ||
7726 | /* | |
7727 | * 2ch mode | |
7728 | */ | |
7729 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
7730 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7731 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7732 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7733 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7734 | { } /* end */ | |
7735 | }; | |
7736 | ||
7737 | /* | |
7738 | * 4ch mode | |
7739 | */ | |
7740 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
7741 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7742 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7743 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7744 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7745 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7746 | { } /* end */ | |
7747 | }; | |
7748 | ||
7749 | /* | |
7750 | * 6ch mode | |
7751 | */ | |
7752 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
7753 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7754 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7755 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7756 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7757 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7758 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7759 | { } /* end */ | |
7760 | }; | |
7761 | ||
7762 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
7763 | { 2, alc883_3ST_ch2_intel_init }, | |
7764 | { 4, alc883_3ST_ch4_intel_init }, | |
7765 | { 6, alc883_3ST_ch6_intel_init }, | |
7766 | }; | |
7767 | ||
dd7714c9 WF |
7768 | /* |
7769 | * 2ch mode | |
7770 | */ | |
7771 | static struct hda_verb alc889_ch2_intel_init[] = { | |
7772 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7773 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7774 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7775 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
7776 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7777 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7778 | { } /* end */ | |
7779 | }; | |
7780 | ||
87a8c370 JK |
7781 | /* |
7782 | * 6ch mode | |
7783 | */ | |
7784 | static struct hda_verb alc889_ch6_intel_init[] = { | |
dd7714c9 WF |
7785 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7786 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7787 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7788 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7789 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
87a8c370 JK |
7790 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
7791 | { } /* end */ | |
7792 | }; | |
7793 | ||
7794 | /* | |
7795 | * 8ch mode | |
7796 | */ | |
7797 | static struct hda_verb alc889_ch8_intel_init[] = { | |
dd7714c9 WF |
7798 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7799 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7800 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7801 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
7802 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | |
87a8c370 JK |
7803 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7804 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
87a8c370 JK |
7805 | { } /* end */ |
7806 | }; | |
7807 | ||
dd7714c9 WF |
7808 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
7809 | { 2, alc889_ch2_intel_init }, | |
87a8c370 JK |
7810 | { 6, alc889_ch6_intel_init }, |
7811 | { 8, alc889_ch8_intel_init }, | |
7812 | }; | |
7813 | ||
4953550a TI |
7814 | /* |
7815 | * 6ch mode | |
7816 | */ | |
7817 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
7818 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7819 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7820 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7821 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7822 | { } /* end */ | |
7823 | }; | |
7824 | ||
7825 | /* | |
7826 | * 8ch mode | |
7827 | */ | |
7828 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
7829 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7830 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7831 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7832 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7833 | { } /* end */ | |
7834 | }; | |
7835 | ||
7836 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
7837 | { 6, alc883_sixstack_ch6_init }, | |
7838 | { 8, alc883_sixstack_ch8_init }, | |
7839 | }; | |
7840 | ||
7841 | ||
1da177e4 LT |
7842 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
7843 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
7844 | */ | |
c8b6bf9b | 7845 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
05acb863 | 7846 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 7847 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 7848 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 7849 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
05acb863 TI |
7850 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
7851 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
7852 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
7853 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
05acb863 | 7854 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 7855 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1da177e4 LT |
7856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
7857 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7858 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7859 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7860 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7861 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7862 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
1da177e4 LT |
7863 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7864 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7865 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
1da177e4 | 7866 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
1da177e4 LT |
7867 | { } /* end */ |
7868 | }; | |
7869 | ||
76e6f5a9 RH |
7870 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
7871 | ||
7872 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { | |
7873 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7874 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), | |
7875 | { } | |
7876 | }; | |
7877 | ||
7878 | ||
87350ad0 | 7879 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
a3f730af TI |
7880 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7881 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7882 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7883 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7884 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
2134ea4f TI |
7885 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7886 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
87350ad0 TI |
7887 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
7888 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
2134ea4f | 7889 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
87350ad0 TI |
7890 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
7891 | { } /* end */ | |
7892 | }; | |
41d5545d KS |
7893 | |
7894 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { | |
92b9de83 KS |
7895 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7896 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7897 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7898 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7899 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7900 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
a76221d4 AM |
7901 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
7902 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
b8f171e7 AM |
7903 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
7904 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
41d5545d KS |
7905 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
7906 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
7907 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7908 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), | |
7909 | { } /* end */ | |
7910 | }; | |
92b9de83 | 7911 | |
e458b1fa LY |
7912 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
7913 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
7914 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
7915 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
7916 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
7917 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | |
7918 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | |
7919 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | |
7920 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | |
7921 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
7922 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
7923 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | |
7924 | { } /* end */ | |
7925 | }; | |
7926 | ||
4b7e1803 | 7927 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
b7cccc52 JM |
7928 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
7929 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
4b7e1803 JM |
7930 | { } /* end */ |
7931 | }; | |
7932 | ||
7933 | ||
bdd148a3 KY |
7934 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
7935 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7936 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7937 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7938 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7939 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7940 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7942 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
bdd148a3 KY |
7944 | { } /* end */ |
7945 | }; | |
7946 | ||
272a527c KY |
7947 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
7948 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7949 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7950 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7951 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7952 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7953 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7954 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7955 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7956 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 7957 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
7958 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7959 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
96fe7cc8 | 7960 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
272a527c KY |
7961 | { } /* end */ |
7962 | }; | |
7963 | ||
7964 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
7965 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
7966 | */ | |
7967 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
7968 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7969 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7970 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7971 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
7972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7976 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
7977 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
7978 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7979 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 7980 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
7981 | { } /* end */ |
7982 | }; | |
7983 | ||
914759b7 TI |
7984 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
7985 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7986 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7987 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7988 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7989 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7990 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7991 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7992 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7993 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
914759b7 TI |
7995 | { } /* end */ |
7996 | }; | |
7997 | ||
df694daa KY |
7998 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
7999 | { | |
8000 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8001 | .name = "Channel Mode", | |
8002 | .info = alc_ch_mode_info, | |
8003 | .get = alc_ch_mode_get, | |
8004 | .put = alc_ch_mode_put, | |
8005 | }, | |
8006 | { } /* end */ | |
8007 | }; | |
8008 | ||
4953550a | 8009 | static struct hda_verb alc882_base_init_verbs[] = { |
1da177e4 | 8010 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
05acb863 TI |
8011 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8012 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 8013 | /* Rear mixer */ |
05acb863 TI |
8014 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8015 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 8016 | /* CLFE mixer */ |
05acb863 TI |
8017 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8018 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 8019 | /* Side mixer */ |
05acb863 TI |
8020 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8021 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 8022 | |
e9edcee0 | 8023 | /* Front Pin: output 0 (0x0c) */ |
05acb863 | 8024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 8025 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 8026 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 8027 | /* Rear Pin: output 1 (0x0d) */ |
05acb863 | 8028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 8029 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 8030 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
e9edcee0 | 8031 | /* CLFE Pin: output 2 (0x0e) */ |
05acb863 | 8032 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 8033 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 8034 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
e9edcee0 | 8035 | /* Side Pin: output 3 (0x0f) */ |
05acb863 | 8036 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 8037 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 8038 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
e9edcee0 | 8039 | /* Mic (rear) pin: input vref at 80% */ |
16ded525 | 8040 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
8041 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
8042 | /* Front Mic pin: input vref at 80% */ | |
16ded525 | 8043 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
8044 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
8045 | /* Line In pin: input */ | |
05acb863 | 8046 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
8047 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
8048 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
8049 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8050 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8051 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1da177e4 | 8052 | /* CD pin widget for input */ |
05acb863 | 8053 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 LT |
8054 | |
8055 | /* FIXME: use matrix-type input source selection */ | |
8056 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
1da177e4 | 8057 | /* Input mixer2 */ |
05acb863 | 8058 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 8059 | /* Input mixer3 */ |
05acb863 | 8060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
05acb863 TI |
8061 | /* ADC2: mute amp left and right */ |
8062 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 8063 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
8064 | /* ADC3: mute amp left and right */ |
8065 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 8066 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 LT |
8067 | |
8068 | { } | |
8069 | }; | |
8070 | ||
4953550a TI |
8071 | static struct hda_verb alc882_adc1_init_verbs[] = { |
8072 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8074 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8075 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8076 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8077 | /* ADC1: mute amp left and right */ | |
8078 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8079 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8080 | { } | |
8081 | }; | |
8082 | ||
4b146cb0 TI |
8083 | static struct hda_verb alc882_eapd_verbs[] = { |
8084 | /* change to EAPD mode */ | |
8085 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
b373bdeb | 8086 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
f12ab1e0 | 8087 | { } |
4b146cb0 TI |
8088 | }; |
8089 | ||
87a8c370 JK |
8090 | static struct hda_verb alc889_eapd_verbs[] = { |
8091 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
8092 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
8093 | { } | |
8094 | }; | |
8095 | ||
6732bd0d WF |
8096 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
8097 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
8098 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8099 | {} | |
8100 | }; | |
87a8c370 JK |
8101 | |
8102 | static struct hda_verb alc885_init_verbs[] = { | |
8103 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
88102f3f KY |
8104 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8105 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 8106 | /* Rear mixer */ |
88102f3f KY |
8107 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 8109 | /* CLFE mixer */ |
88102f3f KY |
8110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 | 8112 | /* Side mixer */ |
88102f3f KY |
8113 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8114 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
87a8c370 JK |
8115 | |
8116 | /* Front HP Pin: output 0 (0x0c) */ | |
6732bd0d | 8117 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
87a8c370 JK |
8118 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
8119 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8120 | /* Front Pin: output 0 (0x0c) */ | |
8121 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8122 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8123 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8124 | /* Rear Pin: output 1 (0x0d) */ | |
8125 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8126 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8127 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8128 | /* CLFE Pin: output 2 (0x0e) */ | |
8129 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8130 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8131 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8132 | /* Side Pin: output 3 (0x0f) */ | |
8133 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8134 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8135 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8136 | /* Mic (rear) pin: input vref at 80% */ | |
8137 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8138 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8139 | /* Front Mic pin: input vref at 80% */ | |
8140 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8141 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8142 | /* Line In pin: input */ | |
8143 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8144 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8145 | ||
8146 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | |
8147 | /* Input mixer1 */ | |
88102f3f | 8148 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
87a8c370 JK |
8149 | /* Input mixer2 */ |
8150 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
87a8c370 | 8151 | /* Input mixer3 */ |
88102f3f | 8152 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
87a8c370 JK |
8153 | /* ADC2: mute amp left and right */ |
8154 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8155 | /* ADC3: mute amp left and right */ | |
8156 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8157 | ||
8158 | { } | |
8159 | }; | |
8160 | ||
8161 | static struct hda_verb alc885_init_input_verbs[] = { | |
8162 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8163 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
8164 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
8165 | { } | |
8166 | }; | |
8167 | ||
8168 | ||
8169 | /* Unmute Selector 24h and set the default input to front mic */ | |
8170 | static struct hda_verb alc889_init_input_verbs[] = { | |
8171 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8172 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8173 | { } | |
8174 | }; | |
8175 | ||
8176 | ||
4953550a TI |
8177 | #define alc883_init_verbs alc882_base_init_verbs |
8178 | ||
9102cd1c TD |
8179 | /* Mac Pro test */ |
8180 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
8181 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8182 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8183 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
8184 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
8185 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
45bdd1c1 | 8186 | /* FIXME: this looks suspicious... |
d355c82a JK |
8187 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8188 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
45bdd1c1 | 8189 | */ |
9102cd1c TD |
8190 | { } /* end */ |
8191 | }; | |
8192 | ||
8193 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
8194 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8195 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8196 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8197 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8198 | /* Front Pin: output 0 (0x0c) */ | |
8199 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8200 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8201 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8202 | /* Front Mic pin: input vref at 80% */ | |
8203 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8204 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8205 | /* Speaker: output */ | |
8206 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8207 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8208 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
8209 | /* Headphone output (output 0 - 0x0c) */ | |
8210 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8211 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8212 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8213 | ||
8214 | /* FIXME: use matrix-type input source selection */ | |
8215 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8216 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8217 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8218 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8219 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8220 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8221 | /* Input mixer2 */ | |
8222 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8223 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8224 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8225 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8226 | /* Input mixer3 */ | |
8227 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8228 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8229 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8230 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8231 | /* ADC1: mute amp left and right */ | |
8232 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8233 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8234 | /* ADC2: mute amp left and right */ | |
8235 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8236 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8237 | /* ADC3: mute amp left and right */ | |
8238 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8239 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8240 | ||
8241 | { } | |
8242 | }; | |
f12ab1e0 | 8243 | |
41d5545d KS |
8244 | /* Macbook 5,1 */ |
8245 | static struct hda_verb alc885_mb5_init_verbs[] = { | |
92b9de83 KS |
8246 | /* DACs */ |
8247 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8248 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8249 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8250 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
41d5545d | 8251 | /* Front mixer */ |
41d5545d KS |
8252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
8253 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8254 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
92b9de83 KS |
8255 | /* Surround mixer */ |
8256 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8257 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8259 | /* LFE mixer */ | |
8260 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8261 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8262 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8263 | /* HP mixer */ | |
8264 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8265 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8266 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8267 | /* Front Pin (0x0c) */ | |
41d5545d KS |
8268 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
8269 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
92b9de83 KS |
8270 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8271 | /* LFE Pin (0x0e) */ | |
8272 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8274 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8275 | /* HP Pin (0x0f) */ | |
41d5545d KS |
8276 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
8277 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
92b9de83 | 8278 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
a76221d4 | 8279 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
41d5545d KS |
8280 | /* Front Mic pin: input vref at 80% */ |
8281 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8282 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8283 | /* Line In pin */ | |
8284 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8285 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8286 | ||
b8f171e7 AM |
8287 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
8288 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, | |
8289 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, | |
41d5545d KS |
8290 | { } |
8291 | }; | |
8292 | ||
e458b1fa LY |
8293 | /* Macmini 3,1 */ |
8294 | static struct hda_verb alc885_macmini3_init_verbs[] = { | |
8295 | /* DACs */ | |
8296 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8297 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8298 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8299 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8300 | /* Front mixer */ | |
8301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8302 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8303 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8304 | /* Surround mixer */ | |
8305 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8306 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8307 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8308 | /* LFE mixer */ | |
8309 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8312 | /* HP mixer */ | |
8313 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8314 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8315 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8316 | /* Front Pin (0x0c) */ | |
8317 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8318 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8319 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8320 | /* LFE Pin (0x0e) */ | |
8321 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | |
8322 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8323 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
8324 | /* HP Pin (0x0f) */ | |
8325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8326 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8327 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
8328 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8329 | /* Line In pin */ | |
8330 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8331 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8332 | ||
8333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8334 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8335 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8336 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8337 | { } | |
8338 | }; | |
8339 | ||
76e6f5a9 RH |
8340 | |
8341 | static struct hda_verb alc885_mba21_init_verbs[] = { | |
8342 | /*Internal and HP Speaker Mixer*/ | |
8343 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8346 | /*Internal Speaker Pin (0x0c)*/ | |
8347 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8348 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8349 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8350 | /* HP Pin: output 0 (0x0e) */ | |
8351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
8352 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8353 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8354 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | |
8355 | /* Line in (is hp when jack connected)*/ | |
8356 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
8357 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8358 | ||
8359 | { } | |
8360 | }; | |
8361 | ||
8362 | ||
87350ad0 TI |
8363 | /* Macbook Pro rev3 */ |
8364 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
8365 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
8366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8368 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8369 | /* Rear mixer */ | |
8370 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8371 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8372 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a3f730af TI |
8373 | /* HP mixer */ |
8374 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8375 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8376 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
87350ad0 TI |
8377 | /* Front Pin: output 0 (0x0c) */ |
8378 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8379 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8380 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
a3f730af | 8381 | /* HP Pin: output 0 (0x0e) */ |
87350ad0 | 8382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
a3f730af TI |
8383 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
8384 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
87350ad0 TI |
8385 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
8386 | /* Mic (rear) pin: input vref at 80% */ | |
8387 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8388 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8389 | /* Front Mic pin: input vref at 80% */ | |
8390 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8391 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8392 | /* Line In pin: use output 1 when in LineOut mode */ | |
8393 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
8394 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8395 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
8396 | ||
8397 | /* FIXME: use matrix-type input source selection */ | |
8398 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8399 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
8400 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8401 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8402 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8403 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8404 | /* Input mixer2 */ | |
8405 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8406 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8407 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8408 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8409 | /* Input mixer3 */ | |
8410 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8412 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8413 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
8414 | /* ADC1: mute amp left and right */ | |
8415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8416 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8417 | /* ADC2: mute amp left and right */ | |
8418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8419 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8420 | /* ADC3: mute amp left and right */ | |
8421 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8422 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8423 | ||
8424 | { } | |
8425 | }; | |
8426 | ||
4b7e1803 JM |
8427 | /* iMac 9,1 */ |
8428 | static struct hda_verb alc885_imac91_init_verbs[] = { | |
b7cccc52 JM |
8429 | /* Internal Speaker Pin (0x0c) */ |
8430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8432 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8433 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | |
8434 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8435 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8436 | /* HP Pin: Rear */ | |
4b7e1803 JM |
8437 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
8438 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8439 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 JM |
8440 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
8441 | /* Line in Rear */ | |
8442 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | |
4b7e1803 | 8443 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
4b7e1803 JM |
8444 | /* Front Mic pin: input vref at 80% */ |
8445 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8446 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
b7cccc52 JM |
8447 | /* Rear mixer */ |
8448 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8449 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8450 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8451 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | |
8452 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8453 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8454 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8455 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | |
4b7e1803 JM |
8456 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8457 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8459 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8460 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
4b7e1803 JM |
8461 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8462 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8463 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8464 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8465 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
4b7e1803 JM |
8466 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8467 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8468 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
b7cccc52 | 8470 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8471 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8472 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 | 8473 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8474 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8475 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
b7cccc52 | 8476 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
4b7e1803 JM |
8477 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8478 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4b7e1803 JM |
8479 | { } |
8480 | }; | |
8481 | ||
c54728d8 NF |
8482 | /* iMac 24 mixer. */ |
8483 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
8484 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
8485 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
8486 | { } /* end */ | |
8487 | }; | |
8488 | ||
8489 | /* iMac 24 init verbs. */ | |
8490 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
8491 | /* Internal speakers: output 0 (0x0c) */ | |
8492 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8493 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8494 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8495 | /* Internal speakers: output 0 (0x0c) */ | |
8496 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8497 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8498 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8499 | /* Headphone: output 0 (0x0c) */ | |
8500 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8502 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8503 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8504 | /* Front Mic: input vref at 80% */ | |
8505 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
8506 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
8507 | { } | |
8508 | }; | |
8509 | ||
8510 | /* Toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 8511 | static void alc885_imac24_setup(struct hda_codec *codec) |
c54728d8 | 8512 | { |
a9fd4f3f | 8513 | struct alc_spec *spec = codec->spec; |
c54728d8 | 8514 | |
a9fd4f3f TI |
8515 | spec->autocfg.hp_pins[0] = 0x14; |
8516 | spec->autocfg.speaker_pins[0] = 0x18; | |
8517 | spec->autocfg.speaker_pins[1] = 0x1a; | |
c54728d8 NF |
8518 | } |
8519 | ||
9d54f08b TI |
8520 | #define alc885_mb5_setup alc885_imac24_setup |
8521 | #define alc885_macmini3_setup alc885_imac24_setup | |
8522 | ||
76e6f5a9 RH |
8523 | /* Macbook Air 2,1 */ |
8524 | static void alc885_mba21_setup(struct hda_codec *codec) | |
8525 | { | |
8526 | struct alc_spec *spec = codec->spec; | |
8527 | ||
8528 | spec->autocfg.hp_pins[0] = 0x14; | |
8529 | spec->autocfg.speaker_pins[0] = 0x18; | |
8530 | } | |
8531 | ||
8532 | ||
8533 | ||
4f5d1706 | 8534 | static void alc885_mbp3_setup(struct hda_codec *codec) |
87350ad0 | 8535 | { |
a9fd4f3f | 8536 | struct alc_spec *spec = codec->spec; |
87350ad0 | 8537 | |
a9fd4f3f TI |
8538 | spec->autocfg.hp_pins[0] = 0x15; |
8539 | spec->autocfg.speaker_pins[0] = 0x14; | |
87350ad0 TI |
8540 | } |
8541 | ||
9d54f08b | 8542 | static void alc885_imac91_setup(struct hda_codec *codec) |
a76221d4 | 8543 | { |
9d54f08b | 8544 | struct alc_spec *spec = codec->spec; |
4b7e1803 | 8545 | |
9d54f08b | 8546 | spec->autocfg.hp_pins[0] = 0x14; |
b7cccc52 | 8547 | spec->autocfg.speaker_pins[0] = 0x18; |
9d54f08b | 8548 | spec->autocfg.speaker_pins[1] = 0x1a; |
4b7e1803 | 8549 | } |
87350ad0 | 8550 | |
272a527c KY |
8551 | static struct hda_verb alc882_targa_verbs[] = { |
8552 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8554 | ||
8555 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8556 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8557 | |
272a527c KY |
8558 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
8559 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8560 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8561 | ||
8562 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
272a527c KY |
8563 | { } /* end */ |
8564 | }; | |
8565 | ||
8566 | /* toggle speaker-output according to the hp-jack state */ | |
8567 | static void alc882_targa_automute(struct hda_codec *codec) | |
8568 | { | |
a9fd4f3f TI |
8569 | struct alc_spec *spec = codec->spec; |
8570 | alc_automute_amp(codec); | |
82beb8fd | 8571 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
a9fd4f3f TI |
8572 | spec->jack_present ? 1 : 3); |
8573 | } | |
8574 | ||
4f5d1706 | 8575 | static void alc882_targa_setup(struct hda_codec *codec) |
a9fd4f3f TI |
8576 | { |
8577 | struct alc_spec *spec = codec->spec; | |
8578 | ||
8579 | spec->autocfg.hp_pins[0] = 0x14; | |
8580 | spec->autocfg.speaker_pins[0] = 0x1b; | |
272a527c KY |
8581 | } |
8582 | ||
8583 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
8584 | { | |
a9fd4f3f | 8585 | if ((res >> 26) == ALC880_HP_EVENT) |
272a527c | 8586 | alc882_targa_automute(codec); |
272a527c KY |
8587 | } |
8588 | ||
8589 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
8590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8592 | ||
8593 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8594 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8595 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8596 | |
272a527c KY |
8597 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
8598 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8599 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8600 | ||
8601 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8602 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8603 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8604 | { } /* end */ | |
8605 | }; | |
8606 | ||
914759b7 TI |
8607 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
8608 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8609 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8610 | ||
8611 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8612 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8613 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 8614 | |
914759b7 TI |
8615 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
8616 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8617 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
8618 | ||
8619 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
8620 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
8621 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
8622 | { } /* end */ | |
8623 | }; | |
8624 | ||
9102cd1c TD |
8625 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
8626 | { | |
8627 | unsigned int gpiostate, gpiomask, gpiodir; | |
8628 | ||
8629 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
8630 | AC_VERB_GET_GPIO_DATA, 0); | |
8631 | ||
8632 | if (!muted) | |
8633 | gpiostate |= (1 << pin); | |
8634 | else | |
8635 | gpiostate &= ~(1 << pin); | |
8636 | ||
8637 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
8638 | AC_VERB_GET_GPIO_MASK, 0); | |
8639 | gpiomask |= (1 << pin); | |
8640 | ||
8641 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
8642 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
8643 | gpiodir |= (1 << pin); | |
8644 | ||
8645 | ||
8646 | snd_hda_codec_write(codec, codec->afg, 0, | |
8647 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
8648 | snd_hda_codec_write(codec, codec->afg, 0, | |
8649 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
8650 | ||
8651 | msleep(1); | |
8652 | ||
8653 | snd_hda_codec_write(codec, codec->afg, 0, | |
8654 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
8655 | } | |
8656 | ||
7debbe51 TI |
8657 | /* set up GPIO at initialization */ |
8658 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
8659 | { | |
8660 | alc882_gpio_mute(codec, 0, 0); | |
8661 | alc882_gpio_mute(codec, 1, 0); | |
8662 | } | |
8663 | ||
8664 | /* set up GPIO and update auto-muting at initialization */ | |
8665 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
8666 | { | |
8667 | alc885_macpro_init_hook(codec); | |
4f5d1706 | 8668 | alc_automute_amp(codec); |
7debbe51 TI |
8669 | } |
8670 | ||
df694daa KY |
8671 | /* |
8672 | * generic initialization of ADC, input mixers and output mixers | |
8673 | */ | |
4953550a | 8674 | static struct hda_verb alc883_auto_init_verbs[] = { |
df694daa KY |
8675 | /* |
8676 | * Unmute ADC0-2 and set the default input to mic-in | |
8677 | */ | |
4953550a TI |
8678 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8679 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8680 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8681 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17bba1b7 | 8682 | |
4953550a TI |
8683 | /* |
8684 | * Set up output mixers (0x0c - 0x0f) | |
8685 | */ | |
8686 | /* set vol=0 to output mixers */ | |
8687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8688 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8689 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8690 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8691 | /* set up input amps for analog loopback */ | |
8692 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
8693 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8695 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8696 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8697 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8698 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8699 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8700 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8701 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8702 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9c7f852e | 8703 | |
4953550a TI |
8704 | /* FIXME: use matrix-type input source selection */ |
8705 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8706 | /* Input mixer2 */ | |
88102f3f | 8707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4953550a | 8708 | /* Input mixer3 */ |
88102f3f | 8709 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4953550a | 8710 | { } |
9c7f852e TI |
8711 | }; |
8712 | ||
eb4c41d3 TS |
8713 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
8714 | static struct hda_verb alc889A_mb31_ch2_init[] = { | |
8715 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8716 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8717 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8718 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8719 | { } /* end */ | |
8720 | }; | |
8721 | ||
8722 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ | |
8723 | static struct hda_verb alc889A_mb31_ch4_init[] = { | |
8724 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | |
8725 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8726 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8727 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8728 | { } /* end */ | |
8729 | }; | |
8730 | ||
8731 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ | |
8732 | static struct hda_verb alc889A_mb31_ch5_init[] = { | |
8733 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ | |
8734 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | |
8735 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | |
8736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | |
8737 | { } /* end */ | |
8738 | }; | |
8739 | ||
8740 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ | |
8741 | static struct hda_verb alc889A_mb31_ch6_init[] = { | |
8742 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ | |
8743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ | |
8744 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | |
8745 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | |
8746 | { } /* end */ | |
8747 | }; | |
8748 | ||
8749 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { | |
8750 | { 2, alc889A_mb31_ch2_init }, | |
8751 | { 4, alc889A_mb31_ch4_init }, | |
8752 | { 5, alc889A_mb31_ch5_init }, | |
8753 | { 6, alc889A_mb31_ch6_init }, | |
8754 | }; | |
8755 | ||
b373bdeb AN |
8756 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
8757 | /* eanable EAPD on medion laptop */ | |
8758 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
8759 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
8760 | { } | |
8761 | }; | |
8762 | ||
4953550a | 8763 | #define alc883_base_mixer alc882_base_mixer |
834be88d | 8764 | |
a8848bd6 AS |
8765 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
8766 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8767 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8768 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8769 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8770 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8771 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8772 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8774 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8775 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8776 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8777 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
8778 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
a8848bd6 AS |
8779 | { } /* end */ |
8780 | }; | |
8781 | ||
0c4cc443 | 8782 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
368c7a95 J |
8783 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8784 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8785 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8786 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8787 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8788 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8789 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8790 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8791 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8792 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
368c7a95 J |
8793 | { } /* end */ |
8794 | }; | |
8795 | ||
fb97dc67 J |
8796 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
8797 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8798 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
8799 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8800 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
8801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8802 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8804 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8805 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8806 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
fb97dc67 J |
8807 | { } /* end */ |
8808 | }; | |
8809 | ||
9c7f852e TI |
8810 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
8811 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8812 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8813 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8814 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8815 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8816 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8817 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8819 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8821 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8822 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8823 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
9c7f852e TI |
8824 | { } /* end */ |
8825 | }; | |
df694daa | 8826 | |
9c7f852e TI |
8827 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
8828 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8829 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8830 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8831 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8832 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8833 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8834 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8835 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8837 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8838 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8839 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8840 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8842 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8843 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8844 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8845 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8846 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
9c7f852e TI |
8847 | { } /* end */ |
8848 | }; | |
8849 | ||
17bba1b7 J |
8850 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
8851 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8852 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8853 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8854 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8855 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8856 | HDA_OUTPUT), | |
8857 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8858 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8859 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8860 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8861 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8862 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8863 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8864 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8865 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8866 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
8867 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8868 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8869 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8870 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17bba1b7 J |
8871 | { } /* end */ |
8872 | }; | |
8873 | ||
87a8c370 JK |
8874 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
8875 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8876 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8877 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8878 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8879 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
8880 | HDA_OUTPUT), | |
8881 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8882 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8883 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8884 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8885 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | |
8886 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8887 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8888 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8889 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
8890 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), | |
8891 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
8892 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8893 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
8894 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
8895 | { } /* end */ | |
8896 | }; | |
8897 | ||
d1d985f0 | 8898 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
c07584c8 | 8899 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
0701e064 | 8900 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
c07584c8 | 8901 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
0701e064 | 8902 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
c07584c8 TD |
8903 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
8904 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
0701e064 TI |
8905 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
8906 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
c07584c8 TD |
8907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8908 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8909 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8910 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8911 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8913 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c07584c8 TD |
8914 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
8915 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 8916 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
c07584c8 | 8917 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
c07584c8 TD |
8918 | { } /* end */ |
8919 | }; | |
8920 | ||
c259249f | 8921 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
ccc656ce | 8922 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
b99dba34 | 8923 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
ccc656ce | 8924 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
b99dba34 | 8925 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
ccc656ce KY |
8926 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
8927 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
8928 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
8929 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8930 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
8931 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
8932 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8933 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8934 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8935 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8936 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8937 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 8938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
ccc656ce | 8939 | { } /* end */ |
f12ab1e0 | 8940 | }; |
ccc656ce | 8941 | |
c259249f | 8942 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
ccc656ce | 8943 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
b99dba34 | 8944 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
ccc656ce | 8945 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
b99dba34 | 8946 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
ccc656ce KY |
8947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
8948 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8949 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 8950 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 8951 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
4383fae0 J |
8952 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
8953 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8954 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce | 8955 | { } /* end */ |
f12ab1e0 | 8956 | }; |
ccc656ce | 8957 | |
b99dba34 TI |
8958 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
8959 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
8960 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
8961 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8962 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
8963 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
8964 | { } /* end */ | |
8965 | }; | |
8966 | ||
bc9f98a9 KY |
8967 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
8968 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8969 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
86cd9298 TI |
8970 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
8971 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
bc9f98a9 KY |
8972 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
8974 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
8975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 | 8976 | { } /* end */ |
f12ab1e0 | 8977 | }; |
bc9f98a9 | 8978 | |
272a527c KY |
8979 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
8980 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8981 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
8982 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8983 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8984 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8985 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8986 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
150b432f DH |
8987 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
8988 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
272a527c KY |
8989 | { } /* end */ |
8990 | }; | |
8991 | ||
7ad7b218 MC |
8992 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
8993 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8994 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
8995 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8996 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | |
8997 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | |
8998 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | |
8999 | { } /* end */ | |
9000 | }; | |
9001 | ||
9002 | static struct hda_verb alc883_medion_wim2160_verbs[] = { | |
9003 | /* Unmute front mixer */ | |
9004 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9005 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9006 | ||
9007 | /* Set speaker pin to front mixer */ | |
9008 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9009 | ||
9010 | /* Init headphone pin */ | |
9011 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9012 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9013 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9014 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9015 | ||
9016 | { } /* end */ | |
9017 | }; | |
9018 | ||
9019 | /* toggle speaker-output according to the hp-jack state */ | |
9020 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | |
9021 | { | |
9022 | struct alc_spec *spec = codec->spec; | |
9023 | ||
9024 | spec->autocfg.hp_pins[0] = 0x1a; | |
9025 | spec->autocfg.speaker_pins[0] = 0x15; | |
9026 | } | |
9027 | ||
2880a867 | 9028 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
d1a991a6 KY |
9029 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9030 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2880a867 | 9031 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
2880a867 TD |
9032 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
9033 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d1a991a6 KY |
9034 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
9035 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9036 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2880a867 | 9037 | { } /* end */ |
d1a991a6 | 9038 | }; |
2880a867 | 9039 | |
d2fd4b09 TV |
9040 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
9041 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
d2fd4b09 | 9042 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
684a8842 TV |
9043 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
9044 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d2fd4b09 TV |
9045 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
9046 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9048 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9049 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9050 | { } /* end */ | |
9051 | }; | |
9052 | ||
e2757d5e KY |
9053 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
9054 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9055 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9056 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
9057 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | |
9058 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | |
9059 | 0x0d, 1, 0x0, HDA_OUTPUT), | |
9060 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
9061 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
9062 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
9063 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
9064 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
e2757d5e KY |
9065 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
9066 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9067 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9068 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9069 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9070 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9071 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9072 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9073 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
9074 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e2757d5e KY |
9075 | { } /* end */ |
9076 | }; | |
9077 | ||
eb4c41d3 TS |
9078 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
9079 | /* Output mixers */ | |
9080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
9081 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
9082 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
9083 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | |
9084 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, | |
9085 | HDA_OUTPUT), | |
9086 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), | |
9087 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), | |
9088 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), | |
9089 | /* Output switches */ | |
9090 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), | |
9091 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), | |
9092 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), | |
9093 | /* Boost mixers */ | |
9094 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | |
9095 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | |
9096 | /* Input mixers */ | |
9097 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | |
9098 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
9099 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9100 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9101 | { } /* end */ | |
9102 | }; | |
9103 | ||
3e1647c5 GG |
9104 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
9105 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9106 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9107 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9109 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
9110 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9111 | { } /* end */ | |
9112 | }; | |
9113 | ||
e2757d5e KY |
9114 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
9115 | .ops = &snd_hda_bind_vol, | |
9116 | .values = { | |
9117 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
9118 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
9119 | 0 | |
9120 | }, | |
9121 | }; | |
9122 | ||
9123 | static struct hda_bind_ctls alc883_bind_cap_switch = { | |
9124 | .ops = &snd_hda_bind_sw, | |
9125 | .values = { | |
9126 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
9127 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
9128 | 0 | |
9129 | }, | |
9130 | }; | |
9131 | ||
9132 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | |
9133 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9134 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
9135 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9136 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
9137 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9138 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
4953550a TI |
9139 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9140 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9141 | { } /* end */ | |
9142 | }; | |
df694daa | 9143 | |
4953550a TI |
9144 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
9145 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | |
9146 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | |
9147 | { | |
9148 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9149 | /* .name = "Capture Source", */ | |
9150 | .name = "Input Source", | |
9151 | .count = 1, | |
9152 | .info = alc_mux_enum_info, | |
9153 | .get = alc_mux_enum_get, | |
9154 | .put = alc_mux_enum_put, | |
9155 | }, | |
9156 | { } /* end */ | |
9157 | }; | |
9c7f852e | 9158 | |
4953550a TI |
9159 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
9160 | { | |
9161 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9162 | .name = "Channel Mode", | |
9163 | .info = alc_ch_mode_info, | |
9164 | .get = alc_ch_mode_get, | |
9165 | .put = alc_ch_mode_put, | |
9166 | }, | |
9167 | { } /* end */ | |
9c7f852e TI |
9168 | }; |
9169 | ||
a8848bd6 | 9170 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 9171 | static void alc883_mitac_setup(struct hda_codec *codec) |
a8848bd6 | 9172 | { |
a9fd4f3f | 9173 | struct alc_spec *spec = codec->spec; |
a8848bd6 | 9174 | |
a9fd4f3f TI |
9175 | spec->autocfg.hp_pins[0] = 0x15; |
9176 | spec->autocfg.speaker_pins[0] = 0x14; | |
9177 | spec->autocfg.speaker_pins[1] = 0x17; | |
a8848bd6 AS |
9178 | } |
9179 | ||
9180 | /* auto-toggle front mic */ | |
9181 | /* | |
9182 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | |
9183 | { | |
864f92be | 9184 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; |
a8848bd6 | 9185 | |
a8848bd6 AS |
9186 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
9187 | } | |
9188 | */ | |
9189 | ||
a8848bd6 AS |
9190 | static struct hda_verb alc883_mitac_verbs[] = { |
9191 | /* HP */ | |
9192 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9194 | /* Subwoofer */ | |
9195 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9196 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9197 | ||
9198 | /* enable unsolicited event */ | |
9199 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9200 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
9201 | ||
9202 | { } /* end */ | |
9203 | }; | |
9204 | ||
a65cc60f | 9205 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
9206 | /* HP */ | |
9207 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9208 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9209 | /* Int speaker */ | |
9210 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | |
9211 | ||
9212 | /* enable unsolicited event */ | |
9213 | /* | |
9214 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9215 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9216 | */ | |
9217 | ||
9218 | { } /* end */ | |
9219 | }; | |
9220 | ||
0c4cc443 | 9221 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
368c7a95 J |
9222 | /* HP */ |
9223 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9225 | /* Int speaker */ | |
9226 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9228 | ||
9229 | /* enable unsolicited event */ | |
9230 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
0c4cc443 | 9231 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
368c7a95 J |
9232 | |
9233 | { } /* end */ | |
9234 | }; | |
9235 | ||
fb97dc67 J |
9236 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
9237 | /* HP */ | |
9238 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9240 | /* Subwoofer */ | |
9241 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9242 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9243 | ||
9244 | /* enable unsolicited event */ | |
9245 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9246 | ||
9247 | { } /* end */ | |
9248 | }; | |
9249 | ||
c259249f | 9250 | static struct hda_verb alc883_targa_verbs[] = { |
ccc656ce KY |
9251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
9252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9253 | ||
9254 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9255 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 9256 | |
64a8be74 DH |
9257 | /* Connect Line-Out side jack (SPDIF) to Side */ |
9258 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9259 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9260 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
9261 | /* Connect Mic jack to CLFE */ | |
9262 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9263 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9264 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
9265 | /* Connect Line-in jack to Surround */ | |
9266 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9267 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9268 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
9269 | /* Connect HP out jack to Front */ | |
9270 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9271 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9272 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
ccc656ce KY |
9273 | |
9274 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
ccc656ce KY |
9275 | |
9276 | { } /* end */ | |
9277 | }; | |
9278 | ||
bc9f98a9 KY |
9279 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
9280 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9281 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
9282 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
9283 | { } /* end */ | |
9284 | }; | |
9285 | ||
272a527c KY |
9286 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
9287 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9288 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9289 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9290 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9291 | { } /* end */ | |
9292 | }; | |
9293 | ||
9294 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
9295 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9297 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9298 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
9299 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9300 | { } /* end */ | |
9301 | }; | |
9302 | ||
189609ae KY |
9303 | static struct hda_verb alc883_haier_w66_verbs[] = { |
9304 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9306 | ||
9307 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9308 | ||
9309 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9310 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9311 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9312 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9313 | { } /* end */ | |
9314 | }; | |
9315 | ||
e2757d5e KY |
9316 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
9317 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9318 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9319 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9320 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9321 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9322 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9323 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9324 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9325 | { } /* end */ | |
9326 | }; | |
9327 | ||
8718b700 HRK |
9328 | static struct hda_verb alc888_6st_dell_verbs[] = { |
9329 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9330 | { } | |
9331 | }; | |
9332 | ||
3e1647c5 GG |
9333 | static struct hda_verb alc883_vaiott_verbs[] = { |
9334 | /* HP */ | |
9335 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9337 | ||
9338 | /* enable unsolicited event */ | |
9339 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9340 | ||
9341 | { } /* end */ | |
9342 | }; | |
9343 | ||
4f5d1706 | 9344 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
8718b700 | 9345 | { |
a9fd4f3f | 9346 | struct alc_spec *spec = codec->spec; |
8718b700 | 9347 | |
a9fd4f3f TI |
9348 | spec->autocfg.hp_pins[0] = 0x1b; |
9349 | spec->autocfg.speaker_pins[0] = 0x14; | |
9350 | spec->autocfg.speaker_pins[1] = 0x16; | |
9351 | spec->autocfg.speaker_pins[2] = 0x18; | |
8718b700 HRK |
9352 | } |
9353 | ||
4723c022 | 9354 | static struct hda_verb alc888_3st_hp_verbs[] = { |
8341de60 | 9355 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
f32a19e3 HRK |
9356 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
9357 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
5795b9e6 | 9358 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
8718b700 | 9359 | { } /* end */ |
5795b9e6 CM |
9360 | }; |
9361 | ||
3ea0d7cf HRK |
9362 | /* |
9363 | * 2ch mode | |
9364 | */ | |
4723c022 | 9365 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
8341de60 CM |
9366 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
9367 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9368 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
9369 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
3ea0d7cf | 9370 | { } /* end */ |
8341de60 CM |
9371 | }; |
9372 | ||
3ea0d7cf HRK |
9373 | /* |
9374 | * 4ch mode | |
9375 | */ | |
9376 | static struct hda_verb alc888_3st_hp_4ch_init[] = { | |
9377 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
9378 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
9379 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9380 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9381 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
9382 | { } /* end */ | |
9383 | }; | |
9384 | ||
9385 | /* | |
9386 | * 6ch mode | |
9387 | */ | |
4723c022 | 9388 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
8341de60 CM |
9389 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
9390 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
3ea0d7cf | 9391 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
8341de60 CM |
9392 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
9393 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
3ea0d7cf HRK |
9394 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
9395 | { } /* end */ | |
8341de60 CM |
9396 | }; |
9397 | ||
3ea0d7cf | 9398 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
4723c022 | 9399 | { 2, alc888_3st_hp_2ch_init }, |
3ea0d7cf | 9400 | { 4, alc888_3st_hp_4ch_init }, |
4723c022 | 9401 | { 6, alc888_3st_hp_6ch_init }, |
8341de60 CM |
9402 | }; |
9403 | ||
272a527c KY |
9404 | /* toggle front-jack and RCA according to the hp-jack state */ |
9405 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
9406 | { | |
864f92be | 9407 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
ea1fb29a | 9408 | |
47fd830a TI |
9409 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9410 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9411 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9412 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
9413 | } |
9414 | ||
9415 | /* toggle RCA according to the front-jack state */ | |
9416 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
9417 | { | |
864f92be | 9418 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
ea1fb29a | 9419 | |
47fd830a TI |
9420 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9421 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c | 9422 | } |
47fd830a | 9423 | |
272a527c KY |
9424 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
9425 | unsigned int res) | |
9426 | { | |
9427 | if ((res >> 26) == ALC880_HP_EVENT) | |
9428 | alc888_lenovo_ms7195_front_automute(codec); | |
9429 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9430 | alc888_lenovo_ms7195_rca_automute(codec); | |
9431 | } | |
9432 | ||
272a527c | 9433 | /* toggle speaker-output according to the hp-jack state */ |
dc427170 | 9434 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
272a527c | 9435 | { |
a9fd4f3f | 9436 | struct alc_spec *spec = codec->spec; |
272a527c | 9437 | |
a9fd4f3f TI |
9438 | spec->autocfg.hp_pins[0] = 0x14; |
9439 | spec->autocfg.speaker_pins[0] = 0x15; | |
272a527c KY |
9440 | } |
9441 | ||
ccc656ce | 9442 | /* toggle speaker-output according to the hp-jack state */ |
c259249f SA |
9443 | #define alc883_targa_init_hook alc882_targa_init_hook |
9444 | #define alc883_targa_unsol_event alc882_targa_unsol_event | |
368c7a95 | 9445 | |
0c4cc443 HRK |
9446 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
9447 | { | |
9448 | unsigned int present; | |
9449 | ||
d56757ab | 9450 | present = snd_hda_jack_detect(codec, 0x18); |
0c4cc443 HRK |
9451 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
9452 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9453 | } | |
9454 | ||
4f5d1706 | 9455 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
0c4cc443 | 9456 | { |
a9fd4f3f TI |
9457 | struct alc_spec *spec = codec->spec; |
9458 | ||
9459 | spec->autocfg.hp_pins[0] = 0x15; | |
9460 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
9461 | } |
9462 | ||
9463 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | |
9464 | { | |
a9fd4f3f | 9465 | alc_automute_amp(codec); |
0c4cc443 HRK |
9466 | alc883_clevo_m720_mic_automute(codec); |
9467 | } | |
9468 | ||
9469 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
368c7a95 J |
9470 | unsigned int res) |
9471 | { | |
0c4cc443 | 9472 | switch (res >> 26) { |
0c4cc443 HRK |
9473 | case ALC880_MIC_EVENT: |
9474 | alc883_clevo_m720_mic_automute(codec); | |
9475 | break; | |
a9fd4f3f TI |
9476 | default: |
9477 | alc_automute_amp_unsol_event(codec, res); | |
9478 | break; | |
0c4cc443 | 9479 | } |
368c7a95 J |
9480 | } |
9481 | ||
fb97dc67 | 9482 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 9483 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
fb97dc67 | 9484 | { |
a9fd4f3f | 9485 | struct alc_spec *spec = codec->spec; |
fb97dc67 | 9486 | |
a9fd4f3f TI |
9487 | spec->autocfg.hp_pins[0] = 0x14; |
9488 | spec->autocfg.speaker_pins[0] = 0x15; | |
fb97dc67 J |
9489 | } |
9490 | ||
4f5d1706 | 9491 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
fb97dc67 | 9492 | { |
a9fd4f3f | 9493 | struct alc_spec *spec = codec->spec; |
189609ae | 9494 | |
a9fd4f3f TI |
9495 | spec->autocfg.hp_pins[0] = 0x1b; |
9496 | spec->autocfg.speaker_pins[0] = 0x14; | |
189609ae KY |
9497 | } |
9498 | ||
bc9f98a9 KY |
9499 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
9500 | { | |
864f92be | 9501 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
bc9f98a9 | 9502 | |
47fd830a TI |
9503 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9504 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
9505 | } |
9506 | ||
9507 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
9508 | { | |
864f92be | 9509 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
bc9f98a9 | 9510 | |
47fd830a TI |
9511 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9512 | HDA_AMP_MUTE, bits); | |
9513 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9514 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
9515 | } |
9516 | ||
9517 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
9518 | unsigned int res) | |
9519 | { | |
9520 | if ((res >> 26) == ALC880_HP_EVENT) | |
9521 | alc883_lenovo_101e_all_automute(codec); | |
9522 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
9523 | alc883_lenovo_101e_ispeaker_automute(codec); | |
9524 | } | |
9525 | ||
676a9b53 | 9526 | /* toggle speaker-output according to the hp-jack state */ |
4f5d1706 | 9527 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
676a9b53 | 9528 | { |
a9fd4f3f | 9529 | struct alc_spec *spec = codec->spec; |
676a9b53 | 9530 | |
a9fd4f3f TI |
9531 | spec->autocfg.hp_pins[0] = 0x14; |
9532 | spec->autocfg.speaker_pins[0] = 0x15; | |
9533 | spec->autocfg.speaker_pins[1] = 0x16; | |
676a9b53 TI |
9534 | } |
9535 | ||
d1a991a6 KY |
9536 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
9537 | /* HP Pin: output 0 (0x0c) */ | |
9538 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9539 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9540 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9541 | /* Front Pin: output 0 (0x0c) */ | |
676a9b53 TI |
9542 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
9543 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1a991a6 | 9544 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
d1a991a6 KY |
9545 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9546 | /* eanable EAPD on medion laptop */ | |
9547 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9548 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
676a9b53 TI |
9549 | /* enable unsolicited event */ |
9550 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
d1a991a6 KY |
9551 | { } |
9552 | }; | |
9553 | ||
4f5d1706 | 9554 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
5795b9e6 | 9555 | { |
a9fd4f3f | 9556 | struct alc_spec *spec = codec->spec; |
5795b9e6 | 9557 | |
a9fd4f3f TI |
9558 | spec->autocfg.hp_pins[0] = 0x1b; |
9559 | spec->autocfg.speaker_pins[0] = 0x14; | |
9560 | spec->autocfg.speaker_pins[1] = 0x15; | |
9561 | spec->autocfg.speaker_pins[2] = 0x16; | |
9562 | spec->autocfg.speaker_pins[3] = 0x17; | |
5795b9e6 CM |
9563 | } |
9564 | ||
4f5d1706 | 9565 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
e2757d5e | 9566 | { |
a9fd4f3f | 9567 | struct alc_spec *spec = codec->spec; |
e2757d5e | 9568 | |
a9fd4f3f TI |
9569 | spec->autocfg.hp_pins[0] = 0x1b; |
9570 | spec->autocfg.speaker_pins[0] = 0x14; | |
9571 | spec->autocfg.speaker_pins[1] = 0x15; | |
9572 | spec->autocfg.speaker_pins[2] = 0x16; | |
9573 | spec->autocfg.speaker_pins[3] = 0x17; | |
9574 | spec->autocfg.speaker_pins[4] = 0x1a; | |
e2757d5e KY |
9575 | } |
9576 | ||
4f5d1706 | 9577 | static void alc883_vaiott_setup(struct hda_codec *codec) |
3e1647c5 GG |
9578 | { |
9579 | struct alc_spec *spec = codec->spec; | |
9580 | ||
9581 | spec->autocfg.hp_pins[0] = 0x15; | |
9582 | spec->autocfg.speaker_pins[0] = 0x14; | |
9583 | spec->autocfg.speaker_pins[1] = 0x17; | |
3e1647c5 GG |
9584 | } |
9585 | ||
e2757d5e KY |
9586 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
9587 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9588 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9589 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9590 | /* enable unsolicited event */ | |
9591 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9592 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
9593 | { } /* end */ | |
9594 | }; | |
9595 | ||
4f5d1706 | 9596 | static void alc883_mode2_setup(struct hda_codec *codec) |
e2757d5e | 9597 | { |
a9fd4f3f | 9598 | struct alc_spec *spec = codec->spec; |
e2757d5e | 9599 | |
a9fd4f3f TI |
9600 | spec->autocfg.hp_pins[0] = 0x1b; |
9601 | spec->autocfg.speaker_pins[0] = 0x14; | |
9602 | spec->autocfg.speaker_pins[1] = 0x15; | |
9603 | spec->autocfg.speaker_pins[2] = 0x16; | |
4f5d1706 TI |
9604 | spec->ext_mic.pin = 0x18; |
9605 | spec->int_mic.pin = 0x19; | |
9606 | spec->ext_mic.mux_idx = 0; | |
9607 | spec->int_mic.mux_idx = 1; | |
9608 | spec->auto_mic = 1; | |
e2757d5e KY |
9609 | } |
9610 | ||
9611 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | |
9612 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9613 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9614 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9617 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
9618 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | |
9619 | /* enable unsolicited event */ | |
9620 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9621 | { } /* end */ | |
9622 | }; | |
9623 | ||
e2757d5e KY |
9624 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
9625 | { | |
a9fd4f3f TI |
9626 | struct alc_spec *spec = codec->spec; |
9627 | ||
9628 | spec->autocfg.hp_pins[0] = 0x14; | |
9629 | spec->autocfg.speaker_pins[0] = 0x1b; | |
9630 | alc_automute_pin(codec); | |
e2757d5e KY |
9631 | } |
9632 | ||
eb4c41d3 TS |
9633 | static struct hda_verb alc889A_mb31_verbs[] = { |
9634 | /* Init rear pin (used as headphone output) */ | |
9635 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ | |
9636 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ | |
9637 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9638 | /* Init line pin (used as output in 4ch and 6ch mode) */ | |
9639 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ | |
9640 | /* Init line 2 pin (used as headphone out by default) */ | |
9641 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ | |
9642 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ | |
9643 | { } /* end */ | |
9644 | }; | |
9645 | ||
9646 | /* Mute speakers according to the headphone jack state */ | |
9647 | static void alc889A_mb31_automute(struct hda_codec *codec) | |
9648 | { | |
9649 | unsigned int present; | |
9650 | ||
9651 | /* Mute only in 2ch or 4ch mode */ | |
9652 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) | |
9653 | == 0x00) { | |
864f92be | 9654 | present = snd_hda_jack_detect(codec, 0x15); |
eb4c41d3 TS |
9655 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9656 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9657 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9658 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
9659 | } | |
9660 | } | |
9661 | ||
9662 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | |
9663 | { | |
9664 | if ((res >> 26) == ALC880_HP_EVENT) | |
9665 | alc889A_mb31_automute(codec); | |
9666 | } | |
9667 | ||
4953550a | 9668 | |
cb53c626 | 9669 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4953550a | 9670 | #define alc882_loopbacks alc880_loopbacks |
cb53c626 TI |
9671 | #endif |
9672 | ||
def319f9 | 9673 | /* pcm configuration: identical with ALC880 */ |
4953550a TI |
9674 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
9675 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
9676 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
9677 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
9678 | ||
9679 | static hda_nid_t alc883_slave_dig_outs[] = { | |
9680 | ALC1200_DIGOUT_NID, 0, | |
9681 | }; | |
9682 | ||
9683 | static hda_nid_t alc1200_slave_dig_outs[] = { | |
9684 | ALC883_DIGOUT_NID, 0, | |
9685 | }; | |
9c7f852e TI |
9686 | |
9687 | /* | |
9688 | * configuration and preset | |
9689 | */ | |
4953550a TI |
9690 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
9691 | [ALC882_3ST_DIG] = "3stack-dig", | |
9692 | [ALC882_6ST_DIG] = "6stack-dig", | |
9693 | [ALC882_ARIMA] = "arima", | |
9694 | [ALC882_W2JC] = "w2jc", | |
9695 | [ALC882_TARGA] = "targa", | |
9696 | [ALC882_ASUS_A7J] = "asus-a7j", | |
9697 | [ALC882_ASUS_A7M] = "asus-a7m", | |
9698 | [ALC885_MACPRO] = "macpro", | |
9699 | [ALC885_MB5] = "mb5", | |
e458b1fa | 9700 | [ALC885_MACMINI3] = "macmini3", |
76e6f5a9 | 9701 | [ALC885_MBA21] = "mba21", |
4953550a TI |
9702 | [ALC885_MBP3] = "mbp3", |
9703 | [ALC885_IMAC24] = "imac24", | |
4b7e1803 | 9704 | [ALC885_IMAC91] = "imac91", |
4953550a | 9705 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
f5fcc13c TI |
9706 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
9707 | [ALC883_3ST_6ch] = "3stack-6ch", | |
4953550a | 9708 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
f5fcc13c TI |
9709 | [ALC883_TARGA_DIG] = "targa-dig", |
9710 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
64a8be74 | 9711 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
f5fcc13c | 9712 | [ALC883_ACER] = "acer", |
2880a867 | 9713 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
5b2d1eca | 9714 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
b1a91469 | 9715 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
3b315d70 | 9716 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
fc86f954 | 9717 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
f5fcc13c | 9718 | [ALC883_MEDION] = "medion", |
7ad7b218 | 9719 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
f5fcc13c | 9720 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
bc9f98a9 | 9721 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
272a527c KY |
9722 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
9723 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
e2757d5e | 9724 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
189609ae | 9725 | [ALC883_HAIER_W66] = "haier-w66", |
4723c022 | 9726 | [ALC888_3ST_HP] = "3stack-hp", |
5795b9e6 | 9727 | [ALC888_6ST_DELL] = "6stack-dell", |
a8848bd6 | 9728 | [ALC883_MITAC] = "mitac", |
a65cc60f | 9729 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
0c4cc443 | 9730 | [ALC883_CLEVO_M720] = "clevo-m720", |
fb97dc67 | 9731 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
ef8ef5fb | 9732 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
17bba1b7 | 9733 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
87a8c370 JK |
9734 | [ALC889A_INTEL] = "intel-alc889a", |
9735 | [ALC889_INTEL] = "intel-x58", | |
3ab90935 | 9736 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
eb4c41d3 | 9737 | [ALC889A_MB31] = "mb31", |
3e1647c5 | 9738 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
4953550a | 9739 | [ALC882_AUTO] = "auto", |
f5fcc13c TI |
9740 | }; |
9741 | ||
4953550a TI |
9742 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
9743 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
9744 | ||
ac3e3741 | 9745 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
69e50282 | 9746 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
9b6682ff | 9747 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
ac3e3741 TI |
9748 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
9749 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
0b18cb18 | 9750 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
5b2d1eca VP |
9751 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
9752 | ALC888_ACER_ASPIRE_4930G), | |
a8e4f9dd | 9753 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
83dd7408 | 9754 | ALC888_ACER_ASPIRE_4930G), |
3b315d70 HM |
9755 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
9756 | ALC888_ACER_ASPIRE_8930G), | |
e46b0c8c TI |
9757 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
9758 | ALC888_ACER_ASPIRE_8930G), | |
4953550a TI |
9759 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
9760 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), | |
a8e4f9dd | 9761 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
dde65356 | 9762 | ALC888_ACER_ASPIRE_6530G), |
cc374c47 | 9763 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
d2fd4b09 | 9764 | ALC888_ACER_ASPIRE_6530G), |
fc86f954 DK |
9765 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
9766 | ALC888_ACER_ASPIRE_7730G), | |
22b530e0 TI |
9767 | /* default Acer -- disabled as it causes more problems. |
9768 | * model=auto should work fine now | |
9769 | */ | |
9770 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | |
4953550a | 9771 | |
5795b9e6 | 9772 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
4953550a | 9773 | |
febe3375 | 9774 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
ac3e3741 TI |
9775 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
9776 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
5d85f8d0 | 9777 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
06bf3e15 | 9778 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
7ec30f0e | 9779 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
4953550a TI |
9780 | |
9781 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | |
9782 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | |
9783 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | |
a01c30cb | 9784 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
4953550a TI |
9785 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
9786 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | |
9787 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | |
ac3e3741 | 9788 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
44a678d0 | 9789 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
3ab90935 | 9790 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
e2757d5e | 9791 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
4953550a TI |
9792 | |
9793 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | |
97ec710c | 9794 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
4953550a | 9795 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
2de686d2 | 9796 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
ac3e3741 TI |
9797 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
9798 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
e2757d5e | 9799 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
ac3e3741 | 9800 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
4953550a TI |
9801 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
9802 | ||
6f3bf657 | 9803 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
bba8dee7 | 9804 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 9805 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
4953550a | 9806 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
2fef62c8 | 9807 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
4953550a | 9808 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
dd146a60 | 9809 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
82808236 | 9810 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
f5fcc13c | 9811 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 9812 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
9813 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
9814 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 | 9815 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
64ca1c29 | 9816 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
b1e4422f | 9817 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
9818 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
9819 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
9820 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
b43f6e5e | 9821 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
64a8be74 | 9822 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
ac3e3741 TI |
9823 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
9824 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
9825 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
ee09543c | 9826 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
86d34b7e | 9827 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
ac3e3741 TI |
9828 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
9829 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
df01b8af | 9830 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
b43f6e5e | 9831 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
f5fcc13c | 9832 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
b1e4422f | 9833 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
4953550a | 9834 | |
ac3e3741 | 9835 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
d1501ea8 | 9836 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), |
0c4cc443 HRK |
9837 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
9838 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
a65cc60f | 9839 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
dea0a509 | 9840 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
e60623b4 | 9841 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
4953550a | 9842 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
f5fcc13c | 9843 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
bfb53037 | 9844 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
f67d8176 | 9845 | ALC883_FUJITSU_PI2515), |
bfb53037 | 9846 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
ef8ef5fb | 9847 | ALC888_FUJITSU_XA3530), |
272a527c | 9848 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
272a527c | 9849 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
ac3e3741 TI |
9850 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
9851 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
e2757d5e | 9852 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
959973b9 | 9853 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
0b167bf4 | 9854 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
189609ae | 9855 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
4953550a | 9856 | |
17bba1b7 J |
9857 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
9858 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
2de686d2 | 9859 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
87a8c370 JK |
9860 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
9861 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | |
9862 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | |
572c0e3c | 9863 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
9c7f852e | 9864 | |
4953550a | 9865 | {} |
f3cd3f5d WF |
9866 | }; |
9867 | ||
4953550a TI |
9868 | /* codec SSID table for Intel Mac */ |
9869 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | |
9870 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | |
9871 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | |
9872 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | |
9873 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | |
9874 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | |
9875 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | |
9876 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | |
26fd74fc | 9877 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
ab669967 | 9878 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), |
f53dae28 | 9879 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
6e12970b | 9880 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
4953550a TI |
9881 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
9882 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | |
9883 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | |
4b7e1803 | 9884 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
4953550a | 9885 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
3bfea98f | 9886 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
46ef6ec9 DC |
9887 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
9888 | * so apparently no perfect solution yet | |
4953550a TI |
9889 | */ |
9890 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | |
46ef6ec9 | 9891 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
e458b1fa | 9892 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
4953550a | 9893 | {} /* terminator */ |
b25c9da1 WF |
9894 | }; |
9895 | ||
4953550a TI |
9896 | static struct alc_config_preset alc882_presets[] = { |
9897 | [ALC882_3ST_DIG] = { | |
9898 | .mixers = { alc882_base_mixer }, | |
8ab9e0af TI |
9899 | .init_verbs = { alc882_base_init_verbs, |
9900 | alc882_adc1_init_verbs }, | |
4953550a TI |
9901 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9902 | .dac_nids = alc882_dac_nids, | |
9903 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9904 | .dig_in_nid = ALC882_DIGIN_NID, | |
9905 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
9906 | .channel_mode = alc882_ch_modes, | |
9907 | .need_dac_fix = 1, | |
9908 | .input_mux = &alc882_capture_source, | |
9909 | }, | |
9910 | [ALC882_6ST_DIG] = { | |
9911 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9912 | .init_verbs = { alc882_base_init_verbs, |
9913 | alc882_adc1_init_verbs }, | |
4953550a TI |
9914 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9915 | .dac_nids = alc882_dac_nids, | |
9916 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9917 | .dig_in_nid = ALC882_DIGIN_NID, | |
9918 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9919 | .channel_mode = alc882_sixstack_modes, | |
9920 | .input_mux = &alc882_capture_source, | |
9921 | }, | |
9922 | [ALC882_ARIMA] = { | |
9923 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9924 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
9925 | alc882_eapd_verbs }, | |
4953550a TI |
9926 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9927 | .dac_nids = alc882_dac_nids, | |
9928 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
9929 | .channel_mode = alc882_sixstack_modes, | |
9930 | .input_mux = &alc882_capture_source, | |
9931 | }, | |
9932 | [ALC882_W2JC] = { | |
9933 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
9934 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
9935 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | |
4953550a TI |
9936 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
9937 | .dac_nids = alc882_dac_nids, | |
9938 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
9939 | .channel_mode = alc880_threestack_modes, | |
9940 | .need_dac_fix = 1, | |
9941 | .input_mux = &alc882_capture_source, | |
9942 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9943 | }, | |
76e6f5a9 RH |
9944 | [ALC885_MBA21] = { |
9945 | .mixers = { alc885_mba21_mixer }, | |
9946 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, | |
9947 | .num_dacs = 2, | |
9948 | .dac_nids = alc882_dac_nids, | |
9949 | .channel_mode = alc885_mba21_ch_modes, | |
9950 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
9951 | .input_mux = &alc882_capture_source, | |
9952 | .unsol_event = alc_automute_amp_unsol_event, | |
9953 | .setup = alc885_mba21_setup, | |
9954 | .init_hook = alc_automute_amp, | |
9955 | }, | |
4953550a TI |
9956 | [ALC885_MBP3] = { |
9957 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
9958 | .init_verbs = { alc885_mbp3_init_verbs, | |
9959 | alc880_gpio1_init_verbs }, | |
be0ae923 | 9960 | .num_dacs = 2, |
4953550a | 9961 | .dac_nids = alc882_dac_nids, |
be0ae923 TI |
9962 | .hp_nid = 0x04, |
9963 | .channel_mode = alc885_mbp_4ch_modes, | |
9964 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | |
4953550a TI |
9965 | .input_mux = &alc882_capture_source, |
9966 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9967 | .dig_in_nid = ALC882_DIGIN_NID, | |
9968 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 TI |
9969 | .setup = alc885_mbp3_setup, |
9970 | .init_hook = alc_automute_amp, | |
4953550a TI |
9971 | }, |
9972 | [ALC885_MB5] = { | |
9973 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | |
9974 | .init_verbs = { alc885_mb5_init_verbs, | |
9975 | alc880_gpio1_init_verbs }, | |
9976 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9977 | .dac_nids = alc882_dac_nids, | |
9978 | .channel_mode = alc885_mb5_6ch_modes, | |
9979 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | |
9980 | .input_mux = &mb5_capture_source, | |
9981 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9982 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
9983 | .unsol_event = alc_automute_amp_unsol_event, |
9984 | .setup = alc885_mb5_setup, | |
9985 | .init_hook = alc_automute_amp, | |
4953550a | 9986 | }, |
e458b1fa LY |
9987 | [ALC885_MACMINI3] = { |
9988 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, | |
9989 | .init_verbs = { alc885_macmini3_init_verbs, | |
9990 | alc880_gpio1_init_verbs }, | |
9991 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
9992 | .dac_nids = alc882_dac_nids, | |
9993 | .channel_mode = alc885_macmini3_6ch_modes, | |
9994 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), | |
9995 | .input_mux = &macmini3_capture_source, | |
9996 | .dig_out_nid = ALC882_DIGOUT_NID, | |
9997 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
9998 | .unsol_event = alc_automute_amp_unsol_event, |
9999 | .setup = alc885_macmini3_setup, | |
10000 | .init_hook = alc_automute_amp, | |
e458b1fa | 10001 | }, |
4953550a TI |
10002 | [ALC885_MACPRO] = { |
10003 | .mixers = { alc882_macpro_mixer }, | |
10004 | .init_verbs = { alc882_macpro_init_verbs }, | |
10005 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10006 | .dac_nids = alc882_dac_nids, | |
10007 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10008 | .dig_in_nid = ALC882_DIGIN_NID, | |
10009 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
10010 | .channel_mode = alc882_ch_modes, | |
10011 | .input_mux = &alc882_capture_source, | |
10012 | .init_hook = alc885_macpro_init_hook, | |
10013 | }, | |
10014 | [ALC885_IMAC24] = { | |
10015 | .mixers = { alc885_imac24_mixer }, | |
10016 | .init_verbs = { alc885_imac24_init_verbs }, | |
10017 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10018 | .dac_nids = alc882_dac_nids, | |
10019 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10020 | .dig_in_nid = ALC882_DIGIN_NID, | |
10021 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
10022 | .channel_mode = alc882_ch_modes, | |
10023 | .input_mux = &alc882_capture_source, | |
10024 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 | 10025 | .setup = alc885_imac24_setup, |
4953550a TI |
10026 | .init_hook = alc885_imac24_init_hook, |
10027 | }, | |
4b7e1803 | 10028 | [ALC885_IMAC91] = { |
b7cccc52 | 10029 | .mixers = {alc885_imac91_mixer}, |
4b7e1803 JM |
10030 | .init_verbs = { alc885_imac91_init_verbs, |
10031 | alc880_gpio1_init_verbs }, | |
10032 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10033 | .dac_nids = alc882_dac_nids, | |
b7cccc52 JM |
10034 | .channel_mode = alc885_mba21_ch_modes, |
10035 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | |
10036 | .input_mux = &alc889A_imac91_capture_source, | |
4b7e1803 JM |
10037 | .dig_out_nid = ALC882_DIGOUT_NID, |
10038 | .dig_in_nid = ALC882_DIGIN_NID, | |
9d54f08b TI |
10039 | .unsol_event = alc_automute_amp_unsol_event, |
10040 | .setup = alc885_imac91_setup, | |
10041 | .init_hook = alc_automute_amp, | |
4b7e1803 | 10042 | }, |
4953550a TI |
10043 | [ALC882_TARGA] = { |
10044 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | |
8ab9e0af | 10045 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
31909b83 | 10046 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
4953550a TI |
10047 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
10048 | .dac_nids = alc882_dac_nids, | |
10049 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10050 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
10051 | .adc_nids = alc882_adc_nids, | |
10052 | .capsrc_nids = alc882_capsrc_nids, | |
10053 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
10054 | .channel_mode = alc882_3ST_6ch_modes, | |
10055 | .need_dac_fix = 1, | |
10056 | .input_mux = &alc882_capture_source, | |
10057 | .unsol_event = alc882_targa_unsol_event, | |
4f5d1706 TI |
10058 | .setup = alc882_targa_setup, |
10059 | .init_hook = alc882_targa_automute, | |
4953550a TI |
10060 | }, |
10061 | [ALC882_ASUS_A7J] = { | |
10062 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
10063 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
10064 | alc882_asus_a7j_verbs}, | |
4953550a TI |
10065 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
10066 | .dac_nids = alc882_dac_nids, | |
10067 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10068 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
10069 | .adc_nids = alc882_adc_nids, | |
10070 | .capsrc_nids = alc882_capsrc_nids, | |
10071 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | |
10072 | .channel_mode = alc882_3ST_6ch_modes, | |
10073 | .need_dac_fix = 1, | |
10074 | .input_mux = &alc882_capture_source, | |
10075 | }, | |
10076 | [ALC882_ASUS_A7M] = { | |
10077 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
8ab9e0af TI |
10078 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
10079 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | |
4953550a TI |
10080 | alc882_asus_a7m_verbs }, |
10081 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
10082 | .dac_nids = alc882_dac_nids, | |
10083 | .dig_out_nid = ALC882_DIGOUT_NID, | |
10084 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
10085 | .channel_mode = alc880_threestack_modes, | |
10086 | .need_dac_fix = 1, | |
10087 | .input_mux = &alc882_capture_source, | |
10088 | }, | |
9c7f852e TI |
10089 | [ALC883_3ST_2ch_DIG] = { |
10090 | .mixers = { alc883_3ST_2ch_mixer }, | |
10091 | .init_verbs = { alc883_init_verbs }, | |
10092 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10093 | .dac_nids = alc883_dac_nids, | |
10094 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
10095 | .dig_in_nid = ALC883_DIGIN_NID, |
10096 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10097 | .channel_mode = alc883_3ST_2ch_modes, | |
10098 | .input_mux = &alc883_capture_source, | |
10099 | }, | |
10100 | [ALC883_3ST_6ch_DIG] = { | |
10101 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10102 | .init_verbs = { alc883_init_verbs }, | |
10103 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10104 | .dac_nids = alc883_dac_nids, | |
10105 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
10106 | .dig_in_nid = ALC883_DIGIN_NID, |
10107 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10108 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 10109 | .need_dac_fix = 1, |
9c7f852e | 10110 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 10111 | }, |
9c7f852e TI |
10112 | [ALC883_3ST_6ch] = { |
10113 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10114 | .init_verbs = { alc883_init_verbs }, | |
10115 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10116 | .dac_nids = alc883_dac_nids, | |
9c7f852e TI |
10117 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
10118 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 10119 | .need_dac_fix = 1, |
9c7f852e | 10120 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 10121 | }, |
17bba1b7 J |
10122 | [ALC883_3ST_6ch_INTEL] = { |
10123 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
10124 | .init_verbs = { alc883_init_verbs }, | |
10125 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10126 | .dac_nids = alc883_dac_nids, | |
10127 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10128 | .dig_in_nid = ALC883_DIGIN_NID, | |
f3cd3f5d | 10129 | .slave_dig_outs = alc883_slave_dig_outs, |
17bba1b7 J |
10130 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
10131 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
10132 | .need_dac_fix = 1, | |
10133 | .input_mux = &alc883_3stack_6ch_intel, | |
10134 | }, | |
87a8c370 JK |
10135 | [ALC889A_INTEL] = { |
10136 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
6732bd0d WF |
10137 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
10138 | alc_hp15_unsol_verbs }, | |
87a8c370 JK |
10139 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10140 | .dac_nids = alc883_dac_nids, | |
10141 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
10142 | .adc_nids = alc889_adc_nids, | |
10143 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10144 | .dig_in_nid = ALC883_DIGIN_NID, | |
10145 | .slave_dig_outs = alc883_slave_dig_outs, | |
10146 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
10147 | .channel_mode = alc889_8ch_intel_modes, | |
10148 | .capsrc_nids = alc889_capsrc_nids, | |
10149 | .input_mux = &alc889_capture_source, | |
4f5d1706 TI |
10150 | .setup = alc889_automute_setup, |
10151 | .init_hook = alc_automute_amp, | |
6732bd0d | 10152 | .unsol_event = alc_automute_amp_unsol_event, |
87a8c370 JK |
10153 | .need_dac_fix = 1, |
10154 | }, | |
10155 | [ALC889_INTEL] = { | |
10156 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | |
10157 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | |
6732bd0d | 10158 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
87a8c370 JK |
10159 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10160 | .dac_nids = alc883_dac_nids, | |
10161 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | |
10162 | .adc_nids = alc889_adc_nids, | |
10163 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10164 | .dig_in_nid = ALC883_DIGIN_NID, | |
10165 | .slave_dig_outs = alc883_slave_dig_outs, | |
10166 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | |
10167 | .channel_mode = alc889_8ch_intel_modes, | |
10168 | .capsrc_nids = alc889_capsrc_nids, | |
10169 | .input_mux = &alc889_capture_source, | |
4f5d1706 | 10170 | .setup = alc889_automute_setup, |
6732bd0d WF |
10171 | .init_hook = alc889_intel_init_hook, |
10172 | .unsol_event = alc_automute_amp_unsol_event, | |
87a8c370 JK |
10173 | .need_dac_fix = 1, |
10174 | }, | |
9c7f852e TI |
10175 | [ALC883_6ST_DIG] = { |
10176 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10177 | .init_verbs = { alc883_init_verbs }, | |
10178 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10179 | .dac_nids = alc883_dac_nids, | |
10180 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
10181 | .dig_in_nid = ALC883_DIGIN_NID, |
10182 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10183 | .channel_mode = alc883_sixstack_modes, | |
10184 | .input_mux = &alc883_capture_source, | |
10185 | }, | |
ccc656ce | 10186 | [ALC883_TARGA_DIG] = { |
c259249f | 10187 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
005b1076 DH |
10188 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
10189 | alc883_targa_verbs}, | |
ccc656ce KY |
10190 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10191 | .dac_nids = alc883_dac_nids, | |
10192 | .dig_out_nid = ALC883_DIGOUT_NID, | |
ccc656ce KY |
10193 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
10194 | .channel_mode = alc883_3ST_6ch_modes, | |
10195 | .need_dac_fix = 1, | |
10196 | .input_mux = &alc883_capture_source, | |
c259249f | 10197 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10198 | .setup = alc882_targa_setup, |
10199 | .init_hook = alc882_targa_automute, | |
ccc656ce KY |
10200 | }, |
10201 | [ALC883_TARGA_2ch_DIG] = { | |
c259249f | 10202 | .mixers = { alc883_targa_2ch_mixer}, |
005b1076 DH |
10203 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
10204 | alc883_targa_verbs}, | |
ccc656ce KY |
10205 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10206 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10207 | .adc_nids = alc883_adc_nids_alt, |
10208 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10209 | .capsrc_nids = alc883_capsrc_nids, |
ccc656ce | 10210 | .dig_out_nid = ALC883_DIGOUT_NID, |
ccc656ce KY |
10211 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10212 | .channel_mode = alc883_3ST_2ch_modes, | |
10213 | .input_mux = &alc883_capture_source, | |
c259249f | 10214 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10215 | .setup = alc882_targa_setup, |
10216 | .init_hook = alc882_targa_automute, | |
ccc656ce | 10217 | }, |
64a8be74 | 10218 | [ALC883_TARGA_8ch_DIG] = { |
b99dba34 TI |
10219 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
10220 | alc883_chmode_mixer }, | |
64a8be74 | 10221 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
c259249f | 10222 | alc883_targa_verbs }, |
64a8be74 DH |
10223 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10224 | .dac_nids = alc883_dac_nids, | |
10225 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10226 | .adc_nids = alc883_adc_nids_rev, | |
10227 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10228 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10229 | .dig_in_nid = ALC883_DIGIN_NID, | |
10230 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), | |
10231 | .channel_mode = alc883_4ST_8ch_modes, | |
10232 | .need_dac_fix = 1, | |
10233 | .input_mux = &alc883_capture_source, | |
c259249f | 10234 | .unsol_event = alc883_targa_unsol_event, |
4f5d1706 TI |
10235 | .setup = alc882_targa_setup, |
10236 | .init_hook = alc882_targa_automute, | |
64a8be74 | 10237 | }, |
bab282b9 | 10238 | [ALC883_ACER] = { |
676a9b53 | 10239 | .mixers = { alc883_base_mixer }, |
bab282b9 VA |
10240 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
10241 | * and the headphone jack. Turn this on and rely on the | |
10242 | * standard mute methods whenever the user wants to turn | |
10243 | * these outputs off. | |
10244 | */ | |
10245 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
10246 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10247 | .dac_nids = alc883_dac_nids, | |
bab282b9 VA |
10248 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10249 | .channel_mode = alc883_3ST_2ch_modes, | |
10250 | .input_mux = &alc883_capture_source, | |
10251 | }, | |
2880a867 | 10252 | [ALC883_ACER_ASPIRE] = { |
676a9b53 | 10253 | .mixers = { alc883_acer_aspire_mixer }, |
d1a991a6 | 10254 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
2880a867 TD |
10255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10256 | .dac_nids = alc883_dac_nids, | |
10257 | .dig_out_nid = ALC883_DIGOUT_NID, | |
2880a867 TD |
10258 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10259 | .channel_mode = alc883_3ST_2ch_modes, | |
10260 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10261 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10262 | .setup = alc883_acer_aspire_setup, |
10263 | .init_hook = alc_automute_amp, | |
d1a991a6 | 10264 | }, |
5b2d1eca | 10265 | [ALC888_ACER_ASPIRE_4930G] = { |
ef8ef5fb | 10266 | .mixers = { alc888_base_mixer, |
5b2d1eca VP |
10267 | alc883_chmode_mixer }, |
10268 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10269 | alc888_acer_aspire_4930g_verbs }, | |
10270 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10271 | .dac_nids = alc883_dac_nids, | |
10272 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10273 | .adc_nids = alc883_adc_nids_rev, | |
10274 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10275 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10276 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10277 | .channel_mode = alc883_3ST_6ch_modes, | |
10278 | .need_dac_fix = 1, | |
973b8cb0 | 10279 | .const_channel_count = 6, |
5b2d1eca | 10280 | .num_mux_defs = |
ef8ef5fb VP |
10281 | ARRAY_SIZE(alc888_2_capture_sources), |
10282 | .input_mux = alc888_2_capture_sources, | |
d2fd4b09 | 10283 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10284 | .setup = alc888_acer_aspire_4930g_setup, |
10285 | .init_hook = alc_automute_amp, | |
d2fd4b09 TV |
10286 | }, |
10287 | [ALC888_ACER_ASPIRE_6530G] = { | |
10288 | .mixers = { alc888_acer_aspire_6530_mixer }, | |
10289 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10290 | alc888_acer_aspire_6530g_verbs }, | |
10291 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10292 | .dac_nids = alc883_dac_nids, | |
10293 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10294 | .adc_nids = alc883_adc_nids_rev, | |
10295 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10296 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10297 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10298 | .channel_mode = alc883_3ST_2ch_modes, | |
10299 | .num_mux_defs = | |
10300 | ARRAY_SIZE(alc888_2_capture_sources), | |
10301 | .input_mux = alc888_acer_aspire_6530_sources, | |
a9fd4f3f | 10302 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10303 | .setup = alc888_acer_aspire_6530g_setup, |
10304 | .init_hook = alc_automute_amp, | |
5b2d1eca | 10305 | }, |
3b315d70 | 10306 | [ALC888_ACER_ASPIRE_8930G] = { |
556eea9a | 10307 | .mixers = { alc889_acer_aspire_8930g_mixer, |
3b315d70 HM |
10308 | alc883_chmode_mixer }, |
10309 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
0f86a228 HM |
10310 | alc889_acer_aspire_8930g_verbs, |
10311 | alc889_eapd_verbs}, | |
3b315d70 HM |
10312 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10313 | .dac_nids = alc883_dac_nids, | |
018df418 HM |
10314 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
10315 | .adc_nids = alc889_adc_nids, | |
10316 | .capsrc_nids = alc889_capsrc_nids, | |
3b315d70 HM |
10317 | .dig_out_nid = ALC883_DIGOUT_NID, |
10318 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10319 | .channel_mode = alc883_3ST_6ch_modes, | |
10320 | .need_dac_fix = 1, | |
10321 | .const_channel_count = 6, | |
10322 | .num_mux_defs = | |
018df418 HM |
10323 | ARRAY_SIZE(alc889_capture_sources), |
10324 | .input_mux = alc889_capture_sources, | |
3b315d70 | 10325 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10326 | .setup = alc889_acer_aspire_8930g_setup, |
10327 | .init_hook = alc_automute_amp, | |
f5de24b0 | 10328 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
c97259df | 10329 | .power_hook = alc_power_eapd, |
f5de24b0 | 10330 | #endif |
3b315d70 | 10331 | }, |
fc86f954 DK |
10332 | [ALC888_ACER_ASPIRE_7730G] = { |
10333 | .mixers = { alc883_3ST_6ch_mixer, | |
10334 | alc883_chmode_mixer }, | |
10335 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | |
10336 | alc888_acer_aspire_7730G_verbs }, | |
10337 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10338 | .dac_nids = alc883_dac_nids, | |
10339 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10340 | .adc_nids = alc883_adc_nids_rev, | |
10341 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10342 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10343 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10344 | .channel_mode = alc883_3ST_6ch_modes, | |
10345 | .need_dac_fix = 1, | |
10346 | .const_channel_count = 6, | |
10347 | .input_mux = &alc883_capture_source, | |
10348 | .unsol_event = alc_automute_amp_unsol_event, | |
d9477207 | 10349 | .setup = alc888_acer_aspire_7730g_setup, |
fc86f954 DK |
10350 | .init_hook = alc_automute_amp, |
10351 | }, | |
c07584c8 TD |
10352 | [ALC883_MEDION] = { |
10353 | .mixers = { alc883_fivestack_mixer, | |
10354 | alc883_chmode_mixer }, | |
10355 | .init_verbs = { alc883_init_verbs, | |
b373bdeb | 10356 | alc883_medion_eapd_verbs }, |
c07584c8 TD |
10357 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10358 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10359 | .adc_nids = alc883_adc_nids_alt, |
10360 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10361 | .capsrc_nids = alc883_capsrc_nids, |
c07584c8 TD |
10362 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10363 | .channel_mode = alc883_sixstack_modes, | |
10364 | .input_mux = &alc883_capture_source, | |
b373bdeb | 10365 | }, |
7ad7b218 MC |
10366 | [ALC883_MEDION_WIM2160] = { |
10367 | .mixers = { alc883_medion_wim2160_mixer }, | |
10368 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | |
10369 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10370 | .dac_nids = alc883_dac_nids, | |
10371 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10372 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
10373 | .adc_nids = alc883_adc_nids, | |
10374 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10375 | .channel_mode = alc883_3ST_2ch_modes, | |
10376 | .input_mux = &alc883_capture_source, | |
10377 | .unsol_event = alc_automute_amp_unsol_event, | |
10378 | .setup = alc883_medion_wim2160_setup, | |
10379 | .init_hook = alc_automute_amp, | |
10380 | }, | |
b373bdeb | 10381 | [ALC883_LAPTOP_EAPD] = { |
676a9b53 | 10382 | .mixers = { alc883_base_mixer }, |
b373bdeb AN |
10383 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
10384 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10385 | .dac_nids = alc883_dac_nids, | |
b373bdeb AN |
10386 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10387 | .channel_mode = alc883_3ST_2ch_modes, | |
10388 | .input_mux = &alc883_capture_source, | |
10389 | }, | |
a65cc60f | 10390 | [ALC883_CLEVO_M540R] = { |
10391 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10392 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | |
10393 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10394 | .dac_nids = alc883_dac_nids, | |
10395 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10396 | .dig_in_nid = ALC883_DIGIN_NID, | |
10397 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | |
10398 | .channel_mode = alc883_3ST_6ch_clevo_modes, | |
10399 | .need_dac_fix = 1, | |
10400 | .input_mux = &alc883_capture_source, | |
10401 | /* This machine has the hardware HP auto-muting, thus | |
10402 | * we need no software mute via unsol event | |
10403 | */ | |
10404 | }, | |
0c4cc443 HRK |
10405 | [ALC883_CLEVO_M720] = { |
10406 | .mixers = { alc883_clevo_m720_mixer }, | |
10407 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
368c7a95 J |
10408 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10409 | .dac_nids = alc883_dac_nids, | |
10410 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10411 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10412 | .channel_mode = alc883_3ST_2ch_modes, | |
10413 | .input_mux = &alc883_capture_source, | |
0c4cc443 | 10414 | .unsol_event = alc883_clevo_m720_unsol_event, |
4f5d1706 | 10415 | .setup = alc883_clevo_m720_setup, |
a9fd4f3f | 10416 | .init_hook = alc883_clevo_m720_init_hook, |
368c7a95 | 10417 | }, |
bc9f98a9 KY |
10418 | [ALC883_LENOVO_101E_2ch] = { |
10419 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
10420 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
10421 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10422 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
10423 | .adc_nids = alc883_adc_nids_alt, |
10424 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
035eb0cf | 10425 | .capsrc_nids = alc883_capsrc_nids, |
bc9f98a9 KY |
10426 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10427 | .channel_mode = alc883_3ST_2ch_modes, | |
10428 | .input_mux = &alc883_lenovo_101e_capture_source, | |
10429 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
10430 | .init_hook = alc883_lenovo_101e_all_automute, | |
10431 | }, | |
272a527c KY |
10432 | [ALC883_LENOVO_NB0763] = { |
10433 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
10434 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
10435 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10436 | .dac_nids = alc883_dac_nids, | |
272a527c KY |
10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10438 | .channel_mode = alc883_3ST_2ch_modes, | |
10439 | .need_dac_fix = 1, | |
10440 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
a9fd4f3f | 10441 | .unsol_event = alc_automute_amp_unsol_event, |
dc427170 | 10442 | .setup = alc883_lenovo_nb0763_setup, |
4f5d1706 | 10443 | .init_hook = alc_automute_amp, |
272a527c KY |
10444 | }, |
10445 | [ALC888_LENOVO_MS7195_DIG] = { | |
10446 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10447 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
10448 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10449 | .dac_nids = alc883_dac_nids, | |
10450 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
10451 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
10452 | .channel_mode = alc883_3ST_6ch_modes, | |
10453 | .need_dac_fix = 1, | |
10454 | .input_mux = &alc883_capture_source, | |
10455 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
10456 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
189609ae KY |
10457 | }, |
10458 | [ALC883_HAIER_W66] = { | |
c259249f | 10459 | .mixers = { alc883_targa_2ch_mixer}, |
189609ae KY |
10460 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
10461 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10462 | .dac_nids = alc883_dac_nids, | |
10463 | .dig_out_nid = ALC883_DIGOUT_NID, | |
189609ae KY |
10464 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10465 | .channel_mode = alc883_3ST_2ch_modes, | |
10466 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10467 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10468 | .setup = alc883_haier_w66_setup, |
10469 | .init_hook = alc_automute_amp, | |
eea6419e | 10470 | }, |
4723c022 | 10471 | [ALC888_3ST_HP] = { |
eea6419e | 10472 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
4723c022 | 10473 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
8341de60 CM |
10474 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
10475 | .dac_nids = alc883_dac_nids, | |
4723c022 CM |
10476 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
10477 | .channel_mode = alc888_3st_hp_modes, | |
8341de60 CM |
10478 | .need_dac_fix = 1, |
10479 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10480 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10481 | .setup = alc888_3st_hp_setup, |
10482 | .init_hook = alc_automute_amp, | |
8341de60 | 10483 | }, |
5795b9e6 | 10484 | [ALC888_6ST_DELL] = { |
f24dbdc6 | 10485 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
5795b9e6 CM |
10486 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
10487 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10488 | .dac_nids = alc883_dac_nids, | |
10489 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5795b9e6 CM |
10490 | .dig_in_nid = ALC883_DIGIN_NID, |
10491 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
10492 | .channel_mode = alc883_sixstack_modes, | |
10493 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10494 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10495 | .setup = alc888_6st_dell_setup, |
10496 | .init_hook = alc_automute_amp, | |
5795b9e6 | 10497 | }, |
a8848bd6 AS |
10498 | [ALC883_MITAC] = { |
10499 | .mixers = { alc883_mitac_mixer }, | |
10500 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
10501 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10502 | .dac_nids = alc883_dac_nids, | |
a8848bd6 AS |
10503 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
10504 | .channel_mode = alc883_3ST_2ch_modes, | |
10505 | .input_mux = &alc883_capture_source, | |
a9fd4f3f | 10506 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10507 | .setup = alc883_mitac_setup, |
10508 | .init_hook = alc_automute_amp, | |
a8848bd6 | 10509 | }, |
fb97dc67 J |
10510 | [ALC883_FUJITSU_PI2515] = { |
10511 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
10512 | .init_verbs = { alc883_init_verbs, | |
10513 | alc883_2ch_fujitsu_pi2515_verbs}, | |
10514 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10515 | .dac_nids = alc883_dac_nids, | |
10516 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10517 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10518 | .channel_mode = alc883_3ST_2ch_modes, | |
10519 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
a9fd4f3f | 10520 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10521 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
10522 | .init_hook = alc_automute_amp, | |
fb97dc67 | 10523 | }, |
ef8ef5fb VP |
10524 | [ALC888_FUJITSU_XA3530] = { |
10525 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | |
10526 | .init_verbs = { alc883_init_verbs, | |
10527 | alc888_fujitsu_xa3530_verbs }, | |
10528 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10529 | .dac_nids = alc883_dac_nids, | |
10530 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | |
10531 | .adc_nids = alc883_adc_nids_rev, | |
10532 | .capsrc_nids = alc883_capsrc_nids_rev, | |
10533 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10534 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), | |
10535 | .channel_mode = alc888_4ST_8ch_intel_modes, | |
10536 | .num_mux_defs = | |
10537 | ARRAY_SIZE(alc888_2_capture_sources), | |
10538 | .input_mux = alc888_2_capture_sources, | |
a9fd4f3f | 10539 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10540 | .setup = alc888_fujitsu_xa3530_setup, |
10541 | .init_hook = alc_automute_amp, | |
ef8ef5fb | 10542 | }, |
e2757d5e KY |
10543 | [ALC888_LENOVO_SKY] = { |
10544 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | |
10545 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | |
10546 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10547 | .dac_nids = alc883_dac_nids, | |
10548 | .dig_out_nid = ALC883_DIGOUT_NID, | |
e2757d5e KY |
10549 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10550 | .channel_mode = alc883_sixstack_modes, | |
10551 | .need_dac_fix = 1, | |
10552 | .input_mux = &alc883_lenovo_sky_capture_source, | |
a9fd4f3f | 10553 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
10554 | .setup = alc888_lenovo_sky_setup, |
10555 | .init_hook = alc_automute_amp, | |
e2757d5e KY |
10556 | }, |
10557 | [ALC888_ASUS_M90V] = { | |
10558 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
10559 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | |
10560 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10561 | .dac_nids = alc883_dac_nids, | |
10562 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10563 | .dig_in_nid = ALC883_DIGIN_NID, | |
10564 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
10565 | .channel_mode = alc883_3ST_6ch_modes, | |
10566 | .need_dac_fix = 1, | |
10567 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
4f5d1706 TI |
10568 | .unsol_event = alc_sku_unsol_event, |
10569 | .setup = alc883_mode2_setup, | |
10570 | .init_hook = alc_inithook, | |
e2757d5e KY |
10571 | }, |
10572 | [ALC888_ASUS_EEE1601] = { | |
10573 | .mixers = { alc883_asus_eee1601_mixer }, | |
f9e336f6 | 10574 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
e2757d5e KY |
10575 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
10576 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10577 | .dac_nids = alc883_dac_nids, | |
10578 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10579 | .dig_in_nid = ALC883_DIGIN_NID, | |
10580 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10581 | .channel_mode = alc883_3ST_2ch_modes, | |
10582 | .need_dac_fix = 1, | |
10583 | .input_mux = &alc883_asus_eee1601_capture_source, | |
a9fd4f3f | 10584 | .unsol_event = alc_sku_unsol_event, |
e2757d5e KY |
10585 | .init_hook = alc883_eee1601_inithook, |
10586 | }, | |
3ab90935 WF |
10587 | [ALC1200_ASUS_P5Q] = { |
10588 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
10589 | .init_verbs = { alc883_init_verbs }, | |
10590 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10591 | .dac_nids = alc883_dac_nids, | |
10592 | .dig_out_nid = ALC1200_DIGOUT_NID, | |
10593 | .dig_in_nid = ALC883_DIGIN_NID, | |
b25c9da1 | 10594 | .slave_dig_outs = alc1200_slave_dig_outs, |
3ab90935 WF |
10595 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
10596 | .channel_mode = alc883_sixstack_modes, | |
10597 | .input_mux = &alc883_capture_source, | |
10598 | }, | |
eb4c41d3 TS |
10599 | [ALC889A_MB31] = { |
10600 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, | |
10601 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, | |
10602 | alc880_gpio1_init_verbs }, | |
10603 | .adc_nids = alc883_adc_nids, | |
10604 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
035eb0cf | 10605 | .capsrc_nids = alc883_capsrc_nids, |
eb4c41d3 TS |
10606 | .dac_nids = alc883_dac_nids, |
10607 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10608 | .channel_mode = alc889A_mb31_6ch_modes, | |
10609 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), | |
10610 | .input_mux = &alc889A_mb31_capture_source, | |
10611 | .dig_out_nid = ALC883_DIGOUT_NID, | |
10612 | .unsol_event = alc889A_mb31_unsol_event, | |
10613 | .init_hook = alc889A_mb31_automute, | |
10614 | }, | |
3e1647c5 GG |
10615 | [ALC883_SONY_VAIO_TT] = { |
10616 | .mixers = { alc883_vaiott_mixer }, | |
10617 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, | |
10618 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
10619 | .dac_nids = alc883_dac_nids, | |
10620 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
10621 | .channel_mode = alc883_3ST_2ch_modes, | |
10622 | .input_mux = &alc883_capture_source, | |
10623 | .unsol_event = alc_automute_amp_unsol_event, | |
4f5d1706 TI |
10624 | .setup = alc883_vaiott_setup, |
10625 | .init_hook = alc_automute_amp, | |
3e1647c5 | 10626 | }, |
9c7f852e TI |
10627 | }; |
10628 | ||
10629 | ||
4953550a TI |
10630 | /* |
10631 | * Pin config fixes | |
10632 | */ | |
10633 | enum { | |
954a29c8 TI |
10634 | PINFIX_ABIT_AW9D_MAX, |
10635 | PINFIX_PB_M5210, | |
c3d226ab | 10636 | PINFIX_ACER_ASPIRE_7736, |
4953550a TI |
10637 | }; |
10638 | ||
f8f25ba3 TI |
10639 | static const struct alc_fixup alc882_fixups[] = { |
10640 | [PINFIX_ABIT_AW9D_MAX] = { | |
73413b12 TI |
10641 | .pins = (const struct alc_pincfg[]) { |
10642 | { 0x15, 0x01080104 }, /* side */ | |
10643 | { 0x16, 0x01011012 }, /* rear */ | |
10644 | { 0x17, 0x01016011 }, /* clfe */ | |
10645 | { } | |
10646 | } | |
f8f25ba3 | 10647 | }, |
954a29c8 | 10648 | [PINFIX_PB_M5210] = { |
73413b12 TI |
10649 | .verbs = (const struct hda_verb[]) { |
10650 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | |
10651 | {} | |
10652 | } | |
954a29c8 | 10653 | }, |
c3d226ab DH |
10654 | [PINFIX_ACER_ASPIRE_7736] = { |
10655 | .sku = ALC_FIXUP_SKU_IGNORE, | |
10656 | }, | |
4953550a TI |
10657 | }; |
10658 | ||
f8f25ba3 | 10659 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
954a29c8 | 10660 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
4953550a | 10661 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
c3d226ab | 10662 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
4953550a TI |
10663 | {} |
10664 | }; | |
10665 | ||
9c7f852e TI |
10666 | /* |
10667 | * BIOS auto configuration | |
10668 | */ | |
05f5f477 TI |
10669 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
10670 | const struct auto_pin_cfg *cfg) | |
10671 | { | |
10672 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | |
10673 | } | |
10674 | ||
4953550a | 10675 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
9c7f852e | 10676 | hda_nid_t nid, int pin_type, |
489008cd | 10677 | hda_nid_t dac) |
9c7f852e | 10678 | { |
f12ab1e0 TI |
10679 | int idx; |
10680 | ||
489008cd | 10681 | /* set as output */ |
f6c7e546 | 10682 | alc_set_pin_output(codec, nid, pin_type); |
489008cd TI |
10683 | |
10684 | if (dac == 0x25) | |
9c7f852e | 10685 | idx = 4; |
489008cd TI |
10686 | else if (dac >= 0x02 && dac <= 0x05) |
10687 | idx = dac - 2; | |
f9700d5a | 10688 | else |
489008cd | 10689 | return; |
9c7f852e | 10690 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
9c7f852e TI |
10691 | } |
10692 | ||
4953550a | 10693 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
9c7f852e TI |
10694 | { |
10695 | struct alc_spec *spec = codec->spec; | |
10696 | int i; | |
10697 | ||
10698 | for (i = 0; i <= HDA_SIDE; i++) { | |
f12ab1e0 | 10699 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 10700 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
9c7f852e | 10701 | if (nid) |
4953550a | 10702 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
489008cd | 10703 | spec->multiout.dac_nids[i]); |
9c7f852e TI |
10704 | } |
10705 | } | |
10706 | ||
4953550a | 10707 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
9c7f852e TI |
10708 | { |
10709 | struct alc_spec *spec = codec->spec; | |
489008cd | 10710 | hda_nid_t pin, dac; |
5855fb80 | 10711 | int i; |
9c7f852e | 10712 | |
5855fb80 TI |
10713 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
10714 | pin = spec->autocfg.hp_pins[i]; | |
10715 | if (!pin) | |
10716 | break; | |
489008cd TI |
10717 | dac = spec->multiout.hp_nid; |
10718 | if (!dac) | |
10719 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10720 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | |
10721 | } | |
5855fb80 TI |
10722 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
10723 | pin = spec->autocfg.speaker_pins[i]; | |
10724 | if (!pin) | |
10725 | break; | |
489008cd TI |
10726 | dac = spec->multiout.extra_out_nid[0]; |
10727 | if (!dac) | |
10728 | dac = spec->multiout.dac_nids[0]; /* to front */ | |
10729 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | |
10730 | } | |
9c7f852e TI |
10731 | } |
10732 | ||
4953550a | 10733 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
9c7f852e TI |
10734 | { |
10735 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 10736 | struct auto_pin_cfg *cfg = &spec->autocfg; |
9c7f852e TI |
10737 | int i; |
10738 | ||
66ceeb6b TI |
10739 | for (i = 0; i < cfg->num_inputs; i++) { |
10740 | hda_nid_t nid = cfg->inputs[i].pin; | |
30ea098f | 10741 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
4953550a TI |
10742 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
10743 | snd_hda_codec_write(codec, nid, 0, | |
10744 | AC_VERB_SET_AMP_GAIN_MUTE, | |
10745 | AMP_OUT_MUTE); | |
10746 | } | |
10747 | } | |
10748 | ||
10749 | static void alc882_auto_init_input_src(struct hda_codec *codec) | |
10750 | { | |
10751 | struct alc_spec *spec = codec->spec; | |
10752 | int c; | |
10753 | ||
10754 | for (c = 0; c < spec->num_adc_nids; c++) { | |
10755 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | |
10756 | hda_nid_t nid = spec->capsrc_nids[c]; | |
10757 | unsigned int mux_idx; | |
10758 | const struct hda_input_mux *imux; | |
10759 | int conns, mute, idx, item; | |
10760 | ||
10761 | conns = snd_hda_get_connections(codec, nid, conn_list, | |
10762 | ARRAY_SIZE(conn_list)); | |
10763 | if (conns < 0) | |
10764 | continue; | |
10765 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | |
10766 | imux = &spec->input_mux[mux_idx]; | |
5311114d TI |
10767 | if (!imux->num_items && mux_idx > 0) |
10768 | imux = &spec->input_mux[0]; | |
4953550a TI |
10769 | for (idx = 0; idx < conns; idx++) { |
10770 | /* if the current connection is the selected one, | |
10771 | * unmute it as default - otherwise mute it | |
10772 | */ | |
10773 | mute = AMP_IN_MUTE(idx); | |
10774 | for (item = 0; item < imux->num_items; item++) { | |
10775 | if (imux->items[item].index == idx) { | |
10776 | if (spec->cur_mux[c] == item) | |
10777 | mute = AMP_IN_UNMUTE(idx); | |
10778 | break; | |
10779 | } | |
10780 | } | |
10781 | /* check if we have a selector or mixer | |
10782 | * we could check for the widget type instead, but | |
10783 | * just check for Amp-In presence (in case of mixer | |
10784 | * without amp-in there is something wrong, this | |
10785 | * function shouldn't be used or capsrc nid is wrong) | |
10786 | */ | |
10787 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | |
9c7f852e TI |
10788 | snd_hda_codec_write(codec, nid, 0, |
10789 | AC_VERB_SET_AMP_GAIN_MUTE, | |
4953550a TI |
10790 | mute); |
10791 | else if (mute != AMP_IN_MUTE(idx)) | |
10792 | snd_hda_codec_write(codec, nid, 0, | |
10793 | AC_VERB_SET_CONNECT_SEL, | |
10794 | idx); | |
9c7f852e TI |
10795 | } |
10796 | } | |
10797 | } | |
10798 | ||
4953550a TI |
10799 | /* add mic boosts if needed */ |
10800 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
10801 | { | |
10802 | struct alc_spec *spec = codec->spec; | |
66ceeb6b TI |
10803 | struct auto_pin_cfg *cfg = &spec->autocfg; |
10804 | int i, err; | |
4953550a TI |
10805 | hda_nid_t nid; |
10806 | ||
66ceeb6b | 10807 | for (i = 0; i < cfg->num_inputs; i++) { |
86e2959a | 10808 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
66ceeb6b TI |
10809 | break; |
10810 | nid = cfg->inputs[i].pin; | |
10811 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { | |
10a20af7 TI |
10812 | char label[32]; |
10813 | snprintf(label, sizeof(label), "%s Boost", | |
10814 | hda_get_autocfg_input_label(codec, cfg, i)); | |
66ceeb6b | 10815 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, |
4953550a | 10816 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
66ceeb6b TI |
10817 | if (err < 0) |
10818 | return err; | |
10819 | } | |
4953550a TI |
10820 | } |
10821 | return 0; | |
10822 | } | |
f511b01c | 10823 | |
9c7f852e | 10824 | /* almost identical with ALC880 parser... */ |
4953550a | 10825 | static int alc882_parse_auto_config(struct hda_codec *codec) |
9c7f852e TI |
10826 | { |
10827 | struct alc_spec *spec = codec->spec; | |
05f5f477 | 10828 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
757899ac | 10829 | int err; |
9c7f852e | 10830 | |
05f5f477 TI |
10831 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
10832 | alc882_ignore); | |
9c7f852e TI |
10833 | if (err < 0) |
10834 | return err; | |
05f5f477 TI |
10835 | if (!spec->autocfg.line_outs) |
10836 | return 0; /* can't find valid BIOS pin config */ | |
776e184e | 10837 | |
05f5f477 TI |
10838 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
10839 | if (err < 0) | |
10840 | return err; | |
10841 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
489008cd TI |
10842 | if (err < 0) |
10843 | return err; | |
10844 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
10845 | "Headphone"); | |
05f5f477 TI |
10846 | if (err < 0) |
10847 | return err; | |
10848 | err = alc880_auto_create_extra_out(spec, | |
10849 | spec->autocfg.speaker_pins[0], | |
10850 | "Speaker"); | |
10851 | if (err < 0) | |
10852 | return err; | |
05f5f477 | 10853 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
776e184e TI |
10854 | if (err < 0) |
10855 | return err; | |
10856 | ||
05f5f477 TI |
10857 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
10858 | ||
757899ac | 10859 | alc_auto_parse_digital(codec); |
05f5f477 TI |
10860 | |
10861 | if (spec->kctls.list) | |
10862 | add_mixer(spec, spec->kctls.list); | |
10863 | ||
10864 | add_verb(spec, alc883_auto_init_verbs); | |
4953550a | 10865 | /* if ADC 0x07 is available, initialize it, too */ |
05f5f477 | 10866 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
4953550a | 10867 | add_verb(spec, alc882_adc1_init_verbs); |
776e184e | 10868 | |
05f5f477 TI |
10869 | spec->num_mux_defs = 1; |
10870 | spec->input_mux = &spec->private_imux[0]; | |
10871 | ||
6227cdce | 10872 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
05f5f477 TI |
10873 | |
10874 | err = alc_auto_add_mic_boost(codec); | |
10875 | if (err < 0) | |
10876 | return err; | |
61b9b9b1 | 10877 | |
776e184e | 10878 | return 1; /* config found */ |
9c7f852e TI |
10879 | } |
10880 | ||
10881 | /* additional initialization for auto-configuration model */ | |
4953550a | 10882 | static void alc882_auto_init(struct hda_codec *codec) |
9c7f852e | 10883 | { |
f6c7e546 | 10884 | struct alc_spec *spec = codec->spec; |
4953550a TI |
10885 | alc882_auto_init_multi_out(codec); |
10886 | alc882_auto_init_hp_out(codec); | |
10887 | alc882_auto_init_analog_input(codec); | |
10888 | alc882_auto_init_input_src(codec); | |
757899ac | 10889 | alc_auto_init_digital(codec); |
f6c7e546 | 10890 | if (spec->unsol_event) |
7fb0d78f | 10891 | alc_inithook(codec); |
9c7f852e TI |
10892 | } |
10893 | ||
4953550a | 10894 | static int patch_alc882(struct hda_codec *codec) |
9c7f852e TI |
10895 | { |
10896 | struct alc_spec *spec; | |
10897 | int err, board_config; | |
10898 | ||
10899 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
10900 | if (spec == NULL) | |
10901 | return -ENOMEM; | |
10902 | ||
10903 | codec->spec = spec; | |
10904 | ||
4953550a TI |
10905 | switch (codec->vendor_id) { |
10906 | case 0x10ec0882: | |
10907 | case 0x10ec0885: | |
10908 | break; | |
10909 | default: | |
10910 | /* ALC883 and variants */ | |
10911 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
10912 | break; | |
10913 | } | |
2c3bf9ab | 10914 | |
4953550a TI |
10915 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
10916 | alc882_models, | |
10917 | alc882_cfg_tbl); | |
10918 | ||
10919 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) | |
10920 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
10921 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); | |
10922 | ||
10923 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
9a11f1aa | 10924 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
4953550a TI |
10925 | codec->chip_name); |
10926 | board_config = ALC882_AUTO; | |
9c7f852e TI |
10927 | } |
10928 | ||
7fa90e87 TI |
10929 | if (board_config == ALC882_AUTO) |
10930 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); | |
4953550a | 10931 | |
90622917 DH |
10932 | alc_auto_parse_customize_define(codec); |
10933 | ||
4953550a | 10934 | if (board_config == ALC882_AUTO) { |
9c7f852e | 10935 | /* automatic parse from the BIOS config */ |
4953550a | 10936 | err = alc882_parse_auto_config(codec); |
9c7f852e TI |
10937 | if (err < 0) { |
10938 | alc_free(codec); | |
10939 | return err; | |
f12ab1e0 | 10940 | } else if (!err) { |
9c7f852e TI |
10941 | printk(KERN_INFO |
10942 | "hda_codec: Cannot set up configuration " | |
10943 | "from BIOS. Using base mode...\n"); | |
4953550a | 10944 | board_config = ALC882_3ST_DIG; |
9c7f852e TI |
10945 | } |
10946 | } | |
10947 | ||
dc1eae25 | 10948 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
10949 | err = snd_hda_attach_beep_device(codec, 0x1); |
10950 | if (err < 0) { | |
10951 | alc_free(codec); | |
10952 | return err; | |
10953 | } | |
680cd536 KK |
10954 | } |
10955 | ||
4953550a | 10956 | if (board_config != ALC882_AUTO) |
e9c364c0 | 10957 | setup_preset(codec, &alc882_presets[board_config]); |
9c7f852e | 10958 | |
4953550a TI |
10959 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
10960 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
10961 | /* FIXME: setup DAC5 */ | |
10962 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
10963 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
10964 | ||
10965 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | |
10966 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
10967 | ||
4953550a | 10968 | if (!spec->adc_nids && spec->input_mux) { |
d11f74c6 | 10969 | int i, j; |
4953550a TI |
10970 | spec->num_adc_nids = 0; |
10971 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | |
d11f74c6 | 10972 | const struct hda_input_mux *imux = spec->input_mux; |
4953550a | 10973 | hda_nid_t cap; |
d11f74c6 | 10974 | hda_nid_t items[16]; |
4953550a TI |
10975 | hda_nid_t nid = alc882_adc_nids[i]; |
10976 | unsigned int wcap = get_wcaps(codec, nid); | |
10977 | /* get type */ | |
a22d543a | 10978 | wcap = get_wcaps_type(wcap); |
4953550a TI |
10979 | if (wcap != AC_WID_AUD_IN) |
10980 | continue; | |
10981 | spec->private_adc_nids[spec->num_adc_nids] = nid; | |
10982 | err = snd_hda_get_connections(codec, nid, &cap, 1); | |
10983 | if (err < 0) | |
10984 | continue; | |
d11f74c6 TI |
10985 | err = snd_hda_get_connections(codec, cap, items, |
10986 | ARRAY_SIZE(items)); | |
10987 | if (err < 0) | |
10988 | continue; | |
10989 | for (j = 0; j < imux->num_items; j++) | |
10990 | if (imux->items[j].index >= err) | |
10991 | break; | |
10992 | if (j < imux->num_items) | |
10993 | continue; | |
4953550a TI |
10994 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
10995 | spec->num_adc_nids++; | |
61b9b9b1 | 10996 | } |
4953550a TI |
10997 | spec->adc_nids = spec->private_adc_nids; |
10998 | spec->capsrc_nids = spec->private_capsrc_nids; | |
2f893286 KY |
10999 | } |
11000 | ||
b59bdf3b | 11001 | set_capture_mixer(codec); |
da00c244 | 11002 | |
dc1eae25 | 11003 | if (has_cdefine_beep(codec)) |
da00c244 | 11004 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
9c7f852e | 11005 | |
7fa90e87 TI |
11006 | if (board_config == ALC882_AUTO) |
11007 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); | |
11008 | ||
2134ea4f TI |
11009 | spec->vmaster_nid = 0x0c; |
11010 | ||
9c7f852e | 11011 | codec->patch_ops = alc_patch_ops; |
4953550a TI |
11012 | if (board_config == ALC882_AUTO) |
11013 | spec->init_hook = alc882_auto_init; | |
bf1b0225 KY |
11014 | |
11015 | alc_init_jacks(codec); | |
cb53c626 TI |
11016 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
11017 | if (!spec->loopback.amplist) | |
4953550a | 11018 | spec->loopback.amplist = alc882_loopbacks; |
cb53c626 | 11019 | #endif |
9c7f852e TI |
11020 | |
11021 | return 0; | |
11022 | } | |
11023 | ||
4953550a | 11024 | |
9c7f852e TI |
11025 | /* |
11026 | * ALC262 support | |
11027 | */ | |
11028 | ||
11029 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
11030 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
11031 | ||
11032 | #define alc262_dac_nids alc260_dac_nids | |
11033 | #define alc262_adc_nids alc882_adc_nids | |
11034 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
88c71a99 TI |
11035 | #define alc262_capsrc_nids alc882_capsrc_nids |
11036 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
9c7f852e TI |
11037 | |
11038 | #define alc262_modes alc260_modes | |
11039 | #define alc262_capture_source alc882_capture_source | |
11040 | ||
4e555fe5 KY |
11041 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
11042 | /* ADC0 */ | |
11043 | 0x09 | |
11044 | }; | |
11045 | ||
11046 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | |
11047 | ||
9c7f852e TI |
11048 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
11049 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11050 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11051 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11052 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11053 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11054 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11055 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11056 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 11057 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
11058 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11059 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 11060 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
11061 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
11062 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11063 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
11064 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
11065 | { } /* end */ | |
11066 | }; | |
11067 | ||
ce875f07 TI |
11068 | /* update HP, line and mono-out pins according to the master switch */ |
11069 | static void alc262_hp_master_update(struct hda_codec *codec) | |
11070 | { | |
11071 | struct alc_spec *spec = codec->spec; | |
11072 | int val = spec->master_sw; | |
11073 | ||
11074 | /* HP & line-out */ | |
11075 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
11076 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11077 | val ? PIN_HP : 0); | |
11078 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
11079 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11080 | val ? PIN_HP : 0); | |
11081 | /* mono (speaker) depending on the HP jack sense */ | |
11082 | val = val && !spec->jack_present; | |
11083 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
11084 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11085 | val ? PIN_OUT : 0); | |
11086 | } | |
11087 | ||
11088 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
11089 | { | |
11090 | struct alc_spec *spec = codec->spec; | |
864f92be WF |
11091 | |
11092 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | |
ce875f07 TI |
11093 | alc262_hp_master_update(codec); |
11094 | } | |
11095 | ||
11096 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
11097 | { | |
11098 | if ((res >> 26) != ALC880_HP_EVENT) | |
11099 | return; | |
11100 | alc262_hp_bpc_automute(codec); | |
11101 | } | |
11102 | ||
11103 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
11104 | { | |
11105 | struct alc_spec *spec = codec->spec; | |
864f92be WF |
11106 | |
11107 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | |
ce875f07 TI |
11108 | alc262_hp_master_update(codec); |
11109 | } | |
11110 | ||
11111 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
11112 | unsigned int res) | |
11113 | { | |
11114 | if ((res >> 26) != ALC880_HP_EVENT) | |
11115 | return; | |
11116 | alc262_hp_wildwest_automute(codec); | |
11117 | } | |
11118 | ||
b72519b5 | 11119 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
ce875f07 TI |
11120 | |
11121 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
11122 | struct snd_ctl_elem_value *ucontrol) | |
11123 | { | |
11124 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11125 | struct alc_spec *spec = codec->spec; | |
11126 | int val = !!*ucontrol->value.integer.value; | |
11127 | ||
11128 | if (val == spec->master_sw) | |
11129 | return 0; | |
11130 | spec->master_sw = val; | |
11131 | alc262_hp_master_update(codec); | |
11132 | return 1; | |
11133 | } | |
11134 | ||
b72519b5 TI |
11135 | #define ALC262_HP_MASTER_SWITCH \ |
11136 | { \ | |
11137 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
11138 | .name = "Master Playback Switch", \ | |
11139 | .info = snd_ctl_boolean_mono_info, \ | |
11140 | .get = alc262_hp_master_sw_get, \ | |
11141 | .put = alc262_hp_master_sw_put, \ | |
5b0cb1d8 JK |
11142 | }, \ |
11143 | { \ | |
11144 | .iface = NID_MAPPING, \ | |
11145 | .name = "Master Playback Switch", \ | |
11146 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ | |
b72519b5 TI |
11147 | } |
11148 | ||
5b0cb1d8 | 11149 | |
9c7f852e | 11150 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
b72519b5 | 11151 | ALC262_HP_MASTER_SWITCH, |
9c7f852e TI |
11152 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11153 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11154 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
11155 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
11156 | HDA_OUTPUT), | |
11157 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
11158 | HDA_OUTPUT), | |
9c7f852e TI |
11159 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11160 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 11161 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
11162 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11163 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 11164 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
11165 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
11166 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11167 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11168 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9c7f852e TI |
11169 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
11170 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
11171 | { } /* end */ | |
11172 | }; | |
11173 | ||
cd7509a4 | 11174 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
b72519b5 | 11175 | ALC262_HP_MASTER_SWITCH, |
cd7509a4 KY |
11176 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11177 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
11178 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11179 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
11180 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
11181 | HDA_OUTPUT), | |
11182 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
11183 | HDA_OUTPUT), | |
cd7509a4 KY |
11184 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
11185 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
cc69d12d | 11186 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
cd7509a4 KY |
11187 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11188 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11189 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11190 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
cd7509a4 KY |
11191 | { } /* end */ |
11192 | }; | |
11193 | ||
11194 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
11195 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11196 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 11197 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
cd7509a4 KY |
11198 | { } /* end */ |
11199 | }; | |
11200 | ||
66d2a9d6 | 11201 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
4f5d1706 | 11202 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
66d2a9d6 KY |
11203 | { |
11204 | struct alc_spec *spec = codec->spec; | |
66d2a9d6 | 11205 | |
a9fd4f3f | 11206 | spec->autocfg.hp_pins[0] = 0x15; |
dc99be47 | 11207 | spec->autocfg.speaker_pins[0] = 0x14; |
66d2a9d6 KY |
11208 | } |
11209 | ||
66d2a9d6 | 11210 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
86cd9298 TI |
11211 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11212 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
66d2a9d6 KY |
11213 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
11214 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11217 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11218 | { } /* end */ | |
11219 | }; | |
11220 | ||
11221 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
11222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11223 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11224 | ||
11225 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11226 | { } | |
11227 | }; | |
11228 | ||
8c427226 | 11229 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
f2f48e18 TI |
11230 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11231 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
11232 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
11233 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
8c427226 KY |
11234 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11235 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11236 | { } /* end */ | |
11237 | }; | |
11238 | ||
11239 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
11240 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11241 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11242 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11243 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11244 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11245 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11246 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11247 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
11248 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11249 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
11250 | {} | |
11251 | }; | |
11252 | ||
11253 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
11254 | .num_items = 1, | |
11255 | .items = { | |
11256 | { "Line", 0x1 }, | |
11257 | }, | |
11258 | }; | |
11259 | ||
42171c17 TI |
11260 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
11261 | static void alc262_hippo_master_update(struct hda_codec *codec) | |
0724ea2a | 11262 | { |
42171c17 TI |
11263 | struct alc_spec *spec = codec->spec; |
11264 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11265 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
11266 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
11267 | unsigned int mute; | |
0724ea2a | 11268 | |
42171c17 TI |
11269 | /* HP */ |
11270 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; | |
11271 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, | |
11272 | HDA_AMP_MUTE, mute); | |
11273 | /* mute internal speaker per jack sense */ | |
11274 | if (spec->jack_present) | |
11275 | mute = HDA_AMP_MUTE; | |
11276 | if (line_nid) | |
11277 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, | |
11278 | HDA_AMP_MUTE, mute); | |
11279 | if (speaker_nid && speaker_nid != line_nid) | |
11280 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, | |
0724ea2a | 11281 | HDA_AMP_MUTE, mute); |
42171c17 TI |
11282 | } |
11283 | ||
11284 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get | |
11285 | ||
11286 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | |
11287 | struct snd_ctl_elem_value *ucontrol) | |
11288 | { | |
11289 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11290 | struct alc_spec *spec = codec->spec; | |
11291 | int val = !!*ucontrol->value.integer.value; | |
11292 | ||
11293 | if (val == spec->master_sw) | |
11294 | return 0; | |
11295 | spec->master_sw = val; | |
11296 | alc262_hippo_master_update(codec); | |
11297 | return 1; | |
11298 | } | |
11299 | ||
11300 | #define ALC262_HIPPO_MASTER_SWITCH \ | |
11301 | { \ | |
11302 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
11303 | .name = "Master Playback Switch", \ | |
11304 | .info = snd_ctl_boolean_mono_info, \ | |
11305 | .get = alc262_hippo_master_sw_get, \ | |
11306 | .put = alc262_hippo_master_sw_put, \ | |
5b0cb1d8 JK |
11307 | }, \ |
11308 | { \ | |
11309 | .iface = NID_MAPPING, \ | |
11310 | .name = "Master Playback Switch", \ | |
11311 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ | |
11312 | (SUBDEV_SPEAKER(0) << 16), \ | |
0724ea2a | 11313 | } |
42171c17 TI |
11314 | |
11315 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { | |
11316 | ALC262_HIPPO_MASTER_SWITCH, | |
11317 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11318 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11319 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11320 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11321 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11322 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11323 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11324 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11325 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11326 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11327 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11328 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11329 | { } /* end */ | |
11330 | }; | |
11331 | ||
11332 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | |
11333 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11334 | ALC262_HIPPO_MASTER_SWITCH, | |
11335 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11336 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11337 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11338 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11339 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11340 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11341 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11342 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11343 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11344 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11345 | { } /* end */ | |
11346 | }; | |
11347 | ||
11348 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
11349 | static void alc262_hippo_automute(struct hda_codec *codec) | |
11350 | { | |
11351 | struct alc_spec *spec = codec->spec; | |
11352 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
42171c17 | 11353 | |
864f92be | 11354 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
42171c17 | 11355 | alc262_hippo_master_update(codec); |
0724ea2a | 11356 | } |
5b31954e | 11357 | |
42171c17 TI |
11358 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
11359 | { | |
11360 | if ((res >> 26) != ALC880_HP_EVENT) | |
11361 | return; | |
11362 | alc262_hippo_automute(codec); | |
11363 | } | |
11364 | ||
4f5d1706 | 11365 | static void alc262_hippo_setup(struct hda_codec *codec) |
42171c17 TI |
11366 | { |
11367 | struct alc_spec *spec = codec->spec; | |
11368 | ||
11369 | spec->autocfg.hp_pins[0] = 0x15; | |
11370 | spec->autocfg.speaker_pins[0] = 0x14; | |
42171c17 TI |
11371 | } |
11372 | ||
4f5d1706 | 11373 | static void alc262_hippo1_setup(struct hda_codec *codec) |
42171c17 TI |
11374 | { |
11375 | struct alc_spec *spec = codec->spec; | |
11376 | ||
11377 | spec->autocfg.hp_pins[0] = 0x1b; | |
11378 | spec->autocfg.speaker_pins[0] = 0x14; | |
42171c17 TI |
11379 | } |
11380 | ||
11381 | ||
272a527c | 11382 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
0724ea2a | 11383 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
42171c17 | 11384 | ALC262_HIPPO_MASTER_SWITCH, |
272a527c KY |
11385 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11386 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11387 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11388 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11389 | { } /* end */ | |
11390 | }; | |
11391 | ||
83c34218 | 11392 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
42171c17 TI |
11393 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11394 | ALC262_HIPPO_MASTER_SWITCH, | |
83c34218 KY |
11395 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
11396 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11397 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11398 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11399 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11400 | { } /* end */ | |
11401 | }; | |
272a527c | 11402 | |
ba340e82 TV |
11403 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
11404 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11405 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
11406 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
11407 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
11408 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11409 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11410 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11411 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11412 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11413 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11414 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11415 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11416 | { } /* end */ | |
11417 | }; | |
11418 | ||
11419 | static struct hda_verb alc262_tyan_verbs[] = { | |
11420 | /* Headphone automute */ | |
11421 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11422 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11423 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11424 | ||
11425 | /* P11 AUX_IN, white 4-pin connector */ | |
11426 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11427 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | |
11428 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | |
11429 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | |
11430 | ||
11431 | {} | |
11432 | }; | |
11433 | ||
11434 | /* unsolicited event for HP jack sensing */ | |
4f5d1706 | 11435 | static void alc262_tyan_setup(struct hda_codec *codec) |
ba340e82 | 11436 | { |
a9fd4f3f | 11437 | struct alc_spec *spec = codec->spec; |
ba340e82 | 11438 | |
a9fd4f3f TI |
11439 | spec->autocfg.hp_pins[0] = 0x1b; |
11440 | spec->autocfg.speaker_pins[0] = 0x15; | |
ba340e82 TV |
11441 | } |
11442 | ||
ba340e82 | 11443 | |
9c7f852e TI |
11444 | #define alc262_capture_mixer alc882_capture_mixer |
11445 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
11446 | ||
11447 | /* | |
11448 | * generic initialization of ADC, input mixers and output mixers | |
11449 | */ | |
11450 | static struct hda_verb alc262_init_verbs[] = { | |
11451 | /* | |
11452 | * Unmute ADC0-2 and set the default input to mic-in | |
11453 | */ | |
11454 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11456 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11457 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11458 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11459 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11460 | ||
cb53c626 | 11461 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 11462 | * mixer widget |
f12ab1e0 TI |
11463 | * Note: PASD motherboards uses the Line In 2 as the input for |
11464 | * front panel mic (mic 2) | |
9c7f852e TI |
11465 | */ |
11466 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
11467 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
11468 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11469 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11470 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11471 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
11472 | |
11473 | /* | |
df694daa KY |
11474 | * Set up output mixers (0x0c - 0x0e) |
11475 | */ | |
11476 | /* set vol=0 to output mixers */ | |
11477 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11478 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11479 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11480 | /* set up input amps for analog loopback */ | |
11481 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
11482 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11483 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11484 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11485 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11486 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11487 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11488 | ||
11489 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11490 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11491 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11492 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11493 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11494 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11495 | ||
11496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11497 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11498 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11499 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11500 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
ea1fb29a | 11501 | |
df694daa KY |
11502 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
11503 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
ea1fb29a | 11504 | |
df694daa KY |
11505 | /* FIXME: use matrix-type input source selection */ |
11506 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
11507 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
11508 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11509 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11510 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11511 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11512 | /* Input mixer2 */ | |
11513 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11514 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11515 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
11516 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
11517 | /* Input mixer3 */ | |
11518 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
11519 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
11520 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
f12ab1e0 | 11521 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
df694daa KY |
11522 | |
11523 | { } | |
11524 | }; | |
1da177e4 | 11525 | |
4e555fe5 KY |
11526 | static struct hda_verb alc262_eapd_verbs[] = { |
11527 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11528 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
11529 | { } | |
11530 | }; | |
11531 | ||
ccc656ce KY |
11532 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
11533 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11534 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11535 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
11536 | ||
11537 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11538 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11539 | {} | |
11540 | }; | |
11541 | ||
272a527c KY |
11542 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
11543 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11544 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11545 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
11546 | ||
11547 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11548 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7b1e8795 | 11549 | {} |
272a527c KY |
11550 | }; |
11551 | ||
4e555fe5 KY |
11552 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
11553 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
11554 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11555 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11556 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11557 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4e555fe5 KY |
11558 | { } /* end */ |
11559 | }; | |
11560 | ||
11561 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | |
11562 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11563 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11564 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11565 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11566 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | |
11567 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11568 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11569 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11570 | {} | |
11571 | }; | |
11572 | ||
4f5d1706 | 11573 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
4e555fe5 | 11574 | { |
a9fd4f3f TI |
11575 | struct alc_spec *spec = codec->spec; |
11576 | ||
11577 | spec->autocfg.hp_pins[0] = 0x15; | |
11578 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
11579 | spec->ext_mic.pin = 0x18; |
11580 | spec->ext_mic.mux_idx = 0; | |
11581 | spec->int_mic.pin = 0x12; | |
11582 | spec->int_mic.mux_idx = 9; | |
11583 | spec->auto_mic = 1; | |
4e555fe5 KY |
11584 | } |
11585 | ||
e8f9ae2a PT |
11586 | /* |
11587 | * nec model | |
11588 | * 0x15 = headphone | |
11589 | * 0x16 = internal speaker | |
11590 | * 0x18 = external mic | |
11591 | */ | |
11592 | ||
11593 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | |
11594 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
11595 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | |
11596 | ||
11597 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11598 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11599 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11600 | ||
11601 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
11602 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11603 | { } /* end */ | |
11604 | }; | |
11605 | ||
11606 | static struct hda_verb alc262_nec_verbs[] = { | |
11607 | /* Unmute Speaker */ | |
11608 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11609 | ||
11610 | /* Headphone */ | |
11611 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11612 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11613 | ||
11614 | /* External mic to headphone */ | |
11615 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11616 | /* External mic to speaker */ | |
11617 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11618 | {} | |
11619 | }; | |
11620 | ||
834be88d TI |
11621 | /* |
11622 | * fujitsu model | |
5d9fab2d TV |
11623 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
11624 | * 0x1b = port replicator headphone out | |
834be88d TI |
11625 | */ |
11626 | ||
11627 | #define ALC_HP_EVENT 0x37 | |
11628 | ||
11629 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
11630 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11631 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5d9fab2d TV |
11632 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
11633 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
834be88d TI |
11634 | {} |
11635 | }; | |
11636 | ||
0e31daf7 J |
11637 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
11638 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
11639 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11640 | {} | |
11641 | }; | |
11642 | ||
e2595322 DC |
11643 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
11644 | /* Front Mic pin: input vref at 50% */ | |
11645 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
11646 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11647 | {} | |
11648 | }; | |
11649 | ||
834be88d | 11650 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
39d3ed38 | 11651 | .num_items = 3, |
834be88d TI |
11652 | .items = { |
11653 | { "Mic", 0x0 }, | |
39d3ed38 | 11654 | { "Int Mic", 0x1 }, |
834be88d TI |
11655 | { "CD", 0x4 }, |
11656 | }, | |
11657 | }; | |
11658 | ||
9c7f852e TI |
11659 | static struct hda_input_mux alc262_HP_capture_source = { |
11660 | .num_items = 5, | |
11661 | .items = { | |
11662 | { "Mic", 0x0 }, | |
accbe498 | 11663 | { "Front Mic", 0x1 }, |
9c7f852e TI |
11664 | { "Line", 0x2 }, |
11665 | { "CD", 0x4 }, | |
11666 | { "AUX IN", 0x6 }, | |
11667 | }, | |
11668 | }; | |
11669 | ||
accbe498 | 11670 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
11671 | .num_items = 4, | |
11672 | .items = { | |
11673 | { "Mic", 0x0 }, | |
11674 | { "Front Mic", 0x2 }, | |
11675 | { "Line", 0x1 }, | |
11676 | { "CD", 0x4 }, | |
11677 | }, | |
11678 | }; | |
11679 | ||
ebc7a406 | 11680 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
834be88d TI |
11681 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
11682 | { | |
11683 | struct alc_spec *spec = codec->spec; | |
11684 | unsigned int mute; | |
11685 | ||
f12ab1e0 | 11686 | if (force || !spec->sense_updated) { |
864f92be WF |
11687 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
11688 | snd_hda_jack_detect(codec, 0x1b); | |
834be88d TI |
11689 | spec->sense_updated = 1; |
11690 | } | |
ebc7a406 TI |
11691 | /* unmute internal speaker only if both HPs are unplugged and |
11692 | * master switch is on | |
11693 | */ | |
11694 | if (spec->jack_present) | |
11695 | mute = HDA_AMP_MUTE; | |
11696 | else | |
834be88d | 11697 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
ebc7a406 TI |
11698 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
11699 | HDA_AMP_MUTE, mute); | |
834be88d TI |
11700 | } |
11701 | ||
11702 | /* unsolicited event for HP jack sensing */ | |
11703 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
11704 | unsigned int res) | |
11705 | { | |
11706 | if ((res >> 26) != ALC_HP_EVENT) | |
11707 | return; | |
11708 | alc262_fujitsu_automute(codec, 1); | |
11709 | } | |
11710 | ||
ebc7a406 TI |
11711 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
11712 | { | |
11713 | alc262_fujitsu_automute(codec, 1); | |
11714 | } | |
11715 | ||
834be88d | 11716 | /* bind volumes of both NID 0x0c and 0x0d */ |
cca3b371 TI |
11717 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
11718 | .ops = &snd_hda_bind_vol, | |
11719 | .values = { | |
11720 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
11721 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
11722 | 0 | |
11723 | }, | |
11724 | }; | |
834be88d | 11725 | |
0e31daf7 J |
11726 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
11727 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
11728 | { | |
11729 | struct alc_spec *spec = codec->spec; | |
11730 | unsigned int mute; | |
11731 | ||
11732 | if (force || !spec->sense_updated) { | |
864f92be | 11733 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
0e31daf7 J |
11734 | spec->sense_updated = 1; |
11735 | } | |
11736 | if (spec->jack_present) { | |
11737 | /* mute internal speaker */ | |
11738 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11739 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11740 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11741 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
11742 | } else { | |
11743 | /* unmute internal speaker if necessary */ | |
11744 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
11745 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11746 | HDA_AMP_MUTE, mute); | |
11747 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
11748 | HDA_AMP_MUTE, mute); | |
11749 | } | |
11750 | } | |
11751 | ||
11752 | /* unsolicited event for HP jack sensing */ | |
11753 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
11754 | unsigned int res) | |
11755 | { | |
11756 | if ((res >> 26) != ALC_HP_EVENT) | |
11757 | return; | |
11758 | alc262_lenovo_3000_automute(codec, 1); | |
11759 | } | |
11760 | ||
8de56b7d TI |
11761 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
11762 | int dir, int idx, long *valp) | |
11763 | { | |
11764 | int i, change = 0; | |
11765 | ||
11766 | for (i = 0; i < 2; i++, valp++) | |
11767 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, | |
11768 | HDA_AMP_MUTE, | |
11769 | *valp ? 0 : HDA_AMP_MUTE); | |
11770 | return change; | |
11771 | } | |
11772 | ||
834be88d TI |
11773 | /* bind hp and internal speaker mute (with plug check) */ |
11774 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
11775 | struct snd_ctl_elem_value *ucontrol) | |
11776 | { | |
11777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11778 | long *valp = ucontrol->value.integer.value; | |
11779 | int change; | |
11780 | ||
8de56b7d TI |
11781 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
11782 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | |
82beb8fd TI |
11783 | if (change) |
11784 | alc262_fujitsu_automute(codec, 0); | |
834be88d TI |
11785 | return change; |
11786 | } | |
11787 | ||
11788 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
cca3b371 | 11789 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
834be88d TI |
11790 | { |
11791 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11792 | .name = "Master Playback Switch", | |
5e26dfd0 | 11793 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
834be88d TI |
11794 | .info = snd_hda_mixer_amp_switch_info, |
11795 | .get = snd_hda_mixer_amp_switch_get, | |
11796 | .put = alc262_fujitsu_master_sw_put, | |
11797 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
11798 | }, | |
5b0cb1d8 JK |
11799 | { |
11800 | .iface = NID_MAPPING, | |
11801 | .name = "Master Playback Switch", | |
11802 | .private_value = 0x1b, | |
11803 | }, | |
834be88d TI |
11804 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
11805 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11806 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
39d3ed38 TI |
11809 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
11810 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11811 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
834be88d TI |
11812 | { } /* end */ |
11813 | }; | |
11814 | ||
0e31daf7 J |
11815 | /* bind hp and internal speaker mute (with plug check) */ |
11816 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
11817 | struct snd_ctl_elem_value *ucontrol) | |
11818 | { | |
11819 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11820 | long *valp = ucontrol->value.integer.value; | |
11821 | int change; | |
11822 | ||
8de56b7d | 11823 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
0e31daf7 J |
11824 | if (change) |
11825 | alc262_lenovo_3000_automute(codec, 0); | |
11826 | return change; | |
11827 | } | |
11828 | ||
11829 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
11830 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
11831 | { | |
11832 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11833 | .name = "Master Playback Switch", | |
5e26dfd0 | 11834 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
0e31daf7 J |
11835 | .info = snd_hda_mixer_amp_switch_info, |
11836 | .get = snd_hda_mixer_amp_switch_get, | |
11837 | .put = alc262_lenovo_3000_master_sw_put, | |
11838 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
11839 | }, | |
11840 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11841 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11842 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11843 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11845 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
11846 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
11847 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
11848 | { } /* end */ | |
11849 | }; | |
11850 | ||
9f99a638 HM |
11851 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
11852 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
42171c17 | 11853 | ALC262_HIPPO_MASTER_SWITCH, |
9f99a638 HM |
11854 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11855 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11856 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11857 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11858 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11859 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11860 | { } /* end */ | |
11861 | }; | |
11862 | ||
304dcaac TI |
11863 | /* additional init verbs for Benq laptops */ |
11864 | static struct hda_verb alc262_EAPD_verbs[] = { | |
11865 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11866 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
11867 | {} | |
11868 | }; | |
11869 | ||
83c34218 KY |
11870 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
11871 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11872 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11873 | ||
11874 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
11875 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
11876 | {} | |
11877 | }; | |
11878 | ||
f651b50b TD |
11879 | /* Samsung Q1 Ultra Vista model setup */ |
11880 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
bb9f76cd TI |
11881 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
11882 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
f651b50b TD |
11883 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11884 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11885 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
bb9f76cd | 11886 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
f651b50b TD |
11887 | { } /* end */ |
11888 | }; | |
11889 | ||
11890 | static struct hda_verb alc262_ultra_verbs[] = { | |
bb9f76cd TI |
11891 | /* output mixer */ |
11892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11893 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11895 | /* speaker */ | |
11896 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
11897 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11898 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11899 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11900 | /* HP */ | |
f651b50b | 11901 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
bb9f76cd TI |
11902 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11903 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11904 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11905 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11906 | /* internal mic */ | |
11907 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
11908 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11909 | /* ADC, choose mic */ | |
11910 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11911 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
11912 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11913 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
11914 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
11915 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
11916 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
11917 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
11918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
11919 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
f651b50b TD |
11920 | {} |
11921 | }; | |
11922 | ||
f651b50b TD |
11923 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
11924 | static void alc262_ultra_automute(struct hda_codec *codec) | |
11925 | { | |
11926 | struct alc_spec *spec = codec->spec; | |
11927 | unsigned int mute; | |
f651b50b | 11928 | |
bb9f76cd TI |
11929 | mute = 0; |
11930 | /* auto-mute only when HP is used as HP */ | |
11931 | if (!spec->cur_mux[0]) { | |
864f92be | 11932 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
bb9f76cd TI |
11933 | if (spec->jack_present) |
11934 | mute = HDA_AMP_MUTE; | |
f651b50b | 11935 | } |
bb9f76cd TI |
11936 | /* mute/unmute internal speaker */ |
11937 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
11938 | HDA_AMP_MUTE, mute); | |
11939 | /* mute/unmute HP */ | |
11940 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
11941 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
f651b50b TD |
11942 | } |
11943 | ||
11944 | /* unsolicited event for HP jack sensing */ | |
11945 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
11946 | unsigned int res) | |
11947 | { | |
11948 | if ((res >> 26) != ALC880_HP_EVENT) | |
11949 | return; | |
11950 | alc262_ultra_automute(codec); | |
11951 | } | |
11952 | ||
bb9f76cd TI |
11953 | static struct hda_input_mux alc262_ultra_capture_source = { |
11954 | .num_items = 2, | |
11955 | .items = { | |
11956 | { "Mic", 0x1 }, | |
11957 | { "Headphone", 0x7 }, | |
11958 | }, | |
11959 | }; | |
11960 | ||
11961 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
11962 | struct snd_ctl_elem_value *ucontrol) | |
11963 | { | |
11964 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
11965 | struct alc_spec *spec = codec->spec; | |
11966 | int ret; | |
11967 | ||
54cbc9ab | 11968 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
bb9f76cd TI |
11969 | if (!ret) |
11970 | return 0; | |
11971 | /* reprogram the HP pin as mic or HP according to the input source */ | |
11972 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
11973 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11974 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
11975 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
11976 | return ret; | |
11977 | } | |
11978 | ||
11979 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
11980 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
11981 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
11982 | { | |
11983 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11984 | .name = "Capture Source", | |
54cbc9ab TI |
11985 | .info = alc_mux_enum_info, |
11986 | .get = alc_mux_enum_get, | |
bb9f76cd TI |
11987 | .put = alc262_ultra_mux_enum_put, |
11988 | }, | |
5b0cb1d8 JK |
11989 | { |
11990 | .iface = NID_MAPPING, | |
11991 | .name = "Capture Source", | |
11992 | .private_value = 0x15, | |
11993 | }, | |
bb9f76cd TI |
11994 | { } /* end */ |
11995 | }; | |
11996 | ||
c3fc1f50 TI |
11997 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
11998 | * and thus it's bound with a different mixer. | |
11999 | * This function returns which mixer amp should be used. | |
12000 | */ | |
12001 | static int alc262_check_volbit(hda_nid_t nid) | |
12002 | { | |
12003 | if (!nid) | |
12004 | return 0; | |
12005 | else if (nid == 0x16) | |
12006 | return 2; | |
12007 | else | |
12008 | return 1; | |
12009 | } | |
12010 | ||
12011 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | |
033688a5 | 12012 | const char *pfx, int *vbits, int idx) |
c3fc1f50 | 12013 | { |
c3fc1f50 TI |
12014 | unsigned long val; |
12015 | int vbit; | |
12016 | ||
12017 | vbit = alc262_check_volbit(nid); | |
12018 | if (!vbit) | |
12019 | return 0; | |
12020 | if (*vbits & vbit) /* a volume control for this mixer already there */ | |
12021 | return 0; | |
12022 | *vbits |= vbit; | |
c3fc1f50 TI |
12023 | if (vbit == 2) |
12024 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | |
12025 | else | |
12026 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | |
033688a5 | 12027 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val); |
c3fc1f50 TI |
12028 | } |
12029 | ||
12030 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | |
033688a5 | 12031 | const char *pfx, int idx) |
c3fc1f50 | 12032 | { |
c3fc1f50 TI |
12033 | unsigned long val; |
12034 | ||
12035 | if (!nid) | |
12036 | return 0; | |
c3fc1f50 TI |
12037 | if (nid == 0x16) |
12038 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
12039 | else | |
12040 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
033688a5 | 12041 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val); |
c3fc1f50 TI |
12042 | } |
12043 | ||
df694daa | 12044 | /* add playback controls from the parsed DAC table */ |
f12ab1e0 TI |
12045 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
12046 | const struct auto_pin_cfg *cfg) | |
df694daa | 12047 | { |
c3fc1f50 TI |
12048 | const char *pfx; |
12049 | int vbits; | |
033688a5 | 12050 | int i, err; |
df694daa KY |
12051 | |
12052 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
12053 | spec->multiout.dac_nids = spec->private_dac_nids; | |
12054 | spec->multiout.dac_nids[0] = 2; | |
12055 | ||
c3fc1f50 TI |
12056 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
12057 | pfx = "Master"; | |
12058 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
12059 | pfx = "Speaker"; | |
033688a5 TI |
12060 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) |
12061 | pfx = "Headphone"; | |
c3fc1f50 TI |
12062 | else |
12063 | pfx = "Front"; | |
033688a5 TI |
12064 | for (i = 0; i < 2; i++) { |
12065 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); | |
12066 | if (err < 0) | |
12067 | return err; | |
12068 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | |
12069 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], | |
12070 | "Speaker", i); | |
12071 | if (err < 0) | |
12072 | return err; | |
12073 | } | |
12074 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | |
12075 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], | |
12076 | "Headphone", i); | |
12077 | if (err < 0) | |
12078 | return err; | |
12079 | } | |
12080 | } | |
df694daa | 12081 | |
c3fc1f50 TI |
12082 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
12083 | alc262_check_volbit(cfg->speaker_pins[0]) | | |
12084 | alc262_check_volbit(cfg->hp_pins[0]); | |
12085 | if (vbits == 1 || vbits == 2) | |
12086 | pfx = "Master"; /* only one mixer is used */ | |
c3fc1f50 | 12087 | vbits = 0; |
033688a5 TI |
12088 | for (i = 0; i < 2; i++) { |
12089 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, | |
12090 | &vbits, i); | |
12091 | if (err < 0) | |
12092 | return err; | |
12093 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | |
12094 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], | |
12095 | "Speaker", &vbits, i); | |
12096 | if (err < 0) | |
12097 | return err; | |
12098 | } | |
12099 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | |
12100 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], | |
12101 | "Headphone", &vbits, i); | |
12102 | if (err < 0) | |
12103 | return err; | |
12104 | } | |
12105 | } | |
f12ab1e0 | 12106 | return 0; |
df694daa KY |
12107 | } |
12108 | ||
05f5f477 | 12109 | #define alc262_auto_create_input_ctls \ |
eaa9b3a7 | 12110 | alc882_auto_create_input_ctls |
df694daa KY |
12111 | |
12112 | /* | |
12113 | * generic initialization of ADC, input mixers and output mixers | |
12114 | */ | |
12115 | static struct hda_verb alc262_volume_init_verbs[] = { | |
12116 | /* | |
12117 | * Unmute ADC0-2 and set the default input to mic-in | |
12118 | */ | |
12119 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12120 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12121 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12122 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12123 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12124 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12125 | ||
cb53c626 | 12126 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 12127 | * mixer widget |
f12ab1e0 TI |
12128 | * Note: PASD motherboards uses the Line In 2 as the input for |
12129 | * front panel mic (mic 2) | |
df694daa KY |
12130 | */ |
12131 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
12137 | |
12138 | /* | |
12139 | * Set up output mixers (0x0c - 0x0f) | |
12140 | */ | |
12141 | /* set vol=0 to output mixers */ | |
12142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12143 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12144 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
ea1fb29a | 12145 | |
df694daa KY |
12146 | /* set up input amps for analog loopback */ |
12147 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12148 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12150 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12151 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12152 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12153 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12154 | ||
12155 | /* FIXME: use matrix-type input source selection */ | |
12156 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
12157 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12158 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12159 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12160 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12161 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12162 | /* Input mixer2 */ | |
12163 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12164 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12165 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12166 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12167 | /* Input mixer3 */ | |
12168 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12169 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12170 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12171 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12172 | ||
12173 | { } | |
12174 | }; | |
12175 | ||
9c7f852e TI |
12176 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
12177 | /* | |
12178 | * Unmute ADC0-2 and set the default input to mic-in | |
12179 | */ | |
12180 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12181 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12182 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12183 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12184 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12185 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12186 | ||
cb53c626 | 12187 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 12188 | * mixer widget |
f12ab1e0 TI |
12189 | * Note: PASD motherboards uses the Line In 2 as the input for |
12190 | * front panel mic (mic 2) | |
9c7f852e TI |
12191 | */ |
12192 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12193 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12194 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12195 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12196 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12197 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12198 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12199 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
ea1fb29a | 12200 | |
9c7f852e TI |
12201 | /* |
12202 | * Set up output mixers (0x0c - 0x0e) | |
12203 | */ | |
12204 | /* set vol=0 to output mixers */ | |
12205 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12206 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12207 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12208 | ||
12209 | /* set up input amps for analog loopback */ | |
12210 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12211 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12212 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12213 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12215 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12216 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12217 | ||
ce875f07 | 12218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
9c7f852e TI |
12219 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
12220 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
12221 | ||
12222 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12223 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12224 | ||
12225 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12226 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12227 | ||
12228 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12229 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12230 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
12231 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12232 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
12233 | ||
0e4835c1 | 12234 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
9c7f852e TI |
12235 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
12236 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
0e4835c1 | 12237 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
9c7f852e TI |
12238 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
12239 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12240 | ||
12241 | ||
12242 | /* FIXME: use matrix-type input source selection */ | |
0e4835c1 JK |
12243 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
12244 | /* Input mixer1: only unmute Mic */ | |
9c7f852e | 12245 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
0e4835c1 JK |
12246 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12247 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12248 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12249 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12250 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12251 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12252 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12253 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e TI |
12254 | /* Input mixer2 */ |
12255 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
0e4835c1 JK |
12256 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12257 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12258 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12261 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12262 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12263 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e TI |
12264 | /* Input mixer3 */ |
12265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
0e4835c1 JK |
12266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
12267 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
12268 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
12269 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
12270 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | |
12271 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | |
12272 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | |
12273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | |
9c7f852e | 12274 | |
ce875f07 TI |
12275 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12276 | ||
9c7f852e TI |
12277 | { } |
12278 | }; | |
12279 | ||
cd7509a4 KY |
12280 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
12281 | /* | |
12282 | * Unmute ADC0-2 and set the default input to mic-in | |
12283 | */ | |
12284 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12285 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12286 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12287 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12288 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12289 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12290 | ||
cb53c626 | 12291 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
cd7509a4 KY |
12292 | * mixer widget |
12293 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
12294 | * panel mic (mic 2) | |
12295 | */ | |
12296 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
12297 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12298 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12299 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12300 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12301 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12302 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
12303 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
12304 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
cd7509a4 KY |
12305 | /* |
12306 | * Set up output mixers (0x0c - 0x0e) | |
12307 | */ | |
12308 | /* set vol=0 to output mixers */ | |
12309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12312 | ||
12313 | /* set up input amps for analog loopback */ | |
12314 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12315 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12316 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12317 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12318 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12320 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12321 | ||
12322 | ||
12323 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
12324 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
12325 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
12326 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
12327 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12328 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
12329 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
12330 | ||
12331 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12332 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12333 | ||
12334 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12335 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12336 | ||
12337 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
12338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12339 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12340 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
12341 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12342 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
12343 | ||
12344 | /* FIXME: use matrix-type input source selection */ | |
12345 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
12346 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12347 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
12348 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
12349 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
12350 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
12351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
12352 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
12354 | /* Input mixer2 */ | |
12355 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12356 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12357 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12359 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12360 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12362 | /* Input mixer3 */ | |
12363 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
12364 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
12365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
12366 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
12367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
12368 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
12369 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
12370 | ||
ce875f07 TI |
12371 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
12372 | ||
cd7509a4 KY |
12373 | { } |
12374 | }; | |
12375 | ||
9f99a638 HM |
12376 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
12377 | ||
12378 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | |
12379 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
12380 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
12381 | ||
12382 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | |
12383 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
12384 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12385 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
12386 | ||
12387 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | |
12388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12389 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
12390 | {} | |
12391 | }; | |
12392 | ||
18675e42 TI |
12393 | /* |
12394 | * Pin config fixes | |
12395 | */ | |
12396 | enum { | |
12397 | PINFIX_FSC_H270, | |
12398 | }; | |
12399 | ||
12400 | static const struct alc_fixup alc262_fixups[] = { | |
12401 | [PINFIX_FSC_H270] = { | |
12402 | .pins = (const struct alc_pincfg[]) { | |
12403 | { 0x14, 0x99130110 }, /* speaker */ | |
12404 | { 0x15, 0x0221142f }, /* front HP */ | |
12405 | { 0x1b, 0x0121141f }, /* rear HP */ | |
12406 | { } | |
12407 | } | |
12408 | }, | |
12409 | [PINFIX_PB_M5210] = { | |
12410 | .verbs = (const struct hda_verb[]) { | |
12411 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, | |
12412 | {} | |
12413 | } | |
12414 | }, | |
12415 | }; | |
12416 | ||
12417 | static struct snd_pci_quirk alc262_fixup_tbl[] = { | |
12418 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), | |
12419 | {} | |
12420 | }; | |
12421 | ||
9f99a638 | 12422 | |
cb53c626 TI |
12423 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12424 | #define alc262_loopbacks alc880_loopbacks | |
12425 | #endif | |
12426 | ||
def319f9 | 12427 | /* pcm configuration: identical with ALC880 */ |
df694daa KY |
12428 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
12429 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
12430 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
12431 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
12432 | ||
12433 | /* | |
12434 | * BIOS auto configuration | |
12435 | */ | |
12436 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
12437 | { | |
12438 | struct alc_spec *spec = codec->spec; | |
12439 | int err; | |
12440 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
12441 | ||
f12ab1e0 TI |
12442 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
12443 | alc262_ignore); | |
12444 | if (err < 0) | |
df694daa | 12445 | return err; |
e64f14f4 | 12446 | if (!spec->autocfg.line_outs) { |
0852d7a6 | 12447 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
e64f14f4 TI |
12448 | spec->multiout.max_channels = 2; |
12449 | spec->no_analog = 1; | |
12450 | goto dig_only; | |
12451 | } | |
df694daa | 12452 | return 0; /* can't find valid BIOS pin config */ |
e64f14f4 | 12453 | } |
f12ab1e0 TI |
12454 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
12455 | if (err < 0) | |
12456 | return err; | |
05f5f477 | 12457 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 12458 | if (err < 0) |
df694daa KY |
12459 | return err; |
12460 | ||
12461 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
12462 | ||
e64f14f4 | 12463 | dig_only: |
757899ac | 12464 | alc_auto_parse_digital(codec); |
df694daa | 12465 | |
603c4019 | 12466 | if (spec->kctls.list) |
d88897ea | 12467 | add_mixer(spec, spec->kctls.list); |
df694daa | 12468 | |
d88897ea | 12469 | add_verb(spec, alc262_volume_init_verbs); |
a1e8d2da | 12470 | spec->num_mux_defs = 1; |
61b9b9b1 | 12471 | spec->input_mux = &spec->private_imux[0]; |
df694daa | 12472 | |
776e184e TI |
12473 | err = alc_auto_add_mic_boost(codec); |
12474 | if (err < 0) | |
12475 | return err; | |
12476 | ||
6227cdce | 12477 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 12478 | |
df694daa KY |
12479 | return 1; |
12480 | } | |
12481 | ||
12482 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
12483 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
12484 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
f511b01c | 12485 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
df694daa KY |
12486 | |
12487 | ||
12488 | /* init callback for auto-configuration model -- overriding the default init */ | |
ae6b813a | 12489 | static void alc262_auto_init(struct hda_codec *codec) |
df694daa | 12490 | { |
f6c7e546 | 12491 | struct alc_spec *spec = codec->spec; |
df694daa KY |
12492 | alc262_auto_init_multi_out(codec); |
12493 | alc262_auto_init_hp_out(codec); | |
12494 | alc262_auto_init_analog_input(codec); | |
f511b01c | 12495 | alc262_auto_init_input_src(codec); |
757899ac | 12496 | alc_auto_init_digital(codec); |
f6c7e546 | 12497 | if (spec->unsol_event) |
7fb0d78f | 12498 | alc_inithook(codec); |
df694daa KY |
12499 | } |
12500 | ||
12501 | /* | |
12502 | * configuration and preset | |
12503 | */ | |
f5fcc13c TI |
12504 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
12505 | [ALC262_BASIC] = "basic", | |
12506 | [ALC262_HIPPO] = "hippo", | |
12507 | [ALC262_HIPPO_1] = "hippo_1", | |
12508 | [ALC262_FUJITSU] = "fujitsu", | |
12509 | [ALC262_HP_BPC] = "hp-bpc", | |
cd7509a4 | 12510 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
61dc35de | 12511 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
8c427226 | 12512 | [ALC262_HP_RP5700] = "hp-rp5700", |
f5fcc13c | 12513 | [ALC262_BENQ_ED8] = "benq", |
0f40502e TI |
12514 | [ALC262_BENQ_T31] = "benq-t31", |
12515 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
2922c9af | 12516 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
9f99a638 | 12517 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
f651b50b | 12518 | [ALC262_ULTRA] = "ultra", |
0e31daf7 | 12519 | [ALC262_LENOVO_3000] = "lenovo-3000", |
e8f9ae2a | 12520 | [ALC262_NEC] = "nec", |
ba340e82 | 12521 | [ALC262_TYAN] = "tyan", |
f5fcc13c TI |
12522 | [ALC262_AUTO] = "auto", |
12523 | }; | |
12524 | ||
12525 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
12526 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
e8f9ae2a | 12527 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
dea0a509 TI |
12528 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
12529 | ALC262_HP_BPC), | |
12530 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", | |
12531 | ALC262_HP_BPC), | |
53eff7e1 TI |
12532 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
12533 | ALC262_HP_BPC), | |
cd7509a4 | 12534 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12535 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12536 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12537 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12538 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12539 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 12540 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 12541 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 TI |
12542 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
12543 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
12544 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
66d2a9d6 KY |
12545 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
12546 | ALC262_HP_TC_T5735), | |
8c427226 | 12547 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
ac3e3741 | 12548 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
f5fcc13c | 12549 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
5b31954e | 12550 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
bd6afe3f | 12551 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
376b508f | 12552 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
95491d90 | 12553 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
12929bae | 12554 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
c5b5165c | 12555 | #if 0 /* disable the quirk since model=auto works better in recent versions */ |
f872a919 TI |
12556 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
12557 | ALC262_SONY_ASSAMD), | |
c5b5165c | 12558 | #endif |
36ca6e13 | 12559 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
9f99a638 | 12560 | ALC262_TOSHIBA_RX1), |
80ffe869 | 12561 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
ac3e3741 | 12562 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
3f1eeaed | 12563 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
ba340e82 | 12564 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
dea0a509 TI |
12565 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
12566 | ALC262_ULTRA), | |
3e420e78 | 12567 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
0e31daf7 | 12568 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
ac3e3741 TI |
12569 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
12570 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
12571 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
df694daa KY |
12572 | {} |
12573 | }; | |
12574 | ||
12575 | static struct alc_config_preset alc262_presets[] = { | |
12576 | [ALC262_BASIC] = { | |
12577 | .mixers = { alc262_base_mixer }, | |
12578 | .init_verbs = { alc262_init_verbs }, | |
12579 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12580 | .dac_nids = alc262_dac_nids, | |
12581 | .hp_nid = 0x03, | |
12582 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12583 | .channel_mode = alc262_modes, | |
a3bcba38 | 12584 | .input_mux = &alc262_capture_source, |
df694daa | 12585 | }, |
ccc656ce | 12586 | [ALC262_HIPPO] = { |
42171c17 | 12587 | .mixers = { alc262_hippo_mixer }, |
6732bd0d | 12588 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
ccc656ce KY |
12589 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12590 | .dac_nids = alc262_dac_nids, | |
12591 | .hp_nid = 0x03, | |
12592 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12593 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12594 | .channel_mode = alc262_modes, | |
12595 | .input_mux = &alc262_capture_source, | |
12596 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12597 | .setup = alc262_hippo_setup, |
12598 | .init_hook = alc262_hippo_automute, | |
ccc656ce KY |
12599 | }, |
12600 | [ALC262_HIPPO_1] = { | |
12601 | .mixers = { alc262_hippo1_mixer }, | |
12602 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
12603 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12604 | .dac_nids = alc262_dac_nids, | |
12605 | .hp_nid = 0x02, | |
12606 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12607 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12608 | .channel_mode = alc262_modes, | |
12609 | .input_mux = &alc262_capture_source, | |
42171c17 | 12610 | .unsol_event = alc262_hippo_unsol_event, |
4f5d1706 TI |
12611 | .setup = alc262_hippo1_setup, |
12612 | .init_hook = alc262_hippo_automute, | |
ccc656ce | 12613 | }, |
834be88d TI |
12614 | [ALC262_FUJITSU] = { |
12615 | .mixers = { alc262_fujitsu_mixer }, | |
39d3ed38 TI |
12616 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
12617 | alc262_fujitsu_unsol_verbs }, | |
834be88d TI |
12618 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12619 | .dac_nids = alc262_dac_nids, | |
12620 | .hp_nid = 0x03, | |
12621 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12622 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12623 | .channel_mode = alc262_modes, | |
12624 | .input_mux = &alc262_fujitsu_capture_source, | |
ae6b813a | 12625 | .unsol_event = alc262_fujitsu_unsol_event, |
ebc7a406 | 12626 | .init_hook = alc262_fujitsu_init_hook, |
834be88d | 12627 | }, |
9c7f852e TI |
12628 | [ALC262_HP_BPC] = { |
12629 | .mixers = { alc262_HP_BPC_mixer }, | |
12630 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
12631 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12632 | .dac_nids = alc262_dac_nids, | |
12633 | .hp_nid = 0x03, | |
12634 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12635 | .channel_mode = alc262_modes, | |
12636 | .input_mux = &alc262_HP_capture_source, | |
ce875f07 TI |
12637 | .unsol_event = alc262_hp_bpc_unsol_event, |
12638 | .init_hook = alc262_hp_bpc_automute, | |
f12ab1e0 | 12639 | }, |
cd7509a4 KY |
12640 | [ALC262_HP_BPC_D7000_WF] = { |
12641 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
12642 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12643 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12644 | .dac_nids = alc262_dac_nids, | |
12645 | .hp_nid = 0x03, | |
12646 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12647 | .channel_mode = alc262_modes, | |
accbe498 | 12648 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
12649 | .unsol_event = alc262_hp_wildwest_unsol_event, |
12650 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 12651 | }, |
cd7509a4 KY |
12652 | [ALC262_HP_BPC_D7000_WL] = { |
12653 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
12654 | alc262_HP_BPC_WildWest_option_mixer }, | |
12655 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
12656 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12657 | .dac_nids = alc262_dac_nids, | |
12658 | .hp_nid = 0x03, | |
12659 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12660 | .channel_mode = alc262_modes, | |
accbe498 | 12661 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
12662 | .unsol_event = alc262_hp_wildwest_unsol_event, |
12663 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 12664 | }, |
66d2a9d6 KY |
12665 | [ALC262_HP_TC_T5735] = { |
12666 | .mixers = { alc262_hp_t5735_mixer }, | |
12667 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
12668 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12669 | .dac_nids = alc262_dac_nids, | |
12670 | .hp_nid = 0x03, | |
12671 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12672 | .channel_mode = alc262_modes, | |
12673 | .input_mux = &alc262_capture_source, | |
dc99be47 | 12674 | .unsol_event = alc_sku_unsol_event, |
4f5d1706 | 12675 | .setup = alc262_hp_t5735_setup, |
dc99be47 | 12676 | .init_hook = alc_inithook, |
8c427226 KY |
12677 | }, |
12678 | [ALC262_HP_RP5700] = { | |
12679 | .mixers = { alc262_hp_rp5700_mixer }, | |
12680 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
12681 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12682 | .dac_nids = alc262_dac_nids, | |
12683 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12684 | .channel_mode = alc262_modes, | |
12685 | .input_mux = &alc262_hp_rp5700_capture_source, | |
66d2a9d6 | 12686 | }, |
304dcaac TI |
12687 | [ALC262_BENQ_ED8] = { |
12688 | .mixers = { alc262_base_mixer }, | |
12689 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
12690 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12691 | .dac_nids = alc262_dac_nids, | |
12692 | .hp_nid = 0x03, | |
12693 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12694 | .channel_mode = alc262_modes, | |
12695 | .input_mux = &alc262_capture_source, | |
f12ab1e0 | 12696 | }, |
272a527c KY |
12697 | [ALC262_SONY_ASSAMD] = { |
12698 | .mixers = { alc262_sony_mixer }, | |
12699 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
12700 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12701 | .dac_nids = alc262_dac_nids, | |
12702 | .hp_nid = 0x02, | |
12703 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12704 | .channel_mode = alc262_modes, | |
12705 | .input_mux = &alc262_capture_source, | |
12706 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12707 | .setup = alc262_hippo_setup, |
12708 | .init_hook = alc262_hippo_automute, | |
83c34218 KY |
12709 | }, |
12710 | [ALC262_BENQ_T31] = { | |
12711 | .mixers = { alc262_benq_t31_mixer }, | |
6732bd0d WF |
12712 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
12713 | alc_hp15_unsol_verbs }, | |
83c34218 KY |
12714 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12715 | .dac_nids = alc262_dac_nids, | |
12716 | .hp_nid = 0x03, | |
12717 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12718 | .channel_mode = alc262_modes, | |
12719 | .input_mux = &alc262_capture_source, | |
12720 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12721 | .setup = alc262_hippo_setup, |
12722 | .init_hook = alc262_hippo_automute, | |
ea1fb29a | 12723 | }, |
f651b50b | 12724 | [ALC262_ULTRA] = { |
f9e336f6 TI |
12725 | .mixers = { alc262_ultra_mixer }, |
12726 | .cap_mixer = alc262_ultra_capture_mixer, | |
bb9f76cd | 12727 | .init_verbs = { alc262_ultra_verbs }, |
f651b50b TD |
12728 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12729 | .dac_nids = alc262_dac_nids, | |
f651b50b TD |
12730 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
12731 | .channel_mode = alc262_modes, | |
12732 | .input_mux = &alc262_ultra_capture_source, | |
bb9f76cd TI |
12733 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
12734 | .capsrc_nids = alc262_capsrc_nids, | |
12735 | .num_adc_nids = 1, /* single ADC */ | |
f651b50b TD |
12736 | .unsol_event = alc262_ultra_unsol_event, |
12737 | .init_hook = alc262_ultra_automute, | |
12738 | }, | |
0e31daf7 J |
12739 | [ALC262_LENOVO_3000] = { |
12740 | .mixers = { alc262_lenovo_3000_mixer }, | |
12741 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
e2595322 DC |
12742 | alc262_lenovo_3000_unsol_verbs, |
12743 | alc262_lenovo_3000_init_verbs }, | |
0e31daf7 J |
12744 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
12745 | .dac_nids = alc262_dac_nids, | |
12746 | .hp_nid = 0x03, | |
12747 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12748 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12749 | .channel_mode = alc262_modes, | |
12750 | .input_mux = &alc262_fujitsu_capture_source, | |
12751 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
12752 | }, | |
e8f9ae2a PT |
12753 | [ALC262_NEC] = { |
12754 | .mixers = { alc262_nec_mixer }, | |
12755 | .init_verbs = { alc262_nec_verbs }, | |
12756 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12757 | .dac_nids = alc262_dac_nids, | |
12758 | .hp_nid = 0x03, | |
12759 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12760 | .channel_mode = alc262_modes, | |
12761 | .input_mux = &alc262_capture_source, | |
12762 | }, | |
4e555fe5 KY |
12763 | [ALC262_TOSHIBA_S06] = { |
12764 | .mixers = { alc262_toshiba_s06_mixer }, | |
12765 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | |
12766 | alc262_eapd_verbs }, | |
12767 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12768 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
12769 | .dac_nids = alc262_dac_nids, | |
12770 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | |
ae14ef68 | 12771 | .num_adc_nids = 1, /* single ADC */ |
4e555fe5 KY |
12772 | .dig_out_nid = ALC262_DIGOUT_NID, |
12773 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12774 | .channel_mode = alc262_modes, | |
4f5d1706 TI |
12775 | .unsol_event = alc_sku_unsol_event, |
12776 | .setup = alc262_toshiba_s06_setup, | |
12777 | .init_hook = alc_inithook, | |
4e555fe5 | 12778 | }, |
9f99a638 HM |
12779 | [ALC262_TOSHIBA_RX1] = { |
12780 | .mixers = { alc262_toshiba_rx1_mixer }, | |
12781 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | |
12782 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12783 | .dac_nids = alc262_dac_nids, | |
12784 | .hp_nid = 0x03, | |
12785 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12786 | .channel_mode = alc262_modes, | |
12787 | .input_mux = &alc262_capture_source, | |
12788 | .unsol_event = alc262_hippo_unsol_event, | |
4f5d1706 TI |
12789 | .setup = alc262_hippo_setup, |
12790 | .init_hook = alc262_hippo_automute, | |
9f99a638 | 12791 | }, |
ba340e82 TV |
12792 | [ALC262_TYAN] = { |
12793 | .mixers = { alc262_tyan_mixer }, | |
12794 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | |
12795 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
12796 | .dac_nids = alc262_dac_nids, | |
12797 | .hp_nid = 0x02, | |
12798 | .dig_out_nid = ALC262_DIGOUT_NID, | |
12799 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
12800 | .channel_mode = alc262_modes, | |
12801 | .input_mux = &alc262_capture_source, | |
a9fd4f3f | 12802 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
12803 | .setup = alc262_tyan_setup, |
12804 | .init_hook = alc_automute_amp, | |
ba340e82 | 12805 | }, |
df694daa KY |
12806 | }; |
12807 | ||
12808 | static int patch_alc262(struct hda_codec *codec) | |
12809 | { | |
12810 | struct alc_spec *spec; | |
12811 | int board_config; | |
12812 | int err; | |
12813 | ||
dc041e0b | 12814 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
12815 | if (spec == NULL) |
12816 | return -ENOMEM; | |
12817 | ||
12818 | codec->spec = spec; | |
12819 | #if 0 | |
f12ab1e0 TI |
12820 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
12821 | * under-run | |
12822 | */ | |
df694daa KY |
12823 | { |
12824 | int tmp; | |
12825 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12826 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
12827 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
12828 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
12829 | } | |
12830 | #endif | |
da00c244 | 12831 | alc_auto_parse_customize_define(codec); |
df694daa | 12832 | |
2c3bf9ab TI |
12833 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
12834 | ||
f5fcc13c TI |
12835 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
12836 | alc262_models, | |
12837 | alc262_cfg_tbl); | |
cd7509a4 | 12838 | |
f5fcc13c | 12839 | if (board_config < 0) { |
9a11f1aa TI |
12840 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
12841 | codec->chip_name); | |
df694daa KY |
12842 | board_config = ALC262_AUTO; |
12843 | } | |
12844 | ||
18675e42 TI |
12845 | if (board_config == ALC262_AUTO) |
12846 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); | |
12847 | ||
df694daa KY |
12848 | if (board_config == ALC262_AUTO) { |
12849 | /* automatic parse from the BIOS config */ | |
12850 | err = alc262_parse_auto_config(codec); | |
12851 | if (err < 0) { | |
12852 | alc_free(codec); | |
12853 | return err; | |
f12ab1e0 | 12854 | } else if (!err) { |
9c7f852e TI |
12855 | printk(KERN_INFO |
12856 | "hda_codec: Cannot set up configuration " | |
12857 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
12858 | board_config = ALC262_BASIC; |
12859 | } | |
12860 | } | |
12861 | ||
dc1eae25 | 12862 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
07eba61d TI |
12863 | err = snd_hda_attach_beep_device(codec, 0x1); |
12864 | if (err < 0) { | |
12865 | alc_free(codec); | |
12866 | return err; | |
12867 | } | |
680cd536 KK |
12868 | } |
12869 | ||
df694daa | 12870 | if (board_config != ALC262_AUTO) |
e9c364c0 | 12871 | setup_preset(codec, &alc262_presets[board_config]); |
df694daa | 12872 | |
df694daa KY |
12873 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
12874 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
ea1fb29a | 12875 | |
df694daa KY |
12876 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
12877 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
12878 | ||
f12ab1e0 | 12879 | if (!spec->adc_nids && spec->input_mux) { |
8c927b4a TI |
12880 | int i; |
12881 | /* check whether the digital-mic has to be supported */ | |
12882 | for (i = 0; i < spec->input_mux->num_items; i++) { | |
12883 | if (spec->input_mux->items[i].index >= 9) | |
12884 | break; | |
12885 | } | |
12886 | if (i < spec->input_mux->num_items) { | |
12887 | /* use only ADC0 */ | |
12888 | spec->adc_nids = alc262_dmic_adc_nids; | |
12889 | spec->num_adc_nids = 1; | |
12890 | spec->capsrc_nids = alc262_dmic_capsrc_nids; | |
df694daa | 12891 | } else { |
8c927b4a TI |
12892 | /* all analog inputs */ |
12893 | /* check whether NID 0x07 is valid */ | |
12894 | unsigned int wcap = get_wcaps(codec, 0x07); | |
12895 | ||
12896 | /* get type */ | |
a22d543a | 12897 | wcap = get_wcaps_type(wcap); |
8c927b4a TI |
12898 | if (wcap != AC_WID_AUD_IN) { |
12899 | spec->adc_nids = alc262_adc_nids_alt; | |
12900 | spec->num_adc_nids = | |
12901 | ARRAY_SIZE(alc262_adc_nids_alt); | |
12902 | spec->capsrc_nids = alc262_capsrc_nids_alt; | |
12903 | } else { | |
12904 | spec->adc_nids = alc262_adc_nids; | |
12905 | spec->num_adc_nids = | |
12906 | ARRAY_SIZE(alc262_adc_nids); | |
12907 | spec->capsrc_nids = alc262_capsrc_nids; | |
12908 | } | |
df694daa KY |
12909 | } |
12910 | } | |
e64f14f4 | 12911 | if (!spec->cap_mixer && !spec->no_analog) |
b59bdf3b | 12912 | set_capture_mixer(codec); |
dc1eae25 | 12913 | if (!spec->no_analog && has_cdefine_beep(codec)) |
07eba61d | 12914 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
df694daa | 12915 | |
18675e42 TI |
12916 | if (board_config == ALC262_AUTO) |
12917 | alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0); | |
12918 | ||
2134ea4f TI |
12919 | spec->vmaster_nid = 0x0c; |
12920 | ||
df694daa KY |
12921 | codec->patch_ops = alc_patch_ops; |
12922 | if (board_config == ALC262_AUTO) | |
ae6b813a | 12923 | spec->init_hook = alc262_auto_init; |
bf1b0225 KY |
12924 | |
12925 | alc_init_jacks(codec); | |
cb53c626 TI |
12926 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12927 | if (!spec->loopback.amplist) | |
12928 | spec->loopback.amplist = alc262_loopbacks; | |
12929 | #endif | |
ea1fb29a | 12930 | |
df694daa KY |
12931 | return 0; |
12932 | } | |
12933 | ||
a361d84b KY |
12934 | /* |
12935 | * ALC268 channel source setting (2 channel) | |
12936 | */ | |
12937 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
12938 | #define alc268_modes alc260_modes | |
ea1fb29a | 12939 | |
a361d84b KY |
12940 | static hda_nid_t alc268_dac_nids[2] = { |
12941 | /* front, hp */ | |
12942 | 0x02, 0x03 | |
12943 | }; | |
12944 | ||
12945 | static hda_nid_t alc268_adc_nids[2] = { | |
12946 | /* ADC0-1 */ | |
12947 | 0x08, 0x07 | |
12948 | }; | |
12949 | ||
12950 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
12951 | /* ADC0 */ | |
12952 | 0x08 | |
12953 | }; | |
12954 | ||
e1406348 TI |
12955 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
12956 | ||
a361d84b KY |
12957 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
12958 | /* output mixer control */ | |
12959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12960 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
12961 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12962 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
33bf17ab TI |
12963 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
12964 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12965 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
a361d84b KY |
12966 | { } |
12967 | }; | |
12968 | ||
42171c17 TI |
12969 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
12970 | /* output mixer control */ | |
12971 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
12972 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
12973 | ALC262_HIPPO_MASTER_SWITCH, | |
12974 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
12975 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
12976 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
12977 | { } | |
12978 | }; | |
12979 | ||
aef9d318 TI |
12980 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
12981 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
12982 | .ops = &snd_hda_bind_sw, | |
12983 | .values = { | |
12984 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
12985 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
12986 | 0 | |
12987 | }, | |
12988 | }; | |
12989 | ||
12990 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
12991 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
12992 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
12993 | { } | |
12994 | }; | |
12995 | ||
d1a991a6 KY |
12996 | static struct hda_verb alc268_eapd_verbs[] = { |
12997 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12998 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12999 | { } | |
13000 | }; | |
13001 | ||
d273809e | 13002 | /* Toshiba specific */ |
d273809e TI |
13003 | static struct hda_verb alc268_toshiba_verbs[] = { |
13004 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13005 | { } /* end */ | |
13006 | }; | |
13007 | ||
13008 | /* Acer specific */ | |
889c4395 | 13009 | /* bind volumes of both NID 0x02 and 0x03 */ |
6bc96857 TI |
13010 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
13011 | .ops = &snd_hda_bind_vol, | |
13012 | .values = { | |
13013 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
13014 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
13015 | 0 | |
13016 | }, | |
13017 | }; | |
13018 | ||
889c4395 TI |
13019 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
13020 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
13021 | { | |
13022 | struct alc_spec *spec = codec->spec; | |
13023 | unsigned int mute; | |
13024 | ||
13025 | if (force || !spec->sense_updated) { | |
864f92be | 13026 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
889c4395 TI |
13027 | spec->sense_updated = 1; |
13028 | } | |
13029 | if (spec->jack_present) | |
13030 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
13031 | else /* unmute internal speaker if necessary */ | |
13032 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
13033 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
13034 | HDA_AMP_MUTE, mute); | |
13035 | } | |
13036 | ||
13037 | ||
13038 | /* bind hp and internal speaker mute (with plug check) */ | |
13039 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
13040 | struct snd_ctl_elem_value *ucontrol) | |
13041 | { | |
13042 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
13043 | long *valp = ucontrol->value.integer.value; | |
13044 | int change; | |
13045 | ||
8de56b7d | 13046 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
889c4395 TI |
13047 | if (change) |
13048 | alc268_acer_automute(codec, 0); | |
13049 | return change; | |
13050 | } | |
d273809e | 13051 | |
8ef355da KY |
13052 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
13053 | /* output mixer control */ | |
13054 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13055 | { | |
13056 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13057 | .name = "Master Playback Switch", | |
5e26dfd0 | 13058 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
8ef355da KY |
13059 | .info = snd_hda_mixer_amp_switch_info, |
13060 | .get = snd_hda_mixer_amp_switch_get, | |
13061 | .put = alc268_acer_master_sw_put, | |
13062 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13063 | }, | |
13064 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | |
13065 | { } | |
13066 | }; | |
13067 | ||
d273809e TI |
13068 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
13069 | /* output mixer control */ | |
13070 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13071 | { | |
13072 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13073 | .name = "Master Playback Switch", | |
5e26dfd0 | 13074 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
d273809e TI |
13075 | .info = snd_hda_mixer_amp_switch_info, |
13076 | .get = snd_hda_mixer_amp_switch_get, | |
13077 | .put = alc268_acer_master_sw_put, | |
13078 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13079 | }, | |
33bf17ab TI |
13080 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
13081 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13082 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
d273809e TI |
13083 | { } |
13084 | }; | |
13085 | ||
c238b4f4 TI |
13086 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
13087 | /* output mixer control */ | |
13088 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
13089 | { | |
13090 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13091 | .name = "Master Playback Switch", | |
5e26dfd0 | 13092 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
c238b4f4 TI |
13093 | .info = snd_hda_mixer_amp_switch_info, |
13094 | .get = snd_hda_mixer_amp_switch_get, | |
13095 | .put = alc268_acer_master_sw_put, | |
13096 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
13097 | }, | |
13098 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13099 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
13100 | { } | |
13101 | }; | |
13102 | ||
8ef355da KY |
13103 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
13104 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13105 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13106 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13107 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
13108 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
13109 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | |
13110 | { } | |
13111 | }; | |
13112 | ||
d273809e | 13113 | static struct hda_verb alc268_acer_verbs[] = { |
0ccb541c TI |
13114 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
13115 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d273809e TI |
13116 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
13117 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
0ccb541c TI |
13118 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
13119 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
d273809e TI |
13120 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
13121 | { } | |
13122 | }; | |
13123 | ||
13124 | /* unsolicited event for HP jack sensing */ | |
42171c17 | 13125 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
4f5d1706 TI |
13126 | #define alc268_toshiba_setup alc262_hippo_setup |
13127 | #define alc268_toshiba_automute alc262_hippo_automute | |
d273809e TI |
13128 | |
13129 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
13130 | unsigned int res) | |
13131 | { | |
889c4395 | 13132 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
13133 | return; |
13134 | alc268_acer_automute(codec, 1); | |
13135 | } | |
13136 | ||
889c4395 TI |
13137 | static void alc268_acer_init_hook(struct hda_codec *codec) |
13138 | { | |
13139 | alc268_acer_automute(codec, 1); | |
13140 | } | |
13141 | ||
8ef355da KY |
13142 | /* toggle speaker-output according to the hp-jack state */ |
13143 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |
13144 | { | |
13145 | unsigned int present; | |
13146 | unsigned char bits; | |
13147 | ||
864f92be | 13148 | present = snd_hda_jack_detect(codec, 0x15); |
5dbd5ec6 | 13149 | bits = present ? HDA_AMP_MUTE : 0; |
8ef355da | 13150 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
5dbd5ec6 | 13151 | HDA_AMP_MUTE, bits); |
8ef355da | 13152 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
5dbd5ec6 | 13153 | HDA_AMP_MUTE, bits); |
8ef355da KY |
13154 | } |
13155 | ||
8ef355da KY |
13156 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
13157 | unsigned int res) | |
13158 | { | |
4f5d1706 TI |
13159 | switch (res >> 26) { |
13160 | case ALC880_HP_EVENT: | |
8ef355da | 13161 | alc268_aspire_one_speaker_automute(codec); |
4f5d1706 TI |
13162 | break; |
13163 | case ALC880_MIC_EVENT: | |
13164 | alc_mic_automute(codec); | |
13165 | break; | |
13166 | } | |
13167 | } | |
13168 | ||
13169 | static void alc268_acer_lc_setup(struct hda_codec *codec) | |
13170 | { | |
13171 | struct alc_spec *spec = codec->spec; | |
13172 | spec->ext_mic.pin = 0x18; | |
13173 | spec->ext_mic.mux_idx = 0; | |
13174 | spec->int_mic.pin = 0x12; | |
13175 | spec->int_mic.mux_idx = 6; | |
13176 | spec->auto_mic = 1; | |
8ef355da KY |
13177 | } |
13178 | ||
13179 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | |
13180 | { | |
13181 | alc268_aspire_one_speaker_automute(codec); | |
4f5d1706 | 13182 | alc_mic_automute(codec); |
8ef355da KY |
13183 | } |
13184 | ||
3866f0b0 TI |
13185 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
13186 | /* output mixer control */ | |
13187 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13188 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13189 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13190 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13191 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13192 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
13193 | { } | |
13194 | }; | |
13195 | ||
13196 | static struct hda_verb alc268_dell_verbs[] = { | |
13197 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13199 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
4f5d1706 | 13200 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
3866f0b0 TI |
13201 | { } |
13202 | }; | |
13203 | ||
13204 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
4f5d1706 | 13205 | static void alc268_dell_setup(struct hda_codec *codec) |
3866f0b0 | 13206 | { |
a9fd4f3f | 13207 | struct alc_spec *spec = codec->spec; |
3866f0b0 | 13208 | |
a9fd4f3f TI |
13209 | spec->autocfg.hp_pins[0] = 0x15; |
13210 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
13211 | spec->ext_mic.pin = 0x18; |
13212 | spec->ext_mic.mux_idx = 0; | |
13213 | spec->int_mic.pin = 0x19; | |
13214 | spec->int_mic.mux_idx = 1; | |
13215 | spec->auto_mic = 1; | |
3866f0b0 TI |
13216 | } |
13217 | ||
eb5a6621 HRK |
13218 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
13219 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
13220 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13221 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
13222 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
13223 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13224 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13225 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
13226 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
13227 | { } | |
13228 | }; | |
13229 | ||
13230 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
13231 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
13232 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
13233 | { } | |
13234 | }; | |
13235 | ||
4f5d1706 | 13236 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
eb5a6621 | 13237 | { |
a9fd4f3f | 13238 | struct alc_spec *spec = codec->spec; |
a9fd4f3f TI |
13239 | spec->autocfg.hp_pins[0] = 0x15; |
13240 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
13241 | spec->ext_mic.pin = 0x18; |
13242 | spec->ext_mic.mux_idx = 0; | |
13243 | spec->int_mic.pin = 0x19; | |
13244 | spec->int_mic.mux_idx = 1; | |
13245 | spec->auto_mic = 1; | |
eb5a6621 HRK |
13246 | } |
13247 | ||
a361d84b KY |
13248 | /* |
13249 | * generic initialization of ADC, input mixers and output mixers | |
13250 | */ | |
13251 | static struct hda_verb alc268_base_init_verbs[] = { | |
13252 | /* Unmute DAC0-1 and set vol = 0 */ | |
13253 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a361d84b | 13254 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
a361d84b KY |
13255 | |
13256 | /* | |
13257 | * Set up output mixers (0x0c - 0x0e) | |
13258 | */ | |
13259 | /* set vol=0 to output mixers */ | |
13260 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
a361d84b KY |
13261 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
13262 | ||
13263 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13264 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13265 | ||
13266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13267 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
13268 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
13269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13270 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13271 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13272 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13273 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13274 | ||
13275 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13276 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13277 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13278 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
a361d84b | 13279 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
aef9d318 TI |
13280 | |
13281 | /* set PCBEEP vol = 0, mute connections */ | |
13282 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13283 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13284 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b | 13285 | |
a9b3aa8a | 13286 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
ea1fb29a | 13287 | |
a9b3aa8a JZ |
13288 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
13289 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13290 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13291 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
a361d84b | 13292 | |
a361d84b KY |
13293 | { } |
13294 | }; | |
13295 | ||
13296 | /* | |
13297 | * generic initialization of ADC, input mixers and output mixers | |
13298 | */ | |
13299 | static struct hda_verb alc268_volume_init_verbs[] = { | |
13300 | /* set output DAC */ | |
4cfb91c6 TI |
13301 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
13302 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a361d84b KY |
13303 | |
13304 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13305 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
13306 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13307 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13308 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
13309 | ||
a361d84b | 13310 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
a361d84b KY |
13311 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
13312 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13313 | ||
13314 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
a361d84b | 13315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
a361d84b | 13316 | |
aef9d318 TI |
13317 | /* set PCBEEP vol = 0, mute connections */ |
13318 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13319 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13320 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b KY |
13321 | |
13322 | { } | |
13323 | }; | |
13324 | ||
fdbc6626 TI |
13325 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
13326 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13327 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13328 | { } /* end */ | |
13329 | }; | |
13330 | ||
a361d84b KY |
13331 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
13332 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13333 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
fdbc6626 | 13334 | _DEFINE_CAPSRC(1), |
a361d84b KY |
13335 | { } /* end */ |
13336 | }; | |
13337 | ||
13338 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
13339 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
13340 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
13341 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
13342 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
fdbc6626 | 13343 | _DEFINE_CAPSRC(2), |
a361d84b KY |
13344 | { } /* end */ |
13345 | }; | |
13346 | ||
13347 | static struct hda_input_mux alc268_capture_source = { | |
13348 | .num_items = 4, | |
13349 | .items = { | |
13350 | { "Mic", 0x0 }, | |
13351 | { "Front Mic", 0x1 }, | |
13352 | { "Line", 0x2 }, | |
13353 | { "CD", 0x3 }, | |
13354 | }, | |
13355 | }; | |
13356 | ||
0ccb541c | 13357 | static struct hda_input_mux alc268_acer_capture_source = { |
c238b4f4 TI |
13358 | .num_items = 3, |
13359 | .items = { | |
13360 | { "Mic", 0x0 }, | |
13361 | { "Internal Mic", 0x1 }, | |
13362 | { "Line", 0x2 }, | |
13363 | }, | |
13364 | }; | |
13365 | ||
13366 | static struct hda_input_mux alc268_acer_dmic_capture_source = { | |
0ccb541c TI |
13367 | .num_items = 3, |
13368 | .items = { | |
13369 | { "Mic", 0x0 }, | |
13370 | { "Internal Mic", 0x6 }, | |
13371 | { "Line", 0x2 }, | |
13372 | }, | |
13373 | }; | |
13374 | ||
86c53bd2 JW |
13375 | #ifdef CONFIG_SND_DEBUG |
13376 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
86c53bd2 JW |
13377 | /* Volume widgets */ |
13378 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13379 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13380 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
13381 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
13382 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
13383 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
13384 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
13385 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
13386 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
13387 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
13388 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
13389 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
13390 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
f0747ee6 TI |
13391 | /* The below appears problematic on some hardwares */ |
13392 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
86c53bd2 JW |
13393 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
13394 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
13395 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
13396 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
13397 | ||
13398 | /* Modes for retasking pin widgets */ | |
13399 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
13400 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
13401 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
13402 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
13403 | ||
13404 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
13405 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
13406 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
13407 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
13408 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
13409 | ||
13410 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
13411 | * The ALC268 does not have an SPDIF input. | |
13412 | */ | |
13413 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
13414 | ||
13415 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
13416 | * this output to turn on an external amplifier. | |
13417 | */ | |
13418 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
13419 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
13420 | ||
13421 | { } /* end */ | |
13422 | }; | |
13423 | #endif | |
13424 | ||
a361d84b KY |
13425 | /* create input playback/capture controls for the given pin */ |
13426 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
13427 | const char *ctlname, int idx) | |
13428 | { | |
3f3b7c1a | 13429 | hda_nid_t dac; |
a361d84b KY |
13430 | int err; |
13431 | ||
3f3b7c1a TI |
13432 | switch (nid) { |
13433 | case 0x14: | |
13434 | case 0x16: | |
13435 | dac = 0x02; | |
13436 | break; | |
13437 | case 0x15: | |
b08b1637 TI |
13438 | case 0x1a: /* ALC259/269 only */ |
13439 | case 0x1b: /* ALC259/269 only */ | |
531d8791 | 13440 | case 0x21: /* ALC269vb has this pin, too */ |
3f3b7c1a TI |
13441 | dac = 0x03; |
13442 | break; | |
13443 | default: | |
c7a9434d TI |
13444 | snd_printd(KERN_WARNING "hda_codec: " |
13445 | "ignoring pin 0x%x as unknown\n", nid); | |
3f3b7c1a TI |
13446 | return 0; |
13447 | } | |
13448 | if (spec->multiout.dac_nids[0] != dac && | |
13449 | spec->multiout.dac_nids[1] != dac) { | |
0afe5f89 | 13450 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
3f3b7c1a | 13451 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
a361d84b KY |
13452 | HDA_OUTPUT)); |
13453 | if (err < 0) | |
13454 | return err; | |
3f3b7c1a TI |
13455 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
13456 | } | |
13457 | ||
3f3b7c1a | 13458 | if (nid != 0x16) |
0afe5f89 | 13459 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
a361d84b | 13460 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
3f3b7c1a | 13461 | else /* mono */ |
0afe5f89 | 13462 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
3f3b7c1a | 13463 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
a361d84b KY |
13464 | if (err < 0) |
13465 | return err; | |
13466 | return 0; | |
13467 | } | |
13468 | ||
13469 | /* add playback controls from the parsed DAC table */ | |
13470 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
13471 | const struct auto_pin_cfg *cfg) | |
13472 | { | |
13473 | hda_nid_t nid; | |
13474 | int err; | |
13475 | ||
a361d84b | 13476 | spec->multiout.dac_nids = spec->private_dac_nids; |
a361d84b KY |
13477 | |
13478 | nid = cfg->line_out_pins[0]; | |
3f3b7c1a TI |
13479 | if (nid) { |
13480 | const char *name; | |
13481 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
13482 | name = "Speaker"; | |
13483 | else | |
13484 | name = "Front"; | |
13485 | err = alc268_new_analog_output(spec, nid, name, 0); | |
13486 | if (err < 0) | |
13487 | return err; | |
13488 | } | |
a361d84b KY |
13489 | |
13490 | nid = cfg->speaker_pins[0]; | |
13491 | if (nid == 0x1d) { | |
0afe5f89 | 13492 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
a361d84b KY |
13493 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
13494 | if (err < 0) | |
13495 | return err; | |
7bfb9c03 | 13496 | } else if (nid) { |
3f3b7c1a TI |
13497 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
13498 | if (err < 0) | |
13499 | return err; | |
a361d84b KY |
13500 | } |
13501 | nid = cfg->hp_pins[0]; | |
3f3b7c1a TI |
13502 | if (nid) { |
13503 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); | |
13504 | if (err < 0) | |
13505 | return err; | |
13506 | } | |
a361d84b KY |
13507 | |
13508 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
13509 | if (nid == 0x16) { | |
0afe5f89 | 13510 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
3f3b7c1a | 13511 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
a361d84b KY |
13512 | if (err < 0) |
13513 | return err; | |
13514 | } | |
ea1fb29a | 13515 | return 0; |
a361d84b KY |
13516 | } |
13517 | ||
13518 | /* create playback/capture controls for input pins */ | |
05f5f477 | 13519 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
a361d84b KY |
13520 | const struct auto_pin_cfg *cfg) |
13521 | { | |
05f5f477 | 13522 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
a361d84b KY |
13523 | } |
13524 | ||
e9af4f36 TI |
13525 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
13526 | hda_nid_t nid, int pin_type) | |
13527 | { | |
13528 | int idx; | |
13529 | ||
13530 | alc_set_pin_output(codec, nid, pin_type); | |
13531 | if (nid == 0x14 || nid == 0x16) | |
13532 | idx = 0; | |
13533 | else | |
13534 | idx = 1; | |
13535 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | |
13536 | } | |
13537 | ||
13538 | static void alc268_auto_init_multi_out(struct hda_codec *codec) | |
13539 | { | |
13540 | struct alc_spec *spec = codec->spec; | |
e1ca7b4e TI |
13541 | int i; |
13542 | ||
13543 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
13544 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
e9af4f36 TI |
13545 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
13546 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); | |
13547 | } | |
13548 | } | |
13549 | ||
13550 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | |
13551 | { | |
13552 | struct alc_spec *spec = codec->spec; | |
13553 | hda_nid_t pin; | |
e1ca7b4e | 13554 | int i; |
e9af4f36 | 13555 | |
e1ca7b4e TI |
13556 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
13557 | pin = spec->autocfg.hp_pins[i]; | |
e9af4f36 | 13558 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
e1ca7b4e TI |
13559 | } |
13560 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { | |
13561 | pin = spec->autocfg.speaker_pins[i]; | |
e9af4f36 | 13562 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
e1ca7b4e TI |
13563 | } |
13564 | if (spec->autocfg.mono_out_pin) | |
13565 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, | |
13566 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
e9af4f36 TI |
13567 | } |
13568 | ||
a361d84b KY |
13569 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
13570 | { | |
13571 | struct alc_spec *spec = codec->spec; | |
13572 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
13573 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
13574 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
13575 | unsigned int dac_vol1, dac_vol2; | |
13576 | ||
e9af4f36 | 13577 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
a361d84b KY |
13578 | snd_hda_codec_write(codec, speaker_nid, 0, |
13579 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
e9af4f36 | 13580 | /* mute mixer inputs from 0x1d */ |
a361d84b KY |
13581 | snd_hda_codec_write(codec, 0x0f, 0, |
13582 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13583 | AMP_IN_UNMUTE(1)); | |
13584 | snd_hda_codec_write(codec, 0x10, 0, | |
13585 | AC_VERB_SET_AMP_GAIN_MUTE, | |
13586 | AMP_IN_UNMUTE(1)); | |
13587 | } else { | |
e9af4f36 | 13588 | /* unmute mixer inputs from 0x1d */ |
a361d84b KY |
13589 | snd_hda_codec_write(codec, 0x0f, 0, |
13590 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13591 | snd_hda_codec_write(codec, 0x10, 0, | |
13592 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
13593 | } | |
13594 | ||
13595 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
ea1fb29a | 13596 | if (line_nid == 0x14) |
a361d84b KY |
13597 | dac_vol2 = AMP_OUT_ZERO; |
13598 | else if (line_nid == 0x15) | |
13599 | dac_vol1 = AMP_OUT_ZERO; | |
ea1fb29a | 13600 | if (hp_nid == 0x14) |
a361d84b KY |
13601 | dac_vol2 = AMP_OUT_ZERO; |
13602 | else if (hp_nid == 0x15) | |
13603 | dac_vol1 = AMP_OUT_ZERO; | |
13604 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
13605 | spec->autocfg.line_out_pins[1] != 0x16 || | |
13606 | spec->autocfg.line_out_pins[2] != 0x16) | |
13607 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
13608 | ||
13609 | snd_hda_codec_write(codec, 0x02, 0, | |
13610 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
13611 | snd_hda_codec_write(codec, 0x03, 0, | |
13612 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
13613 | } | |
13614 | ||
def319f9 | 13615 | /* pcm configuration: identical with ALC880 */ |
a361d84b KY |
13616 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
13617 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 13618 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
a361d84b KY |
13619 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
13620 | ||
13621 | /* | |
13622 | * BIOS auto configuration | |
13623 | */ | |
13624 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
13625 | { | |
13626 | struct alc_spec *spec = codec->spec; | |
13627 | int err; | |
13628 | static hda_nid_t alc268_ignore[] = { 0 }; | |
13629 | ||
13630 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
13631 | alc268_ignore); | |
13632 | if (err < 0) | |
13633 | return err; | |
7e0e44d4 TI |
13634 | if (!spec->autocfg.line_outs) { |
13635 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
13636 | spec->multiout.max_channels = 2; | |
13637 | spec->no_analog = 1; | |
13638 | goto dig_only; | |
13639 | } | |
a361d84b | 13640 | return 0; /* can't find valid BIOS pin config */ |
7e0e44d4 | 13641 | } |
a361d84b KY |
13642 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
13643 | if (err < 0) | |
13644 | return err; | |
05f5f477 | 13645 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
a361d84b KY |
13646 | if (err < 0) |
13647 | return err; | |
13648 | ||
13649 | spec->multiout.max_channels = 2; | |
13650 | ||
7e0e44d4 | 13651 | dig_only: |
a361d84b | 13652 | /* digital only support output */ |
757899ac | 13653 | alc_auto_parse_digital(codec); |
603c4019 | 13654 | if (spec->kctls.list) |
d88897ea | 13655 | add_mixer(spec, spec->kctls.list); |
a361d84b | 13656 | |
892981ff | 13657 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
d88897ea | 13658 | add_mixer(spec, alc268_beep_mixer); |
aef9d318 | 13659 | |
d88897ea | 13660 | add_verb(spec, alc268_volume_init_verbs); |
5908589f | 13661 | spec->num_mux_defs = 2; |
61b9b9b1 | 13662 | spec->input_mux = &spec->private_imux[0]; |
a361d84b | 13663 | |
776e184e TI |
13664 | err = alc_auto_add_mic_boost(codec); |
13665 | if (err < 0) | |
13666 | return err; | |
13667 | ||
6227cdce | 13668 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
1d955ebd | 13669 | |
a361d84b KY |
13670 | return 1; |
13671 | } | |
13672 | ||
a361d84b KY |
13673 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
13674 | ||
13675 | /* init callback for auto-configuration model -- overriding the default init */ | |
13676 | static void alc268_auto_init(struct hda_codec *codec) | |
13677 | { | |
f6c7e546 | 13678 | struct alc_spec *spec = codec->spec; |
a361d84b KY |
13679 | alc268_auto_init_multi_out(codec); |
13680 | alc268_auto_init_hp_out(codec); | |
13681 | alc268_auto_init_mono_speaker_out(codec); | |
13682 | alc268_auto_init_analog_input(codec); | |
757899ac | 13683 | alc_auto_init_digital(codec); |
f6c7e546 | 13684 | if (spec->unsol_event) |
7fb0d78f | 13685 | alc_inithook(codec); |
a361d84b KY |
13686 | } |
13687 | ||
13688 | /* | |
13689 | * configuration and preset | |
13690 | */ | |
13691 | static const char *alc268_models[ALC268_MODEL_LAST] = { | |
eb5a6621 | 13692 | [ALC267_QUANTA_IL1] = "quanta-il1", |
a361d84b | 13693 | [ALC268_3ST] = "3stack", |
983f8ae4 | 13694 | [ALC268_TOSHIBA] = "toshiba", |
d273809e | 13695 | [ALC268_ACER] = "acer", |
c238b4f4 | 13696 | [ALC268_ACER_DMIC] = "acer-dmic", |
8ef355da | 13697 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
3866f0b0 | 13698 | [ALC268_DELL] = "dell", |
f12462c5 | 13699 | [ALC268_ZEPTO] = "zepto", |
86c53bd2 JW |
13700 | #ifdef CONFIG_SND_DEBUG |
13701 | [ALC268_TEST] = "test", | |
13702 | #endif | |
a361d84b KY |
13703 | [ALC268_AUTO] = "auto", |
13704 | }; | |
13705 | ||
13706 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
a0b8f7d8 | 13707 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
ac3e3741 | 13708 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
dafc8357 | 13709 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
ac3e3741 | 13710 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
29a52c24 | 13711 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
8ef355da KY |
13712 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
13713 | ALC268_ACER_ASPIRE_ONE), | |
3866f0b0 | 13714 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
a1bf8088 DC |
13715 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
13716 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), | |
33d78674 TI |
13717 | /* almost compatible with toshiba but with optional digital outs; |
13718 | * auto-probing seems working fine | |
13719 | */ | |
8871e5b9 | 13720 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
33d78674 | 13721 | ALC268_AUTO), |
a361d84b | 13722 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
8871e5b9 | 13723 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
378bd6a5 | 13724 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
b875bf3a | 13725 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
eb5a6621 | 13726 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
a361d84b KY |
13727 | {} |
13728 | }; | |
13729 | ||
3abf2f36 TI |
13730 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
13731 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | |
13732 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | |
13733 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | |
13734 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | |
13735 | ALC268_TOSHIBA), | |
13736 | {} | |
13737 | }; | |
13738 | ||
a361d84b | 13739 | static struct alc_config_preset alc268_presets[] = { |
eb5a6621 | 13740 | [ALC267_QUANTA_IL1] = { |
fdbc6626 TI |
13741 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
13742 | alc268_capture_nosrc_mixer }, | |
eb5a6621 HRK |
13743 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13744 | alc267_quanta_il1_verbs }, | |
13745 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13746 | .dac_nids = alc268_dac_nids, | |
13747 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13748 | .adc_nids = alc268_adc_nids_alt, | |
13749 | .hp_nid = 0x03, | |
13750 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13751 | .channel_mode = alc268_modes, | |
4f5d1706 TI |
13752 | .unsol_event = alc_sku_unsol_event, |
13753 | .setup = alc267_quanta_il1_setup, | |
13754 | .init_hook = alc_inithook, | |
eb5a6621 | 13755 | }, |
a361d84b | 13756 | [ALC268_3ST] = { |
aef9d318 TI |
13757 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
13758 | alc268_beep_mixer }, | |
a361d84b KY |
13759 | .init_verbs = { alc268_base_init_verbs }, |
13760 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13761 | .dac_nids = alc268_dac_nids, | |
13762 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13763 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13764 | .capsrc_nids = alc268_capsrc_nids, |
a361d84b KY |
13765 | .hp_nid = 0x03, |
13766 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13767 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13768 | .channel_mode = alc268_modes, | |
13769 | .input_mux = &alc268_capture_source, | |
13770 | }, | |
d1a991a6 | 13771 | [ALC268_TOSHIBA] = { |
42171c17 | 13772 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
aef9d318 | 13773 | alc268_beep_mixer }, |
d273809e TI |
13774 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13775 | alc268_toshiba_verbs }, | |
d1a991a6 KY |
13776 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
13777 | .dac_nids = alc268_dac_nids, | |
13778 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13779 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13780 | .capsrc_nids = alc268_capsrc_nids, |
d1a991a6 KY |
13781 | .hp_nid = 0x03, |
13782 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13783 | .channel_mode = alc268_modes, | |
13784 | .input_mux = &alc268_capture_source, | |
d273809e | 13785 | .unsol_event = alc268_toshiba_unsol_event, |
4f5d1706 TI |
13786 | .setup = alc268_toshiba_setup, |
13787 | .init_hook = alc268_toshiba_automute, | |
d273809e TI |
13788 | }, |
13789 | [ALC268_ACER] = { | |
432fd133 | 13790 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
aef9d318 | 13791 | alc268_beep_mixer }, |
d273809e TI |
13792 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13793 | alc268_acer_verbs }, | |
13794 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13795 | .dac_nids = alc268_dac_nids, | |
13796 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13797 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13798 | .capsrc_nids = alc268_capsrc_nids, |
d273809e TI |
13799 | .hp_nid = 0x02, |
13800 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13801 | .channel_mode = alc268_modes, | |
0ccb541c | 13802 | .input_mux = &alc268_acer_capture_source, |
d273809e | 13803 | .unsol_event = alc268_acer_unsol_event, |
889c4395 | 13804 | .init_hook = alc268_acer_init_hook, |
d1a991a6 | 13805 | }, |
c238b4f4 TI |
13806 | [ALC268_ACER_DMIC] = { |
13807 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, | |
13808 | alc268_beep_mixer }, | |
13809 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13810 | alc268_acer_verbs }, | |
13811 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13812 | .dac_nids = alc268_dac_nids, | |
13813 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13814 | .adc_nids = alc268_adc_nids_alt, | |
13815 | .capsrc_nids = alc268_capsrc_nids, | |
13816 | .hp_nid = 0x02, | |
13817 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13818 | .channel_mode = alc268_modes, | |
13819 | .input_mux = &alc268_acer_dmic_capture_source, | |
13820 | .unsol_event = alc268_acer_unsol_event, | |
13821 | .init_hook = alc268_acer_init_hook, | |
13822 | }, | |
8ef355da KY |
13823 | [ALC268_ACER_ASPIRE_ONE] = { |
13824 | .mixers = { alc268_acer_aspire_one_mixer, | |
22971e3a | 13825 | alc268_beep_mixer, |
fdbc6626 | 13826 | alc268_capture_nosrc_mixer }, |
8ef355da KY |
13827 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13828 | alc268_acer_aspire_one_verbs }, | |
13829 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13830 | .dac_nids = alc268_dac_nids, | |
13831 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13832 | .adc_nids = alc268_adc_nids_alt, | |
13833 | .capsrc_nids = alc268_capsrc_nids, | |
13834 | .hp_nid = 0x03, | |
13835 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13836 | .channel_mode = alc268_modes, | |
8ef355da | 13837 | .unsol_event = alc268_acer_lc_unsol_event, |
4f5d1706 | 13838 | .setup = alc268_acer_lc_setup, |
8ef355da KY |
13839 | .init_hook = alc268_acer_lc_init_hook, |
13840 | }, | |
3866f0b0 | 13841 | [ALC268_DELL] = { |
fdbc6626 TI |
13842 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
13843 | alc268_capture_nosrc_mixer }, | |
3866f0b0 TI |
13844 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13845 | alc268_dell_verbs }, | |
13846 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13847 | .dac_nids = alc268_dac_nids, | |
fdbc6626 TI |
13848 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
13849 | .adc_nids = alc268_adc_nids_alt, | |
13850 | .capsrc_nids = alc268_capsrc_nids, | |
3866f0b0 TI |
13851 | .hp_nid = 0x02, |
13852 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13853 | .channel_mode = alc268_modes, | |
a9fd4f3f | 13854 | .unsol_event = alc_sku_unsol_event, |
4f5d1706 TI |
13855 | .setup = alc268_dell_setup, |
13856 | .init_hook = alc_inithook, | |
3866f0b0 | 13857 | }, |
f12462c5 | 13858 | [ALC268_ZEPTO] = { |
aef9d318 TI |
13859 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
13860 | alc268_beep_mixer }, | |
f12462c5 MT |
13861 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
13862 | alc268_toshiba_verbs }, | |
13863 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13864 | .dac_nids = alc268_dac_nids, | |
13865 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13866 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13867 | .capsrc_nids = alc268_capsrc_nids, |
f12462c5 MT |
13868 | .hp_nid = 0x03, |
13869 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13870 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13871 | .channel_mode = alc268_modes, | |
13872 | .input_mux = &alc268_capture_source, | |
4f5d1706 TI |
13873 | .setup = alc268_toshiba_setup, |
13874 | .init_hook = alc268_toshiba_automute, | |
f12462c5 | 13875 | }, |
86c53bd2 JW |
13876 | #ifdef CONFIG_SND_DEBUG |
13877 | [ALC268_TEST] = { | |
13878 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
13879 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
13880 | alc268_volume_init_verbs }, | |
13881 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
13882 | .dac_nids = alc268_dac_nids, | |
13883 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
13884 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 13885 | .capsrc_nids = alc268_capsrc_nids, |
86c53bd2 JW |
13886 | .hp_nid = 0x03, |
13887 | .dig_out_nid = ALC268_DIGOUT_NID, | |
13888 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
13889 | .channel_mode = alc268_modes, | |
13890 | .input_mux = &alc268_capture_source, | |
13891 | }, | |
13892 | #endif | |
a361d84b KY |
13893 | }; |
13894 | ||
13895 | static int patch_alc268(struct hda_codec *codec) | |
13896 | { | |
13897 | struct alc_spec *spec; | |
13898 | int board_config; | |
22971e3a | 13899 | int i, has_beep, err; |
a361d84b | 13900 | |
ef86f581 | 13901 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
a361d84b KY |
13902 | if (spec == NULL) |
13903 | return -ENOMEM; | |
13904 | ||
13905 | codec->spec = spec; | |
13906 | ||
13907 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
13908 | alc268_models, | |
13909 | alc268_cfg_tbl); | |
13910 | ||
3abf2f36 TI |
13911 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
13912 | board_config = snd_hda_check_board_codec_sid_config(codec, | |
50ae0aa8 | 13913 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
3abf2f36 | 13914 | |
a361d84b | 13915 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
9a11f1aa TI |
13916 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
13917 | codec->chip_name); | |
a361d84b KY |
13918 | board_config = ALC268_AUTO; |
13919 | } | |
13920 | ||
13921 | if (board_config == ALC268_AUTO) { | |
13922 | /* automatic parse from the BIOS config */ | |
13923 | err = alc268_parse_auto_config(codec); | |
13924 | if (err < 0) { | |
13925 | alc_free(codec); | |
13926 | return err; | |
13927 | } else if (!err) { | |
13928 | printk(KERN_INFO | |
13929 | "hda_codec: Cannot set up configuration " | |
13930 | "from BIOS. Using base mode...\n"); | |
13931 | board_config = ALC268_3ST; | |
13932 | } | |
13933 | } | |
13934 | ||
13935 | if (board_config != ALC268_AUTO) | |
e9c364c0 | 13936 | setup_preset(codec, &alc268_presets[board_config]); |
a361d84b | 13937 | |
a361d84b KY |
13938 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
13939 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
6330079f | 13940 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
a361d84b | 13941 | |
a361d84b KY |
13942 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
13943 | ||
22971e3a TI |
13944 | has_beep = 0; |
13945 | for (i = 0; i < spec->num_mixers; i++) { | |
13946 | if (spec->mixers[i] == alc268_beep_mixer) { | |
13947 | has_beep = 1; | |
13948 | break; | |
13949 | } | |
13950 | } | |
13951 | ||
13952 | if (has_beep) { | |
13953 | err = snd_hda_attach_beep_device(codec, 0x1); | |
13954 | if (err < 0) { | |
13955 | alc_free(codec); | |
13956 | return err; | |
13957 | } | |
13958 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | |
13959 | /* override the amp caps for beep generator */ | |
13960 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
aef9d318 TI |
13961 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
13962 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
13963 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
13964 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
22971e3a | 13965 | } |
aef9d318 | 13966 | |
7e0e44d4 | 13967 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
3866f0b0 TI |
13968 | /* check whether NID 0x07 is valid */ |
13969 | unsigned int wcap = get_wcaps(codec, 0x07); | |
85860c06 | 13970 | int i; |
3866f0b0 | 13971 | |
defb5ab2 | 13972 | spec->capsrc_nids = alc268_capsrc_nids; |
3866f0b0 | 13973 | /* get type */ |
a22d543a | 13974 | wcap = get_wcaps_type(wcap); |
fdbc6626 TI |
13975 | if (spec->auto_mic || |
13976 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
3866f0b0 TI |
13977 | spec->adc_nids = alc268_adc_nids_alt; |
13978 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
defb5ab2 TI |
13979 | if (spec->auto_mic) |
13980 | fixup_automic_adc(codec); | |
fdbc6626 TI |
13981 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
13982 | add_mixer(spec, alc268_capture_nosrc_mixer); | |
13983 | else | |
13984 | add_mixer(spec, alc268_capture_alt_mixer); | |
3866f0b0 TI |
13985 | } else { |
13986 | spec->adc_nids = alc268_adc_nids; | |
13987 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
d88897ea | 13988 | add_mixer(spec, alc268_capture_mixer); |
a361d84b | 13989 | } |
85860c06 TI |
13990 | /* set default input source */ |
13991 | for (i = 0; i < spec->num_adc_nids; i++) | |
13992 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
13993 | 0, AC_VERB_SET_CONNECT_SEL, | |
5908589f HRK |
13994 | i < spec->num_mux_defs ? |
13995 | spec->input_mux[i].items[0].index : | |
85860c06 | 13996 | spec->input_mux->items[0].index); |
a361d84b | 13997 | } |
2134ea4f TI |
13998 | |
13999 | spec->vmaster_nid = 0x02; | |
14000 | ||
a361d84b KY |
14001 | codec->patch_ops = alc_patch_ops; |
14002 | if (board_config == ALC268_AUTO) | |
14003 | spec->init_hook = alc268_auto_init; | |
ea1fb29a | 14004 | |
bf1b0225 KY |
14005 | alc_init_jacks(codec); |
14006 | ||
a361d84b KY |
14007 | return 0; |
14008 | } | |
14009 | ||
f6a92248 KY |
14010 | /* |
14011 | * ALC269 channel source setting (2 channel) | |
14012 | */ | |
14013 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
14014 | ||
14015 | #define alc269_dac_nids alc260_dac_nids | |
14016 | ||
14017 | static hda_nid_t alc269_adc_nids[1] = { | |
14018 | /* ADC1 */ | |
f53281e6 KY |
14019 | 0x08, |
14020 | }; | |
14021 | ||
e01bf509 TI |
14022 | static hda_nid_t alc269_capsrc_nids[1] = { |
14023 | 0x23, | |
14024 | }; | |
14025 | ||
84898e87 KY |
14026 | static hda_nid_t alc269vb_adc_nids[1] = { |
14027 | /* ADC1 */ | |
14028 | 0x09, | |
14029 | }; | |
14030 | ||
14031 | static hda_nid_t alc269vb_capsrc_nids[1] = { | |
14032 | 0x22, | |
14033 | }; | |
14034 | ||
6694635d TI |
14035 | static hda_nid_t alc269_adc_candidates[] = { |
14036 | 0x08, 0x09, 0x07, | |
14037 | }; | |
e01bf509 | 14038 | |
f6a92248 KY |
14039 | #define alc269_modes alc260_modes |
14040 | #define alc269_capture_source alc880_lg_lw_capture_source | |
14041 | ||
14042 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
14043 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14044 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14049 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14050 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
14051 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
14052 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
14053 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14054 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
14055 | { } /* end */ | |
14056 | }; | |
14057 | ||
60db6b53 KY |
14058 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
14059 | /* output mixer control */ | |
14060 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
14061 | { | |
14062 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14063 | .name = "Master Playback Switch", | |
5e26dfd0 | 14064 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
60db6b53 KY |
14065 | .info = snd_hda_mixer_amp_switch_info, |
14066 | .get = snd_hda_mixer_amp_switch_get, | |
14067 | .put = alc268_acer_master_sw_put, | |
14068 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14069 | }, | |
14070 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14071 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14072 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14073 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
14074 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
14075 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
60db6b53 KY |
14076 | { } |
14077 | }; | |
14078 | ||
64154835 TV |
14079 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
14080 | /* output mixer control */ | |
14081 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
14082 | { | |
14083 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14084 | .name = "Master Playback Switch", | |
5e26dfd0 | 14085 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
64154835 TV |
14086 | .info = snd_hda_mixer_amp_switch_info, |
14087 | .get = snd_hda_mixer_amp_switch_get, | |
14088 | .put = alc268_acer_master_sw_put, | |
14089 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14090 | }, | |
14091 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14092 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14093 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14094 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
14095 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
14096 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
14097 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
14098 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
14099 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), | |
64154835 TV |
14100 | { } |
14101 | }; | |
14102 | ||
84898e87 | 14103 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
aa202455 | 14104 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
508f7110 | 14105 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
aa202455 | 14106 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
508f7110 | 14107 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
f53281e6 KY |
14108 | { } /* end */ |
14109 | }; | |
14110 | ||
84898e87 KY |
14111 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
14112 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14113 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14114 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
14115 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
14116 | { } /* end */ | |
14117 | }; | |
14118 | ||
fe3eb0a7 KY |
14119 | static struct snd_kcontrol_new alc269_asus_mixer[] = { |
14120 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14121 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), | |
14122 | { } /* end */ | |
14123 | }; | |
14124 | ||
f53281e6 | 14125 | /* capture mixer elements */ |
84898e87 KY |
14126 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
14127 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
14128 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
14129 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14130 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | |
14131 | { } /* end */ | |
14132 | }; | |
14133 | ||
14134 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { | |
f53281e6 KY |
14135 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
14136 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
26f5df26 TI |
14137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
14138 | { } /* end */ | |
14139 | }; | |
14140 | ||
84898e87 KY |
14141 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
14142 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
14143 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
14144 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14145 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | |
14146 | { } /* end */ | |
14147 | }; | |
14148 | ||
14149 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { | |
14150 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
14151 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
14152 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
14153 | { } /* end */ | |
14154 | }; | |
14155 | ||
26f5df26 | 14156 | /* FSC amilo */ |
84898e87 | 14157 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
f53281e6 | 14158 | |
60db6b53 KY |
14159 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
14160 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14161 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14162 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14163 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14164 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14165 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14166 | { } | |
14167 | }; | |
f6a92248 | 14168 | |
64154835 TV |
14169 | static struct hda_verb alc269_lifebook_verbs[] = { |
14170 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14171 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14172 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14173 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14174 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14175 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14176 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14177 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
14178 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14179 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14180 | { } | |
14181 | }; | |
14182 | ||
60db6b53 KY |
14183 | /* toggle speaker-output according to the hp-jack state */ |
14184 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |
14185 | { | |
14186 | unsigned int present; | |
14187 | unsigned char bits; | |
f6a92248 | 14188 | |
864f92be | 14189 | present = snd_hda_jack_detect(codec, 0x15); |
5dbd5ec6 | 14190 | bits = present ? HDA_AMP_MUTE : 0; |
60db6b53 | 14191 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 14192 | HDA_AMP_MUTE, bits); |
60db6b53 | 14193 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 14194 | HDA_AMP_MUTE, bits); |
f6a92248 | 14195 | |
60db6b53 KY |
14196 | snd_hda_codec_write(codec, 0x20, 0, |
14197 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14198 | snd_hda_codec_write(codec, 0x20, 0, | |
14199 | AC_VERB_SET_PROC_COEF, 0x680); | |
f6a92248 | 14200 | |
60db6b53 KY |
14201 | snd_hda_codec_write(codec, 0x20, 0, |
14202 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14203 | snd_hda_codec_write(codec, 0x20, 0, | |
14204 | AC_VERB_SET_PROC_COEF, 0x480); | |
14205 | } | |
f6a92248 | 14206 | |
64154835 TV |
14207 | /* toggle speaker-output according to the hp-jacks state */ |
14208 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |
14209 | { | |
14210 | unsigned int present; | |
14211 | unsigned char bits; | |
14212 | ||
14213 | /* Check laptop headphone socket */ | |
864f92be | 14214 | present = snd_hda_jack_detect(codec, 0x15); |
64154835 TV |
14215 | |
14216 | /* Check port replicator headphone socket */ | |
864f92be | 14217 | present |= snd_hda_jack_detect(codec, 0x1a); |
64154835 | 14218 | |
5dbd5ec6 | 14219 | bits = present ? HDA_AMP_MUTE : 0; |
64154835 | 14220 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 14221 | HDA_AMP_MUTE, bits); |
64154835 | 14222 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 14223 | HDA_AMP_MUTE, bits); |
64154835 TV |
14224 | |
14225 | snd_hda_codec_write(codec, 0x20, 0, | |
14226 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14227 | snd_hda_codec_write(codec, 0x20, 0, | |
14228 | AC_VERB_SET_PROC_COEF, 0x680); | |
14229 | ||
14230 | snd_hda_codec_write(codec, 0x20, 0, | |
14231 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
14232 | snd_hda_codec_write(codec, 0x20, 0, | |
14233 | AC_VERB_SET_PROC_COEF, 0x480); | |
14234 | } | |
14235 | ||
64154835 TV |
14236 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
14237 | { | |
14238 | unsigned int present_laptop; | |
14239 | unsigned int present_dock; | |
14240 | ||
864f92be WF |
14241 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
14242 | present_dock = snd_hda_jack_detect(codec, 0x1b); | |
64154835 TV |
14243 | |
14244 | /* Laptop mic port overrides dock mic port, design decision */ | |
14245 | if (present_dock) | |
14246 | snd_hda_codec_write(codec, 0x23, 0, | |
14247 | AC_VERB_SET_CONNECT_SEL, 0x3); | |
14248 | if (present_laptop) | |
14249 | snd_hda_codec_write(codec, 0x23, 0, | |
14250 | AC_VERB_SET_CONNECT_SEL, 0x0); | |
14251 | if (!present_dock && !present_laptop) | |
14252 | snd_hda_codec_write(codec, 0x23, 0, | |
14253 | AC_VERB_SET_CONNECT_SEL, 0x1); | |
14254 | } | |
14255 | ||
60db6b53 KY |
14256 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
14257 | unsigned int res) | |
14258 | { | |
4f5d1706 TI |
14259 | switch (res >> 26) { |
14260 | case ALC880_HP_EVENT: | |
60db6b53 | 14261 | alc269_quanta_fl1_speaker_automute(codec); |
4f5d1706 TI |
14262 | break; |
14263 | case ALC880_MIC_EVENT: | |
14264 | alc_mic_automute(codec); | |
14265 | break; | |
14266 | } | |
60db6b53 | 14267 | } |
f6a92248 | 14268 | |
64154835 TV |
14269 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
14270 | unsigned int res) | |
14271 | { | |
14272 | if ((res >> 26) == ALC880_HP_EVENT) | |
14273 | alc269_lifebook_speaker_automute(codec); | |
14274 | if ((res >> 26) == ALC880_MIC_EVENT) | |
14275 | alc269_lifebook_mic_autoswitch(codec); | |
14276 | } | |
14277 | ||
4f5d1706 TI |
14278 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
14279 | { | |
14280 | struct alc_spec *spec = codec->spec; | |
20645d70 TI |
14281 | spec->autocfg.hp_pins[0] = 0x15; |
14282 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
14283 | spec->ext_mic.pin = 0x18; |
14284 | spec->ext_mic.mux_idx = 0; | |
14285 | spec->int_mic.pin = 0x19; | |
14286 | spec->int_mic.mux_idx = 1; | |
14287 | spec->auto_mic = 1; | |
14288 | } | |
14289 | ||
60db6b53 KY |
14290 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
14291 | { | |
14292 | alc269_quanta_fl1_speaker_automute(codec); | |
4f5d1706 | 14293 | alc_mic_automute(codec); |
60db6b53 | 14294 | } |
f6a92248 | 14295 | |
64154835 TV |
14296 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
14297 | { | |
14298 | alc269_lifebook_speaker_automute(codec); | |
14299 | alc269_lifebook_mic_autoswitch(codec); | |
14300 | } | |
14301 | ||
84898e87 | 14302 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
f53281e6 KY |
14303 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
14304 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | |
14305 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14306 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14307 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14308 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14309 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14310 | {} | |
14311 | }; | |
14312 | ||
84898e87 | 14313 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
f53281e6 KY |
14314 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
14315 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14316 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14317 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | |
14318 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14319 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14320 | {} | |
14321 | }; | |
14322 | ||
84898e87 KY |
14323 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
14324 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14325 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
14326 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14327 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14328 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14329 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14330 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14331 | {} | |
14332 | }; | |
14333 | ||
14334 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { | |
14335 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14336 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
14337 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
14338 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
14339 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14340 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14341 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14342 | {} | |
14343 | }; | |
14344 | ||
fe3eb0a7 KY |
14345 | static struct hda_verb alc271_acer_dmic_verbs[] = { |
14346 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | |
14347 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | |
14348 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14350 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14351 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14352 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14353 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14354 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14355 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, | |
14356 | { } | |
14357 | }; | |
14358 | ||
f53281e6 KY |
14359 | /* toggle speaker-output according to the hp-jack state */ |
14360 | static void alc269_speaker_automute(struct hda_codec *codec) | |
14361 | { | |
ebb83eeb KY |
14362 | struct alc_spec *spec = codec->spec; |
14363 | unsigned int nid = spec->autocfg.hp_pins[0]; | |
f53281e6 | 14364 | unsigned int present; |
60db6b53 | 14365 | unsigned char bits; |
f53281e6 | 14366 | |
ebb83eeb | 14367 | present = snd_hda_jack_detect(codec, nid); |
5dbd5ec6 | 14368 | bits = present ? HDA_AMP_MUTE : 0; |
f53281e6 | 14369 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 14370 | HDA_AMP_MUTE, bits); |
f53281e6 | 14371 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 14372 | HDA_AMP_MUTE, bits); |
bf1b0225 | 14373 | alc_report_jack(codec, nid); |
f53281e6 KY |
14374 | } |
14375 | ||
f53281e6 | 14376 | /* unsolicited event for HP jack sensing */ |
84898e87 | 14377 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
60db6b53 | 14378 | unsigned int res) |
f53281e6 | 14379 | { |
4f5d1706 TI |
14380 | switch (res >> 26) { |
14381 | case ALC880_HP_EVENT: | |
f53281e6 | 14382 | alc269_speaker_automute(codec); |
4f5d1706 TI |
14383 | break; |
14384 | case ALC880_MIC_EVENT: | |
14385 | alc_mic_automute(codec); | |
14386 | break; | |
14387 | } | |
f53281e6 KY |
14388 | } |
14389 | ||
226b1ec8 | 14390 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
f53281e6 | 14391 | { |
4f5d1706 | 14392 | struct alc_spec *spec = codec->spec; |
20645d70 TI |
14393 | spec->autocfg.hp_pins[0] = 0x15; |
14394 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
14395 | spec->ext_mic.pin = 0x18; |
14396 | spec->ext_mic.mux_idx = 0; | |
226b1ec8 KY |
14397 | spec->int_mic.pin = 0x19; |
14398 | spec->int_mic.mux_idx = 1; | |
4f5d1706 | 14399 | spec->auto_mic = 1; |
f53281e6 KY |
14400 | } |
14401 | ||
226b1ec8 | 14402 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
84898e87 KY |
14403 | { |
14404 | struct alc_spec *spec = codec->spec; | |
20645d70 TI |
14405 | spec->autocfg.hp_pins[0] = 0x15; |
14406 | spec->autocfg.speaker_pins[0] = 0x14; | |
84898e87 KY |
14407 | spec->ext_mic.pin = 0x18; |
14408 | spec->ext_mic.mux_idx = 0; | |
14409 | spec->int_mic.pin = 0x12; | |
226b1ec8 | 14410 | spec->int_mic.mux_idx = 5; |
84898e87 KY |
14411 | spec->auto_mic = 1; |
14412 | } | |
14413 | ||
226b1ec8 | 14414 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
f53281e6 | 14415 | { |
4f5d1706 | 14416 | struct alc_spec *spec = codec->spec; |
226b1ec8 | 14417 | spec->autocfg.hp_pins[0] = 0x21; |
20645d70 | 14418 | spec->autocfg.speaker_pins[0] = 0x14; |
4f5d1706 TI |
14419 | spec->ext_mic.pin = 0x18; |
14420 | spec->ext_mic.mux_idx = 0; | |
14421 | spec->int_mic.pin = 0x19; | |
14422 | spec->int_mic.mux_idx = 1; | |
14423 | spec->auto_mic = 1; | |
f53281e6 KY |
14424 | } |
14425 | ||
226b1ec8 KY |
14426 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
14427 | { | |
14428 | struct alc_spec *spec = codec->spec; | |
14429 | spec->autocfg.hp_pins[0] = 0x21; | |
14430 | spec->autocfg.speaker_pins[0] = 0x14; | |
14431 | spec->ext_mic.pin = 0x18; | |
14432 | spec->ext_mic.mux_idx = 0; | |
14433 | spec->int_mic.pin = 0x12; | |
14434 | spec->int_mic.mux_idx = 6; | |
14435 | spec->auto_mic = 1; | |
14436 | } | |
14437 | ||
84898e87 | 14438 | static void alc269_laptop_inithook(struct hda_codec *codec) |
f53281e6 KY |
14439 | { |
14440 | alc269_speaker_automute(codec); | |
4f5d1706 | 14441 | alc_mic_automute(codec); |
f53281e6 KY |
14442 | } |
14443 | ||
60db6b53 KY |
14444 | /* |
14445 | * generic initialization of ADC, input mixers and output mixers | |
14446 | */ | |
14447 | static struct hda_verb alc269_init_verbs[] = { | |
14448 | /* | |
14449 | * Unmute ADC0 and set the default input to mic-in | |
14450 | */ | |
84898e87 | 14451 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
60db6b53 KY |
14452 | |
14453 | /* | |
84898e87 | 14454 | * Set up output mixers (0x02 - 0x03) |
60db6b53 KY |
14455 | */ |
14456 | /* set vol=0 to output mixers */ | |
14457 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14458 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14459 | ||
14460 | /* set up input amps for analog loopback */ | |
14461 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14464 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14465 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14466 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14467 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14468 | ||
14469 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14470 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14471 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14472 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14473 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14474 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14475 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14476 | ||
14477 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14478 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
60db6b53 | 14479 | |
84898e87 KY |
14480 | /* FIXME: use Mux-type input source selection */ |
14481 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
14482 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
14483 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
60db6b53 | 14484 | |
84898e87 KY |
14485 | /* set EAPD */ |
14486 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14487 | { } | |
14488 | }; | |
14489 | ||
14490 | static struct hda_verb alc269vb_init_verbs[] = { | |
14491 | /* | |
14492 | * Unmute ADC0 and set the default input to mic-in | |
14493 | */ | |
14494 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14495 | ||
14496 | /* | |
14497 | * Set up output mixers (0x02 - 0x03) | |
14498 | */ | |
14499 | /* set vol=0 to output mixers */ | |
14500 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14501 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14502 | ||
14503 | /* set up input amps for analog loopback */ | |
14504 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
14505 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14506 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14507 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14508 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14509 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14510 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14511 | ||
14512 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14513 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14514 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14515 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14516 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14517 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14518 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14519 | ||
14520 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14521 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14522 | ||
14523 | /* FIXME: use Mux-type input source selection */ | |
60db6b53 KY |
14524 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
14525 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
84898e87 | 14526 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
60db6b53 KY |
14527 | |
14528 | /* set EAPD */ | |
14529 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
60db6b53 KY |
14530 | { } |
14531 | }; | |
14532 | ||
9d0b71b1 TI |
14533 | #define alc269_auto_create_multi_out_ctls \ |
14534 | alc268_auto_create_multi_out_ctls | |
05f5f477 TI |
14535 | #define alc269_auto_create_input_ctls \ |
14536 | alc268_auto_create_input_ctls | |
f6a92248 KY |
14537 | |
14538 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
14539 | #define alc269_loopbacks alc880_loopbacks | |
14540 | #endif | |
14541 | ||
def319f9 | 14542 | /* pcm configuration: identical with ALC880 */ |
f6a92248 KY |
14543 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
14544 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
14545 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
14546 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
14547 | ||
f03d3115 TI |
14548 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
14549 | .substreams = 1, | |
14550 | .channels_min = 2, | |
14551 | .channels_max = 8, | |
14552 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14553 | /* NID is set in alc_build_pcms */ | |
14554 | .ops = { | |
14555 | .open = alc880_playback_pcm_open, | |
14556 | .prepare = alc880_playback_pcm_prepare, | |
14557 | .cleanup = alc880_playback_pcm_cleanup | |
14558 | }, | |
14559 | }; | |
14560 | ||
14561 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { | |
14562 | .substreams = 1, | |
14563 | .channels_min = 2, | |
14564 | .channels_max = 2, | |
14565 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
14566 | /* NID is set in alc_build_pcms */ | |
14567 | }; | |
14568 | ||
ad35879a TI |
14569 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14570 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) | |
14571 | { | |
14572 | switch (codec->subsystem_id) { | |
14573 | case 0x103c1586: | |
14574 | return 1; | |
14575 | } | |
14576 | return 0; | |
14577 | } | |
14578 | ||
14579 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) | |
14580 | { | |
14581 | /* update mute-LED according to the speaker mute state */ | |
14582 | if (nid == 0x01 || nid == 0x14) { | |
14583 | int pinval; | |
14584 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & | |
14585 | HDA_AMP_MUTE) | |
14586 | pinval = 0x24; | |
14587 | else | |
14588 | pinval = 0x20; | |
14589 | /* mic2 vref pin is used for mute LED control */ | |
a68d5a54 TI |
14590 | snd_hda_codec_update_cache(codec, 0x19, 0, |
14591 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14592 | pinval); | |
ad35879a TI |
14593 | } |
14594 | return alc_check_power_status(codec, nid); | |
14595 | } | |
14596 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | |
14597 | ||
840b64c0 TI |
14598 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
14599 | { | |
14600 | struct alc_spec *spec = codec->spec; | |
14601 | ||
14602 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) | |
14603 | return 0; | |
14604 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || | |
14605 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { | |
14606 | if (spec->ext_mic.pin <= 0x12) { | |
14607 | spec->private_adc_nids[0] = 0x08; | |
14608 | spec->private_adc_nids[1] = 0x11; | |
14609 | spec->private_capsrc_nids[0] = 0x23; | |
14610 | spec->private_capsrc_nids[1] = 0x22; | |
14611 | } else { | |
14612 | spec->private_adc_nids[0] = 0x11; | |
14613 | spec->private_adc_nids[1] = 0x08; | |
14614 | spec->private_capsrc_nids[0] = 0x22; | |
14615 | spec->private_capsrc_nids[1] = 0x23; | |
14616 | } | |
14617 | spec->adc_nids = spec->private_adc_nids; | |
14618 | spec->capsrc_nids = spec->private_capsrc_nids; | |
14619 | spec->num_adc_nids = 2; | |
14620 | spec->dual_adc_switch = 1; | |
14621 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", | |
14622 | spec->adc_nids[0], spec->adc_nids[1]); | |
14623 | return 1; | |
14624 | } | |
14625 | return 0; | |
14626 | } | |
14627 | ||
d433a678 TI |
14628 | /* different alc269-variants */ |
14629 | enum { | |
14630 | ALC269_TYPE_NORMAL, | |
48c88e82 | 14631 | ALC269_TYPE_ALC258, |
d433a678 | 14632 | ALC269_TYPE_ALC259, |
48c88e82 KY |
14633 | ALC269_TYPE_ALC269VB, |
14634 | ALC269_TYPE_ALC270, | |
d433a678 TI |
14635 | ALC269_TYPE_ALC271X, |
14636 | }; | |
14637 | ||
f6a92248 KY |
14638 | /* |
14639 | * BIOS auto configuration | |
14640 | */ | |
14641 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
14642 | { | |
14643 | struct alc_spec *spec = codec->spec; | |
cfb9fb55 | 14644 | int err; |
f6a92248 KY |
14645 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
14646 | ||
14647 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
14648 | alc269_ignore); | |
14649 | if (err < 0) | |
14650 | return err; | |
14651 | ||
14652 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
14653 | if (err < 0) | |
14654 | return err; | |
f3550d1b TI |
14655 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
14656 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); | |
14657 | else | |
14658 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, | |
14659 | 0x22, 0); | |
f6a92248 KY |
14660 | if (err < 0) |
14661 | return err; | |
14662 | ||
14663 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14664 | ||
757899ac | 14665 | alc_auto_parse_digital(codec); |
f6a92248 | 14666 | |
603c4019 | 14667 | if (spec->kctls.list) |
d88897ea | 14668 | add_mixer(spec, spec->kctls.list); |
f6a92248 | 14669 | |
d433a678 | 14670 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
84898e87 | 14671 | add_verb(spec, alc269vb_init_verbs); |
6227cdce | 14672 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
84898e87 KY |
14673 | } else { |
14674 | add_verb(spec, alc269_init_verbs); | |
6227cdce | 14675 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
84898e87 KY |
14676 | } |
14677 | ||
f6a92248 | 14678 | spec->num_mux_defs = 1; |
61b9b9b1 | 14679 | spec->input_mux = &spec->private_imux[0]; |
840b64c0 TI |
14680 | |
14681 | if (!alc275_setup_dual_adc(codec)) | |
14682 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | |
14683 | sizeof(alc269_adc_candidates)); | |
6694635d | 14684 | |
e01bf509 | 14685 | /* set default input source */ |
840b64c0 | 14686 | if (!spec->dual_adc_switch) |
748cce43 TI |
14687 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], |
14688 | spec->input_mux->items[0].index); | |
f6a92248 KY |
14689 | |
14690 | err = alc_auto_add_mic_boost(codec); | |
14691 | if (err < 0) | |
14692 | return err; | |
14693 | ||
7e0e44d4 | 14694 | if (!spec->cap_mixer && !spec->no_analog) |
b59bdf3b | 14695 | set_capture_mixer(codec); |
f53281e6 | 14696 | |
f6a92248 KY |
14697 | return 1; |
14698 | } | |
14699 | ||
e9af4f36 TI |
14700 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
14701 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out | |
f6a92248 KY |
14702 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
14703 | ||
14704 | ||
14705 | /* init callback for auto-configuration model -- overriding the default init */ | |
14706 | static void alc269_auto_init(struct hda_codec *codec) | |
14707 | { | |
f6c7e546 | 14708 | struct alc_spec *spec = codec->spec; |
f6a92248 KY |
14709 | alc269_auto_init_multi_out(codec); |
14710 | alc269_auto_init_hp_out(codec); | |
14711 | alc269_auto_init_analog_input(codec); | |
757899ac | 14712 | alc_auto_init_digital(codec); |
f6c7e546 | 14713 | if (spec->unsol_event) |
7fb0d78f | 14714 | alc_inithook(codec); |
f6a92248 KY |
14715 | } |
14716 | ||
0ec33d1f TI |
14717 | #ifdef SND_HDA_NEEDS_RESUME |
14718 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) | |
14719 | { | |
14720 | int val = alc_read_coef_idx(codec, 0x04); | |
14721 | if (power_up) | |
14722 | val |= 1 << 11; | |
14723 | else | |
14724 | val &= ~(1 << 11); | |
14725 | alc_write_coef_idx(codec, 0x04, val); | |
14726 | } | |
14727 | ||
977ddd6b KY |
14728 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14729 | static int alc269_suspend(struct hda_codec *codec, pm_message_t state) | |
14730 | { | |
14731 | struct alc_spec *spec = codec->spec; | |
977ddd6b | 14732 | |
0ec33d1f TI |
14733 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
14734 | alc269_toggle_power_output(codec, 0); | |
977ddd6b | 14735 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
0ec33d1f | 14736 | alc269_toggle_power_output(codec, 0); |
977ddd6b KY |
14737 | msleep(150); |
14738 | } | |
14739 | ||
14740 | alc_shutup(codec); | |
14741 | if (spec && spec->power_hook) | |
14742 | spec->power_hook(codec); | |
14743 | return 0; | |
14744 | } | |
0ec33d1f TI |
14745 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
14746 | ||
977ddd6b KY |
14747 | static int alc269_resume(struct hda_codec *codec) |
14748 | { | |
977ddd6b | 14749 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
0ec33d1f | 14750 | alc269_toggle_power_output(codec, 0); |
977ddd6b KY |
14751 | msleep(150); |
14752 | } | |
14753 | ||
14754 | codec->patch_ops.init(codec); | |
14755 | ||
14756 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { | |
0ec33d1f | 14757 | alc269_toggle_power_output(codec, 1); |
977ddd6b KY |
14758 | msleep(200); |
14759 | } | |
14760 | ||
0ec33d1f TI |
14761 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
14762 | alc269_toggle_power_output(codec, 1); | |
977ddd6b KY |
14763 | |
14764 | snd_hda_codec_resume_amp(codec); | |
14765 | snd_hda_codec_resume_cache(codec); | |
9e5341b9 | 14766 | hda_call_check_power_status(codec, 0x01); |
977ddd6b KY |
14767 | return 0; |
14768 | } | |
0ec33d1f | 14769 | #endif /* SND_HDA_NEEDS_RESUME */ |
977ddd6b | 14770 | |
ff818c24 TI |
14771 | enum { |
14772 | ALC269_FIXUP_SONY_VAIO, | |
145a902b | 14773 | ALC269_FIXUP_DELL_M101Z, |
ff818c24 TI |
14774 | }; |
14775 | ||
ff818c24 TI |
14776 | static const struct alc_fixup alc269_fixups[] = { |
14777 | [ALC269_FIXUP_SONY_VAIO] = { | |
73413b12 TI |
14778 | .verbs = (const struct hda_verb[]) { |
14779 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, | |
14780 | {} | |
14781 | } | |
ff818c24 | 14782 | }, |
145a902b DH |
14783 | [ALC269_FIXUP_DELL_M101Z] = { |
14784 | .verbs = (const struct hda_verb[]) { | |
14785 | /* Enables internal speaker */ | |
14786 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, | |
14787 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, | |
14788 | {} | |
14789 | } | |
14790 | }, | |
ff818c24 TI |
14791 | }; |
14792 | ||
14793 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | |
abdd8f51 | 14794 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
145a902b | 14795 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
ff818c24 TI |
14796 | {} |
14797 | }; | |
14798 | ||
14799 | ||
f6a92248 KY |
14800 | /* |
14801 | * configuration and preset | |
14802 | */ | |
14803 | static const char *alc269_models[ALC269_MODEL_LAST] = { | |
60db6b53 | 14804 | [ALC269_BASIC] = "basic", |
2922c9af | 14805 | [ALC269_QUANTA_FL1] = "quanta", |
84898e87 KY |
14806 | [ALC269_AMIC] = "laptop-amic", |
14807 | [ALC269_DMIC] = "laptop-dmic", | |
64154835 | 14808 | [ALC269_FUJITSU] = "fujitsu", |
3d3792cb TI |
14809 | [ALC269_LIFEBOOK] = "lifebook", |
14810 | [ALC269_AUTO] = "auto", | |
f6a92248 KY |
14811 | }; |
14812 | ||
14813 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
60db6b53 | 14814 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
fe3eb0a7 | 14815 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
f53281e6 | 14816 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
84898e87 KY |
14817 | ALC269_AMIC), |
14818 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), | |
14819 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), | |
14820 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), | |
14821 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), | |
14822 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), | |
14823 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), | |
14824 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), | |
14825 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), | |
14826 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), | |
14827 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), | |
14828 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), | |
14829 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), | |
14830 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), | |
14831 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), | |
14832 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), | |
14833 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), | |
14834 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), | |
14835 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), | |
14836 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), | |
14837 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), | |
14838 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), | |
14839 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), | |
14840 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), | |
14841 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), | |
14842 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), | |
14843 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), | |
14844 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), | |
14845 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), | |
14846 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), | |
14847 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), | |
14848 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), | |
14849 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), | |
14850 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), | |
14851 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), | |
14852 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), | |
14853 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), | |
f53281e6 | 14854 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
84898e87 | 14855 | ALC269_DMIC), |
60db6b53 | 14856 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
84898e87 KY |
14857 | ALC269_DMIC), |
14858 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), | |
14859 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), | |
ff818c24 | 14860 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
64154835 | 14861 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
61c2d2b5 KY |
14862 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
14863 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | |
14864 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), | |
14865 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), | |
14866 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), | |
14867 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), | |
f6a92248 KY |
14868 | {} |
14869 | }; | |
14870 | ||
14871 | static struct alc_config_preset alc269_presets[] = { | |
14872 | [ALC269_BASIC] = { | |
f9e336f6 | 14873 | .mixers = { alc269_base_mixer }, |
f6a92248 KY |
14874 | .init_verbs = { alc269_init_verbs }, |
14875 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14876 | .dac_nids = alc269_dac_nids, | |
14877 | .hp_nid = 0x03, | |
14878 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14879 | .channel_mode = alc269_modes, | |
14880 | .input_mux = &alc269_capture_source, | |
14881 | }, | |
60db6b53 KY |
14882 | [ALC269_QUANTA_FL1] = { |
14883 | .mixers = { alc269_quanta_fl1_mixer }, | |
14884 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | |
14885 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14886 | .dac_nids = alc269_dac_nids, | |
14887 | .hp_nid = 0x03, | |
14888 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14889 | .channel_mode = alc269_modes, | |
14890 | .input_mux = &alc269_capture_source, | |
14891 | .unsol_event = alc269_quanta_fl1_unsol_event, | |
4f5d1706 | 14892 | .setup = alc269_quanta_fl1_setup, |
60db6b53 KY |
14893 | .init_hook = alc269_quanta_fl1_init_hook, |
14894 | }, | |
84898e87 KY |
14895 | [ALC269_AMIC] = { |
14896 | .mixers = { alc269_laptop_mixer }, | |
14897 | .cap_mixer = alc269_laptop_analog_capture_mixer, | |
f53281e6 | 14898 | .init_verbs = { alc269_init_verbs, |
84898e87 | 14899 | alc269_laptop_amic_init_verbs }, |
f53281e6 KY |
14900 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14901 | .dac_nids = alc269_dac_nids, | |
14902 | .hp_nid = 0x03, | |
14903 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14904 | .channel_mode = alc269_modes, | |
84898e87 KY |
14905 | .unsol_event = alc269_laptop_unsol_event, |
14906 | .setup = alc269_laptop_amic_setup, | |
14907 | .init_hook = alc269_laptop_inithook, | |
f53281e6 | 14908 | }, |
84898e87 KY |
14909 | [ALC269_DMIC] = { |
14910 | .mixers = { alc269_laptop_mixer }, | |
14911 | .cap_mixer = alc269_laptop_digital_capture_mixer, | |
f53281e6 | 14912 | .init_verbs = { alc269_init_verbs, |
84898e87 KY |
14913 | alc269_laptop_dmic_init_verbs }, |
14914 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14915 | .dac_nids = alc269_dac_nids, | |
14916 | .hp_nid = 0x03, | |
14917 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14918 | .channel_mode = alc269_modes, | |
14919 | .unsol_event = alc269_laptop_unsol_event, | |
14920 | .setup = alc269_laptop_dmic_setup, | |
14921 | .init_hook = alc269_laptop_inithook, | |
14922 | }, | |
14923 | [ALC269VB_AMIC] = { | |
14924 | .mixers = { alc269vb_laptop_mixer }, | |
14925 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, | |
14926 | .init_verbs = { alc269vb_init_verbs, | |
14927 | alc269vb_laptop_amic_init_verbs }, | |
f53281e6 KY |
14928 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14929 | .dac_nids = alc269_dac_nids, | |
14930 | .hp_nid = 0x03, | |
14931 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14932 | .channel_mode = alc269_modes, | |
84898e87 | 14933 | .unsol_event = alc269_laptop_unsol_event, |
226b1ec8 | 14934 | .setup = alc269vb_laptop_amic_setup, |
84898e87 KY |
14935 | .init_hook = alc269_laptop_inithook, |
14936 | }, | |
14937 | [ALC269VB_DMIC] = { | |
14938 | .mixers = { alc269vb_laptop_mixer }, | |
14939 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
14940 | .init_verbs = { alc269vb_init_verbs, | |
14941 | alc269vb_laptop_dmic_init_verbs }, | |
14942 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14943 | .dac_nids = alc269_dac_nids, | |
14944 | .hp_nid = 0x03, | |
14945 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14946 | .channel_mode = alc269_modes, | |
14947 | .unsol_event = alc269_laptop_unsol_event, | |
14948 | .setup = alc269vb_laptop_dmic_setup, | |
14949 | .init_hook = alc269_laptop_inithook, | |
f53281e6 | 14950 | }, |
26f5df26 | 14951 | [ALC269_FUJITSU] = { |
45bdd1c1 | 14952 | .mixers = { alc269_fujitsu_mixer }, |
84898e87 | 14953 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
26f5df26 | 14954 | .init_verbs = { alc269_init_verbs, |
84898e87 | 14955 | alc269_laptop_dmic_init_verbs }, |
26f5df26 TI |
14956 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
14957 | .dac_nids = alc269_dac_nids, | |
14958 | .hp_nid = 0x03, | |
14959 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14960 | .channel_mode = alc269_modes, | |
84898e87 KY |
14961 | .unsol_event = alc269_laptop_unsol_event, |
14962 | .setup = alc269_laptop_dmic_setup, | |
14963 | .init_hook = alc269_laptop_inithook, | |
26f5df26 | 14964 | }, |
64154835 TV |
14965 | [ALC269_LIFEBOOK] = { |
14966 | .mixers = { alc269_lifebook_mixer }, | |
14967 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | |
14968 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14969 | .dac_nids = alc269_dac_nids, | |
14970 | .hp_nid = 0x03, | |
14971 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14972 | .channel_mode = alc269_modes, | |
14973 | .input_mux = &alc269_capture_source, | |
14974 | .unsol_event = alc269_lifebook_unsol_event, | |
14975 | .init_hook = alc269_lifebook_init_hook, | |
14976 | }, | |
fe3eb0a7 KY |
14977 | [ALC271_ACER] = { |
14978 | .mixers = { alc269_asus_mixer }, | |
14979 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | |
14980 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, | |
14981 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
14982 | .dac_nids = alc269_dac_nids, | |
14983 | .adc_nids = alc262_dmic_adc_nids, | |
14984 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), | |
14985 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
14986 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
14987 | .channel_mode = alc269_modes, | |
14988 | .input_mux = &alc269_capture_source, | |
14989 | .dig_out_nid = ALC880_DIGOUT_NID, | |
14990 | .unsol_event = alc_sku_unsol_event, | |
14991 | .setup = alc269vb_laptop_dmic_setup, | |
14992 | .init_hook = alc_inithook, | |
14993 | }, | |
f6a92248 KY |
14994 | }; |
14995 | ||
977ddd6b KY |
14996 | static int alc269_fill_coef(struct hda_codec *codec) |
14997 | { | |
14998 | int val; | |
14999 | ||
15000 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { | |
15001 | alc_write_coef_idx(codec, 0xf, 0x960b); | |
15002 | alc_write_coef_idx(codec, 0xe, 0x8817); | |
15003 | } | |
15004 | ||
15005 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { | |
15006 | alc_write_coef_idx(codec, 0xf, 0x960b); | |
15007 | alc_write_coef_idx(codec, 0xe, 0x8814); | |
15008 | } | |
15009 | ||
15010 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { | |
15011 | val = alc_read_coef_idx(codec, 0x04); | |
15012 | /* Power up output pin */ | |
15013 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); | |
15014 | } | |
15015 | ||
15016 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { | |
15017 | val = alc_read_coef_idx(codec, 0xd); | |
15018 | if ((val & 0x0c00) >> 10 != 0x1) { | |
15019 | /* Capless ramp up clock control */ | |
15020 | alc_write_coef_idx(codec, 0xd, val | 1<<10); | |
15021 | } | |
15022 | val = alc_read_coef_idx(codec, 0x17); | |
15023 | if ((val & 0x01c0) >> 6 != 0x4) { | |
15024 | /* Class D power on reset */ | |
15025 | alc_write_coef_idx(codec, 0x17, val | 1<<7); | |
15026 | } | |
15027 | } | |
15028 | return 0; | |
15029 | } | |
15030 | ||
f6a92248 KY |
15031 | static int patch_alc269(struct hda_codec *codec) |
15032 | { | |
15033 | struct alc_spec *spec; | |
48c88e82 | 15034 | int board_config, coef; |
f6a92248 KY |
15035 | int err; |
15036 | ||
15037 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
15038 | if (spec == NULL) | |
15039 | return -ENOMEM; | |
15040 | ||
15041 | codec->spec = spec; | |
15042 | ||
da00c244 KY |
15043 | alc_auto_parse_customize_define(codec); |
15044 | ||
48c88e82 KY |
15045 | coef = alc_read_coef_idx(codec, 0); |
15046 | if ((coef & 0x00f0) == 0x0010) { | |
c027ddcd | 15047 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
d433a678 | 15048 | spec->cdefine.platform_type == 1) { |
c027ddcd | 15049 | alc_codec_rename(codec, "ALC271X"); |
d433a678 | 15050 | spec->codec_variant = ALC269_TYPE_ALC271X; |
48c88e82 KY |
15051 | } else if ((coef & 0xf000) == 0x1000) { |
15052 | spec->codec_variant = ALC269_TYPE_ALC270; | |
15053 | } else if ((coef & 0xf000) == 0x2000) { | |
c027ddcd | 15054 | alc_codec_rename(codec, "ALC259"); |
d433a678 | 15055 | spec->codec_variant = ALC269_TYPE_ALC259; |
48c88e82 KY |
15056 | } else if ((coef & 0xf000) == 0x3000) { |
15057 | alc_codec_rename(codec, "ALC258"); | |
15058 | spec->codec_variant = ALC269_TYPE_ALC258; | |
15059 | } else { | |
15060 | alc_codec_rename(codec, "ALC269VB"); | |
15061 | spec->codec_variant = ALC269_TYPE_ALC269VB; | |
d433a678 | 15062 | } |
c027ddcd KY |
15063 | } else |
15064 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
274693f3 | 15065 | |
977ddd6b KY |
15066 | alc269_fill_coef(codec); |
15067 | ||
f6a92248 KY |
15068 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
15069 | alc269_models, | |
15070 | alc269_cfg_tbl); | |
15071 | ||
15072 | if (board_config < 0) { | |
9a11f1aa TI |
15073 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
15074 | codec->chip_name); | |
f6a92248 KY |
15075 | board_config = ALC269_AUTO; |
15076 | } | |
15077 | ||
ff818c24 TI |
15078 | if (board_config == ALC269_AUTO) |
15079 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); | |
15080 | ||
f6a92248 KY |
15081 | if (board_config == ALC269_AUTO) { |
15082 | /* automatic parse from the BIOS config */ | |
15083 | err = alc269_parse_auto_config(codec); | |
15084 | if (err < 0) { | |
15085 | alc_free(codec); | |
15086 | return err; | |
15087 | } else if (!err) { | |
15088 | printk(KERN_INFO | |
15089 | "hda_codec: Cannot set up configuration " | |
15090 | "from BIOS. Using base mode...\n"); | |
15091 | board_config = ALC269_BASIC; | |
15092 | } | |
15093 | } | |
15094 | ||
dc1eae25 | 15095 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
15096 | err = snd_hda_attach_beep_device(codec, 0x1); |
15097 | if (err < 0) { | |
15098 | alc_free(codec); | |
15099 | return err; | |
15100 | } | |
680cd536 KK |
15101 | } |
15102 | ||
f6a92248 | 15103 | if (board_config != ALC269_AUTO) |
e9c364c0 | 15104 | setup_preset(codec, &alc269_presets[board_config]); |
f6a92248 | 15105 | |
84898e87 | 15106 | if (board_config == ALC269_QUANTA_FL1) { |
f03d3115 TI |
15107 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
15108 | * fix the sample rate of analog I/O to 44.1kHz | |
15109 | */ | |
15110 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; | |
15111 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; | |
840b64c0 TI |
15112 | } else if (spec->dual_adc_switch) { |
15113 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
15114 | /* switch ADC dynamically */ | |
15115 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; | |
f03d3115 TI |
15116 | } else { |
15117 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
15118 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
15119 | } | |
f6a92248 KY |
15120 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
15121 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
15122 | ||
6694635d | 15123 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
1657cbd8 | 15124 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
6694635d TI |
15125 | spec->adc_nids = alc269_adc_nids; |
15126 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
15127 | spec->capsrc_nids = alc269_capsrc_nids; | |
15128 | } else { | |
15129 | spec->adc_nids = alc269vb_adc_nids; | |
15130 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); | |
15131 | spec->capsrc_nids = alc269vb_capsrc_nids; | |
15132 | } | |
84898e87 KY |
15133 | } |
15134 | ||
f9e336f6 | 15135 | if (!spec->cap_mixer) |
b59bdf3b | 15136 | set_capture_mixer(codec); |
dc1eae25 | 15137 | if (has_cdefine_beep(codec)) |
da00c244 | 15138 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
f6a92248 | 15139 | |
ff818c24 TI |
15140 | if (board_config == ALC269_AUTO) |
15141 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); | |
15142 | ||
100d5eb3 TI |
15143 | spec->vmaster_nid = 0x02; |
15144 | ||
f6a92248 | 15145 | codec->patch_ops = alc_patch_ops; |
977ddd6b KY |
15146 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15147 | codec->patch_ops.suspend = alc269_suspend; | |
15148 | #endif | |
15149 | #ifdef SND_HDA_NEEDS_RESUME | |
15150 | codec->patch_ops.resume = alc269_resume; | |
15151 | #endif | |
f6a92248 KY |
15152 | if (board_config == ALC269_AUTO) |
15153 | spec->init_hook = alc269_auto_init; | |
bf1b0225 KY |
15154 | |
15155 | alc_init_jacks(codec); | |
f6a92248 KY |
15156 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15157 | if (!spec->loopback.amplist) | |
15158 | spec->loopback.amplist = alc269_loopbacks; | |
ad35879a TI |
15159 | if (alc269_mic2_for_mute_led(codec)) |
15160 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; | |
f6a92248 KY |
15161 | #endif |
15162 | ||
15163 | return 0; | |
15164 | } | |
15165 | ||
df694daa KY |
15166 | /* |
15167 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
15168 | */ | |
15169 | ||
15170 | /* | |
15171 | * set the path ways for 2 channel output | |
15172 | * need to set the codec line out and mic 1 pin widgets to inputs | |
15173 | */ | |
15174 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
15175 | /* set pin widget 1Ah (line in) for input */ | |
15176 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
15177 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
15178 | * the vref | |
15179 | */ | |
df694daa KY |
15180 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
15181 | ||
9c7f852e TI |
15182 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
15183 | #if 0 | |
15184 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15185 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
15186 | #endif | |
df694daa KY |
15187 | { } /* end */ |
15188 | }; | |
15189 | /* | |
15190 | * 6ch mode | |
15191 | * need to set the codec line out and mic 1 pin widgets to outputs | |
15192 | */ | |
15193 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
15194 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
15195 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15196 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
15197 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15198 | ||
15199 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
9c7f852e | 15200 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa | 15201 | |
9c7f852e TI |
15202 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
15203 | #if 0 | |
15204 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15205 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
15206 | #endif | |
df694daa KY |
15207 | { } /* end */ |
15208 | }; | |
15209 | ||
15210 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
15211 | { 2, alc861_threestack_ch2_init }, | |
15212 | { 6, alc861_threestack_ch6_init }, | |
15213 | }; | |
22309c3e TI |
15214 | /* Set mic1 as input and unmute the mixer */ |
15215 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
15216 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15217 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15218 | { } /* end */ | |
15219 | }; | |
15220 | /* Set mic1 as output and mute mixer */ | |
15221 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
15222 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15223 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15224 | { } /* end */ | |
15225 | }; | |
15226 | ||
15227 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
15228 | { 2, alc861_uniwill_m31_ch2_init }, | |
15229 | { 4, alc861_uniwill_m31_ch4_init }, | |
15230 | }; | |
df694daa | 15231 | |
7cdbff94 MD |
15232 | /* Set mic1 and line-in as input and unmute the mixer */ |
15233 | static struct hda_verb alc861_asus_ch2_init[] = { | |
15234 | /* set pin widget 1Ah (line in) for input */ | |
15235 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
15236 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
15237 | * the vref | |
15238 | */ | |
7cdbff94 MD |
15239 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
15240 | ||
15241 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
15242 | #if 0 | |
15243 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
15244 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
15245 | #endif | |
15246 | { } /* end */ | |
15247 | }; | |
15248 | /* Set mic1 nad line-in as output and mute mixer */ | |
15249 | static struct hda_verb alc861_asus_ch6_init[] = { | |
15250 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
15251 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15252 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
15253 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
15254 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15255 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
15256 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15257 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15258 | ||
15259 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
15260 | #if 0 | |
15261 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
15262 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
15263 | #endif | |
15264 | { } /* end */ | |
15265 | }; | |
15266 | ||
15267 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
15268 | { 2, alc861_asus_ch2_init }, | |
15269 | { 6, alc861_asus_ch6_init }, | |
15270 | }; | |
15271 | ||
df694daa KY |
15272 | /* patch-ALC861 */ |
15273 | ||
15274 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
15275 | /* output mixer control */ | |
15276 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15277 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15278 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15279 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15280 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
15281 | ||
15282 | /*Input mixer control */ | |
15283 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15284 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15285 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15286 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15287 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15288 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15290 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15291 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15292 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 15293 | |
df694daa KY |
15294 | { } /* end */ |
15295 | }; | |
15296 | ||
15297 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
15298 | /* output mixer control */ | |
15299 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15300 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15301 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15302 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15303 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
15304 | ||
15305 | /* Input mixer control */ | |
15306 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15307 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15308 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15309 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15310 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15311 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15312 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15313 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15314 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15315 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 15316 | |
df694daa KY |
15317 | { |
15318 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15319 | .name = "Channel Mode", | |
15320 | .info = alc_ch_mode_info, | |
15321 | .get = alc_ch_mode_get, | |
15322 | .put = alc_ch_mode_put, | |
15323 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
15324 | }, | |
15325 | { } /* end */ | |
a53d1aec TD |
15326 | }; |
15327 | ||
d1d985f0 | 15328 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
a53d1aec TD |
15329 | /* output mixer control */ |
15330 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15331 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15332 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
ea1fb29a | 15333 | |
a53d1aec | 15334 | { } /* end */ |
f12ab1e0 | 15335 | }; |
a53d1aec | 15336 | |
22309c3e TI |
15337 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
15338 | /* output mixer control */ | |
15339 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15340 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15341 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15342 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15343 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
15344 | ||
15345 | /* Input mixer control */ | |
15346 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15347 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
15348 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15349 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15350 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15351 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15352 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15354 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
15355 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 15356 | |
22309c3e TI |
15357 | { |
15358 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15359 | .name = "Channel Mode", | |
15360 | .info = alc_ch_mode_info, | |
15361 | .get = alc_ch_mode_get, | |
15362 | .put = alc_ch_mode_put, | |
15363 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
15364 | }, | |
15365 | { } /* end */ | |
f12ab1e0 | 15366 | }; |
7cdbff94 MD |
15367 | |
15368 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
15369 | /* output mixer control */ | |
15370 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
15371 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
15372 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
15373 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
15374 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
15375 | ||
15376 | /* Input mixer control */ | |
15377 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
15378 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
15379 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
15380 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
15381 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
15382 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
15383 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
15384 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
15385 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
f12ab1e0 TI |
15386 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
15387 | ||
7cdbff94 MD |
15388 | { |
15389 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15390 | .name = "Channel Mode", | |
15391 | .info = alc_ch_mode_info, | |
15392 | .get = alc_ch_mode_get, | |
15393 | .put = alc_ch_mode_put, | |
15394 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
15395 | }, | |
15396 | { } | |
56bb0cab TI |
15397 | }; |
15398 | ||
15399 | /* additional mixer */ | |
d1d985f0 | 15400 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
56bb0cab TI |
15401 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
15402 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
56bb0cab TI |
15403 | { } |
15404 | }; | |
7cdbff94 | 15405 | |
df694daa KY |
15406 | /* |
15407 | * generic initialization of ADC, input mixers and output mixers | |
15408 | */ | |
15409 | static struct hda_verb alc861_base_init_verbs[] = { | |
15410 | /* | |
15411 | * Unmute ADC0 and set the default input to mic-in | |
15412 | */ | |
15413 | /* port-A for surround (rear panel) */ | |
15414 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15415 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15416 | /* port-B for mic-in (rear panel) with vref */ | |
15417 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15418 | /* port-C for line-in (rear panel) */ | |
15419 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15420 | /* port-D for Front */ | |
15421 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15422 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15423 | /* port-E for HP out (front panel) */ | |
15424 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15425 | /* route front PCM to HP */ | |
9dece1d7 | 15426 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
15427 | /* port-F for mic-in (front panel) with vref */ |
15428 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15429 | /* port-G for CLFE (rear panel) */ | |
15430 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15431 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15432 | /* port-H for side (rear panel) */ | |
15433 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15434 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15435 | /* CD-in */ | |
15436 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15437 | /* route front mic to ADC1*/ | |
15438 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15439 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 15440 | |
df694daa KY |
15441 | /* Unmute DAC0~3 & spdif out*/ |
15442 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15443 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15444 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15445 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15446 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15447 | |
df694daa KY |
15448 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15449 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15450 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15451 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15452 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15453 | |
df694daa KY |
15454 | /* Unmute Stereo Mixer 15 */ |
15455 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15456 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15457 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15458 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
15459 | |
15460 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15461 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15462 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15463 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15464 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15465 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15466 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15467 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15468 | /* hp used DAC 3 (Front) */ |
15469 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
15470 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15471 | ||
15472 | { } | |
15473 | }; | |
15474 | ||
15475 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
15476 | /* | |
15477 | * Unmute ADC0 and set the default input to mic-in | |
15478 | */ | |
15479 | /* port-A for surround (rear panel) */ | |
15480 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15481 | /* port-B for mic-in (rear panel) with vref */ | |
15482 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15483 | /* port-C for line-in (rear panel) */ | |
15484 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15485 | /* port-D for Front */ | |
15486 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15487 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15488 | /* port-E for HP out (front panel) */ | |
15489 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
15490 | /* route front PCM to HP */ | |
9dece1d7 | 15491 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
15492 | /* port-F for mic-in (front panel) with vref */ |
15493 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15494 | /* port-G for CLFE (rear panel) */ | |
15495 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15496 | /* port-H for side (rear panel) */ | |
15497 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15498 | /* CD-in */ | |
15499 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15500 | /* route front mic to ADC1*/ | |
15501 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15502 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15503 | /* Unmute DAC0~3 & spdif out*/ | |
15504 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15505 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15506 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15507 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15509 | |
df694daa KY |
15510 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15511 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15512 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15513 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15514 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15515 | |
df694daa KY |
15516 | /* Unmute Stereo Mixer 15 */ |
15517 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15518 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15519 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
15521 | |
15522 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15523 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15524 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15525 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15526 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15527 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15528 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15529 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15530 | /* hp used DAC 3 (Front) */ |
15531 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
15532 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15533 | { } | |
15534 | }; | |
22309c3e TI |
15535 | |
15536 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
15537 | /* | |
15538 | * Unmute ADC0 and set the default input to mic-in | |
15539 | */ | |
15540 | /* port-A for surround (rear panel) */ | |
15541 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15542 | /* port-B for mic-in (rear panel) with vref */ | |
15543 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15544 | /* port-C for line-in (rear panel) */ | |
15545 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15546 | /* port-D for Front */ | |
15547 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15548 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15549 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
15550 | /* this has to be set to VREF80 */ |
15551 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
22309c3e | 15552 | /* route front PCM to HP */ |
9dece1d7 | 15553 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
22309c3e TI |
15554 | /* port-F for mic-in (front panel) with vref */ |
15555 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15556 | /* port-G for CLFE (rear panel) */ | |
15557 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15558 | /* port-H for side (rear panel) */ | |
15559 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
15560 | /* CD-in */ | |
15561 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15562 | /* route front mic to ADC1*/ | |
15563 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15564 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15565 | /* Unmute DAC0~3 & spdif out*/ | |
15566 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15567 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15568 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15569 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15571 | |
22309c3e TI |
15572 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15573 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15574 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15575 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15576 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15577 | |
22309c3e TI |
15578 | /* Unmute Stereo Mixer 15 */ |
15579 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15580 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15581 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15582 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
22309c3e TI |
15583 | |
15584 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15585 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15586 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15587 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15588 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15589 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15590 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15591 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15592 | /* hp used DAC 3 (Front) */ |
15593 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
22309c3e TI |
15594 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15595 | { } | |
15596 | }; | |
15597 | ||
7cdbff94 MD |
15598 | static struct hda_verb alc861_asus_init_verbs[] = { |
15599 | /* | |
15600 | * Unmute ADC0 and set the default input to mic-in | |
15601 | */ | |
f12ab1e0 TI |
15602 | /* port-A for surround (rear panel) |
15603 | * according to codec#0 this is the HP jack | |
15604 | */ | |
7cdbff94 MD |
15605 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
15606 | /* route front PCM to HP */ | |
15607 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
15608 | /* port-B for mic-in (rear panel) with vref */ | |
15609 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15610 | /* port-C for line-in (rear panel) */ | |
15611 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15612 | /* port-D for Front */ | |
15613 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15614 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
15615 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
15616 | /* this has to be set to VREF80 */ |
15617 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7cdbff94 | 15618 | /* route front PCM to HP */ |
9dece1d7 | 15619 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7cdbff94 MD |
15620 | /* port-F for mic-in (front panel) with vref */ |
15621 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
15622 | /* port-G for CLFE (rear panel) */ | |
15623 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15624 | /* port-H for side (rear panel) */ | |
15625 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
15626 | /* CD-in */ | |
15627 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
15628 | /* route front mic to ADC1*/ | |
15629 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15630 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15631 | /* Unmute DAC0~3 & spdif out*/ | |
15632 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15633 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15634 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15635 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15636 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15637 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
15638 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15639 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15640 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15641 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15642 | |
7cdbff94 MD |
15643 | /* Unmute Stereo Mixer 15 */ |
15644 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 15647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
7cdbff94 MD |
15648 | |
15649 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15650 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15651 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15652 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15653 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15654 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15655 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15656 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
15657 | /* hp used DAC 3 (Front) */ |
15658 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7cdbff94 MD |
15659 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
15660 | { } | |
15661 | }; | |
15662 | ||
56bb0cab TI |
15663 | /* additional init verbs for ASUS laptops */ |
15664 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
15665 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
15666 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
15667 | { } | |
15668 | }; | |
7cdbff94 | 15669 | |
df694daa KY |
15670 | /* |
15671 | * generic initialization of ADC, input mixers and output mixers | |
15672 | */ | |
15673 | static struct hda_verb alc861_auto_init_verbs[] = { | |
15674 | /* | |
15675 | * Unmute ADC0 and set the default input to mic-in | |
15676 | */ | |
f12ab1e0 | 15677 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
df694daa | 15678 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
ea1fb29a | 15679 | |
df694daa KY |
15680 | /* Unmute DAC0~3 & spdif out*/ |
15681 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15682 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15683 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15684 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
15685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 15686 | |
df694daa KY |
15687 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
15688 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15689 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15690 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15691 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 15692 | |
df694daa KY |
15693 | /* Unmute Stereo Mixer 15 */ |
15694 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15696 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
15697 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
15698 | ||
1c20930a TI |
15699 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
15700 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15701 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15702 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15703 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15704 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15705 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15706 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
df694daa KY |
15707 | |
15708 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15709 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1c20930a TI |
15710 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
15711 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
df694daa KY |
15712 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
15713 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1c20930a TI |
15714 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
15715 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
df694daa | 15716 | |
f12ab1e0 | 15717 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
df694daa KY |
15718 | |
15719 | { } | |
15720 | }; | |
15721 | ||
a53d1aec TD |
15722 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
15723 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f12ab1e0 | 15724 | |
a53d1aec TD |
15725 | { } |
15726 | }; | |
15727 | ||
15728 | /* toggle speaker-output according to the hp-jack state */ | |
15729 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
15730 | { | |
864f92be | 15731 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
a53d1aec | 15732 | |
47fd830a TI |
15733 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
15734 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
15735 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
15736 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
a53d1aec TD |
15737 | } |
15738 | ||
15739 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
15740 | unsigned int res) | |
15741 | { | |
a53d1aec TD |
15742 | if ((res >> 26) == ALC880_HP_EVENT) |
15743 | alc861_toshiba_automute(codec); | |
15744 | } | |
15745 | ||
def319f9 | 15746 | /* pcm configuration: identical with ALC880 */ |
df694daa KY |
15747 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
15748 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
15749 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
15750 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
15751 | ||
15752 | ||
15753 | #define ALC861_DIGOUT_NID 0x07 | |
15754 | ||
15755 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
15756 | { 8, NULL } | |
15757 | }; | |
15758 | ||
15759 | static hda_nid_t alc861_dac_nids[4] = { | |
15760 | /* front, surround, clfe, side */ | |
15761 | 0x03, 0x06, 0x05, 0x04 | |
15762 | }; | |
15763 | ||
9c7f852e TI |
15764 | static hda_nid_t alc660_dac_nids[3] = { |
15765 | /* front, clfe, surround */ | |
15766 | 0x03, 0x05, 0x06 | |
15767 | }; | |
15768 | ||
df694daa KY |
15769 | static hda_nid_t alc861_adc_nids[1] = { |
15770 | /* ADC0-2 */ | |
15771 | 0x08, | |
15772 | }; | |
15773 | ||
15774 | static struct hda_input_mux alc861_capture_source = { | |
15775 | .num_items = 5, | |
15776 | .items = { | |
15777 | { "Mic", 0x0 }, | |
15778 | { "Front Mic", 0x3 }, | |
15779 | { "Line", 0x1 }, | |
15780 | { "CD", 0x4 }, | |
15781 | { "Mixer", 0x5 }, | |
15782 | }, | |
15783 | }; | |
15784 | ||
1c20930a TI |
15785 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
15786 | { | |
15787 | struct alc_spec *spec = codec->spec; | |
15788 | hda_nid_t mix, srcs[5]; | |
15789 | int i, j, num; | |
15790 | ||
15791 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | |
15792 | return 0; | |
15793 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15794 | if (num < 0) | |
15795 | return 0; | |
15796 | for (i = 0; i < num; i++) { | |
15797 | unsigned int type; | |
a22d543a | 15798 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
1c20930a TI |
15799 | if (type != AC_WID_AUD_OUT) |
15800 | continue; | |
15801 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
15802 | if (spec->multiout.dac_nids[j] == srcs[i]) | |
15803 | break; | |
15804 | if (j >= spec->multiout.num_dacs) | |
15805 | return srcs[i]; | |
15806 | } | |
15807 | return 0; | |
15808 | } | |
15809 | ||
df694daa | 15810 | /* fill in the dac_nids table from the parsed pin configuration */ |
1c20930a | 15811 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
f12ab1e0 | 15812 | const struct auto_pin_cfg *cfg) |
df694daa | 15813 | { |
1c20930a | 15814 | struct alc_spec *spec = codec->spec; |
df694daa | 15815 | int i; |
1c20930a | 15816 | hda_nid_t nid, dac; |
df694daa KY |
15817 | |
15818 | spec->multiout.dac_nids = spec->private_dac_nids; | |
15819 | for (i = 0; i < cfg->line_outs; i++) { | |
15820 | nid = cfg->line_out_pins[i]; | |
1c20930a TI |
15821 | dac = alc861_look_for_dac(codec, nid); |
15822 | if (!dac) | |
15823 | continue; | |
15824 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
df694daa | 15825 | } |
df694daa KY |
15826 | return 0; |
15827 | } | |
15828 | ||
1c20930a TI |
15829 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
15830 | hda_nid_t nid, unsigned int chs) | |
15831 | { | |
0afe5f89 | 15832 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
1c20930a TI |
15833 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
15834 | } | |
15835 | ||
df694daa | 15836 | /* add playback controls from the parsed DAC table */ |
1c20930a | 15837 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
df694daa KY |
15838 | const struct auto_pin_cfg *cfg) |
15839 | { | |
1c20930a | 15840 | struct alc_spec *spec = codec->spec; |
f12ab1e0 TI |
15841 | static const char *chname[4] = { |
15842 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
15843 | }; | |
df694daa | 15844 | hda_nid_t nid; |
1c20930a TI |
15845 | int i, err; |
15846 | ||
15847 | if (cfg->line_outs == 1) { | |
15848 | const char *pfx = NULL; | |
15849 | if (!cfg->hp_outs) | |
15850 | pfx = "Master"; | |
15851 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
15852 | pfx = "Speaker"; | |
15853 | if (pfx) { | |
15854 | nid = spec->multiout.dac_nids[0]; | |
15855 | return alc861_create_out_sw(codec, pfx, nid, 3); | |
15856 | } | |
15857 | } | |
df694daa KY |
15858 | |
15859 | for (i = 0; i < cfg->line_outs; i++) { | |
15860 | nid = spec->multiout.dac_nids[i]; | |
f12ab1e0 | 15861 | if (!nid) |
df694daa | 15862 | continue; |
1c20930a | 15863 | if (i == 2) { |
df694daa | 15864 | /* Center/LFE */ |
1c20930a | 15865 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
f12ab1e0 | 15866 | if (err < 0) |
df694daa | 15867 | return err; |
1c20930a | 15868 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
f12ab1e0 | 15869 | if (err < 0) |
df694daa KY |
15870 | return err; |
15871 | } else { | |
1c20930a | 15872 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
f12ab1e0 | 15873 | if (err < 0) |
df694daa KY |
15874 | return err; |
15875 | } | |
15876 | } | |
15877 | return 0; | |
15878 | } | |
15879 | ||
1c20930a | 15880 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
df694daa | 15881 | { |
1c20930a | 15882 | struct alc_spec *spec = codec->spec; |
df694daa KY |
15883 | int err; |
15884 | hda_nid_t nid; | |
15885 | ||
f12ab1e0 | 15886 | if (!pin) |
df694daa KY |
15887 | return 0; |
15888 | ||
15889 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
1c20930a TI |
15890 | nid = alc861_look_for_dac(codec, pin); |
15891 | if (nid) { | |
15892 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); | |
15893 | if (err < 0) | |
15894 | return err; | |
15895 | spec->multiout.hp_nid = nid; | |
15896 | } | |
df694daa KY |
15897 | } |
15898 | return 0; | |
15899 | } | |
15900 | ||
15901 | /* create playback/capture controls for input pins */ | |
05f5f477 | 15902 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
f12ab1e0 | 15903 | const struct auto_pin_cfg *cfg) |
df694daa | 15904 | { |
05f5f477 | 15905 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
df694daa KY |
15906 | } |
15907 | ||
f12ab1e0 TI |
15908 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
15909 | hda_nid_t nid, | |
1c20930a | 15910 | int pin_type, hda_nid_t dac) |
df694daa | 15911 | { |
1c20930a TI |
15912 | hda_nid_t mix, srcs[5]; |
15913 | int i, num; | |
15914 | ||
564c5bea JL |
15915 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
15916 | pin_type); | |
1c20930a | 15917 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
564c5bea | 15918 | AMP_OUT_UNMUTE); |
1c20930a TI |
15919 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
15920 | return; | |
15921 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | |
15922 | if (num < 0) | |
15923 | return; | |
15924 | for (i = 0; i < num; i++) { | |
15925 | unsigned int mute; | |
15926 | if (srcs[i] == dac || srcs[i] == 0x15) | |
15927 | mute = AMP_IN_UNMUTE(i); | |
15928 | else | |
15929 | mute = AMP_IN_MUTE(i); | |
15930 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15931 | mute); | |
15932 | } | |
df694daa KY |
15933 | } |
15934 | ||
15935 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
15936 | { | |
15937 | struct alc_spec *spec = codec->spec; | |
15938 | int i; | |
15939 | ||
15940 | for (i = 0; i < spec->autocfg.line_outs; i++) { | |
15941 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 15942 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 15943 | if (nid) |
baba8ee9 | 15944 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 15945 | spec->multiout.dac_nids[i]); |
df694daa KY |
15946 | } |
15947 | } | |
15948 | ||
15949 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
15950 | { | |
15951 | struct alc_spec *spec = codec->spec; | |
df694daa | 15952 | |
15870f05 TI |
15953 | if (spec->autocfg.hp_outs) |
15954 | alc861_auto_set_output_and_unmute(codec, | |
15955 | spec->autocfg.hp_pins[0], | |
15956 | PIN_HP, | |
1c20930a | 15957 | spec->multiout.hp_nid); |
15870f05 TI |
15958 | if (spec->autocfg.speaker_outs) |
15959 | alc861_auto_set_output_and_unmute(codec, | |
15960 | spec->autocfg.speaker_pins[0], | |
15961 | PIN_OUT, | |
1c20930a | 15962 | spec->multiout.dac_nids[0]); |
df694daa KY |
15963 | } |
15964 | ||
15965 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
15966 | { | |
15967 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 15968 | struct auto_pin_cfg *cfg = &spec->autocfg; |
df694daa KY |
15969 | int i; |
15970 | ||
66ceeb6b TI |
15971 | for (i = 0; i < cfg->num_inputs; i++) { |
15972 | hda_nid_t nid = cfg->inputs[i].pin; | |
23f0c048 | 15973 | if (nid >= 0x0c && nid <= 0x11) |
30ea098f | 15974 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
df694daa KY |
15975 | } |
15976 | } | |
15977 | ||
15978 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
15979 | /* return 1 if successful, 0 if the proper config is not found, |
15980 | * or a negative error code | |
15981 | */ | |
df694daa KY |
15982 | static int alc861_parse_auto_config(struct hda_codec *codec) |
15983 | { | |
15984 | struct alc_spec *spec = codec->spec; | |
15985 | int err; | |
15986 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
15987 | ||
f12ab1e0 TI |
15988 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
15989 | alc861_ignore); | |
15990 | if (err < 0) | |
df694daa | 15991 | return err; |
f12ab1e0 | 15992 | if (!spec->autocfg.line_outs) |
df694daa KY |
15993 | return 0; /* can't find valid BIOS pin config */ |
15994 | ||
1c20930a | 15995 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
f12ab1e0 TI |
15996 | if (err < 0) |
15997 | return err; | |
1c20930a | 15998 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
f12ab1e0 TI |
15999 | if (err < 0) |
16000 | return err; | |
1c20930a | 16001 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
f12ab1e0 TI |
16002 | if (err < 0) |
16003 | return err; | |
05f5f477 | 16004 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 16005 | if (err < 0) |
df694daa KY |
16006 | return err; |
16007 | ||
16008 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
16009 | ||
757899ac | 16010 | alc_auto_parse_digital(codec); |
df694daa | 16011 | |
603c4019 | 16012 | if (spec->kctls.list) |
d88897ea | 16013 | add_mixer(spec, spec->kctls.list); |
df694daa | 16014 | |
d88897ea | 16015 | add_verb(spec, alc861_auto_init_verbs); |
df694daa | 16016 | |
a1e8d2da | 16017 | spec->num_mux_defs = 1; |
61b9b9b1 | 16018 | spec->input_mux = &spec->private_imux[0]; |
df694daa KY |
16019 | |
16020 | spec->adc_nids = alc861_adc_nids; | |
16021 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
b59bdf3b | 16022 | set_capture_mixer(codec); |
df694daa | 16023 | |
6227cdce | 16024 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
4a79ba34 | 16025 | |
df694daa KY |
16026 | return 1; |
16027 | } | |
16028 | ||
ae6b813a TI |
16029 | /* additional initialization for auto-configuration model */ |
16030 | static void alc861_auto_init(struct hda_codec *codec) | |
df694daa | 16031 | { |
f6c7e546 | 16032 | struct alc_spec *spec = codec->spec; |
df694daa KY |
16033 | alc861_auto_init_multi_out(codec); |
16034 | alc861_auto_init_hp_out(codec); | |
16035 | alc861_auto_init_analog_input(codec); | |
757899ac | 16036 | alc_auto_init_digital(codec); |
f6c7e546 | 16037 | if (spec->unsol_event) |
7fb0d78f | 16038 | alc_inithook(codec); |
df694daa KY |
16039 | } |
16040 | ||
cb53c626 TI |
16041 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16042 | static struct hda_amp_list alc861_loopbacks[] = { | |
16043 | { 0x15, HDA_INPUT, 0 }, | |
16044 | { 0x15, HDA_INPUT, 1 }, | |
16045 | { 0x15, HDA_INPUT, 2 }, | |
16046 | { 0x15, HDA_INPUT, 3 }, | |
16047 | { } /* end */ | |
16048 | }; | |
16049 | #endif | |
16050 | ||
df694daa KY |
16051 | |
16052 | /* | |
16053 | * configuration and preset | |
16054 | */ | |
f5fcc13c TI |
16055 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
16056 | [ALC861_3ST] = "3stack", | |
16057 | [ALC660_3ST] = "3stack-660", | |
16058 | [ALC861_3ST_DIG] = "3stack-dig", | |
16059 | [ALC861_6ST_DIG] = "6stack-dig", | |
16060 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
16061 | [ALC861_TOSHIBA] = "toshiba", | |
16062 | [ALC861_ASUS] = "asus", | |
16063 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
16064 | [ALC861_AUTO] = "auto", | |
16065 | }; | |
16066 | ||
16067 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
687a47bd | 16068 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
f5fcc13c TI |
16069 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
16070 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
16071 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
ac3e3741 | 16072 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
83c34218 | 16073 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
ad5e7737 | 16074 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
341d4eb0 TI |
16075 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
16076 | * Any other models that need this preset? | |
16077 | */ | |
16078 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
ac3e3741 TI |
16079 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
16080 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
4147dab6 | 16081 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
ac3e3741 TI |
16082 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
16083 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
16084 | /* FIXME: the below seems conflict */ | |
16085 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
07e038b3 | 16086 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
f5fcc13c | 16087 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
df694daa KY |
16088 | {} |
16089 | }; | |
16090 | ||
16091 | static struct alc_config_preset alc861_presets[] = { | |
16092 | [ALC861_3ST] = { | |
16093 | .mixers = { alc861_3ST_mixer }, | |
16094 | .init_verbs = { alc861_threestack_init_verbs }, | |
16095 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16096 | .dac_nids = alc861_dac_nids, | |
16097 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16098 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 16099 | .need_dac_fix = 1, |
df694daa KY |
16100 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
16101 | .adc_nids = alc861_adc_nids, | |
16102 | .input_mux = &alc861_capture_source, | |
16103 | }, | |
16104 | [ALC861_3ST_DIG] = { | |
16105 | .mixers = { alc861_base_mixer }, | |
16106 | .init_verbs = { alc861_threestack_init_verbs }, | |
16107 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16108 | .dac_nids = alc861_dac_nids, | |
16109 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16110 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16111 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 16112 | .need_dac_fix = 1, |
df694daa KY |
16113 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
16114 | .adc_nids = alc861_adc_nids, | |
16115 | .input_mux = &alc861_capture_source, | |
16116 | }, | |
16117 | [ALC861_6ST_DIG] = { | |
16118 | .mixers = { alc861_base_mixer }, | |
16119 | .init_verbs = { alc861_base_init_verbs }, | |
16120 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16121 | .dac_nids = alc861_dac_nids, | |
16122 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16123 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
16124 | .channel_mode = alc861_8ch_modes, | |
16125 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16126 | .adc_nids = alc861_adc_nids, | |
16127 | .input_mux = &alc861_capture_source, | |
16128 | }, | |
9c7f852e TI |
16129 | [ALC660_3ST] = { |
16130 | .mixers = { alc861_3ST_mixer }, | |
16131 | .init_verbs = { alc861_threestack_init_verbs }, | |
16132 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
16133 | .dac_nids = alc660_dac_nids, | |
16134 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
16135 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 16136 | .need_dac_fix = 1, |
9c7f852e TI |
16137 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
16138 | .adc_nids = alc861_adc_nids, | |
16139 | .input_mux = &alc861_capture_source, | |
16140 | }, | |
22309c3e TI |
16141 | [ALC861_UNIWILL_M31] = { |
16142 | .mixers = { alc861_uniwill_m31_mixer }, | |
16143 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
16144 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16145 | .dac_nids = alc861_dac_nids, | |
16146 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16147 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
16148 | .channel_mode = alc861_uniwill_m31_modes, | |
16149 | .need_dac_fix = 1, | |
16150 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16151 | .adc_nids = alc861_adc_nids, | |
16152 | .input_mux = &alc861_capture_source, | |
16153 | }, | |
a53d1aec TD |
16154 | [ALC861_TOSHIBA] = { |
16155 | .mixers = { alc861_toshiba_mixer }, | |
f12ab1e0 TI |
16156 | .init_verbs = { alc861_base_init_verbs, |
16157 | alc861_toshiba_init_verbs }, | |
a53d1aec TD |
16158 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
16159 | .dac_nids = alc861_dac_nids, | |
16160 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
16161 | .channel_mode = alc883_3ST_2ch_modes, | |
16162 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16163 | .adc_nids = alc861_adc_nids, | |
16164 | .input_mux = &alc861_capture_source, | |
16165 | .unsol_event = alc861_toshiba_unsol_event, | |
16166 | .init_hook = alc861_toshiba_automute, | |
16167 | }, | |
7cdbff94 MD |
16168 | [ALC861_ASUS] = { |
16169 | .mixers = { alc861_asus_mixer }, | |
16170 | .init_verbs = { alc861_asus_init_verbs }, | |
16171 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16172 | .dac_nids = alc861_dac_nids, | |
16173 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16174 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
16175 | .channel_mode = alc861_asus_modes, | |
16176 | .need_dac_fix = 1, | |
16177 | .hp_nid = 0x06, | |
16178 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16179 | .adc_nids = alc861_adc_nids, | |
16180 | .input_mux = &alc861_capture_source, | |
16181 | }, | |
56bb0cab TI |
16182 | [ALC861_ASUS_LAPTOP] = { |
16183 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
16184 | .init_verbs = { alc861_asus_init_verbs, | |
16185 | alc861_asus_laptop_init_verbs }, | |
16186 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
16187 | .dac_nids = alc861_dac_nids, | |
16188 | .dig_out_nid = ALC861_DIGOUT_NID, | |
16189 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
16190 | .channel_mode = alc883_3ST_2ch_modes, | |
16191 | .need_dac_fix = 1, | |
16192 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
16193 | .adc_nids = alc861_adc_nids, | |
16194 | .input_mux = &alc861_capture_source, | |
16195 | }, | |
16196 | }; | |
df694daa | 16197 | |
cfc9b06f TI |
16198 | /* Pin config fixes */ |
16199 | enum { | |
16200 | PINFIX_FSC_AMILO_PI1505, | |
16201 | }; | |
16202 | ||
cfc9b06f TI |
16203 | static const struct alc_fixup alc861_fixups[] = { |
16204 | [PINFIX_FSC_AMILO_PI1505] = { | |
73413b12 TI |
16205 | .pins = (const struct alc_pincfg[]) { |
16206 | { 0x0b, 0x0221101f }, /* HP */ | |
16207 | { 0x0f, 0x90170310 }, /* speaker */ | |
16208 | { } | |
16209 | } | |
cfc9b06f TI |
16210 | }, |
16211 | }; | |
16212 | ||
16213 | static struct snd_pci_quirk alc861_fixup_tbl[] = { | |
16214 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), | |
16215 | {} | |
16216 | }; | |
df694daa KY |
16217 | |
16218 | static int patch_alc861(struct hda_codec *codec) | |
16219 | { | |
16220 | struct alc_spec *spec; | |
16221 | int board_config; | |
16222 | int err; | |
16223 | ||
dc041e0b | 16224 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
16225 | if (spec == NULL) |
16226 | return -ENOMEM; | |
16227 | ||
f12ab1e0 | 16228 | codec->spec = spec; |
df694daa | 16229 | |
f5fcc13c TI |
16230 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
16231 | alc861_models, | |
16232 | alc861_cfg_tbl); | |
9c7f852e | 16233 | |
f5fcc13c | 16234 | if (board_config < 0) { |
9a11f1aa TI |
16235 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
16236 | codec->chip_name); | |
df694daa KY |
16237 | board_config = ALC861_AUTO; |
16238 | } | |
16239 | ||
7fa90e87 TI |
16240 | if (board_config == ALC861_AUTO) |
16241 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); | |
cfc9b06f | 16242 | |
df694daa KY |
16243 | if (board_config == ALC861_AUTO) { |
16244 | /* automatic parse from the BIOS config */ | |
16245 | err = alc861_parse_auto_config(codec); | |
16246 | if (err < 0) { | |
16247 | alc_free(codec); | |
16248 | return err; | |
f12ab1e0 | 16249 | } else if (!err) { |
9c7f852e TI |
16250 | printk(KERN_INFO |
16251 | "hda_codec: Cannot set up configuration " | |
16252 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
16253 | board_config = ALC861_3ST_DIG; |
16254 | } | |
16255 | } | |
16256 | ||
680cd536 KK |
16257 | err = snd_hda_attach_beep_device(codec, 0x23); |
16258 | if (err < 0) { | |
16259 | alc_free(codec); | |
16260 | return err; | |
16261 | } | |
16262 | ||
df694daa | 16263 | if (board_config != ALC861_AUTO) |
e9c364c0 | 16264 | setup_preset(codec, &alc861_presets[board_config]); |
df694daa | 16265 | |
df694daa KY |
16266 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
16267 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
16268 | ||
df694daa KY |
16269 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
16270 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
16271 | ||
c7a8eb10 TI |
16272 | if (!spec->cap_mixer) |
16273 | set_capture_mixer(codec); | |
45bdd1c1 TI |
16274 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
16275 | ||
2134ea4f TI |
16276 | spec->vmaster_nid = 0x03; |
16277 | ||
7fa90e87 TI |
16278 | if (board_config == ALC861_AUTO) |
16279 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); | |
16280 | ||
df694daa | 16281 | codec->patch_ops = alc_patch_ops; |
c97259df | 16282 | if (board_config == ALC861_AUTO) { |
ae6b813a | 16283 | spec->init_hook = alc861_auto_init; |
c97259df DC |
16284 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16285 | spec->power_hook = alc_power_eapd; | |
16286 | #endif | |
16287 | } | |
cb53c626 TI |
16288 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16289 | if (!spec->loopback.amplist) | |
16290 | spec->loopback.amplist = alc861_loopbacks; | |
16291 | #endif | |
ea1fb29a | 16292 | |
1da177e4 LT |
16293 | return 0; |
16294 | } | |
16295 | ||
f32610ed JS |
16296 | /* |
16297 | * ALC861-VD support | |
16298 | * | |
16299 | * Based on ALC882 | |
16300 | * | |
16301 | * In addition, an independent DAC | |
16302 | */ | |
16303 | #define ALC861VD_DIGOUT_NID 0x06 | |
16304 | ||
16305 | static hda_nid_t alc861vd_dac_nids[4] = { | |
16306 | /* front, surr, clfe, side surr */ | |
16307 | 0x02, 0x03, 0x04, 0x05 | |
16308 | }; | |
16309 | ||
16310 | /* dac_nids for ALC660vd are in a different order - according to | |
16311 | * Realtek's driver. | |
def319f9 | 16312 | * This should probably result in a different mixer for 6stack models |
f32610ed JS |
16313 | * of ALC660vd codecs, but for now there is only 3stack mixer |
16314 | * - and it is the same as in 861vd. | |
16315 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
16316 | */ | |
16317 | static hda_nid_t alc660vd_dac_nids[3] = { | |
16318 | /* front, rear, clfe, rear_surr */ | |
16319 | 0x02, 0x04, 0x03 | |
16320 | }; | |
16321 | ||
16322 | static hda_nid_t alc861vd_adc_nids[1] = { | |
16323 | /* ADC0 */ | |
16324 | 0x09, | |
16325 | }; | |
16326 | ||
e1406348 TI |
16327 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
16328 | ||
f32610ed JS |
16329 | /* input MUX */ |
16330 | /* FIXME: should be a matrix-type input source selection */ | |
16331 | static struct hda_input_mux alc861vd_capture_source = { | |
16332 | .num_items = 4, | |
16333 | .items = { | |
16334 | { "Mic", 0x0 }, | |
16335 | { "Front Mic", 0x1 }, | |
16336 | { "Line", 0x2 }, | |
16337 | { "CD", 0x4 }, | |
16338 | }, | |
16339 | }; | |
16340 | ||
272a527c | 16341 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
b419f346 | 16342 | .num_items = 2, |
272a527c | 16343 | .items = { |
b419f346 TD |
16344 | { "Ext Mic", 0x0 }, |
16345 | { "Int Mic", 0x1 }, | |
272a527c KY |
16346 | }, |
16347 | }; | |
16348 | ||
d1a991a6 KY |
16349 | static struct hda_input_mux alc861vd_hp_capture_source = { |
16350 | .num_items = 2, | |
16351 | .items = { | |
16352 | { "Front Mic", 0x0 }, | |
16353 | { "ATAPI Mic", 0x1 }, | |
16354 | }, | |
16355 | }; | |
16356 | ||
f32610ed JS |
16357 | /* |
16358 | * 2ch mode | |
16359 | */ | |
16360 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
16361 | { 2, NULL } | |
16362 | }; | |
16363 | ||
16364 | /* | |
16365 | * 6ch mode | |
16366 | */ | |
16367 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
16368 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
16369 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16370 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16371 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16372 | { } /* end */ | |
16373 | }; | |
16374 | ||
16375 | /* | |
16376 | * 8ch mode | |
16377 | */ | |
16378 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
16379 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16380 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16381 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16382 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
16383 | { } /* end */ | |
16384 | }; | |
16385 | ||
16386 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
16387 | { 6, alc861vd_6stack_ch6_init }, | |
16388 | { 8, alc861vd_6stack_ch8_init }, | |
16389 | }; | |
16390 | ||
16391 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
16392 | { | |
16393 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
16394 | .name = "Channel Mode", | |
16395 | .info = alc_ch_mode_info, | |
16396 | .get = alc_ch_mode_get, | |
16397 | .put = alc_ch_mode_put, | |
16398 | }, | |
16399 | { } /* end */ | |
16400 | }; | |
16401 | ||
f32610ed JS |
16402 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
16403 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
16404 | */ | |
16405 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
16406 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16407 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16408 | ||
16409 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16410 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
16411 | ||
16412 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
16413 | HDA_OUTPUT), | |
16414 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
16415 | HDA_OUTPUT), | |
16416 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
16417 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16418 | ||
16419 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
16420 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
16421 | ||
16422 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16423 | ||
16424 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16425 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16426 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16427 | ||
16428 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16429 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16430 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16431 | ||
16432 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16433 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16434 | ||
16435 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16436 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16437 | ||
f32610ed JS |
16438 | { } /* end */ |
16439 | }; | |
16440 | ||
16441 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
16442 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16443 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16444 | ||
16445 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16446 | ||
16447 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16448 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16449 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16450 | ||
16451 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16452 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16453 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16454 | ||
16455 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
16456 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16457 | ||
16458 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16459 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16460 | ||
f32610ed JS |
16461 | { } /* end */ |
16462 | }; | |
16463 | ||
bdd148a3 KY |
16464 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
16465 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16466 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
16467 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
16468 | ||
16469 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
16470 | ||
16471 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
16472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16474 | ||
16475 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
16476 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16477 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
16478 | ||
16479 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
16480 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16481 | ||
16482 | { } /* end */ | |
16483 | }; | |
16484 | ||
b419f346 TD |
16485 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
16486 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
272a527c KY |
16487 | */ |
16488 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
b419f346 TD |
16489 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
16490 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
272a527c KY |
16491 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
16492 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
b419f346 TD |
16493 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
16494 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16495 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16496 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
16497 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16498 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
272a527c KY |
16499 | { } /* end */ |
16500 | }; | |
16501 | ||
d1a991a6 KY |
16502 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
16503 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
16504 | */ | |
16505 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
16506 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
16507 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
16508 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
16509 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
16510 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
16511 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16512 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
16513 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ea1fb29a | 16514 | |
d1a991a6 KY |
16515 | { } /* end */ |
16516 | }; | |
16517 | ||
f32610ed JS |
16518 | /* |
16519 | * generic initialization of ADC, input mixers and output mixers | |
16520 | */ | |
16521 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
16522 | /* | |
16523 | * Unmute ADC0 and set the default input to mic-in | |
16524 | */ | |
16525 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16526 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16527 | ||
16528 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
16529 | * the analog-loopback mixer widget | |
16530 | */ | |
16531 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
16532 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
16533 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16534 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16535 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16536 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
f32610ed JS |
16537 | |
16538 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
bdd148a3 KY |
16539 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
16540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f32610ed | 16542 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
f32610ed JS |
16543 | |
16544 | /* | |
16545 | * Set up output mixers (0x02 - 0x05) | |
16546 | */ | |
16547 | /* set vol=0 to output mixers */ | |
16548 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16549 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16550 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16551 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16552 | ||
16553 | /* set up input amps for analog loopback */ | |
16554 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
16555 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16556 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16557 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16558 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16559 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16560 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16561 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16562 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16563 | ||
16564 | { } | |
16565 | }; | |
16566 | ||
16567 | /* | |
16568 | * 3-stack pin configuration: | |
16569 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
16570 | */ | |
16571 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
16572 | /* | |
16573 | * Set pin mode and muting | |
16574 | */ | |
16575 | /* set front pin widgets 0x14 for output */ | |
16576 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16577 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16578 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16579 | ||
16580 | /* Mic (rear) pin: input vref at 80% */ | |
16581 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16582 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16583 | /* Front Mic pin: input vref at 80% */ | |
16584 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16585 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16586 | /* Line In pin: input */ | |
16587 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16588 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16589 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16590 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16591 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16592 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16593 | /* CD pin widget for input */ | |
16594 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16595 | ||
16596 | { } | |
16597 | }; | |
16598 | ||
16599 | /* | |
16600 | * 6-stack pin configuration: | |
16601 | */ | |
16602 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
16603 | /* | |
16604 | * Set pin mode and muting | |
16605 | */ | |
16606 | /* set front pin widgets 0x14 for output */ | |
16607 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16608 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16609 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16610 | ||
16611 | /* Rear Pin: output 1 (0x0d) */ | |
16612 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16613 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16614 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
16615 | /* CLFE Pin: output 2 (0x0e) */ | |
16616 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16617 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16618 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16619 | /* Side Pin: output 3 (0x0f) */ | |
16620 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16621 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16622 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
16623 | ||
16624 | /* Mic (rear) pin: input vref at 80% */ | |
16625 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16626 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16627 | /* Front Mic pin: input vref at 80% */ | |
16628 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
16629 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16630 | /* Line In pin: input */ | |
16631 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16632 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16633 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
16634 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
16635 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16636 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
16637 | /* CD pin widget for input */ | |
16638 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16639 | ||
16640 | { } | |
16641 | }; | |
16642 | ||
bdd148a3 KY |
16643 | static struct hda_verb alc861vd_eapd_verbs[] = { |
16644 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16645 | { } | |
16646 | }; | |
16647 | ||
f9423e7a KY |
16648 | static struct hda_verb alc660vd_eapd_verbs[] = { |
16649 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16650 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
16651 | { } | |
16652 | }; | |
16653 | ||
bdd148a3 KY |
16654 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
16655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16656 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
16658 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
ea1fb29a | 16659 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
bdd148a3 KY |
16660 | {} |
16661 | }; | |
16662 | ||
bdd148a3 KY |
16663 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
16664 | { | |
16665 | unsigned int present; | |
16666 | unsigned char bits; | |
16667 | ||
864f92be | 16668 | present = snd_hda_jack_detect(codec, 0x18); |
47fd830a | 16669 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 16670 | |
47fd830a TI |
16671 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
16672 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
16673 | } |
16674 | ||
4f5d1706 | 16675 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
bdd148a3 | 16676 | { |
a9fd4f3f | 16677 | struct alc_spec *spec = codec->spec; |
a9fd4f3f TI |
16678 | spec->autocfg.hp_pins[0] = 0x1b; |
16679 | spec->autocfg.speaker_pins[0] = 0x14; | |
4f5d1706 TI |
16680 | } |
16681 | ||
16682 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | |
16683 | { | |
a9fd4f3f | 16684 | alc_automute_amp(codec); |
bdd148a3 KY |
16685 | alc861vd_lenovo_mic_automute(codec); |
16686 | } | |
16687 | ||
16688 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
16689 | unsigned int res) | |
16690 | { | |
16691 | switch (res >> 26) { | |
bdd148a3 KY |
16692 | case ALC880_MIC_EVENT: |
16693 | alc861vd_lenovo_mic_automute(codec); | |
16694 | break; | |
a9fd4f3f TI |
16695 | default: |
16696 | alc_automute_amp_unsol_event(codec, res); | |
16697 | break; | |
bdd148a3 KY |
16698 | } |
16699 | } | |
16700 | ||
272a527c KY |
16701 | static struct hda_verb alc861vd_dallas_verbs[] = { |
16702 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16703 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16704 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16705 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
16706 | ||
16707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16708 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
16709 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16710 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16711 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16712 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
16713 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
16714 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
ea1fb29a | 16715 | |
272a527c KY |
16716 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16717 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16718 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16719 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16720 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16721 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16722 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
16723 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
16724 | ||
16725 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16726 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16727 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
16728 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16729 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16730 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16731 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16732 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
16733 | ||
16734 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
16735 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
16736 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
16737 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
16738 | ||
16739 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 16740 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
272a527c KY |
16741 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
16742 | ||
16743 | { } /* end */ | |
16744 | }; | |
16745 | ||
16746 | /* toggle speaker-output according to the hp-jack state */ | |
4f5d1706 | 16747 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
272a527c | 16748 | { |
a9fd4f3f | 16749 | struct alc_spec *spec = codec->spec; |
272a527c | 16750 | |
a9fd4f3f TI |
16751 | spec->autocfg.hp_pins[0] = 0x15; |
16752 | spec->autocfg.speaker_pins[0] = 0x14; | |
272a527c KY |
16753 | } |
16754 | ||
cb53c626 TI |
16755 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16756 | #define alc861vd_loopbacks alc880_loopbacks | |
16757 | #endif | |
16758 | ||
def319f9 | 16759 | /* pcm configuration: identical with ALC880 */ |
f32610ed JS |
16760 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
16761 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
16762 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
16763 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
16764 | ||
16765 | /* | |
16766 | * configuration and preset | |
16767 | */ | |
16768 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |
16769 | [ALC660VD_3ST] = "3stack-660", | |
983f8ae4 | 16770 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
13c94744 | 16771 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
f32610ed JS |
16772 | [ALC861VD_3ST] = "3stack", |
16773 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
16774 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
bdd148a3 | 16775 | [ALC861VD_LENOVO] = "lenovo", |
272a527c | 16776 | [ALC861VD_DALLAS] = "dallas", |
983f8ae4 | 16777 | [ALC861VD_HP] = "hp", |
f32610ed JS |
16778 | [ALC861VD_AUTO] = "auto", |
16779 | }; | |
16780 | ||
16781 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
ac3e3741 TI |
16782 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
16783 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
07e038b3 | 16784 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
f8f25ba3 | 16785 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
13c94744 | 16786 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
6963f84c | 16787 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
f32610ed | 16788 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
ac3e3741 | 16789 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
38baf5ad | 16790 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
ce577e8c | 16791 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
542d7c66 | 16792 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
b419f346 | 16793 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
39c5d41f | 16794 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
dea0a509 | 16795 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
625dc0bf | 16796 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
f32610ed JS |
16797 | {} |
16798 | }; | |
16799 | ||
16800 | static struct alc_config_preset alc861vd_presets[] = { | |
16801 | [ALC660VD_3ST] = { | |
16802 | .mixers = { alc861vd_3st_mixer }, | |
16803 | .init_verbs = { alc861vd_volume_init_verbs, | |
16804 | alc861vd_3stack_init_verbs }, | |
16805 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16806 | .dac_nids = alc660vd_dac_nids, | |
f32610ed JS |
16807 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16808 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16809 | .input_mux = &alc861vd_capture_source, | |
16810 | }, | |
6963f84c MC |
16811 | [ALC660VD_3ST_DIG] = { |
16812 | .mixers = { alc861vd_3st_mixer }, | |
16813 | .init_verbs = { alc861vd_volume_init_verbs, | |
16814 | alc861vd_3stack_init_verbs }, | |
16815 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16816 | .dac_nids = alc660vd_dac_nids, | |
16817 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
6963f84c MC |
16818 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16819 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16820 | .input_mux = &alc861vd_capture_source, | |
16821 | }, | |
f32610ed JS |
16822 | [ALC861VD_3ST] = { |
16823 | .mixers = { alc861vd_3st_mixer }, | |
16824 | .init_verbs = { alc861vd_volume_init_verbs, | |
16825 | alc861vd_3stack_init_verbs }, | |
16826 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16827 | .dac_nids = alc861vd_dac_nids, | |
16828 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16829 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16830 | .input_mux = &alc861vd_capture_source, | |
16831 | }, | |
16832 | [ALC861VD_3ST_DIG] = { | |
16833 | .mixers = { alc861vd_3st_mixer }, | |
16834 | .init_verbs = { alc861vd_volume_init_verbs, | |
16835 | alc861vd_3stack_init_verbs }, | |
16836 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16837 | .dac_nids = alc861vd_dac_nids, | |
16838 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16839 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16840 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16841 | .input_mux = &alc861vd_capture_source, | |
16842 | }, | |
16843 | [ALC861VD_6ST_DIG] = { | |
16844 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
16845 | .init_verbs = { alc861vd_volume_init_verbs, | |
16846 | alc861vd_6stack_init_verbs }, | |
16847 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16848 | .dac_nids = alc861vd_dac_nids, | |
16849 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16850 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
16851 | .channel_mode = alc861vd_6stack_modes, | |
16852 | .input_mux = &alc861vd_capture_source, | |
16853 | }, | |
bdd148a3 KY |
16854 | [ALC861VD_LENOVO] = { |
16855 | .mixers = { alc861vd_lenovo_mixer }, | |
16856 | .init_verbs = { alc861vd_volume_init_verbs, | |
16857 | alc861vd_3stack_init_verbs, | |
16858 | alc861vd_eapd_verbs, | |
16859 | alc861vd_lenovo_unsol_verbs }, | |
16860 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16861 | .dac_nids = alc660vd_dac_nids, | |
bdd148a3 KY |
16862 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16863 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16864 | .input_mux = &alc861vd_capture_source, | |
16865 | .unsol_event = alc861vd_lenovo_unsol_event, | |
4f5d1706 | 16866 | .setup = alc861vd_lenovo_setup, |
a9fd4f3f | 16867 | .init_hook = alc861vd_lenovo_init_hook, |
bdd148a3 | 16868 | }, |
272a527c KY |
16869 | [ALC861VD_DALLAS] = { |
16870 | .mixers = { alc861vd_dallas_mixer }, | |
16871 | .init_verbs = { alc861vd_dallas_verbs }, | |
16872 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16873 | .dac_nids = alc861vd_dac_nids, | |
272a527c KY |
16874 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16875 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16876 | .input_mux = &alc861vd_dallas_capture_source, | |
a9fd4f3f | 16877 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
16878 | .setup = alc861vd_dallas_setup, |
16879 | .init_hook = alc_automute_amp, | |
d1a991a6 KY |
16880 | }, |
16881 | [ALC861VD_HP] = { | |
16882 | .mixers = { alc861vd_hp_mixer }, | |
16883 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
16884 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
16885 | .dac_nids = alc861vd_dac_nids, | |
d1a991a6 | 16886 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
d1a991a6 KY |
16887 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
16888 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16889 | .input_mux = &alc861vd_hp_capture_source, | |
a9fd4f3f | 16890 | .unsol_event = alc_automute_amp_unsol_event, |
4f5d1706 TI |
16891 | .setup = alc861vd_dallas_setup, |
16892 | .init_hook = alc_automute_amp, | |
ea1fb29a | 16893 | }, |
13c94744 TI |
16894 | [ALC660VD_ASUS_V1S] = { |
16895 | .mixers = { alc861vd_lenovo_mixer }, | |
16896 | .init_verbs = { alc861vd_volume_init_verbs, | |
16897 | alc861vd_3stack_init_verbs, | |
16898 | alc861vd_eapd_verbs, | |
16899 | alc861vd_lenovo_unsol_verbs }, | |
16900 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
16901 | .dac_nids = alc660vd_dac_nids, | |
16902 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
16903 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
16904 | .channel_mode = alc861vd_3stack_2ch_modes, | |
16905 | .input_mux = &alc861vd_capture_source, | |
16906 | .unsol_event = alc861vd_lenovo_unsol_event, | |
4f5d1706 | 16907 | .setup = alc861vd_lenovo_setup, |
a9fd4f3f | 16908 | .init_hook = alc861vd_lenovo_init_hook, |
13c94744 | 16909 | }, |
f32610ed JS |
16910 | }; |
16911 | ||
16912 | /* | |
16913 | * BIOS auto configuration | |
16914 | */ | |
05f5f477 TI |
16915 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
16916 | const struct auto_pin_cfg *cfg) | |
16917 | { | |
7167594a | 16918 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
05f5f477 TI |
16919 | } |
16920 | ||
16921 | ||
f32610ed JS |
16922 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
16923 | hda_nid_t nid, int pin_type, int dac_idx) | |
16924 | { | |
f6c7e546 | 16925 | alc_set_pin_output(codec, nid, pin_type); |
f32610ed JS |
16926 | } |
16927 | ||
16928 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
16929 | { | |
16930 | struct alc_spec *spec = codec->spec; | |
16931 | int i; | |
16932 | ||
16933 | for (i = 0; i <= HDA_SIDE; i++) { | |
16934 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 16935 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
f32610ed JS |
16936 | if (nid) |
16937 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
baba8ee9 | 16938 | pin_type, i); |
f32610ed JS |
16939 | } |
16940 | } | |
16941 | ||
16942 | ||
16943 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
16944 | { | |
16945 | struct alc_spec *spec = codec->spec; | |
16946 | hda_nid_t pin; | |
16947 | ||
16948 | pin = spec->autocfg.hp_pins[0]; | |
def319f9 | 16949 | if (pin) /* connect to front and use dac 0 */ |
f32610ed | 16950 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
f6c7e546 TI |
16951 | pin = spec->autocfg.speaker_pins[0]; |
16952 | if (pin) | |
16953 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
f32610ed JS |
16954 | } |
16955 | ||
f32610ed JS |
16956 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
16957 | ||
16958 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
16959 | { | |
16960 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 16961 | struct auto_pin_cfg *cfg = &spec->autocfg; |
f32610ed JS |
16962 | int i; |
16963 | ||
66ceeb6b TI |
16964 | for (i = 0; i < cfg->num_inputs; i++) { |
16965 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 16966 | if (alc_is_input_pin(codec, nid)) { |
30ea098f | 16967 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
e82c025b TI |
16968 | if (nid != ALC861VD_PIN_CD_NID && |
16969 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | |
f32610ed JS |
16970 | snd_hda_codec_write(codec, nid, 0, |
16971 | AC_VERB_SET_AMP_GAIN_MUTE, | |
16972 | AMP_OUT_MUTE); | |
16973 | } | |
16974 | } | |
16975 | } | |
16976 | ||
f511b01c TI |
16977 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
16978 | ||
f32610ed JS |
16979 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
16980 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
16981 | ||
16982 | /* add playback controls from the parsed DAC table */ | |
16983 | /* Based on ALC880 version. But ALC861VD has separate, | |
16984 | * different NIDs for mute/unmute switch and volume control */ | |
16985 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
16986 | const struct auto_pin_cfg *cfg) | |
16987 | { | |
f32610ed JS |
16988 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
16989 | hda_nid_t nid_v, nid_s; | |
16990 | int i, err; | |
16991 | ||
16992 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 16993 | if (!spec->multiout.dac_nids[i]) |
f32610ed JS |
16994 | continue; |
16995 | nid_v = alc861vd_idx_to_mixer_vol( | |
16996 | alc880_dac_to_idx( | |
16997 | spec->multiout.dac_nids[i])); | |
16998 | nid_s = alc861vd_idx_to_mixer_switch( | |
16999 | alc880_dac_to_idx( | |
17000 | spec->multiout.dac_nids[i])); | |
17001 | ||
17002 | if (i == 2) { | |
17003 | /* Center/LFE */ | |
0afe5f89 TI |
17004 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
17005 | "Center", | |
f12ab1e0 TI |
17006 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
17007 | HDA_OUTPUT)); | |
17008 | if (err < 0) | |
f32610ed | 17009 | return err; |
0afe5f89 TI |
17010 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
17011 | "LFE", | |
f12ab1e0 TI |
17012 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
17013 | HDA_OUTPUT)); | |
17014 | if (err < 0) | |
f32610ed | 17015 | return err; |
0afe5f89 TI |
17016 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
17017 | "Center", | |
f12ab1e0 TI |
17018 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
17019 | HDA_INPUT)); | |
17020 | if (err < 0) | |
f32610ed | 17021 | return err; |
0afe5f89 TI |
17022 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
17023 | "LFE", | |
f12ab1e0 TI |
17024 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
17025 | HDA_INPUT)); | |
17026 | if (err < 0) | |
f32610ed JS |
17027 | return err; |
17028 | } else { | |
a4fcd491 TI |
17029 | const char *pfx; |
17030 | if (cfg->line_outs == 1 && | |
17031 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
17032 | if (!cfg->hp_pins) | |
17033 | pfx = "Speaker"; | |
17034 | else | |
17035 | pfx = "PCM"; | |
17036 | } else | |
17037 | pfx = chname[i]; | |
0afe5f89 | 17038 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
17039 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
17040 | HDA_OUTPUT)); | |
17041 | if (err < 0) | |
f32610ed | 17042 | return err; |
a4fcd491 TI |
17043 | if (cfg->line_outs == 1 && |
17044 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
17045 | pfx = "Speaker"; | |
0afe5f89 | 17046 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
bdd148a3 | 17047 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
f12ab1e0 TI |
17048 | HDA_INPUT)); |
17049 | if (err < 0) | |
f32610ed JS |
17050 | return err; |
17051 | } | |
17052 | } | |
17053 | return 0; | |
17054 | } | |
17055 | ||
17056 | /* add playback controls for speaker and HP outputs */ | |
17057 | /* Based on ALC880 version. But ALC861VD has separate, | |
17058 | * different NIDs for mute/unmute switch and volume control */ | |
17059 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
17060 | hda_nid_t pin, const char *pfx) | |
17061 | { | |
17062 | hda_nid_t nid_v, nid_s; | |
17063 | int err; | |
f32610ed | 17064 | |
f12ab1e0 | 17065 | if (!pin) |
f32610ed JS |
17066 | return 0; |
17067 | ||
17068 | if (alc880_is_fixed_pin(pin)) { | |
17069 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
17070 | /* specify the DAC as the extra output */ | |
f12ab1e0 | 17071 | if (!spec->multiout.hp_nid) |
f32610ed JS |
17072 | spec->multiout.hp_nid = nid_v; |
17073 | else | |
17074 | spec->multiout.extra_out_nid[0] = nid_v; | |
17075 | /* control HP volume/switch on the output mixer amp */ | |
17076 | nid_v = alc861vd_idx_to_mixer_vol( | |
17077 | alc880_fixed_pin_idx(pin)); | |
17078 | nid_s = alc861vd_idx_to_mixer_switch( | |
17079 | alc880_fixed_pin_idx(pin)); | |
17080 | ||
0afe5f89 | 17081 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
f12ab1e0 TI |
17082 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
17083 | if (err < 0) | |
f32610ed | 17084 | return err; |
0afe5f89 | 17085 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
f12ab1e0 TI |
17086 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
17087 | if (err < 0) | |
f32610ed JS |
17088 | return err; |
17089 | } else if (alc880_is_multi_pin(pin)) { | |
17090 | /* set manual connection */ | |
17091 | /* we have only a switch on HP-out PIN */ | |
0afe5f89 | 17092 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
f12ab1e0 TI |
17093 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
17094 | if (err < 0) | |
f32610ed JS |
17095 | return err; |
17096 | } | |
17097 | return 0; | |
17098 | } | |
17099 | ||
17100 | /* parse the BIOS configuration and set up the alc_spec | |
17101 | * return 1 if successful, 0 if the proper config is not found, | |
17102 | * or a negative error code | |
17103 | * Based on ALC880 version - had to change it to override | |
17104 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
17105 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
17106 | { | |
17107 | struct alc_spec *spec = codec->spec; | |
17108 | int err; | |
17109 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
17110 | ||
f12ab1e0 TI |
17111 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
17112 | alc861vd_ignore); | |
17113 | if (err < 0) | |
f32610ed | 17114 | return err; |
f12ab1e0 | 17115 | if (!spec->autocfg.line_outs) |
f32610ed JS |
17116 | return 0; /* can't find valid BIOS pin config */ |
17117 | ||
f12ab1e0 TI |
17118 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
17119 | if (err < 0) | |
17120 | return err; | |
17121 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
17122 | if (err < 0) | |
17123 | return err; | |
17124 | err = alc861vd_auto_create_extra_out(spec, | |
17125 | spec->autocfg.speaker_pins[0], | |
17126 | "Speaker"); | |
17127 | if (err < 0) | |
17128 | return err; | |
17129 | err = alc861vd_auto_create_extra_out(spec, | |
17130 | spec->autocfg.hp_pins[0], | |
17131 | "Headphone"); | |
17132 | if (err < 0) | |
17133 | return err; | |
05f5f477 | 17134 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 17135 | if (err < 0) |
f32610ed JS |
17136 | return err; |
17137 | ||
17138 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
17139 | ||
757899ac | 17140 | alc_auto_parse_digital(codec); |
f32610ed | 17141 | |
603c4019 | 17142 | if (spec->kctls.list) |
d88897ea | 17143 | add_mixer(spec, spec->kctls.list); |
f32610ed | 17144 | |
d88897ea | 17145 | add_verb(spec, alc861vd_volume_init_verbs); |
f32610ed JS |
17146 | |
17147 | spec->num_mux_defs = 1; | |
61b9b9b1 | 17148 | spec->input_mux = &spec->private_imux[0]; |
f32610ed | 17149 | |
776e184e TI |
17150 | err = alc_auto_add_mic_boost(codec); |
17151 | if (err < 0) | |
17152 | return err; | |
17153 | ||
6227cdce | 17154 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
4a79ba34 | 17155 | |
f32610ed JS |
17156 | return 1; |
17157 | } | |
17158 | ||
17159 | /* additional initialization for auto-configuration model */ | |
17160 | static void alc861vd_auto_init(struct hda_codec *codec) | |
17161 | { | |
f6c7e546 | 17162 | struct alc_spec *spec = codec->spec; |
f32610ed JS |
17163 | alc861vd_auto_init_multi_out(codec); |
17164 | alc861vd_auto_init_hp_out(codec); | |
17165 | alc861vd_auto_init_analog_input(codec); | |
f511b01c | 17166 | alc861vd_auto_init_input_src(codec); |
757899ac | 17167 | alc_auto_init_digital(codec); |
f6c7e546 | 17168 | if (spec->unsol_event) |
7fb0d78f | 17169 | alc_inithook(codec); |
f32610ed JS |
17170 | } |
17171 | ||
f8f25ba3 TI |
17172 | enum { |
17173 | ALC660VD_FIX_ASUS_GPIO1 | |
17174 | }; | |
17175 | ||
17176 | /* reset GPIO1 */ | |
f8f25ba3 TI |
17177 | static const struct alc_fixup alc861vd_fixups[] = { |
17178 | [ALC660VD_FIX_ASUS_GPIO1] = { | |
73413b12 TI |
17179 | .verbs = (const struct hda_verb[]) { |
17180 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
17181 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
17182 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
17183 | { } | |
17184 | } | |
f8f25ba3 TI |
17185 | }, |
17186 | }; | |
17187 | ||
17188 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | |
17189 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | |
17190 | {} | |
17191 | }; | |
17192 | ||
f32610ed JS |
17193 | static int patch_alc861vd(struct hda_codec *codec) |
17194 | { | |
17195 | struct alc_spec *spec; | |
17196 | int err, board_config; | |
17197 | ||
17198 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
17199 | if (spec == NULL) | |
17200 | return -ENOMEM; | |
17201 | ||
17202 | codec->spec = spec; | |
17203 | ||
17204 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
17205 | alc861vd_models, | |
17206 | alc861vd_cfg_tbl); | |
17207 | ||
17208 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
9a11f1aa TI |
17209 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
17210 | codec->chip_name); | |
f32610ed JS |
17211 | board_config = ALC861VD_AUTO; |
17212 | } | |
17213 | ||
7fa90e87 TI |
17214 | if (board_config == ALC861VD_AUTO) |
17215 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); | |
f8f25ba3 | 17216 | |
f32610ed JS |
17217 | if (board_config == ALC861VD_AUTO) { |
17218 | /* automatic parse from the BIOS config */ | |
17219 | err = alc861vd_parse_auto_config(codec); | |
17220 | if (err < 0) { | |
17221 | alc_free(codec); | |
17222 | return err; | |
f12ab1e0 | 17223 | } else if (!err) { |
f32610ed JS |
17224 | printk(KERN_INFO |
17225 | "hda_codec: Cannot set up configuration " | |
17226 | "from BIOS. Using base mode...\n"); | |
17227 | board_config = ALC861VD_3ST; | |
17228 | } | |
17229 | } | |
17230 | ||
680cd536 KK |
17231 | err = snd_hda_attach_beep_device(codec, 0x23); |
17232 | if (err < 0) { | |
17233 | alc_free(codec); | |
17234 | return err; | |
17235 | } | |
17236 | ||
f32610ed | 17237 | if (board_config != ALC861VD_AUTO) |
e9c364c0 | 17238 | setup_preset(codec, &alc861vd_presets[board_config]); |
f32610ed | 17239 | |
2f893286 | 17240 | if (codec->vendor_id == 0x10ec0660) { |
f9423e7a | 17241 | /* always turn on EAPD */ |
d88897ea | 17242 | add_verb(spec, alc660vd_eapd_verbs); |
2f893286 KY |
17243 | } |
17244 | ||
f32610ed JS |
17245 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
17246 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
17247 | ||
f32610ed JS |
17248 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
17249 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
17250 | ||
dd704698 TI |
17251 | if (!spec->adc_nids) { |
17252 | spec->adc_nids = alc861vd_adc_nids; | |
17253 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
17254 | } | |
17255 | if (!spec->capsrc_nids) | |
17256 | spec->capsrc_nids = alc861vd_capsrc_nids; | |
f32610ed | 17257 | |
b59bdf3b | 17258 | set_capture_mixer(codec); |
45bdd1c1 | 17259 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
f32610ed | 17260 | |
2134ea4f TI |
17261 | spec->vmaster_nid = 0x02; |
17262 | ||
7fa90e87 TI |
17263 | if (board_config == ALC861VD_AUTO) |
17264 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); | |
17265 | ||
f32610ed JS |
17266 | codec->patch_ops = alc_patch_ops; |
17267 | ||
17268 | if (board_config == ALC861VD_AUTO) | |
17269 | spec->init_hook = alc861vd_auto_init; | |
cb53c626 TI |
17270 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
17271 | if (!spec->loopback.amplist) | |
17272 | spec->loopback.amplist = alc861vd_loopbacks; | |
17273 | #endif | |
f32610ed JS |
17274 | |
17275 | return 0; | |
17276 | } | |
17277 | ||
bc9f98a9 KY |
17278 | /* |
17279 | * ALC662 support | |
17280 | * | |
17281 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
17282 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
17283 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
17284 | * 6-channel independent captures. | |
17285 | * | |
17286 | * In addition, an independent DAC for the multi-playback (not used in this | |
17287 | * driver yet). | |
17288 | */ | |
17289 | #define ALC662_DIGOUT_NID 0x06 | |
17290 | #define ALC662_DIGIN_NID 0x0a | |
17291 | ||
17292 | static hda_nid_t alc662_dac_nids[4] = { | |
17293 | /* front, rear, clfe, rear_surr */ | |
17294 | 0x02, 0x03, 0x04 | |
17295 | }; | |
17296 | ||
622e84cd KY |
17297 | static hda_nid_t alc272_dac_nids[2] = { |
17298 | 0x02, 0x03 | |
17299 | }; | |
17300 | ||
b59bdf3b | 17301 | static hda_nid_t alc662_adc_nids[2] = { |
bc9f98a9 | 17302 | /* ADC1-2 */ |
b59bdf3b | 17303 | 0x09, 0x08 |
bc9f98a9 | 17304 | }; |
e1406348 | 17305 | |
622e84cd KY |
17306 | static hda_nid_t alc272_adc_nids[1] = { |
17307 | /* ADC1-2 */ | |
17308 | 0x08, | |
17309 | }; | |
17310 | ||
b59bdf3b | 17311 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
622e84cd KY |
17312 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
17313 | ||
e1406348 | 17314 | |
bc9f98a9 KY |
17315 | /* input MUX */ |
17316 | /* FIXME: should be a matrix-type input source selection */ | |
bc9f98a9 KY |
17317 | static struct hda_input_mux alc662_capture_source = { |
17318 | .num_items = 4, | |
17319 | .items = { | |
17320 | { "Mic", 0x0 }, | |
17321 | { "Front Mic", 0x1 }, | |
17322 | { "Line", 0x2 }, | |
17323 | { "CD", 0x4 }, | |
17324 | }, | |
17325 | }; | |
17326 | ||
17327 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
17328 | .num_items = 2, | |
17329 | .items = { | |
17330 | { "Mic", 0x1 }, | |
17331 | { "Line", 0x2 }, | |
17332 | }, | |
17333 | }; | |
291702f0 | 17334 | |
6dda9f4a KY |
17335 | static struct hda_input_mux alc663_capture_source = { |
17336 | .num_items = 3, | |
17337 | .items = { | |
17338 | { "Mic", 0x0 }, | |
17339 | { "Front Mic", 0x1 }, | |
17340 | { "Line", 0x2 }, | |
17341 | }, | |
17342 | }; | |
17343 | ||
4f5d1706 | 17344 | #if 0 /* set to 1 for testing other input sources below */ |
9541ba1d CP |
17345 | static struct hda_input_mux alc272_nc10_capture_source = { |
17346 | .num_items = 16, | |
17347 | .items = { | |
17348 | { "Autoselect Mic", 0x0 }, | |
17349 | { "Internal Mic", 0x1 }, | |
17350 | { "In-0x02", 0x2 }, | |
17351 | { "In-0x03", 0x3 }, | |
17352 | { "In-0x04", 0x4 }, | |
17353 | { "In-0x05", 0x5 }, | |
17354 | { "In-0x06", 0x6 }, | |
17355 | { "In-0x07", 0x7 }, | |
17356 | { "In-0x08", 0x8 }, | |
17357 | { "In-0x09", 0x9 }, | |
17358 | { "In-0x0a", 0x0a }, | |
17359 | { "In-0x0b", 0x0b }, | |
17360 | { "In-0x0c", 0x0c }, | |
17361 | { "In-0x0d", 0x0d }, | |
17362 | { "In-0x0e", 0x0e }, | |
17363 | { "In-0x0f", 0x0f }, | |
17364 | }, | |
17365 | }; | |
17366 | #endif | |
17367 | ||
bc9f98a9 KY |
17368 | /* |
17369 | * 2ch mode | |
17370 | */ | |
17371 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
17372 | { 2, NULL } | |
17373 | }; | |
17374 | ||
17375 | /* | |
17376 | * 2ch mode | |
17377 | */ | |
17378 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
17379 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
17380 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17381 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
17382 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
17383 | { } /* end */ | |
17384 | }; | |
17385 | ||
17386 | /* | |
17387 | * 6ch mode | |
17388 | */ | |
17389 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
17390 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17391 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17392 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
17393 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17394 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
17395 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
17396 | { } /* end */ | |
17397 | }; | |
17398 | ||
17399 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
17400 | { 2, alc662_3ST_ch2_init }, | |
17401 | { 6, alc662_3ST_ch6_init }, | |
17402 | }; | |
17403 | ||
17404 | /* | |
17405 | * 2ch mode | |
17406 | */ | |
17407 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
17408 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17409 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
17410 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17411 | { } /* end */ | |
17412 | }; | |
17413 | ||
17414 | /* | |
17415 | * 6ch mode | |
17416 | */ | |
17417 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
17418 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17419 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17420 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
17421 | { } /* end */ | |
17422 | }; | |
17423 | ||
17424 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
17425 | { 2, alc662_sixstack_ch6_init }, | |
17426 | { 6, alc662_sixstack_ch8_init }, | |
17427 | }; | |
17428 | ||
17429 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
17430 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
17431 | */ | |
17432 | ||
17433 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
17434 | /* output mixer control */ | |
17435 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
7055ad8a | 17436 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 17437 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
7055ad8a | 17438 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17439 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17440 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
17441 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
17442 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
17443 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17444 | ||
17445 | /*Input mixer control */ | |
17446 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
17447 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
17448 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
17449 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
17450 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
17451 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
17452 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
17453 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
bc9f98a9 KY |
17454 | { } /* end */ |
17455 | }; | |
17456 | ||
17457 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
17458 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 17459 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17460 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17461 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17462 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17463 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17464 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17467 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17468 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17469 | { } /* end */ |
17470 | }; | |
17471 | ||
17472 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
17473 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 17474 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 17475 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
7055ad8a | 17476 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
17477 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17478 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
17479 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
17480 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
17481 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17482 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
17483 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
17484 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17485 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17486 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17487 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17488 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17489 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17490 | { } /* end */ |
17491 | }; | |
17492 | ||
17493 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
17494 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17495 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
86cd9298 TI |
17496 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
17497 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
bc9f98a9 KY |
17498 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17500 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
17503 | { } /* end */ |
17504 | }; | |
17505 | ||
291702f0 | 17506 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
42171c17 TI |
17507 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
17508 | ALC262_HIPPO_MASTER_SWITCH, | |
291702f0 KY |
17509 | |
17510 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | |
17511 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17512 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17513 | ||
17514 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
17515 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17516 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17517 | { } /* end */ | |
17518 | }; | |
17519 | ||
8c427226 | 17520 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
42171c17 TI |
17521 | ALC262_HIPPO_MASTER_SWITCH, |
17522 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
8c427226 | 17523 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
8c427226 KY |
17524 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
17525 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
8c427226 KY |
17526 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
17527 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17528 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17531 | { } /* end */ | |
17532 | }; | |
17533 | ||
f1d4e28b KY |
17534 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
17535 | .ops = &snd_hda_bind_vol, | |
17536 | .values = { | |
17537 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17538 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
17539 | 0 | |
17540 | }, | |
17541 | }; | |
17542 | ||
17543 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | |
17544 | .ops = &snd_hda_bind_sw, | |
17545 | .values = { | |
17546 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17547 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17548 | 0 | |
17549 | }, | |
17550 | }; | |
17551 | ||
6dda9f4a | 17552 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
f1d4e28b KY |
17553 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
17554 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | |
17555 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17557 | { } /* end */ | |
17558 | }; | |
17559 | ||
17560 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | |
17561 | .ops = &snd_hda_bind_sw, | |
17562 | .values = { | |
17563 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17564 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17565 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17566 | 0 | |
17567 | }, | |
17568 | }; | |
17569 | ||
17570 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | |
17571 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17572 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | |
17573 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17574 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17575 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17576 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17577 | ||
17578 | { } /* end */ | |
17579 | }; | |
17580 | ||
17581 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | |
17582 | .ops = &snd_hda_bind_sw, | |
17583 | .values = { | |
17584 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17585 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17586 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17587 | 0 | |
17588 | }, | |
17589 | }; | |
17590 | ||
17591 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | |
17592 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17593 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | |
17594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17595 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17596 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17597 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17598 | { } /* end */ | |
17599 | }; | |
17600 | ||
17601 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | |
6dda9f4a KY |
17602 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
17603 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
f1d4e28b KY |
17604 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
17605 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17606 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17607 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17608 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17609 | { } /* end */ | |
17610 | }; | |
17611 | ||
17612 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | |
17613 | .ops = &snd_hda_bind_vol, | |
17614 | .values = { | |
17615 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
17616 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | |
17617 | 0 | |
17618 | }, | |
17619 | }; | |
17620 | ||
17621 | static struct hda_bind_ctls alc663_asus_two_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(0x16, 3, 0, HDA_OUTPUT), | |
17626 | 0 | |
17627 | }, | |
17628 | }; | |
17629 | ||
17630 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | |
17631 | HDA_BIND_VOL("Master Playback Volume", | |
17632 | &alc663_asus_two_bind_master_vol), | |
17633 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17634 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
6dda9f4a KY |
17635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
17636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17637 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
f1d4e28b KY |
17638 | { } /* end */ |
17639 | }; | |
17640 | ||
17641 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | |
17642 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
17643 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
17644 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17645 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17646 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17647 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6dda9f4a KY |
17648 | { } /* end */ |
17649 | }; | |
17650 | ||
17651 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
17652 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17653 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17654 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
17655 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17656 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17657 | ||
17658 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17659 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17660 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17661 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17662 | { } /* end */ | |
17663 | }; | |
17664 | ||
17665 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
17666 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
17667 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
17668 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17669 | ||
17670 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17671 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17672 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17673 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17674 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
17675 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
17676 | { } /* end */ | |
17677 | }; | |
17678 | ||
ebb83eeb KY |
17679 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
17680 | .ops = &snd_hda_bind_sw, | |
17681 | .values = { | |
17682 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17683 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
17684 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17685 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
17686 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
17687 | 0 | |
17688 | }, | |
17689 | }; | |
17690 | ||
17691 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | |
17692 | .ops = &snd_hda_bind_sw, | |
17693 | .values = { | |
17694 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
17695 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | |
17696 | 0 | |
17697 | }, | |
17698 | }; | |
17699 | ||
17700 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | |
17701 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17702 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17703 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17704 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
17705 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17706 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17707 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
17709 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
17710 | { } /* end */ | |
17711 | }; | |
17712 | ||
17713 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | |
17714 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | |
17715 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | |
17716 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | |
17717 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
17718 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
17719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
17720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
17721 | { } /* end */ | |
17722 | }; | |
17723 | ||
17724 | ||
bc9f98a9 KY |
17725 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
17726 | { | |
17727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
17728 | .name = "Channel Mode", | |
17729 | .info = alc_ch_mode_info, | |
17730 | .get = alc_ch_mode_get, | |
17731 | .put = alc_ch_mode_put, | |
17732 | }, | |
17733 | { } /* end */ | |
17734 | }; | |
17735 | ||
17736 | static struct hda_verb alc662_init_verbs[] = { | |
17737 | /* ADC: mute amp left and right */ | |
17738 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17739 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
bc9f98a9 | 17740 | |
b60dd394 KY |
17741 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
17742 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17743 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17744 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17745 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17746 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
17747 | |
17748 | /* Front Pin: output 0 (0x0c) */ | |
17749 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17750 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17751 | ||
17752 | /* Rear Pin: output 1 (0x0d) */ | |
17753 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17754 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17755 | ||
17756 | /* CLFE Pin: output 2 (0x0e) */ | |
17757 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17758 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17759 | ||
17760 | /* Mic (rear) pin: input vref at 80% */ | |
17761 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17762 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17763 | /* Front Mic pin: input vref at 80% */ | |
17764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
17765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17766 | /* Line In pin: input */ | |
17767 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17768 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17769 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
17770 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17771 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17772 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
17773 | /* CD pin widget for input */ | |
17774 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17775 | ||
17776 | /* FIXME: use matrix-type input source selection */ | |
17777 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
17778 | /* Input mixer */ | |
17779 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
291702f0 | 17780 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
6dda9f4a KY |
17781 | |
17782 | /* always trun on EAPD */ | |
17783 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17784 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
17785 | ||
bc9f98a9 KY |
17786 | { } |
17787 | }; | |
17788 | ||
cec27c89 KY |
17789 | static struct hda_verb alc663_init_verbs[] = { |
17790 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17791 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17792 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17793 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17794 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17795 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17796 | { } | |
17797 | }; | |
17798 | ||
17799 | static struct hda_verb alc272_init_verbs[] = { | |
17800 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17801 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
17802 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17803 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17804 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17805 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17806 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
17807 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17808 | { } | |
17809 | }; | |
17810 | ||
bc9f98a9 KY |
17811 | static struct hda_verb alc662_sue_init_verbs[] = { |
17812 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17813 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
291702f0 KY |
17814 | {} |
17815 | }; | |
17816 | ||
17817 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
17818 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17819 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17820 | {} | |
bc9f98a9 KY |
17821 | }; |
17822 | ||
8c427226 KY |
17823 | /* Set Unsolicited Event*/ |
17824 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
17825 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17826 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17827 | {} | |
17828 | }; | |
17829 | ||
6dda9f4a | 17830 | static struct hda_verb alc663_m51va_init_verbs[] = { |
f1d4e28b KY |
17831 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
17832 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6dda9f4a KY |
17833 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
17834 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f1d4e28b KY |
17835 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
17836 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17837 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17838 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17839 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17840 | {} | |
17841 | }; | |
17842 | ||
17843 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | |
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, 0x01}, /* Headphone */ | |
17847 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17848 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
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 alc662_1bjd_amic_init_verbs[] = { | |
17855 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17856 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17857 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17858 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17859 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17860 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17861 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17862 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17863 | {} | |
17864 | }; | |
6dda9f4a | 17865 | |
f1d4e28b KY |
17866 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
17867 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17868 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17869 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17870 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17871 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17872 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17873 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17874 | {} | |
17875 | }; | |
6dda9f4a | 17876 | |
f1d4e28b KY |
17877 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
17878 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17879 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17880 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17881 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
17882 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17883 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17884 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
17885 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17886 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6dda9f4a KY |
17887 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
17888 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f1d4e28b KY |
17889 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
17890 | {} | |
17891 | }; | |
17892 | ||
17893 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | |
17894 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17895 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17896 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17897 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17898 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17899 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17900 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17901 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
17903 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17904 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17905 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6dda9f4a KY |
17906 | {} |
17907 | }; | |
17908 | ||
17909 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
17910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17911 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
17912 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
17913 | ||
17914 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17915 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17916 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17917 | ||
17918 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
17919 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
17920 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
17921 | {} | |
17922 | }; | |
17923 | ||
17924 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
17925 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17926 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17927 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
17928 | ||
17929 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17930 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17931 | {} | |
17932 | }; | |
17933 | ||
f1d4e28b KY |
17934 | static struct hda_verb alc662_ecs_init_verbs[] = { |
17935 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | |
17936 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17937 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17938 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17939 | {} | |
17940 | }; | |
17941 | ||
622e84cd KY |
17942 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
17943 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17944 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17945 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17946 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17947 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17948 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17949 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17950 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17951 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17952 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17953 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17954 | {} | |
17955 | }; | |
17956 | ||
17957 | static struct hda_verb alc272_dell_init_verbs[] = { | |
17958 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17959 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17960 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17961 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17962 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17963 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17964 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17965 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17966 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17967 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17968 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17969 | {} | |
17970 | }; | |
17971 | ||
ebb83eeb KY |
17972 | static struct hda_verb alc663_mode7_init_verbs[] = { |
17973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17974 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17975 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17976 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17977 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17978 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17979 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
17980 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17981 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17982 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
17983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
17984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
17985 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
17986 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17987 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
17988 | {} | |
17989 | }; | |
17990 | ||
17991 | static struct hda_verb alc663_mode8_init_verbs[] = { | |
17992 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
17994 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17995 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
17996 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
17997 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
17998 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
17999 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
18000 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
18001 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
18002 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
18003 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
18004 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
18005 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18006 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
18007 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
18008 | {} | |
18009 | }; | |
18010 | ||
f1d4e28b KY |
18011 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
18012 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
18013 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
18014 | { } /* end */ | |
18015 | }; | |
18016 | ||
622e84cd KY |
18017 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
18018 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
18019 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
18020 | { } /* end */ | |
18021 | }; | |
18022 | ||
bc9f98a9 KY |
18023 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
18024 | { | |
18025 | unsigned int present; | |
f12ab1e0 | 18026 | unsigned char bits; |
bc9f98a9 | 18027 | |
864f92be | 18028 | present = snd_hda_jack_detect(codec, 0x14); |
47fd830a | 18029 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 18030 | |
47fd830a TI |
18031 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
18032 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
18033 | } |
18034 | ||
18035 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
18036 | { | |
18037 | unsigned int present; | |
f12ab1e0 | 18038 | unsigned char bits; |
bc9f98a9 | 18039 | |
864f92be | 18040 | present = snd_hda_jack_detect(codec, 0x1b); |
47fd830a | 18041 | bits = present ? HDA_AMP_MUTE : 0; |
864f92be | 18042 | |
47fd830a TI |
18043 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
18044 | HDA_AMP_MUTE, bits); | |
18045 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18046 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
18047 | } |
18048 | ||
18049 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
18050 | unsigned int res) | |
18051 | { | |
18052 | if ((res >> 26) == ALC880_HP_EVENT) | |
18053 | alc662_lenovo_101e_all_automute(codec); | |
18054 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
18055 | alc662_lenovo_101e_ispeaker_automute(codec); | |
18056 | } | |
18057 | ||
291702f0 KY |
18058 | /* unsolicited event for HP jack sensing */ |
18059 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
18060 | unsigned int res) | |
18061 | { | |
291702f0 | 18062 | if ((res >> 26) == ALC880_MIC_EVENT) |
4f5d1706 | 18063 | alc_mic_automute(codec); |
42171c17 TI |
18064 | else |
18065 | alc262_hippo_unsol_event(codec, res); | |
291702f0 KY |
18066 | } |
18067 | ||
4f5d1706 TI |
18068 | static void alc662_eeepc_setup(struct hda_codec *codec) |
18069 | { | |
18070 | struct alc_spec *spec = codec->spec; | |
18071 | ||
18072 | alc262_hippo1_setup(codec); | |
18073 | spec->ext_mic.pin = 0x18; | |
18074 | spec->ext_mic.mux_idx = 0; | |
18075 | spec->int_mic.pin = 0x19; | |
18076 | spec->int_mic.mux_idx = 1; | |
18077 | spec->auto_mic = 1; | |
18078 | } | |
18079 | ||
291702f0 KY |
18080 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
18081 | { | |
4f5d1706 TI |
18082 | alc262_hippo_automute(codec); |
18083 | alc_mic_automute(codec); | |
291702f0 KY |
18084 | } |
18085 | ||
4f5d1706 | 18086 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
8c427226 | 18087 | { |
42171c17 TI |
18088 | struct alc_spec *spec = codec->spec; |
18089 | ||
18090 | spec->autocfg.hp_pins[0] = 0x14; | |
18091 | spec->autocfg.speaker_pins[0] = 0x1b; | |
8c427226 KY |
18092 | } |
18093 | ||
4f5d1706 TI |
18094 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
18095 | ||
6dda9f4a KY |
18096 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
18097 | { | |
18098 | unsigned int present; | |
18099 | unsigned char bits; | |
18100 | ||
864f92be | 18101 | present = snd_hda_jack_detect(codec, 0x21); |
6dda9f4a | 18102 | bits = present ? HDA_AMP_MUTE : 0; |
f1d4e28b | 18103 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
5dbd5ec6 | 18104 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18105 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18106 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
18107 | } |
18108 | ||
18109 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |
18110 | { | |
18111 | unsigned int present; | |
18112 | unsigned char bits; | |
18113 | ||
864f92be | 18114 | present = snd_hda_jack_detect(codec, 0x21); |
f1d4e28b KY |
18115 | bits = present ? HDA_AMP_MUTE : 0; |
18116 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 18117 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18118 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18119 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18120 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
5dbd5ec6 | 18121 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18122 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
5dbd5ec6 | 18123 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
18124 | } |
18125 | ||
18126 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |
18127 | { | |
18128 | unsigned int present; | |
18129 | unsigned char bits; | |
18130 | ||
864f92be | 18131 | present = snd_hda_jack_detect(codec, 0x15); |
f1d4e28b KY |
18132 | bits = present ? HDA_AMP_MUTE : 0; |
18133 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 18134 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18135 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18136 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18137 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
5dbd5ec6 | 18138 | HDA_AMP_MUTE, bits); |
f1d4e28b | 18139 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
5dbd5ec6 | 18140 | HDA_AMP_MUTE, bits); |
f1d4e28b KY |
18141 | } |
18142 | ||
18143 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | |
18144 | { | |
18145 | unsigned int present; | |
18146 | unsigned char bits; | |
18147 | ||
864f92be | 18148 | present = snd_hda_jack_detect(codec, 0x1b); |
f1d4e28b KY |
18149 | bits = present ? 0 : PIN_OUT; |
18150 | snd_hda_codec_write(codec, 0x14, 0, | |
18151 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
18152 | } | |
18153 | ||
18154 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | |
18155 | { | |
18156 | unsigned int present1, present2; | |
18157 | ||
864f92be WF |
18158 | present1 = snd_hda_jack_detect(codec, 0x21); |
18159 | present2 = snd_hda_jack_detect(codec, 0x15); | |
f1d4e28b KY |
18160 | |
18161 | if (present1 || present2) { | |
18162 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18163 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18164 | } else { | |
18165 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18166 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18167 | } | |
18168 | } | |
18169 | ||
18170 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |
18171 | { | |
18172 | unsigned int present1, present2; | |
18173 | ||
864f92be WF |
18174 | present1 = snd_hda_jack_detect(codec, 0x1b); |
18175 | present2 = snd_hda_jack_detect(codec, 0x15); | |
f1d4e28b KY |
18176 | |
18177 | if (present1 || present2) { | |
18178 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 18179 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
f1d4e28b | 18180 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18181 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
f1d4e28b KY |
18182 | } else { |
18183 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
5dbd5ec6 | 18184 | HDA_AMP_MUTE, 0); |
f1d4e28b | 18185 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
5dbd5ec6 | 18186 | HDA_AMP_MUTE, 0); |
f1d4e28b | 18187 | } |
6dda9f4a KY |
18188 | } |
18189 | ||
ebb83eeb KY |
18190 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
18191 | { | |
18192 | unsigned int present1, present2; | |
18193 | ||
18194 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | |
18195 | AC_VERB_GET_PIN_SENSE, 0) | |
18196 | & AC_PINSENSE_PRESENCE; | |
18197 | present2 = snd_hda_codec_read(codec, 0x21, 0, | |
18198 | AC_VERB_GET_PIN_SENSE, 0) | |
18199 | & AC_PINSENSE_PRESENCE; | |
18200 | ||
18201 | if (present1 || present2) { | |
18202 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18203 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18204 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18205 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18206 | } else { | |
18207 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18208 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18209 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18210 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18211 | } | |
18212 | } | |
18213 | ||
18214 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | |
18215 | { | |
18216 | unsigned int present1, present2; | |
18217 | ||
18218 | present1 = snd_hda_codec_read(codec, 0x21, 0, | |
18219 | AC_VERB_GET_PIN_SENSE, 0) | |
18220 | & AC_PINSENSE_PRESENCE; | |
18221 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
18222 | AC_VERB_GET_PIN_SENSE, 0) | |
18223 | & AC_PINSENSE_PRESENCE; | |
18224 | ||
18225 | if (present1 || present2) { | |
18226 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18227 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18228 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18229 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
18230 | } else { | |
18231 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
18232 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18233 | snd_hda_codec_write_cache(codec, 0x17, 0, | |
18234 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
18235 | } | |
18236 | } | |
18237 | ||
6dda9f4a KY |
18238 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
18239 | unsigned int res) | |
18240 | { | |
18241 | switch (res >> 26) { | |
18242 | case ALC880_HP_EVENT: | |
18243 | alc663_m51va_speaker_automute(codec); | |
18244 | break; | |
18245 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18246 | alc_mic_automute(codec); |
6dda9f4a KY |
18247 | break; |
18248 | } | |
18249 | } | |
18250 | ||
4f5d1706 TI |
18251 | static void alc663_m51va_setup(struct hda_codec *codec) |
18252 | { | |
18253 | struct alc_spec *spec = codec->spec; | |
18254 | spec->ext_mic.pin = 0x18; | |
18255 | spec->ext_mic.mux_idx = 0; | |
18256 | spec->int_mic.pin = 0x12; | |
ebb83eeb | 18257 | spec->int_mic.mux_idx = 9; |
4f5d1706 TI |
18258 | spec->auto_mic = 1; |
18259 | } | |
18260 | ||
6dda9f4a KY |
18261 | static void alc663_m51va_inithook(struct hda_codec *codec) |
18262 | { | |
18263 | alc663_m51va_speaker_automute(codec); | |
4f5d1706 | 18264 | alc_mic_automute(codec); |
6dda9f4a KY |
18265 | } |
18266 | ||
f1d4e28b | 18267 | /* ***************** Mode1 ******************************/ |
4f5d1706 | 18268 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
ebb83eeb KY |
18269 | |
18270 | static void alc663_mode1_setup(struct hda_codec *codec) | |
18271 | { | |
18272 | struct alc_spec *spec = codec->spec; | |
18273 | spec->ext_mic.pin = 0x18; | |
18274 | spec->ext_mic.mux_idx = 0; | |
18275 | spec->int_mic.pin = 0x19; | |
18276 | spec->int_mic.mux_idx = 1; | |
18277 | spec->auto_mic = 1; | |
18278 | } | |
18279 | ||
4f5d1706 | 18280 | #define alc663_mode1_inithook alc663_m51va_inithook |
f1d4e28b | 18281 | |
f1d4e28b KY |
18282 | /* ***************** Mode2 ******************************/ |
18283 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | |
18284 | unsigned int res) | |
18285 | { | |
18286 | switch (res >> 26) { | |
18287 | case ALC880_HP_EVENT: | |
18288 | alc662_f5z_speaker_automute(codec); | |
18289 | break; | |
18290 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18291 | alc_mic_automute(codec); |
f1d4e28b KY |
18292 | break; |
18293 | } | |
18294 | } | |
18295 | ||
ebb83eeb | 18296 | #define alc662_mode2_setup alc663_mode1_setup |
4f5d1706 | 18297 | |
f1d4e28b KY |
18298 | static void alc662_mode2_inithook(struct hda_codec *codec) |
18299 | { | |
18300 | alc662_f5z_speaker_automute(codec); | |
4f5d1706 | 18301 | alc_mic_automute(codec); |
f1d4e28b KY |
18302 | } |
18303 | /* ***************** Mode3 ******************************/ | |
18304 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | |
18305 | unsigned int res) | |
18306 | { | |
18307 | switch (res >> 26) { | |
18308 | case ALC880_HP_EVENT: | |
18309 | alc663_two_hp_m1_speaker_automute(codec); | |
18310 | break; | |
18311 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18312 | alc_mic_automute(codec); |
f1d4e28b KY |
18313 | break; |
18314 | } | |
18315 | } | |
18316 | ||
ebb83eeb | 18317 | #define alc663_mode3_setup alc663_mode1_setup |
4f5d1706 | 18318 | |
f1d4e28b KY |
18319 | static void alc663_mode3_inithook(struct hda_codec *codec) |
18320 | { | |
18321 | alc663_two_hp_m1_speaker_automute(codec); | |
4f5d1706 | 18322 | alc_mic_automute(codec); |
f1d4e28b KY |
18323 | } |
18324 | /* ***************** Mode4 ******************************/ | |
18325 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | |
18326 | unsigned int res) | |
18327 | { | |
18328 | switch (res >> 26) { | |
18329 | case ALC880_HP_EVENT: | |
18330 | alc663_21jd_two_speaker_automute(codec); | |
18331 | break; | |
18332 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18333 | alc_mic_automute(codec); |
f1d4e28b KY |
18334 | break; |
18335 | } | |
18336 | } | |
18337 | ||
ebb83eeb | 18338 | #define alc663_mode4_setup alc663_mode1_setup |
4f5d1706 | 18339 | |
f1d4e28b KY |
18340 | static void alc663_mode4_inithook(struct hda_codec *codec) |
18341 | { | |
18342 | alc663_21jd_two_speaker_automute(codec); | |
4f5d1706 | 18343 | alc_mic_automute(codec); |
f1d4e28b KY |
18344 | } |
18345 | /* ***************** Mode5 ******************************/ | |
18346 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | |
18347 | unsigned int res) | |
18348 | { | |
18349 | switch (res >> 26) { | |
18350 | case ALC880_HP_EVENT: | |
18351 | alc663_15jd_two_speaker_automute(codec); | |
18352 | break; | |
18353 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18354 | alc_mic_automute(codec); |
f1d4e28b KY |
18355 | break; |
18356 | } | |
18357 | } | |
18358 | ||
ebb83eeb | 18359 | #define alc663_mode5_setup alc663_mode1_setup |
4f5d1706 | 18360 | |
f1d4e28b KY |
18361 | static void alc663_mode5_inithook(struct hda_codec *codec) |
18362 | { | |
18363 | alc663_15jd_two_speaker_automute(codec); | |
4f5d1706 | 18364 | alc_mic_automute(codec); |
f1d4e28b KY |
18365 | } |
18366 | /* ***************** Mode6 ******************************/ | |
18367 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | |
18368 | unsigned int res) | |
18369 | { | |
18370 | switch (res >> 26) { | |
18371 | case ALC880_HP_EVENT: | |
18372 | alc663_two_hp_m2_speaker_automute(codec); | |
18373 | break; | |
18374 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18375 | alc_mic_automute(codec); |
f1d4e28b KY |
18376 | break; |
18377 | } | |
18378 | } | |
18379 | ||
ebb83eeb | 18380 | #define alc663_mode6_setup alc663_mode1_setup |
4f5d1706 | 18381 | |
f1d4e28b KY |
18382 | static void alc663_mode6_inithook(struct hda_codec *codec) |
18383 | { | |
18384 | alc663_two_hp_m2_speaker_automute(codec); | |
4f5d1706 | 18385 | alc_mic_automute(codec); |
f1d4e28b KY |
18386 | } |
18387 | ||
ebb83eeb KY |
18388 | /* ***************** Mode7 ******************************/ |
18389 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | |
18390 | unsigned int res) | |
18391 | { | |
18392 | switch (res >> 26) { | |
18393 | case ALC880_HP_EVENT: | |
18394 | alc663_two_hp_m7_speaker_automute(codec); | |
18395 | break; | |
18396 | case ALC880_MIC_EVENT: | |
18397 | alc_mic_automute(codec); | |
18398 | break; | |
18399 | } | |
18400 | } | |
18401 | ||
18402 | #define alc663_mode7_setup alc663_mode1_setup | |
18403 | ||
18404 | static void alc663_mode7_inithook(struct hda_codec *codec) | |
18405 | { | |
18406 | alc663_two_hp_m7_speaker_automute(codec); | |
18407 | alc_mic_automute(codec); | |
18408 | } | |
18409 | ||
18410 | /* ***************** Mode8 ******************************/ | |
18411 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | |
18412 | unsigned int res) | |
18413 | { | |
18414 | switch (res >> 26) { | |
18415 | case ALC880_HP_EVENT: | |
18416 | alc663_two_hp_m8_speaker_automute(codec); | |
18417 | break; | |
18418 | case ALC880_MIC_EVENT: | |
18419 | alc_mic_automute(codec); | |
18420 | break; | |
18421 | } | |
18422 | } | |
18423 | ||
18424 | #define alc663_mode8_setup alc663_m51va_setup | |
18425 | ||
18426 | static void alc663_mode8_inithook(struct hda_codec *codec) | |
18427 | { | |
18428 | alc663_two_hp_m8_speaker_automute(codec); | |
18429 | alc_mic_automute(codec); | |
18430 | } | |
18431 | ||
6dda9f4a KY |
18432 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
18433 | { | |
18434 | unsigned int present; | |
18435 | unsigned char bits; | |
18436 | ||
864f92be | 18437 | present = snd_hda_jack_detect(codec, 0x21); |
6dda9f4a KY |
18438 | bits = present ? HDA_AMP_MUTE : 0; |
18439 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
18440 | HDA_AMP_MUTE, bits); | |
18441 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18442 | HDA_AMP_MUTE, bits); | |
18443 | } | |
18444 | ||
18445 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
18446 | { | |
18447 | unsigned int present; | |
18448 | unsigned char bits; | |
18449 | ||
864f92be | 18450 | present = snd_hda_jack_detect(codec, 0x15); |
6dda9f4a KY |
18451 | bits = present ? HDA_AMP_MUTE : 0; |
18452 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
18453 | HDA_AMP_MUTE, bits); | |
18454 | } | |
18455 | ||
18456 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
18457 | unsigned int res) | |
18458 | { | |
18459 | switch (res >> 26) { | |
18460 | case ALC880_HP_EVENT: | |
18461 | alc663_g71v_hp_automute(codec); | |
18462 | break; | |
18463 | case ALC880_FRONT_EVENT: | |
18464 | alc663_g71v_front_automute(codec); | |
18465 | break; | |
18466 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18467 | alc_mic_automute(codec); |
6dda9f4a KY |
18468 | break; |
18469 | } | |
18470 | } | |
18471 | ||
4f5d1706 TI |
18472 | #define alc663_g71v_setup alc663_m51va_setup |
18473 | ||
6dda9f4a KY |
18474 | static void alc663_g71v_inithook(struct hda_codec *codec) |
18475 | { | |
18476 | alc663_g71v_front_automute(codec); | |
18477 | alc663_g71v_hp_automute(codec); | |
4f5d1706 | 18478 | alc_mic_automute(codec); |
6dda9f4a KY |
18479 | } |
18480 | ||
18481 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
18482 | unsigned int res) | |
18483 | { | |
18484 | switch (res >> 26) { | |
18485 | case ALC880_HP_EVENT: | |
18486 | alc663_m51va_speaker_automute(codec); | |
18487 | break; | |
18488 | case ALC880_MIC_EVENT: | |
4f5d1706 | 18489 | alc_mic_automute(codec); |
6dda9f4a KY |
18490 | break; |
18491 | } | |
18492 | } | |
18493 | ||
4f5d1706 TI |
18494 | #define alc663_g50v_setup alc663_m51va_setup |
18495 | ||
6dda9f4a KY |
18496 | static void alc663_g50v_inithook(struct hda_codec *codec) |
18497 | { | |
18498 | alc663_m51va_speaker_automute(codec); | |
4f5d1706 | 18499 | alc_mic_automute(codec); |
6dda9f4a KY |
18500 | } |
18501 | ||
f1d4e28b KY |
18502 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
18503 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
42171c17 | 18504 | ALC262_HIPPO_MASTER_SWITCH, |
f1d4e28b KY |
18505 | |
18506 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | |
18507 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18508 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18509 | ||
18510 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
18511 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18512 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18513 | { } /* end */ | |
18514 | }; | |
18515 | ||
9541ba1d CP |
18516 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
18517 | /* Master Playback automatically created from Speaker and Headphone */ | |
18518 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
18519 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
18520 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
18521 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
18522 | ||
18523 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
18524 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
18525 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
18526 | ||
18527 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
18528 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
18529 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
18530 | { } /* end */ | |
18531 | }; | |
18532 | ||
cb53c626 TI |
18533 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
18534 | #define alc662_loopbacks alc880_loopbacks | |
18535 | #endif | |
18536 | ||
bc9f98a9 | 18537 | |
def319f9 | 18538 | /* pcm configuration: identical with ALC880 */ |
bc9f98a9 KY |
18539 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
18540 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
18541 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
18542 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
18543 | ||
18544 | /* | |
18545 | * configuration and preset | |
18546 | */ | |
18547 | static const char *alc662_models[ALC662_MODEL_LAST] = { | |
18548 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
18549 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
18550 | [ALC662_3ST_6ch] = "3stack-6ch", | |
18551 | [ALC662_5ST_DIG] = "6stack-dig", | |
18552 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
b995d76d | 18553 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
8c427226 | 18554 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
f1d4e28b | 18555 | [ALC662_ECS] = "ecs", |
6dda9f4a KY |
18556 | [ALC663_ASUS_M51VA] = "m51va", |
18557 | [ALC663_ASUS_G71V] = "g71v", | |
18558 | [ALC663_ASUS_H13] = "h13", | |
18559 | [ALC663_ASUS_G50V] = "g50v", | |
f1d4e28b KY |
18560 | [ALC663_ASUS_MODE1] = "asus-mode1", |
18561 | [ALC662_ASUS_MODE2] = "asus-mode2", | |
18562 | [ALC663_ASUS_MODE3] = "asus-mode3", | |
18563 | [ALC663_ASUS_MODE4] = "asus-mode4", | |
18564 | [ALC663_ASUS_MODE5] = "asus-mode5", | |
18565 | [ALC663_ASUS_MODE6] = "asus-mode6", | |
ebb83eeb KY |
18566 | [ALC663_ASUS_MODE7] = "asus-mode7", |
18567 | [ALC663_ASUS_MODE8] = "asus-mode8", | |
01f2bd48 TI |
18568 | [ALC272_DELL] = "dell", |
18569 | [ALC272_DELL_ZM1] = "dell-zm1", | |
9541ba1d | 18570 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
bc9f98a9 KY |
18571 | [ALC662_AUTO] = "auto", |
18572 | }; | |
18573 | ||
18574 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
dea0a509 | 18575 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
622e84cd KY |
18576 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
18577 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), | |
f1d4e28b | 18578 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
dea0a509 | 18579 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
cec27c89 | 18580 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
dea0a509 | 18581 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
f1d4e28b | 18582 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
dea0a509 | 18583 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
f1d4e28b | 18584 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
ebb83eeb KY |
18585 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
18586 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | |
f1d4e28b | 18587 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
ebb83eeb KY |
18588 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
18589 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | |
18590 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | |
18591 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | |
18592 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | |
dea0a509 | 18593 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
ebb83eeb KY |
18594 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
18595 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | |
dea0a509 TI |
18596 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
18597 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | |
18598 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | |
18599 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | |
ebb83eeb | 18600 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
622e84cd KY |
18601 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
18602 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | |
18603 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | |
f1d4e28b | 18604 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
dea0a509 TI |
18605 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
18606 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | |
18607 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | |
622e84cd | 18608 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
f1d4e28b | 18609 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
dea0a509 TI |
18610 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
18611 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | |
18612 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ | |
f1d4e28b | 18613 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
f1d4e28b | 18614 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
622e84cd | 18615 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
cec27c89 | 18616 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
622e84cd KY |
18617 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
18618 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), | |
dea0a509 TI |
18619 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
18620 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | |
18621 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | |
622e84cd | 18622 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
dea0a509 TI |
18623 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
18624 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | |
622e84cd | 18625 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
dea0a509 TI |
18626 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
18627 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | |
18628 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | |
18629 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | |
18630 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | |
622e84cd | 18631 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
dea0a509 | 18632 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
f1d4e28b | 18633 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
dea0a509 TI |
18634 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
18635 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | |
18636 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | |
18637 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | |
95fe5f2c HRK |
18638 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
18639 | ALC662_3ST_6ch_DIG), | |
4dee8baa | 18640 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
9541ba1d | 18641 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
cb55974c HRK |
18642 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
18643 | ALC662_3ST_6ch_DIG), | |
6227cdce | 18644 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
19c009aa | 18645 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
5bd3729f | 18646 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
dea0a509 | 18647 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
238713d4 | 18648 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
19c009aa | 18649 | ALC662_3ST_6ch_DIG), |
dea0a509 TI |
18650 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
18651 | ALC663_ASUS_H13), | |
bc9f98a9 KY |
18652 | {} |
18653 | }; | |
18654 | ||
18655 | static struct alc_config_preset alc662_presets[] = { | |
18656 | [ALC662_3ST_2ch_DIG] = { | |
f9e336f6 | 18657 | .mixers = { alc662_3ST_2ch_mixer }, |
bc9f98a9 KY |
18658 | .init_verbs = { alc662_init_verbs }, |
18659 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18660 | .dac_nids = alc662_dac_nids, | |
18661 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18662 | .dig_in_nid = ALC662_DIGIN_NID, |
18663 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18664 | .channel_mode = alc662_3ST_2ch_modes, | |
18665 | .input_mux = &alc662_capture_source, | |
18666 | }, | |
18667 | [ALC662_3ST_6ch_DIG] = { | |
f9e336f6 | 18668 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18669 | .init_verbs = { alc662_init_verbs }, |
18670 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18671 | .dac_nids = alc662_dac_nids, | |
18672 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18673 | .dig_in_nid = ALC662_DIGIN_NID, |
18674 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18675 | .channel_mode = alc662_3ST_6ch_modes, | |
18676 | .need_dac_fix = 1, | |
18677 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 18678 | }, |
bc9f98a9 | 18679 | [ALC662_3ST_6ch] = { |
f9e336f6 | 18680 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18681 | .init_verbs = { alc662_init_verbs }, |
18682 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18683 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
18684 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
18685 | .channel_mode = alc662_3ST_6ch_modes, | |
18686 | .need_dac_fix = 1, | |
18687 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 18688 | }, |
bc9f98a9 | 18689 | [ALC662_5ST_DIG] = { |
f9e336f6 | 18690 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
18691 | .init_verbs = { alc662_init_verbs }, |
18692 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18693 | .dac_nids = alc662_dac_nids, | |
18694 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
18695 | .dig_in_nid = ALC662_DIGIN_NID, |
18696 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
18697 | .channel_mode = alc662_5stack_modes, | |
18698 | .input_mux = &alc662_capture_source, | |
18699 | }, | |
18700 | [ALC662_LENOVO_101E] = { | |
f9e336f6 | 18701 | .mixers = { alc662_lenovo_101e_mixer }, |
bc9f98a9 KY |
18702 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
18703 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18704 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
18705 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
18706 | .channel_mode = alc662_3ST_2ch_modes, | |
18707 | .input_mux = &alc662_lenovo_101e_capture_source, | |
18708 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
18709 | .init_hook = alc662_lenovo_101e_all_automute, | |
18710 | }, | |
291702f0 | 18711 | [ALC662_ASUS_EEEPC_P701] = { |
f9e336f6 | 18712 | .mixers = { alc662_eeepc_p701_mixer }, |
291702f0 KY |
18713 | .init_verbs = { alc662_init_verbs, |
18714 | alc662_eeepc_sue_init_verbs }, | |
18715 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18716 | .dac_nids = alc662_dac_nids, | |
291702f0 KY |
18717 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
18718 | .channel_mode = alc662_3ST_2ch_modes, | |
291702f0 | 18719 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18720 | .setup = alc662_eeepc_setup, |
291702f0 KY |
18721 | .init_hook = alc662_eeepc_inithook, |
18722 | }, | |
8c427226 | 18723 | [ALC662_ASUS_EEEPC_EP20] = { |
f9e336f6 | 18724 | .mixers = { alc662_eeepc_ep20_mixer, |
8c427226 KY |
18725 | alc662_chmode_mixer }, |
18726 | .init_verbs = { alc662_init_verbs, | |
18727 | alc662_eeepc_ep20_sue_init_verbs }, | |
18728 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18729 | .dac_nids = alc662_dac_nids, | |
8c427226 KY |
18730 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
18731 | .channel_mode = alc662_3ST_6ch_modes, | |
18732 | .input_mux = &alc662_lenovo_101e_capture_source, | |
42171c17 | 18733 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18734 | .setup = alc662_eeepc_ep20_setup, |
8c427226 KY |
18735 | .init_hook = alc662_eeepc_ep20_inithook, |
18736 | }, | |
f1d4e28b | 18737 | [ALC662_ECS] = { |
f9e336f6 | 18738 | .mixers = { alc662_ecs_mixer }, |
f1d4e28b KY |
18739 | .init_verbs = { alc662_init_verbs, |
18740 | alc662_ecs_init_verbs }, | |
18741 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18742 | .dac_nids = alc662_dac_nids, | |
18743 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18744 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18745 | .unsol_event = alc662_eeepc_unsol_event, |
4f5d1706 | 18746 | .setup = alc662_eeepc_setup, |
f1d4e28b KY |
18747 | .init_hook = alc662_eeepc_inithook, |
18748 | }, | |
6dda9f4a | 18749 | [ALC663_ASUS_M51VA] = { |
f9e336f6 | 18750 | .mixers = { alc663_m51va_mixer }, |
6dda9f4a KY |
18751 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
18752 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18753 | .dac_nids = alc662_dac_nids, | |
18754 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18755 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18756 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a | 18757 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18758 | .setup = alc663_m51va_setup, |
6dda9f4a KY |
18759 | .init_hook = alc663_m51va_inithook, |
18760 | }, | |
18761 | [ALC663_ASUS_G71V] = { | |
f9e336f6 | 18762 | .mixers = { alc663_g71v_mixer }, |
6dda9f4a KY |
18763 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
18764 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18765 | .dac_nids = alc662_dac_nids, | |
18766 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18767 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18768 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a | 18769 | .unsol_event = alc663_g71v_unsol_event, |
4f5d1706 | 18770 | .setup = alc663_g71v_setup, |
6dda9f4a KY |
18771 | .init_hook = alc663_g71v_inithook, |
18772 | }, | |
18773 | [ALC663_ASUS_H13] = { | |
f9e336f6 | 18774 | .mixers = { alc663_m51va_mixer }, |
6dda9f4a KY |
18775 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
18776 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18777 | .dac_nids = alc662_dac_nids, | |
18778 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18779 | .channel_mode = alc662_3ST_2ch_modes, | |
6dda9f4a KY |
18780 | .unsol_event = alc663_m51va_unsol_event, |
18781 | .init_hook = alc663_m51va_inithook, | |
18782 | }, | |
18783 | [ALC663_ASUS_G50V] = { | |
f9e336f6 | 18784 | .mixers = { alc663_g50v_mixer }, |
6dda9f4a KY |
18785 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
18786 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18787 | .dac_nids = alc662_dac_nids, | |
18788 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18789 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
18790 | .channel_mode = alc662_3ST_6ch_modes, | |
18791 | .input_mux = &alc663_capture_source, | |
18792 | .unsol_event = alc663_g50v_unsol_event, | |
4f5d1706 | 18793 | .setup = alc663_g50v_setup, |
6dda9f4a KY |
18794 | .init_hook = alc663_g50v_inithook, |
18795 | }, | |
f1d4e28b | 18796 | [ALC663_ASUS_MODE1] = { |
f9e336f6 TI |
18797 | .mixers = { alc663_m51va_mixer }, |
18798 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18799 | .init_verbs = { alc662_init_verbs, |
18800 | alc663_21jd_amic_init_verbs }, | |
18801 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18802 | .hp_nid = 0x03, | |
18803 | .dac_nids = alc662_dac_nids, | |
18804 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18805 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18806 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18807 | .unsol_event = alc663_mode1_unsol_event, |
4f5d1706 | 18808 | .setup = alc663_mode1_setup, |
f1d4e28b KY |
18809 | .init_hook = alc663_mode1_inithook, |
18810 | }, | |
18811 | [ALC662_ASUS_MODE2] = { | |
f9e336f6 TI |
18812 | .mixers = { alc662_1bjd_mixer }, |
18813 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18814 | .init_verbs = { alc662_init_verbs, |
18815 | alc662_1bjd_amic_init_verbs }, | |
18816 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18817 | .dac_nids = alc662_dac_nids, | |
18818 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18819 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18820 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18821 | .unsol_event = alc662_mode2_unsol_event, |
4f5d1706 | 18822 | .setup = alc662_mode2_setup, |
f1d4e28b KY |
18823 | .init_hook = alc662_mode2_inithook, |
18824 | }, | |
18825 | [ALC663_ASUS_MODE3] = { | |
f9e336f6 TI |
18826 | .mixers = { alc663_two_hp_m1_mixer }, |
18827 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18828 | .init_verbs = { alc662_init_verbs, |
18829 | alc663_two_hp_amic_m1_init_verbs }, | |
18830 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18831 | .hp_nid = 0x03, | |
18832 | .dac_nids = alc662_dac_nids, | |
18833 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18834 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18835 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18836 | .unsol_event = alc663_mode3_unsol_event, |
4f5d1706 | 18837 | .setup = alc663_mode3_setup, |
f1d4e28b KY |
18838 | .init_hook = alc663_mode3_inithook, |
18839 | }, | |
18840 | [ALC663_ASUS_MODE4] = { | |
f9e336f6 TI |
18841 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
18842 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18843 | .init_verbs = { alc662_init_verbs, |
18844 | alc663_21jd_amic_init_verbs}, | |
18845 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18846 | .hp_nid = 0x03, | |
18847 | .dac_nids = alc662_dac_nids, | |
18848 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18849 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18850 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18851 | .unsol_event = alc663_mode4_unsol_event, |
4f5d1706 | 18852 | .setup = alc663_mode4_setup, |
f1d4e28b KY |
18853 | .init_hook = alc663_mode4_inithook, |
18854 | }, | |
18855 | [ALC663_ASUS_MODE5] = { | |
f9e336f6 TI |
18856 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
18857 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18858 | .init_verbs = { alc662_init_verbs, |
18859 | alc663_15jd_amic_init_verbs }, | |
18860 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18861 | .hp_nid = 0x03, | |
18862 | .dac_nids = alc662_dac_nids, | |
18863 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18864 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18865 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18866 | .unsol_event = alc663_mode5_unsol_event, |
4f5d1706 | 18867 | .setup = alc663_mode5_setup, |
f1d4e28b KY |
18868 | .init_hook = alc663_mode5_inithook, |
18869 | }, | |
18870 | [ALC663_ASUS_MODE6] = { | |
f9e336f6 TI |
18871 | .mixers = { alc663_two_hp_m2_mixer }, |
18872 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
18873 | .init_verbs = { alc662_init_verbs, |
18874 | alc663_two_hp_amic_m2_init_verbs }, | |
18875 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18876 | .hp_nid = 0x03, | |
18877 | .dac_nids = alc662_dac_nids, | |
18878 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18879 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18880 | .channel_mode = alc662_3ST_2ch_modes, | |
f1d4e28b | 18881 | .unsol_event = alc663_mode6_unsol_event, |
4f5d1706 | 18882 | .setup = alc663_mode6_setup, |
f1d4e28b KY |
18883 | .init_hook = alc663_mode6_inithook, |
18884 | }, | |
ebb83eeb KY |
18885 | [ALC663_ASUS_MODE7] = { |
18886 | .mixers = { alc663_mode7_mixer }, | |
18887 | .cap_mixer = alc662_auto_capture_mixer, | |
18888 | .init_verbs = { alc662_init_verbs, | |
18889 | alc663_mode7_init_verbs }, | |
18890 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18891 | .hp_nid = 0x03, | |
18892 | .dac_nids = alc662_dac_nids, | |
18893 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18894 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18895 | .channel_mode = alc662_3ST_2ch_modes, | |
18896 | .unsol_event = alc663_mode7_unsol_event, | |
18897 | .setup = alc663_mode7_setup, | |
18898 | .init_hook = alc663_mode7_inithook, | |
18899 | }, | |
18900 | [ALC663_ASUS_MODE8] = { | |
18901 | .mixers = { alc663_mode8_mixer }, | |
18902 | .cap_mixer = alc662_auto_capture_mixer, | |
18903 | .init_verbs = { alc662_init_verbs, | |
18904 | alc663_mode8_init_verbs }, | |
18905 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
18906 | .hp_nid = 0x03, | |
18907 | .dac_nids = alc662_dac_nids, | |
18908 | .dig_out_nid = ALC662_DIGOUT_NID, | |
18909 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18910 | .channel_mode = alc662_3ST_2ch_modes, | |
18911 | .unsol_event = alc663_mode8_unsol_event, | |
18912 | .setup = alc663_mode8_setup, | |
18913 | .init_hook = alc663_mode8_inithook, | |
18914 | }, | |
622e84cd KY |
18915 | [ALC272_DELL] = { |
18916 | .mixers = { alc663_m51va_mixer }, | |
18917 | .cap_mixer = alc272_auto_capture_mixer, | |
18918 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, | |
18919 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18920 | .dac_nids = alc662_dac_nids, | |
18921 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18922 | .adc_nids = alc272_adc_nids, | |
18923 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | |
18924 | .capsrc_nids = alc272_capsrc_nids, | |
18925 | .channel_mode = alc662_3ST_2ch_modes, | |
622e84cd | 18926 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18927 | .setup = alc663_m51va_setup, |
622e84cd KY |
18928 | .init_hook = alc663_m51va_inithook, |
18929 | }, | |
18930 | [ALC272_DELL_ZM1] = { | |
18931 | .mixers = { alc663_m51va_mixer }, | |
18932 | .cap_mixer = alc662_auto_capture_mixer, | |
18933 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, | |
18934 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18935 | .dac_nids = alc662_dac_nids, | |
18936 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18937 | .adc_nids = alc662_adc_nids, | |
b59bdf3b | 18938 | .num_adc_nids = 1, |
622e84cd KY |
18939 | .capsrc_nids = alc662_capsrc_nids, |
18940 | .channel_mode = alc662_3ST_2ch_modes, | |
622e84cd | 18941 | .unsol_event = alc663_m51va_unsol_event, |
4f5d1706 | 18942 | .setup = alc663_m51va_setup, |
622e84cd KY |
18943 | .init_hook = alc663_m51va_inithook, |
18944 | }, | |
9541ba1d CP |
18945 | [ALC272_SAMSUNG_NC10] = { |
18946 | .mixers = { alc272_nc10_mixer }, | |
18947 | .init_verbs = { alc662_init_verbs, | |
18948 | alc663_21jd_amic_init_verbs }, | |
18949 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | |
18950 | .dac_nids = alc272_dac_nids, | |
18951 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
18952 | .channel_mode = alc662_3ST_2ch_modes, | |
4f5d1706 | 18953 | /*.input_mux = &alc272_nc10_capture_source,*/ |
9541ba1d | 18954 | .unsol_event = alc663_mode4_unsol_event, |
4f5d1706 | 18955 | .setup = alc663_mode4_setup, |
9541ba1d CP |
18956 | .init_hook = alc663_mode4_inithook, |
18957 | }, | |
bc9f98a9 KY |
18958 | }; |
18959 | ||
18960 | ||
18961 | /* | |
18962 | * BIOS auto configuration | |
18963 | */ | |
18964 | ||
7085ec12 TI |
18965 | /* convert from MIX nid to DAC */ |
18966 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | |
18967 | { | |
18968 | if (nid == 0x0f) | |
18969 | return 0x02; | |
18970 | else if (nid >= 0x0c && nid <= 0x0e) | |
18971 | return nid - 0x0c + 0x02; | |
cc1c452e DH |
18972 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
18973 | return 0x25; | |
7085ec12 TI |
18974 | else |
18975 | return 0; | |
18976 | } | |
18977 | ||
18978 | /* get MIX nid connected to the given pin targeted to DAC */ | |
18979 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | |
18980 | hda_nid_t dac) | |
18981 | { | |
cc1c452e | 18982 | hda_nid_t mix[5]; |
7085ec12 TI |
18983 | int i, num; |
18984 | ||
18985 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | |
18986 | for (i = 0; i < num; i++) { | |
18987 | if (alc662_mix_to_dac(mix[i]) == dac) | |
18988 | return mix[i]; | |
18989 | } | |
18990 | return 0; | |
18991 | } | |
18992 | ||
18993 | /* look for an empty DAC slot */ | |
18994 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |
18995 | { | |
18996 | struct alc_spec *spec = codec->spec; | |
18997 | hda_nid_t srcs[5]; | |
18998 | int i, j, num; | |
18999 | ||
19000 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | |
19001 | if (num < 0) | |
19002 | return 0; | |
19003 | for (i = 0; i < num; i++) { | |
19004 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); | |
19005 | if (!nid) | |
19006 | continue; | |
19007 | for (j = 0; j < spec->multiout.num_dacs; j++) | |
19008 | if (spec->multiout.dac_nids[j] == nid) | |
19009 | break; | |
19010 | if (j >= spec->multiout.num_dacs) | |
19011 | return nid; | |
19012 | } | |
19013 | return 0; | |
19014 | } | |
19015 | ||
19016 | /* fill in the dac_nids table from the parsed pin configuration */ | |
19017 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, | |
19018 | const struct auto_pin_cfg *cfg) | |
19019 | { | |
19020 | struct alc_spec *spec = codec->spec; | |
19021 | int i; | |
19022 | hda_nid_t dac; | |
19023 | ||
19024 | spec->multiout.dac_nids = spec->private_dac_nids; | |
19025 | for (i = 0; i < cfg->line_outs; i++) { | |
19026 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); | |
19027 | if (!dac) | |
19028 | continue; | |
19029 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
19030 | } | |
19031 | return 0; | |
19032 | } | |
19033 | ||
0afe5f89 | 19034 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
7085ec12 TI |
19035 | hda_nid_t nid, unsigned int chs) |
19036 | { | |
0afe5f89 | 19037 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
7085ec12 TI |
19038 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
19039 | } | |
19040 | ||
0afe5f89 | 19041 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
7085ec12 TI |
19042 | hda_nid_t nid, unsigned int chs) |
19043 | { | |
0afe5f89 | 19044 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
7085ec12 TI |
19045 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
19046 | } | |
19047 | ||
19048 | #define alc662_add_stereo_vol(spec, pfx, nid) \ | |
19049 | alc662_add_vol_ctl(spec, pfx, nid, 3) | |
19050 | #define alc662_add_stereo_sw(spec, pfx, nid) \ | |
19051 | alc662_add_sw_ctl(spec, pfx, nid, 3) | |
19052 | ||
bc9f98a9 | 19053 | /* add playback controls from the parsed DAC table */ |
7085ec12 | 19054 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
bc9f98a9 KY |
19055 | const struct auto_pin_cfg *cfg) |
19056 | { | |
7085ec12 | 19057 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
19058 | static const char *chname[4] = { |
19059 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
19060 | }; | |
7085ec12 | 19061 | hda_nid_t nid, mix; |
bc9f98a9 KY |
19062 | int i, err; |
19063 | ||
19064 | for (i = 0; i < cfg->line_outs; i++) { | |
7085ec12 TI |
19065 | nid = spec->multiout.dac_nids[i]; |
19066 | if (!nid) | |
19067 | continue; | |
19068 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); | |
19069 | if (!mix) | |
bc9f98a9 | 19070 | continue; |
bc9f98a9 KY |
19071 | if (i == 2) { |
19072 | /* Center/LFE */ | |
7085ec12 | 19073 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
bc9f98a9 KY |
19074 | if (err < 0) |
19075 | return err; | |
7085ec12 | 19076 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
bc9f98a9 KY |
19077 | if (err < 0) |
19078 | return err; | |
7085ec12 | 19079 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
bc9f98a9 KY |
19080 | if (err < 0) |
19081 | return err; | |
7085ec12 | 19082 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
bc9f98a9 KY |
19083 | if (err < 0) |
19084 | return err; | |
19085 | } else { | |
0d884cb9 TI |
19086 | const char *pfx; |
19087 | if (cfg->line_outs == 1 && | |
19088 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | |
7085ec12 | 19089 | if (cfg->hp_outs) |
0d884cb9 TI |
19090 | pfx = "Speaker"; |
19091 | else | |
19092 | pfx = "PCM"; | |
19093 | } else | |
19094 | pfx = chname[i]; | |
7085ec12 | 19095 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
bc9f98a9 KY |
19096 | if (err < 0) |
19097 | return err; | |
0d884cb9 TI |
19098 | if (cfg->line_outs == 1 && |
19099 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
19100 | pfx = "Speaker"; | |
7085ec12 | 19101 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
bc9f98a9 KY |
19102 | if (err < 0) |
19103 | return err; | |
19104 | } | |
19105 | } | |
19106 | return 0; | |
19107 | } | |
19108 | ||
19109 | /* add playback controls for speaker and HP outputs */ | |
7085ec12 TI |
19110 | /* return DAC nid if any new DAC is assigned */ |
19111 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |
bc9f98a9 KY |
19112 | const char *pfx) |
19113 | { | |
7085ec12 TI |
19114 | struct alc_spec *spec = codec->spec; |
19115 | hda_nid_t nid, mix; | |
bc9f98a9 | 19116 | int err; |
bc9f98a9 KY |
19117 | |
19118 | if (!pin) | |
19119 | return 0; | |
7085ec12 TI |
19120 | nid = alc662_look_for_dac(codec, pin); |
19121 | if (!nid) { | |
7085ec12 TI |
19122 | /* the corresponding DAC is already occupied */ |
19123 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | |
19124 | return 0; /* no way */ | |
19125 | /* create a switch only */ | |
0afe5f89 | 19126 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
7085ec12 | 19127 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
24fb9173 TI |
19128 | } |
19129 | ||
7085ec12 TI |
19130 | mix = alc662_dac_to_mix(codec, pin, nid); |
19131 | if (!mix) | |
19132 | return 0; | |
19133 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | |
19134 | if (err < 0) | |
19135 | return err; | |
19136 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | |
19137 | if (err < 0) | |
19138 | return err; | |
19139 | return nid; | |
bc9f98a9 KY |
19140 | } |
19141 | ||
19142 | /* create playback/capture controls for input pins */ | |
05f5f477 | 19143 | #define alc662_auto_create_input_ctls \ |
4b7348a1 | 19144 | alc882_auto_create_input_ctls |
bc9f98a9 KY |
19145 | |
19146 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
19147 | hda_nid_t nid, int pin_type, | |
7085ec12 | 19148 | hda_nid_t dac) |
bc9f98a9 | 19149 | { |
7085ec12 | 19150 | int i, num; |
ce503f38 | 19151 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
7085ec12 | 19152 | |
f6c7e546 | 19153 | alc_set_pin_output(codec, nid, pin_type); |
bc9f98a9 | 19154 | /* need the manual connection? */ |
7085ec12 TI |
19155 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
19156 | if (num <= 1) | |
19157 | return; | |
19158 | for (i = 0; i < num; i++) { | |
19159 | if (alc662_mix_to_dac(srcs[i]) != dac) | |
19160 | continue; | |
19161 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); | |
19162 | return; | |
bc9f98a9 KY |
19163 | } |
19164 | } | |
19165 | ||
19166 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
19167 | { | |
19168 | struct alc_spec *spec = codec->spec; | |
7085ec12 | 19169 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
bc9f98a9 KY |
19170 | int i; |
19171 | ||
19172 | for (i = 0; i <= HDA_SIDE; i++) { | |
19173 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
19174 | if (nid) | |
baba8ee9 | 19175 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
7085ec12 | 19176 | spec->multiout.dac_nids[i]); |
bc9f98a9 KY |
19177 | } |
19178 | } | |
19179 | ||
19180 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
19181 | { | |
19182 | struct alc_spec *spec = codec->spec; | |
19183 | hda_nid_t pin; | |
19184 | ||
19185 | pin = spec->autocfg.hp_pins[0]; | |
7085ec12 TI |
19186 | if (pin) |
19187 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, | |
19188 | spec->multiout.hp_nid); | |
f6c7e546 TI |
19189 | pin = spec->autocfg.speaker_pins[0]; |
19190 | if (pin) | |
7085ec12 TI |
19191 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
19192 | spec->multiout.extra_out_nid[0]); | |
bc9f98a9 KY |
19193 | } |
19194 | ||
bc9f98a9 KY |
19195 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
19196 | ||
19197 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
19198 | { | |
19199 | struct alc_spec *spec = codec->spec; | |
66ceeb6b | 19200 | struct auto_pin_cfg *cfg = &spec->autocfg; |
bc9f98a9 KY |
19201 | int i; |
19202 | ||
66ceeb6b TI |
19203 | for (i = 0; i < cfg->num_inputs; i++) { |
19204 | hda_nid_t nid = cfg->inputs[i].pin; | |
05f5f477 | 19205 | if (alc_is_input_pin(codec, nid)) { |
30ea098f | 19206 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
52ca15b7 | 19207 | if (nid != ALC662_PIN_CD_NID && |
e82c025b | 19208 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
bc9f98a9 KY |
19209 | snd_hda_codec_write(codec, nid, 0, |
19210 | AC_VERB_SET_AMP_GAIN_MUTE, | |
19211 | AMP_OUT_MUTE); | |
19212 | } | |
19213 | } | |
19214 | } | |
19215 | ||
f511b01c TI |
19216 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
19217 | ||
bc9f98a9 KY |
19218 | static int alc662_parse_auto_config(struct hda_codec *codec) |
19219 | { | |
19220 | struct alc_spec *spec = codec->spec; | |
19221 | int err; | |
19222 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
19223 | ||
19224 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
19225 | alc662_ignore); | |
19226 | if (err < 0) | |
19227 | return err; | |
19228 | if (!spec->autocfg.line_outs) | |
19229 | return 0; /* can't find valid BIOS pin config */ | |
19230 | ||
7085ec12 | 19231 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
f12ab1e0 TI |
19232 | if (err < 0) |
19233 | return err; | |
7085ec12 | 19234 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
f12ab1e0 TI |
19235 | if (err < 0) |
19236 | return err; | |
7085ec12 | 19237 | err = alc662_auto_create_extra_out(codec, |
f12ab1e0 TI |
19238 | spec->autocfg.speaker_pins[0], |
19239 | "Speaker"); | |
19240 | if (err < 0) | |
19241 | return err; | |
7085ec12 TI |
19242 | if (err) |
19243 | spec->multiout.extra_out_nid[0] = err; | |
19244 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | |
f12ab1e0 TI |
19245 | "Headphone"); |
19246 | if (err < 0) | |
19247 | return err; | |
7085ec12 TI |
19248 | if (err) |
19249 | spec->multiout.hp_nid = err; | |
05f5f477 | 19250 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
f12ab1e0 | 19251 | if (err < 0) |
bc9f98a9 KY |
19252 | return err; |
19253 | ||
19254 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
19255 | ||
757899ac | 19256 | alc_auto_parse_digital(codec); |
bc9f98a9 | 19257 | |
603c4019 | 19258 | if (spec->kctls.list) |
d88897ea | 19259 | add_mixer(spec, spec->kctls.list); |
bc9f98a9 KY |
19260 | |
19261 | spec->num_mux_defs = 1; | |
61b9b9b1 | 19262 | spec->input_mux = &spec->private_imux[0]; |
ea1fb29a | 19263 | |
cec27c89 KY |
19264 | add_verb(spec, alc662_init_verbs); |
19265 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | |
d1eb57f4 | 19266 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
cec27c89 KY |
19267 | add_verb(spec, alc663_init_verbs); |
19268 | ||
19269 | if (codec->vendor_id == 0x10ec0272) | |
19270 | add_verb(spec, alc272_init_verbs); | |
ee979a14 TI |
19271 | |
19272 | err = alc_auto_add_mic_boost(codec); | |
19273 | if (err < 0) | |
19274 | return err; | |
19275 | ||
6227cdce KY |
19276 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
19277 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | |
19278 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); | |
19279 | else | |
19280 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | |
4a79ba34 | 19281 | |
8c87286f | 19282 | return 1; |
bc9f98a9 KY |
19283 | } |
19284 | ||
19285 | /* additional initialization for auto-configuration model */ | |
19286 | static void alc662_auto_init(struct hda_codec *codec) | |
19287 | { | |
f6c7e546 | 19288 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
19289 | alc662_auto_init_multi_out(codec); |
19290 | alc662_auto_init_hp_out(codec); | |
19291 | alc662_auto_init_analog_input(codec); | |
f511b01c | 19292 | alc662_auto_init_input_src(codec); |
757899ac | 19293 | alc_auto_init_digital(codec); |
f6c7e546 | 19294 | if (spec->unsol_event) |
7fb0d78f | 19295 | alc_inithook(codec); |
bc9f98a9 KY |
19296 | } |
19297 | ||
6cb3b707 | 19298 | enum { |
2df03514 | 19299 | ALC662_FIXUP_ASPIRE, |
6cb3b707 DH |
19300 | ALC662_FIXUP_IDEAPAD, |
19301 | }; | |
19302 | ||
19303 | static const struct alc_fixup alc662_fixups[] = { | |
2df03514 DC |
19304 | [ALC662_FIXUP_ASPIRE] = { |
19305 | .pins = (const struct alc_pincfg[]) { | |
19306 | { 0x15, 0x99130112 }, /* subwoofer */ | |
19307 | { } | |
19308 | } | |
19309 | }, | |
6cb3b707 DH |
19310 | [ALC662_FIXUP_IDEAPAD] = { |
19311 | .pins = (const struct alc_pincfg[]) { | |
19312 | { 0x17, 0x99130112 }, /* subwoofer */ | |
19313 | { } | |
19314 | } | |
19315 | }, | |
19316 | }; | |
19317 | ||
19318 | static struct snd_pci_quirk alc662_fixup_tbl[] = { | |
2df03514 | 19319 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
a0e90acc | 19320 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
d4118588 | 19321 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
6cb3b707 DH |
19322 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
19323 | {} | |
19324 | }; | |
19325 | ||
19326 | ||
19327 | ||
bc9f98a9 KY |
19328 | static int patch_alc662(struct hda_codec *codec) |
19329 | { | |
19330 | struct alc_spec *spec; | |
19331 | int err, board_config; | |
693194f3 | 19332 | int coef; |
bc9f98a9 KY |
19333 | |
19334 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
19335 | if (!spec) | |
19336 | return -ENOMEM; | |
19337 | ||
19338 | codec->spec = spec; | |
19339 | ||
da00c244 KY |
19340 | alc_auto_parse_customize_define(codec); |
19341 | ||
2c3bf9ab TI |
19342 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
19343 | ||
693194f3 KY |
19344 | coef = alc_read_coef_idx(codec, 0); |
19345 | if (coef == 0x8020 || coef == 0x8011) | |
c027ddcd | 19346 | alc_codec_rename(codec, "ALC661"); |
693194f3 KY |
19347 | else if (coef & (1 << 14) && |
19348 | codec->bus->pci->subsystem_vendor == 0x1025 && | |
19349 | spec->cdefine.platform_type == 1) | |
c027ddcd | 19350 | alc_codec_rename(codec, "ALC272X"); |
693194f3 KY |
19351 | else if (coef == 0x4011) |
19352 | alc_codec_rename(codec, "ALC656"); | |
274693f3 | 19353 | |
bc9f98a9 KY |
19354 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
19355 | alc662_models, | |
19356 | alc662_cfg_tbl); | |
19357 | if (board_config < 0) { | |
9a11f1aa TI |
19358 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
19359 | codec->chip_name); | |
bc9f98a9 KY |
19360 | board_config = ALC662_AUTO; |
19361 | } | |
19362 | ||
19363 | if (board_config == ALC662_AUTO) { | |
6cb3b707 | 19364 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
bc9f98a9 KY |
19365 | /* automatic parse from the BIOS config */ |
19366 | err = alc662_parse_auto_config(codec); | |
19367 | if (err < 0) { | |
19368 | alc_free(codec); | |
19369 | return err; | |
8c87286f | 19370 | } else if (!err) { |
bc9f98a9 KY |
19371 | printk(KERN_INFO |
19372 | "hda_codec: Cannot set up configuration " | |
19373 | "from BIOS. Using base mode...\n"); | |
19374 | board_config = ALC662_3ST_2ch_DIG; | |
19375 | } | |
19376 | } | |
19377 | ||
dc1eae25 | 19378 | if (has_cdefine_beep(codec)) { |
8af2591d TI |
19379 | err = snd_hda_attach_beep_device(codec, 0x1); |
19380 | if (err < 0) { | |
19381 | alc_free(codec); | |
19382 | return err; | |
19383 | } | |
680cd536 KK |
19384 | } |
19385 | ||
bc9f98a9 | 19386 | if (board_config != ALC662_AUTO) |
e9c364c0 | 19387 | setup_preset(codec, &alc662_presets[board_config]); |
bc9f98a9 | 19388 | |
bc9f98a9 KY |
19389 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
19390 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
19391 | ||
bc9f98a9 KY |
19392 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
19393 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
19394 | ||
dd704698 TI |
19395 | if (!spec->adc_nids) { |
19396 | spec->adc_nids = alc662_adc_nids; | |
19397 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
19398 | } | |
19399 | if (!spec->capsrc_nids) | |
19400 | spec->capsrc_nids = alc662_capsrc_nids; | |
bc9f98a9 | 19401 | |
f9e336f6 | 19402 | if (!spec->cap_mixer) |
b59bdf3b | 19403 | set_capture_mixer(codec); |
cec27c89 | 19404 | |
dc1eae25 | 19405 | if (has_cdefine_beep(codec)) { |
da00c244 KY |
19406 | switch (codec->vendor_id) { |
19407 | case 0x10ec0662: | |
19408 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
19409 | break; | |
19410 | case 0x10ec0272: | |
19411 | case 0x10ec0663: | |
19412 | case 0x10ec0665: | |
19413 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | |
19414 | break; | |
19415 | case 0x10ec0273: | |
19416 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); | |
19417 | break; | |
19418 | } | |
cec27c89 | 19419 | } |
2134ea4f TI |
19420 | spec->vmaster_nid = 0x02; |
19421 | ||
bc9f98a9 | 19422 | codec->patch_ops = alc_patch_ops; |
6cb3b707 | 19423 | if (board_config == ALC662_AUTO) { |
bc9f98a9 | 19424 | spec->init_hook = alc662_auto_init; |
6cb3b707 DH |
19425 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
19426 | } | |
19427 | ||
bf1b0225 KY |
19428 | alc_init_jacks(codec); |
19429 | ||
cb53c626 TI |
19430 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
19431 | if (!spec->loopback.amplist) | |
19432 | spec->loopback.amplist = alc662_loopbacks; | |
19433 | #endif | |
bc9f98a9 KY |
19434 | |
19435 | return 0; | |
19436 | } | |
19437 | ||
274693f3 KY |
19438 | static int patch_alc888(struct hda_codec *codec) |
19439 | { | |
19440 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | |
19441 | kfree(codec->chip_name); | |
01e0f137 KY |
19442 | if (codec->vendor_id == 0x10ec0887) |
19443 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); | |
19444 | else | |
19445 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | |
ac2c92e0 TI |
19446 | if (!codec->chip_name) { |
19447 | alc_free(codec); | |
274693f3 | 19448 | return -ENOMEM; |
ac2c92e0 TI |
19449 | } |
19450 | return patch_alc662(codec); | |
274693f3 | 19451 | } |
ac2c92e0 | 19452 | return patch_alc882(codec); |
274693f3 KY |
19453 | } |
19454 | ||
d1eb57f4 KY |
19455 | /* |
19456 | * ALC680 support | |
19457 | */ | |
c69aefab | 19458 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
d1eb57f4 KY |
19459 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
19460 | #define alc680_modes alc260_modes | |
19461 | ||
19462 | static hda_nid_t alc680_dac_nids[3] = { | |
19463 | /* Lout1, Lout2, hp */ | |
19464 | 0x02, 0x03, 0x04 | |
19465 | }; | |
19466 | ||
19467 | static hda_nid_t alc680_adc_nids[3] = { | |
19468 | /* ADC0-2 */ | |
19469 | /* DMIC, MIC, Line-in*/ | |
19470 | 0x07, 0x08, 0x09 | |
19471 | }; | |
19472 | ||
c69aefab KY |
19473 | /* |
19474 | * Analog capture ADC cgange | |
19475 | */ | |
66ceeb6b TI |
19476 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
19477 | { | |
19478 | struct alc_spec *spec = codec->spec; | |
19479 | struct auto_pin_cfg *cfg = &spec->autocfg; | |
19480 | int pin_found = 0; | |
19481 | int type_found = AUTO_PIN_LAST; | |
19482 | hda_nid_t nid; | |
19483 | int i; | |
19484 | ||
19485 | for (i = 0; i < cfg->num_inputs; i++) { | |
19486 | nid = cfg->inputs[i].pin; | |
19487 | if (!(snd_hda_query_pin_caps(codec, nid) & | |
19488 | AC_PINCAP_PRES_DETECT)) | |
19489 | continue; | |
19490 | if (snd_hda_jack_detect(codec, nid)) { | |
19491 | if (cfg->inputs[i].type < type_found) { | |
19492 | type_found = cfg->inputs[i].type; | |
19493 | pin_found = nid; | |
19494 | } | |
19495 | } | |
19496 | } | |
19497 | ||
19498 | nid = 0x07; | |
19499 | if (pin_found) | |
19500 | snd_hda_get_connections(codec, pin_found, &nid, 1); | |
19501 | ||
19502 | if (nid != spec->cur_adc) | |
19503 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); | |
19504 | spec->cur_adc = nid; | |
19505 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, | |
19506 | spec->cur_adc_format); | |
19507 | } | |
19508 | ||
c69aefab KY |
19509 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
19510 | struct hda_codec *codec, | |
19511 | unsigned int stream_tag, | |
19512 | unsigned int format, | |
19513 | struct snd_pcm_substream *substream) | |
19514 | { | |
19515 | struct alc_spec *spec = codec->spec; | |
c69aefab | 19516 | |
66ceeb6b | 19517 | spec->cur_adc = 0x07; |
c69aefab KY |
19518 | spec->cur_adc_stream_tag = stream_tag; |
19519 | spec->cur_adc_format = format; | |
19520 | ||
66ceeb6b | 19521 | alc680_rec_autoswitch(codec); |
c69aefab KY |
19522 | return 0; |
19523 | } | |
19524 | ||
19525 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
19526 | struct hda_codec *codec, | |
19527 | struct snd_pcm_substream *substream) | |
19528 | { | |
19529 | snd_hda_codec_cleanup_stream(codec, 0x07); | |
19530 | snd_hda_codec_cleanup_stream(codec, 0x08); | |
19531 | snd_hda_codec_cleanup_stream(codec, 0x09); | |
19532 | return 0; | |
19533 | } | |
19534 | ||
19535 | static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { | |
19536 | .substreams = 1, /* can be overridden */ | |
19537 | .channels_min = 2, | |
19538 | .channels_max = 2, | |
19539 | /* NID is set in alc_build_pcms */ | |
19540 | .ops = { | |
19541 | .prepare = alc680_capture_pcm_prepare, | |
19542 | .cleanup = alc680_capture_pcm_cleanup | |
19543 | }, | |
19544 | }; | |
19545 | ||
d1eb57f4 KY |
19546 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
19547 | /* output mixer control */ | |
19548 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
19549 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
19550 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), | |
19551 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
c69aefab | 19552 | HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT), |
d1eb57f4 | 19553 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c69aefab | 19554 | HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT), |
d1eb57f4 KY |
19555 | { } |
19556 | }; | |
19557 | ||
c69aefab KY |
19558 | static struct hda_bind_ctls alc680_bind_cap_vol = { |
19559 | .ops = &snd_hda_bind_vol, | |
19560 | .values = { | |
19561 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19562 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19563 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19564 | 0 | |
19565 | }, | |
19566 | }; | |
19567 | ||
19568 | static struct hda_bind_ctls alc680_bind_cap_switch = { | |
19569 | .ops = &snd_hda_bind_sw, | |
19570 | .values = { | |
19571 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), | |
19572 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
19573 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
19574 | 0 | |
19575 | }, | |
19576 | }; | |
19577 | ||
19578 | static struct snd_kcontrol_new alc680_master_capture_mixer[] = { | |
19579 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), | |
19580 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), | |
d1eb57f4 KY |
19581 | { } /* end */ |
19582 | }; | |
19583 | ||
19584 | /* | |
19585 | * generic initialization of ADC, input mixers and output mixers | |
19586 | */ | |
19587 | static struct hda_verb alc680_init_verbs[] = { | |
c69aefab KY |
19588 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
19589 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
19590 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
d1eb57f4 | 19591 | |
c69aefab KY |
19592 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
19593 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19594 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
19595 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
19596 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
19597 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d1eb57f4 KY |
19598 | |
19599 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19600 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19601 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19602 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
19603 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
c69aefab KY |
19604 | |
19605 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
19606 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
66ceeb6b | 19607 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
c69aefab | 19608 | |
d1eb57f4 KY |
19609 | { } |
19610 | }; | |
19611 | ||
c69aefab KY |
19612 | /* toggle speaker-output according to the hp-jack state */ |
19613 | static void alc680_base_setup(struct hda_codec *codec) | |
19614 | { | |
19615 | struct alc_spec *spec = codec->spec; | |
19616 | ||
19617 | spec->autocfg.hp_pins[0] = 0x16; | |
19618 | spec->autocfg.speaker_pins[0] = 0x14; | |
19619 | spec->autocfg.speaker_pins[1] = 0x15; | |
66ceeb6b TI |
19620 | spec->autocfg.num_inputs = 2; |
19621 | spec->autocfg.inputs[0].pin = 0x18; | |
19622 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; | |
19623 | spec->autocfg.inputs[1].pin = 0x19; | |
86e2959a | 19624 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
c69aefab KY |
19625 | } |
19626 | ||
19627 | static void alc680_unsol_event(struct hda_codec *codec, | |
19628 | unsigned int res) | |
19629 | { | |
19630 | if ((res >> 26) == ALC880_HP_EVENT) | |
19631 | alc_automute_amp(codec); | |
19632 | if ((res >> 26) == ALC880_MIC_EVENT) | |
19633 | alc680_rec_autoswitch(codec); | |
19634 | } | |
19635 | ||
19636 | static void alc680_inithook(struct hda_codec *codec) | |
19637 | { | |
19638 | alc_automute_amp(codec); | |
19639 | alc680_rec_autoswitch(codec); | |
19640 | } | |
19641 | ||
d1eb57f4 KY |
19642 | /* create input playback/capture controls for the given pin */ |
19643 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
19644 | const char *ctlname, int idx) | |
19645 | { | |
19646 | hda_nid_t dac; | |
19647 | int err; | |
19648 | ||
19649 | switch (nid) { | |
19650 | case 0x14: | |
19651 | dac = 0x02; | |
19652 | break; | |
19653 | case 0x15: | |
19654 | dac = 0x03; | |
19655 | break; | |
19656 | case 0x16: | |
19657 | dac = 0x04; | |
19658 | break; | |
19659 | default: | |
19660 | return 0; | |
19661 | } | |
19662 | if (spec->multiout.dac_nids[0] != dac && | |
19663 | spec->multiout.dac_nids[1] != dac) { | |
19664 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | |
19665 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | |
19666 | HDA_OUTPUT)); | |
19667 | if (err < 0) | |
19668 | return err; | |
19669 | ||
19670 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | |
19671 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
19672 | ||
19673 | if (err < 0) | |
19674 | return err; | |
19675 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | |
19676 | } | |
19677 | ||
19678 | return 0; | |
19679 | } | |
19680 | ||
19681 | /* add playback controls from the parsed DAC table */ | |
19682 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, | |
19683 | const struct auto_pin_cfg *cfg) | |
19684 | { | |
19685 | hda_nid_t nid; | |
19686 | int err; | |
19687 | ||
19688 | spec->multiout.dac_nids = spec->private_dac_nids; | |
19689 | ||
19690 | nid = cfg->line_out_pins[0]; | |
19691 | if (nid) { | |
19692 | const char *name; | |
19693 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | |
19694 | name = "Speaker"; | |
19695 | else | |
19696 | name = "Front"; | |
19697 | err = alc680_new_analog_output(spec, nid, name, 0); | |
19698 | if (err < 0) | |
19699 | return err; | |
19700 | } | |
19701 | ||
19702 | nid = cfg->speaker_pins[0]; | |
19703 | if (nid) { | |
19704 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); | |
19705 | if (err < 0) | |
19706 | return err; | |
19707 | } | |
19708 | nid = cfg->hp_pins[0]; | |
19709 | if (nid) { | |
19710 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); | |
19711 | if (err < 0) | |
19712 | return err; | |
19713 | } | |
19714 | ||
19715 | return 0; | |
19716 | } | |
19717 | ||
19718 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, | |
19719 | hda_nid_t nid, int pin_type) | |
19720 | { | |
19721 | alc_set_pin_output(codec, nid, pin_type); | |
19722 | } | |
19723 | ||
19724 | static void alc680_auto_init_multi_out(struct hda_codec *codec) | |
19725 | { | |
19726 | struct alc_spec *spec = codec->spec; | |
19727 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | |
19728 | if (nid) { | |
19729 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
19730 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); | |
19731 | } | |
19732 | } | |
19733 | ||
19734 | static void alc680_auto_init_hp_out(struct hda_codec *codec) | |
19735 | { | |
19736 | struct alc_spec *spec = codec->spec; | |
19737 | hda_nid_t pin; | |
19738 | ||
19739 | pin = spec->autocfg.hp_pins[0]; | |
19740 | if (pin) | |
19741 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); | |
19742 | pin = spec->autocfg.speaker_pins[0]; | |
19743 | if (pin) | |
19744 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); | |
19745 | } | |
19746 | ||
19747 | /* pcm configuration: identical with ALC880 */ | |
19748 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback | |
19749 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture | |
19750 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | |
19751 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback | |
c69aefab | 19752 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
d1eb57f4 KY |
19753 | |
19754 | /* | |
19755 | * BIOS auto configuration | |
19756 | */ | |
19757 | static int alc680_parse_auto_config(struct hda_codec *codec) | |
19758 | { | |
19759 | struct alc_spec *spec = codec->spec; | |
19760 | int err; | |
19761 | static hda_nid_t alc680_ignore[] = { 0 }; | |
19762 | ||
19763 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
19764 | alc680_ignore); | |
19765 | if (err < 0) | |
19766 | return err; | |
c69aefab | 19767 | |
d1eb57f4 KY |
19768 | if (!spec->autocfg.line_outs) { |
19769 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | |
19770 | spec->multiout.max_channels = 2; | |
19771 | spec->no_analog = 1; | |
19772 | goto dig_only; | |
19773 | } | |
19774 | return 0; /* can't find valid BIOS pin config */ | |
19775 | } | |
19776 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
19777 | if (err < 0) | |
19778 | return err; | |
19779 | ||
19780 | spec->multiout.max_channels = 2; | |
19781 | ||
19782 | dig_only: | |
19783 | /* digital only support output */ | |
757899ac | 19784 | alc_auto_parse_digital(codec); |
d1eb57f4 KY |
19785 | if (spec->kctls.list) |
19786 | add_mixer(spec, spec->kctls.list); | |
19787 | ||
19788 | add_verb(spec, alc680_init_verbs); | |
d1eb57f4 KY |
19789 | |
19790 | err = alc_auto_add_mic_boost(codec); | |
19791 | if (err < 0) | |
19792 | return err; | |
19793 | ||
19794 | return 1; | |
19795 | } | |
19796 | ||
19797 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input | |
19798 | ||
19799 | /* init callback for auto-configuration model -- overriding the default init */ | |
19800 | static void alc680_auto_init(struct hda_codec *codec) | |
19801 | { | |
19802 | struct alc_spec *spec = codec->spec; | |
19803 | alc680_auto_init_multi_out(codec); | |
19804 | alc680_auto_init_hp_out(codec); | |
19805 | alc680_auto_init_analog_input(codec); | |
757899ac | 19806 | alc_auto_init_digital(codec); |
d1eb57f4 KY |
19807 | if (spec->unsol_event) |
19808 | alc_inithook(codec); | |
19809 | } | |
19810 | ||
19811 | /* | |
19812 | * configuration and preset | |
19813 | */ | |
19814 | static const char *alc680_models[ALC680_MODEL_LAST] = { | |
d4a86d81 TI |
19815 | [ALC680_BASE] = "base", |
19816 | [ALC680_AUTO] = "auto", | |
d1eb57f4 KY |
19817 | }; |
19818 | ||
19819 | static struct snd_pci_quirk alc680_cfg_tbl[] = { | |
19820 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), | |
19821 | {} | |
19822 | }; | |
19823 | ||
19824 | static struct alc_config_preset alc680_presets[] = { | |
19825 | [ALC680_BASE] = { | |
19826 | .mixers = { alc680_base_mixer }, | |
c69aefab | 19827 | .cap_mixer = alc680_master_capture_mixer, |
d1eb57f4 KY |
19828 | .init_verbs = { alc680_init_verbs }, |
19829 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), | |
19830 | .dac_nids = alc680_dac_nids, | |
d1eb57f4 KY |
19831 | .dig_out_nid = ALC680_DIGOUT_NID, |
19832 | .num_channel_mode = ARRAY_SIZE(alc680_modes), | |
19833 | .channel_mode = alc680_modes, | |
c69aefab KY |
19834 | .unsol_event = alc680_unsol_event, |
19835 | .setup = alc680_base_setup, | |
19836 | .init_hook = alc680_inithook, | |
19837 | ||
d1eb57f4 KY |
19838 | }, |
19839 | }; | |
19840 | ||
19841 | static int patch_alc680(struct hda_codec *codec) | |
19842 | { | |
19843 | struct alc_spec *spec; | |
19844 | int board_config; | |
19845 | int err; | |
19846 | ||
19847 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
19848 | if (spec == NULL) | |
19849 | return -ENOMEM; | |
19850 | ||
19851 | codec->spec = spec; | |
19852 | ||
19853 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, | |
19854 | alc680_models, | |
19855 | alc680_cfg_tbl); | |
19856 | ||
19857 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { | |
19858 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | |
19859 | codec->chip_name); | |
19860 | board_config = ALC680_AUTO; | |
19861 | } | |
19862 | ||
19863 | if (board_config == ALC680_AUTO) { | |
19864 | /* automatic parse from the BIOS config */ | |
19865 | err = alc680_parse_auto_config(codec); | |
19866 | if (err < 0) { | |
19867 | alc_free(codec); | |
19868 | return err; | |
19869 | } else if (!err) { | |
19870 | printk(KERN_INFO | |
19871 | "hda_codec: Cannot set up configuration " | |
19872 | "from BIOS. Using base mode...\n"); | |
19873 | board_config = ALC680_BASE; | |
19874 | } | |
19875 | } | |
19876 | ||
19877 | if (board_config != ALC680_AUTO) | |
19878 | setup_preset(codec, &alc680_presets[board_config]); | |
19879 | ||
19880 | spec->stream_analog_playback = &alc680_pcm_analog_playback; | |
c69aefab | 19881 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
d1eb57f4 | 19882 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
c69aefab | 19883 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
d1eb57f4 KY |
19884 | |
19885 | if (!spec->adc_nids) { | |
19886 | spec->adc_nids = alc680_adc_nids; | |
19887 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); | |
19888 | } | |
19889 | ||
19890 | if (!spec->cap_mixer) | |
19891 | set_capture_mixer(codec); | |
19892 | ||
19893 | spec->vmaster_nid = 0x02; | |
19894 | ||
19895 | codec->patch_ops = alc_patch_ops; | |
19896 | if (board_config == ALC680_AUTO) | |
19897 | spec->init_hook = alc680_auto_init; | |
19898 | ||
19899 | return 0; | |
19900 | } | |
19901 | ||
1da177e4 LT |
19902 | /* |
19903 | * patch entries | |
19904 | */ | |
1289e9e8 | 19905 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
1da177e4 | 19906 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
df694daa | 19907 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
f6a92248 | 19908 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
a361d84b | 19909 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
f6a92248 | 19910 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
ebb83eeb | 19911 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
01afd41f | 19912 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
ebb83eeb | 19913 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
f32610ed | 19914 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
bc9f98a9 | 19915 | .patch = patch_alc861 }, |
f32610ed JS |
19916 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
19917 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
19918 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
bc9f98a9 | 19919 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
4953550a | 19920 | .patch = patch_alc882 }, |
bc9f98a9 KY |
19921 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
19922 | .patch = patch_alc662 }, | |
6dda9f4a | 19923 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
cec27c89 | 19924 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
6227cdce | 19925 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
d1eb57f4 | 19926 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
f32610ed | 19927 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
1da177e4 | 19928 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
4953550a | 19929 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
669faba2 | 19930 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
4953550a | 19931 | .patch = patch_alc882 }, |
cb308f97 | 19932 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
4953550a | 19933 | .patch = patch_alc882 }, |
df694daa | 19934 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
01e0f137 | 19935 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
4442608d | 19936 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
4953550a | 19937 | .patch = patch_alc882 }, |
274693f3 | 19938 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
4953550a | 19939 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
274693f3 | 19940 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
1da177e4 LT |
19941 | {} /* terminator */ |
19942 | }; | |
1289e9e8 TI |
19943 | |
19944 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | |
19945 | ||
19946 | MODULE_LICENSE("GPL"); | |
19947 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | |
19948 | ||
19949 | static struct hda_codec_preset_list realtek_list = { | |
19950 | .preset = snd_hda_preset_realtek, | |
19951 | .owner = THIS_MODULE, | |
19952 | }; | |
19953 | ||
19954 | static int __init patch_realtek_init(void) | |
19955 | { | |
19956 | return snd_hda_add_codec_preset(&realtek_list); | |
19957 | } | |
19958 | ||
19959 | static void __exit patch_realtek_exit(void) | |
19960 | { | |
19961 | snd_hda_delete_codec_preset(&realtek_list); | |
19962 | } | |
19963 | ||
19964 | module_init(patch_realtek_init) | |
19965 | module_exit(patch_realtek_exit) |