]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Universal Interface for Intel High Definition Audio Codec | |
3 | * | |
4 | * HD audio interface patch for ALC 260/880/882 codecs | |
5 | * | |
df694daa KY |
6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
7 | * PeiSen Hou <pshou@realtek.com.tw> | |
1da177e4 | 8 | * Takashi Iwai <tiwai@suse.de> |
7cf51e48 | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
1da177e4 LT |
10 | * |
11 | * This driver is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License as published by | |
13 | * the Free Software Foundation; either version 2 of the License, or | |
14 | * (at your option) any later version. | |
15 | * | |
16 | * This driver is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | * GNU General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU General Public License | |
22 | * along with this program; if not, write to the Free Software | |
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 | */ | |
25 | ||
1da177e4 LT |
26 | #include <linux/init.h> |
27 | #include <linux/delay.h> | |
28 | #include <linux/slab.h> | |
29 | #include <linux/pci.h> | |
30 | #include <sound/core.h> | |
31 | #include "hda_codec.h" | |
32 | #include "hda_local.h" | |
3c9a3203 | 33 | #include "hda_patch.h" |
1da177e4 | 34 | |
ccc656ce KY |
35 | #define ALC880_FRONT_EVENT 0x01 |
36 | #define ALC880_DCVOL_EVENT 0x02 | |
37 | #define ALC880_HP_EVENT 0x04 | |
38 | #define ALC880_MIC_EVENT 0x08 | |
1da177e4 LT |
39 | |
40 | /* ALC880 board config type */ | |
41 | enum { | |
1da177e4 LT |
42 | ALC880_3ST, |
43 | ALC880_3ST_DIG, | |
44 | ALC880_5ST, | |
45 | ALC880_5ST_DIG, | |
46 | ALC880_W810, | |
dfc0ff62 | 47 | ALC880_Z71V, |
b6482d48 | 48 | ALC880_6ST, |
16ded525 TI |
49 | ALC880_6ST_DIG, |
50 | ALC880_F1734, | |
51 | ALC880_ASUS, | |
52 | ALC880_ASUS_DIG, | |
53 | ALC880_ASUS_W1V, | |
df694daa | 54 | ALC880_ASUS_DIG2, |
2cf9f0fc | 55 | ALC880_FUJITSU, |
16ded525 | 56 | ALC880_UNIWILL_DIG, |
ccc656ce KY |
57 | ALC880_UNIWILL, |
58 | ALC880_UNIWILL_P53, | |
df694daa KY |
59 | ALC880_CLEVO, |
60 | ALC880_TCL_S700, | |
ae6b813a | 61 | ALC880_LG, |
d681518a | 62 | ALC880_LG_LW, |
df99cd33 | 63 | ALC880_MEDION_RIM, |
e9edcee0 TI |
64 | #ifdef CONFIG_SND_DEBUG |
65 | ALC880_TEST, | |
66 | #endif | |
df694daa | 67 | ALC880_AUTO, |
16ded525 TI |
68 | ALC880_MODEL_LAST /* last tag */ |
69 | }; | |
70 | ||
71 | /* ALC260 models */ | |
72 | enum { | |
73 | ALC260_BASIC, | |
74 | ALC260_HP, | |
3f878308 | 75 | ALC260_HP_DC7600, |
df694daa KY |
76 | ALC260_HP_3013, |
77 | ALC260_FUJITSU_S702X, | |
0bfc90e9 | 78 | ALC260_ACER, |
bc9f98a9 KY |
79 | ALC260_WILL, |
80 | ALC260_REPLACER_672V, | |
7cf51e48 JW |
81 | #ifdef CONFIG_SND_DEBUG |
82 | ALC260_TEST, | |
83 | #endif | |
df694daa | 84 | ALC260_AUTO, |
16ded525 | 85 | ALC260_MODEL_LAST /* last tag */ |
1da177e4 LT |
86 | }; |
87 | ||
df694daa KY |
88 | /* ALC262 models */ |
89 | enum { | |
90 | ALC262_BASIC, | |
ccc656ce KY |
91 | ALC262_HIPPO, |
92 | ALC262_HIPPO_1, | |
834be88d | 93 | ALC262_FUJITSU, |
9c7f852e | 94 | ALC262_HP_BPC, |
cd7509a4 KY |
95 | ALC262_HP_BPC_D7000_WL, |
96 | ALC262_HP_BPC_D7000_WF, | |
66d2a9d6 | 97 | ALC262_HP_TC_T5735, |
8c427226 | 98 | ALC262_HP_RP5700, |
304dcaac | 99 | ALC262_BENQ_ED8, |
272a527c | 100 | ALC262_SONY_ASSAMD, |
83c34218 | 101 | ALC262_BENQ_T31, |
f651b50b | 102 | ALC262_ULTRA, |
0e31daf7 | 103 | ALC262_LENOVO_3000, |
e8f9ae2a | 104 | ALC262_NEC, |
4e555fe5 | 105 | ALC262_TOSHIBA_S06, |
9f99a638 | 106 | ALC262_TOSHIBA_RX1, |
df694daa KY |
107 | ALC262_AUTO, |
108 | ALC262_MODEL_LAST /* last tag */ | |
109 | }; | |
110 | ||
a361d84b KY |
111 | /* ALC268 models */ |
112 | enum { | |
eb5a6621 | 113 | ALC267_QUANTA_IL1, |
a361d84b | 114 | ALC268_3ST, |
d1a991a6 | 115 | ALC268_TOSHIBA, |
d273809e | 116 | ALC268_ACER, |
c238b4f4 | 117 | ALC268_ACER_DMIC, |
8ef355da | 118 | ALC268_ACER_ASPIRE_ONE, |
3866f0b0 | 119 | ALC268_DELL, |
f12462c5 | 120 | ALC268_ZEPTO, |
86c53bd2 JW |
121 | #ifdef CONFIG_SND_DEBUG |
122 | ALC268_TEST, | |
123 | #endif | |
a361d84b KY |
124 | ALC268_AUTO, |
125 | ALC268_MODEL_LAST /* last tag */ | |
126 | }; | |
127 | ||
f6a92248 KY |
128 | /* ALC269 models */ |
129 | enum { | |
130 | ALC269_BASIC, | |
60db6b53 | 131 | ALC269_QUANTA_FL1, |
f53281e6 KY |
132 | ALC269_ASUS_EEEPC_P703, |
133 | ALC269_ASUS_EEEPC_P901, | |
26f5df26 | 134 | ALC269_FUJITSU, |
64154835 | 135 | ALC269_LIFEBOOK, |
f6a92248 KY |
136 | ALC269_AUTO, |
137 | ALC269_MODEL_LAST /* last tag */ | |
138 | }; | |
139 | ||
df694daa KY |
140 | /* ALC861 models */ |
141 | enum { | |
142 | ALC861_3ST, | |
9c7f852e | 143 | ALC660_3ST, |
df694daa KY |
144 | ALC861_3ST_DIG, |
145 | ALC861_6ST_DIG, | |
22309c3e | 146 | ALC861_UNIWILL_M31, |
a53d1aec | 147 | ALC861_TOSHIBA, |
7cdbff94 | 148 | ALC861_ASUS, |
56bb0cab | 149 | ALC861_ASUS_LAPTOP, |
df694daa KY |
150 | ALC861_AUTO, |
151 | ALC861_MODEL_LAST, | |
152 | }; | |
153 | ||
f32610ed JS |
154 | /* ALC861-VD models */ |
155 | enum { | |
156 | ALC660VD_3ST, | |
6963f84c | 157 | ALC660VD_3ST_DIG, |
13c94744 | 158 | ALC660VD_ASUS_V1S, |
f32610ed JS |
159 | ALC861VD_3ST, |
160 | ALC861VD_3ST_DIG, | |
161 | ALC861VD_6ST_DIG, | |
bdd148a3 | 162 | ALC861VD_LENOVO, |
272a527c | 163 | ALC861VD_DALLAS, |
d1a991a6 | 164 | ALC861VD_HP, |
f32610ed JS |
165 | ALC861VD_AUTO, |
166 | ALC861VD_MODEL_LAST, | |
167 | }; | |
168 | ||
bc9f98a9 KY |
169 | /* ALC662 models */ |
170 | enum { | |
171 | ALC662_3ST_2ch_DIG, | |
172 | ALC662_3ST_6ch_DIG, | |
173 | ALC662_3ST_6ch, | |
174 | ALC662_5ST_DIG, | |
175 | ALC662_LENOVO_101E, | |
291702f0 | 176 | ALC662_ASUS_EEEPC_P701, |
8c427226 | 177 | ALC662_ASUS_EEEPC_EP20, |
6dda9f4a KY |
178 | ALC663_ASUS_M51VA, |
179 | ALC663_ASUS_G71V, | |
180 | ALC663_ASUS_H13, | |
181 | ALC663_ASUS_G50V, | |
f1d4e28b KY |
182 | ALC662_ECS, |
183 | ALC663_ASUS_MODE1, | |
184 | ALC662_ASUS_MODE2, | |
185 | ALC663_ASUS_MODE3, | |
186 | ALC663_ASUS_MODE4, | |
187 | ALC663_ASUS_MODE5, | |
188 | ALC663_ASUS_MODE6, | |
bc9f98a9 KY |
189 | ALC662_AUTO, |
190 | ALC662_MODEL_LAST, | |
191 | }; | |
192 | ||
df694daa KY |
193 | /* ALC882 models */ |
194 | enum { | |
195 | ALC882_3ST_DIG, | |
196 | ALC882_6ST_DIG, | |
4b146cb0 | 197 | ALC882_ARIMA, |
bdd148a3 | 198 | ALC882_W2JC, |
272a527c KY |
199 | ALC882_TARGA, |
200 | ALC882_ASUS_A7J, | |
914759b7 | 201 | ALC882_ASUS_A7M, |
9102cd1c | 202 | ALC885_MACPRO, |
87350ad0 | 203 | ALC885_MBP3, |
c54728d8 | 204 | ALC885_IMAC24, |
272a527c | 205 | ALC882_AUTO, |
df694daa KY |
206 | ALC882_MODEL_LAST, |
207 | }; | |
208 | ||
9c7f852e TI |
209 | /* ALC883 models */ |
210 | enum { | |
211 | ALC883_3ST_2ch_DIG, | |
212 | ALC883_3ST_6ch_DIG, | |
213 | ALC883_3ST_6ch, | |
214 | ALC883_6ST_DIG, | |
ccc656ce KY |
215 | ALC883_TARGA_DIG, |
216 | ALC883_TARGA_2ch_DIG, | |
bab282b9 | 217 | ALC883_ACER, |
2880a867 | 218 | ALC883_ACER_ASPIRE, |
c07584c8 | 219 | ALC883_MEDION, |
ea1fb29a | 220 | ALC883_MEDION_MD2, |
b373bdeb | 221 | ALC883_LAPTOP_EAPD, |
bc9f98a9 | 222 | ALC883_LENOVO_101E_2ch, |
272a527c | 223 | ALC883_LENOVO_NB0763, |
189609ae | 224 | ALC888_LENOVO_MS7195_DIG, |
e2757d5e | 225 | ALC888_LENOVO_SKY, |
ea1fb29a | 226 | ALC883_HAIER_W66, |
4723c022 | 227 | ALC888_3ST_HP, |
5795b9e6 | 228 | ALC888_6ST_DELL, |
a8848bd6 | 229 | ALC883_MITAC, |
0c4cc443 | 230 | ALC883_CLEVO_M720, |
fb97dc67 | 231 | ALC883_FUJITSU_PI2515, |
17bba1b7 | 232 | ALC883_3ST_6ch_INTEL, |
e2757d5e KY |
233 | ALC888_ASUS_M90V, |
234 | ALC888_ASUS_EEE1601, | |
3ab90935 | 235 | ALC1200_ASUS_P5Q, |
9c7f852e TI |
236 | ALC883_AUTO, |
237 | ALC883_MODEL_LAST, | |
238 | }; | |
239 | ||
df694daa KY |
240 | /* for GPIO Poll */ |
241 | #define GPIO_MASK 0x03 | |
242 | ||
1da177e4 LT |
243 | struct alc_spec { |
244 | /* codec parameterization */ | |
df694daa | 245 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
1da177e4 | 246 | unsigned int num_mixers; |
f9e336f6 | 247 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
1da177e4 | 248 | |
df694daa | 249 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
9c7f852e TI |
250 | * don't forget NULL |
251 | * termination! | |
e9edcee0 TI |
252 | */ |
253 | unsigned int num_init_verbs; | |
1da177e4 | 254 | |
16ded525 | 255 | char *stream_name_analog; /* analog PCM stream */ |
1da177e4 LT |
256 | struct hda_pcm_stream *stream_analog_playback; |
257 | struct hda_pcm_stream *stream_analog_capture; | |
6330079f TI |
258 | struct hda_pcm_stream *stream_analog_alt_playback; |
259 | struct hda_pcm_stream *stream_analog_alt_capture; | |
1da177e4 | 260 | |
f12ab1e0 | 261 | char *stream_name_digital; /* digital PCM stream */ |
1da177e4 LT |
262 | struct hda_pcm_stream *stream_digital_playback; |
263 | struct hda_pcm_stream *stream_digital_capture; | |
264 | ||
265 | /* playback */ | |
16ded525 TI |
266 | struct hda_multi_out multiout; /* playback set-up |
267 | * max_channels, dacs must be set | |
268 | * dig_out_nid and hp_nid are optional | |
269 | */ | |
6330079f | 270 | hda_nid_t alt_dac_nid; |
1da177e4 LT |
271 | |
272 | /* capture */ | |
273 | unsigned int num_adc_nids; | |
274 | hda_nid_t *adc_nids; | |
e1406348 | 275 | hda_nid_t *capsrc_nids; |
16ded525 | 276 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
54cbc9ab | 277 | unsigned char is_mix_capture; /* matrix-style capture (non-mux) */ |
1da177e4 LT |
278 | |
279 | /* capture source */ | |
a1e8d2da | 280 | unsigned int num_mux_defs; |
1da177e4 LT |
281 | const struct hda_input_mux *input_mux; |
282 | unsigned int cur_mux[3]; | |
283 | ||
284 | /* channel model */ | |
d2a6d7dc | 285 | const struct hda_channel_mode *channel_mode; |
1da177e4 | 286 | int num_channel_mode; |
4e195a7b | 287 | int need_dac_fix; |
1da177e4 LT |
288 | |
289 | /* PCM information */ | |
4c5186ed | 290 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
41e41f1f | 291 | |
e9edcee0 TI |
292 | /* dynamic controls, init_verbs and input_mux */ |
293 | struct auto_pin_cfg autocfg; | |
603c4019 | 294 | struct snd_array kctls; |
e9edcee0 | 295 | struct hda_input_mux private_imux; |
41923e44 | 296 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
834be88d | 297 | |
ae6b813a TI |
298 | /* hooks */ |
299 | void (*init_hook)(struct hda_codec *codec); | |
300 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
301 | ||
834be88d TI |
302 | /* for pin sensing */ |
303 | unsigned int sense_updated: 1; | |
304 | unsigned int jack_present: 1; | |
bec15c3a | 305 | unsigned int master_sw: 1; |
cb53c626 | 306 | |
2134ea4f TI |
307 | /* for virtual master */ |
308 | hda_nid_t vmaster_nid; | |
cb53c626 TI |
309 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
310 | struct hda_loopback_check loopback; | |
311 | #endif | |
2c3bf9ab TI |
312 | |
313 | /* for PLL fix */ | |
314 | hda_nid_t pll_nid; | |
315 | unsigned int pll_coef_idx, pll_coef_bit; | |
e044c39a TI |
316 | |
317 | #ifdef SND_HDA_NEEDS_RESUME | |
318 | #define ALC_MAX_PINS 16 | |
319 | unsigned int num_pins; | |
320 | hda_nid_t pin_nids[ALC_MAX_PINS]; | |
321 | unsigned int pin_cfgs[ALC_MAX_PINS]; | |
322 | #endif | |
df694daa KY |
323 | }; |
324 | ||
325 | /* | |
326 | * configuration template - to be copied to the spec instance | |
327 | */ | |
328 | struct alc_config_preset { | |
9c7f852e TI |
329 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
330 | * with spec | |
331 | */ | |
f9e336f6 | 332 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
df694daa KY |
333 | const struct hda_verb *init_verbs[5]; |
334 | unsigned int num_dacs; | |
335 | hda_nid_t *dac_nids; | |
336 | hda_nid_t dig_out_nid; /* optional */ | |
337 | hda_nid_t hp_nid; /* optional */ | |
338 | unsigned int num_adc_nids; | |
339 | hda_nid_t *adc_nids; | |
e1406348 | 340 | hda_nid_t *capsrc_nids; |
df694daa KY |
341 | hda_nid_t dig_in_nid; |
342 | unsigned int num_channel_mode; | |
343 | const struct hda_channel_mode *channel_mode; | |
4e195a7b | 344 | int need_dac_fix; |
a1e8d2da | 345 | unsigned int num_mux_defs; |
df694daa | 346 | const struct hda_input_mux *input_mux; |
ae6b813a TI |
347 | void (*unsol_event)(struct hda_codec *, unsigned int); |
348 | void (*init_hook)(struct hda_codec *); | |
cb53c626 TI |
349 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
350 | struct hda_amp_list *loopbacks; | |
351 | #endif | |
1da177e4 LT |
352 | }; |
353 | ||
1da177e4 LT |
354 | |
355 | /* | |
356 | * input MUX handling | |
357 | */ | |
9c7f852e TI |
358 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
359 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
360 | { |
361 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
362 | struct alc_spec *spec = codec->spec; | |
a1e8d2da JW |
363 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
364 | if (mux_idx >= spec->num_mux_defs) | |
365 | mux_idx = 0; | |
366 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | |
1da177e4 LT |
367 | } |
368 | ||
9c7f852e TI |
369 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
370 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
371 | { |
372 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
373 | struct alc_spec *spec = codec->spec; | |
374 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
375 | ||
376 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
377 | return 0; | |
378 | } | |
379 | ||
9c7f852e TI |
380 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
381 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
382 | { |
383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
384 | struct alc_spec *spec = codec->spec; | |
cd896c33 | 385 | const struct hda_input_mux *imux; |
1da177e4 | 386 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
cd896c33 | 387 | unsigned int mux_idx; |
e1406348 TI |
388 | hda_nid_t nid = spec->capsrc_nids ? |
389 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
1da177e4 | 390 | |
cd896c33 TI |
391 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
392 | imux = &spec->input_mux[mux_idx]; | |
393 | ||
54cbc9ab TI |
394 | if (spec->is_mix_capture) { |
395 | /* Matrix-mixer style (e.g. ALC882) */ | |
396 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
397 | unsigned int i, idx; | |
398 | ||
399 | idx = ucontrol->value.enumerated.item[0]; | |
400 | if (idx >= imux->num_items) | |
401 | idx = imux->num_items - 1; | |
402 | if (*cur_val == idx) | |
403 | return 0; | |
404 | for (i = 0; i < imux->num_items; i++) { | |
405 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | |
406 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | |
407 | imux->items[i].index, | |
408 | HDA_AMP_MUTE, v); | |
409 | } | |
410 | *cur_val = idx; | |
411 | return 1; | |
412 | } else { | |
413 | /* MUX style (e.g. ALC880) */ | |
cd896c33 | 414 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
54cbc9ab TI |
415 | &spec->cur_mux[adc_idx]); |
416 | } | |
417 | } | |
e9edcee0 | 418 | |
1da177e4 LT |
419 | /* |
420 | * channel mode setting | |
421 | */ | |
9c7f852e TI |
422 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
423 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
424 | { |
425 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
426 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc TI |
427 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
428 | spec->num_channel_mode); | |
1da177e4 LT |
429 | } |
430 | ||
9c7f852e TI |
431 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
432 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
433 | { |
434 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
435 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc | 436 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
9c7f852e TI |
437 | spec->num_channel_mode, |
438 | spec->multiout.max_channels); | |
1da177e4 LT |
439 | } |
440 | ||
9c7f852e TI |
441 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
442 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
443 | { |
444 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
445 | struct alc_spec *spec = codec->spec; | |
4e195a7b TI |
446 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
447 | spec->num_channel_mode, | |
448 | &spec->multiout.max_channels); | |
bd2033f2 | 449 | if (err >= 0 && spec->need_dac_fix) |
4e195a7b TI |
450 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
451 | return err; | |
1da177e4 LT |
452 | } |
453 | ||
a9430dd8 | 454 | /* |
4c5186ed | 455 | * Control the mode of pin widget settings via the mixer. "pc" is used |
ea1fb29a | 456 | * instead of "%" to avoid consequences of accidently treating the % as |
4c5186ed JW |
457 | * being part of a format specifier. Maximum allowed length of a value is |
458 | * 63 characters plus NULL terminator. | |
7cf51e48 JW |
459 | * |
460 | * Note: some retasking pin complexes seem to ignore requests for input | |
461 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
462 | * are requested. Therefore order this list so that this behaviour will not | |
463 | * cause problems when mixer clients move through the enum sequentially. | |
a1e8d2da JW |
464 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
465 | * March 2006. | |
4c5186ed JW |
466 | */ |
467 | static char *alc_pin_mode_names[] = { | |
7cf51e48 JW |
468 | "Mic 50pc bias", "Mic 80pc bias", |
469 | "Line in", "Line out", "Headphone out", | |
4c5186ed JW |
470 | }; |
471 | static unsigned char alc_pin_mode_values[] = { | |
7cf51e48 | 472 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
4c5186ed JW |
473 | }; |
474 | /* The control can present all 5 options, or it can limit the options based | |
a1e8d2da JW |
475 | * in the pin being assumed to be exclusively an input or an output pin. In |
476 | * addition, "input" pins may or may not process the mic bias option | |
477 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
478 | * accept requests for bias as of chip versions up to March 2006) and/or | |
479 | * wiring in the computer. | |
a9430dd8 | 480 | */ |
a1e8d2da JW |
481 | #define ALC_PIN_DIR_IN 0x00 |
482 | #define ALC_PIN_DIR_OUT 0x01 | |
483 | #define ALC_PIN_DIR_INOUT 0x02 | |
484 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
485 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
4c5186ed | 486 | |
ea1fb29a | 487 | /* Info about the pin modes supported by the different pin direction modes. |
4c5186ed JW |
488 | * For each direction the minimum and maximum values are given. |
489 | */ | |
a1e8d2da | 490 | static signed char alc_pin_mode_dir_info[5][2] = { |
4c5186ed JW |
491 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
492 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
493 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
a1e8d2da JW |
494 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
495 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
4c5186ed JW |
496 | }; |
497 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
498 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
499 | #define alc_pin_mode_n_items(_dir) \ | |
500 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
501 | ||
9c7f852e TI |
502 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
503 | struct snd_ctl_elem_info *uinfo) | |
a9430dd8 | 504 | { |
4c5186ed JW |
505 | unsigned int item_num = uinfo->value.enumerated.item; |
506 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
507 | ||
508 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
a9430dd8 | 509 | uinfo->count = 1; |
4c5186ed JW |
510 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
511 | ||
512 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
513 | item_num = alc_pin_mode_min(dir); | |
514 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
a9430dd8 JW |
515 | return 0; |
516 | } | |
517 | ||
9c7f852e TI |
518 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
519 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 520 | { |
4c5186ed | 521 | unsigned int i; |
a9430dd8 JW |
522 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
523 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed | 524 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
a9430dd8 | 525 | long *valp = ucontrol->value.integer.value; |
9c7f852e TI |
526 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
527 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
528 | 0x00); | |
a9430dd8 | 529 | |
4c5186ed JW |
530 | /* Find enumerated value for current pinctl setting */ |
531 | i = alc_pin_mode_min(dir); | |
9c7f852e | 532 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
4c5186ed | 533 | i++; |
9c7f852e | 534 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
a9430dd8 JW |
535 | return 0; |
536 | } | |
537 | ||
9c7f852e TI |
538 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
539 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 540 | { |
4c5186ed | 541 | signed int change; |
a9430dd8 JW |
542 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
543 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed JW |
544 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
545 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
546 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
547 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
548 | 0x00); | |
a9430dd8 | 549 | |
f12ab1e0 | 550 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
4c5186ed JW |
551 | val = alc_pin_mode_min(dir); |
552 | ||
553 | change = pinctl != alc_pin_mode_values[val]; | |
cdcd9268 JW |
554 | if (change) { |
555 | /* Set pin mode to that requested */ | |
82beb8fd TI |
556 | snd_hda_codec_write_cache(codec, nid, 0, |
557 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
558 | alc_pin_mode_values[val]); | |
cdcd9268 | 559 | |
ea1fb29a | 560 | /* Also enable the retasking pin's input/output as required |
cdcd9268 JW |
561 | * for the requested pin mode. Enum values of 2 or less are |
562 | * input modes. | |
563 | * | |
564 | * Dynamically switching the input/output buffers probably | |
a1e8d2da JW |
565 | * reduces noise slightly (particularly on input) so we'll |
566 | * do it. However, having both input and output buffers | |
567 | * enabled simultaneously doesn't seem to be problematic if | |
568 | * this turns out to be necessary in the future. | |
cdcd9268 JW |
569 | */ |
570 | if (val <= 2) { | |
47fd830a TI |
571 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
572 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
573 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
574 | HDA_AMP_MUTE, 0); | |
cdcd9268 | 575 | } else { |
47fd830a TI |
576 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
577 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
578 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
579 | HDA_AMP_MUTE, 0); | |
cdcd9268 JW |
580 | } |
581 | } | |
a9430dd8 JW |
582 | return change; |
583 | } | |
584 | ||
4c5186ed | 585 | #define ALC_PIN_MODE(xname, nid, dir) \ |
a9430dd8 | 586 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
4c5186ed JW |
587 | .info = alc_pin_mode_info, \ |
588 | .get = alc_pin_mode_get, \ | |
589 | .put = alc_pin_mode_put, \ | |
590 | .private_value = nid | (dir<<16) } | |
df694daa | 591 | |
5c8f858d JW |
592 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
593 | * together using a mask with more than one bit set. This control is | |
594 | * currently used only by the ALC260 test model. At this stage they are not | |
595 | * needed for any "production" models. | |
596 | */ | |
597 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 598 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
f12ab1e0 | 599 | |
9c7f852e TI |
600 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
601 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
602 | { |
603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
604 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
605 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
606 | long *valp = ucontrol->value.integer.value; | |
9c7f852e TI |
607 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
608 | AC_VERB_GET_GPIO_DATA, 0x00); | |
5c8f858d JW |
609 | |
610 | *valp = (val & mask) != 0; | |
611 | return 0; | |
612 | } | |
9c7f852e TI |
613 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
614 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
615 | { |
616 | signed int change; | |
617 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
618 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
619 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
620 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
621 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
622 | AC_VERB_GET_GPIO_DATA, | |
623 | 0x00); | |
5c8f858d JW |
624 | |
625 | /* Set/unset the masked GPIO bit(s) as needed */ | |
9c7f852e TI |
626 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
627 | if (val == 0) | |
5c8f858d JW |
628 | gpio_data &= ~mask; |
629 | else | |
630 | gpio_data |= mask; | |
82beb8fd TI |
631 | snd_hda_codec_write_cache(codec, nid, 0, |
632 | AC_VERB_SET_GPIO_DATA, gpio_data); | |
5c8f858d JW |
633 | |
634 | return change; | |
635 | } | |
636 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
637 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
638 | .info = alc_gpio_data_info, \ | |
639 | .get = alc_gpio_data_get, \ | |
640 | .put = alc_gpio_data_put, \ | |
641 | .private_value = nid | (mask<<16) } | |
642 | #endif /* CONFIG_SND_DEBUG */ | |
643 | ||
92621f13 JW |
644 | /* A switch control to allow the enabling of the digital IO pins on the |
645 | * ALC260. This is incredibly simplistic; the intention of this control is | |
646 | * to provide something in the test model allowing digital outputs to be | |
647 | * identified if present. If models are found which can utilise these | |
648 | * outputs a more complete mixer control can be devised for those models if | |
649 | * necessary. | |
650 | */ | |
651 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 652 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
f12ab1e0 | 653 | |
9c7f852e TI |
654 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
655 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
656 | { |
657 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
658 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
659 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
660 | long *valp = ucontrol->value.integer.value; | |
9c7f852e | 661 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 662 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
92621f13 JW |
663 | |
664 | *valp = (val & mask) != 0; | |
665 | return 0; | |
666 | } | |
9c7f852e TI |
667 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
668 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
669 | { |
670 | signed int change; | |
671 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
672 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
673 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
674 | long val = *ucontrol->value.integer.value; | |
9c7f852e | 675 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 676 | AC_VERB_GET_DIGI_CONVERT_1, |
9c7f852e | 677 | 0x00); |
92621f13 JW |
678 | |
679 | /* Set/unset the masked control bit(s) as needed */ | |
9c7f852e | 680 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
92621f13 JW |
681 | if (val==0) |
682 | ctrl_data &= ~mask; | |
683 | else | |
684 | ctrl_data |= mask; | |
82beb8fd TI |
685 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
686 | ctrl_data); | |
92621f13 JW |
687 | |
688 | return change; | |
689 | } | |
690 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
691 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
692 | .info = alc_spdif_ctrl_info, \ | |
693 | .get = alc_spdif_ctrl_get, \ | |
694 | .put = alc_spdif_ctrl_put, \ | |
695 | .private_value = nid | (mask<<16) } | |
696 | #endif /* CONFIG_SND_DEBUG */ | |
697 | ||
f8225f6d JW |
698 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
699 | * Again, this is only used in the ALC26x test models to help identify when | |
700 | * the EAPD line must be asserted for features to work. | |
701 | */ | |
702 | #ifdef CONFIG_SND_DEBUG | |
703 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | |
704 | ||
705 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | |
706 | struct snd_ctl_elem_value *ucontrol) | |
707 | { | |
708 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
709 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
710 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
711 | long *valp = ucontrol->value.integer.value; | |
712 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
713 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | |
714 | ||
715 | *valp = (val & mask) != 0; | |
716 | return 0; | |
717 | } | |
718 | ||
719 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |
720 | struct snd_ctl_elem_value *ucontrol) | |
721 | { | |
722 | int change; | |
723 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
724 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
725 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
726 | long val = *ucontrol->value.integer.value; | |
727 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
728 | AC_VERB_GET_EAPD_BTLENABLE, | |
729 | 0x00); | |
730 | ||
731 | /* Set/unset the masked control bit(s) as needed */ | |
732 | change = (!val ? 0 : mask) != (ctrl_data & mask); | |
733 | if (!val) | |
734 | ctrl_data &= ~mask; | |
735 | else | |
736 | ctrl_data |= mask; | |
737 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
738 | ctrl_data); | |
739 | ||
740 | return change; | |
741 | } | |
742 | ||
743 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | |
744 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
745 | .info = alc_eapd_ctrl_info, \ | |
746 | .get = alc_eapd_ctrl_get, \ | |
747 | .put = alc_eapd_ctrl_put, \ | |
748 | .private_value = nid | (mask<<16) } | |
749 | #endif /* CONFIG_SND_DEBUG */ | |
750 | ||
d88897ea TI |
751 | /* |
752 | */ | |
753 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | |
754 | { | |
755 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
756 | return; | |
757 | spec->mixers[spec->num_mixers++] = mix; | |
758 | } | |
759 | ||
760 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | |
761 | { | |
762 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) | |
763 | return; | |
764 | spec->init_verbs[spec->num_init_verbs++] = verb; | |
765 | } | |
766 | ||
df694daa KY |
767 | /* |
768 | * set up from the preset table | |
769 | */ | |
9c7f852e TI |
770 | static void setup_preset(struct alc_spec *spec, |
771 | const struct alc_config_preset *preset) | |
df694daa KY |
772 | { |
773 | int i; | |
774 | ||
775 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
d88897ea | 776 | add_mixer(spec, preset->mixers[i]); |
f9e336f6 | 777 | spec->cap_mixer = preset->cap_mixer; |
9c7f852e TI |
778 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
779 | i++) | |
d88897ea | 780 | add_verb(spec, preset->init_verbs[i]); |
ea1fb29a | 781 | |
df694daa KY |
782 | spec->channel_mode = preset->channel_mode; |
783 | spec->num_channel_mode = preset->num_channel_mode; | |
4e195a7b | 784 | spec->need_dac_fix = preset->need_dac_fix; |
df694daa KY |
785 | |
786 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
787 | ||
788 | spec->multiout.num_dacs = preset->num_dacs; | |
789 | spec->multiout.dac_nids = preset->dac_nids; | |
790 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
791 | spec->multiout.hp_nid = preset->hp_nid; | |
ea1fb29a | 792 | |
a1e8d2da | 793 | spec->num_mux_defs = preset->num_mux_defs; |
f12ab1e0 | 794 | if (!spec->num_mux_defs) |
a1e8d2da | 795 | spec->num_mux_defs = 1; |
df694daa KY |
796 | spec->input_mux = preset->input_mux; |
797 | ||
798 | spec->num_adc_nids = preset->num_adc_nids; | |
799 | spec->adc_nids = preset->adc_nids; | |
e1406348 | 800 | spec->capsrc_nids = preset->capsrc_nids; |
df694daa | 801 | spec->dig_in_nid = preset->dig_in_nid; |
ae6b813a TI |
802 | |
803 | spec->unsol_event = preset->unsol_event; | |
804 | spec->init_hook = preset->init_hook; | |
cb53c626 TI |
805 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
806 | spec->loopback.amplist = preset->loopbacks; | |
807 | #endif | |
df694daa KY |
808 | } |
809 | ||
bc9f98a9 KY |
810 | /* Enable GPIO mask and set output */ |
811 | static struct hda_verb alc_gpio1_init_verbs[] = { | |
812 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
813 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
814 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
815 | { } | |
816 | }; | |
817 | ||
818 | static struct hda_verb alc_gpio2_init_verbs[] = { | |
819 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
820 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
821 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
822 | { } | |
823 | }; | |
824 | ||
bdd148a3 KY |
825 | static struct hda_verb alc_gpio3_init_verbs[] = { |
826 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
827 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
828 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
829 | { } | |
830 | }; | |
831 | ||
2c3bf9ab TI |
832 | /* |
833 | * Fix hardware PLL issue | |
834 | * On some codecs, the analog PLL gating control must be off while | |
835 | * the default value is 1. | |
836 | */ | |
837 | static void alc_fix_pll(struct hda_codec *codec) | |
838 | { | |
839 | struct alc_spec *spec = codec->spec; | |
840 | unsigned int val; | |
841 | ||
842 | if (!spec->pll_nid) | |
843 | return; | |
844 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
845 | spec->pll_coef_idx); | |
846 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | |
847 | AC_VERB_GET_PROC_COEF, 0); | |
848 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
849 | spec->pll_coef_idx); | |
850 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | |
851 | val & ~(1 << spec->pll_coef_bit)); | |
852 | } | |
853 | ||
854 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
855 | unsigned int coef_idx, unsigned int coef_bit) | |
856 | { | |
857 | struct alc_spec *spec = codec->spec; | |
858 | spec->pll_nid = nid; | |
859 | spec->pll_coef_idx = coef_idx; | |
860 | spec->pll_coef_bit = coef_bit; | |
861 | alc_fix_pll(codec); | |
862 | } | |
863 | ||
c9b58006 KY |
864 | static void alc_sku_automute(struct hda_codec *codec) |
865 | { | |
866 | struct alc_spec *spec = codec->spec; | |
c9b58006 KY |
867 | unsigned int present; |
868 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; | |
869 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; | |
870 | ||
871 | /* need to execute and sync at first */ | |
872 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); | |
873 | present = snd_hda_codec_read(codec, hp_nid, 0, | |
874 | AC_VERB_GET_PIN_SENSE, 0); | |
875 | spec->jack_present = (present & 0x80000000) != 0; | |
f6c7e546 TI |
876 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
877 | spec->jack_present ? 0 : PIN_OUT); | |
c9b58006 KY |
878 | } |
879 | ||
4605b718 | 880 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
7fb0d78f KY |
881 | static void alc_mic_automute(struct hda_codec *codec) |
882 | { | |
883 | struct alc_spec *spec = codec->spec; | |
884 | unsigned int present; | |
885 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | |
886 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | |
887 | unsigned int mix_nid = spec->capsrc_nids[0]; | |
888 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; | |
889 | ||
890 | capsrc_idx_mic = mic_nid - 0x18; | |
891 | capsrc_idx_fmic = fmic_nid - 0x18; | |
892 | present = snd_hda_codec_read(codec, mic_nid, 0, | |
893 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
894 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
895 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); | |
896 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
897 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); | |
898 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, | |
899 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
900 | } | |
4605b718 TI |
901 | #else |
902 | #define alc_mic_automute(codec) /* NOP */ | |
903 | #endif /* disabled */ | |
7fb0d78f | 904 | |
c9b58006 KY |
905 | /* unsolicited event for HP jack sensing */ |
906 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |
907 | { | |
908 | if (codec->vendor_id == 0x10ec0880) | |
909 | res >>= 28; | |
910 | else | |
911 | res >>= 26; | |
7fb0d78f KY |
912 | if (res == ALC880_HP_EVENT) |
913 | alc_sku_automute(codec); | |
c9b58006 | 914 | |
7fb0d78f KY |
915 | if (res == ALC880_MIC_EVENT) |
916 | alc_mic_automute(codec); | |
917 | } | |
918 | ||
919 | static void alc_inithook(struct hda_codec *codec) | |
920 | { | |
c9b58006 | 921 | alc_sku_automute(codec); |
7fb0d78f | 922 | alc_mic_automute(codec); |
c9b58006 KY |
923 | } |
924 | ||
f9423e7a KY |
925 | /* additional initialization for ALC888 variants */ |
926 | static void alc888_coef_init(struct hda_codec *codec) | |
927 | { | |
928 | unsigned int tmp; | |
929 | ||
930 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | |
931 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
932 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
933 | if ((tmp & 0xf0) == 2) | |
934 | /* alc888S-VC */ | |
935 | snd_hda_codec_read(codec, 0x20, 0, | |
936 | AC_VERB_SET_PROC_COEF, 0x830); | |
937 | else | |
938 | /* alc888-VB */ | |
939 | snd_hda_codec_read(codec, 0x20, 0, | |
940 | AC_VERB_SET_PROC_COEF, 0x3030); | |
941 | } | |
942 | ||
bc9f98a9 KY |
943 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
944 | * 31 ~ 16 : Manufacture ID | |
945 | * 15 ~ 8 : SKU ID | |
946 | * 7 ~ 0 : Assembly ID | |
947 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
948 | */ | |
949 | static void alc_subsystem_id(struct hda_codec *codec, | |
950 | unsigned int porta, unsigned int porte, | |
951 | unsigned int portd) | |
952 | { | |
c9b58006 KY |
953 | unsigned int ass, tmp, i; |
954 | unsigned nid; | |
955 | struct alc_spec *spec = codec->spec; | |
bc9f98a9 | 956 | |
c9b58006 KY |
957 | ass = codec->subsystem_id & 0xffff; |
958 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
959 | goto do_sku; | |
960 | ||
ea1fb29a | 961 | /* |
c9b58006 KY |
962 | * 31~30 : port conetcivity |
963 | * 29~21 : reserve | |
964 | * 20 : PCBEEP input | |
965 | * 19~16 : Check sum (15:1) | |
966 | * 15~1 : Custom | |
967 | * 0 : override | |
968 | */ | |
969 | nid = 0x1d; | |
970 | if (codec->vendor_id == 0x10ec0260) | |
971 | nid = 0x17; | |
972 | ass = snd_hda_codec_read(codec, nid, 0, | |
973 | AC_VERB_GET_CONFIG_DEFAULT, 0); | |
974 | if (!(ass & 1) && !(ass & 0x100000)) | |
975 | return; | |
976 | if ((ass >> 30) != 1) /* no physical connection */ | |
bc9f98a9 KY |
977 | return; |
978 | ||
c9b58006 KY |
979 | /* check sum */ |
980 | tmp = 0; | |
981 | for (i = 1; i < 16; i++) { | |
8c427226 | 982 | if ((ass >> i) & 1) |
c9b58006 KY |
983 | tmp++; |
984 | } | |
985 | if (((ass >> 16) & 0xf) != tmp) | |
986 | return; | |
987 | do_sku: | |
988 | /* | |
989 | * 0 : override | |
990 | * 1 : Swap Jack | |
991 | * 2 : 0 --> Desktop, 1 --> Laptop | |
992 | * 3~5 : External Amplifier control | |
993 | * 7~6 : Reserved | |
994 | */ | |
bc9f98a9 KY |
995 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
996 | switch (tmp) { | |
997 | case 1: | |
998 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); | |
999 | break; | |
1000 | case 3: | |
1001 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); | |
1002 | break; | |
bdd148a3 KY |
1003 | case 7: |
1004 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); | |
1005 | break; | |
c9b58006 | 1006 | case 5: /* set EAPD output high */ |
bdd148a3 | 1007 | switch (codec->vendor_id) { |
c9b58006 KY |
1008 | case 0x10ec0260: |
1009 | snd_hda_codec_write(codec, 0x0f, 0, | |
1010 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1011 | snd_hda_codec_write(codec, 0x10, 0, | |
1012 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1013 | break; | |
1014 | case 0x10ec0262: | |
bdd148a3 KY |
1015 | case 0x10ec0267: |
1016 | case 0x10ec0268: | |
c9b58006 | 1017 | case 0x10ec0269: |
f9423e7a KY |
1018 | case 0x10ec0660: |
1019 | case 0x10ec0662: | |
1020 | case 0x10ec0663: | |
c9b58006 | 1021 | case 0x10ec0862: |
20a3a05d | 1022 | case 0x10ec0889: |
bdd148a3 KY |
1023 | snd_hda_codec_write(codec, 0x14, 0, |
1024 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1025 | snd_hda_codec_write(codec, 0x15, 0, | |
1026 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
c9b58006 | 1027 | break; |
bdd148a3 | 1028 | } |
c9b58006 KY |
1029 | switch (codec->vendor_id) { |
1030 | case 0x10ec0260: | |
1031 | snd_hda_codec_write(codec, 0x1a, 0, | |
1032 | AC_VERB_SET_COEF_INDEX, 7); | |
1033 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | |
1034 | AC_VERB_GET_PROC_COEF, 0); | |
1035 | snd_hda_codec_write(codec, 0x1a, 0, | |
1036 | AC_VERB_SET_COEF_INDEX, 7); | |
1037 | snd_hda_codec_write(codec, 0x1a, 0, | |
1038 | AC_VERB_SET_PROC_COEF, | |
1039 | tmp | 0x2010); | |
1040 | break; | |
1041 | case 0x10ec0262: | |
1042 | case 0x10ec0880: | |
1043 | case 0x10ec0882: | |
1044 | case 0x10ec0883: | |
1045 | case 0x10ec0885: | |
20a3a05d | 1046 | case 0x10ec0889: |
c9b58006 KY |
1047 | snd_hda_codec_write(codec, 0x20, 0, |
1048 | AC_VERB_SET_COEF_INDEX, 7); | |
1049 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1050 | AC_VERB_GET_PROC_COEF, 0); | |
1051 | snd_hda_codec_write(codec, 0x20, 0, | |
ea1fb29a | 1052 | AC_VERB_SET_COEF_INDEX, 7); |
c9b58006 KY |
1053 | snd_hda_codec_write(codec, 0x20, 0, |
1054 | AC_VERB_SET_PROC_COEF, | |
1055 | tmp | 0x2010); | |
1056 | break; | |
f9423e7a | 1057 | case 0x10ec0888: |
1082c748 | 1058 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
f9423e7a | 1059 | break; |
c9b58006 KY |
1060 | case 0x10ec0267: |
1061 | case 0x10ec0268: | |
1062 | snd_hda_codec_write(codec, 0x20, 0, | |
1063 | AC_VERB_SET_COEF_INDEX, 7); | |
1064 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1065 | AC_VERB_GET_PROC_COEF, 0); | |
1066 | snd_hda_codec_write(codec, 0x20, 0, | |
ea1fb29a | 1067 | AC_VERB_SET_COEF_INDEX, 7); |
c9b58006 KY |
1068 | snd_hda_codec_write(codec, 0x20, 0, |
1069 | AC_VERB_SET_PROC_COEF, | |
1070 | tmp | 0x3000); | |
1071 | break; | |
bc9f98a9 | 1072 | } |
c9b58006 | 1073 | default: |
bc9f98a9 KY |
1074 | break; |
1075 | } | |
ea1fb29a | 1076 | |
8c427226 | 1077 | /* is laptop or Desktop and enable the function "Mute internal speaker |
c9b58006 KY |
1078 | * when the external headphone out jack is plugged" |
1079 | */ | |
8c427226 | 1080 | if (!(ass & 0x8000)) |
c9b58006 KY |
1081 | return; |
1082 | /* | |
1083 | * 10~8 : Jack location | |
1084 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
1085 | * 14~13: Resvered | |
1086 | * 15 : 1 --> enable the function "Mute internal speaker | |
1087 | * when the external headphone out jack is plugged" | |
1088 | */ | |
1089 | if (!spec->autocfg.speaker_pins[0]) { | |
8c427226 | 1090 | if (spec->autocfg.line_out_pins[0]) |
c9b58006 | 1091 | spec->autocfg.speaker_pins[0] = |
8c427226 | 1092 | spec->autocfg.line_out_pins[0]; |
c9b58006 KY |
1093 | else |
1094 | return; | |
1095 | } | |
1096 | ||
1097 | if (!spec->autocfg.hp_pins[0]) { | |
1098 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | |
1099 | if (tmp == 0) | |
1100 | spec->autocfg.hp_pins[0] = porta; | |
1101 | else if (tmp == 1) | |
1102 | spec->autocfg.hp_pins[0] = porte; | |
1103 | else if (tmp == 2) | |
1104 | spec->autocfg.hp_pins[0] = portd; | |
1105 | else | |
1106 | return; | |
1107 | } | |
7fb0d78f KY |
1108 | if (spec->autocfg.hp_pins[0]) |
1109 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, | |
1110 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1111 | AC_USRSP_EN | ALC880_HP_EVENT); | |
c9b58006 | 1112 | |
4605b718 | 1113 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
7fb0d78f KY |
1114 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
1115 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) | |
1116 | snd_hda_codec_write(codec, | |
1117 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, | |
1118 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1119 | AC_USRSP_EN | ALC880_MIC_EVENT); | |
4605b718 | 1120 | #endif /* disabled */ |
ea1fb29a | 1121 | |
c9b58006 | 1122 | spec->unsol_event = alc_sku_unsol_event; |
bc9f98a9 KY |
1123 | } |
1124 | ||
f95474ec TI |
1125 | /* |
1126 | * Fix-up pin default configurations | |
1127 | */ | |
1128 | ||
1129 | struct alc_pincfg { | |
1130 | hda_nid_t nid; | |
1131 | u32 val; | |
1132 | }; | |
1133 | ||
1134 | static void alc_fix_pincfg(struct hda_codec *codec, | |
1135 | const struct snd_pci_quirk *quirk, | |
1136 | const struct alc_pincfg **pinfix) | |
1137 | { | |
1138 | const struct alc_pincfg *cfg; | |
1139 | ||
1140 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
1141 | if (!quirk) | |
1142 | return; | |
1143 | ||
1144 | cfg = pinfix[quirk->value]; | |
1145 | for (; cfg->nid; cfg++) { | |
1146 | int i; | |
1147 | u32 val = cfg->val; | |
1148 | for (i = 0; i < 4; i++) { | |
1149 | snd_hda_codec_write(codec, cfg->nid, 0, | |
1150 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, | |
1151 | val & 0xff); | |
1152 | val >>= 8; | |
1153 | } | |
1154 | } | |
1155 | } | |
1156 | ||
1da177e4 | 1157 | /* |
e9edcee0 TI |
1158 | * ALC880 3-stack model |
1159 | * | |
1160 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
9c7f852e TI |
1161 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
1162 | * F-Mic = 0x1b, HP = 0x19 | |
1da177e4 LT |
1163 | */ |
1164 | ||
e9edcee0 TI |
1165 | static hda_nid_t alc880_dac_nids[4] = { |
1166 | /* front, rear, clfe, rear_surr */ | |
1167 | 0x02, 0x05, 0x04, 0x03 | |
1168 | }; | |
1169 | ||
1170 | static hda_nid_t alc880_adc_nids[3] = { | |
1171 | /* ADC0-2 */ | |
1172 | 0x07, 0x08, 0x09, | |
1173 | }; | |
1174 | ||
1175 | /* The datasheet says the node 0x07 is connected from inputs, | |
1176 | * but it shows zero connection in the real implementation on some devices. | |
df694daa | 1177 | * Note: this is a 915GAV bug, fixed on 915GLV |
1da177e4 | 1178 | */ |
e9edcee0 TI |
1179 | static hda_nid_t alc880_adc_nids_alt[2] = { |
1180 | /* ADC1-2 */ | |
1181 | 0x08, 0x09, | |
1182 | }; | |
1183 | ||
1184 | #define ALC880_DIGOUT_NID 0x06 | |
1185 | #define ALC880_DIGIN_NID 0x0a | |
1186 | ||
1187 | static struct hda_input_mux alc880_capture_source = { | |
1188 | .num_items = 4, | |
1189 | .items = { | |
1190 | { "Mic", 0x0 }, | |
1191 | { "Front Mic", 0x3 }, | |
1192 | { "Line", 0x2 }, | |
1193 | { "CD", 0x4 }, | |
1194 | }, | |
1195 | }; | |
1196 | ||
1197 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
1198 | /* 2ch mode */ | |
1199 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
1200 | /* set line-in to input, mute it */ | |
1201 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1202 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1203 | /* set mic-in to input vref 80%, mute it */ | |
1204 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1205 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1206 | { } /* end */ | |
1207 | }; | |
1208 | ||
1209 | /* 6ch mode */ | |
1210 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
1211 | /* set line-in to output, unmute it */ | |
1212 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1213 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1214 | /* set mic-in to output, unmute it */ | |
1215 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1216 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1217 | { } /* end */ | |
1218 | }; | |
1219 | ||
d2a6d7dc | 1220 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
e9edcee0 TI |
1221 | { 2, alc880_threestack_ch2_init }, |
1222 | { 6, alc880_threestack_ch6_init }, | |
1223 | }; | |
1224 | ||
c8b6bf9b | 1225 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
05acb863 | 1226 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1227 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 1228 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 1229 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
05acb863 TI |
1230 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1231 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1232 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1233 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1da177e4 LT |
1234 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1235 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1237 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1238 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1240 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
1241 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
1242 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1243 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
e9edcee0 TI |
1244 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
1245 | { | |
1246 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1247 | .name = "Channel Mode", | |
df694daa KY |
1248 | .info = alc_ch_mode_info, |
1249 | .get = alc_ch_mode_get, | |
1250 | .put = alc_ch_mode_put, | |
e9edcee0 TI |
1251 | }, |
1252 | { } /* end */ | |
1253 | }; | |
1254 | ||
1255 | /* capture mixer elements */ | |
f9e336f6 TI |
1256 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
1257 | struct snd_ctl_elem_info *uinfo) | |
1258 | { | |
1259 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
1260 | struct alc_spec *spec = codec->spec; | |
1261 | int err; | |
1da177e4 | 1262 | |
f9e336f6 TI |
1263 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
1264 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | |
1265 | HDA_INPUT); | |
1266 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | |
1267 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ | |
1268 | return err; | |
1269 | } | |
1270 | ||
1271 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |
1272 | unsigned int size, unsigned int __user *tlv) | |
1273 | { | |
1274 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
1275 | struct alc_spec *spec = codec->spec; | |
1276 | int err; | |
1da177e4 | 1277 | |
f9e336f6 TI |
1278 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
1279 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | |
1280 | HDA_INPUT); | |
1281 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | |
1282 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ | |
1283 | return err; | |
1284 | } | |
1285 | ||
1286 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, | |
1287 | struct snd_ctl_elem_value *ucontrol); | |
1288 | ||
1289 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | |
1290 | struct snd_ctl_elem_value *ucontrol, | |
1291 | getput_call_t func) | |
1292 | { | |
1293 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
1294 | struct alc_spec *spec = codec->spec; | |
1295 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
1296 | int err; | |
1297 | ||
1298 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ | |
1299 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], | |
1300 | 3, 0, HDA_INPUT); | |
1301 | err = func(kcontrol, ucontrol); | |
1302 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ | |
1303 | return err; | |
1304 | } | |
1305 | ||
1306 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, | |
1307 | struct snd_ctl_elem_value *ucontrol) | |
1308 | { | |
1309 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
1310 | snd_hda_mixer_amp_volume_get); | |
1311 | } | |
1312 | ||
1313 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, | |
1314 | struct snd_ctl_elem_value *ucontrol) | |
1315 | { | |
1316 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
1317 | snd_hda_mixer_amp_volume_put); | |
1318 | } | |
1319 | ||
1320 | /* capture mixer elements */ | |
1321 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info | |
1322 | ||
1323 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, | |
1324 | struct snd_ctl_elem_value *ucontrol) | |
1325 | { | |
1326 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
1327 | snd_hda_mixer_amp_switch_get); | |
1328 | } | |
1329 | ||
1330 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |
1331 | struct snd_ctl_elem_value *ucontrol) | |
1332 | { | |
1333 | return alc_cap_getput_caller(kcontrol, ucontrol, | |
1334 | snd_hda_mixer_amp_switch_put); | |
1335 | } | |
1336 | ||
1337 | #define DEFINE_CAPMIX(num) \ | |
1338 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |
1339 | { \ | |
1340 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
1341 | .name = "Capture Switch", \ | |
1342 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | |
1343 | .count = num, \ | |
1344 | .info = alc_cap_sw_info, \ | |
1345 | .get = alc_cap_sw_get, \ | |
1346 | .put = alc_cap_sw_put, \ | |
1347 | }, \ | |
1348 | { \ | |
1349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
1350 | .name = "Capture Volume", \ | |
1351 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | |
1352 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | |
1353 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ | |
1354 | .count = num, \ | |
1355 | .info = alc_cap_vol_info, \ | |
1356 | .get = alc_cap_vol_get, \ | |
1357 | .put = alc_cap_vol_put, \ | |
1358 | .tlv = { .c = alc_cap_vol_tlv }, \ | |
1359 | }, \ | |
3c3e9892 TI |
1360 | { \ |
1361 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
1362 | /* .name = "Capture Source", */ \ | |
1363 | .name = "Input Source", \ | |
1364 | .count = num, \ | |
1365 | .info = alc_mux_enum_info, \ | |
1366 | .get = alc_mux_enum_get, \ | |
1367 | .put = alc_mux_enum_put, \ | |
1368 | }, \ | |
f9e336f6 TI |
1369 | { } /* end */ \ |
1370 | } | |
1371 | ||
1372 | /* up to three ADCs */ | |
1373 | DEFINE_CAPMIX(1); | |
1374 | DEFINE_CAPMIX(2); | |
1375 | DEFINE_CAPMIX(3); | |
e9edcee0 TI |
1376 | |
1377 | ||
1378 | /* | |
1379 | * ALC880 5-stack model | |
1380 | * | |
9c7f852e TI |
1381 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
1382 | * Side = 0x02 (0xd) | |
e9edcee0 TI |
1383 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
1384 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
1385 | */ | |
1386 | ||
1387 | /* additional mixers to alc880_three_stack_mixer */ | |
c8b6bf9b | 1388 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
e9edcee0 | 1389 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1390 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
1da177e4 LT |
1391 | { } /* end */ |
1392 | }; | |
1393 | ||
e9edcee0 TI |
1394 | /* channel source setting (6/8 channel selection for 5-stack) */ |
1395 | /* 6ch mode */ | |
1396 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
1397 | /* set line-in to input, mute it */ | |
1398 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1399 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
dfc0ff62 TI |
1400 | { } /* end */ |
1401 | }; | |
1402 | ||
e9edcee0 TI |
1403 | /* 8ch mode */ |
1404 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
1405 | /* set line-in to output, unmute it */ | |
1406 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1407 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1408 | { } /* end */ | |
1409 | }; | |
1410 | ||
d2a6d7dc | 1411 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
e9edcee0 TI |
1412 | { 6, alc880_fivestack_ch6_init }, |
1413 | { 8, alc880_fivestack_ch8_init }, | |
1414 | }; | |
1415 | ||
1416 | ||
1417 | /* | |
1418 | * ALC880 6-stack model | |
1419 | * | |
9c7f852e TI |
1420 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
1421 | * Side = 0x05 (0x0f) | |
e9edcee0 TI |
1422 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
1423 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
1424 | */ | |
1425 | ||
1426 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
1427 | /* front, rear, clfe, rear_surr */ | |
1428 | 0x02, 0x03, 0x04, 0x05 | |
f12ab1e0 | 1429 | }; |
e9edcee0 TI |
1430 | |
1431 | static struct hda_input_mux alc880_6stack_capture_source = { | |
1432 | .num_items = 4, | |
1433 | .items = { | |
1434 | { "Mic", 0x0 }, | |
1435 | { "Front Mic", 0x1 }, | |
1436 | { "Line", 0x2 }, | |
1437 | { "CD", 0x4 }, | |
1438 | }, | |
1439 | }; | |
1440 | ||
1441 | /* fixed 8-channels */ | |
d2a6d7dc | 1442 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
e9edcee0 TI |
1443 | { 8, NULL }, |
1444 | }; | |
1445 | ||
c8b6bf9b | 1446 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
16ded525 | 1447 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1448 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1449 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1450 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1451 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1452 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1453 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1454 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 | 1455 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 1456 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
16ded525 TI |
1457 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1458 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1459 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1460 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1461 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1463 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1464 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1465 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1466 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
16ded525 TI |
1467 | { |
1468 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1469 | .name = "Channel Mode", | |
df694daa KY |
1470 | .info = alc_ch_mode_info, |
1471 | .get = alc_ch_mode_get, | |
1472 | .put = alc_ch_mode_put, | |
16ded525 TI |
1473 | }, |
1474 | { } /* end */ | |
1475 | }; | |
1476 | ||
e9edcee0 TI |
1477 | |
1478 | /* | |
1479 | * ALC880 W810 model | |
1480 | * | |
1481 | * W810 has rear IO for: | |
1482 | * Front (DAC 02) | |
1483 | * Surround (DAC 03) | |
1484 | * Center/LFE (DAC 04) | |
1485 | * Digital out (06) | |
1486 | * | |
1487 | * The system also has a pair of internal speakers, and a headphone jack. | |
1488 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
ea1fb29a | 1489 | * |
e9edcee0 TI |
1490 | * There is a variable resistor to control the speaker or headphone |
1491 | * volume. This is a hardware-only device without a software API. | |
1492 | * | |
1493 | * Plugging headphones in will disable the internal speakers. This is | |
1494 | * implemented in hardware, not via the driver using jack sense. In | |
1495 | * a similar fashion, plugging into the rear socket marked "front" will | |
1496 | * disable both the speakers and headphones. | |
1497 | * | |
1498 | * For input, there's a microphone jack, and an "audio in" jack. | |
1499 | * These may not do anything useful with this driver yet, because I | |
1500 | * haven't setup any initialization verbs for these yet... | |
1501 | */ | |
1502 | ||
1503 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
1504 | /* front, rear/surround, clfe */ | |
1505 | 0x02, 0x03, 0x04 | |
16ded525 TI |
1506 | }; |
1507 | ||
e9edcee0 | 1508 | /* fixed 6 channels */ |
d2a6d7dc | 1509 | static struct hda_channel_mode alc880_w810_modes[1] = { |
e9edcee0 TI |
1510 | { 6, NULL } |
1511 | }; | |
1512 | ||
1513 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
c8b6bf9b | 1514 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
16ded525 | 1515 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1516 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1517 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1518 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1519 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1520 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1521 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1522 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
e9edcee0 TI |
1523 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
1524 | { } /* end */ | |
1525 | }; | |
1526 | ||
1527 | ||
1528 | /* | |
1529 | * Z710V model | |
1530 | * | |
1531 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
9c7f852e TI |
1532 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
1533 | * Line = 0x1a | |
e9edcee0 TI |
1534 | */ |
1535 | ||
1536 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
1537 | 0x02 | |
1538 | }; | |
1539 | #define ALC880_Z71V_HP_DAC 0x03 | |
1540 | ||
1541 | /* fixed 2 channels */ | |
d2a6d7dc | 1542 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
e9edcee0 TI |
1543 | { 2, NULL } |
1544 | }; | |
1545 | ||
c8b6bf9b | 1546 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
e9edcee0 | 1547 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1548 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
e9edcee0 | 1549 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1550 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1551 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1552 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16ded525 TI |
1553 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1554 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
1555 | { } /* end */ |
1556 | }; | |
1557 | ||
e9edcee0 | 1558 | |
e9edcee0 TI |
1559 | /* |
1560 | * ALC880 F1734 model | |
1561 | * | |
1562 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
1563 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
1564 | */ | |
1565 | ||
1566 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
1567 | 0x03 | |
1568 | }; | |
1569 | #define ALC880_F1734_HP_DAC 0x02 | |
1570 | ||
c8b6bf9b | 1571 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
e9edcee0 | 1572 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1573 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
2134ea4f TI |
1574 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
1575 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
e9edcee0 TI |
1576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1577 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
937b4160 TI |
1578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
1579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e9edcee0 TI |
1580 | { } /* end */ |
1581 | }; | |
1582 | ||
937b4160 TI |
1583 | static struct hda_input_mux alc880_f1734_capture_source = { |
1584 | .num_items = 2, | |
1585 | .items = { | |
1586 | { "Mic", 0x1 }, | |
1587 | { "CD", 0x4 }, | |
1588 | }, | |
1589 | }; | |
1590 | ||
e9edcee0 | 1591 | |
e9edcee0 TI |
1592 | /* |
1593 | * ALC880 ASUS model | |
1594 | * | |
1595 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
1596 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
1597 | * Mic = 0x18, Line = 0x1a | |
1598 | */ | |
1599 | ||
1600 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
1601 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
1602 | ||
c8b6bf9b | 1603 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
16ded525 | 1604 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1605 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1606 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1607 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1608 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1609 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1610 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1611 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 TI |
1612 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1613 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1614 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1615 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16ded525 TI |
1616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
1618 | { |
1619 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1620 | .name = "Channel Mode", | |
df694daa KY |
1621 | .info = alc_ch_mode_info, |
1622 | .get = alc_ch_mode_get, | |
1623 | .put = alc_ch_mode_put, | |
16ded525 TI |
1624 | }, |
1625 | { } /* end */ | |
1626 | }; | |
e9edcee0 | 1627 | |
e9edcee0 TI |
1628 | /* |
1629 | * ALC880 ASUS W1V model | |
1630 | * | |
1631 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
1632 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
1633 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
1634 | */ | |
1635 | ||
1636 | /* additional mixers to alc880_asus_mixer */ | |
c8b6bf9b | 1637 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
e9edcee0 TI |
1638 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
1639 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
1640 | { } /* end */ | |
1641 | }; | |
1642 | ||
3c10a9d9 | 1643 | /* additional mixers to alc880_asus_mixer */ |
c8b6bf9b | 1644 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
3c10a9d9 TI |
1645 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
1646 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1647 | { } /* end */ | |
1648 | }; | |
e9edcee0 | 1649 | |
df694daa KY |
1650 | /* TCL S700 */ |
1651 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
1652 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1653 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
1654 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
1655 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
1656 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
1657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
1658 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
1659 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
1660 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
df694daa KY |
1661 | { } /* end */ |
1662 | }; | |
1663 | ||
ccc656ce KY |
1664 | /* Uniwill */ |
1665 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2134ea4f TI |
1666 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
1667 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1668 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1669 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
1670 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1671 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1672 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1673 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1674 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1675 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1676 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1677 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1678 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1679 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1680 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1681 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1682 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1683 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1684 | { | |
1685 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1686 | .name = "Channel Mode", | |
1687 | .info = alc_ch_mode_info, | |
1688 | .get = alc_ch_mode_get, | |
1689 | .put = alc_ch_mode_put, | |
1690 | }, | |
1691 | { } /* end */ | |
1692 | }; | |
1693 | ||
2cf9f0fc TD |
1694 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
1695 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1696 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1697 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1698 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
1699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1700 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1701 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1702 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1703 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1704 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1705 | { } /* end */ | |
1706 | }; | |
1707 | ||
ccc656ce | 1708 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
2134ea4f TI |
1709 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
1710 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1711 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1712 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
1713 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1714 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1715 | { } /* end */ | |
1716 | }; | |
1717 | ||
2134ea4f TI |
1718 | /* |
1719 | * virtual master controls | |
1720 | */ | |
1721 | ||
1722 | /* | |
1723 | * slave controls for virtual master | |
1724 | */ | |
1725 | static const char *alc_slave_vols[] = { | |
1726 | "Front Playback Volume", | |
1727 | "Surround Playback Volume", | |
1728 | "Center Playback Volume", | |
1729 | "LFE Playback Volume", | |
1730 | "Side Playback Volume", | |
1731 | "Headphone Playback Volume", | |
1732 | "Speaker Playback Volume", | |
1733 | "Mono Playback Volume", | |
2134ea4f | 1734 | "Line-Out Playback Volume", |
26f5df26 | 1735 | "PCM Playback Volume", |
2134ea4f TI |
1736 | NULL, |
1737 | }; | |
1738 | ||
1739 | static const char *alc_slave_sws[] = { | |
1740 | "Front Playback Switch", | |
1741 | "Surround Playback Switch", | |
1742 | "Center Playback Switch", | |
1743 | "LFE Playback Switch", | |
1744 | "Side Playback Switch", | |
1745 | "Headphone Playback Switch", | |
1746 | "Speaker Playback Switch", | |
1747 | "Mono Playback Switch", | |
edb54a55 | 1748 | "IEC958 Playback Switch", |
2134ea4f TI |
1749 | NULL, |
1750 | }; | |
1751 | ||
1da177e4 | 1752 | /* |
e9edcee0 | 1753 | * build control elements |
1da177e4 | 1754 | */ |
603c4019 TI |
1755 | |
1756 | static void alc_free_kctls(struct hda_codec *codec); | |
1757 | ||
1da177e4 LT |
1758 | static int alc_build_controls(struct hda_codec *codec) |
1759 | { | |
1760 | struct alc_spec *spec = codec->spec; | |
1761 | int err; | |
1762 | int i; | |
1763 | ||
1764 | for (i = 0; i < spec->num_mixers; i++) { | |
1765 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
1766 | if (err < 0) | |
1767 | return err; | |
1768 | } | |
f9e336f6 TI |
1769 | if (spec->cap_mixer) { |
1770 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); | |
1771 | if (err < 0) | |
1772 | return err; | |
1773 | } | |
1da177e4 | 1774 | if (spec->multiout.dig_out_nid) { |
9c7f852e TI |
1775 | err = snd_hda_create_spdif_out_ctls(codec, |
1776 | spec->multiout.dig_out_nid); | |
1da177e4 LT |
1777 | if (err < 0) |
1778 | return err; | |
9a08160b TI |
1779 | err = snd_hda_create_spdif_share_sw(codec, |
1780 | &spec->multiout); | |
1781 | if (err < 0) | |
1782 | return err; | |
1783 | spec->multiout.share_spdif = 1; | |
1da177e4 LT |
1784 | } |
1785 | if (spec->dig_in_nid) { | |
1786 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
1787 | if (err < 0) | |
1788 | return err; | |
1789 | } | |
2134ea4f TI |
1790 | |
1791 | /* if we have no master control, let's create it */ | |
1792 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
1c82ed1b | 1793 | unsigned int vmaster_tlv[4]; |
2134ea4f | 1794 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
1c82ed1b | 1795 | HDA_OUTPUT, vmaster_tlv); |
2134ea4f | 1796 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1c82ed1b | 1797 | vmaster_tlv, alc_slave_vols); |
2134ea4f TI |
1798 | if (err < 0) |
1799 | return err; | |
1800 | } | |
1801 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
1802 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | |
1803 | NULL, alc_slave_sws); | |
1804 | if (err < 0) | |
1805 | return err; | |
1806 | } | |
1807 | ||
603c4019 | 1808 | alc_free_kctls(codec); /* no longer needed */ |
1da177e4 LT |
1809 | return 0; |
1810 | } | |
1811 | ||
e9edcee0 | 1812 | |
1da177e4 LT |
1813 | /* |
1814 | * initialize the codec volumes, etc | |
1815 | */ | |
1816 | ||
e9edcee0 TI |
1817 | /* |
1818 | * generic initialization of ADC, input mixers and output mixers | |
1819 | */ | |
1820 | static struct hda_verb alc880_volume_init_verbs[] = { | |
1821 | /* | |
1822 | * Unmute ADC0-2 and set the default input to mic-in | |
1823 | */ | |
71fe7b82 | 1824 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 1826 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1827 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 1828 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1829 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 1830 | |
e9edcee0 TI |
1831 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
1832 | * mixer widget | |
9c7f852e TI |
1833 | * Note: PASD motherboards uses the Line In 2 as the input for front |
1834 | * panel mic (mic 2) | |
1da177e4 | 1835 | */ |
e9edcee0 | 1836 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
cb53c626 TI |
1837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
1840 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
1841 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1842 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
1843 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
1da177e4 | 1844 | |
e9edcee0 TI |
1845 | /* |
1846 | * Set up output mixers (0x0c - 0x0f) | |
1da177e4 | 1847 | */ |
e9edcee0 TI |
1848 | /* set vol=0 to output mixers */ |
1849 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1850 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1851 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1852 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1853 | /* set up input amps for analog loopback */ | |
1854 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
05acb863 TI |
1855 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1856 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1857 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1858 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1859 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1860 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1861 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1862 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
1863 | |
1864 | { } | |
1865 | }; | |
1866 | ||
e9edcee0 TI |
1867 | /* |
1868 | * 3-stack pin configuration: | |
1869 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
1870 | */ | |
1871 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
1872 | /* | |
1873 | * preset connection lists of input pins | |
1874 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1875 | */ | |
1876 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
1877 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1878 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
1879 | ||
1880 | /* | |
1881 | * Set pin mode and muting | |
1882 | */ | |
1883 | /* set front pin widgets 0x14 for output */ | |
05acb863 | 1884 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
1885 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1886 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1887 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1888 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1889 | /* Mic2 (as headphone out) for HP output */ | |
1890 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1891 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1da177e4 | 1892 | /* Line In pin widget for input */ |
05acb863 | 1893 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
1894 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1895 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
1896 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1897 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1da177e4 | 1898 | /* CD pin widget for input */ |
05acb863 | 1899 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 1900 | |
e9edcee0 TI |
1901 | { } |
1902 | }; | |
1da177e4 | 1903 | |
e9edcee0 TI |
1904 | /* |
1905 | * 5-stack pin configuration: | |
1906 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
1907 | * line-in/side = 0x1a, f-mic = 0x1b | |
1908 | */ | |
1909 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
1910 | /* | |
1911 | * preset connection lists of input pins | |
1912 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1da177e4 | 1913 | */ |
e9edcee0 TI |
1914 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
1915 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
1da177e4 | 1916 | |
e9edcee0 TI |
1917 | /* |
1918 | * Set pin mode and muting | |
1da177e4 | 1919 | */ |
e9edcee0 TI |
1920 | /* set pin widgets 0x14-0x17 for output */ |
1921 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1922 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1923 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1924 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1925 | /* unmute pins for output (no gain on this amp) */ | |
1926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1928 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1929 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1930 | ||
1931 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1932 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1933 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1934 | /* Mic2 (as headphone out) for HP output */ | |
1935 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1936 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1937 | /* Line In pin widget for input */ | |
1938 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1939 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1940 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
1941 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1942 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1943 | /* CD pin widget for input */ | |
1944 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1da177e4 LT |
1945 | |
1946 | { } | |
1947 | }; | |
1948 | ||
e9edcee0 TI |
1949 | /* |
1950 | * W810 pin configuration: | |
1951 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
1952 | */ | |
1953 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
1954 | /* hphone/speaker input selector: front DAC */ | |
1955 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
1da177e4 | 1956 | |
05acb863 | 1957 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1958 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1960 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1961 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1962 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 1963 | |
e9edcee0 | 1964 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
05acb863 | 1965 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1da177e4 | 1966 | |
1da177e4 LT |
1967 | { } |
1968 | }; | |
1969 | ||
e9edcee0 TI |
1970 | /* |
1971 | * Z71V pin configuration: | |
1972 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
1973 | */ | |
1974 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
05acb863 | 1975 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1976 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1977 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 1978 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
dfc0ff62 | 1979 | |
16ded525 | 1980 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1981 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 | 1982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1983 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 TI |
1984 | |
1985 | { } | |
1986 | }; | |
1987 | ||
e9edcee0 TI |
1988 | /* |
1989 | * 6-stack pin configuration: | |
9c7f852e TI |
1990 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
1991 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
e9edcee0 TI |
1992 | */ |
1993 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
1994 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1995 | ||
16ded525 | 1996 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1997 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1998 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1999 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2000 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2001 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2002 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
2003 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2004 | ||
16ded525 | 2005 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 2006 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 2007 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 2008 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 2009 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 | 2010 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 2011 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 2012 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2013 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 2014 | |
e9edcee0 TI |
2015 | { } |
2016 | }; | |
2017 | ||
ccc656ce KY |
2018 | /* |
2019 | * Uniwill pin configuration: | |
2020 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
2021 | * line = 0x1a | |
2022 | */ | |
2023 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
2024 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2025 | ||
2026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2027 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2029 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2030 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2031 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2032 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2033 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2035 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2036 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2037 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2038 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2039 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2040 | ||
2041 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2042 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2043 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2044 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2045 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2046 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2047 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
2048 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
2049 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2050 | ||
2051 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
2052 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
2053 | ||
2054 | { } | |
2055 | }; | |
2056 | ||
2057 | /* | |
2058 | * Uniwill P53 | |
ea1fb29a | 2059 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
ccc656ce KY |
2060 | */ |
2061 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
2062 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2063 | ||
2064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2065 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2068 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2069 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2070 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2072 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2073 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2074 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
2075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
2076 | ||
2077 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2079 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2080 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2081 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2082 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2083 | ||
2084 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
2085 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
2086 | ||
2087 | { } | |
2088 | }; | |
2089 | ||
2cf9f0fc TD |
2090 | static struct hda_verb alc880_beep_init_verbs[] = { |
2091 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
2092 | { } | |
2093 | }; | |
2094 | ||
ccc656ce | 2095 | /* toggle speaker-output according to the hp-jack state */ |
458a4fab | 2096 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
ccc656ce KY |
2097 | { |
2098 | unsigned int present; | |
f12ab1e0 | 2099 | unsigned char bits; |
ccc656ce KY |
2100 | |
2101 | present = snd_hda_codec_read(codec, 0x14, 0, | |
2102 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2103 | bits = present ? HDA_AMP_MUTE : 0; |
2104 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
2105 | HDA_AMP_MUTE, bits); | |
2106 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
2107 | HDA_AMP_MUTE, bits); | |
458a4fab TI |
2108 | } |
2109 | ||
2110 | /* auto-toggle front mic */ | |
2111 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |
2112 | { | |
2113 | unsigned int present; | |
2114 | unsigned char bits; | |
ccc656ce KY |
2115 | |
2116 | present = snd_hda_codec_read(codec, 0x18, 0, | |
2117 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2118 | bits = present ? HDA_AMP_MUTE : 0; |
2119 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
458a4fab TI |
2120 | } |
2121 | ||
2122 | static void alc880_uniwill_automute(struct hda_codec *codec) | |
2123 | { | |
2124 | alc880_uniwill_hp_automute(codec); | |
2125 | alc880_uniwill_mic_automute(codec); | |
ccc656ce KY |
2126 | } |
2127 | ||
2128 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
2129 | unsigned int res) | |
2130 | { | |
2131 | /* Looks like the unsol event is incompatible with the standard | |
2132 | * definition. 4bit tag is placed at 28 bit! | |
2133 | */ | |
458a4fab TI |
2134 | switch (res >> 28) { |
2135 | case ALC880_HP_EVENT: | |
2136 | alc880_uniwill_hp_automute(codec); | |
2137 | break; | |
2138 | case ALC880_MIC_EVENT: | |
2139 | alc880_uniwill_mic_automute(codec); | |
2140 | break; | |
2141 | } | |
ccc656ce KY |
2142 | } |
2143 | ||
2144 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) | |
2145 | { | |
2146 | unsigned int present; | |
f12ab1e0 | 2147 | unsigned char bits; |
ccc656ce KY |
2148 | |
2149 | present = snd_hda_codec_read(codec, 0x14, 0, | |
2150 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a | 2151 | bits = present ? HDA_AMP_MUTE : 0; |
64654c2f | 2152 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
ccc656ce KY |
2153 | } |
2154 | ||
2155 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
2156 | { | |
2157 | unsigned int present; | |
ea1fb29a | 2158 | |
ccc656ce | 2159 | present = snd_hda_codec_read(codec, 0x21, 0, |
47fd830a TI |
2160 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
2161 | present &= HDA_AMP_VOLMASK; | |
2162 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
2163 | HDA_AMP_VOLMASK, present); | |
2164 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
2165 | HDA_AMP_VOLMASK, present); | |
ccc656ce | 2166 | } |
47fd830a | 2167 | |
ccc656ce KY |
2168 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
2169 | unsigned int res) | |
2170 | { | |
2171 | /* Looks like the unsol event is incompatible with the standard | |
2172 | * definition. 4bit tag is placed at 28 bit! | |
2173 | */ | |
2174 | if ((res >> 28) == ALC880_HP_EVENT) | |
2175 | alc880_uniwill_p53_hp_automute(codec); | |
f12ab1e0 | 2176 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
ccc656ce KY |
2177 | alc880_uniwill_p53_dcvol_automute(codec); |
2178 | } | |
2179 | ||
e9edcee0 TI |
2180 | /* |
2181 | * F1734 pin configuration: | |
2182 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
2183 | */ | |
2184 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
ee7a9c7c | 2185 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
16ded525 TI |
2186 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
2187 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2188 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2189 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2190 | ||
e9edcee0 | 2191 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
16ded525 | 2192 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
e9edcee0 | 2193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16ded525 | 2194 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2195 | |
e9edcee0 TI |
2196 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
2197 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
ee7a9c7c | 2198 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
e9edcee0 | 2199 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 2200 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2201 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2202 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2203 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2204 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
dfc0ff62 | 2205 | |
937b4160 TI |
2206 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
2207 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
2208 | ||
dfc0ff62 TI |
2209 | { } |
2210 | }; | |
2211 | ||
e9edcee0 TI |
2212 | /* |
2213 | * ASUS pin configuration: | |
2214 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
2215 | */ | |
2216 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
16ded525 TI |
2217 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
2218 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2219 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2220 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2221 | ||
2222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
e9edcee0 | 2223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2225 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2226 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2227 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2228 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
2229 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2230 | ||
2231 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2232 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2233 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2234 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2235 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16ded525 | 2237 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2238 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2239 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 2240 | |
e9edcee0 TI |
2241 | { } |
2242 | }; | |
16ded525 | 2243 | |
e9edcee0 | 2244 | /* Enable GPIO mask and set output */ |
bc9f98a9 KY |
2245 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
2246 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
df694daa KY |
2247 | |
2248 | /* Clevo m520g init */ | |
2249 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
2250 | /* headphone output */ | |
2251 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2252 | /* line-out */ | |
2253 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2254 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2255 | /* Line-in */ | |
2256 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2257 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2258 | /* CD */ | |
2259 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2260 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2261 | /* Mic1 (rear panel) */ | |
2262 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2263 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2264 | /* Mic2 (front panel) */ | |
2265 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2266 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2267 | /* headphone */ | |
2268 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2269 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2270 | /* change to EAPD mode */ | |
2271 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2272 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2273 | ||
2274 | { } | |
16ded525 TI |
2275 | }; |
2276 | ||
df694daa | 2277 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
4b146cb0 TI |
2278 | /* change to EAPD mode */ |
2279 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2280 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2281 | ||
df694daa KY |
2282 | /* Headphone output */ |
2283 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2284 | /* Front output*/ | |
2285 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2286 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2287 | ||
2288 | /* Line In pin widget for input */ | |
2289 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2290 | /* CD pin widget for input */ | |
2291 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2292 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2293 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2294 | ||
2295 | /* change to EAPD mode */ | |
2296 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2297 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
2298 | ||
2299 | { } | |
2300 | }; | |
16ded525 | 2301 | |
e9edcee0 | 2302 | /* |
ae6b813a TI |
2303 | * LG m1 express dual |
2304 | * | |
2305 | * Pin assignment: | |
2306 | * Rear Line-In/Out (blue): 0x14 | |
2307 | * Build-in Mic-In: 0x15 | |
2308 | * Speaker-out: 0x17 | |
2309 | * HP-Out (green): 0x1b | |
2310 | * Mic-In/Out (red): 0x19 | |
2311 | * SPDIF-Out: 0x1e | |
2312 | */ | |
2313 | ||
2314 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
2315 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
2316 | 0x05, 0x02, 0x03 | |
2317 | }; | |
2318 | ||
2319 | /* seems analog CD is not working */ | |
2320 | static struct hda_input_mux alc880_lg_capture_source = { | |
2321 | .num_items = 3, | |
2322 | .items = { | |
2323 | { "Mic", 0x1 }, | |
2324 | { "Line", 0x5 }, | |
2325 | { "Internal Mic", 0x6 }, | |
2326 | }, | |
2327 | }; | |
2328 | ||
2329 | /* 2,4,6 channel modes */ | |
2330 | static struct hda_verb alc880_lg_ch2_init[] = { | |
2331 | /* set line-in and mic-in to input */ | |
2332 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2333 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2334 | { } | |
2335 | }; | |
2336 | ||
2337 | static struct hda_verb alc880_lg_ch4_init[] = { | |
2338 | /* set line-in to out and mic-in to input */ | |
2339 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2340 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2341 | { } | |
2342 | }; | |
2343 | ||
2344 | static struct hda_verb alc880_lg_ch6_init[] = { | |
2345 | /* set line-in and mic-in to output */ | |
2346 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2347 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2348 | { } | |
2349 | }; | |
2350 | ||
2351 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
2352 | { 2, alc880_lg_ch2_init }, | |
2353 | { 4, alc880_lg_ch4_init }, | |
2354 | { 6, alc880_lg_ch6_init }, | |
2355 | }; | |
2356 | ||
2357 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
2134ea4f TI |
2358 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
2359 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
ae6b813a TI |
2360 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2361 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
2362 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
2363 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
2364 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
2365 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
2366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2368 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
2369 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
2370 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
2371 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
2372 | { | |
2373 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2374 | .name = "Channel Mode", | |
2375 | .info = alc_ch_mode_info, | |
2376 | .get = alc_ch_mode_get, | |
2377 | .put = alc_ch_mode_put, | |
2378 | }, | |
2379 | { } /* end */ | |
2380 | }; | |
2381 | ||
2382 | static struct hda_verb alc880_lg_init_verbs[] = { | |
2383 | /* set capture source to mic-in */ | |
2384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2385 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2386 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2387 | /* mute all amp mixer inputs */ | |
2388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
cb53c626 TI |
2389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
2390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
ae6b813a TI |
2391 | /* line-in to input */ |
2392 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2393 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2394 | /* built-in mic */ | |
2395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2396 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2397 | /* speaker-out */ | |
2398 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2399 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2400 | /* mic-in to input */ | |
2401 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2402 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2403 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2404 | /* HP-out */ | |
2405 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
2406 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2407 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2408 | /* jack sense */ | |
2409 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, | |
2410 | { } | |
2411 | }; | |
2412 | ||
2413 | /* toggle speaker-output according to the hp-jack state */ | |
2414 | static void alc880_lg_automute(struct hda_codec *codec) | |
2415 | { | |
2416 | unsigned int present; | |
f12ab1e0 | 2417 | unsigned char bits; |
ae6b813a TI |
2418 | |
2419 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
2420 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2421 | bits = present ? HDA_AMP_MUTE : 0; |
2422 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
2423 | HDA_AMP_MUTE, bits); | |
ae6b813a TI |
2424 | } |
2425 | ||
2426 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) | |
2427 | { | |
2428 | /* Looks like the unsol event is incompatible with the standard | |
2429 | * definition. 4bit tag is placed at 28 bit! | |
2430 | */ | |
2431 | if ((res >> 28) == 0x01) | |
2432 | alc880_lg_automute(codec); | |
2433 | } | |
2434 | ||
d681518a TI |
2435 | /* |
2436 | * LG LW20 | |
2437 | * | |
2438 | * Pin assignment: | |
2439 | * Speaker-out: 0x14 | |
2440 | * Mic-In: 0x18 | |
e4f41da9 CM |
2441 | * Built-in Mic-In: 0x19 |
2442 | * Line-In: 0x1b | |
2443 | * HP-Out: 0x1a | |
d681518a TI |
2444 | * SPDIF-Out: 0x1e |
2445 | */ | |
2446 | ||
d681518a | 2447 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
e4f41da9 | 2448 | .num_items = 3, |
d681518a TI |
2449 | .items = { |
2450 | { "Mic", 0x0 }, | |
2451 | { "Internal Mic", 0x1 }, | |
e4f41da9 | 2452 | { "Line In", 0x2 }, |
d681518a TI |
2453 | }, |
2454 | }; | |
2455 | ||
0a8c5da3 CM |
2456 | #define alc880_lg_lw_modes alc880_threestack_modes |
2457 | ||
d681518a | 2458 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
0a8c5da3 CM |
2459 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2460 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2461 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2462 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
2463 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2464 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2465 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2466 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2467 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2468 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d681518a TI |
2469 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2470 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2471 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
2472 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
0a8c5da3 CM |
2473 | { |
2474 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2475 | .name = "Channel Mode", | |
2476 | .info = alc_ch_mode_info, | |
2477 | .get = alc_ch_mode_get, | |
2478 | .put = alc_ch_mode_put, | |
2479 | }, | |
d681518a TI |
2480 | { } /* end */ |
2481 | }; | |
2482 | ||
2483 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
0a8c5da3 CM |
2484 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
2485 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
2486 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
2487 | ||
d681518a TI |
2488 | /* set capture source to mic-in */ |
2489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2491 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
cb53c626 | 2492 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
d681518a TI |
2493 | /* speaker-out */ |
2494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2495 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2496 | /* HP-out */ | |
d681518a TI |
2497 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
2498 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2499 | /* mic-in to input */ | |
2500 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2502 | /* built-in mic */ | |
2503 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2504 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2505 | /* jack sense */ | |
2506 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, | |
2507 | { } | |
2508 | }; | |
2509 | ||
2510 | /* toggle speaker-output according to the hp-jack state */ | |
2511 | static void alc880_lg_lw_automute(struct hda_codec *codec) | |
2512 | { | |
2513 | unsigned int present; | |
f12ab1e0 | 2514 | unsigned char bits; |
d681518a TI |
2515 | |
2516 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
2517 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2518 | bits = present ? HDA_AMP_MUTE : 0; |
2519 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
2520 | HDA_AMP_MUTE, bits); | |
d681518a TI |
2521 | } |
2522 | ||
2523 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) | |
2524 | { | |
2525 | /* Looks like the unsol event is incompatible with the standard | |
2526 | * definition. 4bit tag is placed at 28 bit! | |
2527 | */ | |
2528 | if ((res >> 28) == 0x01) | |
2529 | alc880_lg_lw_automute(codec); | |
2530 | } | |
2531 | ||
df99cd33 TI |
2532 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
2533 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2534 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
2535 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2536 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2537 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2538 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2539 | { } /* end */ | |
2540 | }; | |
2541 | ||
2542 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
2543 | .num_items = 2, | |
2544 | .items = { | |
2545 | { "Mic", 0x0 }, | |
2546 | { "Internal Mic", 0x1 }, | |
2547 | }, | |
2548 | }; | |
2549 | ||
2550 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
2551 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2552 | ||
2553 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2555 | ||
2556 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2557 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2558 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2559 | /* Mic2 (as headphone out) for HP output */ | |
2560 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2561 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2562 | /* Internal Speaker */ | |
2563 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2564 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2565 | ||
2566 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2567 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2568 | ||
2569 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
2570 | { } | |
2571 | }; | |
2572 | ||
2573 | /* toggle speaker-output according to the hp-jack state */ | |
2574 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
2575 | { | |
2576 | unsigned int present; | |
2577 | unsigned char bits; | |
2578 | ||
2579 | present = snd_hda_codec_read(codec, 0x14, 0, | |
2580 | AC_VERB_GET_PIN_SENSE, 0) | |
2581 | & AC_PINSENSE_PRESENCE; | |
2582 | bits = present ? HDA_AMP_MUTE : 0; | |
2583 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
2584 | HDA_AMP_MUTE, bits); | |
2585 | if (present) | |
2586 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | |
2587 | else | |
2588 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
2589 | } | |
2590 | ||
2591 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
2592 | unsigned int res) | |
2593 | { | |
2594 | /* Looks like the unsol event is incompatible with the standard | |
2595 | * definition. 4bit tag is placed at 28 bit! | |
2596 | */ | |
2597 | if ((res >> 28) == ALC880_HP_EVENT) | |
2598 | alc880_medion_rim_automute(codec); | |
2599 | } | |
2600 | ||
cb53c626 TI |
2601 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2602 | static struct hda_amp_list alc880_loopbacks[] = { | |
2603 | { 0x0b, HDA_INPUT, 0 }, | |
2604 | { 0x0b, HDA_INPUT, 1 }, | |
2605 | { 0x0b, HDA_INPUT, 2 }, | |
2606 | { 0x0b, HDA_INPUT, 3 }, | |
2607 | { 0x0b, HDA_INPUT, 4 }, | |
2608 | { } /* end */ | |
2609 | }; | |
2610 | ||
2611 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
2612 | { 0x0b, HDA_INPUT, 1 }, | |
2613 | { 0x0b, HDA_INPUT, 6 }, | |
2614 | { 0x0b, HDA_INPUT, 7 }, | |
2615 | { } /* end */ | |
2616 | }; | |
2617 | #endif | |
2618 | ||
ae6b813a TI |
2619 | /* |
2620 | * Common callbacks | |
e9edcee0 TI |
2621 | */ |
2622 | ||
1da177e4 LT |
2623 | static int alc_init(struct hda_codec *codec) |
2624 | { | |
2625 | struct alc_spec *spec = codec->spec; | |
e9edcee0 TI |
2626 | unsigned int i; |
2627 | ||
2c3bf9ab | 2628 | alc_fix_pll(codec); |
1082c748 TI |
2629 | if (codec->vendor_id == 0x10ec0888) |
2630 | alc888_coef_init(codec); | |
2c3bf9ab | 2631 | |
e9edcee0 TI |
2632 | for (i = 0; i < spec->num_init_verbs; i++) |
2633 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
ae6b813a TI |
2634 | |
2635 | if (spec->init_hook) | |
2636 | spec->init_hook(codec); | |
2637 | ||
1da177e4 LT |
2638 | return 0; |
2639 | } | |
2640 | ||
ae6b813a TI |
2641 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
2642 | { | |
2643 | struct alc_spec *spec = codec->spec; | |
2644 | ||
2645 | if (spec->unsol_event) | |
2646 | spec->unsol_event(codec, res); | |
2647 | } | |
2648 | ||
cb53c626 TI |
2649 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2650 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
2651 | { | |
2652 | struct alc_spec *spec = codec->spec; | |
2653 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
2654 | } | |
2655 | #endif | |
2656 | ||
1da177e4 LT |
2657 | /* |
2658 | * Analog playback callbacks | |
2659 | */ | |
2660 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
2661 | struct hda_codec *codec, | |
c8b6bf9b | 2662 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2663 | { |
2664 | struct alc_spec *spec = codec->spec; | |
9a08160b TI |
2665 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
2666 | hinfo); | |
1da177e4 LT |
2667 | } |
2668 | ||
2669 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
2670 | struct hda_codec *codec, | |
2671 | unsigned int stream_tag, | |
2672 | unsigned int format, | |
c8b6bf9b | 2673 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2674 | { |
2675 | struct alc_spec *spec = codec->spec; | |
9c7f852e TI |
2676 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
2677 | stream_tag, format, substream); | |
1da177e4 LT |
2678 | } |
2679 | ||
2680 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
2681 | struct hda_codec *codec, | |
c8b6bf9b | 2682 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2683 | { |
2684 | struct alc_spec *spec = codec->spec; | |
2685 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
2686 | } | |
2687 | ||
2688 | /* | |
2689 | * Digital out | |
2690 | */ | |
2691 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
2692 | struct hda_codec *codec, | |
c8b6bf9b | 2693 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2694 | { |
2695 | struct alc_spec *spec = codec->spec; | |
2696 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
2697 | } | |
2698 | ||
6b97eb45 TI |
2699 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
2700 | struct hda_codec *codec, | |
2701 | unsigned int stream_tag, | |
2702 | unsigned int format, | |
2703 | struct snd_pcm_substream *substream) | |
2704 | { | |
2705 | struct alc_spec *spec = codec->spec; | |
2706 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
2707 | stream_tag, format, substream); | |
2708 | } | |
2709 | ||
1da177e4 LT |
2710 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
2711 | struct hda_codec *codec, | |
c8b6bf9b | 2712 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2713 | { |
2714 | struct alc_spec *spec = codec->spec; | |
2715 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
2716 | } | |
2717 | ||
2718 | /* | |
2719 | * Analog capture | |
2720 | */ | |
6330079f | 2721 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
1da177e4 LT |
2722 | struct hda_codec *codec, |
2723 | unsigned int stream_tag, | |
2724 | unsigned int format, | |
c8b6bf9b | 2725 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2726 | { |
2727 | struct alc_spec *spec = codec->spec; | |
2728 | ||
6330079f | 2729 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
1da177e4 LT |
2730 | stream_tag, 0, format); |
2731 | return 0; | |
2732 | } | |
2733 | ||
6330079f | 2734 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
1da177e4 | 2735 | struct hda_codec *codec, |
c8b6bf9b | 2736 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2737 | { |
2738 | struct alc_spec *spec = codec->spec; | |
2739 | ||
888afa15 TI |
2740 | snd_hda_codec_cleanup_stream(codec, |
2741 | spec->adc_nids[substream->number + 1]); | |
1da177e4 LT |
2742 | return 0; |
2743 | } | |
2744 | ||
2745 | ||
2746 | /* | |
2747 | */ | |
2748 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
2749 | .substreams = 1, | |
2750 | .channels_min = 2, | |
2751 | .channels_max = 8, | |
e9edcee0 | 2752 | /* NID is set in alc_build_pcms */ |
1da177e4 LT |
2753 | .ops = { |
2754 | .open = alc880_playback_pcm_open, | |
2755 | .prepare = alc880_playback_pcm_prepare, | |
2756 | .cleanup = alc880_playback_pcm_cleanup | |
2757 | }, | |
2758 | }; | |
2759 | ||
2760 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
6330079f TI |
2761 | .substreams = 1, |
2762 | .channels_min = 2, | |
2763 | .channels_max = 2, | |
2764 | /* NID is set in alc_build_pcms */ | |
2765 | }; | |
2766 | ||
2767 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
2768 | .substreams = 1, | |
2769 | .channels_min = 2, | |
2770 | .channels_max = 2, | |
2771 | /* NID is set in alc_build_pcms */ | |
2772 | }; | |
2773 | ||
2774 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
2775 | .substreams = 2, /* can be overridden */ | |
1da177e4 LT |
2776 | .channels_min = 2, |
2777 | .channels_max = 2, | |
e9edcee0 | 2778 | /* NID is set in alc_build_pcms */ |
1da177e4 | 2779 | .ops = { |
6330079f TI |
2780 | .prepare = alc880_alt_capture_pcm_prepare, |
2781 | .cleanup = alc880_alt_capture_pcm_cleanup | |
1da177e4 LT |
2782 | }, |
2783 | }; | |
2784 | ||
2785 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
2786 | .substreams = 1, | |
2787 | .channels_min = 2, | |
2788 | .channels_max = 2, | |
2789 | /* NID is set in alc_build_pcms */ | |
2790 | .ops = { | |
2791 | .open = alc880_dig_playback_pcm_open, | |
6b97eb45 TI |
2792 | .close = alc880_dig_playback_pcm_close, |
2793 | .prepare = alc880_dig_playback_pcm_prepare | |
1da177e4 LT |
2794 | }, |
2795 | }; | |
2796 | ||
2797 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
2798 | .substreams = 1, | |
2799 | .channels_min = 2, | |
2800 | .channels_max = 2, | |
2801 | /* NID is set in alc_build_pcms */ | |
2802 | }; | |
2803 | ||
4c5186ed | 2804 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
6330079f | 2805 | static struct hda_pcm_stream alc_pcm_null_stream = { |
4c5186ed JW |
2806 | .substreams = 0, |
2807 | .channels_min = 0, | |
2808 | .channels_max = 0, | |
2809 | }; | |
2810 | ||
1da177e4 LT |
2811 | static int alc_build_pcms(struct hda_codec *codec) |
2812 | { | |
2813 | struct alc_spec *spec = codec->spec; | |
2814 | struct hda_pcm *info = spec->pcm_rec; | |
2815 | int i; | |
2816 | ||
2817 | codec->num_pcms = 1; | |
2818 | codec->pcm_info = info; | |
2819 | ||
2820 | info->name = spec->stream_name_analog; | |
4a471b7d | 2821 | if (spec->stream_analog_playback) { |
da3cec35 TI |
2822 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
2823 | return -EINVAL; | |
4a471b7d TI |
2824 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
2825 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
2826 | } | |
2827 | if (spec->stream_analog_capture) { | |
da3cec35 TI |
2828 | if (snd_BUG_ON(!spec->adc_nids)) |
2829 | return -EINVAL; | |
4a471b7d TI |
2830 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
2831 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
2832 | } | |
2833 | ||
2834 | if (spec->channel_mode) { | |
2835 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
2836 | for (i = 0; i < spec->num_channel_mode; i++) { | |
2837 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
2838 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
2839 | } | |
1da177e4 LT |
2840 | } |
2841 | } | |
2842 | ||
e08a007d | 2843 | /* SPDIF for stream index #1 */ |
1da177e4 | 2844 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
e08a007d | 2845 | codec->num_pcms = 2; |
c06134d7 | 2846 | info = spec->pcm_rec + 1; |
1da177e4 | 2847 | info->name = spec->stream_name_digital; |
7ba72ba1 | 2848 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
4a471b7d TI |
2849 | if (spec->multiout.dig_out_nid && |
2850 | spec->stream_digital_playback) { | |
1da177e4 LT |
2851 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
2852 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
2853 | } | |
4a471b7d TI |
2854 | if (spec->dig_in_nid && |
2855 | spec->stream_digital_capture) { | |
1da177e4 LT |
2856 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
2857 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
2858 | } | |
963f803f TI |
2859 | /* FIXME: do we need this for all Realtek codec models? */ |
2860 | codec->spdif_status_reset = 1; | |
1da177e4 LT |
2861 | } |
2862 | ||
e08a007d TI |
2863 | /* If the use of more than one ADC is requested for the current |
2864 | * model, configure a second analog capture-only PCM. | |
2865 | */ | |
2866 | /* Additional Analaog capture for index #2 */ | |
6330079f TI |
2867 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
2868 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
e08a007d | 2869 | codec->num_pcms = 3; |
c06134d7 | 2870 | info = spec->pcm_rec + 2; |
e08a007d | 2871 | info->name = spec->stream_name_analog; |
6330079f TI |
2872 | if (spec->alt_dac_nid) { |
2873 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
2874 | *spec->stream_analog_alt_playback; | |
2875 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
2876 | spec->alt_dac_nid; | |
2877 | } else { | |
2878 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
2879 | alc_pcm_null_stream; | |
2880 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
2881 | } | |
2882 | if (spec->num_adc_nids > 1) { | |
2883 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
2884 | *spec->stream_analog_alt_capture; | |
2885 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
2886 | spec->adc_nids[1]; | |
2887 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
2888 | spec->num_adc_nids - 1; | |
2889 | } else { | |
2890 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
2891 | alc_pcm_null_stream; | |
2892 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
e08a007d TI |
2893 | } |
2894 | } | |
2895 | ||
1da177e4 LT |
2896 | return 0; |
2897 | } | |
2898 | ||
603c4019 TI |
2899 | static void alc_free_kctls(struct hda_codec *codec) |
2900 | { | |
2901 | struct alc_spec *spec = codec->spec; | |
2902 | ||
2903 | if (spec->kctls.list) { | |
2904 | struct snd_kcontrol_new *kctl = spec->kctls.list; | |
2905 | int i; | |
2906 | for (i = 0; i < spec->kctls.used; i++) | |
2907 | kfree(kctl[i].name); | |
2908 | } | |
2909 | snd_array_free(&spec->kctls); | |
2910 | } | |
2911 | ||
1da177e4 LT |
2912 | static void alc_free(struct hda_codec *codec) |
2913 | { | |
e9edcee0 | 2914 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 2915 | |
f12ab1e0 | 2916 | if (!spec) |
e9edcee0 TI |
2917 | return; |
2918 | ||
603c4019 | 2919 | alc_free_kctls(codec); |
e9edcee0 | 2920 | kfree(spec); |
7943a8ab | 2921 | codec->spec = NULL; /* to be sure */ |
1da177e4 LT |
2922 | } |
2923 | ||
e044c39a TI |
2924 | #ifdef SND_HDA_NEEDS_RESUME |
2925 | static void store_pin_configs(struct hda_codec *codec) | |
2926 | { | |
2927 | struct alc_spec *spec = codec->spec; | |
2928 | hda_nid_t nid, end_nid; | |
2929 | ||
2930 | end_nid = codec->start_nid + codec->num_nodes; | |
2931 | for (nid = codec->start_nid; nid < end_nid; nid++) { | |
2932 | unsigned int wid_caps = get_wcaps(codec, nid); | |
2933 | unsigned int wid_type = | |
2934 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
2935 | if (wid_type != AC_WID_PIN) | |
2936 | continue; | |
2937 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) | |
2938 | break; | |
2939 | spec->pin_nids[spec->num_pins] = nid; | |
2940 | spec->pin_cfgs[spec->num_pins] = | |
2941 | snd_hda_codec_read(codec, nid, 0, | |
2942 | AC_VERB_GET_CONFIG_DEFAULT, 0); | |
2943 | spec->num_pins++; | |
2944 | } | |
2945 | } | |
2946 | ||
2947 | static void resume_pin_configs(struct hda_codec *codec) | |
2948 | { | |
2949 | struct alc_spec *spec = codec->spec; | |
2950 | int i; | |
2951 | ||
2952 | for (i = 0; i < spec->num_pins; i++) { | |
2953 | hda_nid_t pin_nid = spec->pin_nids[i]; | |
2954 | unsigned int pin_config = spec->pin_cfgs[i]; | |
2955 | snd_hda_codec_write(codec, pin_nid, 0, | |
2956 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, | |
2957 | pin_config & 0x000000ff); | |
2958 | snd_hda_codec_write(codec, pin_nid, 0, | |
2959 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, | |
2960 | (pin_config & 0x0000ff00) >> 8); | |
2961 | snd_hda_codec_write(codec, pin_nid, 0, | |
2962 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, | |
2963 | (pin_config & 0x00ff0000) >> 16); | |
2964 | snd_hda_codec_write(codec, pin_nid, 0, | |
2965 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, | |
2966 | pin_config >> 24); | |
2967 | } | |
2968 | } | |
2969 | ||
2970 | static int alc_resume(struct hda_codec *codec) | |
2971 | { | |
2972 | resume_pin_configs(codec); | |
2973 | codec->patch_ops.init(codec); | |
2974 | snd_hda_codec_resume_amp(codec); | |
2975 | snd_hda_codec_resume_cache(codec); | |
2976 | return 0; | |
2977 | } | |
2978 | #else | |
2979 | #define store_pin_configs(codec) | |
2980 | #endif | |
2981 | ||
1da177e4 LT |
2982 | /* |
2983 | */ | |
2984 | static struct hda_codec_ops alc_patch_ops = { | |
2985 | .build_controls = alc_build_controls, | |
2986 | .build_pcms = alc_build_pcms, | |
2987 | .init = alc_init, | |
2988 | .free = alc_free, | |
ae6b813a | 2989 | .unsol_event = alc_unsol_event, |
e044c39a TI |
2990 | #ifdef SND_HDA_NEEDS_RESUME |
2991 | .resume = alc_resume, | |
2992 | #endif | |
cb53c626 TI |
2993 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2994 | .check_power_status = alc_check_power_status, | |
2995 | #endif | |
1da177e4 LT |
2996 | }; |
2997 | ||
2fa522be TI |
2998 | |
2999 | /* | |
3000 | * Test configuration for debugging | |
3001 | * | |
3002 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
3003 | * enum controls. | |
3004 | */ | |
3005 | #ifdef CONFIG_SND_DEBUG | |
3006 | static hda_nid_t alc880_test_dac_nids[4] = { | |
3007 | 0x02, 0x03, 0x04, 0x05 | |
3008 | }; | |
3009 | ||
3010 | static struct hda_input_mux alc880_test_capture_source = { | |
ae6b813a | 3011 | .num_items = 7, |
2fa522be TI |
3012 | .items = { |
3013 | { "In-1", 0x0 }, | |
3014 | { "In-2", 0x1 }, | |
3015 | { "In-3", 0x2 }, | |
3016 | { "In-4", 0x3 }, | |
3017 | { "CD", 0x4 }, | |
ae6b813a TI |
3018 | { "Front", 0x5 }, |
3019 | { "Surround", 0x6 }, | |
2fa522be TI |
3020 | }, |
3021 | }; | |
3022 | ||
d2a6d7dc | 3023 | static struct hda_channel_mode alc880_test_modes[4] = { |
2fa522be | 3024 | { 2, NULL }, |
fd2c326d | 3025 | { 4, NULL }, |
2fa522be | 3026 | { 6, NULL }, |
fd2c326d | 3027 | { 8, NULL }, |
2fa522be TI |
3028 | }; |
3029 | ||
9c7f852e TI |
3030 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
3031 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
3032 | { |
3033 | static char *texts[] = { | |
3034 | "N/A", "Line Out", "HP Out", | |
3035 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
3036 | }; | |
3037 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
3038 | uinfo->count = 1; | |
3039 | uinfo->value.enumerated.items = 8; | |
3040 | if (uinfo->value.enumerated.item >= 8) | |
3041 | uinfo->value.enumerated.item = 7; | |
3042 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
3043 | return 0; | |
3044 | } | |
3045 | ||
9c7f852e TI |
3046 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
3047 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
3048 | { |
3049 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3050 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3051 | unsigned int pin_ctl, item = 0; | |
3052 | ||
3053 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
3054 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
3055 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
3056 | if (pin_ctl & AC_PINCTL_HP_EN) | |
3057 | item = 2; | |
3058 | else | |
3059 | item = 1; | |
3060 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
3061 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
3062 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
3063 | case AC_PINCTL_VREF_50: item = 4; break; | |
3064 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
3065 | case AC_PINCTL_VREF_80: item = 6; break; | |
3066 | case AC_PINCTL_VREF_100: item = 7; break; | |
3067 | } | |
3068 | } | |
3069 | ucontrol->value.enumerated.item[0] = item; | |
3070 | return 0; | |
3071 | } | |
3072 | ||
9c7f852e TI |
3073 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
3074 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
3075 | { |
3076 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3077 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3078 | static unsigned int ctls[] = { | |
3079 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
3080 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
3081 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
3082 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
3083 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
3084 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
3085 | }; | |
3086 | unsigned int old_ctl, new_ctl; | |
3087 | ||
3088 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
3089 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
3090 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
3091 | if (old_ctl != new_ctl) { | |
82beb8fd TI |
3092 | int val; |
3093 | snd_hda_codec_write_cache(codec, nid, 0, | |
3094 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3095 | new_ctl); | |
47fd830a TI |
3096 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
3097 | HDA_AMP_MUTE : 0; | |
3098 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
3099 | HDA_AMP_MUTE, val); | |
2fa522be TI |
3100 | return 1; |
3101 | } | |
3102 | return 0; | |
3103 | } | |
3104 | ||
9c7f852e TI |
3105 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
3106 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
3107 | { |
3108 | static char *texts[] = { | |
3109 | "Front", "Surround", "CLFE", "Side" | |
3110 | }; | |
3111 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
3112 | uinfo->count = 1; | |
3113 | uinfo->value.enumerated.items = 4; | |
3114 | if (uinfo->value.enumerated.item >= 4) | |
3115 | uinfo->value.enumerated.item = 3; | |
3116 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
3117 | return 0; | |
3118 | } | |
3119 | ||
9c7f852e TI |
3120 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
3121 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
3122 | { |
3123 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3124 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3125 | unsigned int sel; | |
3126 | ||
3127 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
3128 | ucontrol->value.enumerated.item[0] = sel & 3; | |
3129 | return 0; | |
3130 | } | |
3131 | ||
9c7f852e TI |
3132 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
3133 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
3134 | { |
3135 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3136 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3137 | unsigned int sel; | |
3138 | ||
3139 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
3140 | if (ucontrol->value.enumerated.item[0] != sel) { | |
3141 | sel = ucontrol->value.enumerated.item[0] & 3; | |
82beb8fd TI |
3142 | snd_hda_codec_write_cache(codec, nid, 0, |
3143 | AC_VERB_SET_CONNECT_SEL, sel); | |
2fa522be TI |
3144 | return 1; |
3145 | } | |
3146 | return 0; | |
3147 | } | |
3148 | ||
3149 | #define PIN_CTL_TEST(xname,nid) { \ | |
3150 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
3151 | .name = xname, \ | |
3152 | .info = alc_test_pin_ctl_info, \ | |
3153 | .get = alc_test_pin_ctl_get, \ | |
3154 | .put = alc_test_pin_ctl_put, \ | |
3155 | .private_value = nid \ | |
3156 | } | |
3157 | ||
3158 | #define PIN_SRC_TEST(xname,nid) { \ | |
3159 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
3160 | .name = xname, \ | |
3161 | .info = alc_test_pin_src_info, \ | |
3162 | .get = alc_test_pin_src_get, \ | |
3163 | .put = alc_test_pin_src_put, \ | |
3164 | .private_value = nid \ | |
3165 | } | |
3166 | ||
c8b6bf9b | 3167 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
05acb863 TI |
3168 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
3169 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
3170 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
3171 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
985be54b TI |
3172 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
3173 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
3174 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
3175 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2fa522be TI |
3176 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
3177 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
3178 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
3179 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
3180 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
3181 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
3182 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
3183 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
3184 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
3185 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
3186 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
3187 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
3188 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3189 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3190 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3191 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3192 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
3193 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
3194 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
3195 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
3196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
3197 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
2fa522be TI |
3198 | { |
3199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3200 | .name = "Channel Mode", | |
df694daa KY |
3201 | .info = alc_ch_mode_info, |
3202 | .get = alc_ch_mode_get, | |
3203 | .put = alc_ch_mode_put, | |
2fa522be TI |
3204 | }, |
3205 | { } /* end */ | |
3206 | }; | |
3207 | ||
3208 | static struct hda_verb alc880_test_init_verbs[] = { | |
3209 | /* Unmute inputs of 0x0c - 0x0f */ | |
05acb863 TI |
3210 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3211 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3212 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3213 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3214 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3215 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3216 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3217 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2fa522be | 3218 | /* Vol output for 0x0c-0x0f */ |
05acb863 TI |
3219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
3220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3221 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3222 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2fa522be | 3223 | /* Set output pins 0x14-0x17 */ |
05acb863 TI |
3224 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
3225 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3226 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3227 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2fa522be | 3228 | /* Unmute output pins 0x14-0x17 */ |
05acb863 TI |
3229 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3230 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3231 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3232 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2fa522be | 3233 | /* Set input pins 0x18-0x1c */ |
16ded525 TI |
3234 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3235 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
05acb863 TI |
3236 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
3237 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3238 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2fa522be | 3239 | /* Mute input pins 0x18-0x1b */ |
05acb863 TI |
3240 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3241 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3242 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3243 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
71fe7b82 | 3244 | /* ADC set up */ |
05acb863 | 3245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 3246 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 3247 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 3248 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 3249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 3250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
3251 | /* Analog input/passthru */ |
3252 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3253 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3254 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
3255 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
3256 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2fa522be TI |
3257 | { } |
3258 | }; | |
3259 | #endif | |
3260 | ||
1da177e4 LT |
3261 | /* |
3262 | */ | |
3263 | ||
f5fcc13c TI |
3264 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
3265 | [ALC880_3ST] = "3stack", | |
3266 | [ALC880_TCL_S700] = "tcl", | |
3267 | [ALC880_3ST_DIG] = "3stack-digout", | |
3268 | [ALC880_CLEVO] = "clevo", | |
3269 | [ALC880_5ST] = "5stack", | |
3270 | [ALC880_5ST_DIG] = "5stack-digout", | |
3271 | [ALC880_W810] = "w810", | |
3272 | [ALC880_Z71V] = "z71v", | |
3273 | [ALC880_6ST] = "6stack", | |
3274 | [ALC880_6ST_DIG] = "6stack-digout", | |
3275 | [ALC880_ASUS] = "asus", | |
3276 | [ALC880_ASUS_W1V] = "asus-w1v", | |
3277 | [ALC880_ASUS_DIG] = "asus-dig", | |
3278 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
3279 | [ALC880_UNIWILL_DIG] = "uniwill", | |
2cf9f0fc TD |
3280 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
3281 | [ALC880_FUJITSU] = "fujitsu", | |
f5fcc13c TI |
3282 | [ALC880_F1734] = "F1734", |
3283 | [ALC880_LG] = "lg", | |
3284 | [ALC880_LG_LW] = "lg-lw", | |
df99cd33 | 3285 | [ALC880_MEDION_RIM] = "medion", |
2fa522be | 3286 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 3287 | [ALC880_TEST] = "test", |
2fa522be | 3288 | #endif |
f5fcc13c TI |
3289 | [ALC880_AUTO] = "auto", |
3290 | }; | |
3291 | ||
3292 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
ac3e3741 | 3293 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
f5fcc13c TI |
3294 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
3295 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
3296 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
3297 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
3298 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
3299 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
3300 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
3301 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
f5fcc13c TI |
3302 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
3303 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
f5fcc13c TI |
3304 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
3305 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
3306 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
3307 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
3308 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
3309 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
3310 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
3311 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
3312 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
3313 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
186c3117 | 3314 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
f5fcc13c TI |
3315 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
3316 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
3317 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
ac3e3741 | 3318 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
f5fcc13c | 3319 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
ac3e3741 TI |
3320 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
3321 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
3322 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
3323 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
3324 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
3325 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
3326 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
3327 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
ac3e3741 TI |
3328 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
3329 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
f5fcc13c | 3330 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
ac3e3741 | 3331 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
f5fcc13c | 3332 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
ac3e3741 | 3333 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
f5fcc13c TI |
3334 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
3335 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
ac3e3741 | 3336 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
df99cd33 | 3337 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
ac3e3741 | 3338 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
f5fcc13c | 3339 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
f5fcc13c | 3340 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
1d11604e | 3341 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
ac3e3741 | 3342 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
2cf9f0fc | 3343 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
ac3e3741 | 3344 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
f5fcc13c TI |
3345 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
3346 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
f5fcc13c | 3347 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
ac3e3741 TI |
3348 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
3349 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
3350 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
3351 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
f5fcc13c TI |
3352 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
3353 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 | 3354 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
f5fcc13c | 3355 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
ac3e3741 TI |
3356 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
3357 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
f5fcc13c TI |
3358 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
3359 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
3360 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 TI |
3361 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
3362 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | |
3363 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
1da177e4 LT |
3364 | {} |
3365 | }; | |
3366 | ||
16ded525 | 3367 | /* |
df694daa | 3368 | * ALC880 codec presets |
16ded525 | 3369 | */ |
16ded525 TI |
3370 | static struct alc_config_preset alc880_presets[] = { |
3371 | [ALC880_3ST] = { | |
e9edcee0 | 3372 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
3373 | .init_verbs = { alc880_volume_init_verbs, |
3374 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 3375 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 | 3376 | .dac_nids = alc880_dac_nids, |
16ded525 TI |
3377 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
3378 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3379 | .need_dac_fix = 1, |
16ded525 TI |
3380 | .input_mux = &alc880_capture_source, |
3381 | }, | |
3382 | [ALC880_3ST_DIG] = { | |
e9edcee0 | 3383 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
3384 | .init_verbs = { alc880_volume_init_verbs, |
3385 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 3386 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 TI |
3387 | .dac_nids = alc880_dac_nids, |
3388 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3389 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
3390 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3391 | .need_dac_fix = 1, |
16ded525 TI |
3392 | .input_mux = &alc880_capture_source, |
3393 | }, | |
df694daa KY |
3394 | [ALC880_TCL_S700] = { |
3395 | .mixers = { alc880_tcl_s700_mixer }, | |
3396 | .init_verbs = { alc880_volume_init_verbs, | |
3397 | alc880_pin_tcl_S700_init_verbs, | |
3398 | alc880_gpio2_init_verbs }, | |
3399 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3400 | .dac_nids = alc880_dac_nids, | |
f9e336f6 TI |
3401 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
3402 | .num_adc_nids = 1, /* single ADC */ | |
df694daa KY |
3403 | .hp_nid = 0x03, |
3404 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3405 | .channel_mode = alc880_2_jack_modes, | |
3406 | .input_mux = &alc880_capture_source, | |
3407 | }, | |
16ded525 | 3408 | [ALC880_5ST] = { |
f12ab1e0 TI |
3409 | .mixers = { alc880_three_stack_mixer, |
3410 | alc880_five_stack_mixer}, | |
3411 | .init_verbs = { alc880_volume_init_verbs, | |
3412 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
3413 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
3414 | .dac_nids = alc880_dac_nids, | |
16ded525 TI |
3415 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
3416 | .channel_mode = alc880_fivestack_modes, | |
3417 | .input_mux = &alc880_capture_source, | |
3418 | }, | |
3419 | [ALC880_5ST_DIG] = { | |
f12ab1e0 TI |
3420 | .mixers = { alc880_three_stack_mixer, |
3421 | alc880_five_stack_mixer }, | |
3422 | .init_verbs = { alc880_volume_init_verbs, | |
3423 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
3424 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
3425 | .dac_nids = alc880_dac_nids, | |
3426 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3427 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
3428 | .channel_mode = alc880_fivestack_modes, | |
3429 | .input_mux = &alc880_capture_source, | |
3430 | }, | |
b6482d48 TI |
3431 | [ALC880_6ST] = { |
3432 | .mixers = { alc880_six_stack_mixer }, | |
f12ab1e0 TI |
3433 | .init_verbs = { alc880_volume_init_verbs, |
3434 | alc880_pin_6stack_init_verbs }, | |
b6482d48 TI |
3435 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
3436 | .dac_nids = alc880_6st_dac_nids, | |
3437 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
3438 | .channel_mode = alc880_sixstack_modes, | |
3439 | .input_mux = &alc880_6stack_capture_source, | |
3440 | }, | |
16ded525 | 3441 | [ALC880_6ST_DIG] = { |
e9edcee0 | 3442 | .mixers = { alc880_six_stack_mixer }, |
f12ab1e0 TI |
3443 | .init_verbs = { alc880_volume_init_verbs, |
3444 | alc880_pin_6stack_init_verbs }, | |
16ded525 TI |
3445 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
3446 | .dac_nids = alc880_6st_dac_nids, | |
3447 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3448 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
3449 | .channel_mode = alc880_sixstack_modes, | |
3450 | .input_mux = &alc880_6stack_capture_source, | |
3451 | }, | |
3452 | [ALC880_W810] = { | |
e9edcee0 | 3453 | .mixers = { alc880_w810_base_mixer }, |
f12ab1e0 TI |
3454 | .init_verbs = { alc880_volume_init_verbs, |
3455 | alc880_pin_w810_init_verbs, | |
b0af0de5 | 3456 | alc880_gpio2_init_verbs }, |
16ded525 TI |
3457 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
3458 | .dac_nids = alc880_w810_dac_nids, | |
3459 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3460 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
3461 | .channel_mode = alc880_w810_modes, | |
3462 | .input_mux = &alc880_capture_source, | |
3463 | }, | |
3464 | [ALC880_Z71V] = { | |
e9edcee0 | 3465 | .mixers = { alc880_z71v_mixer }, |
f12ab1e0 TI |
3466 | .init_verbs = { alc880_volume_init_verbs, |
3467 | alc880_pin_z71v_init_verbs }, | |
16ded525 TI |
3468 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
3469 | .dac_nids = alc880_z71v_dac_nids, | |
3470 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3471 | .hp_nid = 0x03, | |
e9edcee0 TI |
3472 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
3473 | .channel_mode = alc880_2_jack_modes, | |
16ded525 TI |
3474 | .input_mux = &alc880_capture_source, |
3475 | }, | |
3476 | [ALC880_F1734] = { | |
e9edcee0 | 3477 | .mixers = { alc880_f1734_mixer }, |
f12ab1e0 TI |
3478 | .init_verbs = { alc880_volume_init_verbs, |
3479 | alc880_pin_f1734_init_verbs }, | |
e9edcee0 TI |
3480 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
3481 | .dac_nids = alc880_f1734_dac_nids, | |
3482 | .hp_nid = 0x02, | |
3483 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3484 | .channel_mode = alc880_2_jack_modes, | |
937b4160 TI |
3485 | .input_mux = &alc880_f1734_capture_source, |
3486 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3487 | .init_hook = alc880_uniwill_p53_hp_automute, | |
16ded525 TI |
3488 | }, |
3489 | [ALC880_ASUS] = { | |
e9edcee0 | 3490 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
3491 | .init_verbs = { alc880_volume_init_verbs, |
3492 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3493 | alc880_gpio1_init_verbs }, |
3494 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3495 | .dac_nids = alc880_asus_dac_nids, | |
3496 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
3497 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3498 | .need_dac_fix = 1, |
16ded525 TI |
3499 | .input_mux = &alc880_capture_source, |
3500 | }, | |
3501 | [ALC880_ASUS_DIG] = { | |
e9edcee0 | 3502 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
3503 | .init_verbs = { alc880_volume_init_verbs, |
3504 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3505 | alc880_gpio1_init_verbs }, |
3506 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3507 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3508 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3509 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3510 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3511 | .need_dac_fix = 1, |
16ded525 TI |
3512 | .input_mux = &alc880_capture_source, |
3513 | }, | |
df694daa KY |
3514 | [ALC880_ASUS_DIG2] = { |
3515 | .mixers = { alc880_asus_mixer }, | |
f12ab1e0 TI |
3516 | .init_verbs = { alc880_volume_init_verbs, |
3517 | alc880_pin_asus_init_verbs, | |
df694daa KY |
3518 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
3519 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3520 | .dac_nids = alc880_asus_dac_nids, | |
3521 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3522 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
3523 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3524 | .need_dac_fix = 1, |
df694daa KY |
3525 | .input_mux = &alc880_capture_source, |
3526 | }, | |
16ded525 | 3527 | [ALC880_ASUS_W1V] = { |
e9edcee0 | 3528 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
f12ab1e0 TI |
3529 | .init_verbs = { alc880_volume_init_verbs, |
3530 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3531 | alc880_gpio1_init_verbs }, |
3532 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3533 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3534 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3535 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3536 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3537 | .need_dac_fix = 1, |
16ded525 TI |
3538 | .input_mux = &alc880_capture_source, |
3539 | }, | |
3540 | [ALC880_UNIWILL_DIG] = { | |
3c10a9d9 | 3541 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
ccc656ce KY |
3542 | .init_verbs = { alc880_volume_init_verbs, |
3543 | alc880_pin_asus_init_verbs }, | |
e9edcee0 TI |
3544 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
3545 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3546 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3547 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3548 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3549 | .need_dac_fix = 1, |
16ded525 TI |
3550 | .input_mux = &alc880_capture_source, |
3551 | }, | |
ccc656ce KY |
3552 | [ALC880_UNIWILL] = { |
3553 | .mixers = { alc880_uniwill_mixer }, | |
3554 | .init_verbs = { alc880_volume_init_verbs, | |
3555 | alc880_uniwill_init_verbs }, | |
3556 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3557 | .dac_nids = alc880_asus_dac_nids, | |
3558 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3559 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
3560 | .channel_mode = alc880_threestack_modes, | |
3561 | .need_dac_fix = 1, | |
3562 | .input_mux = &alc880_capture_source, | |
3563 | .unsol_event = alc880_uniwill_unsol_event, | |
3564 | .init_hook = alc880_uniwill_automute, | |
3565 | }, | |
3566 | [ALC880_UNIWILL_P53] = { | |
3567 | .mixers = { alc880_uniwill_p53_mixer }, | |
3568 | .init_verbs = { alc880_volume_init_verbs, | |
3569 | alc880_uniwill_p53_init_verbs }, | |
3570 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3571 | .dac_nids = alc880_asus_dac_nids, | |
3572 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
2cf9f0fc TD |
3573 | .channel_mode = alc880_threestack_modes, |
3574 | .input_mux = &alc880_capture_source, | |
3575 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3576 | .init_hook = alc880_uniwill_p53_hp_automute, | |
3577 | }, | |
3578 | [ALC880_FUJITSU] = { | |
f12ab1e0 | 3579 | .mixers = { alc880_fujitsu_mixer, |
2cf9f0fc TD |
3580 | alc880_pcbeep_mixer, }, |
3581 | .init_verbs = { alc880_volume_init_verbs, | |
3582 | alc880_uniwill_p53_init_verbs, | |
3583 | alc880_beep_init_verbs }, | |
3584 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3585 | .dac_nids = alc880_dac_nids, | |
d53d7d9e | 3586 | .dig_out_nid = ALC880_DIGOUT_NID, |
2cf9f0fc TD |
3587 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
3588 | .channel_mode = alc880_2_jack_modes, | |
ccc656ce KY |
3589 | .input_mux = &alc880_capture_source, |
3590 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3591 | .init_hook = alc880_uniwill_p53_hp_automute, | |
3592 | }, | |
df694daa KY |
3593 | [ALC880_CLEVO] = { |
3594 | .mixers = { alc880_three_stack_mixer }, | |
3595 | .init_verbs = { alc880_volume_init_verbs, | |
3596 | alc880_pin_clevo_init_verbs }, | |
3597 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3598 | .dac_nids = alc880_dac_nids, | |
3599 | .hp_nid = 0x03, | |
3600 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
3601 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3602 | .need_dac_fix = 1, |
df694daa KY |
3603 | .input_mux = &alc880_capture_source, |
3604 | }, | |
ae6b813a TI |
3605 | [ALC880_LG] = { |
3606 | .mixers = { alc880_lg_mixer }, | |
3607 | .init_verbs = { alc880_volume_init_verbs, | |
3608 | alc880_lg_init_verbs }, | |
3609 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
3610 | .dac_nids = alc880_lg_dac_nids, | |
3611 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3612 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
3613 | .channel_mode = alc880_lg_ch_modes, | |
4e195a7b | 3614 | .need_dac_fix = 1, |
ae6b813a TI |
3615 | .input_mux = &alc880_lg_capture_source, |
3616 | .unsol_event = alc880_lg_unsol_event, | |
3617 | .init_hook = alc880_lg_automute, | |
cb53c626 TI |
3618 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3619 | .loopbacks = alc880_lg_loopbacks, | |
3620 | #endif | |
ae6b813a | 3621 | }, |
d681518a TI |
3622 | [ALC880_LG_LW] = { |
3623 | .mixers = { alc880_lg_lw_mixer }, | |
3624 | .init_verbs = { alc880_volume_init_verbs, | |
3625 | alc880_lg_lw_init_verbs }, | |
0a8c5da3 | 3626 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
d681518a TI |
3627 | .dac_nids = alc880_dac_nids, |
3628 | .dig_out_nid = ALC880_DIGOUT_NID, | |
0a8c5da3 CM |
3629 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
3630 | .channel_mode = alc880_lg_lw_modes, | |
d681518a TI |
3631 | .input_mux = &alc880_lg_lw_capture_source, |
3632 | .unsol_event = alc880_lg_lw_unsol_event, | |
3633 | .init_hook = alc880_lg_lw_automute, | |
3634 | }, | |
df99cd33 TI |
3635 | [ALC880_MEDION_RIM] = { |
3636 | .mixers = { alc880_medion_rim_mixer }, | |
3637 | .init_verbs = { alc880_volume_init_verbs, | |
3638 | alc880_medion_rim_init_verbs, | |
3639 | alc_gpio2_init_verbs }, | |
3640 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3641 | .dac_nids = alc880_dac_nids, | |
3642 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3643 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3644 | .channel_mode = alc880_2_jack_modes, | |
3645 | .input_mux = &alc880_medion_rim_capture_source, | |
3646 | .unsol_event = alc880_medion_rim_unsol_event, | |
3647 | .init_hook = alc880_medion_rim_automute, | |
3648 | }, | |
16ded525 TI |
3649 | #ifdef CONFIG_SND_DEBUG |
3650 | [ALC880_TEST] = { | |
e9edcee0 TI |
3651 | .mixers = { alc880_test_mixer }, |
3652 | .init_verbs = { alc880_test_init_verbs }, | |
16ded525 TI |
3653 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
3654 | .dac_nids = alc880_test_dac_nids, | |
3655 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3656 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
3657 | .channel_mode = alc880_test_modes, | |
3658 | .input_mux = &alc880_test_capture_source, | |
3659 | }, | |
3660 | #endif | |
3661 | }; | |
3662 | ||
e9edcee0 TI |
3663 | /* |
3664 | * Automatic parse of I/O pins from the BIOS configuration | |
3665 | */ | |
3666 | ||
e9edcee0 TI |
3667 | enum { |
3668 | ALC_CTL_WIDGET_VOL, | |
3669 | ALC_CTL_WIDGET_MUTE, | |
3670 | ALC_CTL_BIND_MUTE, | |
3671 | }; | |
c8b6bf9b | 3672 | static struct snd_kcontrol_new alc880_control_templates[] = { |
e9edcee0 TI |
3673 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
3674 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
985be54b | 3675 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
e9edcee0 TI |
3676 | }; |
3677 | ||
3678 | /* add dynamic controls */ | |
f12ab1e0 TI |
3679 | static int add_control(struct alc_spec *spec, int type, const char *name, |
3680 | unsigned long val) | |
e9edcee0 | 3681 | { |
c8b6bf9b | 3682 | struct snd_kcontrol_new *knew; |
e9edcee0 | 3683 | |
603c4019 TI |
3684 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
3685 | knew = snd_array_new(&spec->kctls); | |
3686 | if (!knew) | |
3687 | return -ENOMEM; | |
e9edcee0 | 3688 | *knew = alc880_control_templates[type]; |
543537bd | 3689 | knew->name = kstrdup(name, GFP_KERNEL); |
f12ab1e0 | 3690 | if (!knew->name) |
e9edcee0 TI |
3691 | return -ENOMEM; |
3692 | knew->private_value = val; | |
e9edcee0 TI |
3693 | return 0; |
3694 | } | |
3695 | ||
3696 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) | |
3697 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
3698 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
3699 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
3700 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) | |
3701 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) | |
3702 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | |
3703 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
3704 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
3705 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
3706 | #define ALC880_PIN_CD_NID 0x1c | |
3707 | ||
3708 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
3709 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
3710 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
3711 | { |
3712 | hda_nid_t nid; | |
3713 | int assigned[4]; | |
3714 | int i, j; | |
3715 | ||
3716 | memset(assigned, 0, sizeof(assigned)); | |
b0af0de5 | 3717 | spec->multiout.dac_nids = spec->private_dac_nids; |
e9edcee0 TI |
3718 | |
3719 | /* check the pins hardwired to audio widget */ | |
3720 | for (i = 0; i < cfg->line_outs; i++) { | |
3721 | nid = cfg->line_out_pins[i]; | |
3722 | if (alc880_is_fixed_pin(nid)) { | |
3723 | int idx = alc880_fixed_pin_idx(nid); | |
5014f193 | 3724 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
e9edcee0 TI |
3725 | assigned[idx] = 1; |
3726 | } | |
3727 | } | |
3728 | /* left pins can be connect to any audio widget */ | |
3729 | for (i = 0; i < cfg->line_outs; i++) { | |
3730 | nid = cfg->line_out_pins[i]; | |
3731 | if (alc880_is_fixed_pin(nid)) | |
3732 | continue; | |
3733 | /* search for an empty channel */ | |
3734 | for (j = 0; j < cfg->line_outs; j++) { | |
f12ab1e0 TI |
3735 | if (!assigned[j]) { |
3736 | spec->multiout.dac_nids[i] = | |
3737 | alc880_idx_to_dac(j); | |
e9edcee0 TI |
3738 | assigned[j] = 1; |
3739 | break; | |
3740 | } | |
3741 | } | |
3742 | } | |
3743 | spec->multiout.num_dacs = cfg->line_outs; | |
3744 | return 0; | |
3745 | } | |
3746 | ||
3747 | /* add playback controls from the parsed DAC table */ | |
df694daa KY |
3748 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
3749 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
3750 | { |
3751 | char name[32]; | |
f12ab1e0 TI |
3752 | static const char *chname[4] = { |
3753 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
3754 | }; | |
e9edcee0 TI |
3755 | hda_nid_t nid; |
3756 | int i, err; | |
3757 | ||
3758 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 3759 | if (!spec->multiout.dac_nids[i]) |
e9edcee0 TI |
3760 | continue; |
3761 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
3762 | if (i == 2) { | |
3763 | /* Center/LFE */ | |
f12ab1e0 TI |
3764 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
3765 | "Center Playback Volume", | |
3766 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
3767 | HDA_OUTPUT)); | |
3768 | if (err < 0) | |
e9edcee0 | 3769 | return err; |
f12ab1e0 TI |
3770 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
3771 | "LFE Playback Volume", | |
3772 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
3773 | HDA_OUTPUT)); | |
3774 | if (err < 0) | |
e9edcee0 | 3775 | return err; |
f12ab1e0 TI |
3776 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
3777 | "Center Playback Switch", | |
3778 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | |
3779 | HDA_INPUT)); | |
3780 | if (err < 0) | |
e9edcee0 | 3781 | return err; |
f12ab1e0 TI |
3782 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
3783 | "LFE Playback Switch", | |
3784 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | |
3785 | HDA_INPUT)); | |
3786 | if (err < 0) | |
e9edcee0 TI |
3787 | return err; |
3788 | } else { | |
3789 | sprintf(name, "%s Playback Volume", chname[i]); | |
f12ab1e0 TI |
3790 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3791 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
3792 | HDA_OUTPUT)); | |
3793 | if (err < 0) | |
e9edcee0 TI |
3794 | return err; |
3795 | sprintf(name, "%s Playback Switch", chname[i]); | |
f12ab1e0 TI |
3796 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
3797 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | |
3798 | HDA_INPUT)); | |
3799 | if (err < 0) | |
e9edcee0 TI |
3800 | return err; |
3801 | } | |
3802 | } | |
e9edcee0 TI |
3803 | return 0; |
3804 | } | |
3805 | ||
8d88bc3d TI |
3806 | /* add playback controls for speaker and HP outputs */ |
3807 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
3808 | const char *pfx) | |
e9edcee0 TI |
3809 | { |
3810 | hda_nid_t nid; | |
3811 | int err; | |
8d88bc3d | 3812 | char name[32]; |
e9edcee0 | 3813 | |
f12ab1e0 | 3814 | if (!pin) |
e9edcee0 TI |
3815 | return 0; |
3816 | ||
3817 | if (alc880_is_fixed_pin(pin)) { | |
3818 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
82bc955f | 3819 | /* specify the DAC as the extra output */ |
f12ab1e0 | 3820 | if (!spec->multiout.hp_nid) |
e9edcee0 | 3821 | spec->multiout.hp_nid = nid; |
82bc955f TI |
3822 | else |
3823 | spec->multiout.extra_out_nid[0] = nid; | |
e9edcee0 TI |
3824 | /* control HP volume/switch on the output mixer amp */ |
3825 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
8d88bc3d | 3826 | sprintf(name, "%s Playback Volume", pfx); |
f12ab1e0 TI |
3827 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3828 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
3829 | if (err < 0) | |
e9edcee0 | 3830 | return err; |
8d88bc3d | 3831 | sprintf(name, "%s Playback Switch", pfx); |
f12ab1e0 TI |
3832 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
3833 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
3834 | if (err < 0) | |
e9edcee0 TI |
3835 | return err; |
3836 | } else if (alc880_is_multi_pin(pin)) { | |
3837 | /* set manual connection */ | |
e9edcee0 | 3838 | /* we have only a switch on HP-out PIN */ |
8d88bc3d | 3839 | sprintf(name, "%s Playback Switch", pfx); |
f12ab1e0 TI |
3840 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
3841 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
3842 | if (err < 0) | |
e9edcee0 TI |
3843 | return err; |
3844 | } | |
3845 | return 0; | |
3846 | } | |
3847 | ||
3848 | /* create input playback/capture controls for the given pin */ | |
f12ab1e0 TI |
3849 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
3850 | const char *ctlname, | |
df694daa | 3851 | int idx, hda_nid_t mix_nid) |
e9edcee0 TI |
3852 | { |
3853 | char name[32]; | |
df694daa | 3854 | int err; |
e9edcee0 TI |
3855 | |
3856 | sprintf(name, "%s Playback Volume", ctlname); | |
f12ab1e0 TI |
3857 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3858 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
3859 | if (err < 0) | |
e9edcee0 TI |
3860 | return err; |
3861 | sprintf(name, "%s Playback Switch", ctlname); | |
f12ab1e0 TI |
3862 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
3863 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
3864 | if (err < 0) | |
e9edcee0 TI |
3865 | return err; |
3866 | return 0; | |
3867 | } | |
3868 | ||
3869 | /* create playback/capture controls for input pins */ | |
df694daa KY |
3870 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
3871 | const struct auto_pin_cfg *cfg) | |
e9edcee0 | 3872 | { |
e9edcee0 | 3873 | struct hda_input_mux *imux = &spec->private_imux; |
df694daa | 3874 | int i, err, idx; |
e9edcee0 TI |
3875 | |
3876 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
3877 | if (alc880_is_input_pin(cfg->input_pins[i])) { | |
df694daa | 3878 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
4a471b7d TI |
3879 | err = new_analog_input(spec, cfg->input_pins[i], |
3880 | auto_pin_cfg_labels[i], | |
df694daa | 3881 | idx, 0x0b); |
e9edcee0 TI |
3882 | if (err < 0) |
3883 | return err; | |
f12ab1e0 TI |
3884 | imux->items[imux->num_items].label = |
3885 | auto_pin_cfg_labels[i]; | |
3886 | imux->items[imux->num_items].index = | |
3887 | alc880_input_pin_idx(cfg->input_pins[i]); | |
e9edcee0 TI |
3888 | imux->num_items++; |
3889 | } | |
3890 | } | |
3891 | return 0; | |
3892 | } | |
3893 | ||
f6c7e546 TI |
3894 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
3895 | unsigned int pin_type) | |
3896 | { | |
3897 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3898 | pin_type); | |
3899 | /* unmute pin */ | |
d260cdf6 TI |
3900 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
3901 | AMP_OUT_UNMUTE); | |
f6c7e546 TI |
3902 | } |
3903 | ||
df694daa KY |
3904 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
3905 | hda_nid_t nid, int pin_type, | |
e9edcee0 TI |
3906 | int dac_idx) |
3907 | { | |
f6c7e546 | 3908 | alc_set_pin_output(codec, nid, pin_type); |
e9edcee0 TI |
3909 | /* need the manual connection? */ |
3910 | if (alc880_is_multi_pin(nid)) { | |
3911 | struct alc_spec *spec = codec->spec; | |
3912 | int idx = alc880_multi_pin_idx(nid); | |
3913 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
3914 | AC_VERB_SET_CONNECT_SEL, | |
3915 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
3916 | } | |
3917 | } | |
3918 | ||
baba8ee9 TI |
3919 | static int get_pin_type(int line_out_type) |
3920 | { | |
3921 | if (line_out_type == AUTO_PIN_HP_OUT) | |
3922 | return PIN_HP; | |
3923 | else | |
3924 | return PIN_OUT; | |
3925 | } | |
3926 | ||
e9edcee0 TI |
3927 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
3928 | { | |
3929 | struct alc_spec *spec = codec->spec; | |
3930 | int i; | |
ea1fb29a | 3931 | |
bc9f98a9 | 3932 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
e9edcee0 TI |
3933 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
3934 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 TI |
3935 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
3936 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
e9edcee0 TI |
3937 | } |
3938 | } | |
3939 | ||
8d88bc3d | 3940 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
e9edcee0 TI |
3941 | { |
3942 | struct alc_spec *spec = codec->spec; | |
3943 | hda_nid_t pin; | |
3944 | ||
82bc955f | 3945 | pin = spec->autocfg.speaker_pins[0]; |
8d88bc3d TI |
3946 | if (pin) /* connect to front */ |
3947 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
eb06ed8f | 3948 | pin = spec->autocfg.hp_pins[0]; |
e9edcee0 TI |
3949 | if (pin) /* connect to front */ |
3950 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
3951 | } | |
3952 | ||
3953 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
3954 | { | |
3955 | struct alc_spec *spec = codec->spec; | |
3956 | int i; | |
3957 | ||
3958 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
3959 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
3960 | if (alc880_is_input_pin(nid)) { | |
f12ab1e0 TI |
3961 | snd_hda_codec_write(codec, nid, 0, |
3962 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3963 | i <= AUTO_PIN_FRONT_MIC ? | |
3964 | PIN_VREF80 : PIN_IN); | |
e9edcee0 | 3965 | if (nid != ALC880_PIN_CD_NID) |
f12ab1e0 TI |
3966 | snd_hda_codec_write(codec, nid, 0, |
3967 | AC_VERB_SET_AMP_GAIN_MUTE, | |
e9edcee0 TI |
3968 | AMP_OUT_MUTE); |
3969 | } | |
3970 | } | |
3971 | } | |
3972 | ||
3973 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
3974 | /* return 1 if successful, 0 if the proper config is not found, |
3975 | * or a negative error code | |
3976 | */ | |
e9edcee0 TI |
3977 | static int alc880_parse_auto_config(struct hda_codec *codec) |
3978 | { | |
3979 | struct alc_spec *spec = codec->spec; | |
3980 | int err; | |
df694daa | 3981 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
e9edcee0 | 3982 | |
f12ab1e0 TI |
3983 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
3984 | alc880_ignore); | |
3985 | if (err < 0) | |
e9edcee0 | 3986 | return err; |
f12ab1e0 | 3987 | if (!spec->autocfg.line_outs) |
e9edcee0 | 3988 | return 0; /* can't find valid BIOS pin config */ |
df694daa | 3989 | |
f12ab1e0 TI |
3990 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
3991 | if (err < 0) | |
3992 | return err; | |
3993 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
3994 | if (err < 0) | |
3995 | return err; | |
3996 | err = alc880_auto_create_extra_out(spec, | |
3997 | spec->autocfg.speaker_pins[0], | |
3998 | "Speaker"); | |
3999 | if (err < 0) | |
4000 | return err; | |
4001 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
4002 | "Headphone"); | |
4003 | if (err < 0) | |
4004 | return err; | |
4005 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
4006 | if (err < 0) | |
e9edcee0 TI |
4007 | return err; |
4008 | ||
4009 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
4010 | ||
4011 | if (spec->autocfg.dig_out_pin) | |
4012 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | |
4013 | if (spec->autocfg.dig_in_pin) | |
4014 | spec->dig_in_nid = ALC880_DIGIN_NID; | |
4015 | ||
603c4019 | 4016 | if (spec->kctls.list) |
d88897ea | 4017 | add_mixer(spec, spec->kctls.list); |
e9edcee0 | 4018 | |
d88897ea | 4019 | add_verb(spec, alc880_volume_init_verbs); |
e9edcee0 | 4020 | |
a1e8d2da | 4021 | spec->num_mux_defs = 1; |
e9edcee0 TI |
4022 | spec->input_mux = &spec->private_imux; |
4023 | ||
e044c39a | 4024 | store_pin_configs(codec); |
e9edcee0 TI |
4025 | return 1; |
4026 | } | |
4027 | ||
ae6b813a TI |
4028 | /* additional initialization for auto-configuration model */ |
4029 | static void alc880_auto_init(struct hda_codec *codec) | |
e9edcee0 | 4030 | { |
f6c7e546 | 4031 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 4032 | alc880_auto_init_multi_out(codec); |
8d88bc3d | 4033 | alc880_auto_init_extra_out(codec); |
e9edcee0 | 4034 | alc880_auto_init_analog_input(codec); |
f6c7e546 | 4035 | if (spec->unsol_event) |
7fb0d78f | 4036 | alc_inithook(codec); |
e9edcee0 TI |
4037 | } |
4038 | ||
4039 | /* | |
4040 | * OK, here we have finally the patch for ALC880 | |
4041 | */ | |
4042 | ||
f9e336f6 TI |
4043 | static void set_capture_mixer(struct alc_spec *spec) |
4044 | { | |
4045 | static struct snd_kcontrol_new *caps[3] = { | |
4046 | alc_capture_mixer1, | |
4047 | alc_capture_mixer2, | |
4048 | alc_capture_mixer3, | |
4049 | }; | |
4050 | if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3) | |
4051 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; | |
4052 | } | |
4053 | ||
1da177e4 LT |
4054 | static int patch_alc880(struct hda_codec *codec) |
4055 | { | |
4056 | struct alc_spec *spec; | |
4057 | int board_config; | |
df694daa | 4058 | int err; |
1da177e4 | 4059 | |
e560d8d8 | 4060 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
4061 | if (spec == NULL) |
4062 | return -ENOMEM; | |
4063 | ||
4064 | codec->spec = spec; | |
4065 | ||
f5fcc13c TI |
4066 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
4067 | alc880_models, | |
4068 | alc880_cfg_tbl); | |
4069 | if (board_config < 0) { | |
9c7f852e TI |
4070 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
4071 | "trying auto-probe from BIOS...\n"); | |
e9edcee0 | 4072 | board_config = ALC880_AUTO; |
1da177e4 | 4073 | } |
1da177e4 | 4074 | |
e9edcee0 TI |
4075 | if (board_config == ALC880_AUTO) { |
4076 | /* automatic parse from the BIOS config */ | |
4077 | err = alc880_parse_auto_config(codec); | |
4078 | if (err < 0) { | |
4079 | alc_free(codec); | |
4080 | return err; | |
f12ab1e0 | 4081 | } else if (!err) { |
9c7f852e TI |
4082 | printk(KERN_INFO |
4083 | "hda_codec: Cannot set up configuration " | |
4084 | "from BIOS. Using 3-stack mode...\n"); | |
e9edcee0 TI |
4085 | board_config = ALC880_3ST; |
4086 | } | |
1da177e4 LT |
4087 | } |
4088 | ||
df694daa KY |
4089 | if (board_config != ALC880_AUTO) |
4090 | setup_preset(spec, &alc880_presets[board_config]); | |
1da177e4 LT |
4091 | |
4092 | spec->stream_name_analog = "ALC880 Analog"; | |
4093 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | |
4094 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
6330079f | 4095 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
1da177e4 LT |
4096 | |
4097 | spec->stream_name_digital = "ALC880 Digital"; | |
4098 | spec->stream_digital_playback = &alc880_pcm_digital_playback; | |
4099 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
4100 | ||
f12ab1e0 | 4101 | if (!spec->adc_nids && spec->input_mux) { |
e9edcee0 | 4102 | /* check whether NID 0x07 is valid */ |
54d17403 | 4103 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
f12ab1e0 TI |
4104 | /* get type */ |
4105 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
e9edcee0 TI |
4106 | if (wcap != AC_WID_AUD_IN) { |
4107 | spec->adc_nids = alc880_adc_nids_alt; | |
4108 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
e9edcee0 TI |
4109 | } else { |
4110 | spec->adc_nids = alc880_adc_nids; | |
4111 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
e9edcee0 TI |
4112 | } |
4113 | } | |
f9e336f6 | 4114 | set_capture_mixer(spec); |
1da177e4 | 4115 | |
2134ea4f TI |
4116 | spec->vmaster_nid = 0x0c; |
4117 | ||
1da177e4 | 4118 | codec->patch_ops = alc_patch_ops; |
e9edcee0 | 4119 | if (board_config == ALC880_AUTO) |
ae6b813a | 4120 | spec->init_hook = alc880_auto_init; |
cb53c626 TI |
4121 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4122 | if (!spec->loopback.amplist) | |
4123 | spec->loopback.amplist = alc880_loopbacks; | |
4124 | #endif | |
1da177e4 LT |
4125 | |
4126 | return 0; | |
4127 | } | |
4128 | ||
e9edcee0 | 4129 | |
1da177e4 LT |
4130 | /* |
4131 | * ALC260 support | |
4132 | */ | |
4133 | ||
e9edcee0 TI |
4134 | static hda_nid_t alc260_dac_nids[1] = { |
4135 | /* front */ | |
4136 | 0x02, | |
4137 | }; | |
4138 | ||
4139 | static hda_nid_t alc260_adc_nids[1] = { | |
4140 | /* ADC0 */ | |
4141 | 0x04, | |
4142 | }; | |
4143 | ||
df694daa | 4144 | static hda_nid_t alc260_adc_nids_alt[1] = { |
e9edcee0 TI |
4145 | /* ADC1 */ |
4146 | 0x05, | |
4147 | }; | |
4148 | ||
d57fdac0 JW |
4149 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
4150 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
4151 | */ | |
4152 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
4c5186ed JW |
4153 | /* ADC0, ADC1 */ |
4154 | 0x04, 0x05 | |
4155 | }; | |
4156 | ||
e9edcee0 TI |
4157 | #define ALC260_DIGOUT_NID 0x03 |
4158 | #define ALC260_DIGIN_NID 0x06 | |
4159 | ||
4160 | static struct hda_input_mux alc260_capture_source = { | |
4161 | .num_items = 4, | |
4162 | .items = { | |
4163 | { "Mic", 0x0 }, | |
4164 | { "Front Mic", 0x1 }, | |
4165 | { "Line", 0x2 }, | |
4166 | { "CD", 0x4 }, | |
4167 | }, | |
4168 | }; | |
4169 | ||
17e7aec6 | 4170 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
a1e8d2da JW |
4171 | * headphone jack and the internal CD lines since these are the only pins at |
4172 | * which audio can appear. For flexibility, also allow the option of | |
4173 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
4174 | * connection to the mixer output). | |
a9430dd8 | 4175 | */ |
a1e8d2da JW |
4176 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
4177 | { | |
4178 | .num_items = 3, | |
4179 | .items = { | |
4180 | { "Mic/Line", 0x0 }, | |
4181 | { "CD", 0x4 }, | |
4182 | { "Headphone", 0x2 }, | |
4183 | }, | |
a9430dd8 | 4184 | }, |
a1e8d2da JW |
4185 | { |
4186 | .num_items = 4, | |
4187 | .items = { | |
4188 | { "Mic/Line", 0x0 }, | |
4189 | { "CD", 0x4 }, | |
4190 | { "Headphone", 0x2 }, | |
4191 | { "Mixer", 0x5 }, | |
4192 | }, | |
4193 | }, | |
4194 | ||
a9430dd8 JW |
4195 | }; |
4196 | ||
a1e8d2da JW |
4197 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
4198 | * the Fujitsu S702x, but jacks are marked differently. | |
0bfc90e9 | 4199 | */ |
a1e8d2da JW |
4200 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
4201 | { | |
4202 | .num_items = 4, | |
4203 | .items = { | |
4204 | { "Mic", 0x0 }, | |
4205 | { "Line", 0x2 }, | |
4206 | { "CD", 0x4 }, | |
4207 | { "Headphone", 0x5 }, | |
4208 | }, | |
4209 | }, | |
4210 | { | |
4211 | .num_items = 5, | |
4212 | .items = { | |
4213 | { "Mic", 0x0 }, | |
4214 | { "Line", 0x2 }, | |
4215 | { "CD", 0x4 }, | |
4216 | { "Headphone", 0x6 }, | |
4217 | { "Mixer", 0x5 }, | |
4218 | }, | |
0bfc90e9 JW |
4219 | }, |
4220 | }; | |
1da177e4 LT |
4221 | /* |
4222 | * This is just place-holder, so there's something for alc_build_pcms to look | |
4223 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
4224 | * element which allows changing the channel mode, so the verb list is | |
4225 | * never used. | |
4226 | */ | |
d2a6d7dc | 4227 | static struct hda_channel_mode alc260_modes[1] = { |
1da177e4 LT |
4228 | { 2, NULL }, |
4229 | }; | |
4230 | ||
df694daa KY |
4231 | |
4232 | /* Mixer combinations | |
4233 | * | |
4234 | * basic: base_output + input + pc_beep + capture | |
4235 | * HP: base_output + input + capture_alt | |
4236 | * HP_3013: hp_3013 + input + capture | |
4237 | * fujitsu: fujitsu + capture | |
0bfc90e9 | 4238 | * acer: acer + capture |
df694daa KY |
4239 | */ |
4240 | ||
4241 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
05acb863 | 4242 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 4243 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
05acb863 | 4244 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
985be54b | 4245 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
05acb863 | 4246 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
985be54b | 4247 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
1da177e4 | 4248 | { } /* end */ |
f12ab1e0 | 4249 | }; |
1da177e4 | 4250 | |
df694daa | 4251 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
16ded525 TI |
4252 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4253 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4254 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4255 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4256 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4257 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4258 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
4259 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
df694daa KY |
4260 | { } /* end */ |
4261 | }; | |
4262 | ||
4263 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { | |
4264 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4265 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4266 | { } /* end */ | |
4267 | }; | |
4268 | ||
bec15c3a TI |
4269 | /* update HP, line and mono out pins according to the master switch */ |
4270 | static void alc260_hp_master_update(struct hda_codec *codec, | |
4271 | hda_nid_t hp, hda_nid_t line, | |
4272 | hda_nid_t mono) | |
4273 | { | |
4274 | struct alc_spec *spec = codec->spec; | |
4275 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
4276 | /* change HP and line-out pins */ | |
30cde0aa | 4277 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a | 4278 | val); |
30cde0aa | 4279 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a TI |
4280 | val); |
4281 | /* mono (speaker) depending on the HP jack sense */ | |
4282 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
30cde0aa | 4283 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
bec15c3a TI |
4284 | val); |
4285 | } | |
4286 | ||
4287 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
4288 | struct snd_ctl_elem_value *ucontrol) | |
4289 | { | |
4290 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4291 | struct alc_spec *spec = codec->spec; | |
4292 | *ucontrol->value.integer.value = spec->master_sw; | |
4293 | return 0; | |
4294 | } | |
4295 | ||
4296 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
4297 | struct snd_ctl_elem_value *ucontrol) | |
4298 | { | |
4299 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4300 | struct alc_spec *spec = codec->spec; | |
4301 | int val = !!*ucontrol->value.integer.value; | |
4302 | hda_nid_t hp, line, mono; | |
4303 | ||
4304 | if (val == spec->master_sw) | |
4305 | return 0; | |
4306 | spec->master_sw = val; | |
4307 | hp = (kcontrol->private_value >> 16) & 0xff; | |
4308 | line = (kcontrol->private_value >> 8) & 0xff; | |
4309 | mono = kcontrol->private_value & 0xff; | |
4310 | alc260_hp_master_update(codec, hp, line, mono); | |
4311 | return 1; | |
4312 | } | |
4313 | ||
4314 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
4315 | { | |
4316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4317 | .name = "Master Playback Switch", | |
4318 | .info = snd_ctl_boolean_mono_info, | |
4319 | .get = alc260_hp_master_sw_get, | |
4320 | .put = alc260_hp_master_sw_put, | |
4321 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
4322 | }, | |
4323 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4324 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
4325 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
4326 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
4327 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
4328 | HDA_OUTPUT), | |
4329 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
4330 | { } /* end */ | |
4331 | }; | |
4332 | ||
4333 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
4334 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4335 | {}, | |
4336 | }; | |
4337 | ||
4338 | static void alc260_hp_automute(struct hda_codec *codec) | |
4339 | { | |
4340 | struct alc_spec *spec = codec->spec; | |
4341 | unsigned int present; | |
4342 | ||
4343 | present = snd_hda_codec_read(codec, 0x10, 0, | |
4344 | AC_VERB_GET_PIN_SENSE, 0); | |
4345 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
4346 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); | |
4347 | } | |
4348 | ||
4349 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
4350 | { | |
4351 | if ((res >> 26) == ALC880_HP_EVENT) | |
4352 | alc260_hp_automute(codec); | |
4353 | } | |
4354 | ||
df694daa | 4355 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
bec15c3a TI |
4356 | { |
4357 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4358 | .name = "Master Playback Switch", | |
4359 | .info = snd_ctl_boolean_mono_info, | |
4360 | .get = alc260_hp_master_sw_get, | |
4361 | .put = alc260_hp_master_sw_put, | |
30cde0aa | 4362 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
bec15c3a | 4363 | }, |
df694daa KY |
4364 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
4365 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
4366 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
4367 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
4368 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4369 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
4370 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
4371 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
16ded525 TI |
4372 | { } /* end */ |
4373 | }; | |
4374 | ||
3f878308 KY |
4375 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
4376 | .ops = &snd_hda_bind_vol, | |
4377 | .values = { | |
4378 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | |
4379 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | |
4380 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | |
4381 | 0 | |
4382 | }, | |
4383 | }; | |
4384 | ||
4385 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | |
4386 | .ops = &snd_hda_bind_sw, | |
4387 | .values = { | |
4388 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | |
4389 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
4390 | 0 | |
4391 | }, | |
4392 | }; | |
4393 | ||
4394 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | |
4395 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | |
4396 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | |
4397 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | |
4398 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
4399 | { } /* end */ | |
4400 | }; | |
4401 | ||
bec15c3a TI |
4402 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
4403 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4404 | {}, | |
4405 | }; | |
4406 | ||
4407 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
4408 | { | |
4409 | struct alc_spec *spec = codec->spec; | |
4410 | unsigned int present; | |
4411 | ||
4412 | present = snd_hda_codec_read(codec, 0x15, 0, | |
4413 | AC_VERB_GET_PIN_SENSE, 0); | |
4414 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
30cde0aa | 4415 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
bec15c3a TI |
4416 | } |
4417 | ||
4418 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
4419 | unsigned int res) | |
4420 | { | |
4421 | if ((res >> 26) == ALC880_HP_EVENT) | |
4422 | alc260_hp_3013_automute(codec); | |
4423 | } | |
4424 | ||
3f878308 KY |
4425 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
4426 | { | |
4427 | unsigned int present, bits; | |
4428 | ||
4429 | present = snd_hda_codec_read(codec, 0x10, 0, | |
4430 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; | |
4431 | ||
4432 | bits = present ? 0 : PIN_OUT; | |
4433 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4434 | bits); | |
4435 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4436 | bits); | |
4437 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4438 | bits); | |
4439 | } | |
4440 | ||
4441 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | |
4442 | unsigned int res) | |
4443 | { | |
4444 | if ((res >> 26) == ALC880_HP_EVENT) | |
4445 | alc260_hp_3012_automute(codec); | |
4446 | } | |
4447 | ||
4448 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | |
a1e8d2da JW |
4449 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
4450 | */ | |
c8b6bf9b | 4451 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
a9430dd8 | 4452 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 4453 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
4c5186ed | 4454 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
a9430dd8 JW |
4455 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4456 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4457 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4458 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4c5186ed | 4459 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
a9430dd8 JW |
4460 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
4461 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
31bffaa9 TI |
4462 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
4463 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
df694daa KY |
4464 | { } /* end */ |
4465 | }; | |
4466 | ||
a1e8d2da JW |
4467 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
4468 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
4469 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
4470 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
4471 | * whether this behaviour is intentional or is a hardware bug in chip | |
4472 | * revisions available in early 2006. Therefore for now allow the | |
4473 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
4474 | * that the lack of mic bias for this NID is intentional we could change the | |
4475 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
4476 | * | |
4477 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
4478 | * don't appear to make the mic bias available from the "line" jack, even | |
4479 | * though the NID used for this jack (0x14) can supply it. The theory is | |
4480 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
4481 | * and the output jack. If this turns out to be the case for all such | |
4482 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
4483 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
bd869485 JW |
4484 | * |
4485 | * The C20x Tablet series have a mono internal speaker which is controlled | |
4486 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
4487 | * controls for such models. On models without a "mono speaker" the control | |
4488 | * won't do anything. | |
a1e8d2da | 4489 | */ |
0bfc90e9 JW |
4490 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
4491 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4492 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
a1e8d2da | 4493 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
31bffaa9 | 4494 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
bd869485 | 4495 | HDA_OUTPUT), |
31bffaa9 | 4496 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
bd869485 | 4497 | HDA_INPUT), |
0bfc90e9 JW |
4498 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4499 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4502 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4504 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4505 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4506 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4507 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4508 | { } /* end */ | |
4509 | }; | |
4510 | ||
bc9f98a9 KY |
4511 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
4512 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
4513 | */ | |
4514 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
4515 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4516 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
4517 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4518 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4519 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4520 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4521 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4522 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4523 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
4524 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4525 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4526 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4527 | { } /* end */ | |
4528 | }; | |
4529 | ||
4530 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
4531 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
4532 | */ | |
4533 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
4534 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4535 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
4536 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4537 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4538 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4539 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
4540 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
4541 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4542 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4543 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4544 | { } /* end */ | |
4545 | }; | |
4546 | ||
df694daa KY |
4547 | /* |
4548 | * initialization verbs | |
4549 | */ | |
1da177e4 LT |
4550 | static struct hda_verb alc260_init_verbs[] = { |
4551 | /* Line In pin widget for input */ | |
05acb863 | 4552 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 4553 | /* CD pin widget for input */ |
05acb863 | 4554 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 4555 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
16ded525 | 4556 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 4557 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
16ded525 | 4558 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 4559 | /* LINE-2 is used for line-out in rear */ |
05acb863 | 4560 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 4561 | /* select line-out */ |
fd56f2db | 4562 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 | 4563 | /* LINE-OUT pin */ |
05acb863 | 4564 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 4565 | /* enable HP */ |
05acb863 | 4566 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1da177e4 | 4567 | /* enable Mono */ |
05acb863 TI |
4568 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
4569 | /* mute capture amp left and right */ | |
16ded525 | 4570 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 LT |
4571 | /* set connection select to line in (default select for this ADC) */ |
4572 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16ded525 TI |
4573 | /* mute capture amp left and right */ |
4574 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4575 | /* set connection select to line in (default select for this ADC) */ | |
4576 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
05acb863 TI |
4577 | /* set vol=0 Line-Out mixer amp left and right */ |
4578 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4579 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4580 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4581 | /* set vol=0 HP mixer amp left and right */ | |
4582 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4583 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4584 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4585 | /* set vol=0 Mono mixer amp left and right */ | |
4586 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4587 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4588 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4589 | /* unmute LINE-2 out pin */ | |
4590 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f12ab1e0 TI |
4591 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4592 | * Line In 2 = 0x03 | |
4593 | */ | |
cb53c626 TI |
4594 | /* mute analog inputs */ |
4595 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4597 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 4600 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
05acb863 TI |
4601 | /* mute Front out path */ |
4602 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4603 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4604 | /* mute Headphone out path */ | |
4605 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4606 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4607 | /* mute Mono out path */ | |
4608 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4609 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
4610 | { } |
4611 | }; | |
4612 | ||
474167d6 | 4613 | #if 0 /* should be identical with alc260_init_verbs? */ |
df694daa KY |
4614 | static struct hda_verb alc260_hp_init_verbs[] = { |
4615 | /* Headphone and output */ | |
4616 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
4617 | /* mono output */ | |
4618 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4619 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
4620 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4621 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
4622 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4623 | /* Line In pin widget for input */ | |
4624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4625 | /* Line-2 pin widget for output */ | |
4626 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4627 | /* CD pin widget for input */ | |
4628 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4629 | /* unmute amp left and right */ | |
4630 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
4631 | /* set connection select to line in (default select for this ADC) */ | |
4632 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
4633 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
4634 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4635 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
4637 | /* unmute HP mixer amp left and right (volume = 0) */ | |
4638 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4639 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4640 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
4641 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4642 | * Line In 2 = 0x03 | |
4643 | */ | |
cb53c626 TI |
4644 | /* mute analog inputs */ |
4645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4646 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
4650 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
4651 | /* Unmute Front out path */ | |
4652 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4653 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4654 | /* Unmute Headphone out path */ | |
4655 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4656 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4657 | /* Unmute Mono out path */ | |
4658 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4659 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4660 | { } | |
4661 | }; | |
474167d6 | 4662 | #endif |
df694daa KY |
4663 | |
4664 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
4665 | /* Line out and output */ | |
4666 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4667 | /* mono output */ | |
4668 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4669 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
4670 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4671 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
4672 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4673 | /* Line In pin widget for input */ | |
4674 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4675 | /* Headphone pin widget for output */ | |
4676 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
4677 | /* CD pin widget for input */ | |
4678 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4679 | /* unmute amp left and right */ | |
4680 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
4681 | /* set connection select to line in (default select for this ADC) */ | |
4682 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
4683 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
4684 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4685 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
4687 | /* unmute HP mixer amp left and right (volume = 0) */ | |
4688 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4689 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4690 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
4691 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4692 | * Line In 2 = 0x03 | |
4693 | */ | |
cb53c626 TI |
4694 | /* mute analog inputs */ |
4695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4696 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
4700 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
4701 | /* Unmute Front out path */ | |
4702 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4703 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4704 | /* Unmute Headphone out path */ | |
4705 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4706 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4707 | /* Unmute Mono out path */ | |
4708 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4709 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4710 | { } | |
4711 | }; | |
4712 | ||
a9430dd8 | 4713 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
a1e8d2da JW |
4714 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
4715 | * audio = 0x16, internal speaker = 0x10. | |
a9430dd8 JW |
4716 | */ |
4717 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
4718 | /* Disable all GPIOs */ | |
4719 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
4720 | /* Internal speaker is connected to headphone pin */ | |
4721 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4722 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
4723 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
f7ace40d JW |
4724 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
4725 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4726 | /* Ensure all other unused pins are disabled and muted. */ | |
4727 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4728 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a9430dd8 | 4729 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d | 4730 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
a9430dd8 | 4731 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d JW |
4732 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
4733 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4734 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4735 | ||
4736 | /* Disable digital (SPDIF) pins */ | |
4737 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4738 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
a9430dd8 | 4739 | |
ea1fb29a | 4740 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
f7ace40d JW |
4741 | * when acting as an output. |
4742 | */ | |
4743 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4c5186ed | 4744 | |
f7ace40d | 4745 | /* Start with output sum widgets muted and their output gains at min */ |
8b33a5aa TI |
4746 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
4747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4749 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4751 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4752 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4753 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4754 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a9430dd8 | 4755 | |
f7ace40d JW |
4756 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
4757 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4758 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
4759 | * If the pin mode is changed by the user the pin mode control will | |
4760 | * take care of enabling the pin's input/output buffers as needed. | |
4761 | * Therefore there's no need to enable the input buffer at this | |
4762 | * stage. | |
cdcd9268 | 4763 | */ |
f7ace40d | 4764 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
ea1fb29a | 4765 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
cdcd9268 JW |
4766 | * mixer ctrl) |
4767 | */ | |
f7ace40d JW |
4768 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4769 | ||
4770 | /* Mute capture amp left and right */ | |
4771 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 4772 | /* Set ADC connection select to match default mixer setting - line |
f7ace40d JW |
4773 | * in (on mic1 pin) |
4774 | */ | |
4775 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4776 | ||
4777 | /* Do the same for the second ADC: mute capture input amp and | |
4778 | * set ADC connection to line in (on mic1 pin) | |
4779 | */ | |
4780 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4781 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4782 | ||
4783 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
4784 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
4785 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
4786 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
4787 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
4788 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
4789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
4790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
4791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4a471b7d TI |
4792 | |
4793 | { } | |
a9430dd8 JW |
4794 | }; |
4795 | ||
0bfc90e9 JW |
4796 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
4797 | * similar laptops (adapted from Fujitsu init verbs). | |
4798 | */ | |
4799 | static struct hda_verb alc260_acer_init_verbs[] = { | |
4800 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
4801 | * the headphone jack. Turn this on and rely on the standard mute | |
4802 | * methods whenever the user wants to turn these outputs off. | |
4803 | */ | |
4804 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
4805 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
4806 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
4807 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
4808 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4809 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
4810 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
4811 | /* Line In jack is connected to Line1 pin */ | |
4812 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
bd869485 JW |
4813 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
4814 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
0bfc90e9 JW |
4815 | /* Ensure all other unused pins are disabled and muted. */ |
4816 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4817 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
0bfc90e9 JW |
4818 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
4819 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4820 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4821 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4822 | /* Disable digital (SPDIF) pins */ | |
4823 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4824 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4825 | ||
ea1fb29a | 4826 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
0bfc90e9 JW |
4827 | * bus when acting as outputs. |
4828 | */ | |
4829 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
4830 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4831 | ||
4832 | /* Start with output sum widgets muted and their output gains at min */ | |
4833 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4835 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4836 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4837 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4838 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4839 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4840 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4841 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4842 | ||
f12ab1e0 TI |
4843 | /* Unmute Line-out pin widget amp left and right |
4844 | * (no equiv mixer ctrl) | |
4845 | */ | |
0bfc90e9 | 4846 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
bd869485 JW |
4847 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
4848 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
0bfc90e9 JW |
4849 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
4850 | * inputs. If the pin mode is changed by the user the pin mode control | |
4851 | * will take care of enabling the pin's input/output buffers as needed. | |
4852 | * Therefore there's no need to enable the input buffer at this | |
4853 | * stage. | |
4854 | */ | |
4855 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4856 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4857 | ||
4858 | /* Mute capture amp left and right */ | |
4859 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4860 | /* Set ADC connection select to match default mixer setting - mic | |
4861 | * (on mic1 pin) | |
4862 | */ | |
4863 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4864 | ||
4865 | /* Do similar with the second ADC: mute capture input amp and | |
a1e8d2da | 4866 | * set ADC connection to mic to match ALSA's default state. |
0bfc90e9 JW |
4867 | */ |
4868 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a1e8d2da | 4869 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
0bfc90e9 JW |
4870 | |
4871 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
4872 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
4873 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
4874 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
4875 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
4876 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
4877 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
4878 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
4879 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4880 | ||
4881 | { } | |
4882 | }; | |
4883 | ||
bc9f98a9 KY |
4884 | static struct hda_verb alc260_will_verbs[] = { |
4885 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4886 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4887 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4888 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
4889 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
4890 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
4891 | {} | |
4892 | }; | |
4893 | ||
4894 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
4895 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
4896 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
4897 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
4898 | ||
4899 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
4900 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
4901 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
4902 | ||
4903 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4904 | {} | |
4905 | }; | |
4906 | ||
4907 | /* toggle speaker-output according to the hp-jack state */ | |
4908 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
4909 | { | |
4910 | unsigned int present; | |
4911 | ||
4912 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
4913 | present = snd_hda_codec_read(codec, 0x0f, 0, | |
4914 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
4915 | if (present) { | |
82beb8fd TI |
4916 | snd_hda_codec_write_cache(codec, 0x01, 0, |
4917 | AC_VERB_SET_GPIO_DATA, 1); | |
4918 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
4919 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4920 | PIN_HP); | |
bc9f98a9 | 4921 | } else { |
82beb8fd TI |
4922 | snd_hda_codec_write_cache(codec, 0x01, 0, |
4923 | AC_VERB_SET_GPIO_DATA, 0); | |
4924 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
4925 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4926 | PIN_OUT); | |
bc9f98a9 KY |
4927 | } |
4928 | } | |
4929 | ||
4930 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
4931 | unsigned int res) | |
4932 | { | |
4933 | if ((res >> 26) == ALC880_HP_EVENT) | |
4934 | alc260_replacer_672v_automute(codec); | |
4935 | } | |
4936 | ||
3f878308 KY |
4937 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
4938 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
4939 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
4940 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4941 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4942 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4943 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4944 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
4945 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4946 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4947 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4948 | {} | |
4949 | }; | |
4950 | ||
7cf51e48 JW |
4951 | /* Test configuration for debugging, modelled after the ALC880 test |
4952 | * configuration. | |
4953 | */ | |
4954 | #ifdef CONFIG_SND_DEBUG | |
4955 | static hda_nid_t alc260_test_dac_nids[1] = { | |
4956 | 0x02, | |
4957 | }; | |
4958 | static hda_nid_t alc260_test_adc_nids[2] = { | |
4959 | 0x04, 0x05, | |
4960 | }; | |
a1e8d2da | 4961 | /* For testing the ALC260, each input MUX needs its own definition since |
ea1fb29a | 4962 | * the signal assignments are different. This assumes that the first ADC |
a1e8d2da | 4963 | * is NID 0x04. |
17e7aec6 | 4964 | */ |
a1e8d2da JW |
4965 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
4966 | { | |
4967 | .num_items = 7, | |
4968 | .items = { | |
4969 | { "MIC1 pin", 0x0 }, | |
4970 | { "MIC2 pin", 0x1 }, | |
4971 | { "LINE1 pin", 0x2 }, | |
4972 | { "LINE2 pin", 0x3 }, | |
4973 | { "CD pin", 0x4 }, | |
4974 | { "LINE-OUT pin", 0x5 }, | |
4975 | { "HP-OUT pin", 0x6 }, | |
4976 | }, | |
4977 | }, | |
4978 | { | |
4979 | .num_items = 8, | |
4980 | .items = { | |
4981 | { "MIC1 pin", 0x0 }, | |
4982 | { "MIC2 pin", 0x1 }, | |
4983 | { "LINE1 pin", 0x2 }, | |
4984 | { "LINE2 pin", 0x3 }, | |
4985 | { "CD pin", 0x4 }, | |
4986 | { "Mixer", 0x5 }, | |
4987 | { "LINE-OUT pin", 0x6 }, | |
4988 | { "HP-OUT pin", 0x7 }, | |
4989 | }, | |
7cf51e48 JW |
4990 | }, |
4991 | }; | |
4992 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
4993 | /* Output driver widgets */ | |
4994 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
4995 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
4996 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
4997 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
4998 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4999 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
5000 | ||
a1e8d2da JW |
5001 | /* Modes for retasking pin widgets |
5002 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
5003 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
5004 | * mention this restriction. At this stage it's not clear whether | |
5005 | * this behaviour is intentional or is a hardware bug in chip | |
5006 | * revisions available at least up until early 2006. Therefore for | |
5007 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
5008 | * choices, but if it turns out that the lack of mic bias for these | |
5009 | * NIDs is intentional we could change their modes from | |
5010 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
5011 | */ | |
7cf51e48 JW |
5012 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
5013 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
5014 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
5015 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
5016 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
5017 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
5018 | ||
5019 | /* Loopback mixer controls */ | |
5020 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
5021 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
5022 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
5023 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
5024 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
5025 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
5026 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
5027 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
5028 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
5029 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
5030 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
5031 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
5032 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | |
5033 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
5034 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
5035 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
5c8f858d JW |
5036 | |
5037 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
5038 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
5039 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
5040 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
5041 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
5042 | ||
92621f13 JW |
5043 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
5044 | * is ambigious as to which NID is which; testing on laptops which | |
ea1fb29a | 5045 | * make this output available should provide clarification. |
92621f13 JW |
5046 | */ |
5047 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
5048 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
5049 | ||
f8225f6d JW |
5050 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
5051 | * this output to turn on an external amplifier. | |
5052 | */ | |
5053 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
5054 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
5055 | ||
7cf51e48 JW |
5056 | { } /* end */ |
5057 | }; | |
5058 | static struct hda_verb alc260_test_init_verbs[] = { | |
5c8f858d JW |
5059 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
5060 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
5061 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
5062 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
5063 | ||
7cf51e48 JW |
5064 | /* Enable retasking pins as output, initially without power amp */ |
5065 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5066 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5067 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5069 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5070 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5071 | ||
92621f13 JW |
5072 | /* Disable digital (SPDIF) pins initially, but users can enable |
5073 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
5074 | * payload also sets the generation to 0, output to be in "consumer" | |
5075 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
5076 | * control. | |
5077 | */ | |
7cf51e48 JW |
5078 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
5079 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
5080 | ||
ea1fb29a | 5081 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
7cf51e48 JW |
5082 | * OUT1 sum bus when acting as an output. |
5083 | */ | |
5084 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
5085 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
5086 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
5087 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
5088 | ||
5089 | /* Start with output sum widgets muted and their output gains at min */ | |
5090 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5091 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5092 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5093 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5095 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5096 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5097 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5098 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5099 | ||
cdcd9268 JW |
5100 | /* Unmute retasking pin widget output buffers since the default |
5101 | * state appears to be output. As the pin mode is changed by the | |
5102 | * user the pin mode control will take care of enabling the pin's | |
5103 | * input/output buffers as needed. | |
5104 | */ | |
7cf51e48 JW |
5105 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
5106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5107 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5108 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5109 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5110 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5111 | /* Also unmute the mono-out pin widget */ | |
5112 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5113 | ||
7cf51e48 JW |
5114 | /* Mute capture amp left and right */ |
5115 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
f7ace40d JW |
5116 | /* Set ADC connection select to match default mixer setting (mic1 |
5117 | * pin) | |
7cf51e48 JW |
5118 | */ |
5119 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5120 | ||
5121 | /* Do the same for the second ADC: mute capture input amp and | |
f7ace40d | 5122 | * set ADC connection to mic1 pin |
7cf51e48 JW |
5123 | */ |
5124 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5125 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5126 | ||
5127 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
5128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
5129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
5130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
5131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
5132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
5133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
5134 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
5135 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
5136 | ||
5137 | { } | |
5138 | }; | |
5139 | #endif | |
5140 | ||
6330079f TI |
5141 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
5142 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
1da177e4 | 5143 | |
a3bcba38 TI |
5144 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
5145 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
5146 | ||
df694daa KY |
5147 | /* |
5148 | * for BIOS auto-configuration | |
5149 | */ | |
16ded525 | 5150 | |
df694daa | 5151 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
863b4518 | 5152 | const char *pfx, int *vol_bits) |
df694daa KY |
5153 | { |
5154 | hda_nid_t nid_vol; | |
5155 | unsigned long vol_val, sw_val; | |
5156 | char name[32]; | |
5157 | int err; | |
5158 | ||
5159 | if (nid >= 0x0f && nid < 0x11) { | |
5160 | nid_vol = nid - 0x7; | |
5161 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
5162 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
5163 | } else if (nid == 0x11) { | |
5164 | nid_vol = nid - 0x7; | |
5165 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
5166 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
5167 | } else if (nid >= 0x12 && nid <= 0x15) { | |
5168 | nid_vol = 0x08; | |
5169 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
5170 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
5171 | } else | |
5172 | return 0; /* N/A */ | |
ea1fb29a | 5173 | |
863b4518 TI |
5174 | if (!(*vol_bits & (1 << nid_vol))) { |
5175 | /* first control for the volume widget */ | |
5176 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | |
5177 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); | |
5178 | if (err < 0) | |
5179 | return err; | |
5180 | *vol_bits |= (1 << nid_vol); | |
5181 | } | |
df694daa | 5182 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
f12ab1e0 TI |
5183 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
5184 | if (err < 0) | |
df694daa KY |
5185 | return err; |
5186 | return 1; | |
5187 | } | |
5188 | ||
5189 | /* add playback controls from the parsed DAC table */ | |
5190 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
5191 | const struct auto_pin_cfg *cfg) | |
5192 | { | |
5193 | hda_nid_t nid; | |
5194 | int err; | |
863b4518 | 5195 | int vols = 0; |
df694daa KY |
5196 | |
5197 | spec->multiout.num_dacs = 1; | |
5198 | spec->multiout.dac_nids = spec->private_dac_nids; | |
5199 | spec->multiout.dac_nids[0] = 0x02; | |
5200 | ||
5201 | nid = cfg->line_out_pins[0]; | |
5202 | if (nid) { | |
863b4518 | 5203 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
df694daa KY |
5204 | if (err < 0) |
5205 | return err; | |
5206 | } | |
5207 | ||
82bc955f | 5208 | nid = cfg->speaker_pins[0]; |
df694daa | 5209 | if (nid) { |
863b4518 | 5210 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
df694daa KY |
5211 | if (err < 0) |
5212 | return err; | |
5213 | } | |
5214 | ||
eb06ed8f | 5215 | nid = cfg->hp_pins[0]; |
df694daa | 5216 | if (nid) { |
863b4518 TI |
5217 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
5218 | &vols); | |
df694daa KY |
5219 | if (err < 0) |
5220 | return err; | |
5221 | } | |
f12ab1e0 | 5222 | return 0; |
df694daa KY |
5223 | } |
5224 | ||
5225 | /* create playback/capture controls for input pins */ | |
5226 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, | |
5227 | const struct auto_pin_cfg *cfg) | |
5228 | { | |
df694daa KY |
5229 | struct hda_input_mux *imux = &spec->private_imux; |
5230 | int i, err, idx; | |
5231 | ||
5232 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
5233 | if (cfg->input_pins[i] >= 0x12) { | |
5234 | idx = cfg->input_pins[i] - 0x12; | |
4a471b7d | 5235 | err = new_analog_input(spec, cfg->input_pins[i], |
f12ab1e0 TI |
5236 | auto_pin_cfg_labels[i], idx, |
5237 | 0x07); | |
df694daa KY |
5238 | if (err < 0) |
5239 | return err; | |
f12ab1e0 TI |
5240 | imux->items[imux->num_items].label = |
5241 | auto_pin_cfg_labels[i]; | |
df694daa KY |
5242 | imux->items[imux->num_items].index = idx; |
5243 | imux->num_items++; | |
5244 | } | |
f12ab1e0 | 5245 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
df694daa | 5246 | idx = cfg->input_pins[i] - 0x09; |
4a471b7d | 5247 | err = new_analog_input(spec, cfg->input_pins[i], |
f12ab1e0 TI |
5248 | auto_pin_cfg_labels[i], idx, |
5249 | 0x07); | |
df694daa KY |
5250 | if (err < 0) |
5251 | return err; | |
f12ab1e0 TI |
5252 | imux->items[imux->num_items].label = |
5253 | auto_pin_cfg_labels[i]; | |
df694daa KY |
5254 | imux->items[imux->num_items].index = idx; |
5255 | imux->num_items++; | |
5256 | } | |
5257 | } | |
5258 | return 0; | |
5259 | } | |
5260 | ||
5261 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
5262 | hda_nid_t nid, int pin_type, | |
5263 | int sel_idx) | |
5264 | { | |
f6c7e546 | 5265 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
5266 | /* need the manual connection? */ |
5267 | if (nid >= 0x12) { | |
5268 | int idx = nid - 0x12; | |
5269 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
5270 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
df694daa KY |
5271 | } |
5272 | } | |
5273 | ||
5274 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
5275 | { | |
5276 | struct alc_spec *spec = codec->spec; | |
5277 | hda_nid_t nid; | |
5278 | ||
bc9f98a9 | 5279 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
f12ab1e0 | 5280 | nid = spec->autocfg.line_out_pins[0]; |
baba8ee9 TI |
5281 | if (nid) { |
5282 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
5283 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
5284 | } | |
ea1fb29a | 5285 | |
82bc955f | 5286 | nid = spec->autocfg.speaker_pins[0]; |
df694daa KY |
5287 | if (nid) |
5288 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
5289 | ||
eb06ed8f | 5290 | nid = spec->autocfg.hp_pins[0]; |
df694daa | 5291 | if (nid) |
baba8ee9 | 5292 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
f12ab1e0 | 5293 | } |
df694daa KY |
5294 | |
5295 | #define ALC260_PIN_CD_NID 0x16 | |
5296 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
5297 | { | |
5298 | struct alc_spec *spec = codec->spec; | |
5299 | int i; | |
5300 | ||
5301 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
5302 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
5303 | if (nid >= 0x12) { | |
f12ab1e0 TI |
5304 | snd_hda_codec_write(codec, nid, 0, |
5305 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5306 | i <= AUTO_PIN_FRONT_MIC ? | |
5307 | PIN_VREF80 : PIN_IN); | |
df694daa | 5308 | if (nid != ALC260_PIN_CD_NID) |
f12ab1e0 TI |
5309 | snd_hda_codec_write(codec, nid, 0, |
5310 | AC_VERB_SET_AMP_GAIN_MUTE, | |
df694daa KY |
5311 | AMP_OUT_MUTE); |
5312 | } | |
5313 | } | |
5314 | } | |
5315 | ||
5316 | /* | |
5317 | * generic initialization of ADC, input mixers and output mixers | |
5318 | */ | |
5319 | static struct hda_verb alc260_volume_init_verbs[] = { | |
5320 | /* | |
5321 | * Unmute ADC0-1 and set the default input to mic-in | |
5322 | */ | |
5323 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5324 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5325 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5326 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 5327 | |
df694daa KY |
5328 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
5329 | * mixer widget | |
f12ab1e0 TI |
5330 | * Note: PASD motherboards uses the Line In 2 as the input for |
5331 | * front panel mic (mic 2) | |
df694daa KY |
5332 | */ |
5333 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
5334 | /* mute analog inputs */ |
5335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5337 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5338 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5339 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
5340 | |
5341 | /* | |
5342 | * Set up output mixers (0x08 - 0x0a) | |
5343 | */ | |
5344 | /* set vol=0 to output mixers */ | |
5345 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5346 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5347 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5348 | /* set up input amps for analog loopback */ | |
5349 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
5350 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5351 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5352 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5353 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5354 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5355 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 5356 | |
df694daa KY |
5357 | { } |
5358 | }; | |
5359 | ||
5360 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
5361 | { | |
5362 | struct alc_spec *spec = codec->spec; | |
df694daa KY |
5363 | int err; |
5364 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
5365 | ||
f12ab1e0 TI |
5366 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
5367 | alc260_ignore); | |
5368 | if (err < 0) | |
df694daa | 5369 | return err; |
f12ab1e0 TI |
5370 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
5371 | if (err < 0) | |
4a471b7d | 5372 | return err; |
603c4019 | 5373 | if (!spec->kctls.list) |
df694daa | 5374 | return 0; /* can't find valid BIOS pin config */ |
f12ab1e0 TI |
5375 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
5376 | if (err < 0) | |
df694daa KY |
5377 | return err; |
5378 | ||
5379 | spec->multiout.max_channels = 2; | |
5380 | ||
5381 | if (spec->autocfg.dig_out_pin) | |
5382 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | |
603c4019 | 5383 | if (spec->kctls.list) |
d88897ea | 5384 | add_mixer(spec, spec->kctls.list); |
df694daa | 5385 | |
d88897ea | 5386 | add_verb(spec, alc260_volume_init_verbs); |
df694daa | 5387 | |
a1e8d2da | 5388 | spec->num_mux_defs = 1; |
df694daa KY |
5389 | spec->input_mux = &spec->private_imux; |
5390 | ||
e044c39a | 5391 | store_pin_configs(codec); |
df694daa KY |
5392 | return 1; |
5393 | } | |
5394 | ||
ae6b813a TI |
5395 | /* additional initialization for auto-configuration model */ |
5396 | static void alc260_auto_init(struct hda_codec *codec) | |
df694daa | 5397 | { |
f6c7e546 | 5398 | struct alc_spec *spec = codec->spec; |
df694daa KY |
5399 | alc260_auto_init_multi_out(codec); |
5400 | alc260_auto_init_analog_input(codec); | |
f6c7e546 | 5401 | if (spec->unsol_event) |
7fb0d78f | 5402 | alc_inithook(codec); |
df694daa KY |
5403 | } |
5404 | ||
cb53c626 TI |
5405 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5406 | static struct hda_amp_list alc260_loopbacks[] = { | |
5407 | { 0x07, HDA_INPUT, 0 }, | |
5408 | { 0x07, HDA_INPUT, 1 }, | |
5409 | { 0x07, HDA_INPUT, 2 }, | |
5410 | { 0x07, HDA_INPUT, 3 }, | |
5411 | { 0x07, HDA_INPUT, 4 }, | |
5412 | { } /* end */ | |
5413 | }; | |
5414 | #endif | |
5415 | ||
df694daa KY |
5416 | /* |
5417 | * ALC260 configurations | |
5418 | */ | |
f5fcc13c TI |
5419 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
5420 | [ALC260_BASIC] = "basic", | |
5421 | [ALC260_HP] = "hp", | |
5422 | [ALC260_HP_3013] = "hp-3013", | |
2922c9af | 5423 | [ALC260_HP_DC7600] = "hp-dc7600", |
f5fcc13c TI |
5424 | [ALC260_FUJITSU_S702X] = "fujitsu", |
5425 | [ALC260_ACER] = "acer", | |
bc9f98a9 KY |
5426 | [ALC260_WILL] = "will", |
5427 | [ALC260_REPLACER_672V] = "replacer", | |
7cf51e48 | 5428 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 5429 | [ALC260_TEST] = "test", |
7cf51e48 | 5430 | #endif |
f5fcc13c TI |
5431 | [ALC260_AUTO] = "auto", |
5432 | }; | |
5433 | ||
5434 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
bd869485 | 5435 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
f5fcc13c | 5436 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
9720b718 | 5437 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
a8a5d067 | 5438 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
f5fcc13c | 5439 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
34ec8a0a | 5440 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
3f878308 | 5441 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
f5fcc13c TI |
5442 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
5443 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
5444 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
5445 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
5446 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
5447 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
5448 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
5449 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
5450 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
bc9f98a9 | 5451 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
ac3e3741 | 5452 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
df694daa KY |
5453 | {} |
5454 | }; | |
5455 | ||
5456 | static struct alc_config_preset alc260_presets[] = { | |
5457 | [ALC260_BASIC] = { | |
5458 | .mixers = { alc260_base_output_mixer, | |
5459 | alc260_input_mixer, | |
f9e336f6 | 5460 | alc260_pc_beep_mixer }, |
df694daa KY |
5461 | .init_verbs = { alc260_init_verbs }, |
5462 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5463 | .dac_nids = alc260_dac_nids, | |
f9e336f6 | 5464 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
df694daa KY |
5465 | .adc_nids = alc260_adc_nids, |
5466 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5467 | .channel_mode = alc260_modes, | |
5468 | .input_mux = &alc260_capture_source, | |
5469 | }, | |
5470 | [ALC260_HP] = { | |
bec15c3a | 5471 | .mixers = { alc260_hp_output_mixer, |
f9e336f6 | 5472 | alc260_input_mixer }, |
bec15c3a TI |
5473 | .init_verbs = { alc260_init_verbs, |
5474 | alc260_hp_unsol_verbs }, | |
df694daa KY |
5475 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
5476 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
5477 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
5478 | .adc_nids = alc260_adc_nids_alt, | |
df694daa KY |
5479 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
5480 | .channel_mode = alc260_modes, | |
5481 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
5482 | .unsol_event = alc260_hp_unsol_event, |
5483 | .init_hook = alc260_hp_automute, | |
df694daa | 5484 | }, |
3f878308 KY |
5485 | [ALC260_HP_DC7600] = { |
5486 | .mixers = { alc260_hp_dc7600_mixer, | |
f9e336f6 | 5487 | alc260_input_mixer }, |
3f878308 KY |
5488 | .init_verbs = { alc260_init_verbs, |
5489 | alc260_hp_dc7600_verbs }, | |
5490 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5491 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
5492 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
5493 | .adc_nids = alc260_adc_nids_alt, | |
3f878308 KY |
5494 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
5495 | .channel_mode = alc260_modes, | |
5496 | .input_mux = &alc260_capture_source, | |
5497 | .unsol_event = alc260_hp_3012_unsol_event, | |
5498 | .init_hook = alc260_hp_3012_automute, | |
5499 | }, | |
df694daa KY |
5500 | [ALC260_HP_3013] = { |
5501 | .mixers = { alc260_hp_3013_mixer, | |
f9e336f6 | 5502 | alc260_input_mixer }, |
bec15c3a TI |
5503 | .init_verbs = { alc260_hp_3013_init_verbs, |
5504 | alc260_hp_3013_unsol_verbs }, | |
df694daa KY |
5505 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
5506 | .dac_nids = alc260_dac_nids, | |
f9e336f6 TI |
5507 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
5508 | .adc_nids = alc260_adc_nids_alt, | |
df694daa KY |
5509 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
5510 | .channel_mode = alc260_modes, | |
5511 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
5512 | .unsol_event = alc260_hp_3013_unsol_event, |
5513 | .init_hook = alc260_hp_3013_automute, | |
df694daa KY |
5514 | }, |
5515 | [ALC260_FUJITSU_S702X] = { | |
f9e336f6 | 5516 | .mixers = { alc260_fujitsu_mixer }, |
df694daa KY |
5517 | .init_verbs = { alc260_fujitsu_init_verbs }, |
5518 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5519 | .dac_nids = alc260_dac_nids, | |
d57fdac0 JW |
5520 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
5521 | .adc_nids = alc260_dual_adc_nids, | |
df694daa KY |
5522 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
5523 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5524 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
5525 | .input_mux = alc260_fujitsu_capture_sources, | |
df694daa | 5526 | }, |
0bfc90e9 | 5527 | [ALC260_ACER] = { |
f9e336f6 | 5528 | .mixers = { alc260_acer_mixer }, |
0bfc90e9 JW |
5529 | .init_verbs = { alc260_acer_init_verbs }, |
5530 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5531 | .dac_nids = alc260_dac_nids, | |
5532 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
5533 | .adc_nids = alc260_dual_adc_nids, | |
5534 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5535 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5536 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
5537 | .input_mux = alc260_acer_capture_sources, | |
0bfc90e9 | 5538 | }, |
bc9f98a9 | 5539 | [ALC260_WILL] = { |
f9e336f6 | 5540 | .mixers = { alc260_will_mixer }, |
bc9f98a9 KY |
5541 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
5542 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5543 | .dac_nids = alc260_dac_nids, | |
5544 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
5545 | .adc_nids = alc260_adc_nids, | |
5546 | .dig_out_nid = ALC260_DIGOUT_NID, | |
5547 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5548 | .channel_mode = alc260_modes, | |
5549 | .input_mux = &alc260_capture_source, | |
5550 | }, | |
5551 | [ALC260_REPLACER_672V] = { | |
f9e336f6 | 5552 | .mixers = { alc260_replacer_672v_mixer }, |
bc9f98a9 KY |
5553 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
5554 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5555 | .dac_nids = alc260_dac_nids, | |
5556 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
5557 | .adc_nids = alc260_adc_nids, | |
5558 | .dig_out_nid = ALC260_DIGOUT_NID, | |
5559 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5560 | .channel_mode = alc260_modes, | |
5561 | .input_mux = &alc260_capture_source, | |
5562 | .unsol_event = alc260_replacer_672v_unsol_event, | |
5563 | .init_hook = alc260_replacer_672v_automute, | |
5564 | }, | |
7cf51e48 JW |
5565 | #ifdef CONFIG_SND_DEBUG |
5566 | [ALC260_TEST] = { | |
f9e336f6 | 5567 | .mixers = { alc260_test_mixer }, |
7cf51e48 JW |
5568 | .init_verbs = { alc260_test_init_verbs }, |
5569 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
5570 | .dac_nids = alc260_test_dac_nids, | |
5571 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
5572 | .adc_nids = alc260_test_adc_nids, | |
5573 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5574 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5575 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
5576 | .input_mux = alc260_test_capture_sources, | |
7cf51e48 JW |
5577 | }, |
5578 | #endif | |
df694daa KY |
5579 | }; |
5580 | ||
5581 | static int patch_alc260(struct hda_codec *codec) | |
1da177e4 LT |
5582 | { |
5583 | struct alc_spec *spec; | |
df694daa | 5584 | int err, board_config; |
1da177e4 | 5585 | |
e560d8d8 | 5586 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
5587 | if (spec == NULL) |
5588 | return -ENOMEM; | |
5589 | ||
5590 | codec->spec = spec; | |
5591 | ||
f5fcc13c TI |
5592 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
5593 | alc260_models, | |
5594 | alc260_cfg_tbl); | |
5595 | if (board_config < 0) { | |
9c7f852e TI |
5596 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
5597 | "trying auto-probe from BIOS...\n"); | |
df694daa | 5598 | board_config = ALC260_AUTO; |
16ded525 | 5599 | } |
1da177e4 | 5600 | |
df694daa KY |
5601 | if (board_config == ALC260_AUTO) { |
5602 | /* automatic parse from the BIOS config */ | |
5603 | err = alc260_parse_auto_config(codec); | |
5604 | if (err < 0) { | |
5605 | alc_free(codec); | |
5606 | return err; | |
f12ab1e0 | 5607 | } else if (!err) { |
9c7f852e TI |
5608 | printk(KERN_INFO |
5609 | "hda_codec: Cannot set up configuration " | |
5610 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
5611 | board_config = ALC260_BASIC; |
5612 | } | |
a9430dd8 | 5613 | } |
e9edcee0 | 5614 | |
df694daa KY |
5615 | if (board_config != ALC260_AUTO) |
5616 | setup_preset(spec, &alc260_presets[board_config]); | |
1da177e4 LT |
5617 | |
5618 | spec->stream_name_analog = "ALC260 Analog"; | |
5619 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | |
5620 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
5621 | ||
a3bcba38 TI |
5622 | spec->stream_name_digital = "ALC260 Digital"; |
5623 | spec->stream_digital_playback = &alc260_pcm_digital_playback; | |
5624 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
5625 | ||
4ef0ef19 TI |
5626 | if (!spec->adc_nids && spec->input_mux) { |
5627 | /* check whether NID 0x04 is valid */ | |
5628 | unsigned int wcap = get_wcaps(codec, 0x04); | |
5629 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
5630 | /* get type */ | |
5631 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | |
5632 | spec->adc_nids = alc260_adc_nids_alt; | |
5633 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
5634 | } else { | |
5635 | spec->adc_nids = alc260_adc_nids; | |
5636 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
5637 | } | |
5638 | } | |
f9e336f6 TI |
5639 | set_capture_mixer(spec); |
5640 | ||
2134ea4f TI |
5641 | spec->vmaster_nid = 0x08; |
5642 | ||
1da177e4 | 5643 | codec->patch_ops = alc_patch_ops; |
df694daa | 5644 | if (board_config == ALC260_AUTO) |
ae6b813a | 5645 | spec->init_hook = alc260_auto_init; |
cb53c626 TI |
5646 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5647 | if (!spec->loopback.amplist) | |
5648 | spec->loopback.amplist = alc260_loopbacks; | |
5649 | #endif | |
1da177e4 LT |
5650 | |
5651 | return 0; | |
5652 | } | |
5653 | ||
e9edcee0 | 5654 | |
1da177e4 LT |
5655 | /* |
5656 | * ALC882 support | |
5657 | * | |
5658 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
5659 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
5660 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
5661 | * 6-channel independent captures. | |
5662 | * | |
5663 | * In addition, an independent DAC for the multi-playback (not used in this | |
5664 | * driver yet). | |
5665 | */ | |
df694daa KY |
5666 | #define ALC882_DIGOUT_NID 0x06 |
5667 | #define ALC882_DIGIN_NID 0x0a | |
1da177e4 | 5668 | |
d2a6d7dc | 5669 | static struct hda_channel_mode alc882_ch_modes[1] = { |
1da177e4 LT |
5670 | { 8, NULL } |
5671 | }; | |
5672 | ||
5673 | static hda_nid_t alc882_dac_nids[4] = { | |
5674 | /* front, rear, clfe, rear_surr */ | |
5675 | 0x02, 0x03, 0x04, 0x05 | |
5676 | }; | |
5677 | ||
df694daa KY |
5678 | /* identical with ALC880 */ |
5679 | #define alc882_adc_nids alc880_adc_nids | |
5680 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
1da177e4 | 5681 | |
e1406348 TI |
5682 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
5683 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
5684 | ||
1da177e4 LT |
5685 | /* input MUX */ |
5686 | /* FIXME: should be a matrix-type input source selection */ | |
5687 | ||
5688 | static struct hda_input_mux alc882_capture_source = { | |
5689 | .num_items = 4, | |
5690 | .items = { | |
5691 | { "Mic", 0x0 }, | |
5692 | { "Front Mic", 0x1 }, | |
5693 | { "Line", 0x2 }, | |
5694 | { "CD", 0x4 }, | |
5695 | }, | |
5696 | }; | |
272a527c KY |
5697 | /* |
5698 | * 2ch mode | |
5699 | */ | |
5700 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
5701 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
5702 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
5703 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
5704 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
5705 | { } /* end */ | |
5706 | }; | |
5707 | ||
5708 | /* | |
5709 | * 6ch mode | |
5710 | */ | |
5711 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
5712 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5713 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
5714 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
5715 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5716 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
5717 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
5718 | { } /* end */ | |
5719 | }; | |
5720 | ||
5721 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { | |
5722 | { 2, alc882_3ST_ch2_init }, | |
5723 | { 6, alc882_3ST_ch6_init }, | |
5724 | }; | |
5725 | ||
df694daa KY |
5726 | /* |
5727 | * 6ch mode | |
5728 | */ | |
5729 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
5730 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
5731 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5732 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5733 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5734 | { } /* end */ | |
5735 | }; | |
5736 | ||
5737 | /* | |
5738 | * 8ch mode | |
5739 | */ | |
5740 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
5741 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5742 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5743 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5744 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5745 | { } /* end */ | |
5746 | }; | |
5747 | ||
5748 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
5749 | { 6, alc882_sixstack_ch6_init }, | |
5750 | { 8, alc882_sixstack_ch8_init }, | |
5751 | }; | |
5752 | ||
87350ad0 TI |
5753 | /* |
5754 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic | |
5755 | */ | |
5756 | ||
5757 | /* | |
5758 | * 2ch mode | |
5759 | */ | |
5760 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
5761 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
5762 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5763 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5764 | { } /* end */ | |
5765 | }; | |
5766 | ||
5767 | /* | |
5768 | * 6ch mode | |
5769 | */ | |
5770 | static struct hda_verb alc885_mbp_ch6_init[] = { | |
5771 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5772 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5773 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
5774 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5775 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5776 | { } /* end */ | |
5777 | }; | |
5778 | ||
5779 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { | |
5780 | { 2, alc885_mbp_ch2_init }, | |
5781 | { 6, alc885_mbp_ch6_init }, | |
5782 | }; | |
5783 | ||
5784 | ||
1da177e4 LT |
5785 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
5786 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
5787 | */ | |
c8b6bf9b | 5788 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
05acb863 | 5789 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 5790 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 5791 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 5792 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
05acb863 TI |
5793 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
5794 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
5795 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
5796 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
05acb863 | 5797 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 5798 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1da177e4 LT |
5799 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
5800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5801 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5802 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5803 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 5805 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
1da177e4 LT |
5806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
5807 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 5808 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
1da177e4 LT |
5809 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
5810 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5811 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1da177e4 LT |
5812 | { } /* end */ |
5813 | }; | |
5814 | ||
87350ad0 | 5815 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
2134ea4f TI |
5816 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
5817 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
5818 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), | |
5819 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
5820 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5821 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
87350ad0 TI |
5822 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
5823 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
2134ea4f | 5824 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
87350ad0 TI |
5825 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
5826 | { } /* end */ | |
5827 | }; | |
bdd148a3 KY |
5828 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
5829 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5830 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5831 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5832 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5833 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5834 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5836 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
5837 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5838 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5839 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5840 | { } /* end */ | |
5841 | }; | |
5842 | ||
272a527c KY |
5843 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
5844 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5845 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5846 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5847 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5848 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5849 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5850 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5851 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5852 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 5853 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
5854 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
5855 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
96fe7cc8 | 5856 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
272a527c KY |
5857 | { } /* end */ |
5858 | }; | |
5859 | ||
5860 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
5861 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
5862 | */ | |
5863 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
5864 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5865 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
5866 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5867 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
5868 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5869 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5872 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
5873 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
5874 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 5876 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
5877 | { } /* end */ |
5878 | }; | |
5879 | ||
914759b7 TI |
5880 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
5881 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5882 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5883 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5884 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5885 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5886 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5887 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5888 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5889 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
5890 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5891 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5892 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5893 | { } /* end */ | |
5894 | }; | |
5895 | ||
df694daa KY |
5896 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
5897 | { | |
5898 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5899 | .name = "Channel Mode", | |
5900 | .info = alc_ch_mode_info, | |
5901 | .get = alc_ch_mode_get, | |
5902 | .put = alc_ch_mode_put, | |
5903 | }, | |
5904 | { } /* end */ | |
5905 | }; | |
5906 | ||
1da177e4 LT |
5907 | static struct hda_verb alc882_init_verbs[] = { |
5908 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
05acb863 TI |
5909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5910 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5912 | /* Rear mixer */ |
05acb863 TI |
5913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5916 | /* CLFE mixer */ |
05acb863 TI |
5917 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5918 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5920 | /* Side mixer */ |
05acb863 TI |
5921 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5922 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5924 | |
e9edcee0 | 5925 | /* Front Pin: output 0 (0x0c) */ |
05acb863 | 5926 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5927 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5928 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 5929 | /* Rear Pin: output 1 (0x0d) */ |
05acb863 | 5930 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5931 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5932 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
e9edcee0 | 5933 | /* CLFE Pin: output 2 (0x0e) */ |
05acb863 | 5934 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5935 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5936 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
e9edcee0 | 5937 | /* Side Pin: output 3 (0x0f) */ |
05acb863 | 5938 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5939 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5940 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
e9edcee0 | 5941 | /* Mic (rear) pin: input vref at 80% */ |
16ded525 | 5942 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
5943 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5944 | /* Front Mic pin: input vref at 80% */ | |
16ded525 | 5945 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
5946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5947 | /* Line In pin: input */ | |
05acb863 | 5948 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
5949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5950 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
5951 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5952 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5953 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1da177e4 | 5954 | /* CD pin widget for input */ |
05acb863 | 5955 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 LT |
5956 | |
5957 | /* FIXME: use matrix-type input source selection */ | |
5958 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5959 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
05acb863 TI |
5960 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5961 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5962 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5963 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 5964 | /* Input mixer2 */ |
05acb863 TI |
5965 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5966 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5967 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5968 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 5969 | /* Input mixer3 */ |
05acb863 TI |
5970 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5971 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5973 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5974 | /* ADC1: mute amp left and right */ | |
5975 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5976 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
5977 | /* ADC2: mute amp left and right */ |
5978 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5979 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
5980 | /* ADC3: mute amp left and right */ |
5981 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5982 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 LT |
5983 | |
5984 | { } | |
5985 | }; | |
5986 | ||
4b146cb0 TI |
5987 | static struct hda_verb alc882_eapd_verbs[] = { |
5988 | /* change to EAPD mode */ | |
5989 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
b373bdeb | 5990 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
f12ab1e0 | 5991 | { } |
4b146cb0 TI |
5992 | }; |
5993 | ||
9102cd1c TD |
5994 | /* Mac Pro test */ |
5995 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
5996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5997 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
5999 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
6000 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
6001 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
6002 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
6003 | { } /* end */ | |
6004 | }; | |
6005 | ||
6006 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
6007 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
6008 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6009 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6010 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6011 | /* Front Pin: output 0 (0x0c) */ | |
6012 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6013 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6014 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6015 | /* Front Mic pin: input vref at 80% */ | |
6016 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6017 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6018 | /* Speaker: output */ | |
6019 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6020 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6021 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
6022 | /* Headphone output (output 0 - 0x0c) */ | |
6023 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6024 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6025 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6026 | ||
6027 | /* FIXME: use matrix-type input source selection */ | |
6028 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
6029 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
6030 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6031 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6032 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6033 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6034 | /* Input mixer2 */ | |
6035 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6036 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6037 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6038 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6039 | /* Input mixer3 */ | |
6040 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6041 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6042 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6043 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6044 | /* ADC1: mute amp left and right */ | |
6045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6046 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6047 | /* ADC2: mute amp left and right */ | |
6048 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6049 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6050 | /* ADC3: mute amp left and right */ | |
6051 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6052 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6053 | ||
6054 | { } | |
6055 | }; | |
f12ab1e0 | 6056 | |
87350ad0 TI |
6057 | /* Macbook Pro rev3 */ |
6058 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
6059 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
6060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6062 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6063 | /* Rear mixer */ | |
6064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6065 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6066 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6067 | /* Front Pin: output 0 (0x0c) */ | |
6068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6070 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6071 | /* HP Pin: output 0 (0x0d) */ | |
6072 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
6073 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6074 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6075 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
6076 | /* Mic (rear) pin: input vref at 80% */ | |
6077 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6079 | /* Front Mic pin: input vref at 80% */ | |
6080 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6081 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6082 | /* Line In pin: use output 1 when in LineOut mode */ | |
6083 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6084 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6085 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6086 | ||
6087 | /* FIXME: use matrix-type input source selection */ | |
6088 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
6089 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
6090 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6091 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6094 | /* Input mixer2 */ | |
6095 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6096 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6098 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6099 | /* Input mixer3 */ | |
6100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6104 | /* ADC1: mute amp left and right */ | |
6105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6106 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6107 | /* ADC2: mute amp left and right */ | |
6108 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6109 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6110 | /* ADC3: mute amp left and right */ | |
6111 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6112 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6113 | ||
6114 | { } | |
6115 | }; | |
6116 | ||
c54728d8 NF |
6117 | /* iMac 24 mixer. */ |
6118 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
6119 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
6120 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
6121 | { } /* end */ | |
6122 | }; | |
6123 | ||
6124 | /* iMac 24 init verbs. */ | |
6125 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
6126 | /* Internal speakers: output 0 (0x0c) */ | |
6127 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6128 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6129 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6130 | /* Internal speakers: output 0 (0x0c) */ | |
6131 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6132 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6133 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6134 | /* Headphone: output 0 (0x0c) */ | |
6135 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6136 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6137 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6138 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
6139 | /* Front Mic: input vref at 80% */ | |
6140 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6141 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6142 | { } | |
6143 | }; | |
6144 | ||
6145 | /* Toggle speaker-output according to the hp-jack state */ | |
6146 | static void alc885_imac24_automute(struct hda_codec *codec) | |
6147 | { | |
6148 | unsigned int present; | |
6149 | ||
6150 | present = snd_hda_codec_read(codec, 0x14, 0, | |
6151 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
6152 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
6153 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
6154 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
6155 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
c54728d8 NF |
6156 | } |
6157 | ||
6158 | /* Processes unsolicited events. */ | |
6159 | static void alc885_imac24_unsol_event(struct hda_codec *codec, | |
6160 | unsigned int res) | |
6161 | { | |
6162 | /* Headphone insertion or removal. */ | |
6163 | if ((res >> 26) == ALC880_HP_EVENT) | |
6164 | alc885_imac24_automute(codec); | |
6165 | } | |
6166 | ||
87350ad0 TI |
6167 | static void alc885_mbp3_automute(struct hda_codec *codec) |
6168 | { | |
6169 | unsigned int present; | |
6170 | ||
6171 | present = snd_hda_codec_read(codec, 0x15, 0, | |
6172 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
6173 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
6174 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
6175 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
6176 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
6177 | ||
6178 | } | |
6179 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, | |
6180 | unsigned int res) | |
6181 | { | |
6182 | /* Headphone insertion or removal. */ | |
6183 | if ((res >> 26) == ALC880_HP_EVENT) | |
6184 | alc885_mbp3_automute(codec); | |
6185 | } | |
6186 | ||
6187 | ||
272a527c KY |
6188 | static struct hda_verb alc882_targa_verbs[] = { |
6189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6191 | ||
6192 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6193 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 6194 | |
272a527c KY |
6195 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
6196 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
6197 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6198 | ||
6199 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
6200 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
6201 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
6202 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
6203 | { } /* end */ | |
6204 | }; | |
6205 | ||
6206 | /* toggle speaker-output according to the hp-jack state */ | |
6207 | static void alc882_targa_automute(struct hda_codec *codec) | |
6208 | { | |
6209 | unsigned int present; | |
ea1fb29a | 6210 | |
272a527c KY |
6211 | present = snd_hda_codec_read(codec, 0x14, 0, |
6212 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
6213 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
6214 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
82beb8fd TI |
6215 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
6216 | present ? 1 : 3); | |
272a527c KY |
6217 | } |
6218 | ||
6219 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
6220 | { | |
6221 | /* Looks like the unsol event is incompatible with the standard | |
6222 | * definition. 4bit tag is placed at 26 bit! | |
6223 | */ | |
6224 | if (((res >> 26) == ALC880_HP_EVENT)) { | |
6225 | alc882_targa_automute(codec); | |
6226 | } | |
6227 | } | |
6228 | ||
6229 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
6230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6232 | ||
6233 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6235 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 6236 | |
272a527c KY |
6237 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
6238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6239 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
6240 | ||
6241 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
6242 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
6243 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6244 | { } /* end */ | |
6245 | }; | |
6246 | ||
914759b7 TI |
6247 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
6248 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6250 | ||
6251 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6252 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6253 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 6254 | |
914759b7 TI |
6255 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
6256 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6257 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
6258 | ||
6259 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
6260 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
6261 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6262 | { } /* end */ | |
6263 | }; | |
6264 | ||
9102cd1c TD |
6265 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
6266 | { | |
6267 | unsigned int gpiostate, gpiomask, gpiodir; | |
6268 | ||
6269 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
6270 | AC_VERB_GET_GPIO_DATA, 0); | |
6271 | ||
6272 | if (!muted) | |
6273 | gpiostate |= (1 << pin); | |
6274 | else | |
6275 | gpiostate &= ~(1 << pin); | |
6276 | ||
6277 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
6278 | AC_VERB_GET_GPIO_MASK, 0); | |
6279 | gpiomask |= (1 << pin); | |
6280 | ||
6281 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
6282 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
6283 | gpiodir |= (1 << pin); | |
6284 | ||
6285 | ||
6286 | snd_hda_codec_write(codec, codec->afg, 0, | |
6287 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
6288 | snd_hda_codec_write(codec, codec->afg, 0, | |
6289 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
6290 | ||
6291 | msleep(1); | |
6292 | ||
6293 | snd_hda_codec_write(codec, codec->afg, 0, | |
6294 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
6295 | } | |
6296 | ||
7debbe51 TI |
6297 | /* set up GPIO at initialization */ |
6298 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
6299 | { | |
6300 | alc882_gpio_mute(codec, 0, 0); | |
6301 | alc882_gpio_mute(codec, 1, 0); | |
6302 | } | |
6303 | ||
6304 | /* set up GPIO and update auto-muting at initialization */ | |
6305 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
6306 | { | |
6307 | alc885_macpro_init_hook(codec); | |
6308 | alc885_imac24_automute(codec); | |
6309 | } | |
6310 | ||
df694daa KY |
6311 | /* |
6312 | * generic initialization of ADC, input mixers and output mixers | |
6313 | */ | |
6314 | static struct hda_verb alc882_auto_init_verbs[] = { | |
6315 | /* | |
6316 | * Unmute ADC0-2 and set the default input to mic-in | |
6317 | */ | |
6318 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6319 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6320 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6321 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6322 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6323 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1da177e4 | 6324 | |
cb53c626 | 6325 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 6326 | * mixer widget |
f12ab1e0 TI |
6327 | * Note: PASD motherboards uses the Line In 2 as the input for |
6328 | * front panel mic (mic 2) | |
df694daa KY |
6329 | */ |
6330 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
6331 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6332 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6333 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6334 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
e9edcee0 | 6336 | |
df694daa KY |
6337 | /* |
6338 | * Set up output mixers (0x0c - 0x0f) | |
6339 | */ | |
6340 | /* set vol=0 to output mixers */ | |
6341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6342 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6343 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6344 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6345 | /* set up input amps for analog loopback */ | |
6346 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6348 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6349 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6350 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6351 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6352 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6353 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6354 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6355 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6356 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6357 | ||
6358 | /* FIXME: use matrix-type input source selection */ | |
6359 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
6360 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
6361 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6364 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6365 | /* Input mixer2 */ | |
6366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6369 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6370 | /* Input mixer3 */ | |
6371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6374 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6375 | ||
6376 | { } | |
6377 | }; | |
6378 | ||
cb53c626 TI |
6379 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6380 | #define alc882_loopbacks alc880_loopbacks | |
6381 | #endif | |
6382 | ||
df694daa KY |
6383 | /* pcm configuration: identiacal with ALC880 */ |
6384 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | |
6385 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
6386 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
6387 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
6388 | ||
6389 | /* | |
6390 | * configuration and preset | |
6391 | */ | |
f5fcc13c TI |
6392 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
6393 | [ALC882_3ST_DIG] = "3stack-dig", | |
6394 | [ALC882_6ST_DIG] = "6stack-dig", | |
6395 | [ALC882_ARIMA] = "arima", | |
bdd148a3 | 6396 | [ALC882_W2JC] = "w2jc", |
0438a00e TI |
6397 | [ALC882_TARGA] = "targa", |
6398 | [ALC882_ASUS_A7J] = "asus-a7j", | |
6399 | [ALC882_ASUS_A7M] = "asus-a7m", | |
9102cd1c | 6400 | [ALC885_MACPRO] = "macpro", |
87350ad0 | 6401 | [ALC885_MBP3] = "mbp3", |
c54728d8 | 6402 | [ALC885_IMAC24] = "imac24", |
f5fcc13c TI |
6403 | [ALC882_AUTO] = "auto", |
6404 | }; | |
6405 | ||
6406 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | |
6407 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
272a527c | 6408 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
ac8842a0 | 6409 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
914759b7 | 6410 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
ac3e3741 | 6411 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
c5d9f1cd | 6412 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
7b9470d8 | 6413 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
ac3e3741 | 6414 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
4444704c | 6415 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
ac3e3741 TI |
6416 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
6417 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | |
6418 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), | |
df694daa KY |
6419 | {} |
6420 | }; | |
6421 | ||
6422 | static struct alc_config_preset alc882_presets[] = { | |
6423 | [ALC882_3ST_DIG] = { | |
6424 | .mixers = { alc882_base_mixer }, | |
6425 | .init_verbs = { alc882_init_verbs }, | |
6426 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6427 | .dac_nids = alc882_dac_nids, | |
6428 | .dig_out_nid = ALC882_DIGOUT_NID, | |
df694daa KY |
6429 | .dig_in_nid = ALC882_DIGIN_NID, |
6430 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6431 | .channel_mode = alc882_ch_modes, | |
4e195a7b | 6432 | .need_dac_fix = 1, |
df694daa KY |
6433 | .input_mux = &alc882_capture_source, |
6434 | }, | |
6435 | [ALC882_6ST_DIG] = { | |
6436 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
6437 | .init_verbs = { alc882_init_verbs }, | |
6438 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6439 | .dac_nids = alc882_dac_nids, | |
6440 | .dig_out_nid = ALC882_DIGOUT_NID, | |
df694daa KY |
6441 | .dig_in_nid = ALC882_DIGIN_NID, |
6442 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
6443 | .channel_mode = alc882_sixstack_modes, | |
6444 | .input_mux = &alc882_capture_source, | |
6445 | }, | |
4b146cb0 TI |
6446 | [ALC882_ARIMA] = { |
6447 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
6448 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, | |
6449 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6450 | .dac_nids = alc882_dac_nids, | |
6451 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
6452 | .channel_mode = alc882_sixstack_modes, | |
6453 | .input_mux = &alc882_capture_source, | |
6454 | }, | |
bdd148a3 KY |
6455 | [ALC882_W2JC] = { |
6456 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
6457 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | |
6458 | alc880_gpio1_init_verbs }, | |
6459 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6460 | .dac_nids = alc882_dac_nids, | |
6461 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
6462 | .channel_mode = alc880_threestack_modes, | |
6463 | .need_dac_fix = 1, | |
6464 | .input_mux = &alc882_capture_source, | |
6465 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6466 | }, | |
87350ad0 TI |
6467 | [ALC885_MBP3] = { |
6468 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
6469 | .init_verbs = { alc885_mbp3_init_verbs, | |
6470 | alc880_gpio1_init_verbs }, | |
6471 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6472 | .dac_nids = alc882_dac_nids, | |
6473 | .channel_mode = alc885_mbp_6ch_modes, | |
6474 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), | |
6475 | .input_mux = &alc882_capture_source, | |
6476 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6477 | .dig_in_nid = ALC882_DIGIN_NID, | |
6478 | .unsol_event = alc885_mbp3_unsol_event, | |
6479 | .init_hook = alc885_mbp3_automute, | |
6480 | }, | |
9102cd1c TD |
6481 | [ALC885_MACPRO] = { |
6482 | .mixers = { alc882_macpro_mixer }, | |
6483 | .init_verbs = { alc882_macpro_init_verbs }, | |
6484 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6485 | .dac_nids = alc882_dac_nids, | |
6486 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6487 | .dig_in_nid = ALC882_DIGIN_NID, | |
6488 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6489 | .channel_mode = alc882_ch_modes, | |
6490 | .input_mux = &alc882_capture_source, | |
7debbe51 | 6491 | .init_hook = alc885_macpro_init_hook, |
9102cd1c | 6492 | }, |
c54728d8 NF |
6493 | [ALC885_IMAC24] = { |
6494 | .mixers = { alc885_imac24_mixer }, | |
6495 | .init_verbs = { alc885_imac24_init_verbs }, | |
6496 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6497 | .dac_nids = alc882_dac_nids, | |
6498 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6499 | .dig_in_nid = ALC882_DIGIN_NID, | |
6500 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6501 | .channel_mode = alc882_ch_modes, | |
6502 | .input_mux = &alc882_capture_source, | |
6503 | .unsol_event = alc885_imac24_unsol_event, | |
7debbe51 | 6504 | .init_hook = alc885_imac24_init_hook, |
c54728d8 | 6505 | }, |
272a527c | 6506 | [ALC882_TARGA] = { |
f9e336f6 | 6507 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
272a527c KY |
6508 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
6509 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6510 | .dac_nids = alc882_dac_nids, | |
6511 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6512 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
6513 | .adc_nids = alc882_adc_nids, | |
e1406348 | 6514 | .capsrc_nids = alc882_capsrc_nids, |
272a527c KY |
6515 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6516 | .channel_mode = alc882_3ST_6ch_modes, | |
6517 | .need_dac_fix = 1, | |
6518 | .input_mux = &alc882_capture_source, | |
6519 | .unsol_event = alc882_targa_unsol_event, | |
6520 | .init_hook = alc882_targa_automute, | |
6521 | }, | |
6522 | [ALC882_ASUS_A7J] = { | |
f9e336f6 | 6523 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
272a527c KY |
6524 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
6525 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6526 | .dac_nids = alc882_dac_nids, | |
6527 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6528 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
6529 | .adc_nids = alc882_adc_nids, | |
e1406348 | 6530 | .capsrc_nids = alc882_capsrc_nids, |
272a527c KY |
6531 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6532 | .channel_mode = alc882_3ST_6ch_modes, | |
6533 | .need_dac_fix = 1, | |
6534 | .input_mux = &alc882_capture_source, | |
ea1fb29a | 6535 | }, |
914759b7 TI |
6536 | [ALC882_ASUS_A7M] = { |
6537 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
6538 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | |
6539 | alc880_gpio1_init_verbs, | |
6540 | alc882_asus_a7m_verbs }, | |
6541 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6542 | .dac_nids = alc882_dac_nids, | |
6543 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6544 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
6545 | .channel_mode = alc880_threestack_modes, | |
6546 | .need_dac_fix = 1, | |
6547 | .input_mux = &alc882_capture_source, | |
ea1fb29a | 6548 | }, |
df694daa KY |
6549 | }; |
6550 | ||
6551 | ||
f95474ec TI |
6552 | /* |
6553 | * Pin config fixes | |
6554 | */ | |
ea1fb29a | 6555 | enum { |
f95474ec TI |
6556 | PINFIX_ABIT_AW9D_MAX |
6557 | }; | |
6558 | ||
6559 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | |
6560 | { 0x15, 0x01080104 }, /* side */ | |
6561 | { 0x16, 0x01011012 }, /* rear */ | |
6562 | { 0x17, 0x01016011 }, /* clfe */ | |
6563 | { } | |
6564 | }; | |
6565 | ||
6566 | static const struct alc_pincfg *alc882_pin_fixes[] = { | |
6567 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | |
6568 | }; | |
6569 | ||
6570 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | |
6571 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | |
6572 | {} | |
6573 | }; | |
6574 | ||
df694daa KY |
6575 | /* |
6576 | * BIOS auto configuration | |
6577 | */ | |
6578 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |
6579 | hda_nid_t nid, int pin_type, | |
6580 | int dac_idx) | |
6581 | { | |
6582 | /* set as output */ | |
6583 | struct alc_spec *spec = codec->spec; | |
f12ab1e0 TI |
6584 | int idx; |
6585 | ||
f6c7e546 | 6586 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
6587 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
6588 | idx = 4; | |
6589 | else | |
6590 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
df694daa KY |
6591 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
6592 | ||
6593 | } | |
6594 | ||
6595 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | |
6596 | { | |
6597 | struct alc_spec *spec = codec->spec; | |
6598 | int i; | |
6599 | ||
bc9f98a9 | 6600 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
df694daa | 6601 | for (i = 0; i <= HDA_SIDE; i++) { |
f12ab1e0 | 6602 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 6603 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 6604 | if (nid) |
baba8ee9 | 6605 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 6606 | i); |
df694daa KY |
6607 | } |
6608 | } | |
6609 | ||
6610 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | |
6611 | { | |
6612 | struct alc_spec *spec = codec->spec; | |
6613 | hda_nid_t pin; | |
6614 | ||
eb06ed8f | 6615 | pin = spec->autocfg.hp_pins[0]; |
df694daa | 6616 | if (pin) /* connect to front */ |
f12ab1e0 TI |
6617 | /* use dac 0 */ |
6618 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
6619 | pin = spec->autocfg.speaker_pins[0]; |
6620 | if (pin) | |
6621 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
df694daa KY |
6622 | } |
6623 | ||
6624 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) | |
6625 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID | |
6626 | ||
6627 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | |
6628 | { | |
6629 | struct alc_spec *spec = codec->spec; | |
6630 | int i; | |
6631 | ||
6632 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
6633 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
7194cae6 TI |
6634 | unsigned int vref; |
6635 | if (!nid) | |
6636 | continue; | |
6637 | vref = PIN_IN; | |
6638 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { | |
531240ff KY |
6639 | unsigned int pincap; |
6640 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | |
6641 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & | |
7194cae6 TI |
6642 | AC_PINCAP_VREF_80) |
6643 | vref = PIN_VREF80; | |
df694daa | 6644 | } |
7194cae6 TI |
6645 | snd_hda_codec_write(codec, nid, 0, |
6646 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); | |
6647 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | |
6648 | snd_hda_codec_write(codec, nid, 0, | |
6649 | AC_VERB_SET_AMP_GAIN_MUTE, | |
6650 | AMP_OUT_MUTE); | |
df694daa KY |
6651 | } |
6652 | } | |
6653 | ||
f511b01c TI |
6654 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
6655 | { | |
6656 | struct alc_spec *spec = codec->spec; | |
6657 | const struct hda_input_mux *imux = spec->input_mux; | |
6658 | int c; | |
6659 | ||
6660 | for (c = 0; c < spec->num_adc_nids; c++) { | |
6661 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | |
6662 | hda_nid_t nid = spec->capsrc_nids[c]; | |
6663 | int conns, mute, idx, item; | |
6664 | ||
6665 | conns = snd_hda_get_connections(codec, nid, conn_list, | |
6666 | ARRAY_SIZE(conn_list)); | |
6667 | if (conns < 0) | |
6668 | continue; | |
6669 | for (idx = 0; idx < conns; idx++) { | |
6670 | /* if the current connection is the selected one, | |
6671 | * unmute it as default - otherwise mute it | |
6672 | */ | |
6673 | mute = AMP_IN_MUTE(idx); | |
6674 | for (item = 0; item < imux->num_items; item++) { | |
6675 | if (imux->items[item].index == idx) { | |
6676 | if (spec->cur_mux[c] == item) | |
6677 | mute = AMP_IN_UNMUTE(idx); | |
6678 | break; | |
6679 | } | |
6680 | } | |
6681 | snd_hda_codec_write(codec, nid, 0, | |
6682 | AC_VERB_SET_AMP_GAIN_MUTE, mute); | |
6683 | } | |
6684 | } | |
6685 | } | |
6686 | ||
776e184e TI |
6687 | /* add mic boosts if needed */ |
6688 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
6689 | { | |
6690 | struct alc_spec *spec = codec->spec; | |
6691 | int err; | |
6692 | hda_nid_t nid; | |
6693 | ||
6694 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | |
ce22e03e | 6695 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
776e184e TI |
6696 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
6697 | "Mic Boost", | |
6698 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
6699 | if (err < 0) | |
6700 | return err; | |
6701 | } | |
6702 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | |
ce22e03e | 6703 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
776e184e TI |
6704 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
6705 | "Front Mic Boost", | |
6706 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
6707 | if (err < 0) | |
6708 | return err; | |
6709 | } | |
6710 | return 0; | |
6711 | } | |
6712 | ||
df694daa KY |
6713 | /* almost identical with ALC880 parser... */ |
6714 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
6715 | { | |
6716 | struct alc_spec *spec = codec->spec; | |
6717 | int err = alc880_parse_auto_config(codec); | |
6718 | ||
6719 | if (err < 0) | |
6720 | return err; | |
776e184e TI |
6721 | else if (!err) |
6722 | return 0; /* no config found */ | |
6723 | ||
6724 | err = alc_auto_add_mic_boost(codec); | |
6725 | if (err < 0) | |
6726 | return err; | |
6727 | ||
6728 | /* hack - override the init verbs */ | |
6729 | spec->init_verbs[0] = alc882_auto_init_verbs; | |
6730 | ||
6731 | return 1; /* config found */ | |
df694daa KY |
6732 | } |
6733 | ||
ae6b813a TI |
6734 | /* additional initialization for auto-configuration model */ |
6735 | static void alc882_auto_init(struct hda_codec *codec) | |
df694daa | 6736 | { |
f6c7e546 | 6737 | struct alc_spec *spec = codec->spec; |
df694daa KY |
6738 | alc882_auto_init_multi_out(codec); |
6739 | alc882_auto_init_hp_out(codec); | |
6740 | alc882_auto_init_analog_input(codec); | |
f511b01c | 6741 | alc882_auto_init_input_src(codec); |
f6c7e546 | 6742 | if (spec->unsol_event) |
7fb0d78f | 6743 | alc_inithook(codec); |
df694daa KY |
6744 | } |
6745 | ||
7943a8ab TI |
6746 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
6747 | ||
df694daa KY |
6748 | static int patch_alc882(struct hda_codec *codec) |
6749 | { | |
6750 | struct alc_spec *spec; | |
6751 | int err, board_config; | |
6752 | ||
6753 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
6754 | if (spec == NULL) | |
6755 | return -ENOMEM; | |
6756 | ||
6757 | codec->spec = spec; | |
6758 | ||
f5fcc13c TI |
6759 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
6760 | alc882_models, | |
6761 | alc882_cfg_tbl); | |
df694daa KY |
6762 | |
6763 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
081d17c4 TD |
6764 | /* Pick up systems that don't supply PCI SSID */ |
6765 | switch (codec->subsystem_id) { | |
6766 | case 0x106b0c00: /* Mac Pro */ | |
6767 | board_config = ALC885_MACPRO; | |
6768 | break; | |
c54728d8 | 6769 | case 0x106b1000: /* iMac 24 */ |
f3911c5a | 6770 | case 0x106b2800: /* AppleTV */ |
c54728d8 NF |
6771 | board_config = ALC885_IMAC24; |
6772 | break; | |
c7e0757a | 6773 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
9c95c43d | 6774 | case 0x106b00a4: /* MacbookPro4,1 */ |
87350ad0 | 6775 | case 0x106b2c00: /* Macbook Pro rev3 */ |
c7e0757a | 6776 | case 0x106b3600: /* Macbook 3.1 */ |
87350ad0 TI |
6777 | board_config = ALC885_MBP3; |
6778 | break; | |
081d17c4 | 6779 | default: |
7943a8ab | 6780 | /* ALC889A is handled better as ALC888-compatible */ |
669faba2 CM |
6781 | if (codec->revision_id == 0x100101 || |
6782 | codec->revision_id == 0x100103) { | |
7943a8ab TI |
6783 | alc_free(codec); |
6784 | return patch_alc883(codec); | |
6785 | } | |
081d17c4 TD |
6786 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
6787 | "trying auto-probe from BIOS...\n"); | |
6788 | board_config = ALC882_AUTO; | |
6789 | } | |
df694daa KY |
6790 | } |
6791 | ||
f95474ec TI |
6792 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
6793 | ||
df694daa KY |
6794 | if (board_config == ALC882_AUTO) { |
6795 | /* automatic parse from the BIOS config */ | |
6796 | err = alc882_parse_auto_config(codec); | |
6797 | if (err < 0) { | |
6798 | alc_free(codec); | |
6799 | return err; | |
f12ab1e0 | 6800 | } else if (!err) { |
9c7f852e TI |
6801 | printk(KERN_INFO |
6802 | "hda_codec: Cannot set up configuration " | |
6803 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
6804 | board_config = ALC882_3ST_DIG; |
6805 | } | |
6806 | } | |
6807 | ||
6808 | if (board_config != ALC882_AUTO) | |
6809 | setup_preset(spec, &alc882_presets[board_config]); | |
1da177e4 | 6810 | |
2f893286 KY |
6811 | if (codec->vendor_id == 0x10ec0885) { |
6812 | spec->stream_name_analog = "ALC885 Analog"; | |
6813 | spec->stream_name_digital = "ALC885 Digital"; | |
6814 | } else { | |
6815 | spec->stream_name_analog = "ALC882 Analog"; | |
6816 | spec->stream_name_digital = "ALC882 Digital"; | |
6817 | } | |
6818 | ||
df694daa KY |
6819 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
6820 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
6330079f TI |
6821 | /* FIXME: setup DAC5 */ |
6822 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
6823 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
1da177e4 | 6824 | |
df694daa KY |
6825 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
6826 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
1da177e4 | 6827 | |
54cbc9ab | 6828 | spec->is_mix_capture = 1; /* matrix-style capture */ |
f12ab1e0 | 6829 | if (!spec->adc_nids && spec->input_mux) { |
df694daa | 6830 | /* check whether NID 0x07 is valid */ |
4a471b7d | 6831 | unsigned int wcap = get_wcaps(codec, 0x07); |
f12ab1e0 TI |
6832 | /* get type */ |
6833 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
df694daa KY |
6834 | if (wcap != AC_WID_AUD_IN) { |
6835 | spec->adc_nids = alc882_adc_nids_alt; | |
6836 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); | |
e1406348 | 6837 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
df694daa KY |
6838 | } else { |
6839 | spec->adc_nids = alc882_adc_nids; | |
6840 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); | |
e1406348 | 6841 | spec->capsrc_nids = alc882_capsrc_nids; |
df694daa KY |
6842 | } |
6843 | } | |
f9e336f6 | 6844 | set_capture_mixer(spec); |
1da177e4 | 6845 | |
2134ea4f TI |
6846 | spec->vmaster_nid = 0x0c; |
6847 | ||
1da177e4 | 6848 | codec->patch_ops = alc_patch_ops; |
df694daa | 6849 | if (board_config == ALC882_AUTO) |
ae6b813a | 6850 | spec->init_hook = alc882_auto_init; |
cb53c626 TI |
6851 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6852 | if (!spec->loopback.amplist) | |
6853 | spec->loopback.amplist = alc882_loopbacks; | |
6854 | #endif | |
df694daa KY |
6855 | |
6856 | return 0; | |
6857 | } | |
6858 | ||
6859 | /* | |
9c7f852e TI |
6860 | * ALC883 support |
6861 | * | |
6862 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible | |
6863 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
6864 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
6865 | * 6-channel independent captures. | |
6866 | * | |
6867 | * In addition, an independent DAC for the multi-playback (not used in this | |
6868 | * driver yet). | |
df694daa | 6869 | */ |
9c7f852e TI |
6870 | #define ALC883_DIGOUT_NID 0x06 |
6871 | #define ALC883_DIGIN_NID 0x0a | |
df694daa | 6872 | |
3ab90935 WF |
6873 | #define ALC1200_DIGOUT_NID 0x10 |
6874 | ||
9c7f852e TI |
6875 | static hda_nid_t alc883_dac_nids[4] = { |
6876 | /* front, rear, clfe, rear_surr */ | |
f32a19e3 | 6877 | 0x02, 0x03, 0x04, 0x05 |
9c7f852e | 6878 | }; |
df694daa | 6879 | |
9c7f852e TI |
6880 | static hda_nid_t alc883_adc_nids[2] = { |
6881 | /* ADC1-2 */ | |
6882 | 0x08, 0x09, | |
6883 | }; | |
f12ab1e0 | 6884 | |
f9e336f6 TI |
6885 | static hda_nid_t alc883_adc_nids_alt[1] = { |
6886 | /* ADC1 */ | |
6887 | 0x08, | |
6888 | }; | |
6889 | ||
e1406348 TI |
6890 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
6891 | ||
9c7f852e TI |
6892 | /* input MUX */ |
6893 | /* FIXME: should be a matrix-type input source selection */ | |
df694daa | 6894 | |
9c7f852e TI |
6895 | static struct hda_input_mux alc883_capture_source = { |
6896 | .num_items = 4, | |
6897 | .items = { | |
6898 | { "Mic", 0x0 }, | |
6899 | { "Front Mic", 0x1 }, | |
6900 | { "Line", 0x2 }, | |
6901 | { "CD", 0x4 }, | |
6902 | }, | |
6903 | }; | |
bc9f98a9 | 6904 | |
17bba1b7 J |
6905 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
6906 | .num_items = 4, | |
6907 | .items = { | |
6908 | { "Mic", 0x1 }, | |
6909 | { "Front Mic", 0x0 }, | |
6910 | { "Line", 0x2 }, | |
6911 | { "CD", 0x4 }, | |
6912 | }, | |
6913 | }; | |
6914 | ||
bc9f98a9 KY |
6915 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
6916 | .num_items = 2, | |
6917 | .items = { | |
6918 | { "Mic", 0x1 }, | |
6919 | { "Line", 0x2 }, | |
6920 | }, | |
6921 | }; | |
6922 | ||
272a527c KY |
6923 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
6924 | .num_items = 4, | |
6925 | .items = { | |
6926 | { "Mic", 0x0 }, | |
6927 | { "iMic", 0x1 }, | |
6928 | { "Line", 0x2 }, | |
6929 | { "CD", 0x4 }, | |
6930 | }, | |
6931 | }; | |
6932 | ||
fb97dc67 J |
6933 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
6934 | .num_items = 2, | |
6935 | .items = { | |
6936 | { "Mic", 0x0 }, | |
6937 | { "Int Mic", 0x1 }, | |
6938 | }, | |
6939 | }; | |
6940 | ||
e2757d5e KY |
6941 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
6942 | .num_items = 3, | |
6943 | .items = { | |
6944 | { "Mic", 0x0 }, | |
6945 | { "Front Mic", 0x1 }, | |
6946 | { "Line", 0x4 }, | |
6947 | }, | |
6948 | }; | |
6949 | ||
6950 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | |
6951 | .num_items = 2, | |
6952 | .items = { | |
6953 | { "Mic", 0x0 }, | |
6954 | { "Line", 0x2 }, | |
6955 | }, | |
6956 | }; | |
6957 | ||
9c7f852e TI |
6958 | /* |
6959 | * 2ch mode | |
6960 | */ | |
6961 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
6962 | { 2, NULL } | |
6963 | }; | |
6964 | ||
6965 | /* | |
6966 | * 2ch mode | |
6967 | */ | |
6968 | static struct hda_verb alc883_3ST_ch2_init[] = { | |
6969 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6970 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6971 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6972 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6973 | { } /* end */ | |
6974 | }; | |
6975 | ||
b201131c TD |
6976 | /* |
6977 | * 4ch mode | |
6978 | */ | |
6979 | static struct hda_verb alc883_3ST_ch4_init[] = { | |
6980 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6981 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6982 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6983 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6984 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6985 | { } /* end */ | |
6986 | }; | |
6987 | ||
9c7f852e TI |
6988 | /* |
6989 | * 6ch mode | |
6990 | */ | |
6991 | static struct hda_verb alc883_3ST_ch6_init[] = { | |
6992 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6993 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6994 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6995 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6996 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6997 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6998 | { } /* end */ | |
6999 | }; | |
7000 | ||
b201131c | 7001 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
9c7f852e | 7002 | { 2, alc883_3ST_ch2_init }, |
b201131c | 7003 | { 4, alc883_3ST_ch4_init }, |
9c7f852e TI |
7004 | { 6, alc883_3ST_ch6_init }, |
7005 | }; | |
7006 | ||
17bba1b7 J |
7007 | /* |
7008 | * 2ch mode | |
7009 | */ | |
7010 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
7011 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7012 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7013 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7014 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7015 | { } /* end */ | |
7016 | }; | |
7017 | ||
7018 | /* | |
7019 | * 4ch mode | |
7020 | */ | |
7021 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
7022 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
7023 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7024 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7025 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7026 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7027 | { } /* end */ | |
7028 | }; | |
7029 | ||
7030 | /* | |
7031 | * 6ch mode | |
7032 | */ | |
7033 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
7034 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7035 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7036 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
7037 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7038 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7039 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
7040 | { } /* end */ | |
7041 | }; | |
7042 | ||
7043 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
7044 | { 2, alc883_3ST_ch2_intel_init }, | |
7045 | { 4, alc883_3ST_ch4_intel_init }, | |
7046 | { 6, alc883_3ST_ch6_intel_init }, | |
7047 | }; | |
7048 | ||
9c7f852e TI |
7049 | /* |
7050 | * 6ch mode | |
7051 | */ | |
7052 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
7053 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7054 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7055 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7056 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7057 | { } /* end */ | |
7058 | }; | |
7059 | ||
7060 | /* | |
7061 | * 8ch mode | |
7062 | */ | |
7063 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
7064 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7065 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7066 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7067 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7068 | { } /* end */ | |
7069 | }; | |
7070 | ||
7071 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
7072 | { 6, alc883_sixstack_ch6_init }, | |
7073 | { 8, alc883_sixstack_ch8_init }, | |
7074 | }; | |
7075 | ||
b373bdeb AN |
7076 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
7077 | /* eanable EAPD on medion laptop */ | |
7078 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
7079 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
7080 | { } | |
7081 | }; | |
7082 | ||
9c7f852e TI |
7083 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
7084 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
7085 | */ | |
7086 | ||
7087 | static struct snd_kcontrol_new alc883_base_mixer[] = { | |
df694daa | 7088 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9c7f852e TI |
7089 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
7090 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7091 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7092 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7093 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7094 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7095 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7096 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
7097 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
7098 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
df694daa KY |
7099 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
7100 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7101 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7102 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7103 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7104 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
df694daa | 7105 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
9c7f852e | 7106 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
32360416 | 7107 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
7108 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7109 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7110 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
df694daa | 7111 | { } /* end */ |
834be88d TI |
7112 | }; |
7113 | ||
a8848bd6 AS |
7114 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
7115 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7116 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7117 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7118 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7119 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7120 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7123 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7125 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7126 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
7127 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
a8848bd6 AS |
7128 | { } /* end */ |
7129 | }; | |
7130 | ||
0c4cc443 | 7131 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
368c7a95 J |
7132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7133 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
7134 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7135 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
7136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7139 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7140 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
7141 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
368c7a95 J |
7142 | { } /* end */ |
7143 | }; | |
7144 | ||
fb97dc67 J |
7145 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
7146 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7147 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
7148 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7149 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
7150 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7151 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7152 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7153 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7154 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
7155 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
fb97dc67 J |
7156 | { } /* end */ |
7157 | }; | |
7158 | ||
9c7f852e TI |
7159 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
7160 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7161 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7162 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7163 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7164 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7165 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7166 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
7169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7170 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7171 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
7172 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7173 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7174 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
9c7f852e TI |
7175 | { } /* end */ |
7176 | }; | |
df694daa | 7177 | |
9c7f852e TI |
7178 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
7179 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7180 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7181 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7182 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7183 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7184 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7185 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7186 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7187 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7188 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7189 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7190 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7191 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7193 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
7194 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7195 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7196 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
7197 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7198 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7199 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
9c7f852e TI |
7200 | { } /* end */ |
7201 | }; | |
7202 | ||
17bba1b7 J |
7203 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
7204 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7205 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7206 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7207 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7208 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
7209 | HDA_OUTPUT), | |
7210 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7211 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7212 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7213 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7214 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7215 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7216 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7217 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7218 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7219 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
7220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7221 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7222 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
7223 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7224 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7225 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
17bba1b7 J |
7226 | { } /* end */ |
7227 | }; | |
7228 | ||
d1d985f0 | 7229 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
c07584c8 | 7230 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
0701e064 | 7231 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
c07584c8 | 7232 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
0701e064 | 7233 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
c07584c8 TD |
7234 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
7235 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
0701e064 TI |
7236 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
7237 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
c07584c8 TD |
7238 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
7239 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7240 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7241 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7242 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7244 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c07584c8 TD |
7245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7246 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7247 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
c07584c8 TD |
7248 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7249 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7250 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
c07584c8 TD |
7251 | { } /* end */ |
7252 | }; | |
7253 | ||
ccc656ce KY |
7254 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
7255 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7256 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7257 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7258 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7259 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7260 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7261 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7262 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7263 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7264 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7265 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7266 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7267 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7268 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7269 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 7270 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
ccc656ce | 7271 | { } /* end */ |
f12ab1e0 | 7272 | }; |
ccc656ce KY |
7273 | |
7274 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { | |
7275 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7276 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7277 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7278 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7279 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7281 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 7282 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
4383fae0 J |
7283 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7284 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
7285 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce | 7286 | { } /* end */ |
f12ab1e0 | 7287 | }; |
ccc656ce | 7288 | |
bc9f98a9 KY |
7289 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
7290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7291 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
86cd9298 TI |
7292 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
7293 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
bc9f98a9 KY |
7294 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
7295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7296 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7297 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 | 7298 | { } /* end */ |
f12ab1e0 | 7299 | }; |
bc9f98a9 | 7300 | |
272a527c KY |
7301 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
7302 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7303 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
7304 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7305 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7306 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7307 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7309 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7310 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
272a527c KY |
7311 | { } /* end */ |
7312 | }; | |
7313 | ||
7314 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |
7315 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7316 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7317 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7318 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7319 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7320 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7321 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7322 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7323 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
272a527c | 7324 | { } /* end */ |
ea1fb29a | 7325 | }; |
272a527c | 7326 | |
2880a867 | 7327 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
d1a991a6 KY |
7328 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7329 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2880a867 | 7330 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
2880a867 TD |
7331 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7332 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d1a991a6 KY |
7333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
7334 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2880a867 | 7336 | { } /* end */ |
d1a991a6 | 7337 | }; |
2880a867 | 7338 | |
e2757d5e KY |
7339 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
7340 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7341 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7342 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
7343 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | |
7344 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | |
7345 | 0x0d, 1, 0x0, HDA_OUTPUT), | |
7346 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
7347 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
7348 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
7349 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
7350 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
7351 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7352 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | |
7353 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7354 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7355 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7356 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7358 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7360 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7361 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
7362 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e2757d5e KY |
7363 | { } /* end */ |
7364 | }; | |
7365 | ||
7366 | static struct hda_bind_ctls alc883_bind_cap_vol = { | |
7367 | .ops = &snd_hda_bind_vol, | |
7368 | .values = { | |
7369 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
7370 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
7371 | 0 | |
7372 | }, | |
7373 | }; | |
7374 | ||
7375 | static struct hda_bind_ctls alc883_bind_cap_switch = { | |
7376 | .ops = &snd_hda_bind_sw, | |
7377 | .values = { | |
7378 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
7379 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
7380 | 0 | |
7381 | }, | |
7382 | }; | |
7383 | ||
7384 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | |
7385 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7386 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7387 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7388 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7389 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7390 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7391 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7392 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
f9e336f6 TI |
7393 | { } /* end */ |
7394 | }; | |
7395 | ||
7396 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { | |
e2757d5e KY |
7397 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
7398 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | |
7399 | { | |
7400 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7401 | /* .name = "Capture Source", */ | |
7402 | .name = "Input Source", | |
7403 | .count = 1, | |
54cbc9ab TI |
7404 | .info = alc_mux_enum_info, |
7405 | .get = alc_mux_enum_get, | |
7406 | .put = alc_mux_enum_put, | |
e2757d5e KY |
7407 | }, |
7408 | { } /* end */ | |
7409 | }; | |
7410 | ||
9c7f852e TI |
7411 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
7412 | { | |
7413 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7414 | .name = "Channel Mode", | |
7415 | .info = alc_ch_mode_info, | |
7416 | .get = alc_ch_mode_get, | |
7417 | .put = alc_ch_mode_put, | |
7418 | }, | |
7419 | { } /* end */ | |
7420 | }; | |
7421 | ||
7422 | static struct hda_verb alc883_init_verbs[] = { | |
7423 | /* ADC1: mute amp left and right */ | |
e2757d5e | 7424 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
df694daa | 7425 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9c7f852e TI |
7426 | /* ADC2: mute amp left and right */ |
7427 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
df694daa | 7428 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9c7f852e TI |
7429 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
7430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7433 | /* Rear mixer */ | |
7434 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7435 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7436 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7437 | /* CLFE mixer */ | |
7438 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7439 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7441 | /* Side mixer */ | |
7442 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7443 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7444 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
df694daa | 7445 | |
cb53c626 TI |
7446 | /* mute analog input loopbacks */ |
7447 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7448 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7450 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7451 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa | 7452 | |
9c7f852e TI |
7453 | /* Front Pin: output 0 (0x0c) */ |
7454 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7455 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7456 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7457 | /* Rear Pin: output 1 (0x0d) */ | |
7458 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7459 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7460 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7461 | /* CLFE Pin: output 2 (0x0e) */ | |
7462 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7463 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7464 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7465 | /* Side Pin: output 3 (0x0f) */ | |
7466 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7467 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7468 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7469 | /* Mic (rear) pin: input vref at 80% */ | |
7470 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7471 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7472 | /* Front Mic pin: input vref at 80% */ | |
7473 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7474 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7475 | /* Line In pin: input */ | |
7476 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7477 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7478 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
7479 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7480 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7481 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7482 | /* CD pin widget for input */ | |
7483 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7484 | ||
7485 | /* FIXME: use matrix-type input source selection */ | |
7486 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7487 | /* Input mixer2 */ | |
7488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
e2757d5e KY |
7489 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
7490 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7491 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
7492 | /* Input mixer3 */ |
7493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
e2757d5e KY |
7494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
7495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
7497 | { } |
7498 | }; | |
7499 | ||
a8848bd6 AS |
7500 | /* toggle speaker-output according to the hp-jack state */ |
7501 | static void alc883_mitac_hp_automute(struct hda_codec *codec) | |
7502 | { | |
7503 | unsigned int present; | |
7504 | ||
7505 | present = snd_hda_codec_read(codec, 0x15, 0, | |
7506 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7507 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7508 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7509 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
7510 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7511 | } | |
7512 | ||
7513 | /* auto-toggle front mic */ | |
7514 | /* | |
7515 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | |
7516 | { | |
7517 | unsigned int present; | |
7518 | unsigned char bits; | |
7519 | ||
7520 | present = snd_hda_codec_read(codec, 0x18, 0, | |
7521 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7522 | bits = present ? HDA_AMP_MUTE : 0; | |
7523 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
7524 | } | |
7525 | */ | |
7526 | ||
7527 | static void alc883_mitac_automute(struct hda_codec *codec) | |
7528 | { | |
7529 | alc883_mitac_hp_automute(codec); | |
7530 | /* alc883_mitac_mic_automute(codec); */ | |
7531 | } | |
7532 | ||
7533 | static void alc883_mitac_unsol_event(struct hda_codec *codec, | |
7534 | unsigned int res) | |
7535 | { | |
7536 | switch (res >> 26) { | |
7537 | case ALC880_HP_EVENT: | |
7538 | alc883_mitac_hp_automute(codec); | |
7539 | break; | |
7540 | case ALC880_MIC_EVENT: | |
7541 | /* alc883_mitac_mic_automute(codec); */ | |
7542 | break; | |
7543 | } | |
7544 | } | |
7545 | ||
7546 | static struct hda_verb alc883_mitac_verbs[] = { | |
7547 | /* HP */ | |
7548 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7549 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7550 | /* Subwoofer */ | |
7551 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7552 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7553 | ||
7554 | /* enable unsolicited event */ | |
7555 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7556 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
7557 | ||
7558 | { } /* end */ | |
7559 | }; | |
7560 | ||
0c4cc443 | 7561 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
368c7a95 J |
7562 | /* HP */ |
7563 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7564 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7565 | /* Int speaker */ | |
7566 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7567 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7568 | ||
7569 | /* enable unsolicited event */ | |
7570 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
0c4cc443 | 7571 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
368c7a95 J |
7572 | |
7573 | { } /* end */ | |
7574 | }; | |
7575 | ||
fb97dc67 J |
7576 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
7577 | /* HP */ | |
7578 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7579 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7580 | /* Subwoofer */ | |
7581 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7582 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7583 | ||
7584 | /* enable unsolicited event */ | |
7585 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7586 | ||
7587 | { } /* end */ | |
7588 | }; | |
7589 | ||
ccc656ce KY |
7590 | static struct hda_verb alc883_tagra_verbs[] = { |
7591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7593 | ||
7594 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7595 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 7596 | |
ccc656ce KY |
7597 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
7598 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
7599 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
7600 | ||
7601 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
f12ab1e0 TI |
7602 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
7603 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
7604 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
ccc656ce KY |
7605 | |
7606 | { } /* end */ | |
7607 | }; | |
7608 | ||
bc9f98a9 KY |
7609 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
7610 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7611 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
7612 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
7613 | { } /* end */ | |
7614 | }; | |
7615 | ||
272a527c KY |
7616 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
7617 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7618 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7619 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7620 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7621 | { } /* end */ | |
7622 | }; | |
7623 | ||
7624 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
7625 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7626 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7627 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7628 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
7629 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7630 | { } /* end */ | |
7631 | }; | |
7632 | ||
189609ae KY |
7633 | static struct hda_verb alc883_haier_w66_verbs[] = { |
7634 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7635 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7636 | ||
7637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7638 | ||
7639 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7640 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7641 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7642 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7643 | { } /* end */ | |
7644 | }; | |
7645 | ||
e2757d5e KY |
7646 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
7647 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7648 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7649 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7650 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7651 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7652 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7653 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7654 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7655 | { } /* end */ | |
7656 | }; | |
7657 | ||
4723c022 | 7658 | static struct hda_verb alc888_3st_hp_verbs[] = { |
8341de60 | 7659 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
f32a19e3 HRK |
7660 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
7661 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
8341de60 CM |
7662 | { } |
7663 | }; | |
7664 | ||
5795b9e6 | 7665 | static struct hda_verb alc888_6st_dell_verbs[] = { |
5795b9e6 CM |
7666 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
7667 | { } | |
7668 | }; | |
7669 | ||
4723c022 | 7670 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
8341de60 CM |
7671 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
7672 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7673 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7674 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7675 | { } | |
7676 | }; | |
7677 | ||
4723c022 | 7678 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
8341de60 CM |
7679 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7680 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7681 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7682 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7683 | { } | |
7684 | }; | |
7685 | ||
4723c022 CM |
7686 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
7687 | { 2, alc888_3st_hp_2ch_init }, | |
7688 | { 6, alc888_3st_hp_6ch_init }, | |
8341de60 CM |
7689 | }; |
7690 | ||
272a527c KY |
7691 | /* toggle front-jack and RCA according to the hp-jack state */ |
7692 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
7693 | { | |
7694 | unsigned int present; | |
ea1fb29a | 7695 | |
272a527c KY |
7696 | present = snd_hda_codec_read(codec, 0x1b, 0, |
7697 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7698 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
7699 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7700 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7701 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
7702 | } |
7703 | ||
7704 | /* toggle RCA according to the front-jack state */ | |
7705 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
7706 | { | |
7707 | unsigned int present; | |
ea1fb29a | 7708 | |
272a527c KY |
7709 | present = snd_hda_codec_read(codec, 0x14, 0, |
7710 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7711 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
7712 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c | 7713 | } |
47fd830a | 7714 | |
272a527c KY |
7715 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
7716 | unsigned int res) | |
7717 | { | |
7718 | if ((res >> 26) == ALC880_HP_EVENT) | |
7719 | alc888_lenovo_ms7195_front_automute(codec); | |
7720 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
7721 | alc888_lenovo_ms7195_rca_automute(codec); | |
7722 | } | |
7723 | ||
7724 | static struct hda_verb alc883_medion_md2_verbs[] = { | |
7725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7726 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7727 | ||
7728 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7729 | ||
7730 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7731 | { } /* end */ | |
7732 | }; | |
7733 | ||
7734 | /* toggle speaker-output according to the hp-jack state */ | |
7735 | static void alc883_medion_md2_automute(struct hda_codec *codec) | |
7736 | { | |
7737 | unsigned int present; | |
ea1fb29a | 7738 | |
272a527c KY |
7739 | present = snd_hda_codec_read(codec, 0x14, 0, |
7740 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7741 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
7742 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
7743 | } |
7744 | ||
7745 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, | |
7746 | unsigned int res) | |
7747 | { | |
7748 | if ((res >> 26) == ALC880_HP_EVENT) | |
7749 | alc883_medion_md2_automute(codec); | |
7750 | } | |
7751 | ||
ccc656ce KY |
7752 | /* toggle speaker-output according to the hp-jack state */ |
7753 | static void alc883_tagra_automute(struct hda_codec *codec) | |
7754 | { | |
7755 | unsigned int present; | |
f12ab1e0 | 7756 | unsigned char bits; |
ccc656ce KY |
7757 | |
7758 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7759 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7760 | bits = present ? HDA_AMP_MUTE : 0; |
7761 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
7762 | HDA_AMP_MUTE, bits); | |
82beb8fd TI |
7763 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
7764 | present ? 1 : 3); | |
ccc656ce KY |
7765 | } |
7766 | ||
7767 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) | |
7768 | { | |
7769 | if ((res >> 26) == ALC880_HP_EVENT) | |
7770 | alc883_tagra_automute(codec); | |
7771 | } | |
7772 | ||
368c7a95 | 7773 | /* toggle speaker-output according to the hp-jack state */ |
0c4cc443 | 7774 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
368c7a95 J |
7775 | { |
7776 | unsigned int present; | |
7777 | unsigned char bits; | |
7778 | ||
7779 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) | |
7780 | & AC_PINSENSE_PRESENCE; | |
7781 | bits = present ? HDA_AMP_MUTE : 0; | |
7782 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7783 | HDA_AMP_MUTE, bits); | |
7784 | } | |
7785 | ||
0c4cc443 HRK |
7786 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
7787 | { | |
7788 | unsigned int present; | |
7789 | ||
7790 | present = snd_hda_codec_read(codec, 0x18, 0, | |
7791 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7792 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
7793 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7794 | } | |
7795 | ||
7796 | static void alc883_clevo_m720_automute(struct hda_codec *codec) | |
7797 | { | |
7798 | alc883_clevo_m720_hp_automute(codec); | |
7799 | alc883_clevo_m720_mic_automute(codec); | |
7800 | } | |
7801 | ||
7802 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
368c7a95 J |
7803 | unsigned int res) |
7804 | { | |
0c4cc443 HRK |
7805 | switch (res >> 26) { |
7806 | case ALC880_HP_EVENT: | |
7807 | alc883_clevo_m720_hp_automute(codec); | |
7808 | break; | |
7809 | case ALC880_MIC_EVENT: | |
7810 | alc883_clevo_m720_mic_automute(codec); | |
7811 | break; | |
7812 | } | |
368c7a95 J |
7813 | } |
7814 | ||
fb97dc67 J |
7815 | /* toggle speaker-output according to the hp-jack state */ |
7816 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) | |
7817 | { | |
7818 | unsigned int present; | |
7819 | unsigned char bits; | |
7820 | ||
7821 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) | |
7822 | & AC_PINSENSE_PRESENCE; | |
7823 | bits = present ? HDA_AMP_MUTE : 0; | |
7824 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7825 | HDA_AMP_MUTE, bits); | |
7826 | } | |
7827 | ||
7828 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, | |
7829 | unsigned int res) | |
7830 | { | |
7831 | if ((res >> 26) == ALC880_HP_EVENT) | |
7832 | alc883_2ch_fujitsu_pi2515_automute(codec); | |
7833 | } | |
7834 | ||
189609ae KY |
7835 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
7836 | { | |
7837 | unsigned int present; | |
7838 | unsigned char bits; | |
7839 | ||
7840 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
7841 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7842 | bits = present ? 0x80 : 0; | |
7843 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7844 | 0x80, bits); | |
7845 | } | |
7846 | ||
7847 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, | |
7848 | unsigned int res) | |
7849 | { | |
7850 | if ((res >> 26) == ALC880_HP_EVENT) | |
7851 | alc883_haier_w66_automute(codec); | |
7852 | } | |
7853 | ||
bc9f98a9 KY |
7854 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
7855 | { | |
7856 | unsigned int present; | |
f12ab1e0 | 7857 | unsigned char bits; |
bc9f98a9 KY |
7858 | |
7859 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7860 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7861 | bits = present ? HDA_AMP_MUTE : 0; |
7862 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7863 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
7864 | } |
7865 | ||
7866 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
7867 | { | |
7868 | unsigned int present; | |
f12ab1e0 | 7869 | unsigned char bits; |
bc9f98a9 KY |
7870 | |
7871 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
7872 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7873 | bits = present ? HDA_AMP_MUTE : 0; |
7874 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7875 | HDA_AMP_MUTE, bits); | |
7876 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7877 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
7878 | } |
7879 | ||
7880 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
7881 | unsigned int res) | |
7882 | { | |
7883 | if ((res >> 26) == ALC880_HP_EVENT) | |
7884 | alc883_lenovo_101e_all_automute(codec); | |
7885 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
7886 | alc883_lenovo_101e_ispeaker_automute(codec); | |
7887 | } | |
7888 | ||
676a9b53 TI |
7889 | /* toggle speaker-output according to the hp-jack state */ |
7890 | static void alc883_acer_aspire_automute(struct hda_codec *codec) | |
7891 | { | |
7892 | unsigned int present; | |
ea1fb29a | 7893 | |
676a9b53 TI |
7894 | present = snd_hda_codec_read(codec, 0x14, 0, |
7895 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7896 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7897 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7898 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
7899 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7900 | } | |
7901 | ||
7902 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, | |
7903 | unsigned int res) | |
7904 | { | |
7905 | if ((res >> 26) == ALC880_HP_EVENT) | |
7906 | alc883_acer_aspire_automute(codec); | |
7907 | } | |
7908 | ||
d1a991a6 KY |
7909 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
7910 | /* HP Pin: output 0 (0x0c) */ | |
7911 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7912 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7913 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7914 | /* Front Pin: output 0 (0x0c) */ | |
676a9b53 TI |
7915 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
7916 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1a991a6 | 7917 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
d1a991a6 KY |
7918 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
7919 | /* eanable EAPD on medion laptop */ | |
7920 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
7921 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
676a9b53 TI |
7922 | /* enable unsolicited event */ |
7923 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
d1a991a6 KY |
7924 | { } |
7925 | }; | |
7926 | ||
5795b9e6 CM |
7927 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
7928 | { | |
7929 | unsigned int present; | |
ea1fb29a | 7930 | |
5795b9e6 CM |
7931 | present = snd_hda_codec_read(codec, 0x1b, 0, |
7932 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7933 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7934 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7935 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7936 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7937 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
7938 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7939 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
7940 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7941 | } | |
7942 | ||
7943 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, | |
7944 | unsigned int res) | |
7945 | { | |
7946 | switch (res >> 26) { | |
7947 | case ALC880_HP_EVENT: | |
7948 | printk("hp_event\n"); | |
7949 | alc888_6st_dell_front_automute(codec); | |
7950 | break; | |
7951 | } | |
7952 | } | |
7953 | ||
e2757d5e KY |
7954 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
7955 | { | |
7956 | unsigned int mute; | |
7957 | unsigned int present; | |
7958 | ||
7959 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
7960 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
7961 | AC_VERB_GET_PIN_SENSE, 0); | |
7962 | present = (present & 0x80000000) != 0; | |
7963 | if (present) { | |
7964 | /* mute internal speaker */ | |
7965 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7966 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
7967 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7968 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
7969 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
7970 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
7971 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
7972 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
7973 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
7974 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
7975 | } else { | |
7976 | /* unmute internal speaker if necessary */ | |
7977 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
7978 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7979 | HDA_AMP_MUTE, mute); | |
7980 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7981 | HDA_AMP_MUTE, mute); | |
7982 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
7983 | HDA_AMP_MUTE, mute); | |
7984 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
7985 | HDA_AMP_MUTE, mute); | |
7986 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
7987 | HDA_AMP_MUTE, mute); | |
7988 | } | |
7989 | } | |
7990 | ||
7991 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, | |
7992 | unsigned int res) | |
7993 | { | |
7994 | if ((res >> 26) == ALC880_HP_EVENT) | |
7995 | alc888_lenovo_sky_front_automute(codec); | |
7996 | } | |
7997 | ||
9c7f852e TI |
7998 | /* |
7999 | * generic initialization of ADC, input mixers and output mixers | |
8000 | */ | |
8001 | static struct hda_verb alc883_auto_init_verbs[] = { | |
8002 | /* | |
8003 | * Unmute ADC0-2 and set the default input to mic-in | |
8004 | */ | |
8005 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8006 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8007 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8008 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8009 | ||
cb53c626 | 8010 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 8011 | * mixer widget |
f12ab1e0 TI |
8012 | * Note: PASD motherboards uses the Line In 2 as the input for |
8013 | * front panel mic (mic 2) | |
9c7f852e TI |
8014 | */ |
8015 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
8016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8017 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8018 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8019 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8020 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
8021 | |
8022 | /* | |
8023 | * Set up output mixers (0x0c - 0x0f) | |
8024 | */ | |
8025 | /* set vol=0 to output mixers */ | |
8026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8028 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8029 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8030 | /* set up input amps for analog loopback */ | |
8031 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
8032 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8033 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8034 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8035 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8036 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8037 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8038 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8039 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8040 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8041 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8042 | ||
8043 | /* FIXME: use matrix-type input source selection */ | |
8044 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8045 | /* Input mixer1 */ | |
8046 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8047 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8048 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 8049 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
9c7f852e TI |
8050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
8051 | /* Input mixer2 */ | |
8052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8053 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8054 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 8055 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
e3cde64a | 8056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
9c7f852e TI |
8057 | |
8058 | { } | |
8059 | }; | |
8060 | ||
e2757d5e KY |
8061 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
8062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8063 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8064 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8065 | /* enable unsolicited event */ | |
8066 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8067 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
8068 | { } /* end */ | |
8069 | }; | |
8070 | ||
8071 | static void alc883_nb_mic_automute(struct hda_codec *codec) | |
8072 | { | |
8073 | unsigned int present; | |
8074 | ||
8075 | present = snd_hda_codec_read(codec, 0x18, 0, | |
8076 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
8077 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
8078 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
8079 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
8080 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
8081 | } | |
8082 | ||
8083 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) | |
8084 | { | |
8085 | unsigned int present; | |
8086 | unsigned char bits; | |
8087 | ||
8088 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
8089 | AC_VERB_GET_PIN_SENSE, 0) | |
8090 | & AC_PINSENSE_PRESENCE; | |
8091 | bits = present ? 0 : PIN_OUT; | |
8092 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8093 | bits); | |
8094 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8095 | bits); | |
8096 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8097 | bits); | |
8098 | } | |
8099 | ||
8100 | static void alc883_mode2_unsol_event(struct hda_codec *codec, | |
8101 | unsigned int res) | |
8102 | { | |
8103 | switch (res >> 26) { | |
8104 | case ALC880_HP_EVENT: | |
8105 | alc883_M90V_speaker_automute(codec); | |
8106 | break; | |
8107 | case ALC880_MIC_EVENT: | |
8108 | alc883_nb_mic_automute(codec); | |
8109 | break; | |
8110 | } | |
8111 | } | |
8112 | ||
8113 | static void alc883_mode2_inithook(struct hda_codec *codec) | |
8114 | { | |
8115 | alc883_M90V_speaker_automute(codec); | |
8116 | alc883_nb_mic_automute(codec); | |
8117 | } | |
8118 | ||
8119 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | |
8120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8121 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8123 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8124 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8125 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
8126 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | |
8127 | /* enable unsolicited event */ | |
8128 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8129 | { } /* end */ | |
8130 | }; | |
8131 | ||
8132 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) | |
8133 | { | |
8134 | unsigned int present; | |
8135 | unsigned char bits; | |
8136 | ||
8137 | present = snd_hda_codec_read(codec, 0x14, 0, | |
8138 | AC_VERB_GET_PIN_SENSE, 0) | |
8139 | & AC_PINSENSE_PRESENCE; | |
8140 | bits = present ? 0 : PIN_OUT; | |
8141 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8142 | bits); | |
8143 | } | |
8144 | ||
8145 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, | |
8146 | unsigned int res) | |
8147 | { | |
8148 | switch (res >> 26) { | |
8149 | case ALC880_HP_EVENT: | |
8150 | alc883_eee1601_speaker_automute(codec); | |
8151 | break; | |
8152 | } | |
8153 | } | |
8154 | ||
8155 | static void alc883_eee1601_inithook(struct hda_codec *codec) | |
8156 | { | |
8157 | alc883_eee1601_speaker_automute(codec); | |
8158 | } | |
8159 | ||
cb53c626 TI |
8160 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
8161 | #define alc883_loopbacks alc880_loopbacks | |
8162 | #endif | |
8163 | ||
9c7f852e TI |
8164 | /* pcm configuration: identiacal with ALC880 */ |
8165 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback | |
8166 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 8167 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
9c7f852e TI |
8168 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
8169 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture | |
8170 | ||
8171 | /* | |
8172 | * configuration and preset | |
8173 | */ | |
f5fcc13c TI |
8174 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
8175 | [ALC883_3ST_2ch_DIG] = "3stack-dig", | |
8176 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | |
8177 | [ALC883_3ST_6ch] = "3stack-6ch", | |
8178 | [ALC883_6ST_DIG] = "6stack-dig", | |
8179 | [ALC883_TARGA_DIG] = "targa-dig", | |
8180 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
f5fcc13c | 8181 | [ALC883_ACER] = "acer", |
2880a867 | 8182 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
f5fcc13c | 8183 | [ALC883_MEDION] = "medion", |
272a527c | 8184 | [ALC883_MEDION_MD2] = "medion-md2", |
f5fcc13c | 8185 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
bc9f98a9 | 8186 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
272a527c KY |
8187 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
8188 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
e2757d5e | 8189 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
189609ae | 8190 | [ALC883_HAIER_W66] = "haier-w66", |
4723c022 | 8191 | [ALC888_3ST_HP] = "3stack-hp", |
5795b9e6 | 8192 | [ALC888_6ST_DELL] = "6stack-dell", |
a8848bd6 | 8193 | [ALC883_MITAC] = "mitac", |
0c4cc443 | 8194 | [ALC883_CLEVO_M720] = "clevo-m720", |
fb97dc67 | 8195 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
17bba1b7 | 8196 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
3ab90935 | 8197 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
f5fcc13c TI |
8198 | [ALC883_AUTO] = "auto", |
8199 | }; | |
8200 | ||
8201 | static struct snd_pci_quirk alc883_cfg_tbl[] = { | |
8202 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), | |
ac3e3741 | 8203 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
69e50282 | 8204 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
ac3e3741 TI |
8205 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
8206 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
0b18cb18 | 8207 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
ac3e3741 | 8208 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
5795b9e6 | 8209 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
febe3375 | 8210 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
ac3e3741 TI |
8211 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
8212 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
5d85f8d0 | 8213 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
a01c30cb | 8214 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
ac3e3741 | 8215 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
3ab90935 | 8216 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
e2757d5e | 8217 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
97ec710c | 8218 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
f5fcc13c | 8219 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
ac3e3741 TI |
8220 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
8221 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
e2757d5e | 8222 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
ac3e3741 | 8223 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
57b14f24 | 8224 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
6f3bf657 | 8225 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
bba8dee7 | 8226 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 8227 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
4383fae0 | 8228 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
dd146a60 | 8229 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
82808236 | 8230 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
f5fcc13c | 8231 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 8232 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
8233 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
8234 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 | 8235 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
64ca1c29 | 8236 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
8237 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
8238 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
8239 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 TI |
8240 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
8241 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
8242 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
86d34b7e | 8243 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
ac3e3741 TI |
8244 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
8245 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
f5fcc13c | 8246 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 8247 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
0c4cc443 HRK |
8248 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
8249 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
ac3e3741 | 8250 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
e60623b4 | 8251 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
f5fcc13c | 8252 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
fb97dc67 | 8253 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
272a527c | 8254 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
272a527c | 8255 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
ac3e3741 TI |
8256 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
8257 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
e2757d5e | 8258 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
272a527c | 8259 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
959973b9 | 8260 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
0b167bf4 | 8261 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
189609ae | 8262 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
17bba1b7 J |
8263 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
8264 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
ac3e3741 | 8265 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
9c7f852e TI |
8266 | {} |
8267 | }; | |
8268 | ||
8269 | static struct alc_config_preset alc883_presets[] = { | |
8270 | [ALC883_3ST_2ch_DIG] = { | |
8271 | .mixers = { alc883_3ST_2ch_mixer }, | |
8272 | .init_verbs = { alc883_init_verbs }, | |
8273 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8274 | .dac_nids = alc883_dac_nids, | |
8275 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
8276 | .dig_in_nid = ALC883_DIGIN_NID, |
8277 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8278 | .channel_mode = alc883_3ST_2ch_modes, | |
8279 | .input_mux = &alc883_capture_source, | |
8280 | }, | |
8281 | [ALC883_3ST_6ch_DIG] = { | |
8282 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8283 | .init_verbs = { alc883_init_verbs }, | |
8284 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8285 | .dac_nids = alc883_dac_nids, | |
8286 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
8287 | .dig_in_nid = ALC883_DIGIN_NID, |
8288 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
8289 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 8290 | .need_dac_fix = 1, |
9c7f852e | 8291 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 8292 | }, |
9c7f852e TI |
8293 | [ALC883_3ST_6ch] = { |
8294 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8295 | .init_verbs = { alc883_init_verbs }, | |
8296 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8297 | .dac_nids = alc883_dac_nids, | |
9c7f852e TI |
8298 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
8299 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 8300 | .need_dac_fix = 1, |
9c7f852e | 8301 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 8302 | }, |
17bba1b7 J |
8303 | [ALC883_3ST_6ch_INTEL] = { |
8304 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
8305 | .init_verbs = { alc883_init_verbs }, | |
8306 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8307 | .dac_nids = alc883_dac_nids, | |
8308 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8309 | .dig_in_nid = ALC883_DIGIN_NID, | |
8310 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), | |
8311 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
8312 | .need_dac_fix = 1, | |
8313 | .input_mux = &alc883_3stack_6ch_intel, | |
8314 | }, | |
9c7f852e TI |
8315 | [ALC883_6ST_DIG] = { |
8316 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
8317 | .init_verbs = { alc883_init_verbs }, | |
8318 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8319 | .dac_nids = alc883_dac_nids, | |
8320 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
8321 | .dig_in_nid = ALC883_DIGIN_NID, |
8322 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
8323 | .channel_mode = alc883_sixstack_modes, | |
8324 | .input_mux = &alc883_capture_source, | |
8325 | }, | |
ccc656ce KY |
8326 | [ALC883_TARGA_DIG] = { |
8327 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, | |
8328 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, | |
8329 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8330 | .dac_nids = alc883_dac_nids, | |
8331 | .dig_out_nid = ALC883_DIGOUT_NID, | |
ccc656ce KY |
8332 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
8333 | .channel_mode = alc883_3ST_6ch_modes, | |
8334 | .need_dac_fix = 1, | |
8335 | .input_mux = &alc883_capture_source, | |
8336 | .unsol_event = alc883_tagra_unsol_event, | |
8337 | .init_hook = alc883_tagra_automute, | |
8338 | }, | |
8339 | [ALC883_TARGA_2ch_DIG] = { | |
8340 | .mixers = { alc883_tagra_2ch_mixer}, | |
8341 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, | |
8342 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8343 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
8344 | .adc_nids = alc883_adc_nids_alt, |
8345 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
ccc656ce | 8346 | .dig_out_nid = ALC883_DIGOUT_NID, |
ccc656ce KY |
8347 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8348 | .channel_mode = alc883_3ST_2ch_modes, | |
8349 | .input_mux = &alc883_capture_source, | |
8350 | .unsol_event = alc883_tagra_unsol_event, | |
8351 | .init_hook = alc883_tagra_automute, | |
8352 | }, | |
bab282b9 | 8353 | [ALC883_ACER] = { |
676a9b53 | 8354 | .mixers = { alc883_base_mixer }, |
bab282b9 VA |
8355 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
8356 | * and the headphone jack. Turn this on and rely on the | |
8357 | * standard mute methods whenever the user wants to turn | |
8358 | * these outputs off. | |
8359 | */ | |
8360 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
8361 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8362 | .dac_nids = alc883_dac_nids, | |
bab282b9 VA |
8363 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8364 | .channel_mode = alc883_3ST_2ch_modes, | |
8365 | .input_mux = &alc883_capture_source, | |
8366 | }, | |
2880a867 | 8367 | [ALC883_ACER_ASPIRE] = { |
676a9b53 | 8368 | .mixers = { alc883_acer_aspire_mixer }, |
d1a991a6 | 8369 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
2880a867 TD |
8370 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8371 | .dac_nids = alc883_dac_nids, | |
8372 | .dig_out_nid = ALC883_DIGOUT_NID, | |
2880a867 TD |
8373 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8374 | .channel_mode = alc883_3ST_2ch_modes, | |
8375 | .input_mux = &alc883_capture_source, | |
676a9b53 TI |
8376 | .unsol_event = alc883_acer_aspire_unsol_event, |
8377 | .init_hook = alc883_acer_aspire_automute, | |
d1a991a6 | 8378 | }, |
c07584c8 TD |
8379 | [ALC883_MEDION] = { |
8380 | .mixers = { alc883_fivestack_mixer, | |
8381 | alc883_chmode_mixer }, | |
8382 | .init_verbs = { alc883_init_verbs, | |
b373bdeb | 8383 | alc883_medion_eapd_verbs }, |
c07584c8 TD |
8384 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8385 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
8386 | .adc_nids = alc883_adc_nids_alt, |
8387 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
c07584c8 TD |
8388 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
8389 | .channel_mode = alc883_sixstack_modes, | |
8390 | .input_mux = &alc883_capture_source, | |
b373bdeb | 8391 | }, |
272a527c KY |
8392 | [ALC883_MEDION_MD2] = { |
8393 | .mixers = { alc883_medion_md2_mixer}, | |
8394 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, | |
8395 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8396 | .dac_nids = alc883_dac_nids, | |
8397 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
8398 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8399 | .channel_mode = alc883_3ST_2ch_modes, | |
8400 | .input_mux = &alc883_capture_source, | |
8401 | .unsol_event = alc883_medion_md2_unsol_event, | |
8402 | .init_hook = alc883_medion_md2_automute, | |
ea1fb29a | 8403 | }, |
b373bdeb | 8404 | [ALC883_LAPTOP_EAPD] = { |
676a9b53 | 8405 | .mixers = { alc883_base_mixer }, |
b373bdeb AN |
8406 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
8407 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8408 | .dac_nids = alc883_dac_nids, | |
b373bdeb AN |
8409 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8410 | .channel_mode = alc883_3ST_2ch_modes, | |
8411 | .input_mux = &alc883_capture_source, | |
8412 | }, | |
0c4cc443 HRK |
8413 | [ALC883_CLEVO_M720] = { |
8414 | .mixers = { alc883_clevo_m720_mixer }, | |
8415 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
368c7a95 J |
8416 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8417 | .dac_nids = alc883_dac_nids, | |
8418 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8419 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8420 | .channel_mode = alc883_3ST_2ch_modes, | |
8421 | .input_mux = &alc883_capture_source, | |
0c4cc443 HRK |
8422 | .unsol_event = alc883_clevo_m720_unsol_event, |
8423 | .init_hook = alc883_clevo_m720_automute, | |
368c7a95 | 8424 | }, |
bc9f98a9 KY |
8425 | [ALC883_LENOVO_101E_2ch] = { |
8426 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
8427 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
8428 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8429 | .dac_nids = alc883_dac_nids, | |
f9e336f6 TI |
8430 | .adc_nids = alc883_adc_nids_alt, |
8431 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | |
bc9f98a9 KY |
8432 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8433 | .channel_mode = alc883_3ST_2ch_modes, | |
8434 | .input_mux = &alc883_lenovo_101e_capture_source, | |
8435 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
8436 | .init_hook = alc883_lenovo_101e_all_automute, | |
8437 | }, | |
272a527c KY |
8438 | [ALC883_LENOVO_NB0763] = { |
8439 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
8440 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
8441 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8442 | .dac_nids = alc883_dac_nids, | |
272a527c KY |
8443 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8444 | .channel_mode = alc883_3ST_2ch_modes, | |
8445 | .need_dac_fix = 1, | |
8446 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
8447 | .unsol_event = alc883_medion_md2_unsol_event, | |
8448 | .init_hook = alc883_medion_md2_automute, | |
8449 | }, | |
8450 | [ALC888_LENOVO_MS7195_DIG] = { | |
8451 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8452 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
8453 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8454 | .dac_nids = alc883_dac_nids, | |
8455 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
8456 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
8457 | .channel_mode = alc883_3ST_6ch_modes, | |
8458 | .need_dac_fix = 1, | |
8459 | .input_mux = &alc883_capture_source, | |
8460 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
8461 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
189609ae KY |
8462 | }, |
8463 | [ALC883_HAIER_W66] = { | |
8464 | .mixers = { alc883_tagra_2ch_mixer}, | |
8465 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, | |
8466 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8467 | .dac_nids = alc883_dac_nids, | |
8468 | .dig_out_nid = ALC883_DIGOUT_NID, | |
189609ae KY |
8469 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8470 | .channel_mode = alc883_3ST_2ch_modes, | |
8471 | .input_mux = &alc883_capture_source, | |
8472 | .unsol_event = alc883_haier_w66_unsol_event, | |
8473 | .init_hook = alc883_haier_w66_automute, | |
eea6419e | 8474 | }, |
4723c022 | 8475 | [ALC888_3ST_HP] = { |
eea6419e | 8476 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
4723c022 | 8477 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
8341de60 CM |
8478 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8479 | .dac_nids = alc883_dac_nids, | |
4723c022 CM |
8480 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
8481 | .channel_mode = alc888_3st_hp_modes, | |
8341de60 CM |
8482 | .need_dac_fix = 1, |
8483 | .input_mux = &alc883_capture_source, | |
8484 | }, | |
5795b9e6 | 8485 | [ALC888_6ST_DELL] = { |
f24dbdc6 | 8486 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
5795b9e6 CM |
8487 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
8488 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8489 | .dac_nids = alc883_dac_nids, | |
8490 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5795b9e6 CM |
8491 | .dig_in_nid = ALC883_DIGIN_NID, |
8492 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
8493 | .channel_mode = alc883_sixstack_modes, | |
8494 | .input_mux = &alc883_capture_source, | |
8495 | .unsol_event = alc888_6st_dell_unsol_event, | |
8496 | .init_hook = alc888_6st_dell_front_automute, | |
8497 | }, | |
a8848bd6 AS |
8498 | [ALC883_MITAC] = { |
8499 | .mixers = { alc883_mitac_mixer }, | |
8500 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
8501 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8502 | .dac_nids = alc883_dac_nids, | |
a8848bd6 AS |
8503 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8504 | .channel_mode = alc883_3ST_2ch_modes, | |
8505 | .input_mux = &alc883_capture_source, | |
8506 | .unsol_event = alc883_mitac_unsol_event, | |
8507 | .init_hook = alc883_mitac_automute, | |
8508 | }, | |
fb97dc67 J |
8509 | [ALC883_FUJITSU_PI2515] = { |
8510 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
8511 | .init_verbs = { alc883_init_verbs, | |
8512 | alc883_2ch_fujitsu_pi2515_verbs}, | |
8513 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8514 | .dac_nids = alc883_dac_nids, | |
8515 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8516 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8517 | .channel_mode = alc883_3ST_2ch_modes, | |
8518 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
8519 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, | |
8520 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, | |
8521 | }, | |
e2757d5e KY |
8522 | [ALC888_LENOVO_SKY] = { |
8523 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | |
8524 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | |
8525 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8526 | .dac_nids = alc883_dac_nids, | |
8527 | .dig_out_nid = ALC883_DIGOUT_NID, | |
e2757d5e KY |
8528 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
8529 | .channel_mode = alc883_sixstack_modes, | |
8530 | .need_dac_fix = 1, | |
8531 | .input_mux = &alc883_lenovo_sky_capture_source, | |
8532 | .unsol_event = alc883_lenovo_sky_unsol_event, | |
8533 | .init_hook = alc888_lenovo_sky_front_automute, | |
8534 | }, | |
8535 | [ALC888_ASUS_M90V] = { | |
8536 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8537 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | |
8538 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8539 | .dac_nids = alc883_dac_nids, | |
8540 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8541 | .dig_in_nid = ALC883_DIGIN_NID, | |
8542 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
8543 | .channel_mode = alc883_3ST_6ch_modes, | |
8544 | .need_dac_fix = 1, | |
8545 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
8546 | .unsol_event = alc883_mode2_unsol_event, | |
8547 | .init_hook = alc883_mode2_inithook, | |
8548 | }, | |
8549 | [ALC888_ASUS_EEE1601] = { | |
8550 | .mixers = { alc883_asus_eee1601_mixer }, | |
f9e336f6 | 8551 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
e2757d5e KY |
8552 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
8553 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8554 | .dac_nids = alc883_dac_nids, | |
8555 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8556 | .dig_in_nid = ALC883_DIGIN_NID, | |
8557 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8558 | .channel_mode = alc883_3ST_2ch_modes, | |
8559 | .need_dac_fix = 1, | |
8560 | .input_mux = &alc883_asus_eee1601_capture_source, | |
8561 | .unsol_event = alc883_eee1601_unsol_event, | |
8562 | .init_hook = alc883_eee1601_inithook, | |
8563 | }, | |
3ab90935 WF |
8564 | [ALC1200_ASUS_P5Q] = { |
8565 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
8566 | .init_verbs = { alc883_init_verbs }, | |
8567 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8568 | .dac_nids = alc883_dac_nids, | |
8569 | .dig_out_nid = ALC1200_DIGOUT_NID, | |
8570 | .dig_in_nid = ALC883_DIGIN_NID, | |
8571 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
8572 | .channel_mode = alc883_sixstack_modes, | |
8573 | .input_mux = &alc883_capture_source, | |
8574 | }, | |
9c7f852e TI |
8575 | }; |
8576 | ||
8577 | ||
8578 | /* | |
8579 | * BIOS auto configuration | |
8580 | */ | |
8581 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | |
8582 | hda_nid_t nid, int pin_type, | |
8583 | int dac_idx) | |
8584 | { | |
8585 | /* set as output */ | |
8586 | struct alc_spec *spec = codec->spec; | |
f12ab1e0 TI |
8587 | int idx; |
8588 | ||
f6c7e546 | 8589 | alc_set_pin_output(codec, nid, pin_type); |
9c7f852e TI |
8590 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
8591 | idx = 4; | |
8592 | else | |
8593 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
9c7f852e TI |
8594 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
8595 | ||
8596 | } | |
8597 | ||
8598 | static void alc883_auto_init_multi_out(struct hda_codec *codec) | |
8599 | { | |
8600 | struct alc_spec *spec = codec->spec; | |
8601 | int i; | |
8602 | ||
bc9f98a9 | 8603 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
9c7f852e | 8604 | for (i = 0; i <= HDA_SIDE; i++) { |
f12ab1e0 | 8605 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 8606 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
9c7f852e | 8607 | if (nid) |
baba8ee9 | 8608 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 8609 | i); |
9c7f852e TI |
8610 | } |
8611 | } | |
8612 | ||
8613 | static void alc883_auto_init_hp_out(struct hda_codec *codec) | |
8614 | { | |
8615 | struct alc_spec *spec = codec->spec; | |
8616 | hda_nid_t pin; | |
8617 | ||
eb06ed8f | 8618 | pin = spec->autocfg.hp_pins[0]; |
9c7f852e TI |
8619 | if (pin) /* connect to front */ |
8620 | /* use dac 0 */ | |
8621 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
8622 | pin = spec->autocfg.speaker_pins[0]; |
8623 | if (pin) | |
8624 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
9c7f852e TI |
8625 | } |
8626 | ||
8627 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) | |
8628 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID | |
8629 | ||
8630 | static void alc883_auto_init_analog_input(struct hda_codec *codec) | |
8631 | { | |
8632 | struct alc_spec *spec = codec->spec; | |
8633 | int i; | |
8634 | ||
8635 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
8636 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
8637 | if (alc883_is_input_pin(nid)) { | |
8638 | snd_hda_codec_write(codec, nid, 0, | |
8639 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8640 | (i <= AUTO_PIN_FRONT_MIC ? | |
8641 | PIN_VREF80 : PIN_IN)); | |
8642 | if (nid != ALC883_PIN_CD_NID) | |
8643 | snd_hda_codec_write(codec, nid, 0, | |
8644 | AC_VERB_SET_AMP_GAIN_MUTE, | |
8645 | AMP_OUT_MUTE); | |
8646 | } | |
8647 | } | |
8648 | } | |
8649 | ||
f511b01c TI |
8650 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
8651 | ||
9c7f852e TI |
8652 | /* almost identical with ALC880 parser... */ |
8653 | static int alc883_parse_auto_config(struct hda_codec *codec) | |
8654 | { | |
8655 | struct alc_spec *spec = codec->spec; | |
8656 | int err = alc880_parse_auto_config(codec); | |
8657 | ||
8658 | if (err < 0) | |
8659 | return err; | |
776e184e TI |
8660 | else if (!err) |
8661 | return 0; /* no config found */ | |
8662 | ||
8663 | err = alc_auto_add_mic_boost(codec); | |
8664 | if (err < 0) | |
8665 | return err; | |
8666 | ||
8667 | /* hack - override the init verbs */ | |
8668 | spec->init_verbs[0] = alc883_auto_init_verbs; | |
776e184e TI |
8669 | |
8670 | return 1; /* config found */ | |
9c7f852e TI |
8671 | } |
8672 | ||
8673 | /* additional initialization for auto-configuration model */ | |
8674 | static void alc883_auto_init(struct hda_codec *codec) | |
8675 | { | |
f6c7e546 | 8676 | struct alc_spec *spec = codec->spec; |
9c7f852e TI |
8677 | alc883_auto_init_multi_out(codec); |
8678 | alc883_auto_init_hp_out(codec); | |
8679 | alc883_auto_init_analog_input(codec); | |
f511b01c | 8680 | alc883_auto_init_input_src(codec); |
f6c7e546 | 8681 | if (spec->unsol_event) |
7fb0d78f | 8682 | alc_inithook(codec); |
9c7f852e TI |
8683 | } |
8684 | ||
8685 | static int patch_alc883(struct hda_codec *codec) | |
8686 | { | |
8687 | struct alc_spec *spec; | |
8688 | int err, board_config; | |
8689 | ||
8690 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
8691 | if (spec == NULL) | |
8692 | return -ENOMEM; | |
8693 | ||
8694 | codec->spec = spec; | |
8695 | ||
2c3bf9ab TI |
8696 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
8697 | ||
f5fcc13c TI |
8698 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
8699 | alc883_models, | |
8700 | alc883_cfg_tbl); | |
8701 | if (board_config < 0) { | |
9c7f852e TI |
8702 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
8703 | "trying auto-probe from BIOS...\n"); | |
8704 | board_config = ALC883_AUTO; | |
8705 | } | |
8706 | ||
8707 | if (board_config == ALC883_AUTO) { | |
8708 | /* automatic parse from the BIOS config */ | |
8709 | err = alc883_parse_auto_config(codec); | |
8710 | if (err < 0) { | |
8711 | alc_free(codec); | |
8712 | return err; | |
f12ab1e0 | 8713 | } else if (!err) { |
9c7f852e TI |
8714 | printk(KERN_INFO |
8715 | "hda_codec: Cannot set up configuration " | |
8716 | "from BIOS. Using base mode...\n"); | |
8717 | board_config = ALC883_3ST_2ch_DIG; | |
8718 | } | |
8719 | } | |
8720 | ||
8721 | if (board_config != ALC883_AUTO) | |
8722 | setup_preset(spec, &alc883_presets[board_config]); | |
8723 | ||
2f893286 KY |
8724 | switch (codec->vendor_id) { |
8725 | case 0x10ec0888: | |
4442608d KY |
8726 | if (codec->revision_id == 0x100101) { |
8727 | spec->stream_name_analog = "ALC1200 Analog"; | |
8728 | spec->stream_name_digital = "ALC1200 Digital"; | |
8729 | } else { | |
8730 | spec->stream_name_analog = "ALC888 Analog"; | |
8731 | spec->stream_name_digital = "ALC888 Digital"; | |
8732 | } | |
2f893286 KY |
8733 | break; |
8734 | case 0x10ec0889: | |
8735 | spec->stream_name_analog = "ALC889 Analog"; | |
8736 | spec->stream_name_digital = "ALC889 Digital"; | |
8737 | break; | |
8738 | default: | |
8739 | spec->stream_name_analog = "ALC883 Analog"; | |
8740 | spec->stream_name_digital = "ALC883 Digital"; | |
8741 | break; | |
8742 | } | |
8743 | ||
9c7f852e TI |
8744 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
8745 | spec->stream_analog_capture = &alc883_pcm_analog_capture; | |
6330079f | 8746 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
9c7f852e | 8747 | |
9c7f852e TI |
8748 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
8749 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | |
8750 | ||
f9e336f6 TI |
8751 | if (!spec->num_adc_nids) { |
8752 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | |
8753 | spec->adc_nids = alc883_adc_nids; | |
8754 | } | |
8755 | if (!spec->capsrc_nids) | |
8756 | spec->capsrc_nids = alc883_capsrc_nids; | |
54cbc9ab | 8757 | spec->is_mix_capture = 1; /* matrix-style capture */ |
f9e336f6 TI |
8758 | if (!spec->cap_mixer) |
8759 | set_capture_mixer(spec); | |
9c7f852e | 8760 | |
2134ea4f TI |
8761 | spec->vmaster_nid = 0x0c; |
8762 | ||
9c7f852e TI |
8763 | codec->patch_ops = alc_patch_ops; |
8764 | if (board_config == ALC883_AUTO) | |
8765 | spec->init_hook = alc883_auto_init; | |
f9423e7a | 8766 | |
cb53c626 TI |
8767 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
8768 | if (!spec->loopback.amplist) | |
8769 | spec->loopback.amplist = alc883_loopbacks; | |
8770 | #endif | |
9c7f852e TI |
8771 | |
8772 | return 0; | |
8773 | } | |
8774 | ||
8775 | /* | |
8776 | * ALC262 support | |
8777 | */ | |
8778 | ||
8779 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
8780 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
8781 | ||
8782 | #define alc262_dac_nids alc260_dac_nids | |
8783 | #define alc262_adc_nids alc882_adc_nids | |
8784 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
88c71a99 TI |
8785 | #define alc262_capsrc_nids alc882_capsrc_nids |
8786 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
9c7f852e TI |
8787 | |
8788 | #define alc262_modes alc260_modes | |
8789 | #define alc262_capture_source alc882_capture_source | |
8790 | ||
4e555fe5 KY |
8791 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
8792 | /* ADC0 */ | |
8793 | 0x09 | |
8794 | }; | |
8795 | ||
8796 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | |
8797 | ||
9c7f852e TI |
8798 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
8799 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8800 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8801 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8802 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8803 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8804 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8807 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8808 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8809 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 8810 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8811 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
31bffaa9 | 8812 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
9c7f852e TI |
8813 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
8814 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8815 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8816 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
8817 | { } /* end */ | |
8818 | }; | |
8819 | ||
ccc656ce KY |
8820 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
8821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8822 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8823 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8824 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8825 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8826 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8829 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce KY |
8830 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8831 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 8832 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
ccc656ce | 8833 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
31bffaa9 | 8834 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
ccc656ce KY |
8835 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
8836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8837 | { } /* end */ | |
8838 | }; | |
8839 | ||
ce875f07 TI |
8840 | /* update HP, line and mono-out pins according to the master switch */ |
8841 | static void alc262_hp_master_update(struct hda_codec *codec) | |
8842 | { | |
8843 | struct alc_spec *spec = codec->spec; | |
8844 | int val = spec->master_sw; | |
8845 | ||
8846 | /* HP & line-out */ | |
8847 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
8848 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8849 | val ? PIN_HP : 0); | |
8850 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
8851 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8852 | val ? PIN_HP : 0); | |
8853 | /* mono (speaker) depending on the HP jack sense */ | |
8854 | val = val && !spec->jack_present; | |
8855 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
8856 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8857 | val ? PIN_OUT : 0); | |
8858 | } | |
8859 | ||
8860 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
8861 | { | |
8862 | struct alc_spec *spec = codec->spec; | |
8863 | unsigned int presence; | |
8864 | presence = snd_hda_codec_read(codec, 0x1b, 0, | |
8865 | AC_VERB_GET_PIN_SENSE, 0); | |
8866 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); | |
8867 | alc262_hp_master_update(codec); | |
8868 | } | |
8869 | ||
8870 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
8871 | { | |
8872 | if ((res >> 26) != ALC880_HP_EVENT) | |
8873 | return; | |
8874 | alc262_hp_bpc_automute(codec); | |
8875 | } | |
8876 | ||
8877 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
8878 | { | |
8879 | struct alc_spec *spec = codec->spec; | |
8880 | unsigned int presence; | |
8881 | presence = snd_hda_codec_read(codec, 0x15, 0, | |
8882 | AC_VERB_GET_PIN_SENSE, 0); | |
8883 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); | |
8884 | alc262_hp_master_update(codec); | |
8885 | } | |
8886 | ||
8887 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
8888 | unsigned int res) | |
8889 | { | |
8890 | if ((res >> 26) != ALC880_HP_EVENT) | |
8891 | return; | |
8892 | alc262_hp_wildwest_automute(codec); | |
8893 | } | |
8894 | ||
8895 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
8896 | struct snd_ctl_elem_value *ucontrol) | |
8897 | { | |
8898 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
8899 | struct alc_spec *spec = codec->spec; | |
8900 | *ucontrol->value.integer.value = spec->master_sw; | |
8901 | return 0; | |
8902 | } | |
8903 | ||
8904 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
8905 | struct snd_ctl_elem_value *ucontrol) | |
8906 | { | |
8907 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
8908 | struct alc_spec *spec = codec->spec; | |
8909 | int val = !!*ucontrol->value.integer.value; | |
8910 | ||
8911 | if (val == spec->master_sw) | |
8912 | return 0; | |
8913 | spec->master_sw = val; | |
8914 | alc262_hp_master_update(codec); | |
8915 | return 1; | |
8916 | } | |
8917 | ||
9c7f852e | 8918 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
ce875f07 TI |
8919 | { |
8920 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8921 | .name = "Master Playback Switch", | |
8922 | .info = snd_ctl_boolean_mono_info, | |
8923 | .get = alc262_hp_master_sw_get, | |
8924 | .put = alc262_hp_master_sw_put, | |
8925 | }, | |
9c7f852e TI |
8926 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8927 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8928 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
8929 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
8930 | HDA_OUTPUT), | |
8931 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
8932 | HDA_OUTPUT), | |
9c7f852e TI |
8933 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
8934 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8935 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8936 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8937 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 8938 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
8939 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8940 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8941 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8942 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8943 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
8944 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
8945 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
8946 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
8947 | { } /* end */ | |
8948 | }; | |
8949 | ||
cd7509a4 | 8950 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
ce875f07 TI |
8951 | { |
8952 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
8953 | .name = "Master Playback Switch", | |
8954 | .info = snd_ctl_boolean_mono_info, | |
8955 | .get = alc262_hp_master_sw_get, | |
8956 | .put = alc262_hp_master_sw_put, | |
8957 | }, | |
cd7509a4 KY |
8958 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8959 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8960 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
8961 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
8962 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
8963 | HDA_OUTPUT), | |
8964 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
8965 | HDA_OUTPUT), | |
cd7509a4 KY |
8966 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
8967 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
cc69d12d | 8968 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
cd7509a4 KY |
8969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8970 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
8971 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8972 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8973 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
8974 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
8975 | { } /* end */ | |
8976 | }; | |
8977 | ||
8978 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
8979 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8980 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8981 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
cd7509a4 KY |
8982 | { } /* end */ |
8983 | }; | |
8984 | ||
66d2a9d6 KY |
8985 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
8986 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) | |
8987 | { | |
8988 | struct alc_spec *spec = codec->spec; | |
66d2a9d6 KY |
8989 | |
8990 | if (force || !spec->sense_updated) { | |
8991 | unsigned int present; | |
8992 | present = snd_hda_codec_read(codec, 0x15, 0, | |
8993 | AC_VERB_GET_PIN_SENSE, 0); | |
4bb26130 | 8994 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
66d2a9d6 KY |
8995 | spec->sense_updated = 1; |
8996 | } | |
4bb26130 TI |
8997 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
8998 | spec->jack_present ? HDA_AMP_MUTE : 0); | |
66d2a9d6 KY |
8999 | } |
9000 | ||
9001 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, | |
9002 | unsigned int res) | |
9003 | { | |
9004 | if ((res >> 26) != ALC880_HP_EVENT) | |
9005 | return; | |
9006 | alc262_hp_t5735_automute(codec, 1); | |
9007 | } | |
9008 | ||
9009 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) | |
9010 | { | |
9011 | alc262_hp_t5735_automute(codec, 1); | |
9012 | } | |
9013 | ||
9014 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | |
86cd9298 TI |
9015 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9016 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
66d2a9d6 KY |
9017 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
9018 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9021 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9022 | { } /* end */ | |
9023 | }; | |
9024 | ||
9025 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
9026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9028 | ||
9029 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9030 | { } | |
9031 | }; | |
9032 | ||
8c427226 | 9033 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
f2f48e18 TI |
9034 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9035 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
9036 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
9037 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
8c427226 KY |
9038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9039 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9040 | { } /* end */ | |
9041 | }; | |
9042 | ||
9043 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
9044 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9045 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9046 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9047 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9048 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
9049 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
9051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
9052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
9053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
9054 | {} | |
9055 | }; | |
9056 | ||
9057 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
9058 | .num_items = 1, | |
9059 | .items = { | |
9060 | { "Line", 0x1 }, | |
9061 | }, | |
9062 | }; | |
9063 | ||
0724ea2a TI |
9064 | /* bind hp and internal speaker mute (with plug check) */ |
9065 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, | |
9066 | struct snd_ctl_elem_value *ucontrol) | |
9067 | { | |
9068 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9069 | long *valp = ucontrol->value.integer.value; | |
9070 | int change; | |
9071 | ||
9072 | /* change hp mute */ | |
9073 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, | |
9074 | HDA_AMP_MUTE, | |
9075 | valp[0] ? 0 : HDA_AMP_MUTE); | |
9076 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, | |
9077 | HDA_AMP_MUTE, | |
9078 | valp[1] ? 0 : HDA_AMP_MUTE); | |
9079 | if (change) { | |
9080 | /* change speaker according to HP jack state */ | |
9081 | struct alc_spec *spec = codec->spec; | |
9082 | unsigned int mute; | |
9083 | if (spec->jack_present) | |
9084 | mute = HDA_AMP_MUTE; | |
9085 | else | |
9086 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, | |
9087 | HDA_OUTPUT, 0); | |
9088 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9089 | HDA_AMP_MUTE, mute); | |
9090 | } | |
9091 | return change; | |
9092 | } | |
5b31954e | 9093 | |
272a527c | 9094 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
0724ea2a TI |
9095 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9096 | { | |
9097 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9098 | .name = "Master Playback Switch", | |
9099 | .info = snd_hda_mixer_amp_switch_info, | |
9100 | .get = snd_hda_mixer_amp_switch_get, | |
9101 | .put = alc262_sony_master_sw_put, | |
9102 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
9103 | }, | |
272a527c KY |
9104 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
9105 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9106 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
9107 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9108 | { } /* end */ | |
9109 | }; | |
9110 | ||
83c34218 KY |
9111 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
9112 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9113 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9114 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9117 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
9118 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9119 | { } /* end */ | |
9120 | }; | |
272a527c | 9121 | |
9c7f852e TI |
9122 | #define alc262_capture_mixer alc882_capture_mixer |
9123 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
9124 | ||
9125 | /* | |
9126 | * generic initialization of ADC, input mixers and output mixers | |
9127 | */ | |
9128 | static struct hda_verb alc262_init_verbs[] = { | |
9129 | /* | |
9130 | * Unmute ADC0-2 and set the default input to mic-in | |
9131 | */ | |
9132 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9134 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9135 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9136 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9137 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9138 | ||
cb53c626 | 9139 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 9140 | * mixer widget |
f12ab1e0 TI |
9141 | * Note: PASD motherboards uses the Line In 2 as the input for |
9142 | * front panel mic (mic 2) | |
9c7f852e TI |
9143 | */ |
9144 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
9145 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
9146 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9147 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9149 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
9150 | |
9151 | /* | |
df694daa KY |
9152 | * Set up output mixers (0x0c - 0x0e) |
9153 | */ | |
9154 | /* set vol=0 to output mixers */ | |
9155 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9156 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9157 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9158 | /* set up input amps for analog loopback */ | |
9159 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
9160 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9161 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9162 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9163 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9164 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9165 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9166 | ||
9167 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
9168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
9169 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
9170 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9171 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9172 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9173 | ||
9174 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9176 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9177 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9178 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
ea1fb29a | 9179 | |
df694daa KY |
9180 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9181 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
ea1fb29a | 9182 | |
df694daa KY |
9183 | /* FIXME: use matrix-type input source selection */ |
9184 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
9185 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
9186 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9187 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9188 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9189 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9190 | /* Input mixer2 */ | |
9191 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9192 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9193 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9194 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9195 | /* Input mixer3 */ | |
9196 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9197 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
f12ab1e0 | 9199 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
df694daa KY |
9200 | |
9201 | { } | |
9202 | }; | |
1da177e4 | 9203 | |
4e555fe5 KY |
9204 | static struct hda_verb alc262_eapd_verbs[] = { |
9205 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
9206 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
9207 | { } | |
9208 | }; | |
9209 | ||
ccc656ce KY |
9210 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
9211 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9212 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9213 | {} | |
9214 | }; | |
9215 | ||
9216 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | |
9217 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
9218 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9219 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9220 | ||
9221 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9222 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9223 | {} | |
9224 | }; | |
9225 | ||
272a527c KY |
9226 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
9227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
9228 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9229 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
9230 | ||
9231 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7b1e8795 | 9233 | {} |
272a527c KY |
9234 | }; |
9235 | ||
4e555fe5 KY |
9236 | static struct hda_input_mux alc262_dmic_capture_source = { |
9237 | .num_items = 2, | |
9238 | .items = { | |
9239 | { "Int DMic", 0x9 }, | |
9240 | { "Mic", 0x0 }, | |
9241 | }, | |
9242 | }; | |
9243 | ||
9244 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | |
9245 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9246 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9247 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9248 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9249 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
4e555fe5 KY |
9250 | { } /* end */ |
9251 | }; | |
9252 | ||
9253 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | |
9254 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
9255 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9258 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | |
9259 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9260 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
9261 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9262 | {} | |
9263 | }; | |
9264 | ||
9265 | static void alc262_dmic_automute(struct hda_codec *codec) | |
9266 | { | |
9267 | unsigned int present; | |
9268 | ||
9269 | present = snd_hda_codec_read(codec, 0x18, 0, | |
9270 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
9271 | snd_hda_codec_write(codec, 0x22, 0, | |
9272 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); | |
9273 | } | |
9274 | ||
9275 | /* toggle speaker-output according to the hp-jack state */ | |
9276 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) | |
9277 | { | |
9278 | unsigned int present; | |
9279 | unsigned char bits; | |
9280 | ||
9281 | present = snd_hda_codec_read(codec, 0x15, 0, | |
9282 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
9283 | bits = present ? 0 : PIN_OUT; | |
9284 | snd_hda_codec_write(codec, 0x14, 0, | |
9285 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
9286 | } | |
9287 | ||
9288 | ||
9289 | ||
9290 | /* unsolicited event for HP jack sensing */ | |
9291 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, | |
9292 | unsigned int res) | |
9293 | { | |
9294 | if ((res >> 26) == ALC880_HP_EVENT) | |
9295 | alc262_toshiba_s06_speaker_automute(codec); | |
9296 | if ((res >> 26) == ALC880_MIC_EVENT) | |
9297 | alc262_dmic_automute(codec); | |
9298 | ||
9299 | } | |
9300 | ||
9301 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) | |
9302 | { | |
9303 | alc262_toshiba_s06_speaker_automute(codec); | |
9304 | alc262_dmic_automute(codec); | |
9305 | } | |
9306 | ||
ccc656ce | 9307 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
5b31954e | 9308 | static void alc262_hippo_automute(struct hda_codec *codec) |
ccc656ce KY |
9309 | { |
9310 | struct alc_spec *spec = codec->spec; | |
9311 | unsigned int mute; | |
5b31954e | 9312 | unsigned int present; |
ccc656ce | 9313 | |
5b31954e TI |
9314 | /* need to execute and sync at first */ |
9315 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9316 | present = snd_hda_codec_read(codec, 0x15, 0, | |
9317 | AC_VERB_GET_PIN_SENSE, 0); | |
9318 | spec->jack_present = (present & 0x80000000) != 0; | |
ccc656ce KY |
9319 | if (spec->jack_present) { |
9320 | /* mute internal speaker */ | |
47fd830a TI |
9321 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9322 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
ccc656ce KY |
9323 | } else { |
9324 | /* unmute internal speaker if necessary */ | |
9325 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); | |
47fd830a TI |
9326 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9327 | HDA_AMP_MUTE, mute); | |
ccc656ce KY |
9328 | } |
9329 | } | |
9330 | ||
9331 | /* unsolicited event for HP jack sensing */ | |
9332 | static void alc262_hippo_unsol_event(struct hda_codec *codec, | |
9333 | unsigned int res) | |
9334 | { | |
9335 | if ((res >> 26) != ALC880_HP_EVENT) | |
9336 | return; | |
5b31954e | 9337 | alc262_hippo_automute(codec); |
ccc656ce KY |
9338 | } |
9339 | ||
5b31954e | 9340 | static void alc262_hippo1_automute(struct hda_codec *codec) |
ccc656ce | 9341 | { |
ccc656ce | 9342 | unsigned int mute; |
5b31954e | 9343 | unsigned int present; |
ccc656ce | 9344 | |
5b31954e TI |
9345 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
9346 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
9347 | AC_VERB_GET_PIN_SENSE, 0); | |
9348 | present = (present & 0x80000000) != 0; | |
9349 | if (present) { | |
ccc656ce | 9350 | /* mute internal speaker */ |
47fd830a TI |
9351 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9352 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
ccc656ce KY |
9353 | } else { |
9354 | /* unmute internal speaker if necessary */ | |
9355 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
47fd830a TI |
9356 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9357 | HDA_AMP_MUTE, mute); | |
ccc656ce KY |
9358 | } |
9359 | } | |
9360 | ||
9361 | /* unsolicited event for HP jack sensing */ | |
9362 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, | |
9363 | unsigned int res) | |
9364 | { | |
9365 | if ((res >> 26) != ALC880_HP_EVENT) | |
9366 | return; | |
5b31954e | 9367 | alc262_hippo1_automute(codec); |
ccc656ce KY |
9368 | } |
9369 | ||
e8f9ae2a PT |
9370 | /* |
9371 | * nec model | |
9372 | * 0x15 = headphone | |
9373 | * 0x16 = internal speaker | |
9374 | * 0x18 = external mic | |
9375 | */ | |
9376 | ||
9377 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | |
9378 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
9379 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | |
9380 | ||
9381 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9382 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9383 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9384 | ||
9385 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
9386 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9387 | { } /* end */ | |
9388 | }; | |
9389 | ||
9390 | static struct hda_verb alc262_nec_verbs[] = { | |
9391 | /* Unmute Speaker */ | |
9392 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9393 | ||
9394 | /* Headphone */ | |
9395 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9396 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9397 | ||
9398 | /* External mic to headphone */ | |
9399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9400 | /* External mic to speaker */ | |
9401 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9402 | {} | |
9403 | }; | |
9404 | ||
834be88d TI |
9405 | /* |
9406 | * fujitsu model | |
5d9fab2d TV |
9407 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
9408 | * 0x1b = port replicator headphone out | |
834be88d TI |
9409 | */ |
9410 | ||
9411 | #define ALC_HP_EVENT 0x37 | |
9412 | ||
9413 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
9414 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
9415 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5d9fab2d TV |
9416 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
9417 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
834be88d TI |
9418 | {} |
9419 | }; | |
9420 | ||
0e31daf7 J |
9421 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
9422 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
9423 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9424 | {} | |
9425 | }; | |
9426 | ||
834be88d | 9427 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
39d3ed38 | 9428 | .num_items = 3, |
834be88d TI |
9429 | .items = { |
9430 | { "Mic", 0x0 }, | |
39d3ed38 | 9431 | { "Int Mic", 0x1 }, |
834be88d TI |
9432 | { "CD", 0x4 }, |
9433 | }, | |
9434 | }; | |
9435 | ||
9c7f852e TI |
9436 | static struct hda_input_mux alc262_HP_capture_source = { |
9437 | .num_items = 5, | |
9438 | .items = { | |
9439 | { "Mic", 0x0 }, | |
accbe498 | 9440 | { "Front Mic", 0x1 }, |
9c7f852e TI |
9441 | { "Line", 0x2 }, |
9442 | { "CD", 0x4 }, | |
9443 | { "AUX IN", 0x6 }, | |
9444 | }, | |
9445 | }; | |
9446 | ||
accbe498 | 9447 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
9448 | .num_items = 4, | |
9449 | .items = { | |
9450 | { "Mic", 0x0 }, | |
9451 | { "Front Mic", 0x2 }, | |
9452 | { "Line", 0x1 }, | |
9453 | { "CD", 0x4 }, | |
9454 | }, | |
9455 | }; | |
9456 | ||
ebc7a406 | 9457 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
834be88d TI |
9458 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
9459 | { | |
9460 | struct alc_spec *spec = codec->spec; | |
9461 | unsigned int mute; | |
9462 | ||
f12ab1e0 | 9463 | if (force || !spec->sense_updated) { |
ebc7a406 | 9464 | unsigned int present; |
834be88d TI |
9465 | /* need to execute and sync at first */ |
9466 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); | |
ebc7a406 TI |
9467 | /* check laptop HP jack */ |
9468 | present = snd_hda_codec_read(codec, 0x14, 0, | |
9469 | AC_VERB_GET_PIN_SENSE, 0); | |
9470 | /* need to execute and sync at first */ | |
9471 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9472 | /* check docking HP jack */ | |
9473 | present |= snd_hda_codec_read(codec, 0x1b, 0, | |
9474 | AC_VERB_GET_PIN_SENSE, 0); | |
9475 | if (present & AC_PINSENSE_PRESENCE) | |
9476 | spec->jack_present = 1; | |
9477 | else | |
9478 | spec->jack_present = 0; | |
834be88d TI |
9479 | spec->sense_updated = 1; |
9480 | } | |
ebc7a406 TI |
9481 | /* unmute internal speaker only if both HPs are unplugged and |
9482 | * master switch is on | |
9483 | */ | |
9484 | if (spec->jack_present) | |
9485 | mute = HDA_AMP_MUTE; | |
9486 | else | |
834be88d | 9487 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
ebc7a406 TI |
9488 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9489 | HDA_AMP_MUTE, mute); | |
834be88d TI |
9490 | } |
9491 | ||
9492 | /* unsolicited event for HP jack sensing */ | |
9493 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
9494 | unsigned int res) | |
9495 | { | |
9496 | if ((res >> 26) != ALC_HP_EVENT) | |
9497 | return; | |
9498 | alc262_fujitsu_automute(codec, 1); | |
9499 | } | |
9500 | ||
ebc7a406 TI |
9501 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
9502 | { | |
9503 | alc262_fujitsu_automute(codec, 1); | |
9504 | } | |
9505 | ||
834be88d | 9506 | /* bind volumes of both NID 0x0c and 0x0d */ |
cca3b371 TI |
9507 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
9508 | .ops = &snd_hda_bind_vol, | |
9509 | .values = { | |
9510 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
9511 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
9512 | 0 | |
9513 | }, | |
9514 | }; | |
834be88d | 9515 | |
0e31daf7 J |
9516 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
9517 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
9518 | { | |
9519 | struct alc_spec *spec = codec->spec; | |
9520 | unsigned int mute; | |
9521 | ||
9522 | if (force || !spec->sense_updated) { | |
9523 | unsigned int present_int_hp; | |
9524 | /* need to execute and sync at first */ | |
9525 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9526 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, | |
9527 | AC_VERB_GET_PIN_SENSE, 0); | |
9528 | spec->jack_present = (present_int_hp & 0x80000000) != 0; | |
9529 | spec->sense_updated = 1; | |
9530 | } | |
9531 | if (spec->jack_present) { | |
9532 | /* mute internal speaker */ | |
9533 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9534 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
9535 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9536 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
9537 | } else { | |
9538 | /* unmute internal speaker if necessary */ | |
9539 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
9540 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9541 | HDA_AMP_MUTE, mute); | |
9542 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9543 | HDA_AMP_MUTE, mute); | |
9544 | } | |
9545 | } | |
9546 | ||
9547 | /* unsolicited event for HP jack sensing */ | |
9548 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
9549 | unsigned int res) | |
9550 | { | |
9551 | if ((res >> 26) != ALC_HP_EVENT) | |
9552 | return; | |
9553 | alc262_lenovo_3000_automute(codec, 1); | |
9554 | } | |
9555 | ||
834be88d TI |
9556 | /* bind hp and internal speaker mute (with plug check) */ |
9557 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
9558 | struct snd_ctl_elem_value *ucontrol) | |
9559 | { | |
9560 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9561 | long *valp = ucontrol->value.integer.value; | |
9562 | int change; | |
9563 | ||
5d9fab2d TV |
9564 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9565 | HDA_AMP_MUTE, | |
9566 | valp ? 0 : HDA_AMP_MUTE); | |
9567 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
9568 | HDA_AMP_MUTE, | |
9569 | valp ? 0 : HDA_AMP_MUTE); | |
9570 | ||
82beb8fd TI |
9571 | if (change) |
9572 | alc262_fujitsu_automute(codec, 0); | |
834be88d TI |
9573 | return change; |
9574 | } | |
9575 | ||
9576 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
cca3b371 | 9577 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
834be88d TI |
9578 | { |
9579 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9580 | .name = "Master Playback Switch", | |
9581 | .info = snd_hda_mixer_amp_switch_info, | |
9582 | .get = snd_hda_mixer_amp_switch_get, | |
9583 | .put = alc262_fujitsu_master_sw_put, | |
9584 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
9585 | }, | |
9586 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9587 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
06a9c30c TV |
9588 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
9589 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), | |
834be88d TI |
9590 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9591 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9592 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
39d3ed38 TI |
9593 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
9594 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9595 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
834be88d TI |
9596 | { } /* end */ |
9597 | }; | |
9598 | ||
0e31daf7 J |
9599 | /* bind hp and internal speaker mute (with plug check) */ |
9600 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
9601 | struct snd_ctl_elem_value *ucontrol) | |
9602 | { | |
9603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9604 | long *valp = ucontrol->value.integer.value; | |
9605 | int change; | |
9606 | ||
9607 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
9608 | HDA_AMP_MUTE, | |
9609 | valp ? 0 : HDA_AMP_MUTE); | |
9610 | ||
9611 | if (change) | |
9612 | alc262_lenovo_3000_automute(codec, 0); | |
9613 | return change; | |
9614 | } | |
9615 | ||
9616 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
9617 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
9618 | { | |
9619 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9620 | .name = "Master Playback Switch", | |
9621 | .info = snd_hda_mixer_amp_switch_info, | |
9622 | .get = snd_hda_mixer_amp_switch_get, | |
9623 | .put = alc262_lenovo_3000_master_sw_put, | |
9624 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
9625 | }, | |
9626 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9627 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9628 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9629 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9630 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9631 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
9632 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9633 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9634 | { } /* end */ | |
9635 | }; | |
9636 | ||
9f99a638 HM |
9637 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
9638 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
9639 | { | |
9640 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9641 | .name = "Master Playback Switch", | |
9642 | .info = snd_hda_mixer_amp_switch_info, | |
9643 | .get = snd_hda_mixer_amp_switch_get, | |
9644 | .put = alc262_sony_master_sw_put, | |
9645 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
9646 | }, | |
9647 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9649 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9650 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
9651 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9652 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
9653 | { } /* end */ | |
9654 | }; | |
9655 | ||
304dcaac TI |
9656 | /* additional init verbs for Benq laptops */ |
9657 | static struct hda_verb alc262_EAPD_verbs[] = { | |
9658 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9659 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
9660 | {} | |
9661 | }; | |
9662 | ||
83c34218 KY |
9663 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
9664 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9665 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9666 | ||
9667 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9668 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
9669 | {} | |
9670 | }; | |
9671 | ||
f651b50b TD |
9672 | /* Samsung Q1 Ultra Vista model setup */ |
9673 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
bb9f76cd TI |
9674 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9675 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
f651b50b TD |
9676 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9677 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9678 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
bb9f76cd | 9679 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
f651b50b TD |
9680 | { } /* end */ |
9681 | }; | |
9682 | ||
9683 | static struct hda_verb alc262_ultra_verbs[] = { | |
bb9f76cd TI |
9684 | /* output mixer */ |
9685 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9686 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9688 | /* speaker */ | |
9689 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9690 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
9691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9692 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9693 | /* HP */ | |
f651b50b | 9694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
bb9f76cd TI |
9695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
9696 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9697 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9698 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9699 | /* internal mic */ | |
9700 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
9701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9702 | /* ADC, choose mic */ | |
9703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9706 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9707 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9708 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9709 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
9710 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
9711 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
9712 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
f651b50b TD |
9713 | {} |
9714 | }; | |
9715 | ||
f651b50b TD |
9716 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
9717 | static void alc262_ultra_automute(struct hda_codec *codec) | |
9718 | { | |
9719 | struct alc_spec *spec = codec->spec; | |
9720 | unsigned int mute; | |
f651b50b | 9721 | |
bb9f76cd TI |
9722 | mute = 0; |
9723 | /* auto-mute only when HP is used as HP */ | |
9724 | if (!spec->cur_mux[0]) { | |
9725 | unsigned int present; | |
9726 | /* need to execute and sync at first */ | |
9727 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9728 | present = snd_hda_codec_read(codec, 0x15, 0, | |
9729 | AC_VERB_GET_PIN_SENSE, 0); | |
9730 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
9731 | if (spec->jack_present) | |
9732 | mute = HDA_AMP_MUTE; | |
f651b50b | 9733 | } |
bb9f76cd TI |
9734 | /* mute/unmute internal speaker */ |
9735 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9736 | HDA_AMP_MUTE, mute); | |
9737 | /* mute/unmute HP */ | |
9738 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9739 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
f651b50b TD |
9740 | } |
9741 | ||
9742 | /* unsolicited event for HP jack sensing */ | |
9743 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
9744 | unsigned int res) | |
9745 | { | |
9746 | if ((res >> 26) != ALC880_HP_EVENT) | |
9747 | return; | |
9748 | alc262_ultra_automute(codec); | |
9749 | } | |
9750 | ||
bb9f76cd TI |
9751 | static struct hda_input_mux alc262_ultra_capture_source = { |
9752 | .num_items = 2, | |
9753 | .items = { | |
9754 | { "Mic", 0x1 }, | |
9755 | { "Headphone", 0x7 }, | |
9756 | }, | |
9757 | }; | |
9758 | ||
9759 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
9760 | struct snd_ctl_elem_value *ucontrol) | |
9761 | { | |
9762 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9763 | struct alc_spec *spec = codec->spec; | |
9764 | int ret; | |
9765 | ||
54cbc9ab | 9766 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
bb9f76cd TI |
9767 | if (!ret) |
9768 | return 0; | |
9769 | /* reprogram the HP pin as mic or HP according to the input source */ | |
9770 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
9771 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
9772 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
9773 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
9774 | return ret; | |
9775 | } | |
9776 | ||
9777 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
9778 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
9779 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
9780 | { | |
9781 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9782 | .name = "Capture Source", | |
54cbc9ab TI |
9783 | .info = alc_mux_enum_info, |
9784 | .get = alc_mux_enum_get, | |
bb9f76cd TI |
9785 | .put = alc262_ultra_mux_enum_put, |
9786 | }, | |
9787 | { } /* end */ | |
9788 | }; | |
9789 | ||
df694daa | 9790 | /* add playback controls from the parsed DAC table */ |
f12ab1e0 TI |
9791 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
9792 | const struct auto_pin_cfg *cfg) | |
df694daa KY |
9793 | { |
9794 | hda_nid_t nid; | |
9795 | int err; | |
9796 | ||
9797 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
9798 | spec->multiout.dac_nids = spec->private_dac_nids; | |
9799 | spec->multiout.dac_nids[0] = 2; | |
9800 | ||
9801 | nid = cfg->line_out_pins[0]; | |
9802 | if (nid) { | |
f12ab1e0 TI |
9803 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9804 | "Front Playback Volume", | |
9805 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); | |
9806 | if (err < 0) | |
df694daa | 9807 | return err; |
f12ab1e0 TI |
9808 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9809 | "Front Playback Switch", | |
9810 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
9811 | if (err < 0) | |
df694daa KY |
9812 | return err; |
9813 | } | |
9814 | ||
82bc955f | 9815 | nid = cfg->speaker_pins[0]; |
df694daa KY |
9816 | if (nid) { |
9817 | if (nid == 0x16) { | |
f12ab1e0 TI |
9818 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9819 | "Speaker Playback Volume", | |
9820 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | |
9821 | HDA_OUTPUT)); | |
9822 | if (err < 0) | |
df694daa | 9823 | return err; |
f12ab1e0 TI |
9824 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9825 | "Speaker Playback Switch", | |
9826 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
9827 | HDA_OUTPUT)); | |
9828 | if (err < 0) | |
df694daa KY |
9829 | return err; |
9830 | } else { | |
f12ab1e0 TI |
9831 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9832 | "Speaker Playback Switch", | |
9833 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
9834 | HDA_OUTPUT)); | |
9835 | if (err < 0) | |
df694daa KY |
9836 | return err; |
9837 | } | |
9838 | } | |
eb06ed8f | 9839 | nid = cfg->hp_pins[0]; |
df694daa KY |
9840 | if (nid) { |
9841 | /* spec->multiout.hp_nid = 2; */ | |
9842 | if (nid == 0x16) { | |
f12ab1e0 TI |
9843 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9844 | "Headphone Playback Volume", | |
9845 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | |
9846 | HDA_OUTPUT)); | |
9847 | if (err < 0) | |
df694daa | 9848 | return err; |
f12ab1e0 TI |
9849 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9850 | "Headphone Playback Switch", | |
9851 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
9852 | HDA_OUTPUT)); | |
9853 | if (err < 0) | |
df694daa KY |
9854 | return err; |
9855 | } else { | |
f12ab1e0 TI |
9856 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9857 | "Headphone Playback Switch", | |
9858 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
9859 | HDA_OUTPUT)); | |
9860 | if (err < 0) | |
df694daa KY |
9861 | return err; |
9862 | } | |
9863 | } | |
f12ab1e0 | 9864 | return 0; |
df694daa KY |
9865 | } |
9866 | ||
9867 | /* identical with ALC880 */ | |
f12ab1e0 TI |
9868 | #define alc262_auto_create_analog_input_ctls \ |
9869 | alc880_auto_create_analog_input_ctls | |
df694daa KY |
9870 | |
9871 | /* | |
9872 | * generic initialization of ADC, input mixers and output mixers | |
9873 | */ | |
9874 | static struct hda_verb alc262_volume_init_verbs[] = { | |
9875 | /* | |
9876 | * Unmute ADC0-2 and set the default input to mic-in | |
9877 | */ | |
9878 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9879 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9880 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9881 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9882 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9883 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9884 | ||
cb53c626 | 9885 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 9886 | * mixer widget |
f12ab1e0 TI |
9887 | * Note: PASD motherboards uses the Line In 2 as the input for |
9888 | * front panel mic (mic 2) | |
df694daa KY |
9889 | */ |
9890 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
9891 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
9892 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9893 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9894 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9895 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
9896 | |
9897 | /* | |
9898 | * Set up output mixers (0x0c - 0x0f) | |
9899 | */ | |
9900 | /* set vol=0 to output mixers */ | |
9901 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9902 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9903 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
ea1fb29a | 9904 | |
df694daa KY |
9905 | /* set up input amps for analog loopback */ |
9906 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
9907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9909 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9911 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9912 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9913 | ||
9914 | /* FIXME: use matrix-type input source selection */ | |
9915 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
9916 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
9917 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9919 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9921 | /* Input mixer2 */ | |
9922 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9923 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9924 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9925 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9926 | /* Input mixer3 */ | |
9927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9928 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9929 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9930 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9931 | ||
9932 | { } | |
9933 | }; | |
9934 | ||
9c7f852e TI |
9935 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
9936 | /* | |
9937 | * Unmute ADC0-2 and set the default input to mic-in | |
9938 | */ | |
9939 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9940 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9941 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9942 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9943 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9944 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9945 | ||
cb53c626 | 9946 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 9947 | * mixer widget |
f12ab1e0 TI |
9948 | * Note: PASD motherboards uses the Line In 2 as the input for |
9949 | * front panel mic (mic 2) | |
9c7f852e TI |
9950 | */ |
9951 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
9952 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
9953 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9954 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9955 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9956 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9957 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
9958 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
ea1fb29a | 9959 | |
9c7f852e TI |
9960 | /* |
9961 | * Set up output mixers (0x0c - 0x0e) | |
9962 | */ | |
9963 | /* set vol=0 to output mixers */ | |
9964 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9966 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9967 | ||
9968 | /* set up input amps for analog loopback */ | |
9969 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
9970 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9971 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9972 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9973 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9974 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9975 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9976 | ||
ce875f07 | 9977 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
9c7f852e TI |
9978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
9979 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
9980 | ||
9981 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9982 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
9983 | ||
9984 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9985 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9986 | ||
9987 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9988 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9989 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9990 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9991 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9992 | ||
9993 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
9994 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9995 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9996 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
9997 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9998 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
9999 | ||
10000 | ||
10001 | /* FIXME: use matrix-type input source selection */ | |
10002 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
10003 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
10004 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10005 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10006 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10007 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10008 | /* Input mixer2 */ | |
10009 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10010 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10011 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10012 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10013 | /* Input mixer3 */ | |
10014 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10015 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10016 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10017 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10018 | ||
ce875f07 TI |
10019 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
10020 | ||
9c7f852e TI |
10021 | { } |
10022 | }; | |
10023 | ||
cd7509a4 KY |
10024 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
10025 | /* | |
10026 | * Unmute ADC0-2 and set the default input to mic-in | |
10027 | */ | |
10028 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10029 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10030 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10031 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10032 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10033 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10034 | ||
cb53c626 | 10035 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
cd7509a4 KY |
10036 | * mixer widget |
10037 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
10038 | * panel mic (mic 2) | |
10039 | */ | |
10040 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
10041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
10042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
10044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
10045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
10046 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
10047 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
10048 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
cd7509a4 KY |
10049 | /* |
10050 | * Set up output mixers (0x0c - 0x0e) | |
10051 | */ | |
10052 | /* set vol=0 to output mixers */ | |
10053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10054 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10056 | ||
10057 | /* set up input amps for analog loopback */ | |
10058 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
10059 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10061 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10062 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10063 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10064 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10065 | ||
10066 | ||
10067 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
10068 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
10069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
10070 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
10071 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
10072 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
10073 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
10074 | ||
10075 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
10076 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
10077 | ||
10078 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10079 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
10080 | ||
10081 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
10082 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10083 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10084 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
10085 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10086 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10087 | ||
10088 | /* FIXME: use matrix-type input source selection */ | |
10089 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
10090 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
10091 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
10092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
10093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
10094 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
10095 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
10096 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
10097 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
10098 | /* Input mixer2 */ | |
10099 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10100 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
10101 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10102 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10103 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10104 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
10105 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
10106 | /* Input mixer3 */ | |
10107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
10109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10112 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
10113 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
10114 | ||
ce875f07 TI |
10115 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
10116 | ||
cd7509a4 KY |
10117 | { } |
10118 | }; | |
10119 | ||
9f99a638 HM |
10120 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
10121 | ||
10122 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | |
10123 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
10124 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
10125 | ||
10126 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | |
10127 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
10128 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
10129 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
10130 | ||
10131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | |
10132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10133 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
10134 | {} | |
10135 | }; | |
10136 | ||
10137 | ||
cb53c626 TI |
10138 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
10139 | #define alc262_loopbacks alc880_loopbacks | |
10140 | #endif | |
10141 | ||
df694daa KY |
10142 | /* pcm configuration: identiacal with ALC880 */ |
10143 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback | |
10144 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
10145 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
10146 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
10147 | ||
10148 | /* | |
10149 | * BIOS auto configuration | |
10150 | */ | |
10151 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
10152 | { | |
10153 | struct alc_spec *spec = codec->spec; | |
10154 | int err; | |
10155 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
10156 | ||
f12ab1e0 TI |
10157 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
10158 | alc262_ignore); | |
10159 | if (err < 0) | |
df694daa | 10160 | return err; |
f12ab1e0 | 10161 | if (!spec->autocfg.line_outs) |
df694daa | 10162 | return 0; /* can't find valid BIOS pin config */ |
f12ab1e0 TI |
10163 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
10164 | if (err < 0) | |
10165 | return err; | |
10166 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
10167 | if (err < 0) | |
df694daa KY |
10168 | return err; |
10169 | ||
10170 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
10171 | ||
10172 | if (spec->autocfg.dig_out_pin) | |
10173 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; | |
10174 | if (spec->autocfg.dig_in_pin) | |
10175 | spec->dig_in_nid = ALC262_DIGIN_NID; | |
10176 | ||
603c4019 | 10177 | if (spec->kctls.list) |
d88897ea | 10178 | add_mixer(spec, spec->kctls.list); |
df694daa | 10179 | |
d88897ea | 10180 | add_verb(spec, alc262_volume_init_verbs); |
a1e8d2da | 10181 | spec->num_mux_defs = 1; |
df694daa KY |
10182 | spec->input_mux = &spec->private_imux; |
10183 | ||
776e184e TI |
10184 | err = alc_auto_add_mic_boost(codec); |
10185 | if (err < 0) | |
10186 | return err; | |
10187 | ||
e044c39a | 10188 | store_pin_configs(codec); |
df694daa KY |
10189 | return 1; |
10190 | } | |
10191 | ||
10192 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
10193 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
10194 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
f511b01c | 10195 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
df694daa KY |
10196 | |
10197 | ||
10198 | /* init callback for auto-configuration model -- overriding the default init */ | |
ae6b813a | 10199 | static void alc262_auto_init(struct hda_codec *codec) |
df694daa | 10200 | { |
f6c7e546 | 10201 | struct alc_spec *spec = codec->spec; |
df694daa KY |
10202 | alc262_auto_init_multi_out(codec); |
10203 | alc262_auto_init_hp_out(codec); | |
10204 | alc262_auto_init_analog_input(codec); | |
f511b01c | 10205 | alc262_auto_init_input_src(codec); |
f6c7e546 | 10206 | if (spec->unsol_event) |
7fb0d78f | 10207 | alc_inithook(codec); |
df694daa KY |
10208 | } |
10209 | ||
10210 | /* | |
10211 | * configuration and preset | |
10212 | */ | |
f5fcc13c TI |
10213 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
10214 | [ALC262_BASIC] = "basic", | |
10215 | [ALC262_HIPPO] = "hippo", | |
10216 | [ALC262_HIPPO_1] = "hippo_1", | |
10217 | [ALC262_FUJITSU] = "fujitsu", | |
10218 | [ALC262_HP_BPC] = "hp-bpc", | |
cd7509a4 | 10219 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
61dc35de | 10220 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
8c427226 | 10221 | [ALC262_HP_RP5700] = "hp-rp5700", |
f5fcc13c | 10222 | [ALC262_BENQ_ED8] = "benq", |
0f40502e TI |
10223 | [ALC262_BENQ_T31] = "benq-t31", |
10224 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
2922c9af | 10225 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
9f99a638 | 10226 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
f651b50b | 10227 | [ALC262_ULTRA] = "ultra", |
0e31daf7 | 10228 | [ALC262_LENOVO_3000] = "lenovo-3000", |
e8f9ae2a | 10229 | [ALC262_NEC] = "nec", |
f5fcc13c TI |
10230 | [ALC262_AUTO] = "auto", |
10231 | }; | |
10232 | ||
10233 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
10234 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
e8f9ae2a | 10235 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
f5fcc13c | 10236 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
7d87de2d | 10237 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
ac3e3741 TI |
10238 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
10239 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), | |
7d87de2d | 10240 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
b98f9334 | 10241 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
b98f9334 | 10242 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
b98f9334 | 10243 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
cd7509a4 | 10244 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 10245 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 10246 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 10247 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 10248 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 10249 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 10250 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 10251 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 TI |
10252 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
10253 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
10254 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
66d2a9d6 KY |
10255 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
10256 | ALC262_HP_TC_T5735), | |
8c427226 | 10257 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
ac3e3741 | 10258 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
f5fcc13c | 10259 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
5b31954e | 10260 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
272a527c | 10261 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
ac3e3741 | 10262 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
36ca6e13 | 10263 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
9f99a638 | 10264 | ALC262_TOSHIBA_RX1), |
80ffe869 | 10265 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
ac3e3741 | 10266 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
3f1eeaed | 10267 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
f651b50b | 10268 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
bb9f76cd | 10269 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
0e31daf7 | 10270 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
ac3e3741 TI |
10271 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
10272 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
10273 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
df694daa KY |
10274 | {} |
10275 | }; | |
10276 | ||
10277 | static struct alc_config_preset alc262_presets[] = { | |
10278 | [ALC262_BASIC] = { | |
10279 | .mixers = { alc262_base_mixer }, | |
10280 | .init_verbs = { alc262_init_verbs }, | |
10281 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10282 | .dac_nids = alc262_dac_nids, | |
10283 | .hp_nid = 0x03, | |
10284 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10285 | .channel_mode = alc262_modes, | |
a3bcba38 | 10286 | .input_mux = &alc262_capture_source, |
df694daa | 10287 | }, |
ccc656ce KY |
10288 | [ALC262_HIPPO] = { |
10289 | .mixers = { alc262_base_mixer }, | |
10290 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, | |
10291 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10292 | .dac_nids = alc262_dac_nids, | |
10293 | .hp_nid = 0x03, | |
10294 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10295 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10296 | .channel_mode = alc262_modes, | |
10297 | .input_mux = &alc262_capture_source, | |
10298 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 10299 | .init_hook = alc262_hippo_automute, |
ccc656ce KY |
10300 | }, |
10301 | [ALC262_HIPPO_1] = { | |
10302 | .mixers = { alc262_hippo1_mixer }, | |
10303 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
10304 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10305 | .dac_nids = alc262_dac_nids, | |
10306 | .hp_nid = 0x02, | |
10307 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10308 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10309 | .channel_mode = alc262_modes, | |
10310 | .input_mux = &alc262_capture_source, | |
10311 | .unsol_event = alc262_hippo1_unsol_event, | |
5b31954e | 10312 | .init_hook = alc262_hippo1_automute, |
ccc656ce | 10313 | }, |
834be88d TI |
10314 | [ALC262_FUJITSU] = { |
10315 | .mixers = { alc262_fujitsu_mixer }, | |
39d3ed38 TI |
10316 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
10317 | alc262_fujitsu_unsol_verbs }, | |
834be88d TI |
10318 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
10319 | .dac_nids = alc262_dac_nids, | |
10320 | .hp_nid = 0x03, | |
10321 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10322 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10323 | .channel_mode = alc262_modes, | |
10324 | .input_mux = &alc262_fujitsu_capture_source, | |
ae6b813a | 10325 | .unsol_event = alc262_fujitsu_unsol_event, |
ebc7a406 | 10326 | .init_hook = alc262_fujitsu_init_hook, |
834be88d | 10327 | }, |
9c7f852e TI |
10328 | [ALC262_HP_BPC] = { |
10329 | .mixers = { alc262_HP_BPC_mixer }, | |
10330 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
10331 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10332 | .dac_nids = alc262_dac_nids, | |
10333 | .hp_nid = 0x03, | |
10334 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10335 | .channel_mode = alc262_modes, | |
10336 | .input_mux = &alc262_HP_capture_source, | |
ce875f07 TI |
10337 | .unsol_event = alc262_hp_bpc_unsol_event, |
10338 | .init_hook = alc262_hp_bpc_automute, | |
f12ab1e0 | 10339 | }, |
cd7509a4 KY |
10340 | [ALC262_HP_BPC_D7000_WF] = { |
10341 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
10342 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
10343 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10344 | .dac_nids = alc262_dac_nids, | |
10345 | .hp_nid = 0x03, | |
10346 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10347 | .channel_mode = alc262_modes, | |
accbe498 | 10348 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
10349 | .unsol_event = alc262_hp_wildwest_unsol_event, |
10350 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 10351 | }, |
cd7509a4 KY |
10352 | [ALC262_HP_BPC_D7000_WL] = { |
10353 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
10354 | alc262_HP_BPC_WildWest_option_mixer }, | |
10355 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
10356 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10357 | .dac_nids = alc262_dac_nids, | |
10358 | .hp_nid = 0x03, | |
10359 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10360 | .channel_mode = alc262_modes, | |
accbe498 | 10361 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
10362 | .unsol_event = alc262_hp_wildwest_unsol_event, |
10363 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 10364 | }, |
66d2a9d6 KY |
10365 | [ALC262_HP_TC_T5735] = { |
10366 | .mixers = { alc262_hp_t5735_mixer }, | |
10367 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
10368 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10369 | .dac_nids = alc262_dac_nids, | |
10370 | .hp_nid = 0x03, | |
10371 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10372 | .channel_mode = alc262_modes, | |
10373 | .input_mux = &alc262_capture_source, | |
10374 | .unsol_event = alc262_hp_t5735_unsol_event, | |
10375 | .init_hook = alc262_hp_t5735_init_hook, | |
8c427226 KY |
10376 | }, |
10377 | [ALC262_HP_RP5700] = { | |
10378 | .mixers = { alc262_hp_rp5700_mixer }, | |
10379 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
10380 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10381 | .dac_nids = alc262_dac_nids, | |
10382 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10383 | .channel_mode = alc262_modes, | |
10384 | .input_mux = &alc262_hp_rp5700_capture_source, | |
66d2a9d6 | 10385 | }, |
304dcaac TI |
10386 | [ALC262_BENQ_ED8] = { |
10387 | .mixers = { alc262_base_mixer }, | |
10388 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
10389 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10390 | .dac_nids = alc262_dac_nids, | |
10391 | .hp_nid = 0x03, | |
10392 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10393 | .channel_mode = alc262_modes, | |
10394 | .input_mux = &alc262_capture_source, | |
f12ab1e0 | 10395 | }, |
272a527c KY |
10396 | [ALC262_SONY_ASSAMD] = { |
10397 | .mixers = { alc262_sony_mixer }, | |
10398 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
10399 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10400 | .dac_nids = alc262_dac_nids, | |
10401 | .hp_nid = 0x02, | |
10402 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10403 | .channel_mode = alc262_modes, | |
10404 | .input_mux = &alc262_capture_source, | |
10405 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 10406 | .init_hook = alc262_hippo_automute, |
83c34218 KY |
10407 | }, |
10408 | [ALC262_BENQ_T31] = { | |
10409 | .mixers = { alc262_benq_t31_mixer }, | |
10410 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, | |
10411 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10412 | .dac_nids = alc262_dac_nids, | |
10413 | .hp_nid = 0x03, | |
10414 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10415 | .channel_mode = alc262_modes, | |
10416 | .input_mux = &alc262_capture_source, | |
10417 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 10418 | .init_hook = alc262_hippo_automute, |
ea1fb29a | 10419 | }, |
f651b50b | 10420 | [ALC262_ULTRA] = { |
f9e336f6 TI |
10421 | .mixers = { alc262_ultra_mixer }, |
10422 | .cap_mixer = alc262_ultra_capture_mixer, | |
bb9f76cd | 10423 | .init_verbs = { alc262_ultra_verbs }, |
f651b50b TD |
10424 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
10425 | .dac_nids = alc262_dac_nids, | |
f651b50b TD |
10426 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
10427 | .channel_mode = alc262_modes, | |
10428 | .input_mux = &alc262_ultra_capture_source, | |
bb9f76cd TI |
10429 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
10430 | .capsrc_nids = alc262_capsrc_nids, | |
10431 | .num_adc_nids = 1, /* single ADC */ | |
f651b50b TD |
10432 | .unsol_event = alc262_ultra_unsol_event, |
10433 | .init_hook = alc262_ultra_automute, | |
10434 | }, | |
0e31daf7 J |
10435 | [ALC262_LENOVO_3000] = { |
10436 | .mixers = { alc262_lenovo_3000_mixer }, | |
10437 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
10438 | alc262_lenovo_3000_unsol_verbs }, | |
10439 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10440 | .dac_nids = alc262_dac_nids, | |
10441 | .hp_nid = 0x03, | |
10442 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10443 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10444 | .channel_mode = alc262_modes, | |
10445 | .input_mux = &alc262_fujitsu_capture_source, | |
10446 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
10447 | }, | |
e8f9ae2a PT |
10448 | [ALC262_NEC] = { |
10449 | .mixers = { alc262_nec_mixer }, | |
10450 | .init_verbs = { alc262_nec_verbs }, | |
10451 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10452 | .dac_nids = alc262_dac_nids, | |
10453 | .hp_nid = 0x03, | |
10454 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10455 | .channel_mode = alc262_modes, | |
10456 | .input_mux = &alc262_capture_source, | |
10457 | }, | |
4e555fe5 KY |
10458 | [ALC262_TOSHIBA_S06] = { |
10459 | .mixers = { alc262_toshiba_s06_mixer }, | |
10460 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | |
10461 | alc262_eapd_verbs }, | |
10462 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10463 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
10464 | .dac_nids = alc262_dac_nids, | |
10465 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | |
10466 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10467 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10468 | .channel_mode = alc262_modes, | |
10469 | .input_mux = &alc262_dmic_capture_source, | |
10470 | .unsol_event = alc262_toshiba_s06_unsol_event, | |
10471 | .init_hook = alc262_toshiba_s06_init_hook, | |
10472 | }, | |
9f99a638 HM |
10473 | [ALC262_TOSHIBA_RX1] = { |
10474 | .mixers = { alc262_toshiba_rx1_mixer }, | |
10475 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | |
10476 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10477 | .dac_nids = alc262_dac_nids, | |
10478 | .hp_nid = 0x03, | |
10479 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10480 | .channel_mode = alc262_modes, | |
10481 | .input_mux = &alc262_capture_source, | |
10482 | .unsol_event = alc262_hippo_unsol_event, | |
10483 | .init_hook = alc262_hippo_automute, | |
10484 | }, | |
df694daa KY |
10485 | }; |
10486 | ||
10487 | static int patch_alc262(struct hda_codec *codec) | |
10488 | { | |
10489 | struct alc_spec *spec; | |
10490 | int board_config; | |
10491 | int err; | |
10492 | ||
dc041e0b | 10493 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
10494 | if (spec == NULL) |
10495 | return -ENOMEM; | |
10496 | ||
10497 | codec->spec = spec; | |
10498 | #if 0 | |
f12ab1e0 TI |
10499 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
10500 | * under-run | |
10501 | */ | |
df694daa KY |
10502 | { |
10503 | int tmp; | |
10504 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
10505 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
10506 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
10507 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
10508 | } | |
10509 | #endif | |
10510 | ||
2c3bf9ab TI |
10511 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
10512 | ||
f5fcc13c TI |
10513 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
10514 | alc262_models, | |
10515 | alc262_cfg_tbl); | |
cd7509a4 | 10516 | |
f5fcc13c | 10517 | if (board_config < 0) { |
9c7f852e TI |
10518 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
10519 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
10520 | board_config = ALC262_AUTO; |
10521 | } | |
10522 | ||
10523 | if (board_config == ALC262_AUTO) { | |
10524 | /* automatic parse from the BIOS config */ | |
10525 | err = alc262_parse_auto_config(codec); | |
10526 | if (err < 0) { | |
10527 | alc_free(codec); | |
10528 | return err; | |
f12ab1e0 | 10529 | } else if (!err) { |
9c7f852e TI |
10530 | printk(KERN_INFO |
10531 | "hda_codec: Cannot set up configuration " | |
10532 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
10533 | board_config = ALC262_BASIC; |
10534 | } | |
10535 | } | |
10536 | ||
10537 | if (board_config != ALC262_AUTO) | |
10538 | setup_preset(spec, &alc262_presets[board_config]); | |
10539 | ||
10540 | spec->stream_name_analog = "ALC262 Analog"; | |
10541 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | |
10542 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
ea1fb29a | 10543 | |
df694daa KY |
10544 | spec->stream_name_digital = "ALC262 Digital"; |
10545 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | |
10546 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
10547 | ||
54cbc9ab | 10548 | spec->is_mix_capture = 1; |
f12ab1e0 | 10549 | if (!spec->adc_nids && spec->input_mux) { |
df694daa | 10550 | /* check whether NID 0x07 is valid */ |
4a471b7d TI |
10551 | unsigned int wcap = get_wcaps(codec, 0x07); |
10552 | ||
f12ab1e0 TI |
10553 | /* get type */ |
10554 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
df694daa KY |
10555 | if (wcap != AC_WID_AUD_IN) { |
10556 | spec->adc_nids = alc262_adc_nids_alt; | |
10557 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); | |
88c71a99 | 10558 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
df694daa KY |
10559 | } else { |
10560 | spec->adc_nids = alc262_adc_nids; | |
10561 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); | |
88c71a99 | 10562 | spec->capsrc_nids = alc262_capsrc_nids; |
df694daa KY |
10563 | } |
10564 | } | |
f9e336f6 TI |
10565 | if (!spec->cap_mixer) |
10566 | set_capture_mixer(spec); | |
df694daa | 10567 | |
2134ea4f TI |
10568 | spec->vmaster_nid = 0x0c; |
10569 | ||
df694daa KY |
10570 | codec->patch_ops = alc_patch_ops; |
10571 | if (board_config == ALC262_AUTO) | |
ae6b813a | 10572 | spec->init_hook = alc262_auto_init; |
cb53c626 TI |
10573 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
10574 | if (!spec->loopback.amplist) | |
10575 | spec->loopback.amplist = alc262_loopbacks; | |
10576 | #endif | |
ea1fb29a | 10577 | |
df694daa KY |
10578 | return 0; |
10579 | } | |
10580 | ||
a361d84b KY |
10581 | /* |
10582 | * ALC268 channel source setting (2 channel) | |
10583 | */ | |
10584 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
10585 | #define alc268_modes alc260_modes | |
ea1fb29a | 10586 | |
a361d84b KY |
10587 | static hda_nid_t alc268_dac_nids[2] = { |
10588 | /* front, hp */ | |
10589 | 0x02, 0x03 | |
10590 | }; | |
10591 | ||
10592 | static hda_nid_t alc268_adc_nids[2] = { | |
10593 | /* ADC0-1 */ | |
10594 | 0x08, 0x07 | |
10595 | }; | |
10596 | ||
10597 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
10598 | /* ADC0 */ | |
10599 | 0x08 | |
10600 | }; | |
10601 | ||
e1406348 TI |
10602 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
10603 | ||
a361d84b KY |
10604 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
10605 | /* output mixer control */ | |
10606 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
10607 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10608 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
10609 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
33bf17ab TI |
10610 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
10611 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10612 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
a361d84b KY |
10613 | { } |
10614 | }; | |
10615 | ||
aef9d318 TI |
10616 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
10617 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
10618 | .ops = &snd_hda_bind_sw, | |
10619 | .values = { | |
10620 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
10621 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
10622 | 0 | |
10623 | }, | |
10624 | }; | |
10625 | ||
10626 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
10627 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
10628 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
10629 | { } | |
10630 | }; | |
10631 | ||
d1a991a6 KY |
10632 | static struct hda_verb alc268_eapd_verbs[] = { |
10633 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
10634 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
10635 | { } | |
10636 | }; | |
10637 | ||
d273809e TI |
10638 | /* Toshiba specific */ |
10639 | #define alc268_toshiba_automute alc262_hippo_automute | |
10640 | ||
10641 | static struct hda_verb alc268_toshiba_verbs[] = { | |
10642 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10643 | { } /* end */ | |
10644 | }; | |
10645 | ||
8ef355da KY |
10646 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
10647 | .num_items = 2, | |
10648 | .items = { | |
10649 | { "i-Mic", 0x6 }, | |
10650 | { "E-Mic", 0x0 }, | |
10651 | }, | |
10652 | }; | |
10653 | ||
d273809e | 10654 | /* Acer specific */ |
889c4395 | 10655 | /* bind volumes of both NID 0x02 and 0x03 */ |
6bc96857 TI |
10656 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
10657 | .ops = &snd_hda_bind_vol, | |
10658 | .values = { | |
10659 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
10660 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
10661 | 0 | |
10662 | }, | |
10663 | }; | |
10664 | ||
889c4395 TI |
10665 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
10666 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
10667 | { | |
10668 | struct alc_spec *spec = codec->spec; | |
10669 | unsigned int mute; | |
10670 | ||
10671 | if (force || !spec->sense_updated) { | |
10672 | unsigned int present; | |
10673 | present = snd_hda_codec_read(codec, 0x14, 0, | |
10674 | AC_VERB_GET_PIN_SENSE, 0); | |
10675 | spec->jack_present = (present & 0x80000000) != 0; | |
10676 | spec->sense_updated = 1; | |
10677 | } | |
10678 | if (spec->jack_present) | |
10679 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
10680 | else /* unmute internal speaker if necessary */ | |
10681 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
10682 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
10683 | HDA_AMP_MUTE, mute); | |
10684 | } | |
10685 | ||
10686 | ||
10687 | /* bind hp and internal speaker mute (with plug check) */ | |
10688 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
10689 | struct snd_ctl_elem_value *ucontrol) | |
10690 | { | |
10691 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10692 | long *valp = ucontrol->value.integer.value; | |
10693 | int change; | |
10694 | ||
10695 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
10696 | HDA_AMP_MUTE, | |
10697 | valp[0] ? 0 : HDA_AMP_MUTE); | |
10698 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
10699 | HDA_AMP_MUTE, | |
10700 | valp[1] ? 0 : HDA_AMP_MUTE); | |
10701 | if (change) | |
10702 | alc268_acer_automute(codec, 0); | |
10703 | return change; | |
10704 | } | |
d273809e | 10705 | |
8ef355da KY |
10706 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
10707 | /* output mixer control */ | |
10708 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
10709 | { | |
10710 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10711 | .name = "Master Playback Switch", | |
10712 | .info = snd_hda_mixer_amp_switch_info, | |
10713 | .get = snd_hda_mixer_amp_switch_get, | |
10714 | .put = alc268_acer_master_sw_put, | |
10715 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
10716 | }, | |
10717 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | |
10718 | { } | |
10719 | }; | |
10720 | ||
d273809e TI |
10721 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
10722 | /* output mixer control */ | |
10723 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
10724 | { | |
10725 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10726 | .name = "Master Playback Switch", | |
10727 | .info = snd_hda_mixer_amp_switch_info, | |
10728 | .get = snd_hda_mixer_amp_switch_get, | |
10729 | .put = alc268_acer_master_sw_put, | |
10730 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
10731 | }, | |
33bf17ab TI |
10732 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
10733 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
10734 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
d273809e TI |
10735 | { } |
10736 | }; | |
10737 | ||
c238b4f4 TI |
10738 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
10739 | /* output mixer control */ | |
10740 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
10741 | { | |
10742 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10743 | .name = "Master Playback Switch", | |
10744 | .info = snd_hda_mixer_amp_switch_info, | |
10745 | .get = snd_hda_mixer_amp_switch_get, | |
10746 | .put = alc268_acer_master_sw_put, | |
10747 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
10748 | }, | |
10749 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10750 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
10751 | { } | |
10752 | }; | |
10753 | ||
8ef355da KY |
10754 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
10755 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
10756 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10757 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10758 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
10759 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
10760 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | |
10761 | { } | |
10762 | }; | |
10763 | ||
d273809e | 10764 | static struct hda_verb alc268_acer_verbs[] = { |
0ccb541c TI |
10765 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
10766 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d273809e TI |
10767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
10768 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
0ccb541c TI |
10769 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
10770 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
d273809e TI |
10771 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
10772 | { } | |
10773 | }; | |
10774 | ||
10775 | /* unsolicited event for HP jack sensing */ | |
10776 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, | |
10777 | unsigned int res) | |
10778 | { | |
889c4395 | 10779 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
10780 | return; |
10781 | alc268_toshiba_automute(codec); | |
10782 | } | |
10783 | ||
10784 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
10785 | unsigned int res) | |
10786 | { | |
889c4395 | 10787 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
10788 | return; |
10789 | alc268_acer_automute(codec, 1); | |
10790 | } | |
10791 | ||
889c4395 TI |
10792 | static void alc268_acer_init_hook(struct hda_codec *codec) |
10793 | { | |
10794 | alc268_acer_automute(codec, 1); | |
10795 | } | |
10796 | ||
8ef355da KY |
10797 | /* toggle speaker-output according to the hp-jack state */ |
10798 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |
10799 | { | |
10800 | unsigned int present; | |
10801 | unsigned char bits; | |
10802 | ||
10803 | present = snd_hda_codec_read(codec, 0x15, 0, | |
10804 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
10805 | bits = present ? AMP_IN_MUTE(0) : 0; | |
10806 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | |
10807 | AMP_IN_MUTE(0), bits); | |
10808 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | |
10809 | AMP_IN_MUTE(0), bits); | |
10810 | } | |
10811 | ||
10812 | ||
10813 | static void alc268_acer_mic_automute(struct hda_codec *codec) | |
10814 | { | |
10815 | unsigned int present; | |
10816 | ||
10817 | present = snd_hda_codec_read(codec, 0x18, 0, | |
10818 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
10819 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | |
10820 | present ? 0x0 : 0x6); | |
10821 | } | |
10822 | ||
10823 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | |
10824 | unsigned int res) | |
10825 | { | |
10826 | if ((res >> 26) == ALC880_HP_EVENT) | |
10827 | alc268_aspire_one_speaker_automute(codec); | |
10828 | if ((res >> 26) == ALC880_MIC_EVENT) | |
10829 | alc268_acer_mic_automute(codec); | |
10830 | } | |
10831 | ||
10832 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | |
10833 | { | |
10834 | alc268_aspire_one_speaker_automute(codec); | |
10835 | alc268_acer_mic_automute(codec); | |
10836 | } | |
10837 | ||
3866f0b0 TI |
10838 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
10839 | /* output mixer control */ | |
10840 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
10841 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10842 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
10843 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10844 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10845 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
10846 | { } | |
10847 | }; | |
10848 | ||
10849 | static struct hda_verb alc268_dell_verbs[] = { | |
10850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10851 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10852 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10853 | { } | |
10854 | }; | |
10855 | ||
10856 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
10857 | static void alc268_dell_automute(struct hda_codec *codec) | |
10858 | { | |
10859 | unsigned int present; | |
10860 | unsigned int mute; | |
10861 | ||
10862 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); | |
10863 | if (present & 0x80000000) | |
10864 | mute = HDA_AMP_MUTE; | |
10865 | else | |
10866 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); | |
10867 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
10868 | HDA_AMP_MUTE, mute); | |
10869 | } | |
10870 | ||
10871 | static void alc268_dell_unsol_event(struct hda_codec *codec, | |
10872 | unsigned int res) | |
10873 | { | |
10874 | if ((res >> 26) != ALC880_HP_EVENT) | |
10875 | return; | |
10876 | alc268_dell_automute(codec); | |
10877 | } | |
10878 | ||
10879 | #define alc268_dell_init_hook alc268_dell_automute | |
10880 | ||
eb5a6621 HRK |
10881 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
10882 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
10883 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10884 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
10885 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10886 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
10887 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
10888 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
10889 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
10890 | { } | |
10891 | }; | |
10892 | ||
10893 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
10894 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10895 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
10896 | { } | |
10897 | }; | |
10898 | ||
10899 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) | |
10900 | { | |
10901 | unsigned int present; | |
10902 | ||
10903 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) | |
10904 | & AC_PINSENSE_PRESENCE; | |
10905 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
10906 | present ? 0 : PIN_OUT); | |
10907 | } | |
10908 | ||
10909 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) | |
10910 | { | |
10911 | unsigned int present; | |
10912 | ||
10913 | present = snd_hda_codec_read(codec, 0x18, 0, | |
10914 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
10915 | snd_hda_codec_write(codec, 0x23, 0, | |
10916 | AC_VERB_SET_CONNECT_SEL, | |
10917 | present ? 0x00 : 0x01); | |
10918 | } | |
10919 | ||
10920 | static void alc267_quanta_il1_automute(struct hda_codec *codec) | |
10921 | { | |
10922 | alc267_quanta_il1_hp_automute(codec); | |
10923 | alc267_quanta_il1_mic_automute(codec); | |
10924 | } | |
10925 | ||
10926 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, | |
10927 | unsigned int res) | |
10928 | { | |
10929 | switch (res >> 26) { | |
10930 | case ALC880_HP_EVENT: | |
10931 | alc267_quanta_il1_hp_automute(codec); | |
10932 | break; | |
10933 | case ALC880_MIC_EVENT: | |
10934 | alc267_quanta_il1_mic_automute(codec); | |
10935 | break; | |
10936 | } | |
10937 | } | |
10938 | ||
a361d84b KY |
10939 | /* |
10940 | * generic initialization of ADC, input mixers and output mixers | |
10941 | */ | |
10942 | static struct hda_verb alc268_base_init_verbs[] = { | |
10943 | /* Unmute DAC0-1 and set vol = 0 */ | |
10944 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10945 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10946 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10947 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10948 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10949 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10950 | ||
10951 | /* | |
10952 | * Set up output mixers (0x0c - 0x0e) | |
10953 | */ | |
10954 | /* set vol=0 to output mixers */ | |
10955 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10956 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10957 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10958 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10959 | ||
10960 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10961 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10962 | ||
10963 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
10964 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
10965 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
10966 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10967 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10968 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10969 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10970 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10971 | ||
10972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10974 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10975 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10976 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10977 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
10978 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
aef9d318 TI |
10979 | |
10980 | /* set PCBEEP vol = 0, mute connections */ | |
10981 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10982 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10983 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b | 10984 | |
a9b3aa8a | 10985 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
ea1fb29a | 10986 | |
a9b3aa8a JZ |
10987 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
10988 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
10989 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
a361d84b | 10991 | |
a361d84b KY |
10992 | { } |
10993 | }; | |
10994 | ||
10995 | /* | |
10996 | * generic initialization of ADC, input mixers and output mixers | |
10997 | */ | |
10998 | static struct hda_verb alc268_volume_init_verbs[] = { | |
10999 | /* set output DAC */ | |
11000 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11001 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11002 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11003 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11004 | ||
11005 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11006 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11007 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11008 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11009 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11010 | ||
11011 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11012 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11013 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11014 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11015 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11016 | ||
11017 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11018 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11019 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11020 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11021 | ||
aef9d318 TI |
11022 | /* set PCBEEP vol = 0, mute connections */ |
11023 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11024 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11025 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b KY |
11026 | |
11027 | { } | |
11028 | }; | |
11029 | ||
a361d84b KY |
11030 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
11031 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
11032 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
11033 | { | |
11034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11035 | /* The multiple "Capture Source" controls confuse alsamixer | |
11036 | * So call somewhat different.. | |
a361d84b KY |
11037 | */ |
11038 | /* .name = "Capture Source", */ | |
11039 | .name = "Input Source", | |
11040 | .count = 1, | |
54cbc9ab TI |
11041 | .info = alc_mux_enum_info, |
11042 | .get = alc_mux_enum_get, | |
11043 | .put = alc_mux_enum_put, | |
a361d84b KY |
11044 | }, |
11045 | { } /* end */ | |
11046 | }; | |
11047 | ||
11048 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
11049 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
11050 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
11051 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
11052 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
11053 | { | |
11054 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11055 | /* The multiple "Capture Source" controls confuse alsamixer | |
11056 | * So call somewhat different.. | |
a361d84b KY |
11057 | */ |
11058 | /* .name = "Capture Source", */ | |
11059 | .name = "Input Source", | |
11060 | .count = 2, | |
54cbc9ab TI |
11061 | .info = alc_mux_enum_info, |
11062 | .get = alc_mux_enum_get, | |
11063 | .put = alc_mux_enum_put, | |
a361d84b KY |
11064 | }, |
11065 | { } /* end */ | |
11066 | }; | |
11067 | ||
11068 | static struct hda_input_mux alc268_capture_source = { | |
11069 | .num_items = 4, | |
11070 | .items = { | |
11071 | { "Mic", 0x0 }, | |
11072 | { "Front Mic", 0x1 }, | |
11073 | { "Line", 0x2 }, | |
11074 | { "CD", 0x3 }, | |
11075 | }, | |
11076 | }; | |
11077 | ||
0ccb541c | 11078 | static struct hda_input_mux alc268_acer_capture_source = { |
c238b4f4 TI |
11079 | .num_items = 3, |
11080 | .items = { | |
11081 | { "Mic", 0x0 }, | |
11082 | { "Internal Mic", 0x1 }, | |
11083 | { "Line", 0x2 }, | |
11084 | }, | |
11085 | }; | |
11086 | ||
11087 | static struct hda_input_mux alc268_acer_dmic_capture_source = { | |
0ccb541c TI |
11088 | .num_items = 3, |
11089 | .items = { | |
11090 | { "Mic", 0x0 }, | |
11091 | { "Internal Mic", 0x6 }, | |
11092 | { "Line", 0x2 }, | |
11093 | }, | |
11094 | }; | |
11095 | ||
86c53bd2 JW |
11096 | #ifdef CONFIG_SND_DEBUG |
11097 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
86c53bd2 JW |
11098 | /* Volume widgets */ |
11099 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
11100 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
11101 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
11102 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
11103 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
11104 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
11105 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
11106 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
11107 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
11108 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
11109 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
11110 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
11111 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
f0747ee6 TI |
11112 | /* The below appears problematic on some hardwares */ |
11113 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
86c53bd2 JW |
11114 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
11115 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
11116 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
11117 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
11118 | ||
11119 | /* Modes for retasking pin widgets */ | |
11120 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
11121 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
11122 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
11123 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
11124 | ||
11125 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
11126 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
11127 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
11128 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
11129 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
11130 | ||
11131 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
11132 | * The ALC268 does not have an SPDIF input. | |
11133 | */ | |
11134 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
11135 | ||
11136 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
11137 | * this output to turn on an external amplifier. | |
11138 | */ | |
11139 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
11140 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
11141 | ||
11142 | { } /* end */ | |
11143 | }; | |
11144 | #endif | |
11145 | ||
a361d84b KY |
11146 | /* create input playback/capture controls for the given pin */ |
11147 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
11148 | const char *ctlname, int idx) | |
11149 | { | |
11150 | char name[32]; | |
11151 | int err; | |
11152 | ||
11153 | sprintf(name, "%s Playback Volume", ctlname); | |
11154 | if (nid == 0x14) { | |
11155 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
11156 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, | |
11157 | HDA_OUTPUT)); | |
11158 | if (err < 0) | |
11159 | return err; | |
11160 | } else if (nid == 0x15) { | |
11161 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
11162 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, | |
11163 | HDA_OUTPUT)); | |
11164 | if (err < 0) | |
11165 | return err; | |
11166 | } else | |
11167 | return -1; | |
11168 | sprintf(name, "%s Playback Switch", ctlname); | |
11169 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
11170 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
11171 | if (err < 0) | |
11172 | return err; | |
11173 | return 0; | |
11174 | } | |
11175 | ||
11176 | /* add playback controls from the parsed DAC table */ | |
11177 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
11178 | const struct auto_pin_cfg *cfg) | |
11179 | { | |
11180 | hda_nid_t nid; | |
11181 | int err; | |
11182 | ||
11183 | spec->multiout.num_dacs = 2; /* only use one dac */ | |
11184 | spec->multiout.dac_nids = spec->private_dac_nids; | |
11185 | spec->multiout.dac_nids[0] = 2; | |
11186 | spec->multiout.dac_nids[1] = 3; | |
11187 | ||
11188 | nid = cfg->line_out_pins[0]; | |
11189 | if (nid) | |
ea1fb29a | 11190 | alc268_new_analog_output(spec, nid, "Front", 0); |
a361d84b KY |
11191 | |
11192 | nid = cfg->speaker_pins[0]; | |
11193 | if (nid == 0x1d) { | |
11194 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
11195 | "Speaker Playback Volume", | |
11196 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
11197 | if (err < 0) | |
11198 | return err; | |
11199 | } | |
11200 | nid = cfg->hp_pins[0]; | |
11201 | if (nid) | |
11202 | alc268_new_analog_output(spec, nid, "Headphone", 0); | |
11203 | ||
11204 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
11205 | if (nid == 0x16) { | |
11206 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
11207 | "Mono Playback Switch", | |
11208 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); | |
11209 | if (err < 0) | |
11210 | return err; | |
11211 | } | |
ea1fb29a | 11212 | return 0; |
a361d84b KY |
11213 | } |
11214 | ||
11215 | /* create playback/capture controls for input pins */ | |
11216 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | |
11217 | const struct auto_pin_cfg *cfg) | |
11218 | { | |
11219 | struct hda_input_mux *imux = &spec->private_imux; | |
11220 | int i, idx1; | |
11221 | ||
11222 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
11223 | switch(cfg->input_pins[i]) { | |
11224 | case 0x18: | |
11225 | idx1 = 0; /* Mic 1 */ | |
11226 | break; | |
11227 | case 0x19: | |
11228 | idx1 = 1; /* Mic 2 */ | |
11229 | break; | |
11230 | case 0x1a: | |
11231 | idx1 = 2; /* Line In */ | |
11232 | break; | |
ea1fb29a | 11233 | case 0x1c: |
a361d84b KY |
11234 | idx1 = 3; /* CD */ |
11235 | break; | |
7194cae6 TI |
11236 | case 0x12: |
11237 | case 0x13: | |
11238 | idx1 = 6; /* digital mics */ | |
11239 | break; | |
a361d84b KY |
11240 | default: |
11241 | continue; | |
11242 | } | |
11243 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | |
11244 | imux->items[imux->num_items].index = idx1; | |
ea1fb29a | 11245 | imux->num_items++; |
a361d84b KY |
11246 | } |
11247 | return 0; | |
11248 | } | |
11249 | ||
11250 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |
11251 | { | |
11252 | struct alc_spec *spec = codec->spec; | |
11253 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
11254 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11255 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
11256 | unsigned int dac_vol1, dac_vol2; | |
11257 | ||
11258 | if (speaker_nid) { | |
11259 | snd_hda_codec_write(codec, speaker_nid, 0, | |
11260 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
11261 | snd_hda_codec_write(codec, 0x0f, 0, | |
11262 | AC_VERB_SET_AMP_GAIN_MUTE, | |
11263 | AMP_IN_UNMUTE(1)); | |
11264 | snd_hda_codec_write(codec, 0x10, 0, | |
11265 | AC_VERB_SET_AMP_GAIN_MUTE, | |
11266 | AMP_IN_UNMUTE(1)); | |
11267 | } else { | |
11268 | snd_hda_codec_write(codec, 0x0f, 0, | |
11269 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
11270 | snd_hda_codec_write(codec, 0x10, 0, | |
11271 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
11272 | } | |
11273 | ||
11274 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
ea1fb29a | 11275 | if (line_nid == 0x14) |
a361d84b KY |
11276 | dac_vol2 = AMP_OUT_ZERO; |
11277 | else if (line_nid == 0x15) | |
11278 | dac_vol1 = AMP_OUT_ZERO; | |
ea1fb29a | 11279 | if (hp_nid == 0x14) |
a361d84b KY |
11280 | dac_vol2 = AMP_OUT_ZERO; |
11281 | else if (hp_nid == 0x15) | |
11282 | dac_vol1 = AMP_OUT_ZERO; | |
11283 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
11284 | spec->autocfg.line_out_pins[1] != 0x16 || | |
11285 | spec->autocfg.line_out_pins[2] != 0x16) | |
11286 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
11287 | ||
11288 | snd_hda_codec_write(codec, 0x02, 0, | |
11289 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
11290 | snd_hda_codec_write(codec, 0x03, 0, | |
11291 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
11292 | } | |
11293 | ||
11294 | /* pcm configuration: identiacal with ALC880 */ | |
11295 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback | |
11296 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 11297 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
a361d84b KY |
11298 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
11299 | ||
11300 | /* | |
11301 | * BIOS auto configuration | |
11302 | */ | |
11303 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
11304 | { | |
11305 | struct alc_spec *spec = codec->spec; | |
11306 | int err; | |
11307 | static hda_nid_t alc268_ignore[] = { 0 }; | |
11308 | ||
11309 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
11310 | alc268_ignore); | |
11311 | if (err < 0) | |
11312 | return err; | |
11313 | if (!spec->autocfg.line_outs) | |
11314 | return 0; /* can't find valid BIOS pin config */ | |
11315 | ||
11316 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
11317 | if (err < 0) | |
11318 | return err; | |
11319 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
11320 | if (err < 0) | |
11321 | return err; | |
11322 | ||
11323 | spec->multiout.max_channels = 2; | |
11324 | ||
11325 | /* digital only support output */ | |
11326 | if (spec->autocfg.dig_out_pin) | |
11327 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; | |
11328 | ||
603c4019 | 11329 | if (spec->kctls.list) |
d88897ea | 11330 | add_mixer(spec, spec->kctls.list); |
a361d84b | 11331 | |
aef9d318 | 11332 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
d88897ea | 11333 | add_mixer(spec, alc268_beep_mixer); |
aef9d318 | 11334 | |
d88897ea | 11335 | add_verb(spec, alc268_volume_init_verbs); |
a361d84b KY |
11336 | spec->num_mux_defs = 1; |
11337 | spec->input_mux = &spec->private_imux; | |
11338 | ||
776e184e TI |
11339 | err = alc_auto_add_mic_boost(codec); |
11340 | if (err < 0) | |
11341 | return err; | |
11342 | ||
e044c39a | 11343 | store_pin_configs(codec); |
a361d84b KY |
11344 | return 1; |
11345 | } | |
11346 | ||
11347 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out | |
11348 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out | |
11349 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | |
11350 | ||
11351 | /* init callback for auto-configuration model -- overriding the default init */ | |
11352 | static void alc268_auto_init(struct hda_codec *codec) | |
11353 | { | |
f6c7e546 | 11354 | struct alc_spec *spec = codec->spec; |
a361d84b KY |
11355 | alc268_auto_init_multi_out(codec); |
11356 | alc268_auto_init_hp_out(codec); | |
11357 | alc268_auto_init_mono_speaker_out(codec); | |
11358 | alc268_auto_init_analog_input(codec); | |
f6c7e546 | 11359 | if (spec->unsol_event) |
7fb0d78f | 11360 | alc_inithook(codec); |
a361d84b KY |
11361 | } |
11362 | ||
11363 | /* | |
11364 | * configuration and preset | |
11365 | */ | |
11366 | static const char *alc268_models[ALC268_MODEL_LAST] = { | |
eb5a6621 | 11367 | [ALC267_QUANTA_IL1] = "quanta-il1", |
a361d84b | 11368 | [ALC268_3ST] = "3stack", |
983f8ae4 | 11369 | [ALC268_TOSHIBA] = "toshiba", |
d273809e | 11370 | [ALC268_ACER] = "acer", |
c238b4f4 | 11371 | [ALC268_ACER_DMIC] = "acer-dmic", |
8ef355da | 11372 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
3866f0b0 | 11373 | [ALC268_DELL] = "dell", |
f12462c5 | 11374 | [ALC268_ZEPTO] = "zepto", |
86c53bd2 JW |
11375 | #ifdef CONFIG_SND_DEBUG |
11376 | [ALC268_TEST] = "test", | |
11377 | #endif | |
a361d84b KY |
11378 | [ALC268_AUTO] = "auto", |
11379 | }; | |
11380 | ||
11381 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
a0b8f7d8 | 11382 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
ac3e3741 | 11383 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
dafc8357 | 11384 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
ac3e3741 | 11385 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
29a52c24 | 11386 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
8ef355da KY |
11387 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
11388 | ALC268_ACER_ASPIRE_ONE), | |
3866f0b0 | 11389 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
ac3e3741 | 11390 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
a361d84b | 11391 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
d1a991a6 | 11392 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
8e7f00f9 | 11393 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
2346d0cd | 11394 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
378bd6a5 | 11395 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
b875bf3a | 11396 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
eb5a6621 | 11397 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
f12462c5 | 11398 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
a361d84b KY |
11399 | {} |
11400 | }; | |
11401 | ||
11402 | static struct alc_config_preset alc268_presets[] = { | |
eb5a6621 HRK |
11403 | [ALC267_QUANTA_IL1] = { |
11404 | .mixers = { alc267_quanta_il1_mixer }, | |
11405 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
11406 | alc267_quanta_il1_verbs }, | |
11407 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11408 | .dac_nids = alc268_dac_nids, | |
11409 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11410 | .adc_nids = alc268_adc_nids_alt, | |
11411 | .hp_nid = 0x03, | |
11412 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11413 | .channel_mode = alc268_modes, | |
11414 | .input_mux = &alc268_capture_source, | |
11415 | .unsol_event = alc267_quanta_il1_unsol_event, | |
11416 | .init_hook = alc267_quanta_il1_automute, | |
11417 | }, | |
a361d84b | 11418 | [ALC268_3ST] = { |
aef9d318 TI |
11419 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
11420 | alc268_beep_mixer }, | |
a361d84b KY |
11421 | .init_verbs = { alc268_base_init_verbs }, |
11422 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11423 | .dac_nids = alc268_dac_nids, | |
11424 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11425 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11426 | .capsrc_nids = alc268_capsrc_nids, |
a361d84b KY |
11427 | .hp_nid = 0x03, |
11428 | .dig_out_nid = ALC268_DIGOUT_NID, | |
11429 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11430 | .channel_mode = alc268_modes, | |
11431 | .input_mux = &alc268_capture_source, | |
11432 | }, | |
d1a991a6 | 11433 | [ALC268_TOSHIBA] = { |
aef9d318 TI |
11434 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
11435 | alc268_beep_mixer }, | |
d273809e TI |
11436 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11437 | alc268_toshiba_verbs }, | |
d1a991a6 KY |
11438 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
11439 | .dac_nids = alc268_dac_nids, | |
11440 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11441 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11442 | .capsrc_nids = alc268_capsrc_nids, |
d1a991a6 KY |
11443 | .hp_nid = 0x03, |
11444 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11445 | .channel_mode = alc268_modes, | |
11446 | .input_mux = &alc268_capture_source, | |
d273809e TI |
11447 | .unsol_event = alc268_toshiba_unsol_event, |
11448 | .init_hook = alc268_toshiba_automute, | |
11449 | }, | |
11450 | [ALC268_ACER] = { | |
aef9d318 TI |
11451 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
11452 | alc268_beep_mixer }, | |
d273809e TI |
11453 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11454 | alc268_acer_verbs }, | |
11455 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11456 | .dac_nids = alc268_dac_nids, | |
11457 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11458 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11459 | .capsrc_nids = alc268_capsrc_nids, |
d273809e TI |
11460 | .hp_nid = 0x02, |
11461 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11462 | .channel_mode = alc268_modes, | |
0ccb541c | 11463 | .input_mux = &alc268_acer_capture_source, |
d273809e | 11464 | .unsol_event = alc268_acer_unsol_event, |
889c4395 | 11465 | .init_hook = alc268_acer_init_hook, |
d1a991a6 | 11466 | }, |
c238b4f4 TI |
11467 | [ALC268_ACER_DMIC] = { |
11468 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, | |
11469 | alc268_beep_mixer }, | |
11470 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
11471 | alc268_acer_verbs }, | |
11472 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11473 | .dac_nids = alc268_dac_nids, | |
11474 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11475 | .adc_nids = alc268_adc_nids_alt, | |
11476 | .capsrc_nids = alc268_capsrc_nids, | |
11477 | .hp_nid = 0x02, | |
11478 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11479 | .channel_mode = alc268_modes, | |
11480 | .input_mux = &alc268_acer_dmic_capture_source, | |
11481 | .unsol_event = alc268_acer_unsol_event, | |
11482 | .init_hook = alc268_acer_init_hook, | |
11483 | }, | |
8ef355da KY |
11484 | [ALC268_ACER_ASPIRE_ONE] = { |
11485 | .mixers = { alc268_acer_aspire_one_mixer, | |
11486 | alc268_capture_alt_mixer }, | |
11487 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
11488 | alc268_acer_aspire_one_verbs }, | |
11489 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11490 | .dac_nids = alc268_dac_nids, | |
11491 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11492 | .adc_nids = alc268_adc_nids_alt, | |
11493 | .capsrc_nids = alc268_capsrc_nids, | |
11494 | .hp_nid = 0x03, | |
11495 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11496 | .channel_mode = alc268_modes, | |
11497 | .input_mux = &alc268_acer_lc_capture_source, | |
11498 | .unsol_event = alc268_acer_lc_unsol_event, | |
11499 | .init_hook = alc268_acer_lc_init_hook, | |
11500 | }, | |
3866f0b0 | 11501 | [ALC268_DELL] = { |
aef9d318 | 11502 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
3866f0b0 TI |
11503 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11504 | alc268_dell_verbs }, | |
11505 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11506 | .dac_nids = alc268_dac_nids, | |
11507 | .hp_nid = 0x02, | |
11508 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11509 | .channel_mode = alc268_modes, | |
11510 | .unsol_event = alc268_dell_unsol_event, | |
11511 | .init_hook = alc268_dell_init_hook, | |
11512 | .input_mux = &alc268_capture_source, | |
11513 | }, | |
f12462c5 | 11514 | [ALC268_ZEPTO] = { |
aef9d318 TI |
11515 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
11516 | alc268_beep_mixer }, | |
f12462c5 MT |
11517 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11518 | alc268_toshiba_verbs }, | |
11519 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11520 | .dac_nids = alc268_dac_nids, | |
11521 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11522 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11523 | .capsrc_nids = alc268_capsrc_nids, |
f12462c5 MT |
11524 | .hp_nid = 0x03, |
11525 | .dig_out_nid = ALC268_DIGOUT_NID, | |
11526 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11527 | .channel_mode = alc268_modes, | |
11528 | .input_mux = &alc268_capture_source, | |
11529 | .unsol_event = alc268_toshiba_unsol_event, | |
11530 | .init_hook = alc268_toshiba_automute | |
11531 | }, | |
86c53bd2 JW |
11532 | #ifdef CONFIG_SND_DEBUG |
11533 | [ALC268_TEST] = { | |
11534 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
11535 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
11536 | alc268_volume_init_verbs }, | |
11537 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11538 | .dac_nids = alc268_dac_nids, | |
11539 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11540 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11541 | .capsrc_nids = alc268_capsrc_nids, |
86c53bd2 JW |
11542 | .hp_nid = 0x03, |
11543 | .dig_out_nid = ALC268_DIGOUT_NID, | |
11544 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11545 | .channel_mode = alc268_modes, | |
11546 | .input_mux = &alc268_capture_source, | |
11547 | }, | |
11548 | #endif | |
a361d84b KY |
11549 | }; |
11550 | ||
11551 | static int patch_alc268(struct hda_codec *codec) | |
11552 | { | |
11553 | struct alc_spec *spec; | |
11554 | int board_config; | |
11555 | int err; | |
11556 | ||
11557 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | |
11558 | if (spec == NULL) | |
11559 | return -ENOMEM; | |
11560 | ||
11561 | codec->spec = spec; | |
11562 | ||
11563 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
11564 | alc268_models, | |
11565 | alc268_cfg_tbl); | |
11566 | ||
11567 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | |
11568 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " | |
11569 | "trying auto-probe from BIOS...\n"); | |
11570 | board_config = ALC268_AUTO; | |
11571 | } | |
11572 | ||
11573 | if (board_config == ALC268_AUTO) { | |
11574 | /* automatic parse from the BIOS config */ | |
11575 | err = alc268_parse_auto_config(codec); | |
11576 | if (err < 0) { | |
11577 | alc_free(codec); | |
11578 | return err; | |
11579 | } else if (!err) { | |
11580 | printk(KERN_INFO | |
11581 | "hda_codec: Cannot set up configuration " | |
11582 | "from BIOS. Using base mode...\n"); | |
11583 | board_config = ALC268_3ST; | |
11584 | } | |
11585 | } | |
11586 | ||
11587 | if (board_config != ALC268_AUTO) | |
11588 | setup_preset(spec, &alc268_presets[board_config]); | |
11589 | ||
2f893286 KY |
11590 | if (codec->vendor_id == 0x10ec0267) { |
11591 | spec->stream_name_analog = "ALC267 Analog"; | |
11592 | spec->stream_name_digital = "ALC267 Digital"; | |
11593 | } else { | |
11594 | spec->stream_name_analog = "ALC268 Analog"; | |
11595 | spec->stream_name_digital = "ALC268 Digital"; | |
11596 | } | |
11597 | ||
a361d84b KY |
11598 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
11599 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
6330079f | 11600 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
a361d84b | 11601 | |
a361d84b KY |
11602 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
11603 | ||
aef9d318 TI |
11604 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
11605 | /* override the amp caps for beep generator */ | |
11606 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
11607 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | |
11608 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
11609 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
11610 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
11611 | ||
3866f0b0 TI |
11612 | if (!spec->adc_nids && spec->input_mux) { |
11613 | /* check whether NID 0x07 is valid */ | |
11614 | unsigned int wcap = get_wcaps(codec, 0x07); | |
85860c06 | 11615 | int i; |
3866f0b0 TI |
11616 | |
11617 | /* get type */ | |
11618 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
67ebcb03 | 11619 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
3866f0b0 TI |
11620 | spec->adc_nids = alc268_adc_nids_alt; |
11621 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
d88897ea | 11622 | add_mixer(spec, alc268_capture_alt_mixer); |
3866f0b0 TI |
11623 | } else { |
11624 | spec->adc_nids = alc268_adc_nids; | |
11625 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
d88897ea | 11626 | add_mixer(spec, alc268_capture_mixer); |
a361d84b | 11627 | } |
e1406348 | 11628 | spec->capsrc_nids = alc268_capsrc_nids; |
85860c06 TI |
11629 | /* set default input source */ |
11630 | for (i = 0; i < spec->num_adc_nids; i++) | |
11631 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
11632 | 0, AC_VERB_SET_CONNECT_SEL, | |
11633 | spec->input_mux->items[0].index); | |
a361d84b | 11634 | } |
2134ea4f TI |
11635 | |
11636 | spec->vmaster_nid = 0x02; | |
11637 | ||
a361d84b KY |
11638 | codec->patch_ops = alc_patch_ops; |
11639 | if (board_config == ALC268_AUTO) | |
11640 | spec->init_hook = alc268_auto_init; | |
ea1fb29a | 11641 | |
a361d84b KY |
11642 | return 0; |
11643 | } | |
11644 | ||
f6a92248 KY |
11645 | /* |
11646 | * ALC269 channel source setting (2 channel) | |
11647 | */ | |
11648 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
11649 | ||
11650 | #define alc269_dac_nids alc260_dac_nids | |
11651 | ||
11652 | static hda_nid_t alc269_adc_nids[1] = { | |
11653 | /* ADC1 */ | |
f53281e6 KY |
11654 | 0x08, |
11655 | }; | |
11656 | ||
e01bf509 TI |
11657 | static hda_nid_t alc269_capsrc_nids[1] = { |
11658 | 0x23, | |
11659 | }; | |
11660 | ||
11661 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), | |
11662 | * not a mux! | |
11663 | */ | |
11664 | ||
f53281e6 KY |
11665 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
11666 | .num_items = 2, | |
11667 | .items = { | |
11668 | { "i-Mic", 0x5 }, | |
11669 | { "e-Mic", 0x0 }, | |
11670 | }, | |
11671 | }; | |
11672 | ||
11673 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { | |
11674 | .num_items = 2, | |
11675 | .items = { | |
11676 | { "i-Mic", 0x1 }, | |
11677 | { "e-Mic", 0x0 }, | |
11678 | }, | |
f6a92248 KY |
11679 | }; |
11680 | ||
11681 | #define alc269_modes alc260_modes | |
11682 | #define alc269_capture_source alc880_lg_lw_capture_source | |
11683 | ||
11684 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
11685 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
11686 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11687 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11688 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11689 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11690 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2005af24 TI |
11691 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
11692 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
f6a92248 KY |
11693 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
11694 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11695 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11696 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11698 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
11699 | { } /* end */ | |
11700 | }; | |
11701 | ||
60db6b53 KY |
11702 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
11703 | /* output mixer control */ | |
11704 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
11705 | { | |
11706 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11707 | .name = "Master Playback Switch", | |
11708 | .info = snd_hda_mixer_amp_switch_info, | |
11709 | .get = snd_hda_mixer_amp_switch_get, | |
11710 | .put = alc268_acer_master_sw_put, | |
11711 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
11712 | }, | |
11713 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11714 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11715 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11716 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11717 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11718 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
11719 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11720 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11721 | { } | |
11722 | }; | |
11723 | ||
64154835 TV |
11724 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
11725 | /* output mixer control */ | |
11726 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
11727 | { | |
11728 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11729 | .name = "Master Playback Switch", | |
11730 | .info = snd_hda_mixer_amp_switch_info, | |
11731 | .get = snd_hda_mixer_amp_switch_get, | |
11732 | .put = alc268_acer_master_sw_put, | |
11733 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
11734 | }, | |
11735 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11736 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11737 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11738 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11739 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11740 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
11741 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
11742 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
11743 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), | |
11744 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11745 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11746 | { } | |
11747 | }; | |
11748 | ||
f53281e6 KY |
11749 | /* bind volumes of both NID 0x0c and 0x0d */ |
11750 | static struct hda_bind_ctls alc269_epc_bind_vol = { | |
11751 | .ops = &snd_hda_bind_vol, | |
11752 | .values = { | |
11753 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
11754 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
11755 | 0 | |
11756 | }, | |
11757 | }; | |
11758 | ||
11759 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { | |
11760 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11761 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), | |
11762 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11763 | { } /* end */ | |
11764 | }; | |
11765 | ||
f53281e6 KY |
11766 | /* capture mixer elements */ |
11767 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { | |
11768 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
11769 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
26f5df26 TI |
11770 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
11771 | { } /* end */ | |
11772 | }; | |
11773 | ||
11774 | /* FSC amilo */ | |
11775 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { | |
11776 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11777 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11778 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), | |
f53281e6 KY |
11779 | { } /* end */ |
11780 | }; | |
11781 | ||
2005af24 TI |
11782 | /* beep control */ |
11783 | static struct snd_kcontrol_new alc269_beep_mixer[] = { | |
11784 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
11785 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
11786 | { } /* end */ | |
11787 | }; | |
11788 | ||
60db6b53 KY |
11789 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
11790 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11791 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11792 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11793 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11794 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11795 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11796 | { } | |
11797 | }; | |
f6a92248 | 11798 | |
64154835 TV |
11799 | static struct hda_verb alc269_lifebook_verbs[] = { |
11800 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11801 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11802 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11803 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11804 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11806 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11807 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11808 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11809 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11810 | { } | |
11811 | }; | |
11812 | ||
60db6b53 KY |
11813 | /* toggle speaker-output according to the hp-jack state */ |
11814 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |
11815 | { | |
11816 | unsigned int present; | |
11817 | unsigned char bits; | |
f6a92248 | 11818 | |
60db6b53 KY |
11819 | present = snd_hda_codec_read(codec, 0x15, 0, |
11820 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11821 | bits = present ? AMP_IN_MUTE(0) : 0; | |
11822 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
11823 | AMP_IN_MUTE(0), bits); | |
11824 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
11825 | AMP_IN_MUTE(0), bits); | |
f6a92248 | 11826 | |
60db6b53 KY |
11827 | snd_hda_codec_write(codec, 0x20, 0, |
11828 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
11829 | snd_hda_codec_write(codec, 0x20, 0, | |
11830 | AC_VERB_SET_PROC_COEF, 0x680); | |
f6a92248 | 11831 | |
60db6b53 KY |
11832 | snd_hda_codec_write(codec, 0x20, 0, |
11833 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
11834 | snd_hda_codec_write(codec, 0x20, 0, | |
11835 | AC_VERB_SET_PROC_COEF, 0x480); | |
11836 | } | |
f6a92248 | 11837 | |
64154835 TV |
11838 | /* toggle speaker-output according to the hp-jacks state */ |
11839 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | |
11840 | { | |
11841 | unsigned int present; | |
11842 | unsigned char bits; | |
11843 | ||
11844 | /* Check laptop headphone socket */ | |
11845 | present = snd_hda_codec_read(codec, 0x15, 0, | |
11846 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11847 | ||
11848 | /* Check port replicator headphone socket */ | |
11849 | present |= snd_hda_codec_read(codec, 0x1a, 0, | |
11850 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11851 | ||
11852 | bits = present ? AMP_IN_MUTE(0) : 0; | |
11853 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
11854 | AMP_IN_MUTE(0), bits); | |
11855 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
11856 | AMP_IN_MUTE(0), bits); | |
11857 | ||
11858 | snd_hda_codec_write(codec, 0x20, 0, | |
11859 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
11860 | snd_hda_codec_write(codec, 0x20, 0, | |
11861 | AC_VERB_SET_PROC_COEF, 0x680); | |
11862 | ||
11863 | snd_hda_codec_write(codec, 0x20, 0, | |
11864 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
11865 | snd_hda_codec_write(codec, 0x20, 0, | |
11866 | AC_VERB_SET_PROC_COEF, 0x480); | |
11867 | } | |
11868 | ||
60db6b53 KY |
11869 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
11870 | { | |
11871 | unsigned int present; | |
f6a92248 | 11872 | |
60db6b53 KY |
11873 | present = snd_hda_codec_read(codec, 0x18, 0, |
11874 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11875 | snd_hda_codec_write(codec, 0x23, 0, | |
11876 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); | |
11877 | } | |
f6a92248 | 11878 | |
64154835 TV |
11879 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
11880 | { | |
11881 | unsigned int present_laptop; | |
11882 | unsigned int present_dock; | |
11883 | ||
11884 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, | |
11885 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11886 | ||
11887 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, | |
11888 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11889 | ||
11890 | /* Laptop mic port overrides dock mic port, design decision */ | |
11891 | if (present_dock) | |
11892 | snd_hda_codec_write(codec, 0x23, 0, | |
11893 | AC_VERB_SET_CONNECT_SEL, 0x3); | |
11894 | if (present_laptop) | |
11895 | snd_hda_codec_write(codec, 0x23, 0, | |
11896 | AC_VERB_SET_CONNECT_SEL, 0x0); | |
11897 | if (!present_dock && !present_laptop) | |
11898 | snd_hda_codec_write(codec, 0x23, 0, | |
11899 | AC_VERB_SET_CONNECT_SEL, 0x1); | |
11900 | } | |
11901 | ||
60db6b53 KY |
11902 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
11903 | unsigned int res) | |
11904 | { | |
11905 | if ((res >> 26) == ALC880_HP_EVENT) | |
11906 | alc269_quanta_fl1_speaker_automute(codec); | |
11907 | if ((res >> 26) == ALC880_MIC_EVENT) | |
11908 | alc269_quanta_fl1_mic_automute(codec); | |
11909 | } | |
f6a92248 | 11910 | |
64154835 TV |
11911 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
11912 | unsigned int res) | |
11913 | { | |
11914 | if ((res >> 26) == ALC880_HP_EVENT) | |
11915 | alc269_lifebook_speaker_automute(codec); | |
11916 | if ((res >> 26) == ALC880_MIC_EVENT) | |
11917 | alc269_lifebook_mic_autoswitch(codec); | |
11918 | } | |
11919 | ||
60db6b53 KY |
11920 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
11921 | { | |
11922 | alc269_quanta_fl1_speaker_automute(codec); | |
11923 | alc269_quanta_fl1_mic_automute(codec); | |
11924 | } | |
f6a92248 | 11925 | |
64154835 TV |
11926 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
11927 | { | |
11928 | alc269_lifebook_speaker_automute(codec); | |
11929 | alc269_lifebook_mic_autoswitch(codec); | |
11930 | } | |
11931 | ||
f53281e6 KY |
11932 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
11933 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11934 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | |
11935 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
11936 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
11937 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11938 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11939 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11940 | {} | |
11941 | }; | |
11942 | ||
11943 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { | |
11944 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11945 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11946 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
11947 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | |
11948 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11949 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11950 | {} | |
11951 | }; | |
11952 | ||
11953 | /* toggle speaker-output according to the hp-jack state */ | |
11954 | static void alc269_speaker_automute(struct hda_codec *codec) | |
11955 | { | |
11956 | unsigned int present; | |
60db6b53 | 11957 | unsigned char bits; |
f53281e6 KY |
11958 | |
11959 | present = snd_hda_codec_read(codec, 0x15, 0, | |
60db6b53 | 11960 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
f53281e6 KY |
11961 | bits = present ? AMP_IN_MUTE(0) : 0; |
11962 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
60db6b53 | 11963 | AMP_IN_MUTE(0), bits); |
f53281e6 | 11964 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
60db6b53 | 11965 | AMP_IN_MUTE(0), bits); |
f53281e6 KY |
11966 | } |
11967 | ||
11968 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) | |
11969 | { | |
11970 | unsigned int present; | |
11971 | ||
60db6b53 KY |
11972 | present = snd_hda_codec_read(codec, 0x18, 0, |
11973 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11974 | snd_hda_codec_write(codec, 0x23, 0, | |
11975 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); | |
f53281e6 KY |
11976 | } |
11977 | ||
11978 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) | |
11979 | { | |
11980 | unsigned int present; | |
11981 | ||
60db6b53 KY |
11982 | present = snd_hda_codec_read(codec, 0x18, 0, |
11983 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
f53281e6 | 11984 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
60db6b53 | 11985 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
f53281e6 | 11986 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
60db6b53 | 11987 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
f53281e6 KY |
11988 | } |
11989 | ||
11990 | /* unsolicited event for HP jack sensing */ | |
11991 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, | |
60db6b53 | 11992 | unsigned int res) |
f53281e6 KY |
11993 | { |
11994 | if ((res >> 26) == ALC880_HP_EVENT) | |
11995 | alc269_speaker_automute(codec); | |
11996 | ||
11997 | if ((res >> 26) == ALC880_MIC_EVENT) | |
11998 | alc269_eeepc_dmic_automute(codec); | |
11999 | } | |
12000 | ||
12001 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) | |
12002 | { | |
12003 | alc269_speaker_automute(codec); | |
12004 | alc269_eeepc_dmic_automute(codec); | |
12005 | } | |
12006 | ||
12007 | /* unsolicited event for HP jack sensing */ | |
12008 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, | |
ea1fb29a | 12009 | unsigned int res) |
f53281e6 KY |
12010 | { |
12011 | if ((res >> 26) == ALC880_HP_EVENT) | |
12012 | alc269_speaker_automute(codec); | |
12013 | ||
12014 | if ((res >> 26) == ALC880_MIC_EVENT) | |
12015 | alc269_eeepc_amic_automute(codec); | |
12016 | } | |
12017 | ||
12018 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) | |
12019 | { | |
12020 | alc269_speaker_automute(codec); | |
12021 | alc269_eeepc_amic_automute(codec); | |
12022 | } | |
12023 | ||
60db6b53 KY |
12024 | /* |
12025 | * generic initialization of ADC, input mixers and output mixers | |
12026 | */ | |
12027 | static struct hda_verb alc269_init_verbs[] = { | |
12028 | /* | |
12029 | * Unmute ADC0 and set the default input to mic-in | |
12030 | */ | |
12031 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12032 | ||
12033 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the | |
12034 | * analog-loopback mixer widget | |
12035 | * Note: PASD motherboards uses the Line In 2 as the input for | |
12036 | * front panel mic (mic 2) | |
12037 | */ | |
12038 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
12039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12044 | ||
12045 | /* | |
12046 | * Set up output mixers (0x0c - 0x0e) | |
12047 | */ | |
12048 | /* set vol=0 to output mixers */ | |
12049 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12050 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12051 | ||
12052 | /* set up input amps for analog loopback */ | |
12053 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12056 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12058 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12059 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12060 | ||
12061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12063 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12064 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12065 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12066 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12067 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12068 | ||
12069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12070 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12071 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12072 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12073 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12074 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12075 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12076 | ||
12077 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12078 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12079 | ||
12080 | /* FIXME: use matrix-type input source selection */ | |
12081 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
12082 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12085 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12087 | ||
12088 | /* set EAPD */ | |
12089 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12090 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12091 | { } | |
12092 | }; | |
12093 | ||
f6a92248 KY |
12094 | /* add playback controls from the parsed DAC table */ |
12095 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | |
12096 | const struct auto_pin_cfg *cfg) | |
12097 | { | |
12098 | hda_nid_t nid; | |
12099 | int err; | |
12100 | ||
12101 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
12102 | spec->multiout.dac_nids = spec->private_dac_nids; | |
12103 | spec->multiout.dac_nids[0] = 2; | |
12104 | ||
12105 | nid = cfg->line_out_pins[0]; | |
12106 | if (nid) { | |
12107 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
12108 | "Front Playback Volume", | |
12109 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); | |
12110 | if (err < 0) | |
12111 | return err; | |
12112 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12113 | "Front Playback Switch", | |
12114 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
12115 | if (err < 0) | |
12116 | return err; | |
12117 | } | |
12118 | ||
12119 | nid = cfg->speaker_pins[0]; | |
12120 | if (nid) { | |
12121 | if (!cfg->line_out_pins[0]) { | |
12122 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
12123 | "Speaker Playback Volume", | |
12124 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | |
12125 | HDA_OUTPUT)); | |
12126 | if (err < 0) | |
12127 | return err; | |
12128 | } | |
12129 | if (nid == 0x16) { | |
12130 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12131 | "Speaker Playback Switch", | |
12132 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
12133 | HDA_OUTPUT)); | |
12134 | if (err < 0) | |
12135 | return err; | |
12136 | } else { | |
12137 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12138 | "Speaker Playback Switch", | |
12139 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
12140 | HDA_OUTPUT)); | |
12141 | if (err < 0) | |
12142 | return err; | |
12143 | } | |
12144 | } | |
12145 | nid = cfg->hp_pins[0]; | |
12146 | if (nid) { | |
12147 | /* spec->multiout.hp_nid = 2; */ | |
12148 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { | |
12149 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
12150 | "Headphone Playback Volume", | |
12151 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | |
12152 | HDA_OUTPUT)); | |
12153 | if (err < 0) | |
12154 | return err; | |
12155 | } | |
12156 | if (nid == 0x16) { | |
12157 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12158 | "Headphone Playback Switch", | |
12159 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
12160 | HDA_OUTPUT)); | |
12161 | if (err < 0) | |
12162 | return err; | |
12163 | } else { | |
12164 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12165 | "Headphone Playback Switch", | |
12166 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
12167 | HDA_OUTPUT)); | |
12168 | if (err < 0) | |
12169 | return err; | |
12170 | } | |
12171 | } | |
12172 | return 0; | |
12173 | } | |
12174 | ||
ee956e09 TI |
12175 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
12176 | const struct auto_pin_cfg *cfg) | |
12177 | { | |
12178 | int err; | |
12179 | ||
12180 | err = alc880_auto_create_analog_input_ctls(spec, cfg); | |
12181 | if (err < 0) | |
12182 | return err; | |
12183 | /* digital-mic input pin is excluded in alc880_auto_create..() | |
12184 | * because it's under 0x18 | |
12185 | */ | |
12186 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | |
12187 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | |
12188 | struct hda_input_mux *imux = &spec->private_imux; | |
12189 | imux->items[imux->num_items].label = "Int Mic"; | |
12190 | imux->items[imux->num_items].index = 0x05; | |
12191 | imux->num_items++; | |
12192 | } | |
12193 | return 0; | |
12194 | } | |
f6a92248 KY |
12195 | |
12196 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
12197 | #define alc269_loopbacks alc880_loopbacks | |
12198 | #endif | |
12199 | ||
12200 | /* pcm configuration: identiacal with ALC880 */ | |
12201 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback | |
12202 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
12203 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
12204 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
12205 | ||
12206 | /* | |
12207 | * BIOS auto configuration | |
12208 | */ | |
12209 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
12210 | { | |
12211 | struct alc_spec *spec = codec->spec; | |
2005af24 | 12212 | int i, err; |
f6a92248 KY |
12213 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
12214 | ||
12215 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
12216 | alc269_ignore); | |
12217 | if (err < 0) | |
12218 | return err; | |
12219 | ||
12220 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
12221 | if (err < 0) | |
12222 | return err; | |
12223 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
12224 | if (err < 0) | |
12225 | return err; | |
12226 | ||
12227 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
12228 | ||
12229 | if (spec->autocfg.dig_out_pin) | |
12230 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; | |
12231 | ||
603c4019 | 12232 | if (spec->kctls.list) |
d88897ea | 12233 | add_mixer(spec, spec->kctls.list); |
f6a92248 | 12234 | |
2005af24 TI |
12235 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
12236 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) | |
12237 | if (spec->autocfg.input_pins[i] == 0x1d) | |
12238 | break; | |
12239 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) | |
d88897ea | 12240 | add_mixer(spec, alc269_beep_mixer); |
2005af24 | 12241 | |
d88897ea | 12242 | add_verb(spec, alc269_init_verbs); |
f6a92248 KY |
12243 | spec->num_mux_defs = 1; |
12244 | spec->input_mux = &spec->private_imux; | |
e01bf509 TI |
12245 | /* set default input source */ |
12246 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], | |
12247 | 0, AC_VERB_SET_CONNECT_SEL, | |
12248 | spec->input_mux->items[0].index); | |
f6a92248 KY |
12249 | |
12250 | err = alc_auto_add_mic_boost(codec); | |
12251 | if (err < 0) | |
12252 | return err; | |
12253 | ||
f9e336f6 TI |
12254 | if (!spec->cap_mixer) |
12255 | set_capture_mixer(spec); | |
f53281e6 | 12256 | |
e044c39a | 12257 | store_pin_configs(codec); |
f6a92248 KY |
12258 | return 1; |
12259 | } | |
12260 | ||
12261 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out | |
12262 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out | |
12263 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | |
12264 | ||
12265 | ||
12266 | /* init callback for auto-configuration model -- overriding the default init */ | |
12267 | static void alc269_auto_init(struct hda_codec *codec) | |
12268 | { | |
f6c7e546 | 12269 | struct alc_spec *spec = codec->spec; |
f6a92248 KY |
12270 | alc269_auto_init_multi_out(codec); |
12271 | alc269_auto_init_hp_out(codec); | |
12272 | alc269_auto_init_analog_input(codec); | |
f6c7e546 | 12273 | if (spec->unsol_event) |
7fb0d78f | 12274 | alc_inithook(codec); |
f6a92248 KY |
12275 | } |
12276 | ||
12277 | /* | |
12278 | * configuration and preset | |
12279 | */ | |
12280 | static const char *alc269_models[ALC269_MODEL_LAST] = { | |
60db6b53 | 12281 | [ALC269_BASIC] = "basic", |
2922c9af TI |
12282 | [ALC269_QUANTA_FL1] = "quanta", |
12283 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", | |
26f5df26 | 12284 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
64154835 TV |
12285 | [ALC269_FUJITSU] = "fujitsu", |
12286 | [ALC269_LIFEBOOK] = "lifebook" | |
f6a92248 KY |
12287 | }; |
12288 | ||
12289 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
60db6b53 | 12290 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
f53281e6 KY |
12291 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
12292 | ALC269_ASUS_EEEPC_P703), | |
12293 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | |
12294 | ALC269_ASUS_EEEPC_P901), | |
60db6b53 KY |
12295 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
12296 | ALC269_ASUS_EEEPC_P901), | |
26f5df26 | 12297 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
64154835 | 12298 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
f6a92248 KY |
12299 | {} |
12300 | }; | |
12301 | ||
12302 | static struct alc_config_preset alc269_presets[] = { | |
12303 | [ALC269_BASIC] = { | |
f9e336f6 | 12304 | .mixers = { alc269_base_mixer }, |
f6a92248 KY |
12305 | .init_verbs = { alc269_init_verbs }, |
12306 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12307 | .dac_nids = alc269_dac_nids, | |
12308 | .hp_nid = 0x03, | |
12309 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12310 | .channel_mode = alc269_modes, | |
12311 | .input_mux = &alc269_capture_source, | |
12312 | }, | |
60db6b53 KY |
12313 | [ALC269_QUANTA_FL1] = { |
12314 | .mixers = { alc269_quanta_fl1_mixer }, | |
12315 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | |
12316 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12317 | .dac_nids = alc269_dac_nids, | |
12318 | .hp_nid = 0x03, | |
12319 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12320 | .channel_mode = alc269_modes, | |
12321 | .input_mux = &alc269_capture_source, | |
12322 | .unsol_event = alc269_quanta_fl1_unsol_event, | |
12323 | .init_hook = alc269_quanta_fl1_init_hook, | |
12324 | }, | |
f53281e6 | 12325 | [ALC269_ASUS_EEEPC_P703] = { |
f9e336f6 TI |
12326 | .mixers = { alc269_eeepc_mixer }, |
12327 | .cap_mixer = alc269_epc_capture_mixer, | |
f53281e6 KY |
12328 | .init_verbs = { alc269_init_verbs, |
12329 | alc269_eeepc_amic_init_verbs }, | |
12330 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12331 | .dac_nids = alc269_dac_nids, | |
12332 | .hp_nid = 0x03, | |
12333 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12334 | .channel_mode = alc269_modes, | |
12335 | .input_mux = &alc269_eeepc_amic_capture_source, | |
12336 | .unsol_event = alc269_eeepc_amic_unsol_event, | |
12337 | .init_hook = alc269_eeepc_amic_inithook, | |
12338 | }, | |
12339 | [ALC269_ASUS_EEEPC_P901] = { | |
f9e336f6 TI |
12340 | .mixers = { alc269_eeepc_mixer }, |
12341 | .cap_mixer = alc269_epc_capture_mixer, | |
f53281e6 KY |
12342 | .init_verbs = { alc269_init_verbs, |
12343 | alc269_eeepc_dmic_init_verbs }, | |
12344 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12345 | .dac_nids = alc269_dac_nids, | |
12346 | .hp_nid = 0x03, | |
12347 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12348 | .channel_mode = alc269_modes, | |
12349 | .input_mux = &alc269_eeepc_dmic_capture_source, | |
12350 | .unsol_event = alc269_eeepc_dmic_unsol_event, | |
12351 | .init_hook = alc269_eeepc_dmic_inithook, | |
12352 | }, | |
26f5df26 TI |
12353 | [ALC269_FUJITSU] = { |
12354 | .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer }, | |
12355 | .cap_mixer = alc269_epc_capture_mixer, | |
12356 | .init_verbs = { alc269_init_verbs, | |
12357 | alc269_eeepc_dmic_init_verbs }, | |
12358 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12359 | .dac_nids = alc269_dac_nids, | |
12360 | .hp_nid = 0x03, | |
12361 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12362 | .channel_mode = alc269_modes, | |
12363 | .input_mux = &alc269_eeepc_dmic_capture_source, | |
12364 | .unsol_event = alc269_eeepc_dmic_unsol_event, | |
12365 | .init_hook = alc269_eeepc_dmic_inithook, | |
12366 | }, | |
64154835 TV |
12367 | [ALC269_LIFEBOOK] = { |
12368 | .mixers = { alc269_lifebook_mixer }, | |
12369 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | |
12370 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12371 | .dac_nids = alc269_dac_nids, | |
12372 | .hp_nid = 0x03, | |
12373 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12374 | .channel_mode = alc269_modes, | |
12375 | .input_mux = &alc269_capture_source, | |
12376 | .unsol_event = alc269_lifebook_unsol_event, | |
12377 | .init_hook = alc269_lifebook_init_hook, | |
12378 | }, | |
f6a92248 KY |
12379 | }; |
12380 | ||
12381 | static int patch_alc269(struct hda_codec *codec) | |
12382 | { | |
12383 | struct alc_spec *spec; | |
12384 | int board_config; | |
12385 | int err; | |
12386 | ||
12387 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
12388 | if (spec == NULL) | |
12389 | return -ENOMEM; | |
12390 | ||
12391 | codec->spec = spec; | |
12392 | ||
2c3bf9ab TI |
12393 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
12394 | ||
f6a92248 KY |
12395 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
12396 | alc269_models, | |
12397 | alc269_cfg_tbl); | |
12398 | ||
12399 | if (board_config < 0) { | |
12400 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " | |
12401 | "trying auto-probe from BIOS...\n"); | |
12402 | board_config = ALC269_AUTO; | |
12403 | } | |
12404 | ||
12405 | if (board_config == ALC269_AUTO) { | |
12406 | /* automatic parse from the BIOS config */ | |
12407 | err = alc269_parse_auto_config(codec); | |
12408 | if (err < 0) { | |
12409 | alc_free(codec); | |
12410 | return err; | |
12411 | } else if (!err) { | |
12412 | printk(KERN_INFO | |
12413 | "hda_codec: Cannot set up configuration " | |
12414 | "from BIOS. Using base mode...\n"); | |
12415 | board_config = ALC269_BASIC; | |
12416 | } | |
12417 | } | |
12418 | ||
12419 | if (board_config != ALC269_AUTO) | |
12420 | setup_preset(spec, &alc269_presets[board_config]); | |
12421 | ||
12422 | spec->stream_name_analog = "ALC269 Analog"; | |
12423 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
12424 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
12425 | ||
12426 | spec->stream_name_digital = "ALC269 Digital"; | |
12427 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | |
12428 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
12429 | ||
12430 | spec->adc_nids = alc269_adc_nids; | |
12431 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
e01bf509 | 12432 | spec->capsrc_nids = alc269_capsrc_nids; |
f9e336f6 TI |
12433 | if (!spec->cap_mixer) |
12434 | set_capture_mixer(spec); | |
f6a92248 KY |
12435 | |
12436 | codec->patch_ops = alc_patch_ops; | |
12437 | if (board_config == ALC269_AUTO) | |
12438 | spec->init_hook = alc269_auto_init; | |
12439 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
12440 | if (!spec->loopback.amplist) | |
12441 | spec->loopback.amplist = alc269_loopbacks; | |
12442 | #endif | |
12443 | ||
12444 | return 0; | |
12445 | } | |
12446 | ||
df694daa KY |
12447 | /* |
12448 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
12449 | */ | |
12450 | ||
12451 | /* | |
12452 | * set the path ways for 2 channel output | |
12453 | * need to set the codec line out and mic 1 pin widgets to inputs | |
12454 | */ | |
12455 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
12456 | /* set pin widget 1Ah (line in) for input */ | |
12457 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
12458 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
12459 | * the vref | |
12460 | */ | |
df694daa KY |
12461 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
12462 | ||
9c7f852e TI |
12463 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
12464 | #if 0 | |
12465 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
12466 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
12467 | #endif | |
df694daa KY |
12468 | { } /* end */ |
12469 | }; | |
12470 | /* | |
12471 | * 6ch mode | |
12472 | * need to set the codec line out and mic 1 pin widgets to outputs | |
12473 | */ | |
12474 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
12475 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
12476 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12477 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
12478 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12479 | ||
12480 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
9c7f852e | 12481 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa | 12482 | |
9c7f852e TI |
12483 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
12484 | #if 0 | |
12485 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
12486 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
12487 | #endif | |
df694daa KY |
12488 | { } /* end */ |
12489 | }; | |
12490 | ||
12491 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
12492 | { 2, alc861_threestack_ch2_init }, | |
12493 | { 6, alc861_threestack_ch6_init }, | |
12494 | }; | |
22309c3e TI |
12495 | /* Set mic1 as input and unmute the mixer */ |
12496 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
12497 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12498 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
12499 | { } /* end */ | |
12500 | }; | |
12501 | /* Set mic1 as output and mute mixer */ | |
12502 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
12503 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12504 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
12505 | { } /* end */ | |
12506 | }; | |
12507 | ||
12508 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
12509 | { 2, alc861_uniwill_m31_ch2_init }, | |
12510 | { 4, alc861_uniwill_m31_ch4_init }, | |
12511 | }; | |
df694daa | 12512 | |
7cdbff94 MD |
12513 | /* Set mic1 and line-in as input and unmute the mixer */ |
12514 | static struct hda_verb alc861_asus_ch2_init[] = { | |
12515 | /* set pin widget 1Ah (line in) for input */ | |
12516 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
12517 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
12518 | * the vref | |
12519 | */ | |
7cdbff94 MD |
12520 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
12521 | ||
12522 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
12523 | #if 0 | |
12524 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
12525 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
12526 | #endif | |
12527 | { } /* end */ | |
12528 | }; | |
12529 | /* Set mic1 nad line-in as output and mute mixer */ | |
12530 | static struct hda_verb alc861_asus_ch6_init[] = { | |
12531 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
12532 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12533 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
12534 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
12535 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12536 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
12537 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12538 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12539 | ||
12540 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
12541 | #if 0 | |
12542 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
12543 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
12544 | #endif | |
12545 | { } /* end */ | |
12546 | }; | |
12547 | ||
12548 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
12549 | { 2, alc861_asus_ch2_init }, | |
12550 | { 6, alc861_asus_ch6_init }, | |
12551 | }; | |
12552 | ||
df694daa KY |
12553 | /* patch-ALC861 */ |
12554 | ||
12555 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
12556 | /* output mixer control */ | |
12557 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12558 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
12559 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
12560 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
12561 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
12562 | ||
12563 | /*Input mixer control */ | |
12564 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
12565 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
12566 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
12567 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12568 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
12569 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
12570 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12571 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
12572 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
12573 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 12574 | |
df694daa KY |
12575 | { } /* end */ |
12576 | }; | |
12577 | ||
12578 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
12579 | /* output mixer control */ | |
12580 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12581 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
12582 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
12583 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
12584 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
12585 | ||
12586 | /* Input mixer control */ | |
12587 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
12588 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
12589 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
12590 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12591 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
12592 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
12593 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12594 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
12595 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
12596 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 12597 | |
df694daa KY |
12598 | { |
12599 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12600 | .name = "Channel Mode", | |
12601 | .info = alc_ch_mode_info, | |
12602 | .get = alc_ch_mode_get, | |
12603 | .put = alc_ch_mode_put, | |
12604 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
12605 | }, | |
12606 | { } /* end */ | |
a53d1aec TD |
12607 | }; |
12608 | ||
d1d985f0 | 12609 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
a53d1aec TD |
12610 | /* output mixer control */ |
12611 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
ea1fb29a | 12614 | |
a53d1aec | 12615 | { } /* end */ |
f12ab1e0 | 12616 | }; |
a53d1aec | 12617 | |
22309c3e TI |
12618 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
12619 | /* output mixer control */ | |
12620 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12621 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
12622 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
12623 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
12624 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
12625 | ||
12626 | /* Input mixer control */ | |
12627 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
12628 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
12629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
12630 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12631 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
12632 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
12633 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12634 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
12635 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
12636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 12637 | |
22309c3e TI |
12638 | { |
12639 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12640 | .name = "Channel Mode", | |
12641 | .info = alc_ch_mode_info, | |
12642 | .get = alc_ch_mode_get, | |
12643 | .put = alc_ch_mode_put, | |
12644 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
12645 | }, | |
12646 | { } /* end */ | |
f12ab1e0 | 12647 | }; |
7cdbff94 MD |
12648 | |
12649 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
12650 | /* output mixer control */ | |
12651 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12652 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
12653 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
12654 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
12655 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
12656 | ||
12657 | /* Input mixer control */ | |
12658 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
12659 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
12660 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
12661 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12662 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
12663 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
12664 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12665 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
12666 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
f12ab1e0 TI |
12667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
12668 | ||
7cdbff94 MD |
12669 | { |
12670 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12671 | .name = "Channel Mode", | |
12672 | .info = alc_ch_mode_info, | |
12673 | .get = alc_ch_mode_get, | |
12674 | .put = alc_ch_mode_put, | |
12675 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
12676 | }, | |
12677 | { } | |
56bb0cab TI |
12678 | }; |
12679 | ||
12680 | /* additional mixer */ | |
d1d985f0 | 12681 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
56bb0cab TI |
12682 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
12683 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12684 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), | |
12685 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), | |
12686 | { } | |
12687 | }; | |
7cdbff94 | 12688 | |
df694daa KY |
12689 | /* |
12690 | * generic initialization of ADC, input mixers and output mixers | |
12691 | */ | |
12692 | static struct hda_verb alc861_base_init_verbs[] = { | |
12693 | /* | |
12694 | * Unmute ADC0 and set the default input to mic-in | |
12695 | */ | |
12696 | /* port-A for surround (rear panel) */ | |
12697 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12698 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12699 | /* port-B for mic-in (rear panel) with vref */ | |
12700 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12701 | /* port-C for line-in (rear panel) */ | |
12702 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12703 | /* port-D for Front */ | |
12704 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12705 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12706 | /* port-E for HP out (front panel) */ | |
12707 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
12708 | /* route front PCM to HP */ | |
9dece1d7 | 12709 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
12710 | /* port-F for mic-in (front panel) with vref */ |
12711 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12712 | /* port-G for CLFE (rear panel) */ | |
12713 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12714 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12715 | /* port-H for side (rear panel) */ | |
12716 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12717 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12718 | /* CD-in */ | |
12719 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12720 | /* route front mic to ADC1*/ | |
12721 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12722 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 12723 | |
df694daa KY |
12724 | /* Unmute DAC0~3 & spdif out*/ |
12725 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12726 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12727 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12728 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12729 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 12730 | |
df694daa KY |
12731 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12732 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12733 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12734 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12735 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12736 | |
df694daa KY |
12737 | /* Unmute Stereo Mixer 15 */ |
12738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12739 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12740 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 12741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
12742 | |
12743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12744 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12745 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12746 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12747 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12749 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12750 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
12751 | /* hp used DAC 3 (Front) */ |
12752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
12753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12754 | ||
12755 | { } | |
12756 | }; | |
12757 | ||
12758 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
12759 | /* | |
12760 | * Unmute ADC0 and set the default input to mic-in | |
12761 | */ | |
12762 | /* port-A for surround (rear panel) */ | |
12763 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12764 | /* port-B for mic-in (rear panel) with vref */ | |
12765 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12766 | /* port-C for line-in (rear panel) */ | |
12767 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12768 | /* port-D for Front */ | |
12769 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12770 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12771 | /* port-E for HP out (front panel) */ | |
12772 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
12773 | /* route front PCM to HP */ | |
9dece1d7 | 12774 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
12775 | /* port-F for mic-in (front panel) with vref */ |
12776 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12777 | /* port-G for CLFE (rear panel) */ | |
12778 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12779 | /* port-H for side (rear panel) */ | |
12780 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12781 | /* CD-in */ | |
12782 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12783 | /* route front mic to ADC1*/ | |
12784 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12785 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12786 | /* Unmute DAC0~3 & spdif out*/ | |
12787 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12788 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12789 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12790 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 12792 | |
df694daa KY |
12793 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12794 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12795 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12796 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12797 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12798 | |
df694daa KY |
12799 | /* Unmute Stereo Mixer 15 */ |
12800 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12802 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 12803 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
12804 | |
12805 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12806 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12807 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12808 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12809 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12810 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12811 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12812 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
12813 | /* hp used DAC 3 (Front) */ |
12814 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
12815 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12816 | { } | |
12817 | }; | |
22309c3e TI |
12818 | |
12819 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
12820 | /* | |
12821 | * Unmute ADC0 and set the default input to mic-in | |
12822 | */ | |
12823 | /* port-A for surround (rear panel) */ | |
12824 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12825 | /* port-B for mic-in (rear panel) with vref */ | |
12826 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12827 | /* port-C for line-in (rear panel) */ | |
12828 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12829 | /* port-D for Front */ | |
12830 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12831 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12832 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
12833 | /* this has to be set to VREF80 */ |
12834 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
22309c3e | 12835 | /* route front PCM to HP */ |
9dece1d7 | 12836 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
22309c3e TI |
12837 | /* port-F for mic-in (front panel) with vref */ |
12838 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12839 | /* port-G for CLFE (rear panel) */ | |
12840 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12841 | /* port-H for side (rear panel) */ | |
12842 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12843 | /* CD-in */ | |
12844 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12845 | /* route front mic to ADC1*/ | |
12846 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12847 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12848 | /* Unmute DAC0~3 & spdif out*/ | |
12849 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12850 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12851 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12852 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 12854 | |
22309c3e TI |
12855 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12856 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12857 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12858 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12859 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12860 | |
22309c3e TI |
12861 | /* Unmute Stereo Mixer 15 */ |
12862 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12863 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 12865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
22309c3e TI |
12866 | |
12867 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12868 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12869 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12870 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12871 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12872 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12873 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12874 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
12875 | /* hp used DAC 3 (Front) */ |
12876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
22309c3e TI |
12877 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12878 | { } | |
12879 | }; | |
12880 | ||
7cdbff94 MD |
12881 | static struct hda_verb alc861_asus_init_verbs[] = { |
12882 | /* | |
12883 | * Unmute ADC0 and set the default input to mic-in | |
12884 | */ | |
f12ab1e0 TI |
12885 | /* port-A for surround (rear panel) |
12886 | * according to codec#0 this is the HP jack | |
12887 | */ | |
7cdbff94 MD |
12888 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
12889 | /* route front PCM to HP */ | |
12890 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
12891 | /* port-B for mic-in (rear panel) with vref */ | |
12892 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12893 | /* port-C for line-in (rear panel) */ | |
12894 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12895 | /* port-D for Front */ | |
12896 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12897 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12898 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
12899 | /* this has to be set to VREF80 */ |
12900 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7cdbff94 | 12901 | /* route front PCM to HP */ |
9dece1d7 | 12902 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7cdbff94 MD |
12903 | /* port-F for mic-in (front panel) with vref */ |
12904 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12905 | /* port-G for CLFE (rear panel) */ | |
12906 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12907 | /* port-H for side (rear panel) */ | |
12908 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12909 | /* CD-in */ | |
12910 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12911 | /* route front mic to ADC1*/ | |
12912 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12913 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12914 | /* Unmute DAC0~3 & spdif out*/ | |
12915 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12916 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12917 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12918 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12919 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12920 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
12921 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12922 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12923 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12924 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12925 | |
7cdbff94 MD |
12926 | /* Unmute Stereo Mixer 15 */ |
12927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 12930 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
7cdbff94 MD |
12931 | |
12932 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12933 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12934 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12935 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12936 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12937 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12938 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12939 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
12940 | /* hp used DAC 3 (Front) */ |
12941 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7cdbff94 MD |
12942 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12943 | { } | |
12944 | }; | |
12945 | ||
56bb0cab TI |
12946 | /* additional init verbs for ASUS laptops */ |
12947 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
12948 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
12949 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
12950 | { } | |
12951 | }; | |
7cdbff94 | 12952 | |
df694daa KY |
12953 | /* |
12954 | * generic initialization of ADC, input mixers and output mixers | |
12955 | */ | |
12956 | static struct hda_verb alc861_auto_init_verbs[] = { | |
12957 | /* | |
12958 | * Unmute ADC0 and set the default input to mic-in | |
12959 | */ | |
f12ab1e0 | 12960 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
df694daa | 12961 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
ea1fb29a | 12962 | |
df694daa KY |
12963 | /* Unmute DAC0~3 & spdif out*/ |
12964 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12965 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12966 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12967 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 12969 | |
df694daa KY |
12970 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12971 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12972 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12973 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12974 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12975 | |
df694daa KY |
12976 | /* Unmute Stereo Mixer 15 */ |
12977 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12978 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12979 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
12980 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
12981 | ||
12982 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12983 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12984 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12985 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12986 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12987 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12988 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12989 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12990 | ||
12991 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12992 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
f12ab1e0 TI |
12993 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12994 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
12995 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
12996 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
f12ab1e0 TI |
12997 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12998 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa | 12999 | |
f12ab1e0 | 13000 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
df694daa KY |
13001 | |
13002 | { } | |
13003 | }; | |
13004 | ||
a53d1aec TD |
13005 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
13006 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f12ab1e0 | 13007 | |
a53d1aec TD |
13008 | { } |
13009 | }; | |
13010 | ||
13011 | /* toggle speaker-output according to the hp-jack state */ | |
13012 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
13013 | { | |
13014 | unsigned int present; | |
13015 | ||
13016 | present = snd_hda_codec_read(codec, 0x0f, 0, | |
13017 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
13018 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
13019 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
13020 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
13021 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
a53d1aec TD |
13022 | } |
13023 | ||
13024 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
13025 | unsigned int res) | |
13026 | { | |
a53d1aec TD |
13027 | if ((res >> 26) == ALC880_HP_EVENT) |
13028 | alc861_toshiba_automute(codec); | |
13029 | } | |
13030 | ||
df694daa KY |
13031 | /* pcm configuration: identiacal with ALC880 */ |
13032 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback | |
13033 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
13034 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
13035 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
13036 | ||
13037 | ||
13038 | #define ALC861_DIGOUT_NID 0x07 | |
13039 | ||
13040 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
13041 | { 8, NULL } | |
13042 | }; | |
13043 | ||
13044 | static hda_nid_t alc861_dac_nids[4] = { | |
13045 | /* front, surround, clfe, side */ | |
13046 | 0x03, 0x06, 0x05, 0x04 | |
13047 | }; | |
13048 | ||
9c7f852e TI |
13049 | static hda_nid_t alc660_dac_nids[3] = { |
13050 | /* front, clfe, surround */ | |
13051 | 0x03, 0x05, 0x06 | |
13052 | }; | |
13053 | ||
df694daa KY |
13054 | static hda_nid_t alc861_adc_nids[1] = { |
13055 | /* ADC0-2 */ | |
13056 | 0x08, | |
13057 | }; | |
13058 | ||
13059 | static struct hda_input_mux alc861_capture_source = { | |
13060 | .num_items = 5, | |
13061 | .items = { | |
13062 | { "Mic", 0x0 }, | |
13063 | { "Front Mic", 0x3 }, | |
13064 | { "Line", 0x1 }, | |
13065 | { "CD", 0x4 }, | |
13066 | { "Mixer", 0x5 }, | |
13067 | }, | |
13068 | }; | |
13069 | ||
13070 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
13071 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
13072 | const struct auto_pin_cfg *cfg) | |
df694daa KY |
13073 | { |
13074 | int i; | |
13075 | hda_nid_t nid; | |
13076 | ||
13077 | spec->multiout.dac_nids = spec->private_dac_nids; | |
13078 | for (i = 0; i < cfg->line_outs; i++) { | |
13079 | nid = cfg->line_out_pins[i]; | |
13080 | if (nid) { | |
13081 | if (i >= ARRAY_SIZE(alc861_dac_nids)) | |
13082 | continue; | |
13083 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; | |
13084 | } | |
13085 | } | |
13086 | spec->multiout.num_dacs = cfg->line_outs; | |
13087 | return 0; | |
13088 | } | |
13089 | ||
13090 | /* add playback controls from the parsed DAC table */ | |
13091 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, | |
13092 | const struct auto_pin_cfg *cfg) | |
13093 | { | |
13094 | char name[32]; | |
f12ab1e0 TI |
13095 | static const char *chname[4] = { |
13096 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
13097 | }; | |
df694daa KY |
13098 | hda_nid_t nid; |
13099 | int i, idx, err; | |
13100 | ||
13101 | for (i = 0; i < cfg->line_outs; i++) { | |
13102 | nid = spec->multiout.dac_nids[i]; | |
f12ab1e0 | 13103 | if (!nid) |
df694daa KY |
13104 | continue; |
13105 | if (nid == 0x05) { | |
13106 | /* Center/LFE */ | |
f12ab1e0 TI |
13107 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
13108 | "Center Playback Switch", | |
13109 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
13110 | HDA_OUTPUT)); | |
13111 | if (err < 0) | |
df694daa | 13112 | return err; |
f12ab1e0 TI |
13113 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
13114 | "LFE Playback Switch", | |
13115 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
13116 | HDA_OUTPUT)); | |
13117 | if (err < 0) | |
df694daa KY |
13118 | return err; |
13119 | } else { | |
f12ab1e0 TI |
13120 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
13121 | idx++) | |
df694daa KY |
13122 | if (nid == alc861_dac_nids[idx]) |
13123 | break; | |
13124 | sprintf(name, "%s Playback Switch", chname[idx]); | |
f12ab1e0 TI |
13125 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
13126 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
13127 | HDA_OUTPUT)); | |
13128 | if (err < 0) | |
df694daa KY |
13129 | return err; |
13130 | } | |
13131 | } | |
13132 | return 0; | |
13133 | } | |
13134 | ||
13135 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | |
13136 | { | |
13137 | int err; | |
13138 | hda_nid_t nid; | |
13139 | ||
f12ab1e0 | 13140 | if (!pin) |
df694daa KY |
13141 | return 0; |
13142 | ||
13143 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
13144 | nid = 0x03; | |
f12ab1e0 TI |
13145 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
13146 | "Headphone Playback Switch", | |
13147 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
13148 | if (err < 0) | |
df694daa KY |
13149 | return err; |
13150 | spec->multiout.hp_nid = nid; | |
13151 | } | |
13152 | return 0; | |
13153 | } | |
13154 | ||
13155 | /* create playback/capture controls for input pins */ | |
f12ab1e0 TI |
13156 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
13157 | const struct auto_pin_cfg *cfg) | |
df694daa | 13158 | { |
df694daa KY |
13159 | struct hda_input_mux *imux = &spec->private_imux; |
13160 | int i, err, idx, idx1; | |
13161 | ||
13162 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
f12ab1e0 | 13163 | switch (cfg->input_pins[i]) { |
df694daa KY |
13164 | case 0x0c: |
13165 | idx1 = 1; | |
f12ab1e0 | 13166 | idx = 2; /* Line In */ |
df694daa KY |
13167 | break; |
13168 | case 0x0f: | |
13169 | idx1 = 2; | |
f12ab1e0 | 13170 | idx = 2; /* Line In */ |
df694daa KY |
13171 | break; |
13172 | case 0x0d: | |
13173 | idx1 = 0; | |
f12ab1e0 | 13174 | idx = 1; /* Mic In */ |
df694daa | 13175 | break; |
f12ab1e0 | 13176 | case 0x10: |
df694daa | 13177 | idx1 = 3; |
f12ab1e0 | 13178 | idx = 1; /* Mic In */ |
df694daa KY |
13179 | break; |
13180 | case 0x11: | |
13181 | idx1 = 4; | |
f12ab1e0 | 13182 | idx = 0; /* CD */ |
df694daa KY |
13183 | break; |
13184 | default: | |
13185 | continue; | |
13186 | } | |
13187 | ||
4a471b7d TI |
13188 | err = new_analog_input(spec, cfg->input_pins[i], |
13189 | auto_pin_cfg_labels[i], idx, 0x15); | |
df694daa KY |
13190 | if (err < 0) |
13191 | return err; | |
13192 | ||
4a471b7d | 13193 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
df694daa | 13194 | imux->items[imux->num_items].index = idx1; |
f12ab1e0 | 13195 | imux->num_items++; |
df694daa KY |
13196 | } |
13197 | return 0; | |
13198 | } | |
13199 | ||
f12ab1e0 TI |
13200 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
13201 | hda_nid_t nid, | |
df694daa KY |
13202 | int pin_type, int dac_idx) |
13203 | { | |
564c5bea JL |
13204 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
13205 | pin_type); | |
13206 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13207 | AMP_OUT_UNMUTE); | |
df694daa KY |
13208 | } |
13209 | ||
13210 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
13211 | { | |
13212 | struct alc_spec *spec = codec->spec; | |
13213 | int i; | |
13214 | ||
bc9f98a9 | 13215 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
df694daa KY |
13216 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
13217 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 13218 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 13219 | if (nid) |
baba8ee9 | 13220 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 13221 | spec->multiout.dac_nids[i]); |
df694daa KY |
13222 | } |
13223 | } | |
13224 | ||
13225 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
13226 | { | |
13227 | struct alc_spec *spec = codec->spec; | |
13228 | hda_nid_t pin; | |
13229 | ||
eb06ed8f | 13230 | pin = spec->autocfg.hp_pins[0]; |
df694daa | 13231 | if (pin) /* connect to front */ |
f12ab1e0 TI |
13232 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
13233 | spec->multiout.dac_nids[0]); | |
f6c7e546 TI |
13234 | pin = spec->autocfg.speaker_pins[0]; |
13235 | if (pin) | |
13236 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
df694daa KY |
13237 | } |
13238 | ||
13239 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
13240 | { | |
13241 | struct alc_spec *spec = codec->spec; | |
13242 | int i; | |
13243 | ||
13244 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
13245 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
f12ab1e0 TI |
13246 | if (nid >= 0x0c && nid <= 0x11) { |
13247 | snd_hda_codec_write(codec, nid, 0, | |
13248 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
13249 | i <= AUTO_PIN_FRONT_MIC ? | |
13250 | PIN_VREF80 : PIN_IN); | |
df694daa KY |
13251 | } |
13252 | } | |
13253 | } | |
13254 | ||
13255 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
13256 | /* return 1 if successful, 0 if the proper config is not found, |
13257 | * or a negative error code | |
13258 | */ | |
df694daa KY |
13259 | static int alc861_parse_auto_config(struct hda_codec *codec) |
13260 | { | |
13261 | struct alc_spec *spec = codec->spec; | |
13262 | int err; | |
13263 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
13264 | ||
f12ab1e0 TI |
13265 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
13266 | alc861_ignore); | |
13267 | if (err < 0) | |
df694daa | 13268 | return err; |
f12ab1e0 | 13269 | if (!spec->autocfg.line_outs) |
df694daa KY |
13270 | return 0; /* can't find valid BIOS pin config */ |
13271 | ||
f12ab1e0 TI |
13272 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
13273 | if (err < 0) | |
13274 | return err; | |
13275 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
13276 | if (err < 0) | |
13277 | return err; | |
13278 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); | |
13279 | if (err < 0) | |
13280 | return err; | |
13281 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
13282 | if (err < 0) | |
df694daa KY |
13283 | return err; |
13284 | ||
13285 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
13286 | ||
13287 | if (spec->autocfg.dig_out_pin) | |
13288 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; | |
13289 | ||
603c4019 | 13290 | if (spec->kctls.list) |
d88897ea | 13291 | add_mixer(spec, spec->kctls.list); |
df694daa | 13292 | |
d88897ea | 13293 | add_verb(spec, alc861_auto_init_verbs); |
df694daa | 13294 | |
a1e8d2da | 13295 | spec->num_mux_defs = 1; |
df694daa KY |
13296 | spec->input_mux = &spec->private_imux; |
13297 | ||
13298 | spec->adc_nids = alc861_adc_nids; | |
13299 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
f9e336f6 | 13300 | set_capture_mixer(spec); |
df694daa | 13301 | |
e044c39a | 13302 | store_pin_configs(codec); |
df694daa KY |
13303 | return 1; |
13304 | } | |
13305 | ||
ae6b813a TI |
13306 | /* additional initialization for auto-configuration model */ |
13307 | static void alc861_auto_init(struct hda_codec *codec) | |
df694daa | 13308 | { |
f6c7e546 | 13309 | struct alc_spec *spec = codec->spec; |
df694daa KY |
13310 | alc861_auto_init_multi_out(codec); |
13311 | alc861_auto_init_hp_out(codec); | |
13312 | alc861_auto_init_analog_input(codec); | |
f6c7e546 | 13313 | if (spec->unsol_event) |
7fb0d78f | 13314 | alc_inithook(codec); |
df694daa KY |
13315 | } |
13316 | ||
cb53c626 TI |
13317 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
13318 | static struct hda_amp_list alc861_loopbacks[] = { | |
13319 | { 0x15, HDA_INPUT, 0 }, | |
13320 | { 0x15, HDA_INPUT, 1 }, | |
13321 | { 0x15, HDA_INPUT, 2 }, | |
13322 | { 0x15, HDA_INPUT, 3 }, | |
13323 | { } /* end */ | |
13324 | }; | |
13325 | #endif | |
13326 | ||
df694daa KY |
13327 | |
13328 | /* | |
13329 | * configuration and preset | |
13330 | */ | |
f5fcc13c TI |
13331 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
13332 | [ALC861_3ST] = "3stack", | |
13333 | [ALC660_3ST] = "3stack-660", | |
13334 | [ALC861_3ST_DIG] = "3stack-dig", | |
13335 | [ALC861_6ST_DIG] = "6stack-dig", | |
13336 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
13337 | [ALC861_TOSHIBA] = "toshiba", | |
13338 | [ALC861_ASUS] = "asus", | |
13339 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
13340 | [ALC861_AUTO] = "auto", | |
13341 | }; | |
13342 | ||
13343 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
687a47bd | 13344 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
f5fcc13c TI |
13345 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
13346 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
13347 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
ac3e3741 | 13348 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
83c34218 | 13349 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
ad5e7737 | 13350 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
341d4eb0 TI |
13351 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
13352 | * Any other models that need this preset? | |
13353 | */ | |
13354 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
ac3e3741 TI |
13355 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
13356 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
4147dab6 | 13357 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
ac3e3741 TI |
13358 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
13359 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
13360 | /* FIXME: the below seems conflict */ | |
13361 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
07e038b3 | 13362 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
f5fcc13c | 13363 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
df694daa KY |
13364 | {} |
13365 | }; | |
13366 | ||
13367 | static struct alc_config_preset alc861_presets[] = { | |
13368 | [ALC861_3ST] = { | |
13369 | .mixers = { alc861_3ST_mixer }, | |
13370 | .init_verbs = { alc861_threestack_init_verbs }, | |
13371 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13372 | .dac_nids = alc861_dac_nids, | |
13373 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
13374 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 13375 | .need_dac_fix = 1, |
df694daa KY |
13376 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
13377 | .adc_nids = alc861_adc_nids, | |
13378 | .input_mux = &alc861_capture_source, | |
13379 | }, | |
13380 | [ALC861_3ST_DIG] = { | |
13381 | .mixers = { alc861_base_mixer }, | |
13382 | .init_verbs = { alc861_threestack_init_verbs }, | |
13383 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13384 | .dac_nids = alc861_dac_nids, | |
13385 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13386 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
13387 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 13388 | .need_dac_fix = 1, |
df694daa KY |
13389 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
13390 | .adc_nids = alc861_adc_nids, | |
13391 | .input_mux = &alc861_capture_source, | |
13392 | }, | |
13393 | [ALC861_6ST_DIG] = { | |
13394 | .mixers = { alc861_base_mixer }, | |
13395 | .init_verbs = { alc861_base_init_verbs }, | |
13396 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13397 | .dac_nids = alc861_dac_nids, | |
13398 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13399 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
13400 | .channel_mode = alc861_8ch_modes, | |
13401 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13402 | .adc_nids = alc861_adc_nids, | |
13403 | .input_mux = &alc861_capture_source, | |
13404 | }, | |
9c7f852e TI |
13405 | [ALC660_3ST] = { |
13406 | .mixers = { alc861_3ST_mixer }, | |
13407 | .init_verbs = { alc861_threestack_init_verbs }, | |
13408 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
13409 | .dac_nids = alc660_dac_nids, | |
13410 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
13411 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 13412 | .need_dac_fix = 1, |
9c7f852e TI |
13413 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
13414 | .adc_nids = alc861_adc_nids, | |
13415 | .input_mux = &alc861_capture_source, | |
13416 | }, | |
22309c3e TI |
13417 | [ALC861_UNIWILL_M31] = { |
13418 | .mixers = { alc861_uniwill_m31_mixer }, | |
13419 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
13420 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13421 | .dac_nids = alc861_dac_nids, | |
13422 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13423 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
13424 | .channel_mode = alc861_uniwill_m31_modes, | |
13425 | .need_dac_fix = 1, | |
13426 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13427 | .adc_nids = alc861_adc_nids, | |
13428 | .input_mux = &alc861_capture_source, | |
13429 | }, | |
a53d1aec TD |
13430 | [ALC861_TOSHIBA] = { |
13431 | .mixers = { alc861_toshiba_mixer }, | |
f12ab1e0 TI |
13432 | .init_verbs = { alc861_base_init_verbs, |
13433 | alc861_toshiba_init_verbs }, | |
a53d1aec TD |
13434 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
13435 | .dac_nids = alc861_dac_nids, | |
13436 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
13437 | .channel_mode = alc883_3ST_2ch_modes, | |
13438 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13439 | .adc_nids = alc861_adc_nids, | |
13440 | .input_mux = &alc861_capture_source, | |
13441 | .unsol_event = alc861_toshiba_unsol_event, | |
13442 | .init_hook = alc861_toshiba_automute, | |
13443 | }, | |
7cdbff94 MD |
13444 | [ALC861_ASUS] = { |
13445 | .mixers = { alc861_asus_mixer }, | |
13446 | .init_verbs = { alc861_asus_init_verbs }, | |
13447 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13448 | .dac_nids = alc861_dac_nids, | |
13449 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13450 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
13451 | .channel_mode = alc861_asus_modes, | |
13452 | .need_dac_fix = 1, | |
13453 | .hp_nid = 0x06, | |
13454 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13455 | .adc_nids = alc861_adc_nids, | |
13456 | .input_mux = &alc861_capture_source, | |
13457 | }, | |
56bb0cab TI |
13458 | [ALC861_ASUS_LAPTOP] = { |
13459 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
13460 | .init_verbs = { alc861_asus_init_verbs, | |
13461 | alc861_asus_laptop_init_verbs }, | |
13462 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13463 | .dac_nids = alc861_dac_nids, | |
13464 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13465 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
13466 | .channel_mode = alc883_3ST_2ch_modes, | |
13467 | .need_dac_fix = 1, | |
13468 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13469 | .adc_nids = alc861_adc_nids, | |
13470 | .input_mux = &alc861_capture_source, | |
13471 | }, | |
13472 | }; | |
df694daa KY |
13473 | |
13474 | ||
13475 | static int patch_alc861(struct hda_codec *codec) | |
13476 | { | |
13477 | struct alc_spec *spec; | |
13478 | int board_config; | |
13479 | int err; | |
13480 | ||
dc041e0b | 13481 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
13482 | if (spec == NULL) |
13483 | return -ENOMEM; | |
13484 | ||
f12ab1e0 | 13485 | codec->spec = spec; |
df694daa | 13486 | |
f5fcc13c TI |
13487 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
13488 | alc861_models, | |
13489 | alc861_cfg_tbl); | |
9c7f852e | 13490 | |
f5fcc13c | 13491 | if (board_config < 0) { |
9c7f852e TI |
13492 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
13493 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
13494 | board_config = ALC861_AUTO; |
13495 | } | |
13496 | ||
13497 | if (board_config == ALC861_AUTO) { | |
13498 | /* automatic parse from the BIOS config */ | |
13499 | err = alc861_parse_auto_config(codec); | |
13500 | if (err < 0) { | |
13501 | alc_free(codec); | |
13502 | return err; | |
f12ab1e0 | 13503 | } else if (!err) { |
9c7f852e TI |
13504 | printk(KERN_INFO |
13505 | "hda_codec: Cannot set up configuration " | |
13506 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
13507 | board_config = ALC861_3ST_DIG; |
13508 | } | |
13509 | } | |
13510 | ||
13511 | if (board_config != ALC861_AUTO) | |
13512 | setup_preset(spec, &alc861_presets[board_config]); | |
13513 | ||
13514 | spec->stream_name_analog = "ALC861 Analog"; | |
13515 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | |
13516 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
13517 | ||
13518 | spec->stream_name_digital = "ALC861 Digital"; | |
13519 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | |
13520 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
13521 | ||
2134ea4f TI |
13522 | spec->vmaster_nid = 0x03; |
13523 | ||
df694daa KY |
13524 | codec->patch_ops = alc_patch_ops; |
13525 | if (board_config == ALC861_AUTO) | |
ae6b813a | 13526 | spec->init_hook = alc861_auto_init; |
cb53c626 TI |
13527 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
13528 | if (!spec->loopback.amplist) | |
13529 | spec->loopback.amplist = alc861_loopbacks; | |
13530 | #endif | |
ea1fb29a | 13531 | |
1da177e4 LT |
13532 | return 0; |
13533 | } | |
13534 | ||
f32610ed JS |
13535 | /* |
13536 | * ALC861-VD support | |
13537 | * | |
13538 | * Based on ALC882 | |
13539 | * | |
13540 | * In addition, an independent DAC | |
13541 | */ | |
13542 | #define ALC861VD_DIGOUT_NID 0x06 | |
13543 | ||
13544 | static hda_nid_t alc861vd_dac_nids[4] = { | |
13545 | /* front, surr, clfe, side surr */ | |
13546 | 0x02, 0x03, 0x04, 0x05 | |
13547 | }; | |
13548 | ||
13549 | /* dac_nids for ALC660vd are in a different order - according to | |
13550 | * Realtek's driver. | |
13551 | * This should probably tesult in a different mixer for 6stack models | |
13552 | * of ALC660vd codecs, but for now there is only 3stack mixer | |
13553 | * - and it is the same as in 861vd. | |
13554 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
13555 | */ | |
13556 | static hda_nid_t alc660vd_dac_nids[3] = { | |
13557 | /* front, rear, clfe, rear_surr */ | |
13558 | 0x02, 0x04, 0x03 | |
13559 | }; | |
13560 | ||
13561 | static hda_nid_t alc861vd_adc_nids[1] = { | |
13562 | /* ADC0 */ | |
13563 | 0x09, | |
13564 | }; | |
13565 | ||
e1406348 TI |
13566 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
13567 | ||
f32610ed JS |
13568 | /* input MUX */ |
13569 | /* FIXME: should be a matrix-type input source selection */ | |
13570 | static struct hda_input_mux alc861vd_capture_source = { | |
13571 | .num_items = 4, | |
13572 | .items = { | |
13573 | { "Mic", 0x0 }, | |
13574 | { "Front Mic", 0x1 }, | |
13575 | { "Line", 0x2 }, | |
13576 | { "CD", 0x4 }, | |
13577 | }, | |
13578 | }; | |
13579 | ||
272a527c | 13580 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
b419f346 | 13581 | .num_items = 2, |
272a527c | 13582 | .items = { |
b419f346 TD |
13583 | { "Ext Mic", 0x0 }, |
13584 | { "Int Mic", 0x1 }, | |
272a527c KY |
13585 | }, |
13586 | }; | |
13587 | ||
d1a991a6 KY |
13588 | static struct hda_input_mux alc861vd_hp_capture_source = { |
13589 | .num_items = 2, | |
13590 | .items = { | |
13591 | { "Front Mic", 0x0 }, | |
13592 | { "ATAPI Mic", 0x1 }, | |
13593 | }, | |
13594 | }; | |
13595 | ||
f32610ed JS |
13596 | /* |
13597 | * 2ch mode | |
13598 | */ | |
13599 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
13600 | { 2, NULL } | |
13601 | }; | |
13602 | ||
13603 | /* | |
13604 | * 6ch mode | |
13605 | */ | |
13606 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
13607 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
13608 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13609 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13610 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13611 | { } /* end */ | |
13612 | }; | |
13613 | ||
13614 | /* | |
13615 | * 8ch mode | |
13616 | */ | |
13617 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
13618 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13619 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13620 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13621 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13622 | { } /* end */ | |
13623 | }; | |
13624 | ||
13625 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
13626 | { 6, alc861vd_6stack_ch6_init }, | |
13627 | { 8, alc861vd_6stack_ch8_init }, | |
13628 | }; | |
13629 | ||
13630 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
13631 | { | |
13632 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13633 | .name = "Channel Mode", | |
13634 | .info = alc_ch_mode_info, | |
13635 | .get = alc_ch_mode_get, | |
13636 | .put = alc_ch_mode_put, | |
13637 | }, | |
13638 | { } /* end */ | |
13639 | }; | |
13640 | ||
f32610ed JS |
13641 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
13642 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
13643 | */ | |
13644 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
13645 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13646 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
13647 | ||
13648 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13649 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
13650 | ||
13651 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
13652 | HDA_OUTPUT), | |
13653 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
13654 | HDA_OUTPUT), | |
13655 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
13656 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
13657 | ||
13658 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
13659 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
13660 | ||
13661 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
13662 | ||
13663 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13664 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13665 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13666 | ||
13667 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13668 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13669 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13670 | ||
13671 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13672 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13673 | ||
13674 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
13675 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
13676 | ||
13677 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
13678 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
13679 | ||
13680 | { } /* end */ | |
13681 | }; | |
13682 | ||
13683 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
13684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13685 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
13686 | ||
13687 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
13688 | ||
13689 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13692 | ||
13693 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13694 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13695 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13696 | ||
13697 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13698 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13699 | ||
13700 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
13701 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
13702 | ||
13703 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
13704 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
13705 | ||
13706 | { } /* end */ | |
13707 | }; | |
13708 | ||
bdd148a3 KY |
13709 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
13710 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13711 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
13712 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13713 | ||
13714 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
13715 | ||
13716 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13717 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13718 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13719 | ||
13720 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13721 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13722 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13723 | ||
13724 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
13725 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
13726 | ||
13727 | { } /* end */ | |
13728 | }; | |
13729 | ||
b419f346 TD |
13730 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
13731 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
272a527c KY |
13732 | */ |
13733 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
b419f346 TD |
13734 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
13735 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
272a527c KY |
13736 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
13737 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
b419f346 TD |
13738 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
13739 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13740 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13741 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
13742 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13743 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13744 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), | |
13745 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), | |
272a527c KY |
13746 | { } /* end */ |
13747 | }; | |
13748 | ||
d1a991a6 KY |
13749 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
13750 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
13751 | */ | |
13752 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
13753 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13754 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
13755 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13756 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
13757 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13758 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13759 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13760 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ea1fb29a | 13761 | |
d1a991a6 KY |
13762 | { } /* end */ |
13763 | }; | |
13764 | ||
f32610ed JS |
13765 | /* |
13766 | * generic initialization of ADC, input mixers and output mixers | |
13767 | */ | |
13768 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
13769 | /* | |
13770 | * Unmute ADC0 and set the default input to mic-in | |
13771 | */ | |
13772 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13773 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13774 | ||
13775 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
13776 | * the analog-loopback mixer widget | |
13777 | */ | |
13778 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
13779 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13780 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13781 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
13782 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
13783 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
f32610ed JS |
13784 | |
13785 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
bdd148a3 KY |
13786 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
13787 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13788 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f32610ed | 13789 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
f32610ed JS |
13790 | |
13791 | /* | |
13792 | * Set up output mixers (0x02 - 0x05) | |
13793 | */ | |
13794 | /* set vol=0 to output mixers */ | |
13795 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13796 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13797 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13798 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13799 | ||
13800 | /* set up input amps for analog loopback */ | |
13801 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
13802 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13803 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13804 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13805 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13806 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13807 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13808 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13809 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13810 | ||
13811 | { } | |
13812 | }; | |
13813 | ||
13814 | /* | |
13815 | * 3-stack pin configuration: | |
13816 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
13817 | */ | |
13818 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
13819 | /* | |
13820 | * Set pin mode and muting | |
13821 | */ | |
13822 | /* set front pin widgets 0x14 for output */ | |
13823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13824 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13825 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13826 | ||
13827 | /* Mic (rear) pin: input vref at 80% */ | |
13828 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13829 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13830 | /* Front Mic pin: input vref at 80% */ | |
13831 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13832 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13833 | /* Line In pin: input */ | |
13834 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13835 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13836 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
13837 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13838 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13839 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13840 | /* CD pin widget for input */ | |
13841 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13842 | ||
13843 | { } | |
13844 | }; | |
13845 | ||
13846 | /* | |
13847 | * 6-stack pin configuration: | |
13848 | */ | |
13849 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
13850 | /* | |
13851 | * Set pin mode and muting | |
13852 | */ | |
13853 | /* set front pin widgets 0x14 for output */ | |
13854 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13855 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13856 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13857 | ||
13858 | /* Rear Pin: output 1 (0x0d) */ | |
13859 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13860 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13861 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13862 | /* CLFE Pin: output 2 (0x0e) */ | |
13863 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13864 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13865 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
13866 | /* Side Pin: output 3 (0x0f) */ | |
13867 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13868 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13869 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
13870 | ||
13871 | /* Mic (rear) pin: input vref at 80% */ | |
13872 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13873 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13874 | /* Front Mic pin: input vref at 80% */ | |
13875 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13876 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13877 | /* Line In pin: input */ | |
13878 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13879 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13880 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
13881 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13882 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13883 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13884 | /* CD pin widget for input */ | |
13885 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13886 | ||
13887 | { } | |
13888 | }; | |
13889 | ||
bdd148a3 KY |
13890 | static struct hda_verb alc861vd_eapd_verbs[] = { |
13891 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13892 | { } | |
13893 | }; | |
13894 | ||
f9423e7a KY |
13895 | static struct hda_verb alc660vd_eapd_verbs[] = { |
13896 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13897 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13898 | { } | |
13899 | }; | |
13900 | ||
bdd148a3 KY |
13901 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
13902 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13904 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
13905 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
ea1fb29a | 13906 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
bdd148a3 KY |
13907 | {} |
13908 | }; | |
13909 | ||
13910 | /* toggle speaker-output according to the hp-jack state */ | |
13911 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) | |
13912 | { | |
13913 | unsigned int present; | |
13914 | unsigned char bits; | |
13915 | ||
13916 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
13917 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
13918 | bits = present ? HDA_AMP_MUTE : 0; |
13919 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
13920 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
13921 | } |
13922 | ||
13923 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | |
13924 | { | |
13925 | unsigned int present; | |
13926 | unsigned char bits; | |
13927 | ||
13928 | present = snd_hda_codec_read(codec, 0x18, 0, | |
13929 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
13930 | bits = present ? HDA_AMP_MUTE : 0; |
13931 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
13932 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
13933 | } |
13934 | ||
13935 | static void alc861vd_lenovo_automute(struct hda_codec *codec) | |
13936 | { | |
13937 | alc861vd_lenovo_hp_automute(codec); | |
13938 | alc861vd_lenovo_mic_automute(codec); | |
13939 | } | |
13940 | ||
13941 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
13942 | unsigned int res) | |
13943 | { | |
13944 | switch (res >> 26) { | |
13945 | case ALC880_HP_EVENT: | |
13946 | alc861vd_lenovo_hp_automute(codec); | |
13947 | break; | |
13948 | case ALC880_MIC_EVENT: | |
13949 | alc861vd_lenovo_mic_automute(codec); | |
13950 | break; | |
13951 | } | |
13952 | } | |
13953 | ||
272a527c KY |
13954 | static struct hda_verb alc861vd_dallas_verbs[] = { |
13955 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13956 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13957 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13958 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13959 | ||
13960 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13961 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13962 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13963 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13965 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13966 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13967 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
ea1fb29a | 13968 | |
272a527c KY |
13969 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
13970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13973 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13974 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13975 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13976 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13977 | ||
13978 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
13979 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13980 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
13981 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13982 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13983 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13984 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13985 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13986 | ||
13987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
13989 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
13990 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
13991 | ||
13992 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 13993 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
272a527c KY |
13994 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
13995 | ||
13996 | { } /* end */ | |
13997 | }; | |
13998 | ||
13999 | /* toggle speaker-output according to the hp-jack state */ | |
14000 | static void alc861vd_dallas_automute(struct hda_codec *codec) | |
14001 | { | |
14002 | unsigned int present; | |
14003 | ||
14004 | present = snd_hda_codec_read(codec, 0x15, 0, | |
14005 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
14006 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
14007 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
14008 | } |
14009 | ||
14010 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) | |
14011 | { | |
14012 | if ((res >> 26) == ALC880_HP_EVENT) | |
14013 | alc861vd_dallas_automute(codec); | |
14014 | } | |
14015 | ||
cb53c626 TI |
14016 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14017 | #define alc861vd_loopbacks alc880_loopbacks | |
14018 | #endif | |
14019 | ||
f32610ed JS |
14020 | /* pcm configuration: identiacal with ALC880 */ |
14021 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback | |
14022 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
14023 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
14024 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
14025 | ||
14026 | /* | |
14027 | * configuration and preset | |
14028 | */ | |
14029 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |
14030 | [ALC660VD_3ST] = "3stack-660", | |
983f8ae4 | 14031 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
13c94744 | 14032 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
f32610ed JS |
14033 | [ALC861VD_3ST] = "3stack", |
14034 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
14035 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
bdd148a3 | 14036 | [ALC861VD_LENOVO] = "lenovo", |
272a527c | 14037 | [ALC861VD_DALLAS] = "dallas", |
983f8ae4 | 14038 | [ALC861VD_HP] = "hp", |
f32610ed JS |
14039 | [ALC861VD_AUTO] = "auto", |
14040 | }; | |
14041 | ||
14042 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
ac3e3741 TI |
14043 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
14044 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
07e038b3 | 14045 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
f32610ed | 14046 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
13c94744 | 14047 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
6963f84c | 14048 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
f32610ed | 14049 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
ac3e3741 | 14050 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
38baf5ad | 14051 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
272a527c | 14052 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
542d7c66 | 14053 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
b419f346 | 14054 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
39c5d41f | 14055 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
ac3e3741 TI |
14056 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
14057 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), | |
be321a89 | 14058 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
625dc0bf | 14059 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
f32610ed JS |
14060 | {} |
14061 | }; | |
14062 | ||
14063 | static struct alc_config_preset alc861vd_presets[] = { | |
14064 | [ALC660VD_3ST] = { | |
14065 | .mixers = { alc861vd_3st_mixer }, | |
14066 | .init_verbs = { alc861vd_volume_init_verbs, | |
14067 | alc861vd_3stack_init_verbs }, | |
14068 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
14069 | .dac_nids = alc660vd_dac_nids, | |
f32610ed JS |
14070 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14071 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14072 | .input_mux = &alc861vd_capture_source, | |
14073 | }, | |
6963f84c MC |
14074 | [ALC660VD_3ST_DIG] = { |
14075 | .mixers = { alc861vd_3st_mixer }, | |
14076 | .init_verbs = { alc861vd_volume_init_verbs, | |
14077 | alc861vd_3stack_init_verbs }, | |
14078 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
14079 | .dac_nids = alc660vd_dac_nids, | |
14080 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
6963f84c MC |
14081 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14082 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14083 | .input_mux = &alc861vd_capture_source, | |
14084 | }, | |
f32610ed JS |
14085 | [ALC861VD_3ST] = { |
14086 | .mixers = { alc861vd_3st_mixer }, | |
14087 | .init_verbs = { alc861vd_volume_init_verbs, | |
14088 | alc861vd_3stack_init_verbs }, | |
14089 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14090 | .dac_nids = alc861vd_dac_nids, | |
14091 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
14092 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14093 | .input_mux = &alc861vd_capture_source, | |
14094 | }, | |
14095 | [ALC861VD_3ST_DIG] = { | |
14096 | .mixers = { alc861vd_3st_mixer }, | |
14097 | .init_verbs = { alc861vd_volume_init_verbs, | |
14098 | alc861vd_3stack_init_verbs }, | |
14099 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14100 | .dac_nids = alc861vd_dac_nids, | |
14101 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
14102 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
14103 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14104 | .input_mux = &alc861vd_capture_source, | |
14105 | }, | |
14106 | [ALC861VD_6ST_DIG] = { | |
14107 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
14108 | .init_verbs = { alc861vd_volume_init_verbs, | |
14109 | alc861vd_6stack_init_verbs }, | |
14110 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14111 | .dac_nids = alc861vd_dac_nids, | |
14112 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
14113 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
14114 | .channel_mode = alc861vd_6stack_modes, | |
14115 | .input_mux = &alc861vd_capture_source, | |
14116 | }, | |
bdd148a3 KY |
14117 | [ALC861VD_LENOVO] = { |
14118 | .mixers = { alc861vd_lenovo_mixer }, | |
14119 | .init_verbs = { alc861vd_volume_init_verbs, | |
14120 | alc861vd_3stack_init_verbs, | |
14121 | alc861vd_eapd_verbs, | |
14122 | alc861vd_lenovo_unsol_verbs }, | |
14123 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
14124 | .dac_nids = alc660vd_dac_nids, | |
bdd148a3 KY |
14125 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14126 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14127 | .input_mux = &alc861vd_capture_source, | |
14128 | .unsol_event = alc861vd_lenovo_unsol_event, | |
14129 | .init_hook = alc861vd_lenovo_automute, | |
14130 | }, | |
272a527c KY |
14131 | [ALC861VD_DALLAS] = { |
14132 | .mixers = { alc861vd_dallas_mixer }, | |
14133 | .init_verbs = { alc861vd_dallas_verbs }, | |
14134 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14135 | .dac_nids = alc861vd_dac_nids, | |
272a527c KY |
14136 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14137 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14138 | .input_mux = &alc861vd_dallas_capture_source, | |
14139 | .unsol_event = alc861vd_dallas_unsol_event, | |
14140 | .init_hook = alc861vd_dallas_automute, | |
d1a991a6 KY |
14141 | }, |
14142 | [ALC861VD_HP] = { | |
14143 | .mixers = { alc861vd_hp_mixer }, | |
14144 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
14145 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14146 | .dac_nids = alc861vd_dac_nids, | |
d1a991a6 | 14147 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
d1a991a6 KY |
14148 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14149 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14150 | .input_mux = &alc861vd_hp_capture_source, | |
14151 | .unsol_event = alc861vd_dallas_unsol_event, | |
14152 | .init_hook = alc861vd_dallas_automute, | |
ea1fb29a | 14153 | }, |
13c94744 TI |
14154 | [ALC660VD_ASUS_V1S] = { |
14155 | .mixers = { alc861vd_lenovo_mixer }, | |
14156 | .init_verbs = { alc861vd_volume_init_verbs, | |
14157 | alc861vd_3stack_init_verbs, | |
14158 | alc861vd_eapd_verbs, | |
14159 | alc861vd_lenovo_unsol_verbs }, | |
14160 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
14161 | .dac_nids = alc660vd_dac_nids, | |
14162 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
14163 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
14164 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14165 | .input_mux = &alc861vd_capture_source, | |
14166 | .unsol_event = alc861vd_lenovo_unsol_event, | |
14167 | .init_hook = alc861vd_lenovo_automute, | |
14168 | }, | |
f32610ed JS |
14169 | }; |
14170 | ||
14171 | /* | |
14172 | * BIOS auto configuration | |
14173 | */ | |
14174 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | |
14175 | hda_nid_t nid, int pin_type, int dac_idx) | |
14176 | { | |
f6c7e546 | 14177 | alc_set_pin_output(codec, nid, pin_type); |
f32610ed JS |
14178 | } |
14179 | ||
14180 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
14181 | { | |
14182 | struct alc_spec *spec = codec->spec; | |
14183 | int i; | |
14184 | ||
bc9f98a9 | 14185 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
f32610ed JS |
14186 | for (i = 0; i <= HDA_SIDE; i++) { |
14187 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 14188 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
f32610ed JS |
14189 | if (nid) |
14190 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
baba8ee9 | 14191 | pin_type, i); |
f32610ed JS |
14192 | } |
14193 | } | |
14194 | ||
14195 | ||
14196 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
14197 | { | |
14198 | struct alc_spec *spec = codec->spec; | |
14199 | hda_nid_t pin; | |
14200 | ||
14201 | pin = spec->autocfg.hp_pins[0]; | |
14202 | if (pin) /* connect to front and use dac 0 */ | |
14203 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
14204 | pin = spec->autocfg.speaker_pins[0]; |
14205 | if (pin) | |
14206 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
f32610ed JS |
14207 | } |
14208 | ||
14209 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) | |
14210 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | |
14211 | ||
14212 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
14213 | { | |
14214 | struct alc_spec *spec = codec->spec; | |
14215 | int i; | |
14216 | ||
14217 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
14218 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
14219 | if (alc861vd_is_input_pin(nid)) { | |
14220 | snd_hda_codec_write(codec, nid, 0, | |
14221 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14222 | i <= AUTO_PIN_FRONT_MIC ? | |
14223 | PIN_VREF80 : PIN_IN); | |
14224 | if (nid != ALC861VD_PIN_CD_NID) | |
14225 | snd_hda_codec_write(codec, nid, 0, | |
14226 | AC_VERB_SET_AMP_GAIN_MUTE, | |
14227 | AMP_OUT_MUTE); | |
14228 | } | |
14229 | } | |
14230 | } | |
14231 | ||
f511b01c TI |
14232 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
14233 | ||
f32610ed JS |
14234 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
14235 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
14236 | ||
14237 | /* add playback controls from the parsed DAC table */ | |
14238 | /* Based on ALC880 version. But ALC861VD has separate, | |
14239 | * different NIDs for mute/unmute switch and volume control */ | |
14240 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
14241 | const struct auto_pin_cfg *cfg) | |
14242 | { | |
14243 | char name[32]; | |
14244 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; | |
14245 | hda_nid_t nid_v, nid_s; | |
14246 | int i, err; | |
14247 | ||
14248 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 14249 | if (!spec->multiout.dac_nids[i]) |
f32610ed JS |
14250 | continue; |
14251 | nid_v = alc861vd_idx_to_mixer_vol( | |
14252 | alc880_dac_to_idx( | |
14253 | spec->multiout.dac_nids[i])); | |
14254 | nid_s = alc861vd_idx_to_mixer_switch( | |
14255 | alc880_dac_to_idx( | |
14256 | spec->multiout.dac_nids[i])); | |
14257 | ||
14258 | if (i == 2) { | |
14259 | /* Center/LFE */ | |
f12ab1e0 TI |
14260 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
14261 | "Center Playback Volume", | |
14262 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, | |
14263 | HDA_OUTPUT)); | |
14264 | if (err < 0) | |
f32610ed | 14265 | return err; |
f12ab1e0 TI |
14266 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
14267 | "LFE Playback Volume", | |
14268 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, | |
14269 | HDA_OUTPUT)); | |
14270 | if (err < 0) | |
f32610ed | 14271 | return err; |
f12ab1e0 TI |
14272 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
14273 | "Center Playback Switch", | |
14274 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, | |
14275 | HDA_INPUT)); | |
14276 | if (err < 0) | |
f32610ed | 14277 | return err; |
f12ab1e0 TI |
14278 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
14279 | "LFE Playback Switch", | |
14280 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, | |
14281 | HDA_INPUT)); | |
14282 | if (err < 0) | |
f32610ed JS |
14283 | return err; |
14284 | } else { | |
14285 | sprintf(name, "%s Playback Volume", chname[i]); | |
f12ab1e0 TI |
14286 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
14287 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | |
14288 | HDA_OUTPUT)); | |
14289 | if (err < 0) | |
f32610ed JS |
14290 | return err; |
14291 | sprintf(name, "%s Playback Switch", chname[i]); | |
f12ab1e0 | 14292 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
bdd148a3 | 14293 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
f12ab1e0 TI |
14294 | HDA_INPUT)); |
14295 | if (err < 0) | |
f32610ed JS |
14296 | return err; |
14297 | } | |
14298 | } | |
14299 | return 0; | |
14300 | } | |
14301 | ||
14302 | /* add playback controls for speaker and HP outputs */ | |
14303 | /* Based on ALC880 version. But ALC861VD has separate, | |
14304 | * different NIDs for mute/unmute switch and volume control */ | |
14305 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
14306 | hda_nid_t pin, const char *pfx) | |
14307 | { | |
14308 | hda_nid_t nid_v, nid_s; | |
14309 | int err; | |
14310 | char name[32]; | |
14311 | ||
f12ab1e0 | 14312 | if (!pin) |
f32610ed JS |
14313 | return 0; |
14314 | ||
14315 | if (alc880_is_fixed_pin(pin)) { | |
14316 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
14317 | /* specify the DAC as the extra output */ | |
f12ab1e0 | 14318 | if (!spec->multiout.hp_nid) |
f32610ed JS |
14319 | spec->multiout.hp_nid = nid_v; |
14320 | else | |
14321 | spec->multiout.extra_out_nid[0] = nid_v; | |
14322 | /* control HP volume/switch on the output mixer amp */ | |
14323 | nid_v = alc861vd_idx_to_mixer_vol( | |
14324 | alc880_fixed_pin_idx(pin)); | |
14325 | nid_s = alc861vd_idx_to_mixer_switch( | |
14326 | alc880_fixed_pin_idx(pin)); | |
14327 | ||
14328 | sprintf(name, "%s Playback Volume", pfx); | |
f12ab1e0 TI |
14329 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
14330 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); | |
14331 | if (err < 0) | |
f32610ed JS |
14332 | return err; |
14333 | sprintf(name, "%s Playback Switch", pfx); | |
f12ab1e0 TI |
14334 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
14335 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); | |
14336 | if (err < 0) | |
f32610ed JS |
14337 | return err; |
14338 | } else if (alc880_is_multi_pin(pin)) { | |
14339 | /* set manual connection */ | |
14340 | /* we have only a switch on HP-out PIN */ | |
14341 | sprintf(name, "%s Playback Switch", pfx); | |
f12ab1e0 TI |
14342 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
14343 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
14344 | if (err < 0) | |
f32610ed JS |
14345 | return err; |
14346 | } | |
14347 | return 0; | |
14348 | } | |
14349 | ||
14350 | /* parse the BIOS configuration and set up the alc_spec | |
14351 | * return 1 if successful, 0 if the proper config is not found, | |
14352 | * or a negative error code | |
14353 | * Based on ALC880 version - had to change it to override | |
14354 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
14355 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
14356 | { | |
14357 | struct alc_spec *spec = codec->spec; | |
14358 | int err; | |
14359 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
14360 | ||
f12ab1e0 TI |
14361 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
14362 | alc861vd_ignore); | |
14363 | if (err < 0) | |
f32610ed | 14364 | return err; |
f12ab1e0 | 14365 | if (!spec->autocfg.line_outs) |
f32610ed JS |
14366 | return 0; /* can't find valid BIOS pin config */ |
14367 | ||
f12ab1e0 TI |
14368 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
14369 | if (err < 0) | |
14370 | return err; | |
14371 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
14372 | if (err < 0) | |
14373 | return err; | |
14374 | err = alc861vd_auto_create_extra_out(spec, | |
14375 | spec->autocfg.speaker_pins[0], | |
14376 | "Speaker"); | |
14377 | if (err < 0) | |
14378 | return err; | |
14379 | err = alc861vd_auto_create_extra_out(spec, | |
14380 | spec->autocfg.hp_pins[0], | |
14381 | "Headphone"); | |
14382 | if (err < 0) | |
14383 | return err; | |
14384 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
14385 | if (err < 0) | |
f32610ed JS |
14386 | return err; |
14387 | ||
14388 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14389 | ||
14390 | if (spec->autocfg.dig_out_pin) | |
14391 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; | |
14392 | ||
603c4019 | 14393 | if (spec->kctls.list) |
d88897ea | 14394 | add_mixer(spec, spec->kctls.list); |
f32610ed | 14395 | |
d88897ea | 14396 | add_verb(spec, alc861vd_volume_init_verbs); |
f32610ed JS |
14397 | |
14398 | spec->num_mux_defs = 1; | |
14399 | spec->input_mux = &spec->private_imux; | |
14400 | ||
776e184e TI |
14401 | err = alc_auto_add_mic_boost(codec); |
14402 | if (err < 0) | |
14403 | return err; | |
14404 | ||
e044c39a | 14405 | store_pin_configs(codec); |
f32610ed JS |
14406 | return 1; |
14407 | } | |
14408 | ||
14409 | /* additional initialization for auto-configuration model */ | |
14410 | static void alc861vd_auto_init(struct hda_codec *codec) | |
14411 | { | |
f6c7e546 | 14412 | struct alc_spec *spec = codec->spec; |
f32610ed JS |
14413 | alc861vd_auto_init_multi_out(codec); |
14414 | alc861vd_auto_init_hp_out(codec); | |
14415 | alc861vd_auto_init_analog_input(codec); | |
f511b01c | 14416 | alc861vd_auto_init_input_src(codec); |
f6c7e546 | 14417 | if (spec->unsol_event) |
7fb0d78f | 14418 | alc_inithook(codec); |
f32610ed JS |
14419 | } |
14420 | ||
14421 | static int patch_alc861vd(struct hda_codec *codec) | |
14422 | { | |
14423 | struct alc_spec *spec; | |
14424 | int err, board_config; | |
14425 | ||
14426 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
14427 | if (spec == NULL) | |
14428 | return -ENOMEM; | |
14429 | ||
14430 | codec->spec = spec; | |
14431 | ||
14432 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
14433 | alc861vd_models, | |
14434 | alc861vd_cfg_tbl); | |
14435 | ||
14436 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
14437 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" | |
14438 | "ALC861VD, trying auto-probe from BIOS...\n"); | |
14439 | board_config = ALC861VD_AUTO; | |
14440 | } | |
14441 | ||
14442 | if (board_config == ALC861VD_AUTO) { | |
14443 | /* automatic parse from the BIOS config */ | |
14444 | err = alc861vd_parse_auto_config(codec); | |
14445 | if (err < 0) { | |
14446 | alc_free(codec); | |
14447 | return err; | |
f12ab1e0 | 14448 | } else if (!err) { |
f32610ed JS |
14449 | printk(KERN_INFO |
14450 | "hda_codec: Cannot set up configuration " | |
14451 | "from BIOS. Using base mode...\n"); | |
14452 | board_config = ALC861VD_3ST; | |
14453 | } | |
14454 | } | |
14455 | ||
14456 | if (board_config != ALC861VD_AUTO) | |
14457 | setup_preset(spec, &alc861vd_presets[board_config]); | |
14458 | ||
2f893286 KY |
14459 | if (codec->vendor_id == 0x10ec0660) { |
14460 | spec->stream_name_analog = "ALC660-VD Analog"; | |
14461 | spec->stream_name_digital = "ALC660-VD Digital"; | |
f9423e7a | 14462 | /* always turn on EAPD */ |
d88897ea | 14463 | add_verb(spec, alc660vd_eapd_verbs); |
2f893286 KY |
14464 | } else { |
14465 | spec->stream_name_analog = "ALC861VD Analog"; | |
14466 | spec->stream_name_digital = "ALC861VD Digital"; | |
14467 | } | |
14468 | ||
f32610ed JS |
14469 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
14470 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
14471 | ||
f32610ed JS |
14472 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
14473 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
14474 | ||
14475 | spec->adc_nids = alc861vd_adc_nids; | |
14476 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
e1406348 | 14477 | spec->capsrc_nids = alc861vd_capsrc_nids; |
54cbc9ab | 14478 | spec->is_mix_capture = 1; |
f32610ed | 14479 | |
f9e336f6 | 14480 | set_capture_mixer(spec); |
f32610ed | 14481 | |
2134ea4f TI |
14482 | spec->vmaster_nid = 0x02; |
14483 | ||
f32610ed JS |
14484 | codec->patch_ops = alc_patch_ops; |
14485 | ||
14486 | if (board_config == ALC861VD_AUTO) | |
14487 | spec->init_hook = alc861vd_auto_init; | |
cb53c626 TI |
14488 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14489 | if (!spec->loopback.amplist) | |
14490 | spec->loopback.amplist = alc861vd_loopbacks; | |
14491 | #endif | |
f32610ed JS |
14492 | |
14493 | return 0; | |
14494 | } | |
14495 | ||
bc9f98a9 KY |
14496 | /* |
14497 | * ALC662 support | |
14498 | * | |
14499 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
14500 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
14501 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
14502 | * 6-channel independent captures. | |
14503 | * | |
14504 | * In addition, an independent DAC for the multi-playback (not used in this | |
14505 | * driver yet). | |
14506 | */ | |
14507 | #define ALC662_DIGOUT_NID 0x06 | |
14508 | #define ALC662_DIGIN_NID 0x0a | |
14509 | ||
14510 | static hda_nid_t alc662_dac_nids[4] = { | |
14511 | /* front, rear, clfe, rear_surr */ | |
14512 | 0x02, 0x03, 0x04 | |
14513 | }; | |
14514 | ||
14515 | static hda_nid_t alc662_adc_nids[1] = { | |
14516 | /* ADC1-2 */ | |
14517 | 0x09, | |
14518 | }; | |
e1406348 | 14519 | |
77a261b7 | 14520 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
e1406348 | 14521 | |
bc9f98a9 KY |
14522 | /* input MUX */ |
14523 | /* FIXME: should be a matrix-type input source selection */ | |
bc9f98a9 KY |
14524 | static struct hda_input_mux alc662_capture_source = { |
14525 | .num_items = 4, | |
14526 | .items = { | |
14527 | { "Mic", 0x0 }, | |
14528 | { "Front Mic", 0x1 }, | |
14529 | { "Line", 0x2 }, | |
14530 | { "CD", 0x4 }, | |
14531 | }, | |
14532 | }; | |
14533 | ||
14534 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
14535 | .num_items = 2, | |
14536 | .items = { | |
14537 | { "Mic", 0x1 }, | |
14538 | { "Line", 0x2 }, | |
14539 | }, | |
14540 | }; | |
291702f0 KY |
14541 | |
14542 | static struct hda_input_mux alc662_eeepc_capture_source = { | |
14543 | .num_items = 2, | |
14544 | .items = { | |
14545 | { "i-Mic", 0x1 }, | |
14546 | { "e-Mic", 0x0 }, | |
14547 | }, | |
14548 | }; | |
14549 | ||
6dda9f4a KY |
14550 | static struct hda_input_mux alc663_capture_source = { |
14551 | .num_items = 3, | |
14552 | .items = { | |
14553 | { "Mic", 0x0 }, | |
14554 | { "Front Mic", 0x1 }, | |
14555 | { "Line", 0x2 }, | |
14556 | }, | |
14557 | }; | |
14558 | ||
14559 | static struct hda_input_mux alc663_m51va_capture_source = { | |
14560 | .num_items = 2, | |
14561 | .items = { | |
14562 | { "Ext-Mic", 0x0 }, | |
14563 | { "D-Mic", 0x9 }, | |
14564 | }, | |
14565 | }; | |
14566 | ||
bc9f98a9 KY |
14567 | /* |
14568 | * 2ch mode | |
14569 | */ | |
14570 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
14571 | { 2, NULL } | |
14572 | }; | |
14573 | ||
14574 | /* | |
14575 | * 2ch mode | |
14576 | */ | |
14577 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
14578 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
14579 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
14580 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
14581 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
14582 | { } /* end */ | |
14583 | }; | |
14584 | ||
14585 | /* | |
14586 | * 6ch mode | |
14587 | */ | |
14588 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
14589 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14590 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
14591 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
14592 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14593 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
14594 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
14595 | { } /* end */ | |
14596 | }; | |
14597 | ||
14598 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
14599 | { 2, alc662_3ST_ch2_init }, | |
14600 | { 6, alc662_3ST_ch6_init }, | |
14601 | }; | |
14602 | ||
14603 | /* | |
14604 | * 2ch mode | |
14605 | */ | |
14606 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
14607 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14608 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14609 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14610 | { } /* end */ | |
14611 | }; | |
14612 | ||
14613 | /* | |
14614 | * 6ch mode | |
14615 | */ | |
14616 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
14617 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14618 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14619 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14620 | { } /* end */ | |
14621 | }; | |
14622 | ||
14623 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
14624 | { 2, alc662_sixstack_ch6_init }, | |
14625 | { 6, alc662_sixstack_ch8_init }, | |
14626 | }; | |
14627 | ||
14628 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
14629 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
14630 | */ | |
14631 | ||
14632 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
14633 | /* output mixer control */ | |
14634 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
7055ad8a | 14635 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 14636 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
7055ad8a | 14637 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
14638 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
14639 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
14640 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
14641 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
14642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14643 | ||
14644 | /*Input mixer control */ | |
14645 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
14646 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
14647 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
14648 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
14649 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
14650 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
14651 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
14652 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
bc9f98a9 KY |
14653 | { } /* end */ |
14654 | }; | |
14655 | ||
14656 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
14657 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 14658 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 KY |
14659 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14660 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
14661 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
14662 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14663 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14664 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14665 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14666 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14667 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14668 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
14669 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
bc9f98a9 KY |
14670 | { } /* end */ |
14671 | }; | |
14672 | ||
14673 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
14674 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 14675 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 14676 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
7055ad8a | 14677 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
14678 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
14679 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
14680 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
14681 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
14682 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14683 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
14684 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
14685 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14686 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14689 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14690 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14691 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
14692 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
bc9f98a9 KY |
14693 | { } /* end */ |
14694 | }; | |
14695 | ||
14696 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
14697 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14698 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
86cd9298 TI |
14699 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
14700 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
bc9f98a9 KY |
14701 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14702 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14703 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14705 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
14706 | { } /* end */ |
14707 | }; | |
14708 | ||
291702f0 | 14709 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
86cd9298 | 14710 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
291702f0 | 14711 | |
b4818494 HRK |
14712 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
14713 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
291702f0 KY |
14714 | |
14715 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | |
14716 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14717 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14718 | ||
14719 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
14720 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14721 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14722 | { } /* end */ | |
14723 | }; | |
14724 | ||
8c427226 | 14725 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
31bffaa9 TI |
14726 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
14727 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8c427226 KY |
14728 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
14729 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), | |
14730 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
14731 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
14732 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), | |
14733 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), | |
86cd9298 | 14734 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8c427226 KY |
14735 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
14736 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14737 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14739 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14740 | { } /* end */ | |
14741 | }; | |
14742 | ||
f1d4e28b KY |
14743 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
14744 | .ops = &snd_hda_bind_vol, | |
14745 | .values = { | |
14746 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
14747 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
14748 | 0 | |
14749 | }, | |
14750 | }; | |
14751 | ||
14752 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | |
14753 | .ops = &snd_hda_bind_sw, | |
14754 | .values = { | |
14755 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14756 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
14757 | 0 | |
14758 | }, | |
14759 | }; | |
14760 | ||
6dda9f4a | 14761 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
f1d4e28b KY |
14762 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
14763 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | |
14764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14766 | { } /* end */ | |
14767 | }; | |
14768 | ||
14769 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | |
14770 | .ops = &snd_hda_bind_sw, | |
14771 | .values = { | |
14772 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14773 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
14774 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
14775 | 0 | |
14776 | }, | |
14777 | }; | |
14778 | ||
14779 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | |
14780 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
14781 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | |
14782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14784 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14785 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14786 | ||
14787 | { } /* end */ | |
14788 | }; | |
14789 | ||
14790 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | |
14791 | .ops = &snd_hda_bind_sw, | |
14792 | .values = { | |
14793 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14794 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
14795 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
14796 | 0 | |
14797 | }, | |
14798 | }; | |
14799 | ||
14800 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | |
14801 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
14802 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | |
14803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14805 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14806 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14807 | { } /* end */ | |
14808 | }; | |
14809 | ||
14810 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | |
6dda9f4a KY |
14811 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
14812 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
f1d4e28b KY |
14813 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14816 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14817 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14818 | { } /* end */ | |
14819 | }; | |
14820 | ||
14821 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | |
14822 | .ops = &snd_hda_bind_vol, | |
14823 | .values = { | |
14824 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
14825 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | |
14826 | 0 | |
14827 | }, | |
14828 | }; | |
14829 | ||
14830 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | |
14831 | .ops = &snd_hda_bind_sw, | |
14832 | .values = { | |
14833 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14834 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | |
14835 | 0 | |
14836 | }, | |
14837 | }; | |
14838 | ||
14839 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | |
14840 | HDA_BIND_VOL("Master Playback Volume", | |
14841 | &alc663_asus_two_bind_master_vol), | |
14842 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
14843 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
6dda9f4a KY |
14844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
14845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
f1d4e28b KY |
14847 | { } /* end */ |
14848 | }; | |
14849 | ||
14850 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | |
14851 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
14852 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
14853 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
14854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6dda9f4a KY |
14857 | { } /* end */ |
14858 | }; | |
14859 | ||
14860 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
14861 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14862 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
14864 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
14866 | ||
14867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14869 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14870 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14871 | { } /* end */ | |
14872 | }; | |
14873 | ||
14874 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
14875 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14876 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14877 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
14878 | ||
14879 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14880 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14881 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14882 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14883 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14884 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14885 | { } /* end */ | |
14886 | }; | |
14887 | ||
bc9f98a9 KY |
14888 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
14889 | { | |
14890 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14891 | .name = "Channel Mode", | |
14892 | .info = alc_ch_mode_info, | |
14893 | .get = alc_ch_mode_get, | |
14894 | .put = alc_ch_mode_put, | |
14895 | }, | |
14896 | { } /* end */ | |
14897 | }; | |
14898 | ||
14899 | static struct hda_verb alc662_init_verbs[] = { | |
14900 | /* ADC: mute amp left and right */ | |
14901 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14902 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14903 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
14904 | ||
cb53c626 TI |
14905 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14906 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14907 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
14908 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
14909 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
bc9f98a9 | 14910 | |
b60dd394 KY |
14911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
14912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14915 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14916 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
14917 | |
14918 | /* Front Pin: output 0 (0x0c) */ | |
14919 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14920 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14921 | ||
14922 | /* Rear Pin: output 1 (0x0d) */ | |
14923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14925 | ||
14926 | /* CLFE Pin: output 2 (0x0e) */ | |
14927 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14928 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14929 | ||
14930 | /* Mic (rear) pin: input vref at 80% */ | |
14931 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14932 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14933 | /* Front Mic pin: input vref at 80% */ | |
14934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14935 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14936 | /* Line In pin: input */ | |
14937 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14938 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14939 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
14940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14943 | /* CD pin widget for input */ | |
14944 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14945 | ||
14946 | /* FIXME: use matrix-type input source selection */ | |
14947 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
14948 | /* Input mixer */ | |
14949 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14950 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14951 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14952 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
291702f0 KY |
14953 | |
14954 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14956 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14957 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
6dda9f4a KY |
14958 | |
14959 | /* always trun on EAPD */ | |
14960 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14961 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
14962 | ||
bc9f98a9 KY |
14963 | { } |
14964 | }; | |
14965 | ||
14966 | static struct hda_verb alc662_sue_init_verbs[] = { | |
14967 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
14968 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
291702f0 KY |
14969 | {} |
14970 | }; | |
14971 | ||
14972 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
14973 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
14974 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14975 | {} | |
bc9f98a9 KY |
14976 | }; |
14977 | ||
8c427226 KY |
14978 | /* Set Unsolicited Event*/ |
14979 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
14980 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14981 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
14982 | {} | |
14983 | }; | |
14984 | ||
bc9f98a9 KY |
14985 | /* |
14986 | * generic initialization of ADC, input mixers and output mixers | |
14987 | */ | |
14988 | static struct hda_verb alc662_auto_init_verbs[] = { | |
14989 | /* | |
14990 | * Unmute ADC and set the default input to mic-in | |
14991 | */ | |
14992 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14993 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14994 | ||
14995 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
14996 | * mixer widget | |
14997 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
14998 | * panel mic (mic 2) | |
14999 | */ | |
15000 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
15001 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
15002 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15003 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
15004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
15005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
bc9f98a9 KY |
15006 | |
15007 | /* | |
15008 | * Set up output mixers (0x0c - 0x0f) | |
15009 | */ | |
15010 | /* set vol=0 to output mixers */ | |
15011 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15012 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15013 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15014 | ||
15015 | /* set up input amps for analog loopback */ | |
15016 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
b60dd394 KY |
15017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
15018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15019 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15020 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15021 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15022 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
15023 | |
15024 | ||
15025 | /* FIXME: use matrix-type input source selection */ | |
15026 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
15027 | /* Input mixer */ | |
15028 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
d1a991a6 | 15029 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
bc9f98a9 KY |
15030 | { } |
15031 | }; | |
15032 | ||
24fb9173 TI |
15033 | /* additional verbs for ALC663 */ |
15034 | static struct hda_verb alc663_auto_init_verbs[] = { | |
15035 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15036 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15037 | { } | |
15038 | }; | |
15039 | ||
6dda9f4a | 15040 | static struct hda_verb alc663_m51va_init_verbs[] = { |
f1d4e28b KY |
15041 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
15042 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6dda9f4a KY |
15043 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
15044 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f1d4e28b KY |
15045 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
15046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
15048 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15049 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15050 | {} | |
15051 | }; | |
15052 | ||
15053 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | |
15054 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15055 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15056 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
15057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15059 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15060 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15061 | {} | |
15062 | }; | |
15063 | ||
15064 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | |
15065 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15066 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15067 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15068 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
15069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15071 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15072 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15073 | {} | |
15074 | }; | |
6dda9f4a | 15075 | |
f1d4e28b KY |
15076 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
15077 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15078 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15079 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
15080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15082 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15083 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15084 | {} | |
15085 | }; | |
6dda9f4a | 15086 | |
f1d4e28b KY |
15087 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
15088 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15089 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15090 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15091 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
15092 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15093 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15094 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
15095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6dda9f4a KY |
15097 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
15098 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f1d4e28b KY |
15099 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
15100 | {} | |
15101 | }; | |
15102 | ||
15103 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | |
15104 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15105 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15106 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15107 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
15108 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
15111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15113 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15114 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15115 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6dda9f4a KY |
15116 | {} |
15117 | }; | |
15118 | ||
15119 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
15120 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15121 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
15122 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
15123 | ||
15124 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15125 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15126 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
15127 | ||
15128 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
15129 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
15130 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
15131 | {} | |
15132 | }; | |
15133 | ||
15134 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
15135 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15136 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15137 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
15138 | ||
15139 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15140 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15141 | {} | |
15142 | }; | |
15143 | ||
f1d4e28b KY |
15144 | static struct hda_verb alc662_ecs_init_verbs[] = { |
15145 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | |
15146 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15147 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15148 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15149 | {} | |
15150 | }; | |
15151 | ||
f1d4e28b KY |
15152 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
15153 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
15154 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
15155 | { } /* end */ | |
15156 | }; | |
15157 | ||
bc9f98a9 KY |
15158 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
15159 | { | |
15160 | unsigned int present; | |
f12ab1e0 | 15161 | unsigned char bits; |
bc9f98a9 KY |
15162 | |
15163 | present = snd_hda_codec_read(codec, 0x14, 0, | |
15164 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
15165 | bits = present ? HDA_AMP_MUTE : 0; |
15166 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
15167 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
15168 | } |
15169 | ||
15170 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
15171 | { | |
15172 | unsigned int present; | |
f12ab1e0 | 15173 | unsigned char bits; |
bc9f98a9 KY |
15174 | |
15175 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
15176 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
15177 | bits = present ? HDA_AMP_MUTE : 0; |
15178 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
15179 | HDA_AMP_MUTE, bits); | |
15180 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
15181 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
15182 | } |
15183 | ||
15184 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
15185 | unsigned int res) | |
15186 | { | |
15187 | if ((res >> 26) == ALC880_HP_EVENT) | |
15188 | alc662_lenovo_101e_all_automute(codec); | |
15189 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
15190 | alc662_lenovo_101e_ispeaker_automute(codec); | |
15191 | } | |
15192 | ||
291702f0 KY |
15193 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
15194 | { | |
15195 | unsigned int present; | |
15196 | ||
15197 | present = snd_hda_codec_read(codec, 0x18, 0, | |
15198 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
15199 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15200 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
15201 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15202 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
15203 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15204 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
15205 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15206 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
15207 | } | |
15208 | ||
15209 | /* unsolicited event for HP jack sensing */ | |
15210 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
15211 | unsigned int res) | |
15212 | { | |
15213 | if ((res >> 26) == ALC880_HP_EVENT) | |
15214 | alc262_hippo1_automute( codec ); | |
15215 | ||
15216 | if ((res >> 26) == ALC880_MIC_EVENT) | |
15217 | alc662_eeepc_mic_automute(codec); | |
15218 | } | |
15219 | ||
15220 | static void alc662_eeepc_inithook(struct hda_codec *codec) | |
15221 | { | |
15222 | alc262_hippo1_automute( codec ); | |
15223 | alc662_eeepc_mic_automute(codec); | |
15224 | } | |
15225 | ||
8c427226 KY |
15226 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
15227 | { | |
15228 | unsigned int mute; | |
15229 | unsigned int present; | |
15230 | ||
15231 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); | |
15232 | present = snd_hda_codec_read(codec, 0x14, 0, | |
15233 | AC_VERB_GET_PIN_SENSE, 0); | |
15234 | present = (present & 0x80000000) != 0; | |
15235 | if (present) { | |
15236 | /* mute internal speaker */ | |
15237 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
ea1fb29a | 15238 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
8c427226 KY |
15239 | } else { |
15240 | /* unmute internal speaker if necessary */ | |
15241 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
15242 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
ea1fb29a | 15243 | HDA_AMP_MUTE, mute); |
8c427226 KY |
15244 | } |
15245 | } | |
15246 | ||
15247 | /* unsolicited event for HP jack sensing */ | |
15248 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, | |
15249 | unsigned int res) | |
15250 | { | |
15251 | if ((res >> 26) == ALC880_HP_EVENT) | |
15252 | alc662_eeepc_ep20_automute(codec); | |
15253 | } | |
15254 | ||
15255 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) | |
15256 | { | |
15257 | alc662_eeepc_ep20_automute(codec); | |
15258 | } | |
15259 | ||
6dda9f4a KY |
15260 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
15261 | { | |
15262 | unsigned int present; | |
15263 | unsigned char bits; | |
15264 | ||
15265 | present = snd_hda_codec_read(codec, 0x21, 0, | |
f1d4e28b KY |
15266 | AC_VERB_GET_PIN_SENSE, 0) |
15267 | & AC_PINSENSE_PRESENCE; | |
6dda9f4a | 15268 | bits = present ? HDA_AMP_MUTE : 0; |
f1d4e28b KY |
15269 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
15270 | AMP_IN_MUTE(0), bits); | |
15271 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15272 | AMP_IN_MUTE(0), bits); | |
15273 | } | |
15274 | ||
15275 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |
15276 | { | |
15277 | unsigned int present; | |
15278 | unsigned char bits; | |
15279 | ||
15280 | present = snd_hda_codec_read(codec, 0x21, 0, | |
15281 | AC_VERB_GET_PIN_SENSE, 0) | |
15282 | & AC_PINSENSE_PRESENCE; | |
15283 | bits = present ? HDA_AMP_MUTE : 0; | |
15284 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
15285 | AMP_IN_MUTE(0), bits); | |
15286 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15287 | AMP_IN_MUTE(0), bits); | |
15288 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
15289 | AMP_IN_MUTE(0), bits); | |
15290 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
15291 | AMP_IN_MUTE(0), bits); | |
15292 | } | |
15293 | ||
15294 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |
15295 | { | |
15296 | unsigned int present; | |
15297 | unsigned char bits; | |
15298 | ||
15299 | present = snd_hda_codec_read(codec, 0x15, 0, | |
15300 | AC_VERB_GET_PIN_SENSE, 0) | |
15301 | & AC_PINSENSE_PRESENCE; | |
15302 | bits = present ? HDA_AMP_MUTE : 0; | |
15303 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
15304 | AMP_IN_MUTE(0), bits); | |
15305 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15306 | AMP_IN_MUTE(0), bits); | |
15307 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
15308 | AMP_IN_MUTE(0), bits); | |
15309 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
15310 | AMP_IN_MUTE(0), bits); | |
15311 | } | |
15312 | ||
15313 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | |
15314 | { | |
15315 | unsigned int present; | |
15316 | unsigned char bits; | |
15317 | ||
15318 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
15319 | AC_VERB_GET_PIN_SENSE, 0) | |
15320 | & AC_PINSENSE_PRESENCE; | |
15321 | bits = present ? 0 : PIN_OUT; | |
15322 | snd_hda_codec_write(codec, 0x14, 0, | |
15323 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
15324 | } | |
15325 | ||
15326 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | |
15327 | { | |
15328 | unsigned int present1, present2; | |
15329 | ||
15330 | present1 = snd_hda_codec_read(codec, 0x21, 0, | |
15331 | AC_VERB_GET_PIN_SENSE, 0) | |
15332 | & AC_PINSENSE_PRESENCE; | |
15333 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
15334 | AC_VERB_GET_PIN_SENSE, 0) | |
15335 | & AC_PINSENSE_PRESENCE; | |
15336 | ||
15337 | if (present1 || present2) { | |
15338 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
15339 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
15340 | } else { | |
15341 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
15342 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
15343 | } | |
15344 | } | |
15345 | ||
15346 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |
15347 | { | |
15348 | unsigned int present1, present2; | |
15349 | ||
15350 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | |
15351 | AC_VERB_GET_PIN_SENSE, 0) | |
15352 | & AC_PINSENSE_PRESENCE; | |
15353 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
15354 | AC_VERB_GET_PIN_SENSE, 0) | |
15355 | & AC_PINSENSE_PRESENCE; | |
15356 | ||
15357 | if (present1 || present2) { | |
15358 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
15359 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | |
15360 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15361 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | |
15362 | } else { | |
15363 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
15364 | AMP_IN_MUTE(0), 0); | |
15365 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15366 | AMP_IN_MUTE(0), 0); | |
15367 | } | |
6dda9f4a KY |
15368 | } |
15369 | ||
15370 | static void alc663_m51va_mic_automute(struct hda_codec *codec) | |
15371 | { | |
15372 | unsigned int present; | |
15373 | ||
15374 | present = snd_hda_codec_read(codec, 0x18, 0, | |
ea1fb29a KY |
15375 | AC_VERB_GET_PIN_SENSE, 0) |
15376 | & AC_PINSENSE_PRESENCE; | |
6dda9f4a | 15377 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
ea1fb29a | 15378 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
6dda9f4a | 15379 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
ea1fb29a | 15380 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
6dda9f4a | 15381 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
ea1fb29a | 15382 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
6dda9f4a | 15383 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
ea1fb29a | 15384 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
6dda9f4a KY |
15385 | } |
15386 | ||
15387 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | |
15388 | unsigned int res) | |
15389 | { | |
15390 | switch (res >> 26) { | |
15391 | case ALC880_HP_EVENT: | |
15392 | alc663_m51va_speaker_automute(codec); | |
15393 | break; | |
15394 | case ALC880_MIC_EVENT: | |
15395 | alc663_m51va_mic_automute(codec); | |
15396 | break; | |
15397 | } | |
15398 | } | |
15399 | ||
15400 | static void alc663_m51va_inithook(struct hda_codec *codec) | |
15401 | { | |
15402 | alc663_m51va_speaker_automute(codec); | |
15403 | alc663_m51va_mic_automute(codec); | |
15404 | } | |
15405 | ||
f1d4e28b KY |
15406 | /* ***************** Mode1 ******************************/ |
15407 | static void alc663_mode1_unsol_event(struct hda_codec *codec, | |
15408 | unsigned int res) | |
15409 | { | |
15410 | switch (res >> 26) { | |
15411 | case ALC880_HP_EVENT: | |
15412 | alc663_m51va_speaker_automute(codec); | |
15413 | break; | |
15414 | case ALC880_MIC_EVENT: | |
15415 | alc662_eeepc_mic_automute(codec); | |
15416 | break; | |
15417 | } | |
15418 | } | |
15419 | ||
15420 | static void alc663_mode1_inithook(struct hda_codec *codec) | |
15421 | { | |
15422 | alc663_m51va_speaker_automute(codec); | |
15423 | alc662_eeepc_mic_automute(codec); | |
15424 | } | |
15425 | /* ***************** Mode2 ******************************/ | |
15426 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | |
15427 | unsigned int res) | |
15428 | { | |
15429 | switch (res >> 26) { | |
15430 | case ALC880_HP_EVENT: | |
15431 | alc662_f5z_speaker_automute(codec); | |
15432 | break; | |
15433 | case ALC880_MIC_EVENT: | |
15434 | alc662_eeepc_mic_automute(codec); | |
15435 | break; | |
15436 | } | |
15437 | } | |
15438 | ||
15439 | static void alc662_mode2_inithook(struct hda_codec *codec) | |
15440 | { | |
15441 | alc662_f5z_speaker_automute(codec); | |
15442 | alc662_eeepc_mic_automute(codec); | |
15443 | } | |
15444 | /* ***************** Mode3 ******************************/ | |
15445 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | |
15446 | unsigned int res) | |
15447 | { | |
15448 | switch (res >> 26) { | |
15449 | case ALC880_HP_EVENT: | |
15450 | alc663_two_hp_m1_speaker_automute(codec); | |
15451 | break; | |
15452 | case ALC880_MIC_EVENT: | |
15453 | alc662_eeepc_mic_automute(codec); | |
15454 | break; | |
15455 | } | |
15456 | } | |
15457 | ||
15458 | static void alc663_mode3_inithook(struct hda_codec *codec) | |
15459 | { | |
15460 | alc663_two_hp_m1_speaker_automute(codec); | |
15461 | alc662_eeepc_mic_automute(codec); | |
15462 | } | |
15463 | /* ***************** Mode4 ******************************/ | |
15464 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | |
15465 | unsigned int res) | |
15466 | { | |
15467 | switch (res >> 26) { | |
15468 | case ALC880_HP_EVENT: | |
15469 | alc663_21jd_two_speaker_automute(codec); | |
15470 | break; | |
15471 | case ALC880_MIC_EVENT: | |
15472 | alc662_eeepc_mic_automute(codec); | |
15473 | break; | |
15474 | } | |
15475 | } | |
15476 | ||
15477 | static void alc663_mode4_inithook(struct hda_codec *codec) | |
15478 | { | |
15479 | alc663_21jd_two_speaker_automute(codec); | |
15480 | alc662_eeepc_mic_automute(codec); | |
15481 | } | |
15482 | /* ***************** Mode5 ******************************/ | |
15483 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | |
15484 | unsigned int res) | |
15485 | { | |
15486 | switch (res >> 26) { | |
15487 | case ALC880_HP_EVENT: | |
15488 | alc663_15jd_two_speaker_automute(codec); | |
15489 | break; | |
15490 | case ALC880_MIC_EVENT: | |
15491 | alc662_eeepc_mic_automute(codec); | |
15492 | break; | |
15493 | } | |
15494 | } | |
15495 | ||
15496 | static void alc663_mode5_inithook(struct hda_codec *codec) | |
15497 | { | |
15498 | alc663_15jd_two_speaker_automute(codec); | |
15499 | alc662_eeepc_mic_automute(codec); | |
15500 | } | |
15501 | /* ***************** Mode6 ******************************/ | |
15502 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | |
15503 | unsigned int res) | |
15504 | { | |
15505 | switch (res >> 26) { | |
15506 | case ALC880_HP_EVENT: | |
15507 | alc663_two_hp_m2_speaker_automute(codec); | |
15508 | break; | |
15509 | case ALC880_MIC_EVENT: | |
15510 | alc662_eeepc_mic_automute(codec); | |
15511 | break; | |
15512 | } | |
15513 | } | |
15514 | ||
15515 | static void alc663_mode6_inithook(struct hda_codec *codec) | |
15516 | { | |
15517 | alc663_two_hp_m2_speaker_automute(codec); | |
15518 | alc662_eeepc_mic_automute(codec); | |
15519 | } | |
15520 | ||
6dda9f4a KY |
15521 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
15522 | { | |
15523 | unsigned int present; | |
15524 | unsigned char bits; | |
15525 | ||
15526 | present = snd_hda_codec_read(codec, 0x21, 0, | |
15527 | AC_VERB_GET_PIN_SENSE, 0) | |
15528 | & AC_PINSENSE_PRESENCE; | |
15529 | bits = present ? HDA_AMP_MUTE : 0; | |
15530 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
15531 | HDA_AMP_MUTE, bits); | |
15532 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
15533 | HDA_AMP_MUTE, bits); | |
15534 | } | |
15535 | ||
15536 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
15537 | { | |
15538 | unsigned int present; | |
15539 | unsigned char bits; | |
15540 | ||
15541 | present = snd_hda_codec_read(codec, 0x15, 0, | |
15542 | AC_VERB_GET_PIN_SENSE, 0) | |
15543 | & AC_PINSENSE_PRESENCE; | |
15544 | bits = present ? HDA_AMP_MUTE : 0; | |
15545 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
15546 | HDA_AMP_MUTE, bits); | |
15547 | } | |
15548 | ||
15549 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
15550 | unsigned int res) | |
15551 | { | |
15552 | switch (res >> 26) { | |
15553 | case ALC880_HP_EVENT: | |
15554 | alc663_g71v_hp_automute(codec); | |
15555 | break; | |
15556 | case ALC880_FRONT_EVENT: | |
15557 | alc663_g71v_front_automute(codec); | |
15558 | break; | |
15559 | case ALC880_MIC_EVENT: | |
15560 | alc662_eeepc_mic_automute(codec); | |
15561 | break; | |
15562 | } | |
15563 | } | |
15564 | ||
15565 | static void alc663_g71v_inithook(struct hda_codec *codec) | |
15566 | { | |
15567 | alc663_g71v_front_automute(codec); | |
15568 | alc663_g71v_hp_automute(codec); | |
15569 | alc662_eeepc_mic_automute(codec); | |
15570 | } | |
15571 | ||
15572 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
15573 | unsigned int res) | |
15574 | { | |
15575 | switch (res >> 26) { | |
15576 | case ALC880_HP_EVENT: | |
15577 | alc663_m51va_speaker_automute(codec); | |
15578 | break; | |
15579 | case ALC880_MIC_EVENT: | |
15580 | alc662_eeepc_mic_automute(codec); | |
15581 | break; | |
15582 | } | |
15583 | } | |
15584 | ||
15585 | static void alc663_g50v_inithook(struct hda_codec *codec) | |
15586 | { | |
15587 | alc663_m51va_speaker_automute(codec); | |
15588 | alc662_eeepc_mic_automute(codec); | |
15589 | } | |
15590 | ||
f1d4e28b KY |
15591 | /* bind hp and internal speaker mute (with plug check) */ |
15592 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, | |
15593 | struct snd_ctl_elem_value *ucontrol) | |
15594 | { | |
15595 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
15596 | long *valp = ucontrol->value.integer.value; | |
15597 | int change; | |
15598 | ||
15599 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, | |
15600 | HDA_AMP_MUTE, | |
15601 | valp[0] ? 0 : HDA_AMP_MUTE); | |
15602 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, | |
15603 | HDA_AMP_MUTE, | |
15604 | valp[1] ? 0 : HDA_AMP_MUTE); | |
15605 | if (change) | |
15606 | alc262_hippo1_automute(codec); | |
15607 | return change; | |
15608 | } | |
15609 | ||
15610 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | |
15611 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
15612 | { | |
15613 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15614 | .name = "Master Playback Switch", | |
15615 | .info = snd_hda_mixer_amp_switch_info, | |
15616 | .get = snd_hda_mixer_amp_switch_get, | |
15617 | .put = alc662_ecs_master_sw_put, | |
15618 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
15619 | }, | |
15620 | ||
15621 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | |
15622 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
15623 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
15624 | ||
15625 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
15626 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
15627 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
15628 | { } /* end */ | |
15629 | }; | |
15630 | ||
cb53c626 TI |
15631 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15632 | #define alc662_loopbacks alc880_loopbacks | |
15633 | #endif | |
15634 | ||
bc9f98a9 KY |
15635 | |
15636 | /* pcm configuration: identiacal with ALC880 */ | |
15637 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback | |
15638 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
15639 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
15640 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
15641 | ||
15642 | /* | |
15643 | * configuration and preset | |
15644 | */ | |
15645 | static const char *alc662_models[ALC662_MODEL_LAST] = { | |
15646 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
15647 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
15648 | [ALC662_3ST_6ch] = "3stack-6ch", | |
15649 | [ALC662_5ST_DIG] = "6stack-dig", | |
15650 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
b995d76d | 15651 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
8c427226 | 15652 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
f1d4e28b | 15653 | [ALC662_ECS] = "ecs", |
6dda9f4a KY |
15654 | [ALC663_ASUS_M51VA] = "m51va", |
15655 | [ALC663_ASUS_G71V] = "g71v", | |
15656 | [ALC663_ASUS_H13] = "h13", | |
15657 | [ALC663_ASUS_G50V] = "g50v", | |
f1d4e28b KY |
15658 | [ALC663_ASUS_MODE1] = "asus-mode1", |
15659 | [ALC662_ASUS_MODE2] = "asus-mode2", | |
15660 | [ALC663_ASUS_MODE3] = "asus-mode3", | |
15661 | [ALC663_ASUS_MODE4] = "asus-mode4", | |
15662 | [ALC663_ASUS_MODE5] = "asus-mode5", | |
15663 | [ALC663_ASUS_MODE6] = "asus-mode6", | |
bc9f98a9 KY |
15664 | [ALC662_AUTO] = "auto", |
15665 | }; | |
15666 | ||
15667 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
6dda9f4a | 15668 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
80ffe869 | 15669 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
3da23cac | 15670 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
291702f0 | 15671 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
8c427226 | 15672 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
f1d4e28b KY |
15673 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
15674 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), | |
15675 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | |
15676 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | |
15677 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | |
15678 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), | |
15679 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | |
15680 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | |
15681 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | |
80ffe869 | 15682 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
f1d4e28b KY |
15683 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
15684 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | |
15685 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | |
15686 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | |
15687 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | |
15688 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | |
15689 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | |
15690 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | |
15691 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | |
15692 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | |
15693 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | |
15694 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | |
15695 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | |
15696 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | |
15697 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | |
15698 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | |
15699 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | |
15700 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | |
15701 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | |
15702 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | |
15703 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | |
15704 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | |
95fe5f2c HRK |
15705 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
15706 | ALC662_3ST_6ch_DIG), | |
ac3e3741 | 15707 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
f1d4e28b KY |
15708 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
15709 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | |
cb55974c HRK |
15710 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
15711 | ALC662_3ST_6ch_DIG), | |
19c009aa | 15712 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
238713d4 | 15713 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
19c009aa | 15714 | ALC662_3ST_6ch_DIG), |
6dda9f4a KY |
15715 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
15716 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), | |
15717 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), | |
bc9f98a9 KY |
15718 | {} |
15719 | }; | |
15720 | ||
15721 | static struct alc_config_preset alc662_presets[] = { | |
15722 | [ALC662_3ST_2ch_DIG] = { | |
f9e336f6 | 15723 | .mixers = { alc662_3ST_2ch_mixer }, |
bc9f98a9 KY |
15724 | .init_verbs = { alc662_init_verbs }, |
15725 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15726 | .dac_nids = alc662_dac_nids, | |
15727 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
15728 | .dig_in_nid = ALC662_DIGIN_NID, |
15729 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15730 | .channel_mode = alc662_3ST_2ch_modes, | |
15731 | .input_mux = &alc662_capture_source, | |
15732 | }, | |
15733 | [ALC662_3ST_6ch_DIG] = { | |
f9e336f6 | 15734 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
15735 | .init_verbs = { alc662_init_verbs }, |
15736 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15737 | .dac_nids = alc662_dac_nids, | |
15738 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
15739 | .dig_in_nid = ALC662_DIGIN_NID, |
15740 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
15741 | .channel_mode = alc662_3ST_6ch_modes, | |
15742 | .need_dac_fix = 1, | |
15743 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 15744 | }, |
bc9f98a9 | 15745 | [ALC662_3ST_6ch] = { |
f9e336f6 | 15746 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
15747 | .init_verbs = { alc662_init_verbs }, |
15748 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15749 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
15750 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
15751 | .channel_mode = alc662_3ST_6ch_modes, | |
15752 | .need_dac_fix = 1, | |
15753 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 15754 | }, |
bc9f98a9 | 15755 | [ALC662_5ST_DIG] = { |
f9e336f6 | 15756 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
bc9f98a9 KY |
15757 | .init_verbs = { alc662_init_verbs }, |
15758 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15759 | .dac_nids = alc662_dac_nids, | |
15760 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
15761 | .dig_in_nid = ALC662_DIGIN_NID, |
15762 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
15763 | .channel_mode = alc662_5stack_modes, | |
15764 | .input_mux = &alc662_capture_source, | |
15765 | }, | |
15766 | [ALC662_LENOVO_101E] = { | |
f9e336f6 | 15767 | .mixers = { alc662_lenovo_101e_mixer }, |
bc9f98a9 KY |
15768 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
15769 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15770 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
15771 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
15772 | .channel_mode = alc662_3ST_2ch_modes, | |
15773 | .input_mux = &alc662_lenovo_101e_capture_source, | |
15774 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
15775 | .init_hook = alc662_lenovo_101e_all_automute, | |
15776 | }, | |
291702f0 | 15777 | [ALC662_ASUS_EEEPC_P701] = { |
f9e336f6 | 15778 | .mixers = { alc662_eeepc_p701_mixer }, |
291702f0 KY |
15779 | .init_verbs = { alc662_init_verbs, |
15780 | alc662_eeepc_sue_init_verbs }, | |
15781 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15782 | .dac_nids = alc662_dac_nids, | |
291702f0 KY |
15783 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
15784 | .channel_mode = alc662_3ST_2ch_modes, | |
15785 | .input_mux = &alc662_eeepc_capture_source, | |
15786 | .unsol_event = alc662_eeepc_unsol_event, | |
15787 | .init_hook = alc662_eeepc_inithook, | |
15788 | }, | |
8c427226 | 15789 | [ALC662_ASUS_EEEPC_EP20] = { |
f9e336f6 | 15790 | .mixers = { alc662_eeepc_ep20_mixer, |
8c427226 KY |
15791 | alc662_chmode_mixer }, |
15792 | .init_verbs = { alc662_init_verbs, | |
15793 | alc662_eeepc_ep20_sue_init_verbs }, | |
15794 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15795 | .dac_nids = alc662_dac_nids, | |
8c427226 KY |
15796 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
15797 | .channel_mode = alc662_3ST_6ch_modes, | |
15798 | .input_mux = &alc662_lenovo_101e_capture_source, | |
15799 | .unsol_event = alc662_eeepc_ep20_unsol_event, | |
15800 | .init_hook = alc662_eeepc_ep20_inithook, | |
15801 | }, | |
f1d4e28b | 15802 | [ALC662_ECS] = { |
f9e336f6 | 15803 | .mixers = { alc662_ecs_mixer }, |
f1d4e28b KY |
15804 | .init_verbs = { alc662_init_verbs, |
15805 | alc662_ecs_init_verbs }, | |
15806 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15807 | .dac_nids = alc662_dac_nids, | |
15808 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15809 | .channel_mode = alc662_3ST_2ch_modes, | |
15810 | .input_mux = &alc662_eeepc_capture_source, | |
15811 | .unsol_event = alc662_eeepc_unsol_event, | |
15812 | .init_hook = alc662_eeepc_inithook, | |
15813 | }, | |
6dda9f4a | 15814 | [ALC663_ASUS_M51VA] = { |
f9e336f6 | 15815 | .mixers = { alc663_m51va_mixer }, |
6dda9f4a KY |
15816 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
15817 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15818 | .dac_nids = alc662_dac_nids, | |
15819 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15820 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15821 | .channel_mode = alc662_3ST_2ch_modes, | |
15822 | .input_mux = &alc663_m51va_capture_source, | |
15823 | .unsol_event = alc663_m51va_unsol_event, | |
15824 | .init_hook = alc663_m51va_inithook, | |
15825 | }, | |
15826 | [ALC663_ASUS_G71V] = { | |
f9e336f6 | 15827 | .mixers = { alc663_g71v_mixer }, |
6dda9f4a KY |
15828 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
15829 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15830 | .dac_nids = alc662_dac_nids, | |
15831 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15832 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15833 | .channel_mode = alc662_3ST_2ch_modes, | |
15834 | .input_mux = &alc662_eeepc_capture_source, | |
15835 | .unsol_event = alc663_g71v_unsol_event, | |
15836 | .init_hook = alc663_g71v_inithook, | |
15837 | }, | |
15838 | [ALC663_ASUS_H13] = { | |
f9e336f6 | 15839 | .mixers = { alc663_m51va_mixer }, |
6dda9f4a KY |
15840 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
15841 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15842 | .dac_nids = alc662_dac_nids, | |
15843 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15844 | .channel_mode = alc662_3ST_2ch_modes, | |
15845 | .input_mux = &alc663_m51va_capture_source, | |
15846 | .unsol_event = alc663_m51va_unsol_event, | |
15847 | .init_hook = alc663_m51va_inithook, | |
15848 | }, | |
15849 | [ALC663_ASUS_G50V] = { | |
f9e336f6 | 15850 | .mixers = { alc663_g50v_mixer }, |
6dda9f4a KY |
15851 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
15852 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15853 | .dac_nids = alc662_dac_nids, | |
15854 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15855 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
15856 | .channel_mode = alc662_3ST_6ch_modes, | |
15857 | .input_mux = &alc663_capture_source, | |
15858 | .unsol_event = alc663_g50v_unsol_event, | |
15859 | .init_hook = alc663_g50v_inithook, | |
15860 | }, | |
f1d4e28b | 15861 | [ALC663_ASUS_MODE1] = { |
f9e336f6 TI |
15862 | .mixers = { alc663_m51va_mixer }, |
15863 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
15864 | .init_verbs = { alc662_init_verbs, |
15865 | alc663_21jd_amic_init_verbs }, | |
15866 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15867 | .hp_nid = 0x03, | |
15868 | .dac_nids = alc662_dac_nids, | |
15869 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15870 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15871 | .channel_mode = alc662_3ST_2ch_modes, | |
15872 | .input_mux = &alc662_eeepc_capture_source, | |
15873 | .unsol_event = alc663_mode1_unsol_event, | |
15874 | .init_hook = alc663_mode1_inithook, | |
15875 | }, | |
15876 | [ALC662_ASUS_MODE2] = { | |
f9e336f6 TI |
15877 | .mixers = { alc662_1bjd_mixer }, |
15878 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
15879 | .init_verbs = { alc662_init_verbs, |
15880 | alc662_1bjd_amic_init_verbs }, | |
15881 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15882 | .dac_nids = alc662_dac_nids, | |
15883 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15884 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15885 | .channel_mode = alc662_3ST_2ch_modes, | |
15886 | .input_mux = &alc662_eeepc_capture_source, | |
15887 | .unsol_event = alc662_mode2_unsol_event, | |
15888 | .init_hook = alc662_mode2_inithook, | |
15889 | }, | |
15890 | [ALC663_ASUS_MODE3] = { | |
f9e336f6 TI |
15891 | .mixers = { alc663_two_hp_m1_mixer }, |
15892 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
15893 | .init_verbs = { alc662_init_verbs, |
15894 | alc663_two_hp_amic_m1_init_verbs }, | |
15895 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15896 | .hp_nid = 0x03, | |
15897 | .dac_nids = alc662_dac_nids, | |
15898 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15899 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15900 | .channel_mode = alc662_3ST_2ch_modes, | |
15901 | .input_mux = &alc662_eeepc_capture_source, | |
15902 | .unsol_event = alc663_mode3_unsol_event, | |
15903 | .init_hook = alc663_mode3_inithook, | |
15904 | }, | |
15905 | [ALC663_ASUS_MODE4] = { | |
f9e336f6 TI |
15906 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
15907 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
15908 | .init_verbs = { alc662_init_verbs, |
15909 | alc663_21jd_amic_init_verbs}, | |
15910 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15911 | .hp_nid = 0x03, | |
15912 | .dac_nids = alc662_dac_nids, | |
15913 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15914 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15915 | .channel_mode = alc662_3ST_2ch_modes, | |
15916 | .input_mux = &alc662_eeepc_capture_source, | |
15917 | .unsol_event = alc663_mode4_unsol_event, | |
15918 | .init_hook = alc663_mode4_inithook, | |
15919 | }, | |
15920 | [ALC663_ASUS_MODE5] = { | |
f9e336f6 TI |
15921 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
15922 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
15923 | .init_verbs = { alc662_init_verbs, |
15924 | alc663_15jd_amic_init_verbs }, | |
15925 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15926 | .hp_nid = 0x03, | |
15927 | .dac_nids = alc662_dac_nids, | |
15928 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15929 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15930 | .channel_mode = alc662_3ST_2ch_modes, | |
15931 | .input_mux = &alc662_eeepc_capture_source, | |
15932 | .unsol_event = alc663_mode5_unsol_event, | |
15933 | .init_hook = alc663_mode5_inithook, | |
15934 | }, | |
15935 | [ALC663_ASUS_MODE6] = { | |
f9e336f6 TI |
15936 | .mixers = { alc663_two_hp_m2_mixer }, |
15937 | .cap_mixer = alc662_auto_capture_mixer, | |
f1d4e28b KY |
15938 | .init_verbs = { alc662_init_verbs, |
15939 | alc663_two_hp_amic_m2_init_verbs }, | |
15940 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15941 | .hp_nid = 0x03, | |
15942 | .dac_nids = alc662_dac_nids, | |
15943 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15944 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15945 | .channel_mode = alc662_3ST_2ch_modes, | |
15946 | .input_mux = &alc662_eeepc_capture_source, | |
15947 | .unsol_event = alc663_mode6_unsol_event, | |
15948 | .init_hook = alc663_mode6_inithook, | |
15949 | }, | |
bc9f98a9 KY |
15950 | }; |
15951 | ||
15952 | ||
15953 | /* | |
15954 | * BIOS auto configuration | |
15955 | */ | |
15956 | ||
15957 | /* add playback controls from the parsed DAC table */ | |
15958 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |
15959 | const struct auto_pin_cfg *cfg) | |
15960 | { | |
15961 | char name[32]; | |
15962 | static const char *chname[4] = { | |
15963 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
15964 | }; | |
15965 | hda_nid_t nid; | |
15966 | int i, err; | |
15967 | ||
15968 | for (i = 0; i < cfg->line_outs; i++) { | |
15969 | if (!spec->multiout.dac_nids[i]) | |
15970 | continue; | |
b60dd394 | 15971 | nid = alc880_idx_to_dac(i); |
bc9f98a9 KY |
15972 | if (i == 2) { |
15973 | /* Center/LFE */ | |
15974 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
15975 | "Center Playback Volume", | |
f12ab1e0 TI |
15976 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
15977 | HDA_OUTPUT)); | |
bc9f98a9 KY |
15978 | if (err < 0) |
15979 | return err; | |
15980 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
15981 | "LFE Playback Volume", | |
f12ab1e0 TI |
15982 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
15983 | HDA_OUTPUT)); | |
bc9f98a9 KY |
15984 | if (err < 0) |
15985 | return err; | |
b69ce01a | 15986 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
bc9f98a9 | 15987 | "Center Playback Switch", |
b69ce01a | 15988 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
f12ab1e0 | 15989 | HDA_INPUT)); |
bc9f98a9 KY |
15990 | if (err < 0) |
15991 | return err; | |
b69ce01a | 15992 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
bc9f98a9 | 15993 | "LFE Playback Switch", |
b69ce01a | 15994 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
f12ab1e0 | 15995 | HDA_INPUT)); |
bc9f98a9 KY |
15996 | if (err < 0) |
15997 | return err; | |
15998 | } else { | |
15999 | sprintf(name, "%s Playback Volume", chname[i]); | |
16000 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
f12ab1e0 TI |
16001 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
16002 | HDA_OUTPUT)); | |
bc9f98a9 KY |
16003 | if (err < 0) |
16004 | return err; | |
16005 | sprintf(name, "%s Playback Switch", chname[i]); | |
b69ce01a HRK |
16006 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
16007 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), | |
16008 | 3, 0, HDA_INPUT)); | |
bc9f98a9 KY |
16009 | if (err < 0) |
16010 | return err; | |
16011 | } | |
16012 | } | |
16013 | return 0; | |
16014 | } | |
16015 | ||
16016 | /* add playback controls for speaker and HP outputs */ | |
16017 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
16018 | const char *pfx) | |
16019 | { | |
16020 | hda_nid_t nid; | |
16021 | int err; | |
16022 | char name[32]; | |
16023 | ||
16024 | if (!pin) | |
16025 | return 0; | |
16026 | ||
24fb9173 TI |
16027 | if (pin == 0x17) { |
16028 | /* ALC663 has a mono output pin on 0x17 */ | |
16029 | sprintf(name, "%s Playback Switch", pfx); | |
16030 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
16031 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); | |
16032 | return err; | |
16033 | } | |
16034 | ||
bc9f98a9 KY |
16035 | if (alc880_is_fixed_pin(pin)) { |
16036 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
16037 | /* printk("DAC nid=%x\n",nid); */ | |
16038 | /* specify the DAC as the extra output */ | |
16039 | if (!spec->multiout.hp_nid) | |
16040 | spec->multiout.hp_nid = nid; | |
16041 | else | |
16042 | spec->multiout.extra_out_nid[0] = nid; | |
16043 | /* control HP volume/switch on the output mixer amp */ | |
16044 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
16045 | sprintf(name, "%s Playback Volume", pfx); | |
16046 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
16047 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
16048 | if (err < 0) | |
16049 | return err; | |
16050 | sprintf(name, "%s Playback Switch", pfx); | |
16051 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | |
16052 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
16053 | if (err < 0) | |
16054 | return err; | |
16055 | } else if (alc880_is_multi_pin(pin)) { | |
16056 | /* set manual connection */ | |
16057 | /* we have only a switch on HP-out PIN */ | |
16058 | sprintf(name, "%s Playback Switch", pfx); | |
16059 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
16060 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
16061 | if (err < 0) | |
16062 | return err; | |
16063 | } | |
16064 | return 0; | |
16065 | } | |
16066 | ||
16067 | /* create playback/capture controls for input pins */ | |
16068 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, | |
16069 | const struct auto_pin_cfg *cfg) | |
16070 | { | |
16071 | struct hda_input_mux *imux = &spec->private_imux; | |
16072 | int i, err, idx; | |
16073 | ||
16074 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
16075 | if (alc880_is_input_pin(cfg->input_pins[i])) { | |
16076 | idx = alc880_input_pin_idx(cfg->input_pins[i]); | |
16077 | err = new_analog_input(spec, cfg->input_pins[i], | |
16078 | auto_pin_cfg_labels[i], | |
16079 | idx, 0x0b); | |
16080 | if (err < 0) | |
16081 | return err; | |
16082 | imux->items[imux->num_items].label = | |
16083 | auto_pin_cfg_labels[i]; | |
16084 | imux->items[imux->num_items].index = | |
16085 | alc880_input_pin_idx(cfg->input_pins[i]); | |
16086 | imux->num_items++; | |
16087 | } | |
16088 | } | |
16089 | return 0; | |
16090 | } | |
16091 | ||
16092 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
16093 | hda_nid_t nid, int pin_type, | |
16094 | int dac_idx) | |
16095 | { | |
f6c7e546 | 16096 | alc_set_pin_output(codec, nid, pin_type); |
bc9f98a9 KY |
16097 | /* need the manual connection? */ |
16098 | if (alc880_is_multi_pin(nid)) { | |
16099 | struct alc_spec *spec = codec->spec; | |
16100 | int idx = alc880_multi_pin_idx(nid); | |
16101 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
16102 | AC_VERB_SET_CONNECT_SEL, | |
16103 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
16104 | } | |
16105 | } | |
16106 | ||
16107 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
16108 | { | |
16109 | struct alc_spec *spec = codec->spec; | |
16110 | int i; | |
16111 | ||
8c427226 | 16112 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
bc9f98a9 KY |
16113 | for (i = 0; i <= HDA_SIDE; i++) { |
16114 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 16115 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
bc9f98a9 | 16116 | if (nid) |
baba8ee9 | 16117 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
bc9f98a9 KY |
16118 | i); |
16119 | } | |
16120 | } | |
16121 | ||
16122 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
16123 | { | |
16124 | struct alc_spec *spec = codec->spec; | |
16125 | hda_nid_t pin; | |
16126 | ||
16127 | pin = spec->autocfg.hp_pins[0]; | |
16128 | if (pin) /* connect to front */ | |
16129 | /* use dac 0 */ | |
16130 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
16131 | pin = spec->autocfg.speaker_pins[0]; |
16132 | if (pin) | |
16133 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
bc9f98a9 KY |
16134 | } |
16135 | ||
16136 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) | |
16137 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | |
16138 | ||
16139 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
16140 | { | |
16141 | struct alc_spec *spec = codec->spec; | |
16142 | int i; | |
16143 | ||
16144 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
16145 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
16146 | if (alc662_is_input_pin(nid)) { | |
16147 | snd_hda_codec_write(codec, nid, 0, | |
16148 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
16149 | (i <= AUTO_PIN_FRONT_MIC ? | |
16150 | PIN_VREF80 : PIN_IN)); | |
16151 | if (nid != ALC662_PIN_CD_NID) | |
16152 | snd_hda_codec_write(codec, nid, 0, | |
16153 | AC_VERB_SET_AMP_GAIN_MUTE, | |
16154 | AMP_OUT_MUTE); | |
16155 | } | |
16156 | } | |
16157 | } | |
16158 | ||
f511b01c TI |
16159 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
16160 | ||
bc9f98a9 KY |
16161 | static int alc662_parse_auto_config(struct hda_codec *codec) |
16162 | { | |
16163 | struct alc_spec *spec = codec->spec; | |
16164 | int err; | |
16165 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
16166 | ||
16167 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
16168 | alc662_ignore); | |
16169 | if (err < 0) | |
16170 | return err; | |
16171 | if (!spec->autocfg.line_outs) | |
16172 | return 0; /* can't find valid BIOS pin config */ | |
16173 | ||
f12ab1e0 TI |
16174 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
16175 | if (err < 0) | |
16176 | return err; | |
16177 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
16178 | if (err < 0) | |
16179 | return err; | |
16180 | err = alc662_auto_create_extra_out(spec, | |
16181 | spec->autocfg.speaker_pins[0], | |
16182 | "Speaker"); | |
16183 | if (err < 0) | |
16184 | return err; | |
16185 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
16186 | "Headphone"); | |
16187 | if (err < 0) | |
16188 | return err; | |
16189 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
16190 | if (err < 0) | |
bc9f98a9 KY |
16191 | return err; |
16192 | ||
16193 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
16194 | ||
16195 | if (spec->autocfg.dig_out_pin) | |
16196 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | |
16197 | ||
603c4019 | 16198 | if (spec->kctls.list) |
d88897ea | 16199 | add_mixer(spec, spec->kctls.list); |
bc9f98a9 KY |
16200 | |
16201 | spec->num_mux_defs = 1; | |
16202 | spec->input_mux = &spec->private_imux; | |
ea1fb29a | 16203 | |
d88897ea | 16204 | add_verb(spec, alc662_auto_init_verbs); |
24fb9173 | 16205 | if (codec->vendor_id == 0x10ec0663) |
d88897ea | 16206 | add_verb(spec, alc663_auto_init_verbs); |
ee979a14 TI |
16207 | |
16208 | err = alc_auto_add_mic_boost(codec); | |
16209 | if (err < 0) | |
16210 | return err; | |
16211 | ||
e044c39a | 16212 | store_pin_configs(codec); |
8c87286f | 16213 | return 1; |
bc9f98a9 KY |
16214 | } |
16215 | ||
16216 | /* additional initialization for auto-configuration model */ | |
16217 | static void alc662_auto_init(struct hda_codec *codec) | |
16218 | { | |
f6c7e546 | 16219 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
16220 | alc662_auto_init_multi_out(codec); |
16221 | alc662_auto_init_hp_out(codec); | |
16222 | alc662_auto_init_analog_input(codec); | |
f511b01c | 16223 | alc662_auto_init_input_src(codec); |
f6c7e546 | 16224 | if (spec->unsol_event) |
7fb0d78f | 16225 | alc_inithook(codec); |
bc9f98a9 KY |
16226 | } |
16227 | ||
16228 | static int patch_alc662(struct hda_codec *codec) | |
16229 | { | |
16230 | struct alc_spec *spec; | |
16231 | int err, board_config; | |
16232 | ||
16233 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
16234 | if (!spec) | |
16235 | return -ENOMEM; | |
16236 | ||
16237 | codec->spec = spec; | |
16238 | ||
2c3bf9ab TI |
16239 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
16240 | ||
bc9f98a9 KY |
16241 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
16242 | alc662_models, | |
16243 | alc662_cfg_tbl); | |
16244 | if (board_config < 0) { | |
16245 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " | |
16246 | "trying auto-probe from BIOS...\n"); | |
16247 | board_config = ALC662_AUTO; | |
16248 | } | |
16249 | ||
16250 | if (board_config == ALC662_AUTO) { | |
16251 | /* automatic parse from the BIOS config */ | |
16252 | err = alc662_parse_auto_config(codec); | |
16253 | if (err < 0) { | |
16254 | alc_free(codec); | |
16255 | return err; | |
8c87286f | 16256 | } else if (!err) { |
bc9f98a9 KY |
16257 | printk(KERN_INFO |
16258 | "hda_codec: Cannot set up configuration " | |
16259 | "from BIOS. Using base mode...\n"); | |
16260 | board_config = ALC662_3ST_2ch_DIG; | |
16261 | } | |
16262 | } | |
16263 | ||
16264 | if (board_config != ALC662_AUTO) | |
16265 | setup_preset(spec, &alc662_presets[board_config]); | |
16266 | ||
6dda9f4a KY |
16267 | if (codec->vendor_id == 0x10ec0663) { |
16268 | spec->stream_name_analog = "ALC663 Analog"; | |
16269 | spec->stream_name_digital = "ALC663 Digital"; | |
01afd41f KY |
16270 | } else if (codec->vendor_id == 0x10ec0272) { |
16271 | spec->stream_name_analog = "ALC272 Analog"; | |
16272 | spec->stream_name_digital = "ALC272 Digital"; | |
6dda9f4a KY |
16273 | } else { |
16274 | spec->stream_name_analog = "ALC662 Analog"; | |
16275 | spec->stream_name_digital = "ALC662 Digital"; | |
16276 | } | |
16277 | ||
bc9f98a9 KY |
16278 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
16279 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
16280 | ||
bc9f98a9 KY |
16281 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
16282 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
16283 | ||
e1406348 TI |
16284 | spec->adc_nids = alc662_adc_nids; |
16285 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
16286 | spec->capsrc_nids = alc662_capsrc_nids; | |
54cbc9ab | 16287 | spec->is_mix_capture = 1; |
bc9f98a9 | 16288 | |
f9e336f6 TI |
16289 | if (!spec->cap_mixer) |
16290 | set_capture_mixer(spec); | |
16291 | ||
2134ea4f TI |
16292 | spec->vmaster_nid = 0x02; |
16293 | ||
bc9f98a9 KY |
16294 | codec->patch_ops = alc_patch_ops; |
16295 | if (board_config == ALC662_AUTO) | |
16296 | spec->init_hook = alc662_auto_init; | |
cb53c626 TI |
16297 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16298 | if (!spec->loopback.amplist) | |
16299 | spec->loopback.amplist = alc662_loopbacks; | |
16300 | #endif | |
bc9f98a9 KY |
16301 | |
16302 | return 0; | |
16303 | } | |
16304 | ||
1da177e4 LT |
16305 | /* |
16306 | * patch entries | |
16307 | */ | |
16308 | struct hda_codec_preset snd_hda_preset_realtek[] = { | |
16309 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | |
df694daa | 16310 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
f6a92248 | 16311 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
a361d84b | 16312 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
f6a92248 | 16313 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
01afd41f | 16314 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
f32610ed | 16315 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
bc9f98a9 | 16316 | .patch = patch_alc861 }, |
f32610ed JS |
16317 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
16318 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
16319 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
bc9f98a9 KY |
16320 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
16321 | .patch = patch_alc883 }, | |
16322 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | |
16323 | .patch = patch_alc662 }, | |
6dda9f4a | 16324 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
f32610ed | 16325 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
1da177e4 | 16326 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
9c7f852e | 16327 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
669faba2 CM |
16328 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
16329 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | |
cb308f97 | 16330 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
7943a8ab | 16331 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
df694daa | 16332 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
a385a529 | 16333 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
9c7f852e | 16334 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
4442608d KY |
16335 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
16336 | .patch = patch_alc883 }, | |
f6a92248 | 16337 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
1da177e4 LT |
16338 | {} /* terminator */ |
16339 | }; |