]>
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, |
8ef355da | 117 | ALC268_ACER_ASPIRE_ONE, |
3866f0b0 | 118 | ALC268_DELL, |
f12462c5 | 119 | ALC268_ZEPTO, |
86c53bd2 JW |
120 | #ifdef CONFIG_SND_DEBUG |
121 | ALC268_TEST, | |
122 | #endif | |
a361d84b KY |
123 | ALC268_AUTO, |
124 | ALC268_MODEL_LAST /* last tag */ | |
125 | }; | |
126 | ||
f6a92248 KY |
127 | /* ALC269 models */ |
128 | enum { | |
129 | ALC269_BASIC, | |
60db6b53 | 130 | ALC269_QUANTA_FL1, |
f53281e6 KY |
131 | ALC269_ASUS_EEEPC_P703, |
132 | ALC269_ASUS_EEEPC_P901, | |
f6a92248 KY |
133 | ALC269_AUTO, |
134 | ALC269_MODEL_LAST /* last tag */ | |
135 | }; | |
136 | ||
df694daa KY |
137 | /* ALC861 models */ |
138 | enum { | |
139 | ALC861_3ST, | |
9c7f852e | 140 | ALC660_3ST, |
df694daa KY |
141 | ALC861_3ST_DIG, |
142 | ALC861_6ST_DIG, | |
22309c3e | 143 | ALC861_UNIWILL_M31, |
a53d1aec | 144 | ALC861_TOSHIBA, |
7cdbff94 | 145 | ALC861_ASUS, |
56bb0cab | 146 | ALC861_ASUS_LAPTOP, |
df694daa KY |
147 | ALC861_AUTO, |
148 | ALC861_MODEL_LAST, | |
149 | }; | |
150 | ||
f32610ed JS |
151 | /* ALC861-VD models */ |
152 | enum { | |
153 | ALC660VD_3ST, | |
6963f84c | 154 | ALC660VD_3ST_DIG, |
f32610ed JS |
155 | ALC861VD_3ST, |
156 | ALC861VD_3ST_DIG, | |
157 | ALC861VD_6ST_DIG, | |
bdd148a3 | 158 | ALC861VD_LENOVO, |
272a527c | 159 | ALC861VD_DALLAS, |
d1a991a6 | 160 | ALC861VD_HP, |
f32610ed JS |
161 | ALC861VD_AUTO, |
162 | ALC861VD_MODEL_LAST, | |
163 | }; | |
164 | ||
bc9f98a9 KY |
165 | /* ALC662 models */ |
166 | enum { | |
167 | ALC662_3ST_2ch_DIG, | |
168 | ALC662_3ST_6ch_DIG, | |
169 | ALC662_3ST_6ch, | |
170 | ALC662_5ST_DIG, | |
171 | ALC662_LENOVO_101E, | |
291702f0 | 172 | ALC662_ASUS_EEEPC_P701, |
8c427226 | 173 | ALC662_ASUS_EEEPC_EP20, |
6dda9f4a KY |
174 | ALC663_ASUS_M51VA, |
175 | ALC663_ASUS_G71V, | |
176 | ALC663_ASUS_H13, | |
177 | ALC663_ASUS_G50V, | |
f1d4e28b KY |
178 | ALC662_ECS, |
179 | ALC663_ASUS_MODE1, | |
180 | ALC662_ASUS_MODE2, | |
181 | ALC663_ASUS_MODE3, | |
182 | ALC663_ASUS_MODE4, | |
183 | ALC663_ASUS_MODE5, | |
184 | ALC663_ASUS_MODE6, | |
bc9f98a9 KY |
185 | ALC662_AUTO, |
186 | ALC662_MODEL_LAST, | |
187 | }; | |
188 | ||
df694daa KY |
189 | /* ALC882 models */ |
190 | enum { | |
191 | ALC882_3ST_DIG, | |
192 | ALC882_6ST_DIG, | |
4b146cb0 | 193 | ALC882_ARIMA, |
bdd148a3 | 194 | ALC882_W2JC, |
272a527c KY |
195 | ALC882_TARGA, |
196 | ALC882_ASUS_A7J, | |
914759b7 | 197 | ALC882_ASUS_A7M, |
9102cd1c | 198 | ALC885_MACPRO, |
87350ad0 | 199 | ALC885_MBP3, |
c54728d8 | 200 | ALC885_IMAC24, |
272a527c | 201 | ALC882_AUTO, |
df694daa KY |
202 | ALC882_MODEL_LAST, |
203 | }; | |
204 | ||
9c7f852e TI |
205 | /* ALC883 models */ |
206 | enum { | |
207 | ALC883_3ST_2ch_DIG, | |
208 | ALC883_3ST_6ch_DIG, | |
209 | ALC883_3ST_6ch, | |
210 | ALC883_6ST_DIG, | |
ccc656ce KY |
211 | ALC883_TARGA_DIG, |
212 | ALC883_TARGA_2ch_DIG, | |
bab282b9 | 213 | ALC883_ACER, |
2880a867 | 214 | ALC883_ACER_ASPIRE, |
c07584c8 | 215 | ALC883_MEDION, |
ea1fb29a | 216 | ALC883_MEDION_MD2, |
b373bdeb | 217 | ALC883_LAPTOP_EAPD, |
bc9f98a9 | 218 | ALC883_LENOVO_101E_2ch, |
272a527c | 219 | ALC883_LENOVO_NB0763, |
189609ae | 220 | ALC888_LENOVO_MS7195_DIG, |
e2757d5e | 221 | ALC888_LENOVO_SKY, |
ea1fb29a | 222 | ALC883_HAIER_W66, |
4723c022 | 223 | ALC888_3ST_HP, |
5795b9e6 | 224 | ALC888_6ST_DELL, |
a8848bd6 | 225 | ALC883_MITAC, |
0c4cc443 | 226 | ALC883_CLEVO_M720, |
fb97dc67 | 227 | ALC883_FUJITSU_PI2515, |
17bba1b7 | 228 | ALC883_3ST_6ch_INTEL, |
e2757d5e KY |
229 | ALC888_ASUS_M90V, |
230 | ALC888_ASUS_EEE1601, | |
9c7f852e TI |
231 | ALC883_AUTO, |
232 | ALC883_MODEL_LAST, | |
233 | }; | |
234 | ||
df694daa KY |
235 | /* for GPIO Poll */ |
236 | #define GPIO_MASK 0x03 | |
237 | ||
1da177e4 LT |
238 | struct alc_spec { |
239 | /* codec parameterization */ | |
df694daa | 240 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
1da177e4 LT |
241 | unsigned int num_mixers; |
242 | ||
df694daa | 243 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
9c7f852e TI |
244 | * don't forget NULL |
245 | * termination! | |
e9edcee0 TI |
246 | */ |
247 | unsigned int num_init_verbs; | |
1da177e4 | 248 | |
16ded525 | 249 | char *stream_name_analog; /* analog PCM stream */ |
1da177e4 LT |
250 | struct hda_pcm_stream *stream_analog_playback; |
251 | struct hda_pcm_stream *stream_analog_capture; | |
6330079f TI |
252 | struct hda_pcm_stream *stream_analog_alt_playback; |
253 | struct hda_pcm_stream *stream_analog_alt_capture; | |
1da177e4 | 254 | |
f12ab1e0 | 255 | char *stream_name_digital; /* digital PCM stream */ |
1da177e4 LT |
256 | struct hda_pcm_stream *stream_digital_playback; |
257 | struct hda_pcm_stream *stream_digital_capture; | |
258 | ||
259 | /* playback */ | |
16ded525 TI |
260 | struct hda_multi_out multiout; /* playback set-up |
261 | * max_channels, dacs must be set | |
262 | * dig_out_nid and hp_nid are optional | |
263 | */ | |
6330079f | 264 | hda_nid_t alt_dac_nid; |
1da177e4 LT |
265 | |
266 | /* capture */ | |
267 | unsigned int num_adc_nids; | |
268 | hda_nid_t *adc_nids; | |
e1406348 | 269 | hda_nid_t *capsrc_nids; |
16ded525 | 270 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
54cbc9ab | 271 | unsigned char is_mix_capture; /* matrix-style capture (non-mux) */ |
1da177e4 LT |
272 | |
273 | /* capture source */ | |
a1e8d2da | 274 | unsigned int num_mux_defs; |
1da177e4 LT |
275 | const struct hda_input_mux *input_mux; |
276 | unsigned int cur_mux[3]; | |
277 | ||
278 | /* channel model */ | |
d2a6d7dc | 279 | const struct hda_channel_mode *channel_mode; |
1da177e4 | 280 | int num_channel_mode; |
4e195a7b | 281 | int need_dac_fix; |
1da177e4 LT |
282 | |
283 | /* PCM information */ | |
4c5186ed | 284 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
41e41f1f | 285 | |
e9edcee0 TI |
286 | /* dynamic controls, init_verbs and input_mux */ |
287 | struct auto_pin_cfg autocfg; | |
603c4019 | 288 | struct snd_array kctls; |
e9edcee0 | 289 | struct hda_input_mux private_imux; |
41923e44 | 290 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
834be88d | 291 | |
ae6b813a TI |
292 | /* hooks */ |
293 | void (*init_hook)(struct hda_codec *codec); | |
294 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | |
295 | ||
834be88d TI |
296 | /* for pin sensing */ |
297 | unsigned int sense_updated: 1; | |
298 | unsigned int jack_present: 1; | |
bec15c3a | 299 | unsigned int master_sw: 1; |
cb53c626 | 300 | |
2134ea4f TI |
301 | /* for virtual master */ |
302 | hda_nid_t vmaster_nid; | |
cb53c626 TI |
303 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
304 | struct hda_loopback_check loopback; | |
305 | #endif | |
2c3bf9ab TI |
306 | |
307 | /* for PLL fix */ | |
308 | hda_nid_t pll_nid; | |
309 | unsigned int pll_coef_idx, pll_coef_bit; | |
e044c39a TI |
310 | |
311 | #ifdef SND_HDA_NEEDS_RESUME | |
312 | #define ALC_MAX_PINS 16 | |
313 | unsigned int num_pins; | |
314 | hda_nid_t pin_nids[ALC_MAX_PINS]; | |
315 | unsigned int pin_cfgs[ALC_MAX_PINS]; | |
316 | #endif | |
df694daa KY |
317 | }; |
318 | ||
319 | /* | |
320 | * configuration template - to be copied to the spec instance | |
321 | */ | |
322 | struct alc_config_preset { | |
9c7f852e TI |
323 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
324 | * with spec | |
325 | */ | |
df694daa KY |
326 | const struct hda_verb *init_verbs[5]; |
327 | unsigned int num_dacs; | |
328 | hda_nid_t *dac_nids; | |
329 | hda_nid_t dig_out_nid; /* optional */ | |
330 | hda_nid_t hp_nid; /* optional */ | |
331 | unsigned int num_adc_nids; | |
332 | hda_nid_t *adc_nids; | |
e1406348 | 333 | hda_nid_t *capsrc_nids; |
df694daa KY |
334 | hda_nid_t dig_in_nid; |
335 | unsigned int num_channel_mode; | |
336 | const struct hda_channel_mode *channel_mode; | |
4e195a7b | 337 | int need_dac_fix; |
a1e8d2da | 338 | unsigned int num_mux_defs; |
df694daa | 339 | const struct hda_input_mux *input_mux; |
ae6b813a TI |
340 | void (*unsol_event)(struct hda_codec *, unsigned int); |
341 | void (*init_hook)(struct hda_codec *); | |
cb53c626 TI |
342 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
343 | struct hda_amp_list *loopbacks; | |
344 | #endif | |
1da177e4 LT |
345 | }; |
346 | ||
1da177e4 LT |
347 | |
348 | /* | |
349 | * input MUX handling | |
350 | */ | |
9c7f852e TI |
351 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
352 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
353 | { |
354 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
355 | struct alc_spec *spec = codec->spec; | |
a1e8d2da JW |
356 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
357 | if (mux_idx >= spec->num_mux_defs) | |
358 | mux_idx = 0; | |
359 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | |
1da177e4 LT |
360 | } |
361 | ||
9c7f852e TI |
362 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
363 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
364 | { |
365 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
366 | struct alc_spec *spec = codec->spec; | |
367 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | |
368 | ||
369 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | |
370 | return 0; | |
371 | } | |
372 | ||
9c7f852e TI |
373 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
374 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
375 | { |
376 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
377 | struct alc_spec *spec = codec->spec; | |
54cbc9ab | 378 | const struct hda_input_mux *imux = spec->input_mux; |
1da177e4 | 379 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
e1406348 TI |
380 | hda_nid_t nid = spec->capsrc_nids ? |
381 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | |
1da177e4 | 382 | |
54cbc9ab TI |
383 | if (spec->is_mix_capture) { |
384 | /* Matrix-mixer style (e.g. ALC882) */ | |
385 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | |
386 | unsigned int i, idx; | |
387 | ||
388 | idx = ucontrol->value.enumerated.item[0]; | |
389 | if (idx >= imux->num_items) | |
390 | idx = imux->num_items - 1; | |
391 | if (*cur_val == idx) | |
392 | return 0; | |
393 | for (i = 0; i < imux->num_items; i++) { | |
394 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | |
395 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | |
396 | imux->items[i].index, | |
397 | HDA_AMP_MUTE, v); | |
398 | } | |
399 | *cur_val = idx; | |
400 | return 1; | |
401 | } else { | |
402 | /* MUX style (e.g. ALC880) */ | |
403 | unsigned int mux_idx; | |
404 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | |
405 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], | |
406 | ucontrol, nid, | |
407 | &spec->cur_mux[adc_idx]); | |
408 | } | |
409 | } | |
e9edcee0 | 410 | |
1da177e4 LT |
411 | /* |
412 | * channel mode setting | |
413 | */ | |
9c7f852e TI |
414 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
415 | struct snd_ctl_elem_info *uinfo) | |
1da177e4 LT |
416 | { |
417 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
418 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc TI |
419 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
420 | spec->num_channel_mode); | |
1da177e4 LT |
421 | } |
422 | ||
9c7f852e TI |
423 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
424 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
425 | { |
426 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
427 | struct alc_spec *spec = codec->spec; | |
d2a6d7dc | 428 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
9c7f852e TI |
429 | spec->num_channel_mode, |
430 | spec->multiout.max_channels); | |
1da177e4 LT |
431 | } |
432 | ||
9c7f852e TI |
433 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
434 | struct snd_ctl_elem_value *ucontrol) | |
1da177e4 LT |
435 | { |
436 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
437 | struct alc_spec *spec = codec->spec; | |
4e195a7b TI |
438 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
439 | spec->num_channel_mode, | |
440 | &spec->multiout.max_channels); | |
bd2033f2 | 441 | if (err >= 0 && spec->need_dac_fix) |
4e195a7b TI |
442 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
443 | return err; | |
1da177e4 LT |
444 | } |
445 | ||
a9430dd8 | 446 | /* |
4c5186ed | 447 | * Control the mode of pin widget settings via the mixer. "pc" is used |
ea1fb29a | 448 | * instead of "%" to avoid consequences of accidently treating the % as |
4c5186ed JW |
449 | * being part of a format specifier. Maximum allowed length of a value is |
450 | * 63 characters plus NULL terminator. | |
7cf51e48 JW |
451 | * |
452 | * Note: some retasking pin complexes seem to ignore requests for input | |
453 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | |
454 | * are requested. Therefore order this list so that this behaviour will not | |
455 | * cause problems when mixer clients move through the enum sequentially. | |
a1e8d2da JW |
456 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
457 | * March 2006. | |
4c5186ed JW |
458 | */ |
459 | static char *alc_pin_mode_names[] = { | |
7cf51e48 JW |
460 | "Mic 50pc bias", "Mic 80pc bias", |
461 | "Line in", "Line out", "Headphone out", | |
4c5186ed JW |
462 | }; |
463 | static unsigned char alc_pin_mode_values[] = { | |
7cf51e48 | 464 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
4c5186ed JW |
465 | }; |
466 | /* The control can present all 5 options, or it can limit the options based | |
a1e8d2da JW |
467 | * in the pin being assumed to be exclusively an input or an output pin. In |
468 | * addition, "input" pins may or may not process the mic bias option | |
469 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | |
470 | * accept requests for bias as of chip versions up to March 2006) and/or | |
471 | * wiring in the computer. | |
a9430dd8 | 472 | */ |
a1e8d2da JW |
473 | #define ALC_PIN_DIR_IN 0x00 |
474 | #define ALC_PIN_DIR_OUT 0x01 | |
475 | #define ALC_PIN_DIR_INOUT 0x02 | |
476 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | |
477 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | |
4c5186ed | 478 | |
ea1fb29a | 479 | /* Info about the pin modes supported by the different pin direction modes. |
4c5186ed JW |
480 | * For each direction the minimum and maximum values are given. |
481 | */ | |
a1e8d2da | 482 | static signed char alc_pin_mode_dir_info[5][2] = { |
4c5186ed JW |
483 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
484 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | |
485 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | |
a1e8d2da JW |
486 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
487 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | |
4c5186ed JW |
488 | }; |
489 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | |
490 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | |
491 | #define alc_pin_mode_n_items(_dir) \ | |
492 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | |
493 | ||
9c7f852e TI |
494 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
495 | struct snd_ctl_elem_info *uinfo) | |
a9430dd8 | 496 | { |
4c5186ed JW |
497 | unsigned int item_num = uinfo->value.enumerated.item; |
498 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | |
499 | ||
500 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
a9430dd8 | 501 | uinfo->count = 1; |
4c5186ed JW |
502 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
503 | ||
504 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | |
505 | item_num = alc_pin_mode_min(dir); | |
506 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | |
a9430dd8 JW |
507 | return 0; |
508 | } | |
509 | ||
9c7f852e TI |
510 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
511 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 512 | { |
4c5186ed | 513 | unsigned int i; |
a9430dd8 JW |
514 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
515 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed | 516 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
a9430dd8 | 517 | long *valp = ucontrol->value.integer.value; |
9c7f852e TI |
518 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
519 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
520 | 0x00); | |
a9430dd8 | 521 | |
4c5186ed JW |
522 | /* Find enumerated value for current pinctl setting */ |
523 | i = alc_pin_mode_min(dir); | |
9c7f852e | 524 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
4c5186ed | 525 | i++; |
9c7f852e | 526 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
a9430dd8 JW |
527 | return 0; |
528 | } | |
529 | ||
9c7f852e TI |
530 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
531 | struct snd_ctl_elem_value *ucontrol) | |
a9430dd8 | 532 | { |
4c5186ed | 533 | signed int change; |
a9430dd8 JW |
534 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
535 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
4c5186ed JW |
536 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
537 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
538 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
539 | AC_VERB_GET_PIN_WIDGET_CONTROL, | |
540 | 0x00); | |
a9430dd8 | 541 | |
f12ab1e0 | 542 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
4c5186ed JW |
543 | val = alc_pin_mode_min(dir); |
544 | ||
545 | change = pinctl != alc_pin_mode_values[val]; | |
cdcd9268 JW |
546 | if (change) { |
547 | /* Set pin mode to that requested */ | |
82beb8fd TI |
548 | snd_hda_codec_write_cache(codec, nid, 0, |
549 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
550 | alc_pin_mode_values[val]); | |
cdcd9268 | 551 | |
ea1fb29a | 552 | /* Also enable the retasking pin's input/output as required |
cdcd9268 JW |
553 | * for the requested pin mode. Enum values of 2 or less are |
554 | * input modes. | |
555 | * | |
556 | * Dynamically switching the input/output buffers probably | |
a1e8d2da JW |
557 | * reduces noise slightly (particularly on input) so we'll |
558 | * do it. However, having both input and output buffers | |
559 | * enabled simultaneously doesn't seem to be problematic if | |
560 | * this turns out to be necessary in the future. | |
cdcd9268 JW |
561 | */ |
562 | if (val <= 2) { | |
47fd830a TI |
563 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
564 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
565 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | |
566 | HDA_AMP_MUTE, 0); | |
cdcd9268 | 567 | } else { |
47fd830a TI |
568 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
569 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
570 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
571 | HDA_AMP_MUTE, 0); | |
cdcd9268 JW |
572 | } |
573 | } | |
a9430dd8 JW |
574 | return change; |
575 | } | |
576 | ||
4c5186ed | 577 | #define ALC_PIN_MODE(xname, nid, dir) \ |
a9430dd8 | 578 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
4c5186ed JW |
579 | .info = alc_pin_mode_info, \ |
580 | .get = alc_pin_mode_get, \ | |
581 | .put = alc_pin_mode_put, \ | |
582 | .private_value = nid | (dir<<16) } | |
df694daa | 583 | |
5c8f858d JW |
584 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
585 | * together using a mask with more than one bit set. This control is | |
586 | * currently used only by the ALC260 test model. At this stage they are not | |
587 | * needed for any "production" models. | |
588 | */ | |
589 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 590 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
f12ab1e0 | 591 | |
9c7f852e TI |
592 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
593 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
594 | { |
595 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
596 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
597 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
598 | long *valp = ucontrol->value.integer.value; | |
9c7f852e TI |
599 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
600 | AC_VERB_GET_GPIO_DATA, 0x00); | |
5c8f858d JW |
601 | |
602 | *valp = (val & mask) != 0; | |
603 | return 0; | |
604 | } | |
9c7f852e TI |
605 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
606 | struct snd_ctl_elem_value *ucontrol) | |
5c8f858d JW |
607 | { |
608 | signed int change; | |
609 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
610 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
611 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
612 | long val = *ucontrol->value.integer.value; | |
9c7f852e TI |
613 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
614 | AC_VERB_GET_GPIO_DATA, | |
615 | 0x00); | |
5c8f858d JW |
616 | |
617 | /* Set/unset the masked GPIO bit(s) as needed */ | |
9c7f852e TI |
618 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
619 | if (val == 0) | |
5c8f858d JW |
620 | gpio_data &= ~mask; |
621 | else | |
622 | gpio_data |= mask; | |
82beb8fd TI |
623 | snd_hda_codec_write_cache(codec, nid, 0, |
624 | AC_VERB_SET_GPIO_DATA, gpio_data); | |
5c8f858d JW |
625 | |
626 | return change; | |
627 | } | |
628 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | |
629 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
630 | .info = alc_gpio_data_info, \ | |
631 | .get = alc_gpio_data_get, \ | |
632 | .put = alc_gpio_data_put, \ | |
633 | .private_value = nid | (mask<<16) } | |
634 | #endif /* CONFIG_SND_DEBUG */ | |
635 | ||
92621f13 JW |
636 | /* A switch control to allow the enabling of the digital IO pins on the |
637 | * ALC260. This is incredibly simplistic; the intention of this control is | |
638 | * to provide something in the test model allowing digital outputs to be | |
639 | * identified if present. If models are found which can utilise these | |
640 | * outputs a more complete mixer control can be devised for those models if | |
641 | * necessary. | |
642 | */ | |
643 | #ifdef CONFIG_SND_DEBUG | |
a5ce8890 | 644 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
f12ab1e0 | 645 | |
9c7f852e TI |
646 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
647 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
648 | { |
649 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
650 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
651 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
652 | long *valp = ucontrol->value.integer.value; | |
9c7f852e | 653 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 654 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
92621f13 JW |
655 | |
656 | *valp = (val & mask) != 0; | |
657 | return 0; | |
658 | } | |
9c7f852e TI |
659 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
660 | struct snd_ctl_elem_value *ucontrol) | |
92621f13 JW |
661 | { |
662 | signed int change; | |
663 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
664 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
665 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
666 | long val = *ucontrol->value.integer.value; | |
9c7f852e | 667 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
3982d17e | 668 | AC_VERB_GET_DIGI_CONVERT_1, |
9c7f852e | 669 | 0x00); |
92621f13 JW |
670 | |
671 | /* Set/unset the masked control bit(s) as needed */ | |
9c7f852e | 672 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
92621f13 JW |
673 | if (val==0) |
674 | ctrl_data &= ~mask; | |
675 | else | |
676 | ctrl_data |= mask; | |
82beb8fd TI |
677 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
678 | ctrl_data); | |
92621f13 JW |
679 | |
680 | return change; | |
681 | } | |
682 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | |
683 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
684 | .info = alc_spdif_ctrl_info, \ | |
685 | .get = alc_spdif_ctrl_get, \ | |
686 | .put = alc_spdif_ctrl_put, \ | |
687 | .private_value = nid | (mask<<16) } | |
688 | #endif /* CONFIG_SND_DEBUG */ | |
689 | ||
f8225f6d JW |
690 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
691 | * Again, this is only used in the ALC26x test models to help identify when | |
692 | * the EAPD line must be asserted for features to work. | |
693 | */ | |
694 | #ifdef CONFIG_SND_DEBUG | |
695 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | |
696 | ||
697 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | |
698 | struct snd_ctl_elem_value *ucontrol) | |
699 | { | |
700 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
701 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
702 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
703 | long *valp = ucontrol->value.integer.value; | |
704 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | |
705 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | |
706 | ||
707 | *valp = (val & mask) != 0; | |
708 | return 0; | |
709 | } | |
710 | ||
711 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |
712 | struct snd_ctl_elem_value *ucontrol) | |
713 | { | |
714 | int change; | |
715 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
716 | hda_nid_t nid = kcontrol->private_value & 0xffff; | |
717 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | |
718 | long val = *ucontrol->value.integer.value; | |
719 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | |
720 | AC_VERB_GET_EAPD_BTLENABLE, | |
721 | 0x00); | |
722 | ||
723 | /* Set/unset the masked control bit(s) as needed */ | |
724 | change = (!val ? 0 : mask) != (ctrl_data & mask); | |
725 | if (!val) | |
726 | ctrl_data &= ~mask; | |
727 | else | |
728 | ctrl_data |= mask; | |
729 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
730 | ctrl_data); | |
731 | ||
732 | return change; | |
733 | } | |
734 | ||
735 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | |
736 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | |
737 | .info = alc_eapd_ctrl_info, \ | |
738 | .get = alc_eapd_ctrl_get, \ | |
739 | .put = alc_eapd_ctrl_put, \ | |
740 | .private_value = nid | (mask<<16) } | |
741 | #endif /* CONFIG_SND_DEBUG */ | |
742 | ||
d88897ea TI |
743 | /* |
744 | */ | |
745 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | |
746 | { | |
747 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
748 | return; | |
749 | spec->mixers[spec->num_mixers++] = mix; | |
750 | } | |
751 | ||
752 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | |
753 | { | |
754 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) | |
755 | return; | |
756 | spec->init_verbs[spec->num_init_verbs++] = verb; | |
757 | } | |
758 | ||
df694daa KY |
759 | /* |
760 | * set up from the preset table | |
761 | */ | |
9c7f852e TI |
762 | static void setup_preset(struct alc_spec *spec, |
763 | const struct alc_config_preset *preset) | |
df694daa KY |
764 | { |
765 | int i; | |
766 | ||
767 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | |
d88897ea | 768 | add_mixer(spec, preset->mixers[i]); |
9c7f852e TI |
769 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
770 | i++) | |
d88897ea | 771 | add_verb(spec, preset->init_verbs[i]); |
ea1fb29a | 772 | |
df694daa KY |
773 | spec->channel_mode = preset->channel_mode; |
774 | spec->num_channel_mode = preset->num_channel_mode; | |
4e195a7b | 775 | spec->need_dac_fix = preset->need_dac_fix; |
df694daa KY |
776 | |
777 | spec->multiout.max_channels = spec->channel_mode[0].channels; | |
778 | ||
779 | spec->multiout.num_dacs = preset->num_dacs; | |
780 | spec->multiout.dac_nids = preset->dac_nids; | |
781 | spec->multiout.dig_out_nid = preset->dig_out_nid; | |
782 | spec->multiout.hp_nid = preset->hp_nid; | |
ea1fb29a | 783 | |
a1e8d2da | 784 | spec->num_mux_defs = preset->num_mux_defs; |
f12ab1e0 | 785 | if (!spec->num_mux_defs) |
a1e8d2da | 786 | spec->num_mux_defs = 1; |
df694daa KY |
787 | spec->input_mux = preset->input_mux; |
788 | ||
789 | spec->num_adc_nids = preset->num_adc_nids; | |
790 | spec->adc_nids = preset->adc_nids; | |
e1406348 | 791 | spec->capsrc_nids = preset->capsrc_nids; |
df694daa | 792 | spec->dig_in_nid = preset->dig_in_nid; |
ae6b813a TI |
793 | |
794 | spec->unsol_event = preset->unsol_event; | |
795 | spec->init_hook = preset->init_hook; | |
cb53c626 TI |
796 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
797 | spec->loopback.amplist = preset->loopbacks; | |
798 | #endif | |
df694daa KY |
799 | } |
800 | ||
bc9f98a9 KY |
801 | /* Enable GPIO mask and set output */ |
802 | static struct hda_verb alc_gpio1_init_verbs[] = { | |
803 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
804 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
805 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
806 | { } | |
807 | }; | |
808 | ||
809 | static struct hda_verb alc_gpio2_init_verbs[] = { | |
810 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | |
811 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
812 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
813 | { } | |
814 | }; | |
815 | ||
bdd148a3 KY |
816 | static struct hda_verb alc_gpio3_init_verbs[] = { |
817 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
818 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
819 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
820 | { } | |
821 | }; | |
822 | ||
2c3bf9ab TI |
823 | /* |
824 | * Fix hardware PLL issue | |
825 | * On some codecs, the analog PLL gating control must be off while | |
826 | * the default value is 1. | |
827 | */ | |
828 | static void alc_fix_pll(struct hda_codec *codec) | |
829 | { | |
830 | struct alc_spec *spec = codec->spec; | |
831 | unsigned int val; | |
832 | ||
833 | if (!spec->pll_nid) | |
834 | return; | |
835 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
836 | spec->pll_coef_idx); | |
837 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | |
838 | AC_VERB_GET_PROC_COEF, 0); | |
839 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | |
840 | spec->pll_coef_idx); | |
841 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | |
842 | val & ~(1 << spec->pll_coef_bit)); | |
843 | } | |
844 | ||
845 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
846 | unsigned int coef_idx, unsigned int coef_bit) | |
847 | { | |
848 | struct alc_spec *spec = codec->spec; | |
849 | spec->pll_nid = nid; | |
850 | spec->pll_coef_idx = coef_idx; | |
851 | spec->pll_coef_bit = coef_bit; | |
852 | alc_fix_pll(codec); | |
853 | } | |
854 | ||
c9b58006 KY |
855 | static void alc_sku_automute(struct hda_codec *codec) |
856 | { | |
857 | struct alc_spec *spec = codec->spec; | |
c9b58006 KY |
858 | unsigned int present; |
859 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; | |
860 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; | |
861 | ||
862 | /* need to execute and sync at first */ | |
863 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); | |
864 | present = snd_hda_codec_read(codec, hp_nid, 0, | |
865 | AC_VERB_GET_PIN_SENSE, 0); | |
866 | spec->jack_present = (present & 0x80000000) != 0; | |
f6c7e546 TI |
867 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
868 | spec->jack_present ? 0 : PIN_OUT); | |
c9b58006 KY |
869 | } |
870 | ||
4605b718 | 871 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
7fb0d78f KY |
872 | static void alc_mic_automute(struct hda_codec *codec) |
873 | { | |
874 | struct alc_spec *spec = codec->spec; | |
875 | unsigned int present; | |
876 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | |
877 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | |
878 | unsigned int mix_nid = spec->capsrc_nids[0]; | |
879 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; | |
880 | ||
881 | capsrc_idx_mic = mic_nid - 0x18; | |
882 | capsrc_idx_fmic = fmic_nid - 0x18; | |
883 | present = snd_hda_codec_read(codec, mic_nid, 0, | |
884 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
885 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
886 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); | |
887 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
888 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); | |
889 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, | |
890 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
891 | } | |
4605b718 TI |
892 | #else |
893 | #define alc_mic_automute(codec) /* NOP */ | |
894 | #endif /* disabled */ | |
7fb0d78f | 895 | |
c9b58006 KY |
896 | /* unsolicited event for HP jack sensing */ |
897 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |
898 | { | |
899 | if (codec->vendor_id == 0x10ec0880) | |
900 | res >>= 28; | |
901 | else | |
902 | res >>= 26; | |
7fb0d78f KY |
903 | if (res == ALC880_HP_EVENT) |
904 | alc_sku_automute(codec); | |
c9b58006 | 905 | |
7fb0d78f KY |
906 | if (res == ALC880_MIC_EVENT) |
907 | alc_mic_automute(codec); | |
908 | } | |
909 | ||
910 | static void alc_inithook(struct hda_codec *codec) | |
911 | { | |
c9b58006 | 912 | alc_sku_automute(codec); |
7fb0d78f | 913 | alc_mic_automute(codec); |
c9b58006 KY |
914 | } |
915 | ||
f9423e7a KY |
916 | /* additional initialization for ALC888 variants */ |
917 | static void alc888_coef_init(struct hda_codec *codec) | |
918 | { | |
919 | unsigned int tmp; | |
920 | ||
921 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | |
922 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
923 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | |
924 | if ((tmp & 0xf0) == 2) | |
925 | /* alc888S-VC */ | |
926 | snd_hda_codec_read(codec, 0x20, 0, | |
927 | AC_VERB_SET_PROC_COEF, 0x830); | |
928 | else | |
929 | /* alc888-VB */ | |
930 | snd_hda_codec_read(codec, 0x20, 0, | |
931 | AC_VERB_SET_PROC_COEF, 0x3030); | |
932 | } | |
933 | ||
bc9f98a9 KY |
934 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
935 | * 31 ~ 16 : Manufacture ID | |
936 | * 15 ~ 8 : SKU ID | |
937 | * 7 ~ 0 : Assembly ID | |
938 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
939 | */ | |
940 | static void alc_subsystem_id(struct hda_codec *codec, | |
941 | unsigned int porta, unsigned int porte, | |
942 | unsigned int portd) | |
943 | { | |
c9b58006 KY |
944 | unsigned int ass, tmp, i; |
945 | unsigned nid; | |
946 | struct alc_spec *spec = codec->spec; | |
bc9f98a9 | 947 | |
c9b58006 KY |
948 | ass = codec->subsystem_id & 0xffff; |
949 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | |
950 | goto do_sku; | |
951 | ||
ea1fb29a | 952 | /* |
c9b58006 KY |
953 | * 31~30 : port conetcivity |
954 | * 29~21 : reserve | |
955 | * 20 : PCBEEP input | |
956 | * 19~16 : Check sum (15:1) | |
957 | * 15~1 : Custom | |
958 | * 0 : override | |
959 | */ | |
960 | nid = 0x1d; | |
961 | if (codec->vendor_id == 0x10ec0260) | |
962 | nid = 0x17; | |
963 | ass = snd_hda_codec_read(codec, nid, 0, | |
964 | AC_VERB_GET_CONFIG_DEFAULT, 0); | |
965 | if (!(ass & 1) && !(ass & 0x100000)) | |
966 | return; | |
967 | if ((ass >> 30) != 1) /* no physical connection */ | |
bc9f98a9 KY |
968 | return; |
969 | ||
c9b58006 KY |
970 | /* check sum */ |
971 | tmp = 0; | |
972 | for (i = 1; i < 16; i++) { | |
8c427226 | 973 | if ((ass >> i) & 1) |
c9b58006 KY |
974 | tmp++; |
975 | } | |
976 | if (((ass >> 16) & 0xf) != tmp) | |
977 | return; | |
978 | do_sku: | |
979 | /* | |
980 | * 0 : override | |
981 | * 1 : Swap Jack | |
982 | * 2 : 0 --> Desktop, 1 --> Laptop | |
983 | * 3~5 : External Amplifier control | |
984 | * 7~6 : Reserved | |
985 | */ | |
bc9f98a9 KY |
986 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
987 | switch (tmp) { | |
988 | case 1: | |
989 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); | |
990 | break; | |
991 | case 3: | |
992 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); | |
993 | break; | |
bdd148a3 KY |
994 | case 7: |
995 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); | |
996 | break; | |
c9b58006 | 997 | case 5: /* set EAPD output high */ |
bdd148a3 | 998 | switch (codec->vendor_id) { |
c9b58006 KY |
999 | case 0x10ec0260: |
1000 | snd_hda_codec_write(codec, 0x0f, 0, | |
1001 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1002 | snd_hda_codec_write(codec, 0x10, 0, | |
1003 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1004 | break; | |
1005 | case 0x10ec0262: | |
bdd148a3 KY |
1006 | case 0x10ec0267: |
1007 | case 0x10ec0268: | |
c9b58006 | 1008 | case 0x10ec0269: |
f9423e7a KY |
1009 | case 0x10ec0660: |
1010 | case 0x10ec0662: | |
1011 | case 0x10ec0663: | |
c9b58006 | 1012 | case 0x10ec0862: |
20a3a05d | 1013 | case 0x10ec0889: |
bdd148a3 KY |
1014 | snd_hda_codec_write(codec, 0x14, 0, |
1015 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
1016 | snd_hda_codec_write(codec, 0x15, 0, | |
1017 | AC_VERB_SET_EAPD_BTLENABLE, 2); | |
c9b58006 | 1018 | break; |
bdd148a3 | 1019 | } |
c9b58006 KY |
1020 | switch (codec->vendor_id) { |
1021 | case 0x10ec0260: | |
1022 | snd_hda_codec_write(codec, 0x1a, 0, | |
1023 | AC_VERB_SET_COEF_INDEX, 7); | |
1024 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | |
1025 | AC_VERB_GET_PROC_COEF, 0); | |
1026 | snd_hda_codec_write(codec, 0x1a, 0, | |
1027 | AC_VERB_SET_COEF_INDEX, 7); | |
1028 | snd_hda_codec_write(codec, 0x1a, 0, | |
1029 | AC_VERB_SET_PROC_COEF, | |
1030 | tmp | 0x2010); | |
1031 | break; | |
1032 | case 0x10ec0262: | |
1033 | case 0x10ec0880: | |
1034 | case 0x10ec0882: | |
1035 | case 0x10ec0883: | |
1036 | case 0x10ec0885: | |
20a3a05d | 1037 | case 0x10ec0889: |
c9b58006 KY |
1038 | snd_hda_codec_write(codec, 0x20, 0, |
1039 | AC_VERB_SET_COEF_INDEX, 7); | |
1040 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1041 | AC_VERB_GET_PROC_COEF, 0); | |
1042 | snd_hda_codec_write(codec, 0x20, 0, | |
ea1fb29a | 1043 | AC_VERB_SET_COEF_INDEX, 7); |
c9b58006 KY |
1044 | snd_hda_codec_write(codec, 0x20, 0, |
1045 | AC_VERB_SET_PROC_COEF, | |
1046 | tmp | 0x2010); | |
1047 | break; | |
f9423e7a | 1048 | case 0x10ec0888: |
1082c748 | 1049 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
f9423e7a | 1050 | break; |
c9b58006 KY |
1051 | case 0x10ec0267: |
1052 | case 0x10ec0268: | |
1053 | snd_hda_codec_write(codec, 0x20, 0, | |
1054 | AC_VERB_SET_COEF_INDEX, 7); | |
1055 | tmp = snd_hda_codec_read(codec, 0x20, 0, | |
1056 | AC_VERB_GET_PROC_COEF, 0); | |
1057 | snd_hda_codec_write(codec, 0x20, 0, | |
ea1fb29a | 1058 | AC_VERB_SET_COEF_INDEX, 7); |
c9b58006 KY |
1059 | snd_hda_codec_write(codec, 0x20, 0, |
1060 | AC_VERB_SET_PROC_COEF, | |
1061 | tmp | 0x3000); | |
1062 | break; | |
bc9f98a9 | 1063 | } |
c9b58006 | 1064 | default: |
bc9f98a9 KY |
1065 | break; |
1066 | } | |
ea1fb29a | 1067 | |
8c427226 | 1068 | /* is laptop or Desktop and enable the function "Mute internal speaker |
c9b58006 KY |
1069 | * when the external headphone out jack is plugged" |
1070 | */ | |
8c427226 | 1071 | if (!(ass & 0x8000)) |
c9b58006 KY |
1072 | return; |
1073 | /* | |
1074 | * 10~8 : Jack location | |
1075 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
1076 | * 14~13: Resvered | |
1077 | * 15 : 1 --> enable the function "Mute internal speaker | |
1078 | * when the external headphone out jack is plugged" | |
1079 | */ | |
1080 | if (!spec->autocfg.speaker_pins[0]) { | |
8c427226 | 1081 | if (spec->autocfg.line_out_pins[0]) |
c9b58006 | 1082 | spec->autocfg.speaker_pins[0] = |
8c427226 | 1083 | spec->autocfg.line_out_pins[0]; |
c9b58006 KY |
1084 | else |
1085 | return; | |
1086 | } | |
1087 | ||
1088 | if (!spec->autocfg.hp_pins[0]) { | |
1089 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | |
1090 | if (tmp == 0) | |
1091 | spec->autocfg.hp_pins[0] = porta; | |
1092 | else if (tmp == 1) | |
1093 | spec->autocfg.hp_pins[0] = porte; | |
1094 | else if (tmp == 2) | |
1095 | spec->autocfg.hp_pins[0] = portd; | |
1096 | else | |
1097 | return; | |
1098 | } | |
7fb0d78f KY |
1099 | if (spec->autocfg.hp_pins[0]) |
1100 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, | |
1101 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1102 | AC_USRSP_EN | ALC880_HP_EVENT); | |
c9b58006 | 1103 | |
4605b718 | 1104 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
7fb0d78f KY |
1105 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
1106 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) | |
1107 | snd_hda_codec_write(codec, | |
1108 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, | |
1109 | AC_VERB_SET_UNSOLICITED_ENABLE, | |
1110 | AC_USRSP_EN | ALC880_MIC_EVENT); | |
4605b718 | 1111 | #endif /* disabled */ |
ea1fb29a | 1112 | |
c9b58006 | 1113 | spec->unsol_event = alc_sku_unsol_event; |
bc9f98a9 KY |
1114 | } |
1115 | ||
f95474ec TI |
1116 | /* |
1117 | * Fix-up pin default configurations | |
1118 | */ | |
1119 | ||
1120 | struct alc_pincfg { | |
1121 | hda_nid_t nid; | |
1122 | u32 val; | |
1123 | }; | |
1124 | ||
1125 | static void alc_fix_pincfg(struct hda_codec *codec, | |
1126 | const struct snd_pci_quirk *quirk, | |
1127 | const struct alc_pincfg **pinfix) | |
1128 | { | |
1129 | const struct alc_pincfg *cfg; | |
1130 | ||
1131 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | |
1132 | if (!quirk) | |
1133 | return; | |
1134 | ||
1135 | cfg = pinfix[quirk->value]; | |
1136 | for (; cfg->nid; cfg++) { | |
1137 | int i; | |
1138 | u32 val = cfg->val; | |
1139 | for (i = 0; i < 4; i++) { | |
1140 | snd_hda_codec_write(codec, cfg->nid, 0, | |
1141 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, | |
1142 | val & 0xff); | |
1143 | val >>= 8; | |
1144 | } | |
1145 | } | |
1146 | } | |
1147 | ||
1da177e4 | 1148 | /* |
e9edcee0 TI |
1149 | * ALC880 3-stack model |
1150 | * | |
1151 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | |
9c7f852e TI |
1152 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
1153 | * F-Mic = 0x1b, HP = 0x19 | |
1da177e4 LT |
1154 | */ |
1155 | ||
e9edcee0 TI |
1156 | static hda_nid_t alc880_dac_nids[4] = { |
1157 | /* front, rear, clfe, rear_surr */ | |
1158 | 0x02, 0x05, 0x04, 0x03 | |
1159 | }; | |
1160 | ||
1161 | static hda_nid_t alc880_adc_nids[3] = { | |
1162 | /* ADC0-2 */ | |
1163 | 0x07, 0x08, 0x09, | |
1164 | }; | |
1165 | ||
1166 | /* The datasheet says the node 0x07 is connected from inputs, | |
1167 | * but it shows zero connection in the real implementation on some devices. | |
df694daa | 1168 | * Note: this is a 915GAV bug, fixed on 915GLV |
1da177e4 | 1169 | */ |
e9edcee0 TI |
1170 | static hda_nid_t alc880_adc_nids_alt[2] = { |
1171 | /* ADC1-2 */ | |
1172 | 0x08, 0x09, | |
1173 | }; | |
1174 | ||
1175 | #define ALC880_DIGOUT_NID 0x06 | |
1176 | #define ALC880_DIGIN_NID 0x0a | |
1177 | ||
1178 | static struct hda_input_mux alc880_capture_source = { | |
1179 | .num_items = 4, | |
1180 | .items = { | |
1181 | { "Mic", 0x0 }, | |
1182 | { "Front Mic", 0x3 }, | |
1183 | { "Line", 0x2 }, | |
1184 | { "CD", 0x4 }, | |
1185 | }, | |
1186 | }; | |
1187 | ||
1188 | /* channel source setting (2/6 channel selection for 3-stack) */ | |
1189 | /* 2ch mode */ | |
1190 | static struct hda_verb alc880_threestack_ch2_init[] = { | |
1191 | /* set line-in to input, mute it */ | |
1192 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1193 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1194 | /* set mic-in to input vref 80%, mute it */ | |
1195 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
1196 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
1197 | { } /* end */ | |
1198 | }; | |
1199 | ||
1200 | /* 6ch mode */ | |
1201 | static struct hda_verb alc880_threestack_ch6_init[] = { | |
1202 | /* set line-in to output, unmute it */ | |
1203 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1204 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1205 | /* set mic-in to output, unmute it */ | |
1206 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1207 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1208 | { } /* end */ | |
1209 | }; | |
1210 | ||
d2a6d7dc | 1211 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
e9edcee0 TI |
1212 | { 2, alc880_threestack_ch2_init }, |
1213 | { 6, alc880_threestack_ch6_init }, | |
1214 | }; | |
1215 | ||
c8b6bf9b | 1216 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
05acb863 | 1217 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1218 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 1219 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 1220 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
05acb863 TI |
1221 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1222 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1223 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1224 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1da177e4 LT |
1225 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1226 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1227 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1228 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1229 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1230 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1231 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
1232 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
1233 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1234 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
e9edcee0 TI |
1235 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
1236 | { | |
1237 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1238 | .name = "Channel Mode", | |
df694daa KY |
1239 | .info = alc_ch_mode_info, |
1240 | .get = alc_ch_mode_get, | |
1241 | .put = alc_ch_mode_put, | |
e9edcee0 TI |
1242 | }, |
1243 | { } /* end */ | |
1244 | }; | |
1245 | ||
1246 | /* capture mixer elements */ | |
c8b6bf9b | 1247 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
e9edcee0 TI |
1248 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
1249 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
1250 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), | |
1251 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), | |
1252 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), | |
1253 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), | |
1da177e4 LT |
1254 | { |
1255 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1256 | /* The multiple "Capture Source" controls confuse alsamixer | |
1257 | * So call somewhat different.. | |
1da177e4 LT |
1258 | */ |
1259 | /* .name = "Capture Source", */ | |
1260 | .name = "Input Source", | |
e9edcee0 | 1261 | .count = 3, |
1da177e4 LT |
1262 | .info = alc_mux_enum_info, |
1263 | .get = alc_mux_enum_get, | |
1264 | .put = alc_mux_enum_put, | |
1265 | }, | |
1da177e4 LT |
1266 | { } /* end */ |
1267 | }; | |
1268 | ||
e9edcee0 | 1269 | /* capture mixer elements (in case NID 0x07 not available) */ |
c8b6bf9b | 1270 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
71fe7b82 TI |
1271 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
1272 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
1273 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
1274 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
1da177e4 LT |
1275 | { |
1276 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1277 | /* The multiple "Capture Source" controls confuse alsamixer | |
1278 | * So call somewhat different.. | |
1da177e4 LT |
1279 | */ |
1280 | /* .name = "Capture Source", */ | |
1281 | .name = "Input Source", | |
1282 | .count = 2, | |
1283 | .info = alc_mux_enum_info, | |
1284 | .get = alc_mux_enum_get, | |
1285 | .put = alc_mux_enum_put, | |
1286 | }, | |
1da177e4 LT |
1287 | }; |
1288 | ||
e9edcee0 TI |
1289 | |
1290 | ||
1291 | /* | |
1292 | * ALC880 5-stack model | |
1293 | * | |
9c7f852e TI |
1294 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
1295 | * Side = 0x02 (0xd) | |
e9edcee0 TI |
1296 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
1297 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | |
1298 | */ | |
1299 | ||
1300 | /* additional mixers to alc880_three_stack_mixer */ | |
c8b6bf9b | 1301 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
e9edcee0 | 1302 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1303 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
1da177e4 LT |
1304 | { } /* end */ |
1305 | }; | |
1306 | ||
e9edcee0 TI |
1307 | /* channel source setting (6/8 channel selection for 5-stack) */ |
1308 | /* 6ch mode */ | |
1309 | static struct hda_verb alc880_fivestack_ch6_init[] = { | |
1310 | /* set line-in to input, mute it */ | |
1311 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
1312 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
dfc0ff62 TI |
1313 | { } /* end */ |
1314 | }; | |
1315 | ||
e9edcee0 TI |
1316 | /* 8ch mode */ |
1317 | static struct hda_verb alc880_fivestack_ch8_init[] = { | |
1318 | /* set line-in to output, unmute it */ | |
1319 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
1320 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
1321 | { } /* end */ | |
1322 | }; | |
1323 | ||
d2a6d7dc | 1324 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
e9edcee0 TI |
1325 | { 6, alc880_fivestack_ch6_init }, |
1326 | { 8, alc880_fivestack_ch8_init }, | |
1327 | }; | |
1328 | ||
1329 | ||
1330 | /* | |
1331 | * ALC880 6-stack model | |
1332 | * | |
9c7f852e TI |
1333 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
1334 | * Side = 0x05 (0x0f) | |
e9edcee0 TI |
1335 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
1336 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | |
1337 | */ | |
1338 | ||
1339 | static hda_nid_t alc880_6st_dac_nids[4] = { | |
1340 | /* front, rear, clfe, rear_surr */ | |
1341 | 0x02, 0x03, 0x04, 0x05 | |
f12ab1e0 | 1342 | }; |
e9edcee0 TI |
1343 | |
1344 | static struct hda_input_mux alc880_6stack_capture_source = { | |
1345 | .num_items = 4, | |
1346 | .items = { | |
1347 | { "Mic", 0x0 }, | |
1348 | { "Front Mic", 0x1 }, | |
1349 | { "Line", 0x2 }, | |
1350 | { "CD", 0x4 }, | |
1351 | }, | |
1352 | }; | |
1353 | ||
1354 | /* fixed 8-channels */ | |
d2a6d7dc | 1355 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
e9edcee0 TI |
1356 | { 8, NULL }, |
1357 | }; | |
1358 | ||
c8b6bf9b | 1359 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
16ded525 | 1360 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1361 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1362 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1363 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1364 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1365 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1366 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1367 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 | 1368 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 1369 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
16ded525 TI |
1370 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1371 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1372 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1373 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1374 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1375 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1376 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1377 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1378 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1379 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
16ded525 TI |
1380 | { |
1381 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1382 | .name = "Channel Mode", | |
df694daa KY |
1383 | .info = alc_ch_mode_info, |
1384 | .get = alc_ch_mode_get, | |
1385 | .put = alc_ch_mode_put, | |
16ded525 TI |
1386 | }, |
1387 | { } /* end */ | |
1388 | }; | |
1389 | ||
e9edcee0 TI |
1390 | |
1391 | /* | |
1392 | * ALC880 W810 model | |
1393 | * | |
1394 | * W810 has rear IO for: | |
1395 | * Front (DAC 02) | |
1396 | * Surround (DAC 03) | |
1397 | * Center/LFE (DAC 04) | |
1398 | * Digital out (06) | |
1399 | * | |
1400 | * The system also has a pair of internal speakers, and a headphone jack. | |
1401 | * These are both connected to Line2 on the codec, hence to DAC 02. | |
ea1fb29a | 1402 | * |
e9edcee0 TI |
1403 | * There is a variable resistor to control the speaker or headphone |
1404 | * volume. This is a hardware-only device without a software API. | |
1405 | * | |
1406 | * Plugging headphones in will disable the internal speakers. This is | |
1407 | * implemented in hardware, not via the driver using jack sense. In | |
1408 | * a similar fashion, plugging into the rear socket marked "front" will | |
1409 | * disable both the speakers and headphones. | |
1410 | * | |
1411 | * For input, there's a microphone jack, and an "audio in" jack. | |
1412 | * These may not do anything useful with this driver yet, because I | |
1413 | * haven't setup any initialization verbs for these yet... | |
1414 | */ | |
1415 | ||
1416 | static hda_nid_t alc880_w810_dac_nids[3] = { | |
1417 | /* front, rear/surround, clfe */ | |
1418 | 0x02, 0x03, 0x04 | |
16ded525 TI |
1419 | }; |
1420 | ||
e9edcee0 | 1421 | /* fixed 6 channels */ |
d2a6d7dc | 1422 | static struct hda_channel_mode alc880_w810_modes[1] = { |
e9edcee0 TI |
1423 | { 6, NULL } |
1424 | }; | |
1425 | ||
1426 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | |
c8b6bf9b | 1427 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
16ded525 | 1428 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1429 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1430 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1431 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1432 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1433 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1434 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1435 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
e9edcee0 TI |
1436 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
1437 | { } /* end */ | |
1438 | }; | |
1439 | ||
1440 | ||
1441 | /* | |
1442 | * Z710V model | |
1443 | * | |
1444 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | |
9c7f852e TI |
1445 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
1446 | * Line = 0x1a | |
e9edcee0 TI |
1447 | */ |
1448 | ||
1449 | static hda_nid_t alc880_z71v_dac_nids[1] = { | |
1450 | 0x02 | |
1451 | }; | |
1452 | #define ALC880_Z71V_HP_DAC 0x03 | |
1453 | ||
1454 | /* fixed 2 channels */ | |
d2a6d7dc | 1455 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
e9edcee0 TI |
1456 | { 2, NULL } |
1457 | }; | |
1458 | ||
c8b6bf9b | 1459 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
e9edcee0 | 1460 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1461 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
e9edcee0 | 1462 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1463 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1464 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1465 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
16ded525 TI |
1466 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1467 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
1468 | { } /* end */ |
1469 | }; | |
1470 | ||
e9edcee0 | 1471 | |
e9edcee0 TI |
1472 | /* |
1473 | * ALC880 F1734 model | |
1474 | * | |
1475 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | |
1476 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | |
1477 | */ | |
1478 | ||
1479 | static hda_nid_t alc880_f1734_dac_nids[1] = { | |
1480 | 0x03 | |
1481 | }; | |
1482 | #define ALC880_F1734_HP_DAC 0x02 | |
1483 | ||
c8b6bf9b | 1484 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
e9edcee0 | 1485 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1486 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
2134ea4f TI |
1487 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
1488 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
e9edcee0 TI |
1489 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1490 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
937b4160 TI |
1491 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
1492 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
e9edcee0 TI |
1493 | { } /* end */ |
1494 | }; | |
1495 | ||
937b4160 TI |
1496 | static struct hda_input_mux alc880_f1734_capture_source = { |
1497 | .num_items = 2, | |
1498 | .items = { | |
1499 | { "Mic", 0x1 }, | |
1500 | { "CD", 0x4 }, | |
1501 | }, | |
1502 | }; | |
1503 | ||
e9edcee0 | 1504 | |
e9edcee0 TI |
1505 | /* |
1506 | * ALC880 ASUS model | |
1507 | * | |
1508 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
1509 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
1510 | * Mic = 0x18, Line = 0x1a | |
1511 | */ | |
1512 | ||
1513 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | |
1514 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | |
1515 | ||
c8b6bf9b | 1516 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
16ded525 | 1517 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 1518 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
16ded525 | 1519 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 1520 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
16ded525 TI |
1521 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1522 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
1523 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
1524 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
16ded525 TI |
1525 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1526 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1527 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1528 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
16ded525 TI |
1529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
16ded525 TI |
1531 | { |
1532 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1533 | .name = "Channel Mode", | |
df694daa KY |
1534 | .info = alc_ch_mode_info, |
1535 | .get = alc_ch_mode_get, | |
1536 | .put = alc_ch_mode_put, | |
16ded525 TI |
1537 | }, |
1538 | { } /* end */ | |
1539 | }; | |
e9edcee0 | 1540 | |
e9edcee0 TI |
1541 | /* |
1542 | * ALC880 ASUS W1V model | |
1543 | * | |
1544 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | |
1545 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | |
1546 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | |
1547 | */ | |
1548 | ||
1549 | /* additional mixers to alc880_asus_mixer */ | |
c8b6bf9b | 1550 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
e9edcee0 TI |
1551 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
1552 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
1553 | { } /* end */ | |
1554 | }; | |
1555 | ||
3c10a9d9 | 1556 | /* additional mixers to alc880_asus_mixer */ |
c8b6bf9b | 1557 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
3c10a9d9 TI |
1558 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
1559 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1560 | { } /* end */ | |
1561 | }; | |
e9edcee0 | 1562 | |
df694daa KY |
1563 | /* TCL S700 */ |
1564 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | |
1565 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1566 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
1567 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
1568 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | |
1569 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | |
1570 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | |
1571 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | |
1572 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
1573 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
1574 | { | |
1575 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1576 | /* The multiple "Capture Source" controls confuse alsamixer | |
1577 | * So call somewhat different.. | |
df694daa KY |
1578 | */ |
1579 | /* .name = "Capture Source", */ | |
1580 | .name = "Input Source", | |
1581 | .count = 1, | |
1582 | .info = alc_mux_enum_info, | |
1583 | .get = alc_mux_enum_get, | |
1584 | .put = alc_mux_enum_put, | |
1585 | }, | |
1586 | { } /* end */ | |
1587 | }; | |
1588 | ||
ccc656ce KY |
1589 | /* Uniwill */ |
1590 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |
2134ea4f TI |
1591 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
1592 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1593 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1594 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
1595 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
1596 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
1597 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
1598 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
1599 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1600 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1601 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
1602 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
1603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1605 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1606 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1607 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
1608 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1609 | { | |
1610 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
1611 | .name = "Channel Mode", | |
1612 | .info = alc_ch_mode_info, | |
1613 | .get = alc_ch_mode_get, | |
1614 | .put = alc_ch_mode_put, | |
1615 | }, | |
1616 | { } /* end */ | |
1617 | }; | |
1618 | ||
2cf9f0fc TD |
1619 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
1620 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
1621 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1622 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1623 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
1624 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
1625 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
1626 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
1627 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1628 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
1629 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
1630 | { } /* end */ | |
1631 | }; | |
1632 | ||
ccc656ce | 1633 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
2134ea4f TI |
1634 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
1635 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
1636 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
1637 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
ccc656ce KY |
1638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
1640 | { } /* end */ | |
1641 | }; | |
1642 | ||
2134ea4f TI |
1643 | /* |
1644 | * virtual master controls | |
1645 | */ | |
1646 | ||
1647 | /* | |
1648 | * slave controls for virtual master | |
1649 | */ | |
1650 | static const char *alc_slave_vols[] = { | |
1651 | "Front Playback Volume", | |
1652 | "Surround Playback Volume", | |
1653 | "Center Playback Volume", | |
1654 | "LFE Playback Volume", | |
1655 | "Side Playback Volume", | |
1656 | "Headphone Playback Volume", | |
1657 | "Speaker Playback Volume", | |
1658 | "Mono Playback Volume", | |
2134ea4f TI |
1659 | "Line-Out Playback Volume", |
1660 | NULL, | |
1661 | }; | |
1662 | ||
1663 | static const char *alc_slave_sws[] = { | |
1664 | "Front Playback Switch", | |
1665 | "Surround Playback Switch", | |
1666 | "Center Playback Switch", | |
1667 | "LFE Playback Switch", | |
1668 | "Side Playback Switch", | |
1669 | "Headphone Playback Switch", | |
1670 | "Speaker Playback Switch", | |
1671 | "Mono Playback Switch", | |
edb54a55 | 1672 | "IEC958 Playback Switch", |
2134ea4f TI |
1673 | NULL, |
1674 | }; | |
1675 | ||
1da177e4 | 1676 | /* |
e9edcee0 | 1677 | * build control elements |
1da177e4 | 1678 | */ |
603c4019 TI |
1679 | |
1680 | static void alc_free_kctls(struct hda_codec *codec); | |
1681 | ||
1da177e4 LT |
1682 | static int alc_build_controls(struct hda_codec *codec) |
1683 | { | |
1684 | struct alc_spec *spec = codec->spec; | |
1685 | int err; | |
1686 | int i; | |
1687 | ||
1688 | for (i = 0; i < spec->num_mixers; i++) { | |
1689 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
1690 | if (err < 0) | |
1691 | return err; | |
1692 | } | |
1693 | ||
1694 | if (spec->multiout.dig_out_nid) { | |
9c7f852e TI |
1695 | err = snd_hda_create_spdif_out_ctls(codec, |
1696 | spec->multiout.dig_out_nid); | |
1da177e4 LT |
1697 | if (err < 0) |
1698 | return err; | |
9a08160b TI |
1699 | err = snd_hda_create_spdif_share_sw(codec, |
1700 | &spec->multiout); | |
1701 | if (err < 0) | |
1702 | return err; | |
1703 | spec->multiout.share_spdif = 1; | |
1da177e4 LT |
1704 | } |
1705 | if (spec->dig_in_nid) { | |
1706 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | |
1707 | if (err < 0) | |
1708 | return err; | |
1709 | } | |
2134ea4f TI |
1710 | |
1711 | /* if we have no master control, let's create it */ | |
1712 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | |
1c82ed1b | 1713 | unsigned int vmaster_tlv[4]; |
2134ea4f | 1714 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
1c82ed1b | 1715 | HDA_OUTPUT, vmaster_tlv); |
2134ea4f | 1716 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1c82ed1b | 1717 | vmaster_tlv, alc_slave_vols); |
2134ea4f TI |
1718 | if (err < 0) |
1719 | return err; | |
1720 | } | |
1721 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | |
1722 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | |
1723 | NULL, alc_slave_sws); | |
1724 | if (err < 0) | |
1725 | return err; | |
1726 | } | |
1727 | ||
603c4019 | 1728 | alc_free_kctls(codec); /* no longer needed */ |
1da177e4 LT |
1729 | return 0; |
1730 | } | |
1731 | ||
e9edcee0 | 1732 | |
1da177e4 LT |
1733 | /* |
1734 | * initialize the codec volumes, etc | |
1735 | */ | |
1736 | ||
e9edcee0 TI |
1737 | /* |
1738 | * generic initialization of ADC, input mixers and output mixers | |
1739 | */ | |
1740 | static struct hda_verb alc880_volume_init_verbs[] = { | |
1741 | /* | |
1742 | * Unmute ADC0-2 and set the default input to mic-in | |
1743 | */ | |
71fe7b82 | 1744 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1745 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 1746 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
71fe7b82 | 1748 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 1749 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 | 1750 | |
e9edcee0 TI |
1751 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
1752 | * mixer widget | |
9c7f852e TI |
1753 | * Note: PASD motherboards uses the Line In 2 as the input for front |
1754 | * panel mic (mic 2) | |
1da177e4 | 1755 | */ |
e9edcee0 | 1756 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
cb53c626 TI |
1757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
1760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
1761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1762 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
1763 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
1da177e4 | 1764 | |
e9edcee0 TI |
1765 | /* |
1766 | * Set up output mixers (0x0c - 0x0f) | |
1da177e4 | 1767 | */ |
e9edcee0 TI |
1768 | /* set vol=0 to output mixers */ |
1769 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1770 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1771 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1772 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
1773 | /* set up input amps for analog loopback */ | |
1774 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
05acb863 TI |
1775 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1776 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1777 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1778 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1779 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
05acb863 TI |
1781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
1782 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
1783 | |
1784 | { } | |
1785 | }; | |
1786 | ||
e9edcee0 TI |
1787 | /* |
1788 | * 3-stack pin configuration: | |
1789 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
1790 | */ | |
1791 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | |
1792 | /* | |
1793 | * preset connection lists of input pins | |
1794 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1795 | */ | |
1796 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
1797 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1798 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
1799 | ||
1800 | /* | |
1801 | * Set pin mode and muting | |
1802 | */ | |
1803 | /* set front pin widgets 0x14 for output */ | |
05acb863 | 1804 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
1805 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1806 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1807 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1808 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1809 | /* Mic2 (as headphone out) for HP output */ | |
1810 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1811 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1da177e4 | 1812 | /* Line In pin widget for input */ |
05acb863 | 1813 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
1814 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1815 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
1816 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1817 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1da177e4 | 1818 | /* CD pin widget for input */ |
05acb863 | 1819 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 1820 | |
e9edcee0 TI |
1821 | { } |
1822 | }; | |
1da177e4 | 1823 | |
e9edcee0 TI |
1824 | /* |
1825 | * 5-stack pin configuration: | |
1826 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | |
1827 | * line-in/side = 0x1a, f-mic = 0x1b | |
1828 | */ | |
1829 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | |
1830 | /* | |
1831 | * preset connection lists of input pins | |
1832 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | |
1da177e4 | 1833 | */ |
e9edcee0 TI |
1834 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
1835 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | |
1da177e4 | 1836 | |
e9edcee0 TI |
1837 | /* |
1838 | * Set pin mode and muting | |
1da177e4 | 1839 | */ |
e9edcee0 TI |
1840 | /* set pin widgets 0x14-0x17 for output */ |
1841 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1842 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1843 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1844 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1845 | /* unmute pins for output (no gain on this amp) */ | |
1846 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1848 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1849 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1850 | ||
1851 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
1852 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1853 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1854 | /* Mic2 (as headphone out) for HP output */ | |
1855 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1856 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1857 | /* Line In pin widget for input */ | |
1858 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1859 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1860 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | |
1861 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1862 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1863 | /* CD pin widget for input */ | |
1864 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1da177e4 LT |
1865 | |
1866 | { } | |
1867 | }; | |
1868 | ||
e9edcee0 TI |
1869 | /* |
1870 | * W810 pin configuration: | |
1871 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | |
1872 | */ | |
1873 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | |
1874 | /* hphone/speaker input selector: front DAC */ | |
1875 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | |
1da177e4 | 1876 | |
05acb863 | 1877 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1878 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1879 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1880 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1881 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1882 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 1883 | |
e9edcee0 | 1884 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
05acb863 | 1885 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1da177e4 | 1886 | |
1da177e4 LT |
1887 | { } |
1888 | }; | |
1889 | ||
e9edcee0 TI |
1890 | /* |
1891 | * Z71V pin configuration: | |
1892 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | |
1893 | */ | |
1894 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | |
05acb863 | 1895 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1896 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
05acb863 | 1897 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 1898 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
dfc0ff62 | 1899 | |
16ded525 | 1900 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1901 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 | 1902 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1903 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
16ded525 TI |
1904 | |
1905 | { } | |
1906 | }; | |
1907 | ||
e9edcee0 TI |
1908 | /* |
1909 | * 6-stack pin configuration: | |
9c7f852e TI |
1910 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
1911 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | |
e9edcee0 TI |
1912 | */ |
1913 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |
1914 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1915 | ||
16ded525 | 1916 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1917 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1918 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1919 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1920 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 1921 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1922 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
1923 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1924 | ||
16ded525 | 1925 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1926 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1927 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 | 1928 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1929 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 | 1930 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 1931 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
e9edcee0 | 1932 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 1933 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 1934 | |
e9edcee0 TI |
1935 | { } |
1936 | }; | |
1937 | ||
ccc656ce KY |
1938 | /* |
1939 | * Uniwill pin configuration: | |
1940 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | |
1941 | * line = 0x1a | |
1942 | */ | |
1943 | static struct hda_verb alc880_uniwill_init_verbs[] = { | |
1944 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1945 | ||
1946 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1947 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1948 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1949 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1950 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1951 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1952 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
1953 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1954 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1955 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1956 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1957 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1958 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1959 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1960 | ||
1961 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1962 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1963 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1964 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1965 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1966 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1967 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | |
1968 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
1969 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
1970 | ||
1971 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
1972 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
1973 | ||
1974 | { } | |
1975 | }; | |
1976 | ||
1977 | /* | |
1978 | * Uniwill P53 | |
ea1fb29a | 1979 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
ccc656ce KY |
1980 | */ |
1981 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | |
1982 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
1983 | ||
1984 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1985 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1986 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1987 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1988 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
1989 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
1990 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1991 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1992 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1993 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1994 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
1995 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
1996 | ||
1997 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
1998 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
1999 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2000 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2001 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2002 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2003 | ||
2004 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
2005 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | |
2006 | ||
2007 | { } | |
2008 | }; | |
2009 | ||
2cf9f0fc TD |
2010 | static struct hda_verb alc880_beep_init_verbs[] = { |
2011 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | |
2012 | { } | |
2013 | }; | |
2014 | ||
ccc656ce | 2015 | /* toggle speaker-output according to the hp-jack state */ |
458a4fab | 2016 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
ccc656ce KY |
2017 | { |
2018 | unsigned int present; | |
f12ab1e0 | 2019 | unsigned char bits; |
ccc656ce KY |
2020 | |
2021 | present = snd_hda_codec_read(codec, 0x14, 0, | |
2022 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2023 | bits = present ? HDA_AMP_MUTE : 0; |
2024 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
2025 | HDA_AMP_MUTE, bits); | |
2026 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
2027 | HDA_AMP_MUTE, bits); | |
458a4fab TI |
2028 | } |
2029 | ||
2030 | /* auto-toggle front mic */ | |
2031 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | |
2032 | { | |
2033 | unsigned int present; | |
2034 | unsigned char bits; | |
ccc656ce KY |
2035 | |
2036 | present = snd_hda_codec_read(codec, 0x18, 0, | |
2037 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2038 | bits = present ? HDA_AMP_MUTE : 0; |
2039 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
458a4fab TI |
2040 | } |
2041 | ||
2042 | static void alc880_uniwill_automute(struct hda_codec *codec) | |
2043 | { | |
2044 | alc880_uniwill_hp_automute(codec); | |
2045 | alc880_uniwill_mic_automute(codec); | |
ccc656ce KY |
2046 | } |
2047 | ||
2048 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | |
2049 | unsigned int res) | |
2050 | { | |
2051 | /* Looks like the unsol event is incompatible with the standard | |
2052 | * definition. 4bit tag is placed at 28 bit! | |
2053 | */ | |
458a4fab TI |
2054 | switch (res >> 28) { |
2055 | case ALC880_HP_EVENT: | |
2056 | alc880_uniwill_hp_automute(codec); | |
2057 | break; | |
2058 | case ALC880_MIC_EVENT: | |
2059 | alc880_uniwill_mic_automute(codec); | |
2060 | break; | |
2061 | } | |
ccc656ce KY |
2062 | } |
2063 | ||
2064 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) | |
2065 | { | |
2066 | unsigned int present; | |
f12ab1e0 | 2067 | unsigned char bits; |
ccc656ce KY |
2068 | |
2069 | present = snd_hda_codec_read(codec, 0x14, 0, | |
2070 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a | 2071 | bits = present ? HDA_AMP_MUTE : 0; |
64654c2f | 2072 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
ccc656ce KY |
2073 | } |
2074 | ||
2075 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | |
2076 | { | |
2077 | unsigned int present; | |
ea1fb29a | 2078 | |
ccc656ce | 2079 | present = snd_hda_codec_read(codec, 0x21, 0, |
47fd830a TI |
2080 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
2081 | present &= HDA_AMP_VOLMASK; | |
2082 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | |
2083 | HDA_AMP_VOLMASK, present); | |
2084 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | |
2085 | HDA_AMP_VOLMASK, present); | |
ccc656ce | 2086 | } |
47fd830a | 2087 | |
ccc656ce KY |
2088 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
2089 | unsigned int res) | |
2090 | { | |
2091 | /* Looks like the unsol event is incompatible with the standard | |
2092 | * definition. 4bit tag is placed at 28 bit! | |
2093 | */ | |
2094 | if ((res >> 28) == ALC880_HP_EVENT) | |
2095 | alc880_uniwill_p53_hp_automute(codec); | |
f12ab1e0 | 2096 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
ccc656ce KY |
2097 | alc880_uniwill_p53_dcvol_automute(codec); |
2098 | } | |
2099 | ||
e9edcee0 TI |
2100 | /* |
2101 | * F1734 pin configuration: | |
2102 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | |
2103 | */ | |
2104 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |
ee7a9c7c | 2105 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
16ded525 TI |
2106 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
2107 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2108 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2109 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2110 | ||
e9edcee0 | 2111 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
16ded525 | 2112 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
e9edcee0 | 2113 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
16ded525 | 2114 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2115 | |
e9edcee0 TI |
2116 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
2117 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
ee7a9c7c | 2118 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
e9edcee0 | 2119 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
16ded525 | 2120 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2121 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2122 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2123 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2124 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
dfc0ff62 | 2125 | |
937b4160 TI |
2126 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
2127 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | |
2128 | ||
dfc0ff62 TI |
2129 | { } |
2130 | }; | |
2131 | ||
e9edcee0 TI |
2132 | /* |
2133 | * ASUS pin configuration: | |
2134 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | |
2135 | */ | |
2136 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | |
16ded525 TI |
2137 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
2138 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2139 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2140 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2141 | ||
2142 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
e9edcee0 | 2143 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2144 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2145 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2146 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2147 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2148 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 TI |
2149 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2150 | ||
2151 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2152 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2153 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2154 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2155 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2156 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
16ded525 | 2157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
e9edcee0 | 2158 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
16ded525 | 2159 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
ea1fb29a | 2160 | |
e9edcee0 TI |
2161 | { } |
2162 | }; | |
16ded525 | 2163 | |
e9edcee0 | 2164 | /* Enable GPIO mask and set output */ |
bc9f98a9 KY |
2165 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
2166 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | |
df694daa KY |
2167 | |
2168 | /* Clevo m520g init */ | |
2169 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | |
2170 | /* headphone output */ | |
2171 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2172 | /* line-out */ | |
2173 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2174 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2175 | /* Line-in */ | |
2176 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2177 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2178 | /* CD */ | |
2179 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2180 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2181 | /* Mic1 (rear panel) */ | |
2182 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2183 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2184 | /* Mic2 (front panel) */ | |
2185 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2186 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2187 | /* headphone */ | |
2188 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2189 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2190 | /* change to EAPD mode */ | |
2191 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2192 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2193 | ||
2194 | { } | |
16ded525 TI |
2195 | }; |
2196 | ||
df694daa | 2197 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
4b146cb0 TI |
2198 | /* change to EAPD mode */ |
2199 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2200 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2201 | ||
df694daa KY |
2202 | /* Headphone output */ |
2203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2204 | /* Front output*/ | |
2205 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2206 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
2207 | ||
2208 | /* Line In pin widget for input */ | |
2209 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2210 | /* CD pin widget for input */ | |
2211 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2212 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2213 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2214 | ||
2215 | /* change to EAPD mode */ | |
2216 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2217 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
2218 | ||
2219 | { } | |
2220 | }; | |
16ded525 | 2221 | |
e9edcee0 | 2222 | /* |
ae6b813a TI |
2223 | * LG m1 express dual |
2224 | * | |
2225 | * Pin assignment: | |
2226 | * Rear Line-In/Out (blue): 0x14 | |
2227 | * Build-in Mic-In: 0x15 | |
2228 | * Speaker-out: 0x17 | |
2229 | * HP-Out (green): 0x1b | |
2230 | * Mic-In/Out (red): 0x19 | |
2231 | * SPDIF-Out: 0x1e | |
2232 | */ | |
2233 | ||
2234 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | |
2235 | static hda_nid_t alc880_lg_dac_nids[3] = { | |
2236 | 0x05, 0x02, 0x03 | |
2237 | }; | |
2238 | ||
2239 | /* seems analog CD is not working */ | |
2240 | static struct hda_input_mux alc880_lg_capture_source = { | |
2241 | .num_items = 3, | |
2242 | .items = { | |
2243 | { "Mic", 0x1 }, | |
2244 | { "Line", 0x5 }, | |
2245 | { "Internal Mic", 0x6 }, | |
2246 | }, | |
2247 | }; | |
2248 | ||
2249 | /* 2,4,6 channel modes */ | |
2250 | static struct hda_verb alc880_lg_ch2_init[] = { | |
2251 | /* set line-in and mic-in to input */ | |
2252 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
2253 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2254 | { } | |
2255 | }; | |
2256 | ||
2257 | static struct hda_verb alc880_lg_ch4_init[] = { | |
2258 | /* set line-in to out and mic-in to input */ | |
2259 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2260 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
2261 | { } | |
2262 | }; | |
2263 | ||
2264 | static struct hda_verb alc880_lg_ch6_init[] = { | |
2265 | /* set line-in and mic-in to output */ | |
2266 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2267 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | |
2268 | { } | |
2269 | }; | |
2270 | ||
2271 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | |
2272 | { 2, alc880_lg_ch2_init }, | |
2273 | { 4, alc880_lg_ch4_init }, | |
2274 | { 6, alc880_lg_ch6_init }, | |
2275 | }; | |
2276 | ||
2277 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | |
2134ea4f TI |
2278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
2279 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | |
ae6b813a TI |
2280 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2281 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | |
2282 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | |
2283 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
2284 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
2285 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
2286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2288 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
2289 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
2290 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | |
2291 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | |
2292 | { | |
2293 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2294 | .name = "Channel Mode", | |
2295 | .info = alc_ch_mode_info, | |
2296 | .get = alc_ch_mode_get, | |
2297 | .put = alc_ch_mode_put, | |
2298 | }, | |
2299 | { } /* end */ | |
2300 | }; | |
2301 | ||
2302 | static struct hda_verb alc880_lg_init_verbs[] = { | |
2303 | /* set capture source to mic-in */ | |
2304 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2305 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2306 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2307 | /* mute all amp mixer inputs */ | |
2308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | |
cb53c626 TI |
2309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
2310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
ae6b813a TI |
2311 | /* line-in to input */ |
2312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2313 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2314 | /* built-in mic */ | |
2315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2317 | /* speaker-out */ | |
2318 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2319 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2320 | /* mic-in to input */ | |
2321 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
2322 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2323 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2324 | /* HP-out */ | |
2325 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
2326 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2327 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2328 | /* jack sense */ | |
2329 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, | |
2330 | { } | |
2331 | }; | |
2332 | ||
2333 | /* toggle speaker-output according to the hp-jack state */ | |
2334 | static void alc880_lg_automute(struct hda_codec *codec) | |
2335 | { | |
2336 | unsigned int present; | |
f12ab1e0 | 2337 | unsigned char bits; |
ae6b813a TI |
2338 | |
2339 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
2340 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2341 | bits = present ? HDA_AMP_MUTE : 0; |
2342 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
2343 | HDA_AMP_MUTE, bits); | |
ae6b813a TI |
2344 | } |
2345 | ||
2346 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) | |
2347 | { | |
2348 | /* Looks like the unsol event is incompatible with the standard | |
2349 | * definition. 4bit tag is placed at 28 bit! | |
2350 | */ | |
2351 | if ((res >> 28) == 0x01) | |
2352 | alc880_lg_automute(codec); | |
2353 | } | |
2354 | ||
d681518a TI |
2355 | /* |
2356 | * LG LW20 | |
2357 | * | |
2358 | * Pin assignment: | |
2359 | * Speaker-out: 0x14 | |
2360 | * Mic-In: 0x18 | |
e4f41da9 CM |
2361 | * Built-in Mic-In: 0x19 |
2362 | * Line-In: 0x1b | |
2363 | * HP-Out: 0x1a | |
d681518a TI |
2364 | * SPDIF-Out: 0x1e |
2365 | */ | |
2366 | ||
d681518a | 2367 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
e4f41da9 | 2368 | .num_items = 3, |
d681518a TI |
2369 | .items = { |
2370 | { "Mic", 0x0 }, | |
2371 | { "Internal Mic", 0x1 }, | |
e4f41da9 | 2372 | { "Line In", 0x2 }, |
d681518a TI |
2373 | }, |
2374 | }; | |
2375 | ||
0a8c5da3 CM |
2376 | #define alc880_lg_lw_modes alc880_threestack_modes |
2377 | ||
d681518a | 2378 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
0a8c5da3 CM |
2379 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2380 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2381 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
2382 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | |
2383 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
2384 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
2385 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
2386 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
2387 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
2388 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d681518a TI |
2389 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
2390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2391 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
2392 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
0a8c5da3 CM |
2393 | { |
2394 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
2395 | .name = "Channel Mode", | |
2396 | .info = alc_ch_mode_info, | |
2397 | .get = alc_ch_mode_get, | |
2398 | .put = alc_ch_mode_put, | |
2399 | }, | |
d681518a TI |
2400 | { } /* end */ |
2401 | }; | |
2402 | ||
2403 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | |
0a8c5da3 CM |
2404 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
2405 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
2406 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | |
2407 | ||
d681518a TI |
2408 | /* set capture source to mic-in */ |
2409 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2410 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2411 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
cb53c626 | 2412 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
d681518a TI |
2413 | /* speaker-out */ |
2414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2415 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2416 | /* HP-out */ | |
d681518a TI |
2417 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
2418 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2419 | /* mic-in to input */ | |
2420 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2421 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2422 | /* built-in mic */ | |
2423 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2424 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2425 | /* jack sense */ | |
2426 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, | |
2427 | { } | |
2428 | }; | |
2429 | ||
2430 | /* toggle speaker-output according to the hp-jack state */ | |
2431 | static void alc880_lg_lw_automute(struct hda_codec *codec) | |
2432 | { | |
2433 | unsigned int present; | |
f12ab1e0 | 2434 | unsigned char bits; |
d681518a TI |
2435 | |
2436 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
2437 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
2438 | bits = present ? HDA_AMP_MUTE : 0; |
2439 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
2440 | HDA_AMP_MUTE, bits); | |
d681518a TI |
2441 | } |
2442 | ||
2443 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) | |
2444 | { | |
2445 | /* Looks like the unsol event is incompatible with the standard | |
2446 | * definition. 4bit tag is placed at 28 bit! | |
2447 | */ | |
2448 | if ((res >> 28) == 0x01) | |
2449 | alc880_lg_lw_automute(codec); | |
2450 | } | |
2451 | ||
df99cd33 TI |
2452 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
2453 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
2454 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
2455 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
2456 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2457 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
2458 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
2459 | { } /* end */ | |
2460 | }; | |
2461 | ||
2462 | static struct hda_input_mux alc880_medion_rim_capture_source = { | |
2463 | .num_items = 2, | |
2464 | .items = { | |
2465 | { "Mic", 0x0 }, | |
2466 | { "Internal Mic", 0x1 }, | |
2467 | }, | |
2468 | }; | |
2469 | ||
2470 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | |
2471 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
2472 | ||
2473 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2474 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2475 | ||
2476 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
2477 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
2478 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2479 | /* Mic2 (as headphone out) for HP output */ | |
2480 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
2481 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
2482 | /* Internal Speaker */ | |
2483 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2484 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2485 | ||
2486 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
2487 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | |
2488 | ||
2489 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
2490 | { } | |
2491 | }; | |
2492 | ||
2493 | /* toggle speaker-output according to the hp-jack state */ | |
2494 | static void alc880_medion_rim_automute(struct hda_codec *codec) | |
2495 | { | |
2496 | unsigned int present; | |
2497 | unsigned char bits; | |
2498 | ||
2499 | present = snd_hda_codec_read(codec, 0x14, 0, | |
2500 | AC_VERB_GET_PIN_SENSE, 0) | |
2501 | & AC_PINSENSE_PRESENCE; | |
2502 | bits = present ? HDA_AMP_MUTE : 0; | |
2503 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
2504 | HDA_AMP_MUTE, bits); | |
2505 | if (present) | |
2506 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | |
2507 | else | |
2508 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | |
2509 | } | |
2510 | ||
2511 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | |
2512 | unsigned int res) | |
2513 | { | |
2514 | /* Looks like the unsol event is incompatible with the standard | |
2515 | * definition. 4bit tag is placed at 28 bit! | |
2516 | */ | |
2517 | if ((res >> 28) == ALC880_HP_EVENT) | |
2518 | alc880_medion_rim_automute(codec); | |
2519 | } | |
2520 | ||
cb53c626 TI |
2521 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2522 | static struct hda_amp_list alc880_loopbacks[] = { | |
2523 | { 0x0b, HDA_INPUT, 0 }, | |
2524 | { 0x0b, HDA_INPUT, 1 }, | |
2525 | { 0x0b, HDA_INPUT, 2 }, | |
2526 | { 0x0b, HDA_INPUT, 3 }, | |
2527 | { 0x0b, HDA_INPUT, 4 }, | |
2528 | { } /* end */ | |
2529 | }; | |
2530 | ||
2531 | static struct hda_amp_list alc880_lg_loopbacks[] = { | |
2532 | { 0x0b, HDA_INPUT, 1 }, | |
2533 | { 0x0b, HDA_INPUT, 6 }, | |
2534 | { 0x0b, HDA_INPUT, 7 }, | |
2535 | { } /* end */ | |
2536 | }; | |
2537 | #endif | |
2538 | ||
ae6b813a TI |
2539 | /* |
2540 | * Common callbacks | |
e9edcee0 TI |
2541 | */ |
2542 | ||
1da177e4 LT |
2543 | static int alc_init(struct hda_codec *codec) |
2544 | { | |
2545 | struct alc_spec *spec = codec->spec; | |
e9edcee0 TI |
2546 | unsigned int i; |
2547 | ||
2c3bf9ab | 2548 | alc_fix_pll(codec); |
1082c748 TI |
2549 | if (codec->vendor_id == 0x10ec0888) |
2550 | alc888_coef_init(codec); | |
2c3bf9ab | 2551 | |
e9edcee0 TI |
2552 | for (i = 0; i < spec->num_init_verbs; i++) |
2553 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | |
ae6b813a TI |
2554 | |
2555 | if (spec->init_hook) | |
2556 | spec->init_hook(codec); | |
2557 | ||
1da177e4 LT |
2558 | return 0; |
2559 | } | |
2560 | ||
ae6b813a TI |
2561 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
2562 | { | |
2563 | struct alc_spec *spec = codec->spec; | |
2564 | ||
2565 | if (spec->unsol_event) | |
2566 | spec->unsol_event(codec, res); | |
2567 | } | |
2568 | ||
cb53c626 TI |
2569 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2570 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | |
2571 | { | |
2572 | struct alc_spec *spec = codec->spec; | |
2573 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | |
2574 | } | |
2575 | #endif | |
2576 | ||
1da177e4 LT |
2577 | /* |
2578 | * Analog playback callbacks | |
2579 | */ | |
2580 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
2581 | struct hda_codec *codec, | |
c8b6bf9b | 2582 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2583 | { |
2584 | struct alc_spec *spec = codec->spec; | |
9a08160b TI |
2585 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
2586 | hinfo); | |
1da177e4 LT |
2587 | } |
2588 | ||
2589 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
2590 | struct hda_codec *codec, | |
2591 | unsigned int stream_tag, | |
2592 | unsigned int format, | |
c8b6bf9b | 2593 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2594 | { |
2595 | struct alc_spec *spec = codec->spec; | |
9c7f852e TI |
2596 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
2597 | stream_tag, format, substream); | |
1da177e4 LT |
2598 | } |
2599 | ||
2600 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
2601 | struct hda_codec *codec, | |
c8b6bf9b | 2602 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2603 | { |
2604 | struct alc_spec *spec = codec->spec; | |
2605 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
2606 | } | |
2607 | ||
2608 | /* | |
2609 | * Digital out | |
2610 | */ | |
2611 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | |
2612 | struct hda_codec *codec, | |
c8b6bf9b | 2613 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2614 | { |
2615 | struct alc_spec *spec = codec->spec; | |
2616 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | |
2617 | } | |
2618 | ||
6b97eb45 TI |
2619 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
2620 | struct hda_codec *codec, | |
2621 | unsigned int stream_tag, | |
2622 | unsigned int format, | |
2623 | struct snd_pcm_substream *substream) | |
2624 | { | |
2625 | struct alc_spec *spec = codec->spec; | |
2626 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | |
2627 | stream_tag, format, substream); | |
2628 | } | |
2629 | ||
1da177e4 LT |
2630 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
2631 | struct hda_codec *codec, | |
c8b6bf9b | 2632 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2633 | { |
2634 | struct alc_spec *spec = codec->spec; | |
2635 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | |
2636 | } | |
2637 | ||
2638 | /* | |
2639 | * Analog capture | |
2640 | */ | |
6330079f | 2641 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
1da177e4 LT |
2642 | struct hda_codec *codec, |
2643 | unsigned int stream_tag, | |
2644 | unsigned int format, | |
c8b6bf9b | 2645 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2646 | { |
2647 | struct alc_spec *spec = codec->spec; | |
2648 | ||
6330079f | 2649 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
1da177e4 LT |
2650 | stream_tag, 0, format); |
2651 | return 0; | |
2652 | } | |
2653 | ||
6330079f | 2654 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
1da177e4 | 2655 | struct hda_codec *codec, |
c8b6bf9b | 2656 | struct snd_pcm_substream *substream) |
1da177e4 LT |
2657 | { |
2658 | struct alc_spec *spec = codec->spec; | |
2659 | ||
888afa15 TI |
2660 | snd_hda_codec_cleanup_stream(codec, |
2661 | spec->adc_nids[substream->number + 1]); | |
1da177e4 LT |
2662 | return 0; |
2663 | } | |
2664 | ||
2665 | ||
2666 | /* | |
2667 | */ | |
2668 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | |
2669 | .substreams = 1, | |
2670 | .channels_min = 2, | |
2671 | .channels_max = 8, | |
e9edcee0 | 2672 | /* NID is set in alc_build_pcms */ |
1da177e4 LT |
2673 | .ops = { |
2674 | .open = alc880_playback_pcm_open, | |
2675 | .prepare = alc880_playback_pcm_prepare, | |
2676 | .cleanup = alc880_playback_pcm_cleanup | |
2677 | }, | |
2678 | }; | |
2679 | ||
2680 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | |
6330079f TI |
2681 | .substreams = 1, |
2682 | .channels_min = 2, | |
2683 | .channels_max = 2, | |
2684 | /* NID is set in alc_build_pcms */ | |
2685 | }; | |
2686 | ||
2687 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | |
2688 | .substreams = 1, | |
2689 | .channels_min = 2, | |
2690 | .channels_max = 2, | |
2691 | /* NID is set in alc_build_pcms */ | |
2692 | }; | |
2693 | ||
2694 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | |
2695 | .substreams = 2, /* can be overridden */ | |
1da177e4 LT |
2696 | .channels_min = 2, |
2697 | .channels_max = 2, | |
e9edcee0 | 2698 | /* NID is set in alc_build_pcms */ |
1da177e4 | 2699 | .ops = { |
6330079f TI |
2700 | .prepare = alc880_alt_capture_pcm_prepare, |
2701 | .cleanup = alc880_alt_capture_pcm_cleanup | |
1da177e4 LT |
2702 | }, |
2703 | }; | |
2704 | ||
2705 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | |
2706 | .substreams = 1, | |
2707 | .channels_min = 2, | |
2708 | .channels_max = 2, | |
2709 | /* NID is set in alc_build_pcms */ | |
2710 | .ops = { | |
2711 | .open = alc880_dig_playback_pcm_open, | |
6b97eb45 TI |
2712 | .close = alc880_dig_playback_pcm_close, |
2713 | .prepare = alc880_dig_playback_pcm_prepare | |
1da177e4 LT |
2714 | }, |
2715 | }; | |
2716 | ||
2717 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | |
2718 | .substreams = 1, | |
2719 | .channels_min = 2, | |
2720 | .channels_max = 2, | |
2721 | /* NID is set in alc_build_pcms */ | |
2722 | }; | |
2723 | ||
4c5186ed | 2724 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
6330079f | 2725 | static struct hda_pcm_stream alc_pcm_null_stream = { |
4c5186ed JW |
2726 | .substreams = 0, |
2727 | .channels_min = 0, | |
2728 | .channels_max = 0, | |
2729 | }; | |
2730 | ||
1da177e4 LT |
2731 | static int alc_build_pcms(struct hda_codec *codec) |
2732 | { | |
2733 | struct alc_spec *spec = codec->spec; | |
2734 | struct hda_pcm *info = spec->pcm_rec; | |
2735 | int i; | |
2736 | ||
2737 | codec->num_pcms = 1; | |
2738 | codec->pcm_info = info; | |
2739 | ||
2740 | info->name = spec->stream_name_analog; | |
4a471b7d | 2741 | if (spec->stream_analog_playback) { |
da3cec35 TI |
2742 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
2743 | return -EINVAL; | |
4a471b7d TI |
2744 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
2745 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | |
2746 | } | |
2747 | if (spec->stream_analog_capture) { | |
da3cec35 TI |
2748 | if (snd_BUG_ON(!spec->adc_nids)) |
2749 | return -EINVAL; | |
4a471b7d TI |
2750 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
2751 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | |
2752 | } | |
2753 | ||
2754 | if (spec->channel_mode) { | |
2755 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | |
2756 | for (i = 0; i < spec->num_channel_mode; i++) { | |
2757 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | |
2758 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | |
2759 | } | |
1da177e4 LT |
2760 | } |
2761 | } | |
2762 | ||
e08a007d | 2763 | /* SPDIF for stream index #1 */ |
1da177e4 | 2764 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
e08a007d | 2765 | codec->num_pcms = 2; |
c06134d7 | 2766 | info = spec->pcm_rec + 1; |
1da177e4 | 2767 | info->name = spec->stream_name_digital; |
7ba72ba1 | 2768 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
4a471b7d TI |
2769 | if (spec->multiout.dig_out_nid && |
2770 | spec->stream_digital_playback) { | |
1da177e4 LT |
2771 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
2772 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | |
2773 | } | |
4a471b7d TI |
2774 | if (spec->dig_in_nid && |
2775 | spec->stream_digital_capture) { | |
1da177e4 LT |
2776 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
2777 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | |
2778 | } | |
963f803f TI |
2779 | /* FIXME: do we need this for all Realtek codec models? */ |
2780 | codec->spdif_status_reset = 1; | |
1da177e4 LT |
2781 | } |
2782 | ||
e08a007d TI |
2783 | /* If the use of more than one ADC is requested for the current |
2784 | * model, configure a second analog capture-only PCM. | |
2785 | */ | |
2786 | /* Additional Analaog capture for index #2 */ | |
6330079f TI |
2787 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
2788 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | |
e08a007d | 2789 | codec->num_pcms = 3; |
c06134d7 | 2790 | info = spec->pcm_rec + 2; |
e08a007d | 2791 | info->name = spec->stream_name_analog; |
6330079f TI |
2792 | if (spec->alt_dac_nid) { |
2793 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
2794 | *spec->stream_analog_alt_playback; | |
2795 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | |
2796 | spec->alt_dac_nid; | |
2797 | } else { | |
2798 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | |
2799 | alc_pcm_null_stream; | |
2800 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | |
2801 | } | |
2802 | if (spec->num_adc_nids > 1) { | |
2803 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
2804 | *spec->stream_analog_alt_capture; | |
2805 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | |
2806 | spec->adc_nids[1]; | |
2807 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | |
2808 | spec->num_adc_nids - 1; | |
2809 | } else { | |
2810 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | |
2811 | alc_pcm_null_stream; | |
2812 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | |
e08a007d TI |
2813 | } |
2814 | } | |
2815 | ||
1da177e4 LT |
2816 | return 0; |
2817 | } | |
2818 | ||
603c4019 TI |
2819 | static void alc_free_kctls(struct hda_codec *codec) |
2820 | { | |
2821 | struct alc_spec *spec = codec->spec; | |
2822 | ||
2823 | if (spec->kctls.list) { | |
2824 | struct snd_kcontrol_new *kctl = spec->kctls.list; | |
2825 | int i; | |
2826 | for (i = 0; i < spec->kctls.used; i++) | |
2827 | kfree(kctl[i].name); | |
2828 | } | |
2829 | snd_array_free(&spec->kctls); | |
2830 | } | |
2831 | ||
1da177e4 LT |
2832 | static void alc_free(struct hda_codec *codec) |
2833 | { | |
e9edcee0 | 2834 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 2835 | |
f12ab1e0 | 2836 | if (!spec) |
e9edcee0 TI |
2837 | return; |
2838 | ||
603c4019 | 2839 | alc_free_kctls(codec); |
e9edcee0 | 2840 | kfree(spec); |
7943a8ab | 2841 | codec->spec = NULL; /* to be sure */ |
1da177e4 LT |
2842 | } |
2843 | ||
e044c39a TI |
2844 | #ifdef SND_HDA_NEEDS_RESUME |
2845 | static void store_pin_configs(struct hda_codec *codec) | |
2846 | { | |
2847 | struct alc_spec *spec = codec->spec; | |
2848 | hda_nid_t nid, end_nid; | |
2849 | ||
2850 | end_nid = codec->start_nid + codec->num_nodes; | |
2851 | for (nid = codec->start_nid; nid < end_nid; nid++) { | |
2852 | unsigned int wid_caps = get_wcaps(codec, nid); | |
2853 | unsigned int wid_type = | |
2854 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
2855 | if (wid_type != AC_WID_PIN) | |
2856 | continue; | |
2857 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) | |
2858 | break; | |
2859 | spec->pin_nids[spec->num_pins] = nid; | |
2860 | spec->pin_cfgs[spec->num_pins] = | |
2861 | snd_hda_codec_read(codec, nid, 0, | |
2862 | AC_VERB_GET_CONFIG_DEFAULT, 0); | |
2863 | spec->num_pins++; | |
2864 | } | |
2865 | } | |
2866 | ||
2867 | static void resume_pin_configs(struct hda_codec *codec) | |
2868 | { | |
2869 | struct alc_spec *spec = codec->spec; | |
2870 | int i; | |
2871 | ||
2872 | for (i = 0; i < spec->num_pins; i++) { | |
2873 | hda_nid_t pin_nid = spec->pin_nids[i]; | |
2874 | unsigned int pin_config = spec->pin_cfgs[i]; | |
2875 | snd_hda_codec_write(codec, pin_nid, 0, | |
2876 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, | |
2877 | pin_config & 0x000000ff); | |
2878 | snd_hda_codec_write(codec, pin_nid, 0, | |
2879 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, | |
2880 | (pin_config & 0x0000ff00) >> 8); | |
2881 | snd_hda_codec_write(codec, pin_nid, 0, | |
2882 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, | |
2883 | (pin_config & 0x00ff0000) >> 16); | |
2884 | snd_hda_codec_write(codec, pin_nid, 0, | |
2885 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, | |
2886 | pin_config >> 24); | |
2887 | } | |
2888 | } | |
2889 | ||
2890 | static int alc_resume(struct hda_codec *codec) | |
2891 | { | |
2892 | resume_pin_configs(codec); | |
2893 | codec->patch_ops.init(codec); | |
2894 | snd_hda_codec_resume_amp(codec); | |
2895 | snd_hda_codec_resume_cache(codec); | |
2896 | return 0; | |
2897 | } | |
2898 | #else | |
2899 | #define store_pin_configs(codec) | |
2900 | #endif | |
2901 | ||
1da177e4 LT |
2902 | /* |
2903 | */ | |
2904 | static struct hda_codec_ops alc_patch_ops = { | |
2905 | .build_controls = alc_build_controls, | |
2906 | .build_pcms = alc_build_pcms, | |
2907 | .init = alc_init, | |
2908 | .free = alc_free, | |
ae6b813a | 2909 | .unsol_event = alc_unsol_event, |
e044c39a TI |
2910 | #ifdef SND_HDA_NEEDS_RESUME |
2911 | .resume = alc_resume, | |
2912 | #endif | |
cb53c626 TI |
2913 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2914 | .check_power_status = alc_check_power_status, | |
2915 | #endif | |
1da177e4 LT |
2916 | }; |
2917 | ||
2fa522be TI |
2918 | |
2919 | /* | |
2920 | * Test configuration for debugging | |
2921 | * | |
2922 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | |
2923 | * enum controls. | |
2924 | */ | |
2925 | #ifdef CONFIG_SND_DEBUG | |
2926 | static hda_nid_t alc880_test_dac_nids[4] = { | |
2927 | 0x02, 0x03, 0x04, 0x05 | |
2928 | }; | |
2929 | ||
2930 | static struct hda_input_mux alc880_test_capture_source = { | |
ae6b813a | 2931 | .num_items = 7, |
2fa522be TI |
2932 | .items = { |
2933 | { "In-1", 0x0 }, | |
2934 | { "In-2", 0x1 }, | |
2935 | { "In-3", 0x2 }, | |
2936 | { "In-4", 0x3 }, | |
2937 | { "CD", 0x4 }, | |
ae6b813a TI |
2938 | { "Front", 0x5 }, |
2939 | { "Surround", 0x6 }, | |
2fa522be TI |
2940 | }, |
2941 | }; | |
2942 | ||
d2a6d7dc | 2943 | static struct hda_channel_mode alc880_test_modes[4] = { |
2fa522be | 2944 | { 2, NULL }, |
fd2c326d | 2945 | { 4, NULL }, |
2fa522be | 2946 | { 6, NULL }, |
fd2c326d | 2947 | { 8, NULL }, |
2fa522be TI |
2948 | }; |
2949 | ||
9c7f852e TI |
2950 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
2951 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
2952 | { |
2953 | static char *texts[] = { | |
2954 | "N/A", "Line Out", "HP Out", | |
2955 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | |
2956 | }; | |
2957 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
2958 | uinfo->count = 1; | |
2959 | uinfo->value.enumerated.items = 8; | |
2960 | if (uinfo->value.enumerated.item >= 8) | |
2961 | uinfo->value.enumerated.item = 7; | |
2962 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
2963 | return 0; | |
2964 | } | |
2965 | ||
9c7f852e TI |
2966 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
2967 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2968 | { |
2969 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2970 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2971 | unsigned int pin_ctl, item = 0; | |
2972 | ||
2973 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | |
2974 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
2975 | if (pin_ctl & AC_PINCTL_OUT_EN) { | |
2976 | if (pin_ctl & AC_PINCTL_HP_EN) | |
2977 | item = 2; | |
2978 | else | |
2979 | item = 1; | |
2980 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | |
2981 | switch (pin_ctl & AC_PINCTL_VREFEN) { | |
2982 | case AC_PINCTL_VREF_HIZ: item = 3; break; | |
2983 | case AC_PINCTL_VREF_50: item = 4; break; | |
2984 | case AC_PINCTL_VREF_GRD: item = 5; break; | |
2985 | case AC_PINCTL_VREF_80: item = 6; break; | |
2986 | case AC_PINCTL_VREF_100: item = 7; break; | |
2987 | } | |
2988 | } | |
2989 | ucontrol->value.enumerated.item[0] = item; | |
2990 | return 0; | |
2991 | } | |
2992 | ||
9c7f852e TI |
2993 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
2994 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
2995 | { |
2996 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
2997 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
2998 | static unsigned int ctls[] = { | |
2999 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | |
3000 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | |
3001 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | |
3002 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | |
3003 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | |
3004 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | |
3005 | }; | |
3006 | unsigned int old_ctl, new_ctl; | |
3007 | ||
3008 | old_ctl = snd_hda_codec_read(codec, nid, 0, | |
3009 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | |
3010 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | |
3011 | if (old_ctl != new_ctl) { | |
82beb8fd TI |
3012 | int val; |
3013 | snd_hda_codec_write_cache(codec, nid, 0, | |
3014 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3015 | new_ctl); | |
47fd830a TI |
3016 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
3017 | HDA_AMP_MUTE : 0; | |
3018 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | |
3019 | HDA_AMP_MUTE, val); | |
2fa522be TI |
3020 | return 1; |
3021 | } | |
3022 | return 0; | |
3023 | } | |
3024 | ||
9c7f852e TI |
3025 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
3026 | struct snd_ctl_elem_info *uinfo) | |
2fa522be TI |
3027 | { |
3028 | static char *texts[] = { | |
3029 | "Front", "Surround", "CLFE", "Side" | |
3030 | }; | |
3031 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | |
3032 | uinfo->count = 1; | |
3033 | uinfo->value.enumerated.items = 4; | |
3034 | if (uinfo->value.enumerated.item >= 4) | |
3035 | uinfo->value.enumerated.item = 3; | |
3036 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | |
3037 | return 0; | |
3038 | } | |
3039 | ||
9c7f852e TI |
3040 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
3041 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
3042 | { |
3043 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3044 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3045 | unsigned int sel; | |
3046 | ||
3047 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | |
3048 | ucontrol->value.enumerated.item[0] = sel & 3; | |
3049 | return 0; | |
3050 | } | |
3051 | ||
9c7f852e TI |
3052 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
3053 | struct snd_ctl_elem_value *ucontrol) | |
2fa522be TI |
3054 | { |
3055 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
3056 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | |
3057 | unsigned int sel; | |
3058 | ||
3059 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | |
3060 | if (ucontrol->value.enumerated.item[0] != sel) { | |
3061 | sel = ucontrol->value.enumerated.item[0] & 3; | |
82beb8fd TI |
3062 | snd_hda_codec_write_cache(codec, nid, 0, |
3063 | AC_VERB_SET_CONNECT_SEL, sel); | |
2fa522be TI |
3064 | return 1; |
3065 | } | |
3066 | return 0; | |
3067 | } | |
3068 | ||
3069 | #define PIN_CTL_TEST(xname,nid) { \ | |
3070 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
3071 | .name = xname, \ | |
3072 | .info = alc_test_pin_ctl_info, \ | |
3073 | .get = alc_test_pin_ctl_get, \ | |
3074 | .put = alc_test_pin_ctl_put, \ | |
3075 | .private_value = nid \ | |
3076 | } | |
3077 | ||
3078 | #define PIN_SRC_TEST(xname,nid) { \ | |
3079 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | |
3080 | .name = xname, \ | |
3081 | .info = alc_test_pin_src_info, \ | |
3082 | .get = alc_test_pin_src_get, \ | |
3083 | .put = alc_test_pin_src_put, \ | |
3084 | .private_value = nid \ | |
3085 | } | |
3086 | ||
c8b6bf9b | 3087 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
05acb863 TI |
3088 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
3089 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
3090 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
3091 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
985be54b TI |
3092 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
3093 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
3094 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | |
3095 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
2fa522be TI |
3096 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
3097 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | |
3098 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | |
3099 | PIN_CTL_TEST("Side Pin Mode", 0x17), | |
3100 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | |
3101 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | |
3102 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | |
3103 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | |
3104 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | |
3105 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | |
3106 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | |
3107 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | |
3108 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
3109 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
3110 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
3111 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
3112 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | |
3113 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | |
3114 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | |
3115 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | |
3116 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
3117 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
2fa522be TI |
3118 | { |
3119 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
3120 | .name = "Channel Mode", | |
df694daa KY |
3121 | .info = alc_ch_mode_info, |
3122 | .get = alc_ch_mode_get, | |
3123 | .put = alc_ch_mode_put, | |
2fa522be TI |
3124 | }, |
3125 | { } /* end */ | |
3126 | }; | |
3127 | ||
3128 | static struct hda_verb alc880_test_init_verbs[] = { | |
3129 | /* Unmute inputs of 0x0c - 0x0f */ | |
05acb863 TI |
3130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3131 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3132 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3133 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3134 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3135 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
3136 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
3137 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
2fa522be | 3138 | /* Vol output for 0x0c-0x0f */ |
05acb863 TI |
3139 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
3140 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3141 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
3142 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
2fa522be | 3143 | /* Set output pins 0x14-0x17 */ |
05acb863 TI |
3144 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
3145 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3146 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
3147 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
2fa522be | 3148 | /* Unmute output pins 0x14-0x17 */ |
05acb863 TI |
3149 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
3150 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3151 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
3152 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
2fa522be | 3153 | /* Set input pins 0x18-0x1c */ |
16ded525 TI |
3154 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3155 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
05acb863 TI |
3156 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
3157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
3158 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
2fa522be | 3159 | /* Mute input pins 0x18-0x1b */ |
05acb863 TI |
3160 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3161 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3162 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
3163 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
71fe7b82 | 3164 | /* ADC set up */ |
05acb863 | 3165 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 3166 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 3167 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 3168 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 | 3169 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
71fe7b82 | 3170 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
3171 | /* Analog input/passthru */ |
3172 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
3173 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
3174 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
3175 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
3176 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
2fa522be TI |
3177 | { } |
3178 | }; | |
3179 | #endif | |
3180 | ||
1da177e4 LT |
3181 | /* |
3182 | */ | |
3183 | ||
f5fcc13c TI |
3184 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
3185 | [ALC880_3ST] = "3stack", | |
3186 | [ALC880_TCL_S700] = "tcl", | |
3187 | [ALC880_3ST_DIG] = "3stack-digout", | |
3188 | [ALC880_CLEVO] = "clevo", | |
3189 | [ALC880_5ST] = "5stack", | |
3190 | [ALC880_5ST_DIG] = "5stack-digout", | |
3191 | [ALC880_W810] = "w810", | |
3192 | [ALC880_Z71V] = "z71v", | |
3193 | [ALC880_6ST] = "6stack", | |
3194 | [ALC880_6ST_DIG] = "6stack-digout", | |
3195 | [ALC880_ASUS] = "asus", | |
3196 | [ALC880_ASUS_W1V] = "asus-w1v", | |
3197 | [ALC880_ASUS_DIG] = "asus-dig", | |
3198 | [ALC880_ASUS_DIG2] = "asus-dig2", | |
3199 | [ALC880_UNIWILL_DIG] = "uniwill", | |
2cf9f0fc TD |
3200 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
3201 | [ALC880_FUJITSU] = "fujitsu", | |
f5fcc13c TI |
3202 | [ALC880_F1734] = "F1734", |
3203 | [ALC880_LG] = "lg", | |
3204 | [ALC880_LG_LW] = "lg-lw", | |
df99cd33 | 3205 | [ALC880_MEDION_RIM] = "medion", |
2fa522be | 3206 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 3207 | [ALC880_TEST] = "test", |
2fa522be | 3208 | #endif |
f5fcc13c TI |
3209 | [ALC880_AUTO] = "auto", |
3210 | }; | |
3211 | ||
3212 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | |
ac3e3741 | 3213 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
f5fcc13c TI |
3214 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
3215 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | |
3216 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | |
3217 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | |
3218 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | |
3219 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | |
3220 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | |
3221 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | |
f5fcc13c TI |
3222 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
3223 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | |
f5fcc13c TI |
3224 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
3225 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | |
3226 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | |
3227 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | |
3228 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | |
3229 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | |
3230 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | |
3231 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | |
3232 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | |
3233 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | |
186c3117 | 3234 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
f5fcc13c TI |
3235 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
3236 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | |
3237 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | |
ac3e3741 | 3238 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
f5fcc13c | 3239 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
ac3e3741 TI |
3240 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
3241 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
3242 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
3243 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | |
f5fcc13c TI |
3244 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
3245 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | |
3246 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | |
3247 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | |
ac3e3741 TI |
3248 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
3249 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | |
f5fcc13c | 3250 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
ac3e3741 | 3251 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
f5fcc13c | 3252 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
ac3e3741 | 3253 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
f5fcc13c TI |
3254 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
3255 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | |
ac3e3741 | 3256 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
df99cd33 | 3257 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
ac3e3741 | 3258 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
f5fcc13c | 3259 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
f5fcc13c | 3260 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
1d11604e | 3261 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
ac3e3741 | 3262 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
2cf9f0fc | 3263 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
ac3e3741 | 3264 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
f5fcc13c TI |
3265 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
3266 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | |
f5fcc13c | 3267 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
ac3e3741 TI |
3268 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
3269 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | |
3270 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | |
3271 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | |
f5fcc13c TI |
3272 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
3273 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 | 3274 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
f5fcc13c | 3275 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
ac3e3741 TI |
3276 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
3277 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | |
f5fcc13c TI |
3278 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
3279 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | |
3280 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | |
ac3e3741 TI |
3281 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
3282 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | |
3283 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | |
1da177e4 LT |
3284 | {} |
3285 | }; | |
3286 | ||
16ded525 | 3287 | /* |
df694daa | 3288 | * ALC880 codec presets |
16ded525 | 3289 | */ |
16ded525 TI |
3290 | static struct alc_config_preset alc880_presets[] = { |
3291 | [ALC880_3ST] = { | |
e9edcee0 | 3292 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
3293 | .init_verbs = { alc880_volume_init_verbs, |
3294 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 3295 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 | 3296 | .dac_nids = alc880_dac_nids, |
16ded525 TI |
3297 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
3298 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3299 | .need_dac_fix = 1, |
16ded525 TI |
3300 | .input_mux = &alc880_capture_source, |
3301 | }, | |
3302 | [ALC880_3ST_DIG] = { | |
e9edcee0 | 3303 | .mixers = { alc880_three_stack_mixer }, |
f12ab1e0 TI |
3304 | .init_verbs = { alc880_volume_init_verbs, |
3305 | alc880_pin_3stack_init_verbs }, | |
16ded525 | 3306 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
16ded525 TI |
3307 | .dac_nids = alc880_dac_nids, |
3308 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3309 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
3310 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3311 | .need_dac_fix = 1, |
16ded525 TI |
3312 | .input_mux = &alc880_capture_source, |
3313 | }, | |
df694daa KY |
3314 | [ALC880_TCL_S700] = { |
3315 | .mixers = { alc880_tcl_s700_mixer }, | |
3316 | .init_verbs = { alc880_volume_init_verbs, | |
3317 | alc880_pin_tcl_S700_init_verbs, | |
3318 | alc880_gpio2_init_verbs }, | |
3319 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3320 | .dac_nids = alc880_dac_nids, | |
3321 | .hp_nid = 0x03, | |
3322 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3323 | .channel_mode = alc880_2_jack_modes, | |
3324 | .input_mux = &alc880_capture_source, | |
3325 | }, | |
16ded525 | 3326 | [ALC880_5ST] = { |
f12ab1e0 TI |
3327 | .mixers = { alc880_three_stack_mixer, |
3328 | alc880_five_stack_mixer}, | |
3329 | .init_verbs = { alc880_volume_init_verbs, | |
3330 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
3331 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
3332 | .dac_nids = alc880_dac_nids, | |
16ded525 TI |
3333 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
3334 | .channel_mode = alc880_fivestack_modes, | |
3335 | .input_mux = &alc880_capture_source, | |
3336 | }, | |
3337 | [ALC880_5ST_DIG] = { | |
f12ab1e0 TI |
3338 | .mixers = { alc880_three_stack_mixer, |
3339 | alc880_five_stack_mixer }, | |
3340 | .init_verbs = { alc880_volume_init_verbs, | |
3341 | alc880_pin_5stack_init_verbs }, | |
16ded525 TI |
3342 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
3343 | .dac_nids = alc880_dac_nids, | |
3344 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3345 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
3346 | .channel_mode = alc880_fivestack_modes, | |
3347 | .input_mux = &alc880_capture_source, | |
3348 | }, | |
b6482d48 TI |
3349 | [ALC880_6ST] = { |
3350 | .mixers = { alc880_six_stack_mixer }, | |
f12ab1e0 TI |
3351 | .init_verbs = { alc880_volume_init_verbs, |
3352 | alc880_pin_6stack_init_verbs }, | |
b6482d48 TI |
3353 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
3354 | .dac_nids = alc880_6st_dac_nids, | |
3355 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | |
3356 | .channel_mode = alc880_sixstack_modes, | |
3357 | .input_mux = &alc880_6stack_capture_source, | |
3358 | }, | |
16ded525 | 3359 | [ALC880_6ST_DIG] = { |
e9edcee0 | 3360 | .mixers = { alc880_six_stack_mixer }, |
f12ab1e0 TI |
3361 | .init_verbs = { alc880_volume_init_verbs, |
3362 | alc880_pin_6stack_init_verbs }, | |
16ded525 TI |
3363 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
3364 | .dac_nids = alc880_6st_dac_nids, | |
3365 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3366 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
3367 | .channel_mode = alc880_sixstack_modes, | |
3368 | .input_mux = &alc880_6stack_capture_source, | |
3369 | }, | |
3370 | [ALC880_W810] = { | |
e9edcee0 | 3371 | .mixers = { alc880_w810_base_mixer }, |
f12ab1e0 TI |
3372 | .init_verbs = { alc880_volume_init_verbs, |
3373 | alc880_pin_w810_init_verbs, | |
b0af0de5 | 3374 | alc880_gpio2_init_verbs }, |
16ded525 TI |
3375 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
3376 | .dac_nids = alc880_w810_dac_nids, | |
3377 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3378 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
3379 | .channel_mode = alc880_w810_modes, | |
3380 | .input_mux = &alc880_capture_source, | |
3381 | }, | |
3382 | [ALC880_Z71V] = { | |
e9edcee0 | 3383 | .mixers = { alc880_z71v_mixer }, |
f12ab1e0 TI |
3384 | .init_verbs = { alc880_volume_init_verbs, |
3385 | alc880_pin_z71v_init_verbs }, | |
16ded525 TI |
3386 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
3387 | .dac_nids = alc880_z71v_dac_nids, | |
3388 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3389 | .hp_nid = 0x03, | |
e9edcee0 TI |
3390 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
3391 | .channel_mode = alc880_2_jack_modes, | |
16ded525 TI |
3392 | .input_mux = &alc880_capture_source, |
3393 | }, | |
3394 | [ALC880_F1734] = { | |
e9edcee0 | 3395 | .mixers = { alc880_f1734_mixer }, |
f12ab1e0 TI |
3396 | .init_verbs = { alc880_volume_init_verbs, |
3397 | alc880_pin_f1734_init_verbs }, | |
e9edcee0 TI |
3398 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
3399 | .dac_nids = alc880_f1734_dac_nids, | |
3400 | .hp_nid = 0x02, | |
3401 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3402 | .channel_mode = alc880_2_jack_modes, | |
937b4160 TI |
3403 | .input_mux = &alc880_f1734_capture_source, |
3404 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3405 | .init_hook = alc880_uniwill_p53_hp_automute, | |
16ded525 TI |
3406 | }, |
3407 | [ALC880_ASUS] = { | |
e9edcee0 | 3408 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
3409 | .init_verbs = { alc880_volume_init_verbs, |
3410 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3411 | alc880_gpio1_init_verbs }, |
3412 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3413 | .dac_nids = alc880_asus_dac_nids, | |
3414 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
3415 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3416 | .need_dac_fix = 1, |
16ded525 TI |
3417 | .input_mux = &alc880_capture_source, |
3418 | }, | |
3419 | [ALC880_ASUS_DIG] = { | |
e9edcee0 | 3420 | .mixers = { alc880_asus_mixer }, |
f12ab1e0 TI |
3421 | .init_verbs = { alc880_volume_init_verbs, |
3422 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3423 | alc880_gpio1_init_verbs }, |
3424 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3425 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3426 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3427 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3428 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3429 | .need_dac_fix = 1, |
16ded525 TI |
3430 | .input_mux = &alc880_capture_source, |
3431 | }, | |
df694daa KY |
3432 | [ALC880_ASUS_DIG2] = { |
3433 | .mixers = { alc880_asus_mixer }, | |
f12ab1e0 TI |
3434 | .init_verbs = { alc880_volume_init_verbs, |
3435 | alc880_pin_asus_init_verbs, | |
df694daa KY |
3436 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
3437 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3438 | .dac_nids = alc880_asus_dac_nids, | |
3439 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3440 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | |
3441 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3442 | .need_dac_fix = 1, |
df694daa KY |
3443 | .input_mux = &alc880_capture_source, |
3444 | }, | |
16ded525 | 3445 | [ALC880_ASUS_W1V] = { |
e9edcee0 | 3446 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
f12ab1e0 TI |
3447 | .init_verbs = { alc880_volume_init_verbs, |
3448 | alc880_pin_asus_init_verbs, | |
e9edcee0 TI |
3449 | alc880_gpio1_init_verbs }, |
3450 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3451 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3452 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3453 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3454 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3455 | .need_dac_fix = 1, |
16ded525 TI |
3456 | .input_mux = &alc880_capture_source, |
3457 | }, | |
3458 | [ALC880_UNIWILL_DIG] = { | |
3c10a9d9 | 3459 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
ccc656ce KY |
3460 | .init_verbs = { alc880_volume_init_verbs, |
3461 | alc880_pin_asus_init_verbs }, | |
e9edcee0 TI |
3462 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
3463 | .dac_nids = alc880_asus_dac_nids, | |
16ded525 | 3464 | .dig_out_nid = ALC880_DIGOUT_NID, |
e9edcee0 TI |
3465 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
3466 | .channel_mode = alc880_asus_modes, | |
4e195a7b | 3467 | .need_dac_fix = 1, |
16ded525 TI |
3468 | .input_mux = &alc880_capture_source, |
3469 | }, | |
ccc656ce KY |
3470 | [ALC880_UNIWILL] = { |
3471 | .mixers = { alc880_uniwill_mixer }, | |
3472 | .init_verbs = { alc880_volume_init_verbs, | |
3473 | alc880_uniwill_init_verbs }, | |
3474 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3475 | .dac_nids = alc880_asus_dac_nids, | |
3476 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3477 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
3478 | .channel_mode = alc880_threestack_modes, | |
3479 | .need_dac_fix = 1, | |
3480 | .input_mux = &alc880_capture_source, | |
3481 | .unsol_event = alc880_uniwill_unsol_event, | |
3482 | .init_hook = alc880_uniwill_automute, | |
3483 | }, | |
3484 | [ALC880_UNIWILL_P53] = { | |
3485 | .mixers = { alc880_uniwill_p53_mixer }, | |
3486 | .init_verbs = { alc880_volume_init_verbs, | |
3487 | alc880_uniwill_p53_init_verbs }, | |
3488 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | |
3489 | .dac_nids = alc880_asus_dac_nids, | |
3490 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | |
2cf9f0fc TD |
3491 | .channel_mode = alc880_threestack_modes, |
3492 | .input_mux = &alc880_capture_source, | |
3493 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3494 | .init_hook = alc880_uniwill_p53_hp_automute, | |
3495 | }, | |
3496 | [ALC880_FUJITSU] = { | |
f12ab1e0 | 3497 | .mixers = { alc880_fujitsu_mixer, |
2cf9f0fc TD |
3498 | alc880_pcbeep_mixer, }, |
3499 | .init_verbs = { alc880_volume_init_verbs, | |
3500 | alc880_uniwill_p53_init_verbs, | |
3501 | alc880_beep_init_verbs }, | |
3502 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3503 | .dac_nids = alc880_dac_nids, | |
d53d7d9e | 3504 | .dig_out_nid = ALC880_DIGOUT_NID, |
2cf9f0fc TD |
3505 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
3506 | .channel_mode = alc880_2_jack_modes, | |
ccc656ce KY |
3507 | .input_mux = &alc880_capture_source, |
3508 | .unsol_event = alc880_uniwill_p53_unsol_event, | |
3509 | .init_hook = alc880_uniwill_p53_hp_automute, | |
3510 | }, | |
df694daa KY |
3511 | [ALC880_CLEVO] = { |
3512 | .mixers = { alc880_three_stack_mixer }, | |
3513 | .init_verbs = { alc880_volume_init_verbs, | |
3514 | alc880_pin_clevo_init_verbs }, | |
3515 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3516 | .dac_nids = alc880_dac_nids, | |
3517 | .hp_nid = 0x03, | |
3518 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
3519 | .channel_mode = alc880_threestack_modes, | |
4e195a7b | 3520 | .need_dac_fix = 1, |
df694daa KY |
3521 | .input_mux = &alc880_capture_source, |
3522 | }, | |
ae6b813a TI |
3523 | [ALC880_LG] = { |
3524 | .mixers = { alc880_lg_mixer }, | |
3525 | .init_verbs = { alc880_volume_init_verbs, | |
3526 | alc880_lg_init_verbs }, | |
3527 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | |
3528 | .dac_nids = alc880_lg_dac_nids, | |
3529 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3530 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | |
3531 | .channel_mode = alc880_lg_ch_modes, | |
4e195a7b | 3532 | .need_dac_fix = 1, |
ae6b813a TI |
3533 | .input_mux = &alc880_lg_capture_source, |
3534 | .unsol_event = alc880_lg_unsol_event, | |
3535 | .init_hook = alc880_lg_automute, | |
cb53c626 TI |
3536 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3537 | .loopbacks = alc880_lg_loopbacks, | |
3538 | #endif | |
ae6b813a | 3539 | }, |
d681518a TI |
3540 | [ALC880_LG_LW] = { |
3541 | .mixers = { alc880_lg_lw_mixer }, | |
3542 | .init_verbs = { alc880_volume_init_verbs, | |
3543 | alc880_lg_lw_init_verbs }, | |
0a8c5da3 | 3544 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
d681518a TI |
3545 | .dac_nids = alc880_dac_nids, |
3546 | .dig_out_nid = ALC880_DIGOUT_NID, | |
0a8c5da3 CM |
3547 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
3548 | .channel_mode = alc880_lg_lw_modes, | |
d681518a TI |
3549 | .input_mux = &alc880_lg_lw_capture_source, |
3550 | .unsol_event = alc880_lg_lw_unsol_event, | |
3551 | .init_hook = alc880_lg_lw_automute, | |
3552 | }, | |
df99cd33 TI |
3553 | [ALC880_MEDION_RIM] = { |
3554 | .mixers = { alc880_medion_rim_mixer }, | |
3555 | .init_verbs = { alc880_volume_init_verbs, | |
3556 | alc880_medion_rim_init_verbs, | |
3557 | alc_gpio2_init_verbs }, | |
3558 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | |
3559 | .dac_nids = alc880_dac_nids, | |
3560 | .dig_out_nid = ALC880_DIGOUT_NID, | |
3561 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | |
3562 | .channel_mode = alc880_2_jack_modes, | |
3563 | .input_mux = &alc880_medion_rim_capture_source, | |
3564 | .unsol_event = alc880_medion_rim_unsol_event, | |
3565 | .init_hook = alc880_medion_rim_automute, | |
3566 | }, | |
16ded525 TI |
3567 | #ifdef CONFIG_SND_DEBUG |
3568 | [ALC880_TEST] = { | |
e9edcee0 TI |
3569 | .mixers = { alc880_test_mixer }, |
3570 | .init_verbs = { alc880_test_init_verbs }, | |
16ded525 TI |
3571 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
3572 | .dac_nids = alc880_test_dac_nids, | |
3573 | .dig_out_nid = ALC880_DIGOUT_NID, | |
16ded525 TI |
3574 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
3575 | .channel_mode = alc880_test_modes, | |
3576 | .input_mux = &alc880_test_capture_source, | |
3577 | }, | |
3578 | #endif | |
3579 | }; | |
3580 | ||
e9edcee0 TI |
3581 | /* |
3582 | * Automatic parse of I/O pins from the BIOS configuration | |
3583 | */ | |
3584 | ||
e9edcee0 TI |
3585 | enum { |
3586 | ALC_CTL_WIDGET_VOL, | |
3587 | ALC_CTL_WIDGET_MUTE, | |
3588 | ALC_CTL_BIND_MUTE, | |
3589 | }; | |
c8b6bf9b | 3590 | static struct snd_kcontrol_new alc880_control_templates[] = { |
e9edcee0 TI |
3591 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
3592 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | |
985be54b | 3593 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
e9edcee0 TI |
3594 | }; |
3595 | ||
3596 | /* add dynamic controls */ | |
f12ab1e0 TI |
3597 | static int add_control(struct alc_spec *spec, int type, const char *name, |
3598 | unsigned long val) | |
e9edcee0 | 3599 | { |
c8b6bf9b | 3600 | struct snd_kcontrol_new *knew; |
e9edcee0 | 3601 | |
603c4019 TI |
3602 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
3603 | knew = snd_array_new(&spec->kctls); | |
3604 | if (!knew) | |
3605 | return -ENOMEM; | |
e9edcee0 | 3606 | *knew = alc880_control_templates[type]; |
543537bd | 3607 | knew->name = kstrdup(name, GFP_KERNEL); |
f12ab1e0 | 3608 | if (!knew->name) |
e9edcee0 TI |
3609 | return -ENOMEM; |
3610 | knew->private_value = val; | |
e9edcee0 TI |
3611 | return 0; |
3612 | } | |
3613 | ||
3614 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) | |
3615 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | |
3616 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | |
3617 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | |
3618 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) | |
3619 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) | |
3620 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | |
3621 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | |
3622 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | |
3623 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | |
3624 | #define ALC880_PIN_CD_NID 0x1c | |
3625 | ||
3626 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
3627 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
3628 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
3629 | { |
3630 | hda_nid_t nid; | |
3631 | int assigned[4]; | |
3632 | int i, j; | |
3633 | ||
3634 | memset(assigned, 0, sizeof(assigned)); | |
b0af0de5 | 3635 | spec->multiout.dac_nids = spec->private_dac_nids; |
e9edcee0 TI |
3636 | |
3637 | /* check the pins hardwired to audio widget */ | |
3638 | for (i = 0; i < cfg->line_outs; i++) { | |
3639 | nid = cfg->line_out_pins[i]; | |
3640 | if (alc880_is_fixed_pin(nid)) { | |
3641 | int idx = alc880_fixed_pin_idx(nid); | |
5014f193 | 3642 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
e9edcee0 TI |
3643 | assigned[idx] = 1; |
3644 | } | |
3645 | } | |
3646 | /* left pins can be connect to any audio widget */ | |
3647 | for (i = 0; i < cfg->line_outs; i++) { | |
3648 | nid = cfg->line_out_pins[i]; | |
3649 | if (alc880_is_fixed_pin(nid)) | |
3650 | continue; | |
3651 | /* search for an empty channel */ | |
3652 | for (j = 0; j < cfg->line_outs; j++) { | |
f12ab1e0 TI |
3653 | if (!assigned[j]) { |
3654 | spec->multiout.dac_nids[i] = | |
3655 | alc880_idx_to_dac(j); | |
e9edcee0 TI |
3656 | assigned[j] = 1; |
3657 | break; | |
3658 | } | |
3659 | } | |
3660 | } | |
3661 | spec->multiout.num_dacs = cfg->line_outs; | |
3662 | return 0; | |
3663 | } | |
3664 | ||
3665 | /* add playback controls from the parsed DAC table */ | |
df694daa KY |
3666 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
3667 | const struct auto_pin_cfg *cfg) | |
e9edcee0 TI |
3668 | { |
3669 | char name[32]; | |
f12ab1e0 TI |
3670 | static const char *chname[4] = { |
3671 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
3672 | }; | |
e9edcee0 TI |
3673 | hda_nid_t nid; |
3674 | int i, err; | |
3675 | ||
3676 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 3677 | if (!spec->multiout.dac_nids[i]) |
e9edcee0 TI |
3678 | continue; |
3679 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | |
3680 | if (i == 2) { | |
3681 | /* Center/LFE */ | |
f12ab1e0 TI |
3682 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
3683 | "Center Playback Volume", | |
3684 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
3685 | HDA_OUTPUT)); | |
3686 | if (err < 0) | |
e9edcee0 | 3687 | return err; |
f12ab1e0 TI |
3688 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
3689 | "LFE Playback Volume", | |
3690 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
3691 | HDA_OUTPUT)); | |
3692 | if (err < 0) | |
e9edcee0 | 3693 | return err; |
f12ab1e0 TI |
3694 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
3695 | "Center Playback Switch", | |
3696 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | |
3697 | HDA_INPUT)); | |
3698 | if (err < 0) | |
e9edcee0 | 3699 | return err; |
f12ab1e0 TI |
3700 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
3701 | "LFE Playback Switch", | |
3702 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | |
3703 | HDA_INPUT)); | |
3704 | if (err < 0) | |
e9edcee0 TI |
3705 | return err; |
3706 | } else { | |
3707 | sprintf(name, "%s Playback Volume", chname[i]); | |
f12ab1e0 TI |
3708 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3709 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
3710 | HDA_OUTPUT)); | |
3711 | if (err < 0) | |
e9edcee0 TI |
3712 | return err; |
3713 | sprintf(name, "%s Playback Switch", chname[i]); | |
f12ab1e0 TI |
3714 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
3715 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | |
3716 | HDA_INPUT)); | |
3717 | if (err < 0) | |
e9edcee0 TI |
3718 | return err; |
3719 | } | |
3720 | } | |
e9edcee0 TI |
3721 | return 0; |
3722 | } | |
3723 | ||
8d88bc3d TI |
3724 | /* add playback controls for speaker and HP outputs */ |
3725 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
3726 | const char *pfx) | |
e9edcee0 TI |
3727 | { |
3728 | hda_nid_t nid; | |
3729 | int err; | |
8d88bc3d | 3730 | char name[32]; |
e9edcee0 | 3731 | |
f12ab1e0 | 3732 | if (!pin) |
e9edcee0 TI |
3733 | return 0; |
3734 | ||
3735 | if (alc880_is_fixed_pin(pin)) { | |
3736 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
82bc955f | 3737 | /* specify the DAC as the extra output */ |
f12ab1e0 | 3738 | if (!spec->multiout.hp_nid) |
e9edcee0 | 3739 | spec->multiout.hp_nid = nid; |
82bc955f TI |
3740 | else |
3741 | spec->multiout.extra_out_nid[0] = nid; | |
e9edcee0 TI |
3742 | /* control HP volume/switch on the output mixer amp */ |
3743 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | |
8d88bc3d | 3744 | sprintf(name, "%s Playback Volume", pfx); |
f12ab1e0 TI |
3745 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3746 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
3747 | if (err < 0) | |
e9edcee0 | 3748 | return err; |
8d88bc3d | 3749 | sprintf(name, "%s Playback Switch", pfx); |
f12ab1e0 TI |
3750 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
3751 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
3752 | if (err < 0) | |
e9edcee0 TI |
3753 | return err; |
3754 | } else if (alc880_is_multi_pin(pin)) { | |
3755 | /* set manual connection */ | |
e9edcee0 | 3756 | /* we have only a switch on HP-out PIN */ |
8d88bc3d | 3757 | sprintf(name, "%s Playback Switch", pfx); |
f12ab1e0 TI |
3758 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
3759 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
3760 | if (err < 0) | |
e9edcee0 TI |
3761 | return err; |
3762 | } | |
3763 | return 0; | |
3764 | } | |
3765 | ||
3766 | /* create input playback/capture controls for the given pin */ | |
f12ab1e0 TI |
3767 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
3768 | const char *ctlname, | |
df694daa | 3769 | int idx, hda_nid_t mix_nid) |
e9edcee0 TI |
3770 | { |
3771 | char name[32]; | |
df694daa | 3772 | int err; |
e9edcee0 TI |
3773 | |
3774 | sprintf(name, "%s Playback Volume", ctlname); | |
f12ab1e0 TI |
3775 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
3776 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
3777 | if (err < 0) | |
e9edcee0 TI |
3778 | return err; |
3779 | sprintf(name, "%s Playback Switch", ctlname); | |
f12ab1e0 TI |
3780 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
3781 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | |
3782 | if (err < 0) | |
e9edcee0 TI |
3783 | return err; |
3784 | return 0; | |
3785 | } | |
3786 | ||
3787 | /* create playback/capture controls for input pins */ | |
df694daa KY |
3788 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
3789 | const struct auto_pin_cfg *cfg) | |
e9edcee0 | 3790 | { |
e9edcee0 | 3791 | struct hda_input_mux *imux = &spec->private_imux; |
df694daa | 3792 | int i, err, idx; |
e9edcee0 TI |
3793 | |
3794 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
3795 | if (alc880_is_input_pin(cfg->input_pins[i])) { | |
df694daa | 3796 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
4a471b7d TI |
3797 | err = new_analog_input(spec, cfg->input_pins[i], |
3798 | auto_pin_cfg_labels[i], | |
df694daa | 3799 | idx, 0x0b); |
e9edcee0 TI |
3800 | if (err < 0) |
3801 | return err; | |
f12ab1e0 TI |
3802 | imux->items[imux->num_items].label = |
3803 | auto_pin_cfg_labels[i]; | |
3804 | imux->items[imux->num_items].index = | |
3805 | alc880_input_pin_idx(cfg->input_pins[i]); | |
e9edcee0 TI |
3806 | imux->num_items++; |
3807 | } | |
3808 | } | |
3809 | return 0; | |
3810 | } | |
3811 | ||
f6c7e546 TI |
3812 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
3813 | unsigned int pin_type) | |
3814 | { | |
3815 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3816 | pin_type); | |
3817 | /* unmute pin */ | |
d260cdf6 TI |
3818 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
3819 | AMP_OUT_UNMUTE); | |
f6c7e546 TI |
3820 | } |
3821 | ||
df694daa KY |
3822 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
3823 | hda_nid_t nid, int pin_type, | |
e9edcee0 TI |
3824 | int dac_idx) |
3825 | { | |
f6c7e546 | 3826 | alc_set_pin_output(codec, nid, pin_type); |
e9edcee0 TI |
3827 | /* need the manual connection? */ |
3828 | if (alc880_is_multi_pin(nid)) { | |
3829 | struct alc_spec *spec = codec->spec; | |
3830 | int idx = alc880_multi_pin_idx(nid); | |
3831 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
3832 | AC_VERB_SET_CONNECT_SEL, | |
3833 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
3834 | } | |
3835 | } | |
3836 | ||
baba8ee9 TI |
3837 | static int get_pin_type(int line_out_type) |
3838 | { | |
3839 | if (line_out_type == AUTO_PIN_HP_OUT) | |
3840 | return PIN_HP; | |
3841 | else | |
3842 | return PIN_OUT; | |
3843 | } | |
3844 | ||
e9edcee0 TI |
3845 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
3846 | { | |
3847 | struct alc_spec *spec = codec->spec; | |
3848 | int i; | |
ea1fb29a | 3849 | |
bc9f98a9 | 3850 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
e9edcee0 TI |
3851 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
3852 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 TI |
3853 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
3854 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | |
e9edcee0 TI |
3855 | } |
3856 | } | |
3857 | ||
8d88bc3d | 3858 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
e9edcee0 TI |
3859 | { |
3860 | struct alc_spec *spec = codec->spec; | |
3861 | hda_nid_t pin; | |
3862 | ||
82bc955f | 3863 | pin = spec->autocfg.speaker_pins[0]; |
8d88bc3d TI |
3864 | if (pin) /* connect to front */ |
3865 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
eb06ed8f | 3866 | pin = spec->autocfg.hp_pins[0]; |
e9edcee0 TI |
3867 | if (pin) /* connect to front */ |
3868 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
3869 | } | |
3870 | ||
3871 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | |
3872 | { | |
3873 | struct alc_spec *spec = codec->spec; | |
3874 | int i; | |
3875 | ||
3876 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
3877 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
3878 | if (alc880_is_input_pin(nid)) { | |
f12ab1e0 TI |
3879 | snd_hda_codec_write(codec, nid, 0, |
3880 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3881 | i <= AUTO_PIN_FRONT_MIC ? | |
3882 | PIN_VREF80 : PIN_IN); | |
e9edcee0 | 3883 | if (nid != ALC880_PIN_CD_NID) |
f12ab1e0 TI |
3884 | snd_hda_codec_write(codec, nid, 0, |
3885 | AC_VERB_SET_AMP_GAIN_MUTE, | |
e9edcee0 TI |
3886 | AMP_OUT_MUTE); |
3887 | } | |
3888 | } | |
3889 | } | |
3890 | ||
3891 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
3892 | /* return 1 if successful, 0 if the proper config is not found, |
3893 | * or a negative error code | |
3894 | */ | |
e9edcee0 TI |
3895 | static int alc880_parse_auto_config(struct hda_codec *codec) |
3896 | { | |
3897 | struct alc_spec *spec = codec->spec; | |
3898 | int err; | |
df694daa | 3899 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
e9edcee0 | 3900 | |
f12ab1e0 TI |
3901 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
3902 | alc880_ignore); | |
3903 | if (err < 0) | |
e9edcee0 | 3904 | return err; |
f12ab1e0 | 3905 | if (!spec->autocfg.line_outs) |
e9edcee0 | 3906 | return 0; /* can't find valid BIOS pin config */ |
df694daa | 3907 | |
f12ab1e0 TI |
3908 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
3909 | if (err < 0) | |
3910 | return err; | |
3911 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
3912 | if (err < 0) | |
3913 | return err; | |
3914 | err = alc880_auto_create_extra_out(spec, | |
3915 | spec->autocfg.speaker_pins[0], | |
3916 | "Speaker"); | |
3917 | if (err < 0) | |
3918 | return err; | |
3919 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
3920 | "Headphone"); | |
3921 | if (err < 0) | |
3922 | return err; | |
3923 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
3924 | if (err < 0) | |
e9edcee0 TI |
3925 | return err; |
3926 | ||
3927 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
3928 | ||
3929 | if (spec->autocfg.dig_out_pin) | |
3930 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | |
3931 | if (spec->autocfg.dig_in_pin) | |
3932 | spec->dig_in_nid = ALC880_DIGIN_NID; | |
3933 | ||
603c4019 | 3934 | if (spec->kctls.list) |
d88897ea | 3935 | add_mixer(spec, spec->kctls.list); |
e9edcee0 | 3936 | |
d88897ea | 3937 | add_verb(spec, alc880_volume_init_verbs); |
e9edcee0 | 3938 | |
a1e8d2da | 3939 | spec->num_mux_defs = 1; |
e9edcee0 TI |
3940 | spec->input_mux = &spec->private_imux; |
3941 | ||
e044c39a | 3942 | store_pin_configs(codec); |
e9edcee0 TI |
3943 | return 1; |
3944 | } | |
3945 | ||
ae6b813a TI |
3946 | /* additional initialization for auto-configuration model */ |
3947 | static void alc880_auto_init(struct hda_codec *codec) | |
e9edcee0 | 3948 | { |
f6c7e546 | 3949 | struct alc_spec *spec = codec->spec; |
e9edcee0 | 3950 | alc880_auto_init_multi_out(codec); |
8d88bc3d | 3951 | alc880_auto_init_extra_out(codec); |
e9edcee0 | 3952 | alc880_auto_init_analog_input(codec); |
f6c7e546 | 3953 | if (spec->unsol_event) |
7fb0d78f | 3954 | alc_inithook(codec); |
e9edcee0 TI |
3955 | } |
3956 | ||
3957 | /* | |
3958 | * OK, here we have finally the patch for ALC880 | |
3959 | */ | |
3960 | ||
1da177e4 LT |
3961 | static int patch_alc880(struct hda_codec *codec) |
3962 | { | |
3963 | struct alc_spec *spec; | |
3964 | int board_config; | |
df694daa | 3965 | int err; |
1da177e4 | 3966 | |
e560d8d8 | 3967 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
3968 | if (spec == NULL) |
3969 | return -ENOMEM; | |
3970 | ||
3971 | codec->spec = spec; | |
3972 | ||
f5fcc13c TI |
3973 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
3974 | alc880_models, | |
3975 | alc880_cfg_tbl); | |
3976 | if (board_config < 0) { | |
9c7f852e TI |
3977 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
3978 | "trying auto-probe from BIOS...\n"); | |
e9edcee0 | 3979 | board_config = ALC880_AUTO; |
1da177e4 | 3980 | } |
1da177e4 | 3981 | |
e9edcee0 TI |
3982 | if (board_config == ALC880_AUTO) { |
3983 | /* automatic parse from the BIOS config */ | |
3984 | err = alc880_parse_auto_config(codec); | |
3985 | if (err < 0) { | |
3986 | alc_free(codec); | |
3987 | return err; | |
f12ab1e0 | 3988 | } else if (!err) { |
9c7f852e TI |
3989 | printk(KERN_INFO |
3990 | "hda_codec: Cannot set up configuration " | |
3991 | "from BIOS. Using 3-stack mode...\n"); | |
e9edcee0 TI |
3992 | board_config = ALC880_3ST; |
3993 | } | |
1da177e4 LT |
3994 | } |
3995 | ||
df694daa KY |
3996 | if (board_config != ALC880_AUTO) |
3997 | setup_preset(spec, &alc880_presets[board_config]); | |
1da177e4 LT |
3998 | |
3999 | spec->stream_name_analog = "ALC880 Analog"; | |
4000 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | |
4001 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | |
6330079f | 4002 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
1da177e4 LT |
4003 | |
4004 | spec->stream_name_digital = "ALC880 Digital"; | |
4005 | spec->stream_digital_playback = &alc880_pcm_digital_playback; | |
4006 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | |
4007 | ||
f12ab1e0 | 4008 | if (!spec->adc_nids && spec->input_mux) { |
e9edcee0 | 4009 | /* check whether NID 0x07 is valid */ |
54d17403 | 4010 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
f12ab1e0 TI |
4011 | /* get type */ |
4012 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
e9edcee0 TI |
4013 | if (wcap != AC_WID_AUD_IN) { |
4014 | spec->adc_nids = alc880_adc_nids_alt; | |
4015 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | |
d88897ea | 4016 | add_mixer(spec, alc880_capture_alt_mixer); |
e9edcee0 TI |
4017 | } else { |
4018 | spec->adc_nids = alc880_adc_nids; | |
4019 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | |
d88897ea | 4020 | add_mixer(spec, alc880_capture_mixer); |
e9edcee0 TI |
4021 | } |
4022 | } | |
1da177e4 | 4023 | |
2134ea4f TI |
4024 | spec->vmaster_nid = 0x0c; |
4025 | ||
1da177e4 | 4026 | codec->patch_ops = alc_patch_ops; |
e9edcee0 | 4027 | if (board_config == ALC880_AUTO) |
ae6b813a | 4028 | spec->init_hook = alc880_auto_init; |
cb53c626 TI |
4029 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
4030 | if (!spec->loopback.amplist) | |
4031 | spec->loopback.amplist = alc880_loopbacks; | |
4032 | #endif | |
1da177e4 LT |
4033 | |
4034 | return 0; | |
4035 | } | |
4036 | ||
e9edcee0 | 4037 | |
1da177e4 LT |
4038 | /* |
4039 | * ALC260 support | |
4040 | */ | |
4041 | ||
e9edcee0 TI |
4042 | static hda_nid_t alc260_dac_nids[1] = { |
4043 | /* front */ | |
4044 | 0x02, | |
4045 | }; | |
4046 | ||
4047 | static hda_nid_t alc260_adc_nids[1] = { | |
4048 | /* ADC0 */ | |
4049 | 0x04, | |
4050 | }; | |
4051 | ||
df694daa | 4052 | static hda_nid_t alc260_adc_nids_alt[1] = { |
e9edcee0 TI |
4053 | /* ADC1 */ |
4054 | 0x05, | |
4055 | }; | |
4056 | ||
df694daa KY |
4057 | static hda_nid_t alc260_hp_adc_nids[2] = { |
4058 | /* ADC1, 0 */ | |
4059 | 0x05, 0x04 | |
4060 | }; | |
4061 | ||
d57fdac0 JW |
4062 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
4063 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | |
4064 | */ | |
4065 | static hda_nid_t alc260_dual_adc_nids[2] = { | |
4c5186ed JW |
4066 | /* ADC0, ADC1 */ |
4067 | 0x04, 0x05 | |
4068 | }; | |
4069 | ||
e9edcee0 TI |
4070 | #define ALC260_DIGOUT_NID 0x03 |
4071 | #define ALC260_DIGIN_NID 0x06 | |
4072 | ||
4073 | static struct hda_input_mux alc260_capture_source = { | |
4074 | .num_items = 4, | |
4075 | .items = { | |
4076 | { "Mic", 0x0 }, | |
4077 | { "Front Mic", 0x1 }, | |
4078 | { "Line", 0x2 }, | |
4079 | { "CD", 0x4 }, | |
4080 | }, | |
4081 | }; | |
4082 | ||
17e7aec6 | 4083 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
a1e8d2da JW |
4084 | * headphone jack and the internal CD lines since these are the only pins at |
4085 | * which audio can appear. For flexibility, also allow the option of | |
4086 | * recording the mixer output on the second ADC (ADC0 doesn't have a | |
4087 | * connection to the mixer output). | |
a9430dd8 | 4088 | */ |
a1e8d2da JW |
4089 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
4090 | { | |
4091 | .num_items = 3, | |
4092 | .items = { | |
4093 | { "Mic/Line", 0x0 }, | |
4094 | { "CD", 0x4 }, | |
4095 | { "Headphone", 0x2 }, | |
4096 | }, | |
a9430dd8 | 4097 | }, |
a1e8d2da JW |
4098 | { |
4099 | .num_items = 4, | |
4100 | .items = { | |
4101 | { "Mic/Line", 0x0 }, | |
4102 | { "CD", 0x4 }, | |
4103 | { "Headphone", 0x2 }, | |
4104 | { "Mixer", 0x5 }, | |
4105 | }, | |
4106 | }, | |
4107 | ||
a9430dd8 JW |
4108 | }; |
4109 | ||
a1e8d2da JW |
4110 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
4111 | * the Fujitsu S702x, but jacks are marked differently. | |
0bfc90e9 | 4112 | */ |
a1e8d2da JW |
4113 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
4114 | { | |
4115 | .num_items = 4, | |
4116 | .items = { | |
4117 | { "Mic", 0x0 }, | |
4118 | { "Line", 0x2 }, | |
4119 | { "CD", 0x4 }, | |
4120 | { "Headphone", 0x5 }, | |
4121 | }, | |
4122 | }, | |
4123 | { | |
4124 | .num_items = 5, | |
4125 | .items = { | |
4126 | { "Mic", 0x0 }, | |
4127 | { "Line", 0x2 }, | |
4128 | { "CD", 0x4 }, | |
4129 | { "Headphone", 0x6 }, | |
4130 | { "Mixer", 0x5 }, | |
4131 | }, | |
0bfc90e9 JW |
4132 | }, |
4133 | }; | |
1da177e4 LT |
4134 | /* |
4135 | * This is just place-holder, so there's something for alc_build_pcms to look | |
4136 | * at when it calculates the maximum number of channels. ALC260 has no mixer | |
4137 | * element which allows changing the channel mode, so the verb list is | |
4138 | * never used. | |
4139 | */ | |
d2a6d7dc | 4140 | static struct hda_channel_mode alc260_modes[1] = { |
1da177e4 LT |
4141 | { 2, NULL }, |
4142 | }; | |
4143 | ||
df694daa KY |
4144 | |
4145 | /* Mixer combinations | |
4146 | * | |
4147 | * basic: base_output + input + pc_beep + capture | |
4148 | * HP: base_output + input + capture_alt | |
4149 | * HP_3013: hp_3013 + input + capture | |
4150 | * fujitsu: fujitsu + capture | |
0bfc90e9 | 4151 | * acer: acer + capture |
df694daa KY |
4152 | */ |
4153 | ||
4154 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | |
05acb863 | 4155 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 4156 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
05acb863 | 4157 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
985be54b | 4158 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
05acb863 | 4159 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
985be54b | 4160 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
1da177e4 | 4161 | { } /* end */ |
f12ab1e0 | 4162 | }; |
1da177e4 | 4163 | |
df694daa | 4164 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
16ded525 TI |
4165 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4166 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4167 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4168 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4171 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | |
4172 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | |
df694daa KY |
4173 | { } /* end */ |
4174 | }; | |
4175 | ||
4176 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { | |
4177 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4178 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4179 | { } /* end */ | |
4180 | }; | |
4181 | ||
bec15c3a TI |
4182 | /* update HP, line and mono out pins according to the master switch */ |
4183 | static void alc260_hp_master_update(struct hda_codec *codec, | |
4184 | hda_nid_t hp, hda_nid_t line, | |
4185 | hda_nid_t mono) | |
4186 | { | |
4187 | struct alc_spec *spec = codec->spec; | |
4188 | unsigned int val = spec->master_sw ? PIN_HP : 0; | |
4189 | /* change HP and line-out pins */ | |
4190 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4191 | val); | |
4192 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4193 | val); | |
4194 | /* mono (speaker) depending on the HP jack sense */ | |
4195 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | |
4196 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4197 | val); | |
4198 | } | |
4199 | ||
4200 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
4201 | struct snd_ctl_elem_value *ucontrol) | |
4202 | { | |
4203 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4204 | struct alc_spec *spec = codec->spec; | |
4205 | *ucontrol->value.integer.value = spec->master_sw; | |
4206 | return 0; | |
4207 | } | |
4208 | ||
4209 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
4210 | struct snd_ctl_elem_value *ucontrol) | |
4211 | { | |
4212 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
4213 | struct alc_spec *spec = codec->spec; | |
4214 | int val = !!*ucontrol->value.integer.value; | |
4215 | hda_nid_t hp, line, mono; | |
4216 | ||
4217 | if (val == spec->master_sw) | |
4218 | return 0; | |
4219 | spec->master_sw = val; | |
4220 | hp = (kcontrol->private_value >> 16) & 0xff; | |
4221 | line = (kcontrol->private_value >> 8) & 0xff; | |
4222 | mono = kcontrol->private_value & 0xff; | |
4223 | alc260_hp_master_update(codec, hp, line, mono); | |
4224 | return 1; | |
4225 | } | |
4226 | ||
4227 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | |
4228 | { | |
4229 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4230 | .name = "Master Playback Switch", | |
4231 | .info = snd_ctl_boolean_mono_info, | |
4232 | .get = alc260_hp_master_sw_get, | |
4233 | .put = alc260_hp_master_sw_put, | |
4234 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | |
4235 | }, | |
4236 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4237 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | |
4238 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
4239 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | |
4240 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | |
4241 | HDA_OUTPUT), | |
4242 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
4243 | { } /* end */ | |
4244 | }; | |
4245 | ||
4246 | static struct hda_verb alc260_hp_unsol_verbs[] = { | |
4247 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4248 | {}, | |
4249 | }; | |
4250 | ||
4251 | static void alc260_hp_automute(struct hda_codec *codec) | |
4252 | { | |
4253 | struct alc_spec *spec = codec->spec; | |
4254 | unsigned int present; | |
4255 | ||
4256 | present = snd_hda_codec_read(codec, 0x10, 0, | |
4257 | AC_VERB_GET_PIN_SENSE, 0); | |
4258 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
4259 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); | |
4260 | } | |
4261 | ||
4262 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | |
4263 | { | |
4264 | if ((res >> 26) == ALC880_HP_EVENT) | |
4265 | alc260_hp_automute(codec); | |
4266 | } | |
4267 | ||
df694daa | 4268 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
bec15c3a TI |
4269 | { |
4270 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4271 | .name = "Master Playback Switch", | |
4272 | .info = snd_ctl_boolean_mono_info, | |
4273 | .get = alc260_hp_master_sw_get, | |
4274 | .put = alc260_hp_master_sw_put, | |
4275 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 | |
4276 | }, | |
df694daa KY |
4277 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
4278 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
4279 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | |
4280 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | |
4281 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4282 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
4283 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
4284 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | |
16ded525 TI |
4285 | { } /* end */ |
4286 | }; | |
4287 | ||
3f878308 KY |
4288 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
4289 | .ops = &snd_hda_bind_vol, | |
4290 | .values = { | |
4291 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | |
4292 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | |
4293 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | |
4294 | 0 | |
4295 | }, | |
4296 | }; | |
4297 | ||
4298 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | |
4299 | .ops = &snd_hda_bind_sw, | |
4300 | .values = { | |
4301 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | |
4302 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
4303 | 0 | |
4304 | }, | |
4305 | }; | |
4306 | ||
4307 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | |
4308 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | |
4309 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | |
4310 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | |
4311 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | |
4312 | { } /* end */ | |
4313 | }; | |
4314 | ||
bec15c3a TI |
4315 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
4316 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4317 | {}, | |
4318 | }; | |
4319 | ||
4320 | static void alc260_hp_3013_automute(struct hda_codec *codec) | |
4321 | { | |
4322 | struct alc_spec *spec = codec->spec; | |
4323 | unsigned int present; | |
4324 | ||
4325 | present = snd_hda_codec_read(codec, 0x15, 0, | |
4326 | AC_VERB_GET_PIN_SENSE, 0); | |
4327 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
4328 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); | |
4329 | } | |
4330 | ||
4331 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |
4332 | unsigned int res) | |
4333 | { | |
4334 | if ((res >> 26) == ALC880_HP_EVENT) | |
4335 | alc260_hp_3013_automute(codec); | |
4336 | } | |
4337 | ||
3f878308 KY |
4338 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
4339 | { | |
4340 | unsigned int present, bits; | |
4341 | ||
4342 | present = snd_hda_codec_read(codec, 0x10, 0, | |
4343 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; | |
4344 | ||
4345 | bits = present ? 0 : PIN_OUT; | |
4346 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4347 | bits); | |
4348 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4349 | bits); | |
4350 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4351 | bits); | |
4352 | } | |
4353 | ||
4354 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | |
4355 | unsigned int res) | |
4356 | { | |
4357 | if ((res >> 26) == ALC880_HP_EVENT) | |
4358 | alc260_hp_3012_automute(codec); | |
4359 | } | |
4360 | ||
4361 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | |
a1e8d2da JW |
4362 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
4363 | */ | |
c8b6bf9b | 4364 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
a9430dd8 | 4365 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
985be54b | 4366 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
4c5186ed | 4367 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
a9430dd8 JW |
4368 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4369 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4370 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4371 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4c5186ed | 4372 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
a9430dd8 JW |
4373 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
4374 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
31bffaa9 TI |
4375 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
4376 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | |
df694daa KY |
4377 | { } /* end */ |
4378 | }; | |
4379 | ||
a1e8d2da JW |
4380 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
4381 | * versions of the ALC260 don't act on requests to enable mic bias from NID | |
4382 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | |
4383 | * datasheet doesn't mention this restriction. At this stage it's not clear | |
4384 | * whether this behaviour is intentional or is a hardware bug in chip | |
4385 | * revisions available in early 2006. Therefore for now allow the | |
4386 | * "Headphone Jack Mode" control to span all choices, but if it turns out | |
4387 | * that the lack of mic bias for this NID is intentional we could change the | |
4388 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
4389 | * | |
4390 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | |
4391 | * don't appear to make the mic bias available from the "line" jack, even | |
4392 | * though the NID used for this jack (0x14) can supply it. The theory is | |
4393 | * that perhaps Acer have included blocking capacitors between the ALC260 | |
4394 | * and the output jack. If this turns out to be the case for all such | |
4395 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | |
4396 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
bd869485 JW |
4397 | * |
4398 | * The C20x Tablet series have a mono internal speaker which is controlled | |
4399 | * via the chip's Mono sum widget and pin complex, so include the necessary | |
4400 | * controls for such models. On models without a "mono speaker" the control | |
4401 | * won't do anything. | |
a1e8d2da | 4402 | */ |
0bfc90e9 JW |
4403 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
4404 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4405 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | |
a1e8d2da | 4406 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
31bffaa9 | 4407 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
bd869485 | 4408 | HDA_OUTPUT), |
31bffaa9 | 4409 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
bd869485 | 4410 | HDA_INPUT), |
0bfc90e9 JW |
4411 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4412 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4413 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4414 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4415 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4416 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4417 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4418 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4419 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4420 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4421 | { } /* end */ | |
4422 | }; | |
4423 | ||
bc9f98a9 KY |
4424 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
4425 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | |
4426 | */ | |
4427 | static struct snd_kcontrol_new alc260_will_mixer[] = { | |
4428 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4429 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
4430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4432 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4433 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4434 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4435 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4436 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
4437 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4438 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4439 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4440 | { } /* end */ | |
4441 | }; | |
4442 | ||
4443 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | |
4444 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | |
4445 | */ | |
4446 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | |
4447 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4448 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | |
4449 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | |
4450 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | |
4451 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | |
4452 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | |
4453 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | |
4454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4455 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4456 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | |
4457 | { } /* end */ | |
4458 | }; | |
4459 | ||
df694daa KY |
4460 | /* capture mixer elements */ |
4461 | static struct snd_kcontrol_new alc260_capture_mixer[] = { | |
a9430dd8 JW |
4462 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
4463 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), | |
df694daa KY |
4464 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
4465 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), | |
a9430dd8 JW |
4466 | { |
4467 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
df694daa KY |
4468 | /* The multiple "Capture Source" controls confuse alsamixer |
4469 | * So call somewhat different.. | |
df694daa KY |
4470 | */ |
4471 | /* .name = "Capture Source", */ | |
4472 | .name = "Input Source", | |
4473 | .count = 2, | |
4474 | .info = alc_mux_enum_info, | |
4475 | .get = alc_mux_enum_get, | |
4476 | .put = alc_mux_enum_put, | |
4477 | }, | |
4478 | { } /* end */ | |
4479 | }; | |
4480 | ||
4481 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { | |
4482 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), | |
4483 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), | |
4484 | { | |
4485 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
4486 | /* The multiple "Capture Source" controls confuse alsamixer | |
4487 | * So call somewhat different.. | |
df694daa KY |
4488 | */ |
4489 | /* .name = "Capture Source", */ | |
4490 | .name = "Input Source", | |
4491 | .count = 1, | |
a9430dd8 JW |
4492 | .info = alc_mux_enum_info, |
4493 | .get = alc_mux_enum_get, | |
4494 | .put = alc_mux_enum_put, | |
4495 | }, | |
4496 | { } /* end */ | |
4497 | }; | |
4498 | ||
df694daa KY |
4499 | /* |
4500 | * initialization verbs | |
4501 | */ | |
1da177e4 LT |
4502 | static struct hda_verb alc260_init_verbs[] = { |
4503 | /* Line In pin widget for input */ | |
05acb863 | 4504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 4505 | /* CD pin widget for input */ |
05acb863 | 4506 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 | 4507 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
16ded525 | 4508 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 4509 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
16ded525 | 4510 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1da177e4 | 4511 | /* LINE-2 is used for line-out in rear */ |
05acb863 | 4512 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 4513 | /* select line-out */ |
fd56f2db | 4514 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 | 4515 | /* LINE-OUT pin */ |
05acb863 | 4516 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1da177e4 | 4517 | /* enable HP */ |
05acb863 | 4518 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1da177e4 | 4519 | /* enable Mono */ |
05acb863 TI |
4520 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
4521 | /* mute capture amp left and right */ | |
16ded525 | 4522 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1da177e4 LT |
4523 | /* set connection select to line in (default select for this ADC) */ |
4524 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
16ded525 TI |
4525 | /* mute capture amp left and right */ |
4526 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4527 | /* set connection select to line in (default select for this ADC) */ | |
4528 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
05acb863 TI |
4529 | /* set vol=0 Line-Out mixer amp left and right */ |
4530 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4531 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4532 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4533 | /* set vol=0 HP mixer amp left and right */ | |
4534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4535 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4536 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4537 | /* set vol=0 Mono mixer amp left and right */ | |
4538 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4539 | /* unmute pin widget amp left and right (no gain on this amp) */ | |
4540 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4541 | /* unmute LINE-2 out pin */ | |
4542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f12ab1e0 TI |
4543 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4544 | * Line In 2 = 0x03 | |
4545 | */ | |
cb53c626 TI |
4546 | /* mute analog inputs */ |
4547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 4552 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
05acb863 TI |
4553 | /* mute Front out path */ |
4554 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4555 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4556 | /* mute Headphone out path */ | |
4557 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4558 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4559 | /* mute Mono out path */ | |
4560 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4561 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 LT |
4562 | { } |
4563 | }; | |
4564 | ||
474167d6 | 4565 | #if 0 /* should be identical with alc260_init_verbs? */ |
df694daa KY |
4566 | static struct hda_verb alc260_hp_init_verbs[] = { |
4567 | /* Headphone and output */ | |
4568 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
4569 | /* mono output */ | |
4570 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4571 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
4572 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4573 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
4574 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4575 | /* Line In pin widget for input */ | |
4576 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4577 | /* Line-2 pin widget for output */ | |
4578 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4579 | /* CD pin widget for input */ | |
4580 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4581 | /* unmute amp left and right */ | |
4582 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
4583 | /* set connection select to line in (default select for this ADC) */ | |
4584 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
4585 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
4586 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4587 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4588 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
4589 | /* unmute HP mixer amp left and right (volume = 0) */ | |
4590 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4591 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4592 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
4593 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4594 | * Line In 2 = 0x03 | |
4595 | */ | |
cb53c626 TI |
4596 | /* mute analog inputs */ |
4597 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4600 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4601 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
4602 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
4603 | /* Unmute Front out path */ | |
4604 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4605 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4606 | /* Unmute Headphone out path */ | |
4607 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4608 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4609 | /* Unmute Mono out path */ | |
4610 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4611 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4612 | { } | |
4613 | }; | |
474167d6 | 4614 | #endif |
df694daa KY |
4615 | |
4616 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | |
4617 | /* Line out and output */ | |
4618 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4619 | /* mono output */ | |
4620 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
4621 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | |
4622 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4623 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | |
4624 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
4625 | /* Line In pin widget for input */ | |
4626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4627 | /* Headphone pin widget for output */ | |
4628 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
4629 | /* CD pin widget for input */ | |
4630 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
4631 | /* unmute amp left and right */ | |
4632 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | |
4633 | /* set connection select to line in (default select for this ADC) */ | |
4634 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
4635 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | |
4636 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4637 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4638 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
4639 | /* unmute HP mixer amp left and right (volume = 0) */ | |
4640 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | |
4641 | /* mute pin widget amp left and right (no gain on this amp) */ | |
4642 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
f12ab1e0 TI |
4643 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
4644 | * Line In 2 = 0x03 | |
4645 | */ | |
cb53c626 TI |
4646 | /* mute analog inputs */ |
4647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
4650 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
4651 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
4652 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
4653 | /* Unmute Front out path */ | |
4654 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4655 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4656 | /* Unmute Headphone out path */ | |
4657 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4658 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4659 | /* Unmute Mono out path */ | |
4660 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
4661 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
4662 | { } | |
4663 | }; | |
4664 | ||
a9430dd8 | 4665 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
a1e8d2da JW |
4666 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
4667 | * audio = 0x16, internal speaker = 0x10. | |
a9430dd8 JW |
4668 | */ |
4669 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | |
4670 | /* Disable all GPIOs */ | |
4671 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | |
4672 | /* Internal speaker is connected to headphone pin */ | |
4673 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4674 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | |
4675 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
f7ace40d JW |
4676 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
4677 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
4678 | /* Ensure all other unused pins are disabled and muted. */ | |
4679 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4680 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a9430dd8 | 4681 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d | 4682 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
a9430dd8 | 4683 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
f7ace40d JW |
4684 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
4685 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4687 | ||
4688 | /* Disable digital (SPDIF) pins */ | |
4689 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4690 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
a9430dd8 | 4691 | |
ea1fb29a | 4692 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
f7ace40d JW |
4693 | * when acting as an output. |
4694 | */ | |
4695 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4c5186ed | 4696 | |
f7ace40d | 4697 | /* Start with output sum widgets muted and their output gains at min */ |
8b33a5aa TI |
4698 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
4699 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4700 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4701 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4702 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4703 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4704 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4705 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4706 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
a9430dd8 | 4707 | |
f7ace40d JW |
4708 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
4709 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
4710 | /* Unmute Line1 pin widget output buffer since it starts as an output. | |
4711 | * If the pin mode is changed by the user the pin mode control will | |
4712 | * take care of enabling the pin's input/output buffers as needed. | |
4713 | * Therefore there's no need to enable the input buffer at this | |
4714 | * stage. | |
cdcd9268 | 4715 | */ |
f7ace40d | 4716 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
ea1fb29a | 4717 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
cdcd9268 JW |
4718 | * mixer ctrl) |
4719 | */ | |
f7ace40d JW |
4720 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4721 | ||
4722 | /* Mute capture amp left and right */ | |
4723 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 4724 | /* Set ADC connection select to match default mixer setting - line |
f7ace40d JW |
4725 | * in (on mic1 pin) |
4726 | */ | |
4727 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4728 | ||
4729 | /* Do the same for the second ADC: mute capture input amp and | |
4730 | * set ADC connection to line in (on mic1 pin) | |
4731 | */ | |
4732 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4733 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4734 | ||
4735 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
4736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
4737 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
4738 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
4739 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
4740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
4741 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
4742 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
4743 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4a471b7d TI |
4744 | |
4745 | { } | |
a9430dd8 JW |
4746 | }; |
4747 | ||
0bfc90e9 JW |
4748 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
4749 | * similar laptops (adapted from Fujitsu init verbs). | |
4750 | */ | |
4751 | static struct hda_verb alc260_acer_init_verbs[] = { | |
4752 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | |
4753 | * the headphone jack. Turn this on and rely on the standard mute | |
4754 | * methods whenever the user wants to turn these outputs off. | |
4755 | */ | |
4756 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
4757 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
4758 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
4759 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | |
4760 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4761 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | |
4762 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
4763 | /* Line In jack is connected to Line1 pin */ | |
4764 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
bd869485 JW |
4765 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
4766 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
0bfc90e9 JW |
4767 | /* Ensure all other unused pins are disabled and muted. */ |
4768 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4769 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
0bfc90e9 JW |
4770 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
4771 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4772 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4774 | /* Disable digital (SPDIF) pins */ | |
4775 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4776 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
4777 | ||
ea1fb29a | 4778 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
0bfc90e9 JW |
4779 | * bus when acting as outputs. |
4780 | */ | |
4781 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
4782 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
4783 | ||
4784 | /* Start with output sum widgets muted and their output gains at min */ | |
4785 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4786 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4787 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4788 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4789 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4790 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4791 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4792 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
4793 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
4794 | ||
f12ab1e0 TI |
4795 | /* Unmute Line-out pin widget amp left and right |
4796 | * (no equiv mixer ctrl) | |
4797 | */ | |
0bfc90e9 | 4798 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
bd869485 JW |
4799 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
4800 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
0bfc90e9 JW |
4801 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
4802 | * inputs. If the pin mode is changed by the user the pin mode control | |
4803 | * will take care of enabling the pin's input/output buffers as needed. | |
4804 | * Therefore there's no need to enable the input buffer at this | |
4805 | * stage. | |
4806 | */ | |
4807 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
4809 | ||
4810 | /* Mute capture amp left and right */ | |
4811 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
4812 | /* Set ADC connection select to match default mixer setting - mic | |
4813 | * (on mic1 pin) | |
4814 | */ | |
4815 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4816 | ||
4817 | /* Do similar with the second ADC: mute capture input amp and | |
a1e8d2da | 4818 | * set ADC connection to mic to match ALSA's default state. |
0bfc90e9 JW |
4819 | */ |
4820 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
a1e8d2da | 4821 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
0bfc90e9 JW |
4822 | |
4823 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
4824 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
4825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
4826 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
4827 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
4828 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
4829 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
4830 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
4831 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
4832 | ||
4833 | { } | |
4834 | }; | |
4835 | ||
bc9f98a9 KY |
4836 | static struct hda_verb alc260_will_verbs[] = { |
4837 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4838 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4839 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
4840 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
4841 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
4842 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | |
4843 | {} | |
4844 | }; | |
4845 | ||
4846 | static struct hda_verb alc260_replacer_672v_verbs[] = { | |
4847 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | |
4848 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | |
4849 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | |
4850 | ||
4851 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | |
4852 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
4853 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
4854 | ||
4855 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4856 | {} | |
4857 | }; | |
4858 | ||
4859 | /* toggle speaker-output according to the hp-jack state */ | |
4860 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | |
4861 | { | |
4862 | unsigned int present; | |
4863 | ||
4864 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | |
4865 | present = snd_hda_codec_read(codec, 0x0f, 0, | |
4866 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
4867 | if (present) { | |
82beb8fd TI |
4868 | snd_hda_codec_write_cache(codec, 0x01, 0, |
4869 | AC_VERB_SET_GPIO_DATA, 1); | |
4870 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
4871 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4872 | PIN_HP); | |
bc9f98a9 | 4873 | } else { |
82beb8fd TI |
4874 | snd_hda_codec_write_cache(codec, 0x01, 0, |
4875 | AC_VERB_SET_GPIO_DATA, 0); | |
4876 | snd_hda_codec_write_cache(codec, 0x0f, 0, | |
4877 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4878 | PIN_OUT); | |
bc9f98a9 KY |
4879 | } |
4880 | } | |
4881 | ||
4882 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |
4883 | unsigned int res) | |
4884 | { | |
4885 | if ((res >> 26) == ALC880_HP_EVENT) | |
4886 | alc260_replacer_672v_automute(codec); | |
4887 | } | |
4888 | ||
3f878308 KY |
4889 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
4890 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
4891 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
4892 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4893 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
4894 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
4896 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
4897 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4898 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4899 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
4900 | {} | |
4901 | }; | |
4902 | ||
7cf51e48 JW |
4903 | /* Test configuration for debugging, modelled after the ALC880 test |
4904 | * configuration. | |
4905 | */ | |
4906 | #ifdef CONFIG_SND_DEBUG | |
4907 | static hda_nid_t alc260_test_dac_nids[1] = { | |
4908 | 0x02, | |
4909 | }; | |
4910 | static hda_nid_t alc260_test_adc_nids[2] = { | |
4911 | 0x04, 0x05, | |
4912 | }; | |
a1e8d2da | 4913 | /* For testing the ALC260, each input MUX needs its own definition since |
ea1fb29a | 4914 | * the signal assignments are different. This assumes that the first ADC |
a1e8d2da | 4915 | * is NID 0x04. |
17e7aec6 | 4916 | */ |
a1e8d2da JW |
4917 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
4918 | { | |
4919 | .num_items = 7, | |
4920 | .items = { | |
4921 | { "MIC1 pin", 0x0 }, | |
4922 | { "MIC2 pin", 0x1 }, | |
4923 | { "LINE1 pin", 0x2 }, | |
4924 | { "LINE2 pin", 0x3 }, | |
4925 | { "CD pin", 0x4 }, | |
4926 | { "LINE-OUT pin", 0x5 }, | |
4927 | { "HP-OUT pin", 0x6 }, | |
4928 | }, | |
4929 | }, | |
4930 | { | |
4931 | .num_items = 8, | |
4932 | .items = { | |
4933 | { "MIC1 pin", 0x0 }, | |
4934 | { "MIC2 pin", 0x1 }, | |
4935 | { "LINE1 pin", 0x2 }, | |
4936 | { "LINE2 pin", 0x3 }, | |
4937 | { "CD pin", 0x4 }, | |
4938 | { "Mixer", 0x5 }, | |
4939 | { "LINE-OUT pin", 0x6 }, | |
4940 | { "HP-OUT pin", 0x7 }, | |
4941 | }, | |
7cf51e48 JW |
4942 | }, |
4943 | }; | |
4944 | static struct snd_kcontrol_new alc260_test_mixer[] = { | |
4945 | /* Output driver widgets */ | |
4946 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | |
4947 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | |
4948 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | |
4949 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | |
4950 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | |
4951 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | |
4952 | ||
a1e8d2da JW |
4953 | /* Modes for retasking pin widgets |
4954 | * Note: the ALC260 doesn't seem to act on requests to enable mic | |
4955 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | |
4956 | * mention this restriction. At this stage it's not clear whether | |
4957 | * this behaviour is intentional or is a hardware bug in chip | |
4958 | * revisions available at least up until early 2006. Therefore for | |
4959 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | |
4960 | * choices, but if it turns out that the lack of mic bias for these | |
4961 | * NIDs is intentional we could change their modes from | |
4962 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | |
4963 | */ | |
7cf51e48 JW |
4964 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
4965 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | |
4966 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
4967 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
4968 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | |
4969 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | |
4970 | ||
4971 | /* Loopback mixer controls */ | |
4972 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | |
4973 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | |
4974 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | |
4975 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | |
4976 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | |
4977 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | |
4978 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | |
4979 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | |
4980 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | |
4981 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | |
4982 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | |
4983 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | |
4984 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | |
4985 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | |
4986 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | |
4987 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | |
5c8f858d JW |
4988 | |
4989 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
4990 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
4991 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
4992 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
4993 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
4994 | ||
92621f13 JW |
4995 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
4996 | * is ambigious as to which NID is which; testing on laptops which | |
ea1fb29a | 4997 | * make this output available should provide clarification. |
92621f13 JW |
4998 | */ |
4999 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | |
5000 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | |
5001 | ||
f8225f6d JW |
5002 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
5003 | * this output to turn on an external amplifier. | |
5004 | */ | |
5005 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
5006 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
5007 | ||
7cf51e48 JW |
5008 | { } /* end */ |
5009 | }; | |
5010 | static struct hda_verb alc260_test_init_verbs[] = { | |
5c8f858d JW |
5011 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
5012 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | |
5013 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
5014 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | |
5015 | ||
7cf51e48 JW |
5016 | /* Enable retasking pins as output, initially without power amp */ |
5017 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5018 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5019 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5020 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5021 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5022 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5023 | ||
92621f13 JW |
5024 | /* Disable digital (SPDIF) pins initially, but users can enable |
5025 | * them via a mixer switch. In the case of SPDIF-out, this initverb | |
5026 | * payload also sets the generation to 0, output to be in "consumer" | |
5027 | * PCM format, copyright asserted, no pre-emphasis and no validity | |
5028 | * control. | |
5029 | */ | |
7cf51e48 JW |
5030 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
5031 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | |
5032 | ||
ea1fb29a | 5033 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
7cf51e48 JW |
5034 | * OUT1 sum bus when acting as an output. |
5035 | */ | |
5036 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | |
5037 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | |
5038 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | |
5039 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | |
5040 | ||
5041 | /* Start with output sum widgets muted and their output gains at min */ | |
5042 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5043 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5044 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5045 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5046 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5047 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5048 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5049 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5050 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5051 | ||
cdcd9268 JW |
5052 | /* Unmute retasking pin widget output buffers since the default |
5053 | * state appears to be output. As the pin mode is changed by the | |
5054 | * user the pin mode control will take care of enabling the pin's | |
5055 | * input/output buffers as needed. | |
5056 | */ | |
7cf51e48 JW |
5057 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
5058 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5059 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5060 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5061 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5062 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5063 | /* Also unmute the mono-out pin widget */ | |
5064 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5065 | ||
7cf51e48 JW |
5066 | /* Mute capture amp left and right */ |
5067 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
f7ace40d JW |
5068 | /* Set ADC connection select to match default mixer setting (mic1 |
5069 | * pin) | |
7cf51e48 JW |
5070 | */ |
5071 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5072 | ||
5073 | /* Do the same for the second ADC: mute capture input amp and | |
f7ace40d | 5074 | * set ADC connection to mic1 pin |
7cf51e48 JW |
5075 | */ |
5076 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5077 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5078 | ||
5079 | /* Mute all inputs to mixer widget (even unconnected ones) */ | |
5080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | |
5081 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | |
5082 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | |
5083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | |
5084 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | |
5085 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | |
5086 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | |
5087 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | |
5088 | ||
5089 | { } | |
5090 | }; | |
5091 | #endif | |
5092 | ||
6330079f TI |
5093 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
5094 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | |
1da177e4 | 5095 | |
a3bcba38 TI |
5096 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
5097 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | |
5098 | ||
df694daa KY |
5099 | /* |
5100 | * for BIOS auto-configuration | |
5101 | */ | |
16ded525 | 5102 | |
df694daa | 5103 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
863b4518 | 5104 | const char *pfx, int *vol_bits) |
df694daa KY |
5105 | { |
5106 | hda_nid_t nid_vol; | |
5107 | unsigned long vol_val, sw_val; | |
5108 | char name[32]; | |
5109 | int err; | |
5110 | ||
5111 | if (nid >= 0x0f && nid < 0x11) { | |
5112 | nid_vol = nid - 0x7; | |
5113 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
5114 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
5115 | } else if (nid == 0x11) { | |
5116 | nid_vol = nid - 0x7; | |
5117 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | |
5118 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | |
5119 | } else if (nid >= 0x12 && nid <= 0x15) { | |
5120 | nid_vol = 0x08; | |
5121 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | |
5122 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | |
5123 | } else | |
5124 | return 0; /* N/A */ | |
ea1fb29a | 5125 | |
863b4518 TI |
5126 | if (!(*vol_bits & (1 << nid_vol))) { |
5127 | /* first control for the volume widget */ | |
5128 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | |
5129 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); | |
5130 | if (err < 0) | |
5131 | return err; | |
5132 | *vol_bits |= (1 << nid_vol); | |
5133 | } | |
df694daa | 5134 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
f12ab1e0 TI |
5135 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
5136 | if (err < 0) | |
df694daa KY |
5137 | return err; |
5138 | return 1; | |
5139 | } | |
5140 | ||
5141 | /* add playback controls from the parsed DAC table */ | |
5142 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |
5143 | const struct auto_pin_cfg *cfg) | |
5144 | { | |
5145 | hda_nid_t nid; | |
5146 | int err; | |
863b4518 | 5147 | int vols = 0; |
df694daa KY |
5148 | |
5149 | spec->multiout.num_dacs = 1; | |
5150 | spec->multiout.dac_nids = spec->private_dac_nids; | |
5151 | spec->multiout.dac_nids[0] = 0x02; | |
5152 | ||
5153 | nid = cfg->line_out_pins[0]; | |
5154 | if (nid) { | |
863b4518 | 5155 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
df694daa KY |
5156 | if (err < 0) |
5157 | return err; | |
5158 | } | |
5159 | ||
82bc955f | 5160 | nid = cfg->speaker_pins[0]; |
df694daa | 5161 | if (nid) { |
863b4518 | 5162 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
df694daa KY |
5163 | if (err < 0) |
5164 | return err; | |
5165 | } | |
5166 | ||
eb06ed8f | 5167 | nid = cfg->hp_pins[0]; |
df694daa | 5168 | if (nid) { |
863b4518 TI |
5169 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
5170 | &vols); | |
df694daa KY |
5171 | if (err < 0) |
5172 | return err; | |
5173 | } | |
f12ab1e0 | 5174 | return 0; |
df694daa KY |
5175 | } |
5176 | ||
5177 | /* create playback/capture controls for input pins */ | |
5178 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, | |
5179 | const struct auto_pin_cfg *cfg) | |
5180 | { | |
df694daa KY |
5181 | struct hda_input_mux *imux = &spec->private_imux; |
5182 | int i, err, idx; | |
5183 | ||
5184 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
5185 | if (cfg->input_pins[i] >= 0x12) { | |
5186 | idx = cfg->input_pins[i] - 0x12; | |
4a471b7d | 5187 | err = new_analog_input(spec, cfg->input_pins[i], |
f12ab1e0 TI |
5188 | auto_pin_cfg_labels[i], idx, |
5189 | 0x07); | |
df694daa KY |
5190 | if (err < 0) |
5191 | return err; | |
f12ab1e0 TI |
5192 | imux->items[imux->num_items].label = |
5193 | auto_pin_cfg_labels[i]; | |
df694daa KY |
5194 | imux->items[imux->num_items].index = idx; |
5195 | imux->num_items++; | |
5196 | } | |
f12ab1e0 | 5197 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
df694daa | 5198 | idx = cfg->input_pins[i] - 0x09; |
4a471b7d | 5199 | err = new_analog_input(spec, cfg->input_pins[i], |
f12ab1e0 TI |
5200 | auto_pin_cfg_labels[i], idx, |
5201 | 0x07); | |
df694daa KY |
5202 | if (err < 0) |
5203 | return err; | |
f12ab1e0 TI |
5204 | imux->items[imux->num_items].label = |
5205 | auto_pin_cfg_labels[i]; | |
df694daa KY |
5206 | imux->items[imux->num_items].index = idx; |
5207 | imux->num_items++; | |
5208 | } | |
5209 | } | |
5210 | return 0; | |
5211 | } | |
5212 | ||
5213 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |
5214 | hda_nid_t nid, int pin_type, | |
5215 | int sel_idx) | |
5216 | { | |
f6c7e546 | 5217 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
5218 | /* need the manual connection? */ |
5219 | if (nid >= 0x12) { | |
5220 | int idx = nid - 0x12; | |
5221 | snd_hda_codec_write(codec, idx + 0x0b, 0, | |
5222 | AC_VERB_SET_CONNECT_SEL, sel_idx); | |
df694daa KY |
5223 | } |
5224 | } | |
5225 | ||
5226 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | |
5227 | { | |
5228 | struct alc_spec *spec = codec->spec; | |
5229 | hda_nid_t nid; | |
5230 | ||
bc9f98a9 | 5231 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
f12ab1e0 | 5232 | nid = spec->autocfg.line_out_pins[0]; |
baba8ee9 TI |
5233 | if (nid) { |
5234 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | |
5235 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | |
5236 | } | |
ea1fb29a | 5237 | |
82bc955f | 5238 | nid = spec->autocfg.speaker_pins[0]; |
df694daa KY |
5239 | if (nid) |
5240 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | |
5241 | ||
eb06ed8f | 5242 | nid = spec->autocfg.hp_pins[0]; |
df694daa | 5243 | if (nid) |
baba8ee9 | 5244 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
f12ab1e0 | 5245 | } |
df694daa KY |
5246 | |
5247 | #define ALC260_PIN_CD_NID 0x16 | |
5248 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | |
5249 | { | |
5250 | struct alc_spec *spec = codec->spec; | |
5251 | int i; | |
5252 | ||
5253 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
5254 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
5255 | if (nid >= 0x12) { | |
f12ab1e0 TI |
5256 | snd_hda_codec_write(codec, nid, 0, |
5257 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
5258 | i <= AUTO_PIN_FRONT_MIC ? | |
5259 | PIN_VREF80 : PIN_IN); | |
df694daa | 5260 | if (nid != ALC260_PIN_CD_NID) |
f12ab1e0 TI |
5261 | snd_hda_codec_write(codec, nid, 0, |
5262 | AC_VERB_SET_AMP_GAIN_MUTE, | |
df694daa KY |
5263 | AMP_OUT_MUTE); |
5264 | } | |
5265 | } | |
5266 | } | |
5267 | ||
5268 | /* | |
5269 | * generic initialization of ADC, input mixers and output mixers | |
5270 | */ | |
5271 | static struct hda_verb alc260_volume_init_verbs[] = { | |
5272 | /* | |
5273 | * Unmute ADC0-1 and set the default input to mic-in | |
5274 | */ | |
5275 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5276 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5277 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5278 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 5279 | |
df694daa KY |
5280 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
5281 | * mixer widget | |
f12ab1e0 TI |
5282 | * Note: PASD motherboards uses the Line In 2 as the input for |
5283 | * front panel mic (mic 2) | |
df694daa KY |
5284 | */ |
5285 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
5286 | /* mute analog inputs */ |
5287 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5288 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5289 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5290 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5291 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
5292 | |
5293 | /* | |
5294 | * Set up output mixers (0x08 - 0x0a) | |
5295 | */ | |
5296 | /* set vol=0 to output mixers */ | |
5297 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5298 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5299 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5300 | /* set up input amps for analog loopback */ | |
5301 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
5302 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5303 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5304 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5305 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5306 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5307 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 5308 | |
df694daa KY |
5309 | { } |
5310 | }; | |
5311 | ||
5312 | static int alc260_parse_auto_config(struct hda_codec *codec) | |
5313 | { | |
5314 | struct alc_spec *spec = codec->spec; | |
5315 | unsigned int wcap; | |
5316 | int err; | |
5317 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | |
5318 | ||
f12ab1e0 TI |
5319 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
5320 | alc260_ignore); | |
5321 | if (err < 0) | |
df694daa | 5322 | return err; |
f12ab1e0 TI |
5323 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
5324 | if (err < 0) | |
4a471b7d | 5325 | return err; |
603c4019 | 5326 | if (!spec->kctls.list) |
df694daa | 5327 | return 0; /* can't find valid BIOS pin config */ |
f12ab1e0 TI |
5328 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
5329 | if (err < 0) | |
df694daa KY |
5330 | return err; |
5331 | ||
5332 | spec->multiout.max_channels = 2; | |
5333 | ||
5334 | if (spec->autocfg.dig_out_pin) | |
5335 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | |
603c4019 | 5336 | if (spec->kctls.list) |
d88897ea | 5337 | add_mixer(spec, spec->kctls.list); |
df694daa | 5338 | |
d88897ea | 5339 | add_verb(spec, alc260_volume_init_verbs); |
df694daa | 5340 | |
a1e8d2da | 5341 | spec->num_mux_defs = 1; |
df694daa KY |
5342 | spec->input_mux = &spec->private_imux; |
5343 | ||
5344 | /* check whether NID 0x04 is valid */ | |
4a471b7d | 5345 | wcap = get_wcaps(codec, 0x04); |
df694daa | 5346 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
67ebcb03 | 5347 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
df694daa KY |
5348 | spec->adc_nids = alc260_adc_nids_alt; |
5349 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | |
d88897ea | 5350 | add_mixer(spec, alc260_capture_alt_mixer); |
df694daa KY |
5351 | } else { |
5352 | spec->adc_nids = alc260_adc_nids; | |
5353 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | |
d88897ea | 5354 | add_mixer(spec, alc260_capture_mixer); |
df694daa KY |
5355 | } |
5356 | ||
e044c39a | 5357 | store_pin_configs(codec); |
df694daa KY |
5358 | return 1; |
5359 | } | |
5360 | ||
ae6b813a TI |
5361 | /* additional initialization for auto-configuration model */ |
5362 | static void alc260_auto_init(struct hda_codec *codec) | |
df694daa | 5363 | { |
f6c7e546 | 5364 | struct alc_spec *spec = codec->spec; |
df694daa KY |
5365 | alc260_auto_init_multi_out(codec); |
5366 | alc260_auto_init_analog_input(codec); | |
f6c7e546 | 5367 | if (spec->unsol_event) |
7fb0d78f | 5368 | alc_inithook(codec); |
df694daa KY |
5369 | } |
5370 | ||
cb53c626 TI |
5371 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5372 | static struct hda_amp_list alc260_loopbacks[] = { | |
5373 | { 0x07, HDA_INPUT, 0 }, | |
5374 | { 0x07, HDA_INPUT, 1 }, | |
5375 | { 0x07, HDA_INPUT, 2 }, | |
5376 | { 0x07, HDA_INPUT, 3 }, | |
5377 | { 0x07, HDA_INPUT, 4 }, | |
5378 | { } /* end */ | |
5379 | }; | |
5380 | #endif | |
5381 | ||
df694daa KY |
5382 | /* |
5383 | * ALC260 configurations | |
5384 | */ | |
f5fcc13c TI |
5385 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
5386 | [ALC260_BASIC] = "basic", | |
5387 | [ALC260_HP] = "hp", | |
5388 | [ALC260_HP_3013] = "hp-3013", | |
2922c9af | 5389 | [ALC260_HP_DC7600] = "hp-dc7600", |
f5fcc13c TI |
5390 | [ALC260_FUJITSU_S702X] = "fujitsu", |
5391 | [ALC260_ACER] = "acer", | |
bc9f98a9 KY |
5392 | [ALC260_WILL] = "will", |
5393 | [ALC260_REPLACER_672V] = "replacer", | |
7cf51e48 | 5394 | #ifdef CONFIG_SND_DEBUG |
f5fcc13c | 5395 | [ALC260_TEST] = "test", |
7cf51e48 | 5396 | #endif |
f5fcc13c TI |
5397 | [ALC260_AUTO] = "auto", |
5398 | }; | |
5399 | ||
5400 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | |
bd869485 | 5401 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
f5fcc13c | 5402 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
9720b718 | 5403 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
a8a5d067 | 5404 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
f5fcc13c | 5405 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
34ec8a0a | 5406 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
3f878308 | 5407 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
f5fcc13c TI |
5408 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
5409 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | |
5410 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | |
5411 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | |
5412 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | |
5413 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | |
5414 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | |
5415 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | |
5416 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | |
bc9f98a9 | 5417 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
ac3e3741 | 5418 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
df694daa KY |
5419 | {} |
5420 | }; | |
5421 | ||
5422 | static struct alc_config_preset alc260_presets[] = { | |
5423 | [ALC260_BASIC] = { | |
5424 | .mixers = { alc260_base_output_mixer, | |
5425 | alc260_input_mixer, | |
5426 | alc260_pc_beep_mixer, | |
5427 | alc260_capture_mixer }, | |
5428 | .init_verbs = { alc260_init_verbs }, | |
5429 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5430 | .dac_nids = alc260_dac_nids, | |
5431 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
5432 | .adc_nids = alc260_adc_nids, | |
5433 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5434 | .channel_mode = alc260_modes, | |
5435 | .input_mux = &alc260_capture_source, | |
5436 | }, | |
5437 | [ALC260_HP] = { | |
bec15c3a | 5438 | .mixers = { alc260_hp_output_mixer, |
df694daa KY |
5439 | alc260_input_mixer, |
5440 | alc260_capture_alt_mixer }, | |
bec15c3a TI |
5441 | .init_verbs = { alc260_init_verbs, |
5442 | alc260_hp_unsol_verbs }, | |
df694daa KY |
5443 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
5444 | .dac_nids = alc260_dac_nids, | |
5445 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | |
5446 | .adc_nids = alc260_hp_adc_nids, | |
5447 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5448 | .channel_mode = alc260_modes, | |
5449 | .input_mux = &alc260_capture_source, | |
bec15c3a TI |
5450 | .unsol_event = alc260_hp_unsol_event, |
5451 | .init_hook = alc260_hp_automute, | |
df694daa | 5452 | }, |
3f878308 KY |
5453 | [ALC260_HP_DC7600] = { |
5454 | .mixers = { alc260_hp_dc7600_mixer, | |
5455 | alc260_input_mixer, | |
5456 | alc260_capture_alt_mixer }, | |
5457 | .init_verbs = { alc260_init_verbs, | |
5458 | alc260_hp_dc7600_verbs }, | |
5459 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5460 | .dac_nids = alc260_dac_nids, | |
5461 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | |
5462 | .adc_nids = alc260_hp_adc_nids, | |
5463 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5464 | .channel_mode = alc260_modes, | |
5465 | .input_mux = &alc260_capture_source, | |
5466 | .unsol_event = alc260_hp_3012_unsol_event, | |
5467 | .init_hook = alc260_hp_3012_automute, | |
5468 | }, | |
df694daa KY |
5469 | [ALC260_HP_3013] = { |
5470 | .mixers = { alc260_hp_3013_mixer, | |
5471 | alc260_input_mixer, | |
5472 | alc260_capture_alt_mixer }, | |
bec15c3a TI |
5473 | .init_verbs = { alc260_hp_3013_init_verbs, |
5474 | alc260_hp_3013_unsol_verbs }, | |
df694daa KY |
5475 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
5476 | .dac_nids = alc260_dac_nids, | |
5477 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | |
5478 | .adc_nids = alc260_hp_adc_nids, | |
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_3013_unsol_event, |
5483 | .init_hook = alc260_hp_3013_automute, | |
df694daa KY |
5484 | }, |
5485 | [ALC260_FUJITSU_S702X] = { | |
5486 | .mixers = { alc260_fujitsu_mixer, | |
5487 | alc260_capture_mixer }, | |
5488 | .init_verbs = { alc260_fujitsu_init_verbs }, | |
5489 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5490 | .dac_nids = alc260_dac_nids, | |
d57fdac0 JW |
5491 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
5492 | .adc_nids = alc260_dual_adc_nids, | |
df694daa KY |
5493 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
5494 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5495 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
5496 | .input_mux = alc260_fujitsu_capture_sources, | |
df694daa | 5497 | }, |
0bfc90e9 JW |
5498 | [ALC260_ACER] = { |
5499 | .mixers = { alc260_acer_mixer, | |
5500 | alc260_capture_mixer }, | |
5501 | .init_verbs = { alc260_acer_init_verbs }, | |
5502 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5503 | .dac_nids = alc260_dac_nids, | |
5504 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | |
5505 | .adc_nids = alc260_dual_adc_nids, | |
5506 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5507 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5508 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
5509 | .input_mux = alc260_acer_capture_sources, | |
0bfc90e9 | 5510 | }, |
bc9f98a9 KY |
5511 | [ALC260_WILL] = { |
5512 | .mixers = { alc260_will_mixer, | |
5513 | alc260_capture_mixer }, | |
5514 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, | |
5515 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5516 | .dac_nids = alc260_dac_nids, | |
5517 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
5518 | .adc_nids = alc260_adc_nids, | |
5519 | .dig_out_nid = ALC260_DIGOUT_NID, | |
5520 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5521 | .channel_mode = alc260_modes, | |
5522 | .input_mux = &alc260_capture_source, | |
5523 | }, | |
5524 | [ALC260_REPLACER_672V] = { | |
5525 | .mixers = { alc260_replacer_672v_mixer, | |
5526 | alc260_capture_mixer }, | |
5527 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, | |
5528 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | |
5529 | .dac_nids = alc260_dac_nids, | |
5530 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | |
5531 | .adc_nids = alc260_adc_nids, | |
5532 | .dig_out_nid = ALC260_DIGOUT_NID, | |
5533 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5534 | .channel_mode = alc260_modes, | |
5535 | .input_mux = &alc260_capture_source, | |
5536 | .unsol_event = alc260_replacer_672v_unsol_event, | |
5537 | .init_hook = alc260_replacer_672v_automute, | |
5538 | }, | |
7cf51e48 JW |
5539 | #ifdef CONFIG_SND_DEBUG |
5540 | [ALC260_TEST] = { | |
5541 | .mixers = { alc260_test_mixer, | |
5542 | alc260_capture_mixer }, | |
5543 | .init_verbs = { alc260_test_init_verbs }, | |
5544 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | |
5545 | .dac_nids = alc260_test_dac_nids, | |
5546 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | |
5547 | .adc_nids = alc260_test_adc_nids, | |
5548 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | |
5549 | .channel_mode = alc260_modes, | |
a1e8d2da JW |
5550 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
5551 | .input_mux = alc260_test_capture_sources, | |
7cf51e48 JW |
5552 | }, |
5553 | #endif | |
df694daa KY |
5554 | }; |
5555 | ||
5556 | static int patch_alc260(struct hda_codec *codec) | |
1da177e4 LT |
5557 | { |
5558 | struct alc_spec *spec; | |
df694daa | 5559 | int err, board_config; |
1da177e4 | 5560 | |
e560d8d8 | 5561 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1da177e4 LT |
5562 | if (spec == NULL) |
5563 | return -ENOMEM; | |
5564 | ||
5565 | codec->spec = spec; | |
5566 | ||
f5fcc13c TI |
5567 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
5568 | alc260_models, | |
5569 | alc260_cfg_tbl); | |
5570 | if (board_config < 0) { | |
9c7f852e TI |
5571 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
5572 | "trying auto-probe from BIOS...\n"); | |
df694daa | 5573 | board_config = ALC260_AUTO; |
16ded525 | 5574 | } |
1da177e4 | 5575 | |
df694daa KY |
5576 | if (board_config == ALC260_AUTO) { |
5577 | /* automatic parse from the BIOS config */ | |
5578 | err = alc260_parse_auto_config(codec); | |
5579 | if (err < 0) { | |
5580 | alc_free(codec); | |
5581 | return err; | |
f12ab1e0 | 5582 | } else if (!err) { |
9c7f852e TI |
5583 | printk(KERN_INFO |
5584 | "hda_codec: Cannot set up configuration " | |
5585 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
5586 | board_config = ALC260_BASIC; |
5587 | } | |
a9430dd8 | 5588 | } |
e9edcee0 | 5589 | |
df694daa KY |
5590 | if (board_config != ALC260_AUTO) |
5591 | setup_preset(spec, &alc260_presets[board_config]); | |
1da177e4 LT |
5592 | |
5593 | spec->stream_name_analog = "ALC260 Analog"; | |
5594 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | |
5595 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | |
5596 | ||
a3bcba38 TI |
5597 | spec->stream_name_digital = "ALC260 Digital"; |
5598 | spec->stream_digital_playback = &alc260_pcm_digital_playback; | |
5599 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | |
5600 | ||
2134ea4f TI |
5601 | spec->vmaster_nid = 0x08; |
5602 | ||
1da177e4 | 5603 | codec->patch_ops = alc_patch_ops; |
df694daa | 5604 | if (board_config == ALC260_AUTO) |
ae6b813a | 5605 | spec->init_hook = alc260_auto_init; |
cb53c626 TI |
5606 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5607 | if (!spec->loopback.amplist) | |
5608 | spec->loopback.amplist = alc260_loopbacks; | |
5609 | #endif | |
1da177e4 LT |
5610 | |
5611 | return 0; | |
5612 | } | |
5613 | ||
e9edcee0 | 5614 | |
1da177e4 LT |
5615 | /* |
5616 | * ALC882 support | |
5617 | * | |
5618 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
5619 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
5620 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
5621 | * 6-channel independent captures. | |
5622 | * | |
5623 | * In addition, an independent DAC for the multi-playback (not used in this | |
5624 | * driver yet). | |
5625 | */ | |
df694daa KY |
5626 | #define ALC882_DIGOUT_NID 0x06 |
5627 | #define ALC882_DIGIN_NID 0x0a | |
1da177e4 | 5628 | |
d2a6d7dc | 5629 | static struct hda_channel_mode alc882_ch_modes[1] = { |
1da177e4 LT |
5630 | { 8, NULL } |
5631 | }; | |
5632 | ||
5633 | static hda_nid_t alc882_dac_nids[4] = { | |
5634 | /* front, rear, clfe, rear_surr */ | |
5635 | 0x02, 0x03, 0x04, 0x05 | |
5636 | }; | |
5637 | ||
df694daa KY |
5638 | /* identical with ALC880 */ |
5639 | #define alc882_adc_nids alc880_adc_nids | |
5640 | #define alc882_adc_nids_alt alc880_adc_nids_alt | |
1da177e4 | 5641 | |
e1406348 TI |
5642 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
5643 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | |
5644 | ||
1da177e4 LT |
5645 | /* input MUX */ |
5646 | /* FIXME: should be a matrix-type input source selection */ | |
5647 | ||
5648 | static struct hda_input_mux alc882_capture_source = { | |
5649 | .num_items = 4, | |
5650 | .items = { | |
5651 | { "Mic", 0x0 }, | |
5652 | { "Front Mic", 0x1 }, | |
5653 | { "Line", 0x2 }, | |
5654 | { "CD", 0x4 }, | |
5655 | }, | |
5656 | }; | |
272a527c KY |
5657 | /* |
5658 | * 2ch mode | |
5659 | */ | |
5660 | static struct hda_verb alc882_3ST_ch2_init[] = { | |
5661 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
5662 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
5663 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
5664 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
5665 | { } /* end */ | |
5666 | }; | |
5667 | ||
5668 | /* | |
5669 | * 6ch mode | |
5670 | */ | |
5671 | static struct hda_verb alc882_3ST_ch6_init[] = { | |
5672 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5673 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
5674 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
5675 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5676 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
5677 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
5678 | { } /* end */ | |
5679 | }; | |
5680 | ||
5681 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { | |
5682 | { 2, alc882_3ST_ch2_init }, | |
5683 | { 6, alc882_3ST_ch6_init }, | |
5684 | }; | |
5685 | ||
df694daa KY |
5686 | /* |
5687 | * 6ch mode | |
5688 | */ | |
5689 | static struct hda_verb alc882_sixstack_ch6_init[] = { | |
5690 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
5691 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5692 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5693 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5694 | { } /* end */ | |
5695 | }; | |
5696 | ||
5697 | /* | |
5698 | * 8ch mode | |
5699 | */ | |
5700 | static struct hda_verb alc882_sixstack_ch8_init[] = { | |
5701 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5702 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5703 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5704 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5705 | { } /* end */ | |
5706 | }; | |
5707 | ||
5708 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | |
5709 | { 6, alc882_sixstack_ch6_init }, | |
5710 | { 8, alc882_sixstack_ch8_init }, | |
5711 | }; | |
5712 | ||
87350ad0 TI |
5713 | /* |
5714 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic | |
5715 | */ | |
5716 | ||
5717 | /* | |
5718 | * 2ch mode | |
5719 | */ | |
5720 | static struct hda_verb alc885_mbp_ch2_init[] = { | |
5721 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
5722 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5723 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5724 | { } /* end */ | |
5725 | }; | |
5726 | ||
5727 | /* | |
5728 | * 6ch mode | |
5729 | */ | |
5730 | static struct hda_verb alc885_mbp_ch6_init[] = { | |
5731 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
5732 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5733 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
5734 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5735 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
5736 | { } /* end */ | |
5737 | }; | |
5738 | ||
5739 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { | |
5740 | { 2, alc885_mbp_ch2_init }, | |
5741 | { 6, alc885_mbp_ch6_init }, | |
5742 | }; | |
5743 | ||
5744 | ||
1da177e4 LT |
5745 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
5746 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
5747 | */ | |
c8b6bf9b | 5748 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
05acb863 | 5749 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
985be54b | 5750 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
05acb863 | 5751 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
985be54b | 5752 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
05acb863 TI |
5753 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
5754 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
985be54b TI |
5755 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
5756 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
05acb863 | 5757 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
985be54b | 5758 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1da177e4 LT |
5759 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
5760 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5761 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5762 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5763 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 5765 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
1da177e4 LT |
5766 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
5767 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 5768 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
1da177e4 LT |
5769 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
5770 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5771 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
1da177e4 LT |
5772 | { } /* end */ |
5773 | }; | |
5774 | ||
87350ad0 | 5775 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
2134ea4f TI |
5776 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
5777 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | |
5778 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), | |
5779 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | |
5780 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5781 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
87350ad0 TI |
5782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
5783 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | |
2134ea4f | 5784 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
87350ad0 TI |
5785 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
5786 | { } /* end */ | |
5787 | }; | |
bdd148a3 KY |
5788 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
5789 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5790 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5791 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5792 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5793 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5794 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5795 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5796 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
5797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5798 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5799 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5800 | { } /* end */ | |
5801 | }; | |
5802 | ||
272a527c KY |
5803 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
5804 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5805 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5806 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
5807 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5808 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5809 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5810 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 5813 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
5814 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
5815 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
96fe7cc8 | 5816 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
272a527c KY |
5817 | { } /* end */ |
5818 | }; | |
5819 | ||
5820 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | |
5821 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | |
5822 | */ | |
5823 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | |
5824 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5825 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
5826 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5827 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
5828 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5829 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5830 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5831 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5832 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | |
5833 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | |
5834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
96fe7cc8 | 5836 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
272a527c KY |
5837 | { } /* end */ |
5838 | }; | |
5839 | ||
914759b7 TI |
5840 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
5841 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5842 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5843 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
5844 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
5845 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
5846 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5847 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
5849 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
5850 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
5851 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
5852 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
5853 | { } /* end */ | |
5854 | }; | |
5855 | ||
df694daa KY |
5856 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
5857 | { | |
5858 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
5859 | .name = "Channel Mode", | |
5860 | .info = alc_ch_mode_info, | |
5861 | .get = alc_ch_mode_get, | |
5862 | .put = alc_ch_mode_put, | |
5863 | }, | |
5864 | { } /* end */ | |
5865 | }; | |
5866 | ||
1da177e4 LT |
5867 | static struct hda_verb alc882_init_verbs[] = { |
5868 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
05acb863 TI |
5869 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5870 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5871 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5872 | /* Rear mixer */ |
05acb863 TI |
5873 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5874 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5875 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5876 | /* CLFE mixer */ |
05acb863 TI |
5877 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5878 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5879 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5880 | /* Side mixer */ |
05acb863 TI |
5881 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
5882 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5883 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
1da177e4 | 5884 | |
e9edcee0 | 5885 | /* Front Pin: output 0 (0x0c) */ |
05acb863 | 5886 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5887 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5888 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
e9edcee0 | 5889 | /* Rear Pin: output 1 (0x0d) */ |
05acb863 | 5890 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5891 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5892 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
e9edcee0 | 5893 | /* CLFE Pin: output 2 (0x0e) */ |
05acb863 | 5894 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5895 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5896 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
e9edcee0 | 5897 | /* Side Pin: output 3 (0x0f) */ |
05acb863 | 5898 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
05acb863 | 5899 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1da177e4 | 5900 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
e9edcee0 | 5901 | /* Mic (rear) pin: input vref at 80% */ |
16ded525 | 5902 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
5903 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5904 | /* Front Mic pin: input vref at 80% */ | |
16ded525 | 5905 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
e9edcee0 TI |
5906 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5907 | /* Line In pin: input */ | |
05acb863 | 5908 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
e9edcee0 TI |
5909 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
5910 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
5911 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5912 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5913 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
1da177e4 | 5914 | /* CD pin widget for input */ |
05acb863 | 5915 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1da177e4 LT |
5916 | |
5917 | /* FIXME: use matrix-type input source selection */ | |
5918 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5919 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
05acb863 TI |
5920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5921 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5922 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5923 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 5924 | /* Input mixer2 */ |
05acb863 TI |
5925 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5926 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5927 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5928 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
1da177e4 | 5929 | /* Input mixer3 */ |
05acb863 TI |
5930 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5931 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5932 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5934 | /* ADC1: mute amp left and right */ | |
5935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5936 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
5937 | /* ADC2: mute amp left and right */ |
5938 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5939 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
05acb863 TI |
5940 | /* ADC3: mute amp left and right */ |
5941 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
71fe7b82 | 5942 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1da177e4 LT |
5943 | |
5944 | { } | |
5945 | }; | |
5946 | ||
4b146cb0 TI |
5947 | static struct hda_verb alc882_eapd_verbs[] = { |
5948 | /* change to EAPD mode */ | |
5949 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
b373bdeb | 5950 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
f12ab1e0 | 5951 | { } |
4b146cb0 TI |
5952 | }; |
5953 | ||
9102cd1c TD |
5954 | /* Mac Pro test */ |
5955 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |
5956 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
5957 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
5958 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | |
5959 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
5960 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
5961 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
5962 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
5963 | { } /* end */ | |
5964 | }; | |
5965 | ||
5966 | static struct hda_verb alc882_macpro_init_verbs[] = { | |
5967 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
5968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
5969 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
5970 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
5971 | /* Front Pin: output 0 (0x0c) */ | |
5972 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5974 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5975 | /* Front Mic pin: input vref at 80% */ | |
5976 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
5977 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
5978 | /* Speaker: output */ | |
5979 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
5980 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5981 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | |
5982 | /* Headphone output (output 0 - 0x0c) */ | |
5983 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5984 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
5985 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
5986 | ||
5987 | /* FIXME: use matrix-type input source selection */ | |
5988 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
5989 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
5990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5994 | /* Input mixer2 */ | |
5995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
5996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
5997 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
5998 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
5999 | /* Input mixer3 */ | |
6000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6002 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6003 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6004 | /* ADC1: mute amp left and right */ | |
6005 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6006 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6007 | /* ADC2: mute amp left and right */ | |
6008 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6009 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6010 | /* ADC3: mute amp left and right */ | |
6011 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6012 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6013 | ||
6014 | { } | |
6015 | }; | |
f12ab1e0 | 6016 | |
87350ad0 TI |
6017 | /* Macbook Pro rev3 */ |
6018 | static struct hda_verb alc885_mbp3_init_verbs[] = { | |
6019 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
6020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6021 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6022 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6023 | /* Rear mixer */ | |
6024 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6025 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6026 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6027 | /* Front Pin: output 0 (0x0c) */ | |
6028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6029 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6030 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6031 | /* HP Pin: output 0 (0x0d) */ | |
6032 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | |
6033 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6034 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6035 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
6036 | /* Mic (rear) pin: input vref at 80% */ | |
6037 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6038 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6039 | /* Front Mic pin: input vref at 80% */ | |
6040 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6041 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6042 | /* Line In pin: use output 1 when in LineOut mode */ | |
6043 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6044 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6045 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
6046 | ||
6047 | /* FIXME: use matrix-type input source selection */ | |
6048 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
6049 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
6050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6054 | /* Input mixer2 */ | |
6055 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6056 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6058 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6059 | /* Input mixer3 */ | |
6060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
6064 | /* ADC1: mute amp left and right */ | |
6065 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6066 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6067 | /* ADC2: mute amp left and right */ | |
6068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6069 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6070 | /* ADC3: mute amp left and right */ | |
6071 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
6072 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6073 | ||
6074 | { } | |
6075 | }; | |
6076 | ||
c54728d8 NF |
6077 | /* iMac 24 mixer. */ |
6078 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | |
6079 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | |
6080 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | |
6081 | { } /* end */ | |
6082 | }; | |
6083 | ||
6084 | /* iMac 24 init verbs. */ | |
6085 | static struct hda_verb alc885_imac24_init_verbs[] = { | |
6086 | /* Internal speakers: output 0 (0x0c) */ | |
6087 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6088 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6089 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6090 | /* Internal speakers: output 0 (0x0c) */ | |
6091 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6092 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6093 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6094 | /* Headphone: output 0 (0x0c) */ | |
6095 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6096 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
6097 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6098 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
6099 | /* Front Mic: input vref at 80% */ | |
6100 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
6101 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
6102 | { } | |
6103 | }; | |
6104 | ||
6105 | /* Toggle speaker-output according to the hp-jack state */ | |
6106 | static void alc885_imac24_automute(struct hda_codec *codec) | |
6107 | { | |
6108 | unsigned int present; | |
6109 | ||
6110 | present = snd_hda_codec_read(codec, 0x14, 0, | |
6111 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
6112 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
6113 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
6114 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
6115 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
c54728d8 NF |
6116 | } |
6117 | ||
6118 | /* Processes unsolicited events. */ | |
6119 | static void alc885_imac24_unsol_event(struct hda_codec *codec, | |
6120 | unsigned int res) | |
6121 | { | |
6122 | /* Headphone insertion or removal. */ | |
6123 | if ((res >> 26) == ALC880_HP_EVENT) | |
6124 | alc885_imac24_automute(codec); | |
6125 | } | |
6126 | ||
87350ad0 TI |
6127 | static void alc885_mbp3_automute(struct hda_codec *codec) |
6128 | { | |
6129 | unsigned int present; | |
6130 | ||
6131 | present = snd_hda_codec_read(codec, 0x15, 0, | |
6132 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
6133 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
6134 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
6135 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
6136 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
6137 | ||
6138 | } | |
6139 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, | |
6140 | unsigned int res) | |
6141 | { | |
6142 | /* Headphone insertion or removal. */ | |
6143 | if ((res >> 26) == ALC880_HP_EVENT) | |
6144 | alc885_mbp3_automute(codec); | |
6145 | } | |
6146 | ||
6147 | ||
272a527c KY |
6148 | static struct hda_verb alc882_targa_verbs[] = { |
6149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6151 | ||
6152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6153 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 6154 | |
272a527c KY |
6155 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
6156 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
6157 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6158 | ||
6159 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
6160 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | |
6161 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
6162 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
6163 | { } /* end */ | |
6164 | }; | |
6165 | ||
6166 | /* toggle speaker-output according to the hp-jack state */ | |
6167 | static void alc882_targa_automute(struct hda_codec *codec) | |
6168 | { | |
6169 | unsigned int present; | |
ea1fb29a | 6170 | |
272a527c KY |
6171 | present = snd_hda_codec_read(codec, 0x14, 0, |
6172 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
6173 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
6174 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
82beb8fd TI |
6175 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
6176 | present ? 1 : 3); | |
272a527c KY |
6177 | } |
6178 | ||
6179 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | |
6180 | { | |
6181 | /* Looks like the unsol event is incompatible with the standard | |
6182 | * definition. 4bit tag is placed at 26 bit! | |
6183 | */ | |
6184 | if (((res >> 26) == ALC880_HP_EVENT)) { | |
6185 | alc882_targa_automute(codec); | |
6186 | } | |
6187 | } | |
6188 | ||
6189 | static struct hda_verb alc882_asus_a7j_verbs[] = { | |
6190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6191 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6192 | ||
6193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6194 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6195 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 6196 | |
272a527c KY |
6197 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
6198 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6199 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
6200 | ||
6201 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
6202 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
6203 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6204 | { } /* end */ | |
6205 | }; | |
6206 | ||
914759b7 TI |
6207 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
6208 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6209 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6210 | ||
6211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
6212 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
6213 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 6214 | |
914759b7 TI |
6215 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
6216 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6217 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | |
6218 | ||
6219 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | |
6220 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
6221 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
6222 | { } /* end */ | |
6223 | }; | |
6224 | ||
9102cd1c TD |
6225 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
6226 | { | |
6227 | unsigned int gpiostate, gpiomask, gpiodir; | |
6228 | ||
6229 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
6230 | AC_VERB_GET_GPIO_DATA, 0); | |
6231 | ||
6232 | if (!muted) | |
6233 | gpiostate |= (1 << pin); | |
6234 | else | |
6235 | gpiostate &= ~(1 << pin); | |
6236 | ||
6237 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
6238 | AC_VERB_GET_GPIO_MASK, 0); | |
6239 | gpiomask |= (1 << pin); | |
6240 | ||
6241 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
6242 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
6243 | gpiodir |= (1 << pin); | |
6244 | ||
6245 | ||
6246 | snd_hda_codec_write(codec, codec->afg, 0, | |
6247 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
6248 | snd_hda_codec_write(codec, codec->afg, 0, | |
6249 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
6250 | ||
6251 | msleep(1); | |
6252 | ||
6253 | snd_hda_codec_write(codec, codec->afg, 0, | |
6254 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
6255 | } | |
6256 | ||
7debbe51 TI |
6257 | /* set up GPIO at initialization */ |
6258 | static void alc885_macpro_init_hook(struct hda_codec *codec) | |
6259 | { | |
6260 | alc882_gpio_mute(codec, 0, 0); | |
6261 | alc882_gpio_mute(codec, 1, 0); | |
6262 | } | |
6263 | ||
6264 | /* set up GPIO and update auto-muting at initialization */ | |
6265 | static void alc885_imac24_init_hook(struct hda_codec *codec) | |
6266 | { | |
6267 | alc885_macpro_init_hook(codec); | |
6268 | alc885_imac24_automute(codec); | |
6269 | } | |
6270 | ||
df694daa KY |
6271 | /* |
6272 | * generic initialization of ADC, input mixers and output mixers | |
6273 | */ | |
6274 | static struct hda_verb alc882_auto_init_verbs[] = { | |
6275 | /* | |
6276 | * Unmute ADC0-2 and set the default input to mic-in | |
6277 | */ | |
6278 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6280 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6281 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6282 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
6283 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
1da177e4 | 6284 | |
cb53c626 | 6285 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 6286 | * mixer widget |
f12ab1e0 TI |
6287 | * Note: PASD motherboards uses the Line In 2 as the input for |
6288 | * front panel mic (mic 2) | |
df694daa KY |
6289 | */ |
6290 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
6291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
6293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
6294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
6295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
e9edcee0 | 6296 | |
df694daa KY |
6297 | /* |
6298 | * Set up output mixers (0x0c - 0x0f) | |
6299 | */ | |
6300 | /* set vol=0 to output mixers */ | |
6301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6302 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6303 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6304 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
6305 | /* set up input amps for analog loopback */ | |
6306 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
6307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6312 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6313 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6314 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6315 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
6316 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6317 | ||
6318 | /* FIXME: use matrix-type input source selection */ | |
6319 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
6320 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
6321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6323 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6324 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6325 | /* Input mixer2 */ | |
6326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6330 | /* Input mixer3 */ | |
6331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
6332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
6333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
6334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
6335 | ||
6336 | { } | |
6337 | }; | |
6338 | ||
54cbc9ab TI |
6339 | #define alc882_capture_alt_mixer alc880_capture_alt_mixer |
6340 | #define alc882_capture_mixer alc880_capture_mixer | |
df694daa | 6341 | |
cb53c626 TI |
6342 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6343 | #define alc882_loopbacks alc880_loopbacks | |
6344 | #endif | |
6345 | ||
df694daa KY |
6346 | /* pcm configuration: identiacal with ALC880 */ |
6347 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | |
6348 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | |
6349 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | |
6350 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | |
6351 | ||
6352 | /* | |
6353 | * configuration and preset | |
6354 | */ | |
f5fcc13c TI |
6355 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
6356 | [ALC882_3ST_DIG] = "3stack-dig", | |
6357 | [ALC882_6ST_DIG] = "6stack-dig", | |
6358 | [ALC882_ARIMA] = "arima", | |
bdd148a3 | 6359 | [ALC882_W2JC] = "w2jc", |
0438a00e TI |
6360 | [ALC882_TARGA] = "targa", |
6361 | [ALC882_ASUS_A7J] = "asus-a7j", | |
6362 | [ALC882_ASUS_A7M] = "asus-a7m", | |
9102cd1c | 6363 | [ALC885_MACPRO] = "macpro", |
87350ad0 | 6364 | [ALC885_MBP3] = "mbp3", |
c54728d8 | 6365 | [ALC885_IMAC24] = "imac24", |
f5fcc13c TI |
6366 | [ALC882_AUTO] = "auto", |
6367 | }; | |
6368 | ||
6369 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | |
6370 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | |
272a527c | 6371 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
ac8842a0 | 6372 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
914759b7 | 6373 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
ac3e3741 | 6374 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
c5d9f1cd | 6375 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
7b9470d8 | 6376 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
ac3e3741 | 6377 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
4444704c | 6378 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
ac3e3741 TI |
6379 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
6380 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | |
6381 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), | |
df694daa KY |
6382 | {} |
6383 | }; | |
6384 | ||
6385 | static struct alc_config_preset alc882_presets[] = { | |
6386 | [ALC882_3ST_DIG] = { | |
6387 | .mixers = { alc882_base_mixer }, | |
6388 | .init_verbs = { alc882_init_verbs }, | |
6389 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6390 | .dac_nids = alc882_dac_nids, | |
6391 | .dig_out_nid = ALC882_DIGOUT_NID, | |
df694daa KY |
6392 | .dig_in_nid = ALC882_DIGIN_NID, |
6393 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6394 | .channel_mode = alc882_ch_modes, | |
4e195a7b | 6395 | .need_dac_fix = 1, |
df694daa KY |
6396 | .input_mux = &alc882_capture_source, |
6397 | }, | |
6398 | [ALC882_6ST_DIG] = { | |
6399 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
6400 | .init_verbs = { alc882_init_verbs }, | |
6401 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6402 | .dac_nids = alc882_dac_nids, | |
6403 | .dig_out_nid = ALC882_DIGOUT_NID, | |
df694daa KY |
6404 | .dig_in_nid = ALC882_DIGIN_NID, |
6405 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
6406 | .channel_mode = alc882_sixstack_modes, | |
6407 | .input_mux = &alc882_capture_source, | |
6408 | }, | |
4b146cb0 TI |
6409 | [ALC882_ARIMA] = { |
6410 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | |
6411 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, | |
6412 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6413 | .dac_nids = alc882_dac_nids, | |
6414 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | |
6415 | .channel_mode = alc882_sixstack_modes, | |
6416 | .input_mux = &alc882_capture_source, | |
6417 | }, | |
bdd148a3 KY |
6418 | [ALC882_W2JC] = { |
6419 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | |
6420 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | |
6421 | alc880_gpio1_init_verbs }, | |
6422 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6423 | .dac_nids = alc882_dac_nids, | |
6424 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
6425 | .channel_mode = alc880_threestack_modes, | |
6426 | .need_dac_fix = 1, | |
6427 | .input_mux = &alc882_capture_source, | |
6428 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6429 | }, | |
87350ad0 TI |
6430 | [ALC885_MBP3] = { |
6431 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | |
6432 | .init_verbs = { alc885_mbp3_init_verbs, | |
6433 | alc880_gpio1_init_verbs }, | |
6434 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6435 | .dac_nids = alc882_dac_nids, | |
6436 | .channel_mode = alc885_mbp_6ch_modes, | |
6437 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), | |
6438 | .input_mux = &alc882_capture_source, | |
6439 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6440 | .dig_in_nid = ALC882_DIGIN_NID, | |
6441 | .unsol_event = alc885_mbp3_unsol_event, | |
6442 | .init_hook = alc885_mbp3_automute, | |
6443 | }, | |
9102cd1c TD |
6444 | [ALC885_MACPRO] = { |
6445 | .mixers = { alc882_macpro_mixer }, | |
6446 | .init_verbs = { alc882_macpro_init_verbs }, | |
6447 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6448 | .dac_nids = alc882_dac_nids, | |
6449 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6450 | .dig_in_nid = ALC882_DIGIN_NID, | |
6451 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6452 | .channel_mode = alc882_ch_modes, | |
6453 | .input_mux = &alc882_capture_source, | |
7debbe51 | 6454 | .init_hook = alc885_macpro_init_hook, |
9102cd1c | 6455 | }, |
c54728d8 NF |
6456 | [ALC885_IMAC24] = { |
6457 | .mixers = { alc885_imac24_mixer }, | |
6458 | .init_verbs = { alc885_imac24_init_verbs }, | |
6459 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6460 | .dac_nids = alc882_dac_nids, | |
6461 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6462 | .dig_in_nid = ALC882_DIGIN_NID, | |
6463 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | |
6464 | .channel_mode = alc882_ch_modes, | |
6465 | .input_mux = &alc882_capture_source, | |
6466 | .unsol_event = alc885_imac24_unsol_event, | |
7debbe51 | 6467 | .init_hook = alc885_imac24_init_hook, |
c54728d8 | 6468 | }, |
272a527c KY |
6469 | [ALC882_TARGA] = { |
6470 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, | |
6471 | alc882_capture_mixer }, | |
6472 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, | |
6473 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6474 | .dac_nids = alc882_dac_nids, | |
6475 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6476 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
6477 | .adc_nids = alc882_adc_nids, | |
e1406348 | 6478 | .capsrc_nids = alc882_capsrc_nids, |
272a527c KY |
6479 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6480 | .channel_mode = alc882_3ST_6ch_modes, | |
6481 | .need_dac_fix = 1, | |
6482 | .input_mux = &alc882_capture_source, | |
6483 | .unsol_event = alc882_targa_unsol_event, | |
6484 | .init_hook = alc882_targa_automute, | |
6485 | }, | |
6486 | [ALC882_ASUS_A7J] = { | |
6487 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, | |
6488 | alc882_capture_mixer }, | |
6489 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, | |
6490 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6491 | .dac_nids = alc882_dac_nids, | |
6492 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6493 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | |
6494 | .adc_nids = alc882_adc_nids, | |
e1406348 | 6495 | .capsrc_nids = alc882_capsrc_nids, |
272a527c KY |
6496 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6497 | .channel_mode = alc882_3ST_6ch_modes, | |
6498 | .need_dac_fix = 1, | |
6499 | .input_mux = &alc882_capture_source, | |
ea1fb29a | 6500 | }, |
914759b7 TI |
6501 | [ALC882_ASUS_A7M] = { |
6502 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | |
6503 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | |
6504 | alc880_gpio1_init_verbs, | |
6505 | alc882_asus_a7m_verbs }, | |
6506 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | |
6507 | .dac_nids = alc882_dac_nids, | |
6508 | .dig_out_nid = ALC882_DIGOUT_NID, | |
6509 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | |
6510 | .channel_mode = alc880_threestack_modes, | |
6511 | .need_dac_fix = 1, | |
6512 | .input_mux = &alc882_capture_source, | |
ea1fb29a | 6513 | }, |
df694daa KY |
6514 | }; |
6515 | ||
6516 | ||
f95474ec TI |
6517 | /* |
6518 | * Pin config fixes | |
6519 | */ | |
ea1fb29a | 6520 | enum { |
f95474ec TI |
6521 | PINFIX_ABIT_AW9D_MAX |
6522 | }; | |
6523 | ||
6524 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | |
6525 | { 0x15, 0x01080104 }, /* side */ | |
6526 | { 0x16, 0x01011012 }, /* rear */ | |
6527 | { 0x17, 0x01016011 }, /* clfe */ | |
6528 | { } | |
6529 | }; | |
6530 | ||
6531 | static const struct alc_pincfg *alc882_pin_fixes[] = { | |
6532 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | |
6533 | }; | |
6534 | ||
6535 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | |
6536 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | |
6537 | {} | |
6538 | }; | |
6539 | ||
df694daa KY |
6540 | /* |
6541 | * BIOS auto configuration | |
6542 | */ | |
6543 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |
6544 | hda_nid_t nid, int pin_type, | |
6545 | int dac_idx) | |
6546 | { | |
6547 | /* set as output */ | |
6548 | struct alc_spec *spec = codec->spec; | |
f12ab1e0 TI |
6549 | int idx; |
6550 | ||
f6c7e546 | 6551 | alc_set_pin_output(codec, nid, pin_type); |
df694daa KY |
6552 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
6553 | idx = 4; | |
6554 | else | |
6555 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
df694daa KY |
6556 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
6557 | ||
6558 | } | |
6559 | ||
6560 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | |
6561 | { | |
6562 | struct alc_spec *spec = codec->spec; | |
6563 | int i; | |
6564 | ||
bc9f98a9 | 6565 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
df694daa | 6566 | for (i = 0; i <= HDA_SIDE; i++) { |
f12ab1e0 | 6567 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 6568 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 6569 | if (nid) |
baba8ee9 | 6570 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 6571 | i); |
df694daa KY |
6572 | } |
6573 | } | |
6574 | ||
6575 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | |
6576 | { | |
6577 | struct alc_spec *spec = codec->spec; | |
6578 | hda_nid_t pin; | |
6579 | ||
eb06ed8f | 6580 | pin = spec->autocfg.hp_pins[0]; |
df694daa | 6581 | if (pin) /* connect to front */ |
f12ab1e0 TI |
6582 | /* use dac 0 */ |
6583 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
6584 | pin = spec->autocfg.speaker_pins[0]; |
6585 | if (pin) | |
6586 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
df694daa KY |
6587 | } |
6588 | ||
6589 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) | |
6590 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID | |
6591 | ||
6592 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | |
6593 | { | |
6594 | struct alc_spec *spec = codec->spec; | |
6595 | int i; | |
6596 | ||
6597 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
6598 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
7194cae6 TI |
6599 | unsigned int vref; |
6600 | if (!nid) | |
6601 | continue; | |
6602 | vref = PIN_IN; | |
6603 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { | |
531240ff KY |
6604 | unsigned int pincap; |
6605 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | |
6606 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & | |
7194cae6 TI |
6607 | AC_PINCAP_VREF_80) |
6608 | vref = PIN_VREF80; | |
df694daa | 6609 | } |
7194cae6 TI |
6610 | snd_hda_codec_write(codec, nid, 0, |
6611 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); | |
6612 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | |
6613 | snd_hda_codec_write(codec, nid, 0, | |
6614 | AC_VERB_SET_AMP_GAIN_MUTE, | |
6615 | AMP_OUT_MUTE); | |
df694daa KY |
6616 | } |
6617 | } | |
6618 | ||
f511b01c TI |
6619 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
6620 | { | |
6621 | struct alc_spec *spec = codec->spec; | |
6622 | const struct hda_input_mux *imux = spec->input_mux; | |
6623 | int c; | |
6624 | ||
6625 | for (c = 0; c < spec->num_adc_nids; c++) { | |
6626 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | |
6627 | hda_nid_t nid = spec->capsrc_nids[c]; | |
6628 | int conns, mute, idx, item; | |
6629 | ||
6630 | conns = snd_hda_get_connections(codec, nid, conn_list, | |
6631 | ARRAY_SIZE(conn_list)); | |
6632 | if (conns < 0) | |
6633 | continue; | |
6634 | for (idx = 0; idx < conns; idx++) { | |
6635 | /* if the current connection is the selected one, | |
6636 | * unmute it as default - otherwise mute it | |
6637 | */ | |
6638 | mute = AMP_IN_MUTE(idx); | |
6639 | for (item = 0; item < imux->num_items; item++) { | |
6640 | if (imux->items[item].index == idx) { | |
6641 | if (spec->cur_mux[c] == item) | |
6642 | mute = AMP_IN_UNMUTE(idx); | |
6643 | break; | |
6644 | } | |
6645 | } | |
6646 | snd_hda_codec_write(codec, nid, 0, | |
6647 | AC_VERB_SET_AMP_GAIN_MUTE, mute); | |
6648 | } | |
6649 | } | |
6650 | } | |
6651 | ||
776e184e TI |
6652 | /* add mic boosts if needed */ |
6653 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | |
6654 | { | |
6655 | struct alc_spec *spec = codec->spec; | |
6656 | int err; | |
6657 | hda_nid_t nid; | |
6658 | ||
6659 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | |
ce22e03e | 6660 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
776e184e TI |
6661 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
6662 | "Mic Boost", | |
6663 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
6664 | if (err < 0) | |
6665 | return err; | |
6666 | } | |
6667 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | |
ce22e03e | 6668 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
776e184e TI |
6669 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
6670 | "Front Mic Boost", | |
6671 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
6672 | if (err < 0) | |
6673 | return err; | |
6674 | } | |
6675 | return 0; | |
6676 | } | |
6677 | ||
df694daa KY |
6678 | /* almost identical with ALC880 parser... */ |
6679 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
6680 | { | |
6681 | struct alc_spec *spec = codec->spec; | |
6682 | int err = alc880_parse_auto_config(codec); | |
6683 | ||
6684 | if (err < 0) | |
6685 | return err; | |
776e184e TI |
6686 | else if (!err) |
6687 | return 0; /* no config found */ | |
6688 | ||
6689 | err = alc_auto_add_mic_boost(codec); | |
6690 | if (err < 0) | |
6691 | return err; | |
6692 | ||
6693 | /* hack - override the init verbs */ | |
6694 | spec->init_verbs[0] = alc882_auto_init_verbs; | |
6695 | ||
6696 | return 1; /* config found */ | |
df694daa KY |
6697 | } |
6698 | ||
ae6b813a TI |
6699 | /* additional initialization for auto-configuration model */ |
6700 | static void alc882_auto_init(struct hda_codec *codec) | |
df694daa | 6701 | { |
f6c7e546 | 6702 | struct alc_spec *spec = codec->spec; |
df694daa KY |
6703 | alc882_auto_init_multi_out(codec); |
6704 | alc882_auto_init_hp_out(codec); | |
6705 | alc882_auto_init_analog_input(codec); | |
f511b01c | 6706 | alc882_auto_init_input_src(codec); |
f6c7e546 | 6707 | if (spec->unsol_event) |
7fb0d78f | 6708 | alc_inithook(codec); |
df694daa KY |
6709 | } |
6710 | ||
7943a8ab TI |
6711 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
6712 | ||
df694daa KY |
6713 | static int patch_alc882(struct hda_codec *codec) |
6714 | { | |
6715 | struct alc_spec *spec; | |
6716 | int err, board_config; | |
6717 | ||
6718 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
6719 | if (spec == NULL) | |
6720 | return -ENOMEM; | |
6721 | ||
6722 | codec->spec = spec; | |
6723 | ||
f5fcc13c TI |
6724 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
6725 | alc882_models, | |
6726 | alc882_cfg_tbl); | |
df694daa KY |
6727 | |
6728 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | |
081d17c4 TD |
6729 | /* Pick up systems that don't supply PCI SSID */ |
6730 | switch (codec->subsystem_id) { | |
6731 | case 0x106b0c00: /* Mac Pro */ | |
6732 | board_config = ALC885_MACPRO; | |
6733 | break; | |
c54728d8 | 6734 | case 0x106b1000: /* iMac 24 */ |
f3911c5a | 6735 | case 0x106b2800: /* AppleTV */ |
c54728d8 NF |
6736 | board_config = ALC885_IMAC24; |
6737 | break; | |
c7e0757a | 6738 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
9c95c43d | 6739 | case 0x106b00a4: /* MacbookPro4,1 */ |
87350ad0 | 6740 | case 0x106b2c00: /* Macbook Pro rev3 */ |
c7e0757a | 6741 | case 0x106b3600: /* Macbook 3.1 */ |
87350ad0 TI |
6742 | board_config = ALC885_MBP3; |
6743 | break; | |
081d17c4 | 6744 | default: |
7943a8ab | 6745 | /* ALC889A is handled better as ALC888-compatible */ |
669faba2 CM |
6746 | if (codec->revision_id == 0x100101 || |
6747 | codec->revision_id == 0x100103) { | |
7943a8ab TI |
6748 | alc_free(codec); |
6749 | return patch_alc883(codec); | |
6750 | } | |
081d17c4 TD |
6751 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
6752 | "trying auto-probe from BIOS...\n"); | |
6753 | board_config = ALC882_AUTO; | |
6754 | } | |
df694daa KY |
6755 | } |
6756 | ||
f95474ec TI |
6757 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
6758 | ||
df694daa KY |
6759 | if (board_config == ALC882_AUTO) { |
6760 | /* automatic parse from the BIOS config */ | |
6761 | err = alc882_parse_auto_config(codec); | |
6762 | if (err < 0) { | |
6763 | alc_free(codec); | |
6764 | return err; | |
f12ab1e0 | 6765 | } else if (!err) { |
9c7f852e TI |
6766 | printk(KERN_INFO |
6767 | "hda_codec: Cannot set up configuration " | |
6768 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
6769 | board_config = ALC882_3ST_DIG; |
6770 | } | |
6771 | } | |
6772 | ||
6773 | if (board_config != ALC882_AUTO) | |
6774 | setup_preset(spec, &alc882_presets[board_config]); | |
1da177e4 | 6775 | |
2f893286 KY |
6776 | if (codec->vendor_id == 0x10ec0885) { |
6777 | spec->stream_name_analog = "ALC885 Analog"; | |
6778 | spec->stream_name_digital = "ALC885 Digital"; | |
6779 | } else { | |
6780 | spec->stream_name_analog = "ALC882 Analog"; | |
6781 | spec->stream_name_digital = "ALC882 Digital"; | |
6782 | } | |
6783 | ||
df694daa KY |
6784 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
6785 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | |
6330079f TI |
6786 | /* FIXME: setup DAC5 */ |
6787 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | |
6788 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | |
1da177e4 | 6789 | |
df694daa KY |
6790 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
6791 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | |
1da177e4 | 6792 | |
54cbc9ab | 6793 | spec->is_mix_capture = 1; /* matrix-style capture */ |
f12ab1e0 | 6794 | if (!spec->adc_nids && spec->input_mux) { |
df694daa | 6795 | /* check whether NID 0x07 is valid */ |
4a471b7d | 6796 | unsigned int wcap = get_wcaps(codec, 0x07); |
f12ab1e0 TI |
6797 | /* get type */ |
6798 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
df694daa KY |
6799 | if (wcap != AC_WID_AUD_IN) { |
6800 | spec->adc_nids = alc882_adc_nids_alt; | |
6801 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); | |
e1406348 | 6802 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
d88897ea | 6803 | add_mixer(spec, alc882_capture_alt_mixer); |
df694daa KY |
6804 | } else { |
6805 | spec->adc_nids = alc882_adc_nids; | |
6806 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); | |
e1406348 | 6807 | spec->capsrc_nids = alc882_capsrc_nids; |
d88897ea | 6808 | add_mixer(spec, alc882_capture_mixer); |
df694daa KY |
6809 | } |
6810 | } | |
1da177e4 | 6811 | |
2134ea4f TI |
6812 | spec->vmaster_nid = 0x0c; |
6813 | ||
1da177e4 | 6814 | codec->patch_ops = alc_patch_ops; |
df694daa | 6815 | if (board_config == ALC882_AUTO) |
ae6b813a | 6816 | spec->init_hook = alc882_auto_init; |
cb53c626 TI |
6817 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6818 | if (!spec->loopback.amplist) | |
6819 | spec->loopback.amplist = alc882_loopbacks; | |
6820 | #endif | |
df694daa KY |
6821 | |
6822 | return 0; | |
6823 | } | |
6824 | ||
6825 | /* | |
9c7f852e TI |
6826 | * ALC883 support |
6827 | * | |
6828 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible | |
6829 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
6830 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
6831 | * 6-channel independent captures. | |
6832 | * | |
6833 | * In addition, an independent DAC for the multi-playback (not used in this | |
6834 | * driver yet). | |
df694daa | 6835 | */ |
9c7f852e TI |
6836 | #define ALC883_DIGOUT_NID 0x06 |
6837 | #define ALC883_DIGIN_NID 0x0a | |
df694daa | 6838 | |
9c7f852e TI |
6839 | static hda_nid_t alc883_dac_nids[4] = { |
6840 | /* front, rear, clfe, rear_surr */ | |
f32a19e3 | 6841 | 0x02, 0x03, 0x04, 0x05 |
9c7f852e | 6842 | }; |
df694daa | 6843 | |
9c7f852e TI |
6844 | static hda_nid_t alc883_adc_nids[2] = { |
6845 | /* ADC1-2 */ | |
6846 | 0x08, 0x09, | |
6847 | }; | |
f12ab1e0 | 6848 | |
e1406348 TI |
6849 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
6850 | ||
9c7f852e TI |
6851 | /* input MUX */ |
6852 | /* FIXME: should be a matrix-type input source selection */ | |
df694daa | 6853 | |
9c7f852e TI |
6854 | static struct hda_input_mux alc883_capture_source = { |
6855 | .num_items = 4, | |
6856 | .items = { | |
6857 | { "Mic", 0x0 }, | |
6858 | { "Front Mic", 0x1 }, | |
6859 | { "Line", 0x2 }, | |
6860 | { "CD", 0x4 }, | |
6861 | }, | |
6862 | }; | |
bc9f98a9 | 6863 | |
17bba1b7 J |
6864 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
6865 | .num_items = 4, | |
6866 | .items = { | |
6867 | { "Mic", 0x1 }, | |
6868 | { "Front Mic", 0x0 }, | |
6869 | { "Line", 0x2 }, | |
6870 | { "CD", 0x4 }, | |
6871 | }, | |
6872 | }; | |
6873 | ||
bc9f98a9 KY |
6874 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
6875 | .num_items = 2, | |
6876 | .items = { | |
6877 | { "Mic", 0x1 }, | |
6878 | { "Line", 0x2 }, | |
6879 | }, | |
6880 | }; | |
6881 | ||
272a527c KY |
6882 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
6883 | .num_items = 4, | |
6884 | .items = { | |
6885 | { "Mic", 0x0 }, | |
6886 | { "iMic", 0x1 }, | |
6887 | { "Line", 0x2 }, | |
6888 | { "CD", 0x4 }, | |
6889 | }, | |
6890 | }; | |
6891 | ||
fb97dc67 J |
6892 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
6893 | .num_items = 2, | |
6894 | .items = { | |
6895 | { "Mic", 0x0 }, | |
6896 | { "Int Mic", 0x1 }, | |
6897 | }, | |
6898 | }; | |
6899 | ||
e2757d5e KY |
6900 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
6901 | .num_items = 3, | |
6902 | .items = { | |
6903 | { "Mic", 0x0 }, | |
6904 | { "Front Mic", 0x1 }, | |
6905 | { "Line", 0x4 }, | |
6906 | }, | |
6907 | }; | |
6908 | ||
6909 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | |
6910 | .num_items = 2, | |
6911 | .items = { | |
6912 | { "Mic", 0x0 }, | |
6913 | { "Line", 0x2 }, | |
6914 | }, | |
6915 | }; | |
6916 | ||
9c7f852e TI |
6917 | /* |
6918 | * 2ch mode | |
6919 | */ | |
6920 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | |
6921 | { 2, NULL } | |
6922 | }; | |
6923 | ||
6924 | /* | |
6925 | * 2ch mode | |
6926 | */ | |
6927 | static struct hda_verb alc883_3ST_ch2_init[] = { | |
6928 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6929 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6930 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6931 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6932 | { } /* end */ | |
6933 | }; | |
6934 | ||
b201131c TD |
6935 | /* |
6936 | * 4ch mode | |
6937 | */ | |
6938 | static struct hda_verb alc883_3ST_ch4_init[] = { | |
6939 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6940 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6941 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6942 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6943 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6944 | { } /* end */ | |
6945 | }; | |
6946 | ||
9c7f852e TI |
6947 | /* |
6948 | * 6ch mode | |
6949 | */ | |
6950 | static struct hda_verb alc883_3ST_ch6_init[] = { | |
6951 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6952 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6953 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6954 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6955 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6956 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6957 | { } /* end */ | |
6958 | }; | |
6959 | ||
b201131c | 6960 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
9c7f852e | 6961 | { 2, alc883_3ST_ch2_init }, |
b201131c | 6962 | { 4, alc883_3ST_ch4_init }, |
9c7f852e TI |
6963 | { 6, alc883_3ST_ch6_init }, |
6964 | }; | |
6965 | ||
17bba1b7 J |
6966 | /* |
6967 | * 2ch mode | |
6968 | */ | |
6969 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | |
6970 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6971 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6972 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
6973 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6974 | { } /* end */ | |
6975 | }; | |
6976 | ||
6977 | /* | |
6978 | * 4ch mode | |
6979 | */ | |
6980 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | |
6981 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
6982 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
6983 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6984 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6985 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6986 | { } /* end */ | |
6987 | }; | |
6988 | ||
6989 | /* | |
6990 | * 6ch mode | |
6991 | */ | |
6992 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | |
6993 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6994 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6995 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
6996 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
6997 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
6998 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
6999 | { } /* end */ | |
7000 | }; | |
7001 | ||
7002 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | |
7003 | { 2, alc883_3ST_ch2_intel_init }, | |
7004 | { 4, alc883_3ST_ch4_intel_init }, | |
7005 | { 6, alc883_3ST_ch6_intel_init }, | |
7006 | }; | |
7007 | ||
9c7f852e TI |
7008 | /* |
7009 | * 6ch mode | |
7010 | */ | |
7011 | static struct hda_verb alc883_sixstack_ch6_init[] = { | |
7012 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
7013 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7014 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7015 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7016 | { } /* end */ | |
7017 | }; | |
7018 | ||
7019 | /* | |
7020 | * 8ch mode | |
7021 | */ | |
7022 | static struct hda_verb alc883_sixstack_ch8_init[] = { | |
7023 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7024 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7025 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7026 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7027 | { } /* end */ | |
7028 | }; | |
7029 | ||
7030 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | |
7031 | { 6, alc883_sixstack_ch6_init }, | |
7032 | { 8, alc883_sixstack_ch8_init }, | |
7033 | }; | |
7034 | ||
b373bdeb AN |
7035 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
7036 | /* eanable EAPD on medion laptop */ | |
7037 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
7038 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
7039 | { } | |
7040 | }; | |
7041 | ||
9c7f852e TI |
7042 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
7043 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
7044 | */ | |
7045 | ||
7046 | static struct snd_kcontrol_new alc883_base_mixer[] = { | |
df694daa | 7047 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9c7f852e TI |
7048 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
7049 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7050 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7051 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7052 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7053 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7054 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7055 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
7056 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
7057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
df694daa KY |
7058 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
7059 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7060 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7061 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7063 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
df694daa | 7064 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
9c7f852e | 7065 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
32360416 | 7066 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
7067 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7068 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7069 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
7070 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7071 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7072 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7073 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7074 | { | |
7075 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7076 | /* .name = "Capture Source", */ | |
7077 | .name = "Input Source", | |
7078 | .count = 2, | |
54cbc9ab TI |
7079 | .info = alc_mux_enum_info, |
7080 | .get = alc_mux_enum_get, | |
7081 | .put = alc_mux_enum_put, | |
9c7f852e | 7082 | }, |
df694daa | 7083 | { } /* end */ |
834be88d TI |
7084 | }; |
7085 | ||
a8848bd6 AS |
7086 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
7087 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7088 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7089 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7090 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7091 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7092 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7093 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7094 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7095 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7096 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7097 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7098 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
7099 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7100 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7101 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7102 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7103 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7104 | { | |
7105 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7106 | /* .name = "Capture Source", */ | |
7107 | .name = "Input Source", | |
7108 | .count = 2, | |
54cbc9ab TI |
7109 | .info = alc_mux_enum_info, |
7110 | .get = alc_mux_enum_get, | |
7111 | .put = alc_mux_enum_put, | |
a8848bd6 AS |
7112 | }, |
7113 | { } /* end */ | |
7114 | }; | |
7115 | ||
0c4cc443 | 7116 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
368c7a95 J |
7117 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7118 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
7119 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7120 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
7121 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7122 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7123 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7124 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7125 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
7126 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7127 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7128 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7129 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7130 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7131 | { | |
7132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7133 | /* .name = "Capture Source", */ | |
7134 | .name = "Input Source", | |
7135 | .count = 2, | |
54cbc9ab TI |
7136 | .info = alc_mux_enum_info, |
7137 | .get = alc_mux_enum_get, | |
7138 | .put = alc_mux_enum_put, | |
368c7a95 J |
7139 | }, |
7140 | { } /* end */ | |
7141 | }; | |
7142 | ||
fb97dc67 J |
7143 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
7144 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7145 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | |
7146 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7147 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
7148 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7149 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7151 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7152 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
7153 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7154 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7155 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7156 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7157 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7158 | { | |
7159 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7160 | /* .name = "Capture Source", */ | |
7161 | .name = "Input Source", | |
7162 | .count = 2, | |
54cbc9ab TI |
7163 | .info = alc_mux_enum_info, |
7164 | .get = alc_mux_enum_get, | |
7165 | .put = alc_mux_enum_put, | |
fb97dc67 J |
7166 | }, |
7167 | { } /* end */ | |
7168 | }; | |
7169 | ||
9c7f852e TI |
7170 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
7171 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7172 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7173 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7174 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7175 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7176 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7177 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7179 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
7180 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7181 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7182 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
7183 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7184 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7185 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
7186 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7187 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7188 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7189 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7190 | { | |
7191 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7192 | /* .name = "Capture Source", */ | |
7193 | .name = "Input Source", | |
7194 | .count = 2, | |
54cbc9ab TI |
7195 | .info = alc_mux_enum_info, |
7196 | .get = alc_mux_enum_get, | |
7197 | .put = alc_mux_enum_put, | |
9c7f852e TI |
7198 | }, |
7199 | { } /* end */ | |
7200 | }; | |
df694daa | 7201 | |
9c7f852e TI |
7202 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
7203 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7204 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7205 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7206 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7207 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7208 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7209 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7210 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7211 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7213 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7214 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7215 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7217 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
7218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7219 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7220 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
7221 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7222 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7223 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
7224 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7225 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
9c7f852e TI |
7226 | { |
7227 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7228 | /* .name = "Capture Source", */ | |
7229 | .name = "Input Source", | |
e2757d5e | 7230 | .count = 1, |
54cbc9ab TI |
7231 | .info = alc_mux_enum_info, |
7232 | .get = alc_mux_enum_get, | |
7233 | .put = alc_mux_enum_put, | |
9c7f852e TI |
7234 | }, |
7235 | { } /* end */ | |
7236 | }; | |
7237 | ||
17bba1b7 J |
7238 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
7239 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7240 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7241 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7242 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7243 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | |
7244 | HDA_OUTPUT), | |
7245 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7246 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7247 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7248 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7249 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7250 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7251 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7252 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7254 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
7255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7256 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7257 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | |
7258 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7259 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7260 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
7261 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7262 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7263 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7264 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7265 | { | |
7266 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7267 | /* .name = "Capture Source", */ | |
7268 | .name = "Input Source", | |
7269 | .count = 2, | |
54cbc9ab TI |
7270 | .info = alc_mux_enum_info, |
7271 | .get = alc_mux_enum_get, | |
7272 | .put = alc_mux_enum_put, | |
17bba1b7 J |
7273 | }, |
7274 | { } /* end */ | |
7275 | }; | |
7276 | ||
d1d985f0 | 7277 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
c07584c8 | 7278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
0701e064 | 7279 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
c07584c8 | 7280 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
0701e064 | 7281 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
c07584c8 TD |
7282 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
7283 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
0701e064 TI |
7284 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
7285 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
c07584c8 TD |
7286 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
7287 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7288 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7289 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7290 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7291 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7292 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
c07584c8 TD |
7293 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7294 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
32360416 | 7295 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
c07584c8 TD |
7296 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7297 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
7298 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
7299 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7300 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7301 | ||
7302 | { | |
7303 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7304 | /* .name = "Capture Source", */ | |
7305 | .name = "Input Source", | |
7306 | .count = 1, | |
54cbc9ab TI |
7307 | .info = alc_mux_enum_info, |
7308 | .get = alc_mux_enum_get, | |
7309 | .put = alc_mux_enum_put, | |
c07584c8 TD |
7310 | }, |
7311 | { } /* end */ | |
7312 | }; | |
7313 | ||
ccc656ce KY |
7314 | static struct snd_kcontrol_new alc883_tagra_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", 0x1b, 0x0, HDA_OUTPUT), | |
7318 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
7319 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
7320 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
7321 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
7322 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
7323 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
7324 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7325 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7326 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7327 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7328 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7329 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce KY |
7330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7331 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7332 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7333 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7334 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7335 | { | |
7336 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7337 | /* .name = "Capture Source", */ | |
7338 | .name = "Input Source", | |
7339 | .count = 2, | |
54cbc9ab TI |
7340 | .info = alc_mux_enum_info, |
7341 | .get = alc_mux_enum_get, | |
7342 | .put = alc_mux_enum_put, | |
ccc656ce KY |
7343 | }, |
7344 | { } /* end */ | |
f12ab1e0 | 7345 | }; |
ccc656ce KY |
7346 | |
7347 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { | |
7348 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7349 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7350 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7351 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7352 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
32360416 | 7354 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce | 7355 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
4383fae0 J |
7356 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7357 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
7358 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ccc656ce KY |
7359 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
7360 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7361 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7362 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7363 | { | |
7364 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7365 | /* .name = "Capture Source", */ | |
7366 | .name = "Input Source", | |
7367 | .count = 2, | |
54cbc9ab TI |
7368 | .info = alc_mux_enum_info, |
7369 | .get = alc_mux_enum_get, | |
7370 | .put = alc_mux_enum_put, | |
ccc656ce KY |
7371 | }, |
7372 | { } /* end */ | |
f12ab1e0 | 7373 | }; |
ccc656ce | 7374 | |
bc9f98a9 KY |
7375 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
7376 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7377 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
86cd9298 TI |
7378 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
7379 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | |
bc9f98a9 KY |
7380 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
7381 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7382 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7383 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7384 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7385 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7386 | { | |
7387 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7388 | /* .name = "Capture Source", */ | |
7389 | .name = "Input Source", | |
7390 | .count = 1, | |
54cbc9ab TI |
7391 | .info = alc_mux_enum_info, |
7392 | .get = alc_mux_enum_get, | |
7393 | .put = alc_mux_enum_put, | |
bc9f98a9 KY |
7394 | }, |
7395 | { } /* end */ | |
f12ab1e0 | 7396 | }; |
bc9f98a9 | 7397 | |
272a527c KY |
7398 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
7399 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7400 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
7401 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7402 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7403 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7404 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7405 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7406 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7407 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7408 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7409 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7410 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7411 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7412 | { | |
7413 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7414 | /* .name = "Capture Source", */ | |
7415 | .name = "Input Source", | |
7416 | .count = 2, | |
54cbc9ab TI |
7417 | .info = alc_mux_enum_info, |
7418 | .get = alc_mux_enum_get, | |
7419 | .put = alc_mux_enum_put, | |
272a527c KY |
7420 | }, |
7421 | { } /* end */ | |
7422 | }; | |
7423 | ||
7424 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |
7425 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7426 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7427 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
7428 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7429 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7432 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7433 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7434 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7435 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7436 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7437 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7438 | { | |
7439 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7440 | /* .name = "Capture Source", */ | |
7441 | .name = "Input Source", | |
7442 | .count = 2, | |
54cbc9ab TI |
7443 | .info = alc_mux_enum_info, |
7444 | .get = alc_mux_enum_get, | |
7445 | .put = alc_mux_enum_put, | |
272a527c KY |
7446 | }, |
7447 | { } /* end */ | |
ea1fb29a | 7448 | }; |
272a527c | 7449 | |
2880a867 | 7450 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
d1a991a6 KY |
7451 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7452 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
2880a867 | 7453 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
2880a867 TD |
7454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
7455 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
d1a991a6 KY |
7456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
7457 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2880a867 TD |
7459 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
7460 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7461 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7462 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7463 | { | |
7464 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7465 | /* .name = "Capture Source", */ | |
7466 | .name = "Input Source", | |
7467 | .count = 2, | |
54cbc9ab TI |
7468 | .info = alc_mux_enum_info, |
7469 | .get = alc_mux_enum_get, | |
7470 | .put = alc_mux_enum_put, | |
2880a867 TD |
7471 | }, |
7472 | { } /* end */ | |
d1a991a6 | 7473 | }; |
2880a867 | 7474 | |
e2757d5e KY |
7475 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
7476 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7477 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7478 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | |
7479 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | |
7480 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | |
7481 | 0x0d, 1, 0x0, HDA_OUTPUT), | |
7482 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | |
7483 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | |
7484 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | |
7485 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | |
7486 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
7487 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
7488 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | |
7489 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
7490 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
7491 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7492 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7493 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7494 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7495 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7496 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
7497 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
7498 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
7499 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
7500 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
7501 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | |
7502 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | |
7503 | { | |
7504 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7505 | /* .name = "Capture Source", */ | |
7506 | .name = "Input Source", | |
7507 | .count = 2, | |
54cbc9ab TI |
7508 | .info = alc_mux_enum_info, |
7509 | .get = alc_mux_enum_get, | |
7510 | .put = alc_mux_enum_put, | |
e2757d5e KY |
7511 | }, |
7512 | { } /* end */ | |
7513 | }; | |
7514 | ||
7515 | static struct hda_bind_ctls alc883_bind_cap_vol = { | |
7516 | .ops = &snd_hda_bind_vol, | |
7517 | .values = { | |
7518 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
7519 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
7520 | 0 | |
7521 | }, | |
7522 | }; | |
7523 | ||
7524 | static struct hda_bind_ctls alc883_bind_cap_switch = { | |
7525 | .ops = &snd_hda_bind_sw, | |
7526 | .values = { | |
7527 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | |
7528 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | |
7529 | 0 | |
7530 | }, | |
7531 | }; | |
7532 | ||
7533 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | |
7534 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
7535 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
7536 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
7537 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
7538 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
7539 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
7540 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
7541 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
7542 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | |
7543 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | |
7544 | { | |
7545 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7546 | /* .name = "Capture Source", */ | |
7547 | .name = "Input Source", | |
7548 | .count = 1, | |
54cbc9ab TI |
7549 | .info = alc_mux_enum_info, |
7550 | .get = alc_mux_enum_get, | |
7551 | .put = alc_mux_enum_put, | |
e2757d5e KY |
7552 | }, |
7553 | { } /* end */ | |
7554 | }; | |
7555 | ||
9c7f852e TI |
7556 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
7557 | { | |
7558 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
7559 | .name = "Channel Mode", | |
7560 | .info = alc_ch_mode_info, | |
7561 | .get = alc_ch_mode_get, | |
7562 | .put = alc_ch_mode_put, | |
7563 | }, | |
7564 | { } /* end */ | |
7565 | }; | |
7566 | ||
7567 | static struct hda_verb alc883_init_verbs[] = { | |
7568 | /* ADC1: mute amp left and right */ | |
e2757d5e | 7569 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
df694daa | 7570 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9c7f852e TI |
7571 | /* ADC2: mute amp left and right */ |
7572 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
df694daa | 7573 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9c7f852e TI |
7574 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
7575 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7576 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7578 | /* Rear mixer */ | |
7579 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7580 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7581 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7582 | /* CLFE mixer */ | |
7583 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7584 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7585 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7586 | /* Side mixer */ | |
7587 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
7588 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7589 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
df694daa | 7590 | |
cb53c626 TI |
7591 | /* mute analog input loopbacks */ |
7592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
7593 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
7594 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7595 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
7596 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa | 7597 | |
9c7f852e TI |
7598 | /* Front Pin: output 0 (0x0c) */ |
7599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7600 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7601 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7602 | /* Rear Pin: output 1 (0x0d) */ | |
7603 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7604 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7605 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7606 | /* CLFE Pin: output 2 (0x0e) */ | |
7607 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7608 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7609 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7610 | /* Side Pin: output 3 (0x0f) */ | |
7611 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7612 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7613 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
7614 | /* Mic (rear) pin: input vref at 80% */ | |
7615 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7616 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7617 | /* Front Mic pin: input vref at 80% */ | |
7618 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
7619 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7620 | /* Line In pin: input */ | |
7621 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7622 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
7623 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
7624 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7625 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
7626 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7627 | /* CD pin widget for input */ | |
7628 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
7629 | ||
7630 | /* FIXME: use matrix-type input source selection */ | |
7631 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
7632 | /* Input mixer2 */ | |
7633 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
e2757d5e KY |
7634 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
7635 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7636 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
7637 | /* Input mixer3 */ |
7638 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
e2757d5e KY |
7639 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
7640 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
7641 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
7642 | { } |
7643 | }; | |
7644 | ||
a8848bd6 AS |
7645 | /* toggle speaker-output according to the hp-jack state */ |
7646 | static void alc883_mitac_hp_automute(struct hda_codec *codec) | |
7647 | { | |
7648 | unsigned int present; | |
7649 | ||
7650 | present = snd_hda_codec_read(codec, 0x15, 0, | |
7651 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7652 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7653 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7654 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
7655 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7656 | } | |
7657 | ||
7658 | /* auto-toggle front mic */ | |
7659 | /* | |
7660 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | |
7661 | { | |
7662 | unsigned int present; | |
7663 | unsigned char bits; | |
7664 | ||
7665 | present = snd_hda_codec_read(codec, 0x18, 0, | |
7666 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7667 | bits = present ? HDA_AMP_MUTE : 0; | |
7668 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | |
7669 | } | |
7670 | */ | |
7671 | ||
7672 | static void alc883_mitac_automute(struct hda_codec *codec) | |
7673 | { | |
7674 | alc883_mitac_hp_automute(codec); | |
7675 | /* alc883_mitac_mic_automute(codec); */ | |
7676 | } | |
7677 | ||
7678 | static void alc883_mitac_unsol_event(struct hda_codec *codec, | |
7679 | unsigned int res) | |
7680 | { | |
7681 | switch (res >> 26) { | |
7682 | case ALC880_HP_EVENT: | |
7683 | alc883_mitac_hp_automute(codec); | |
7684 | break; | |
7685 | case ALC880_MIC_EVENT: | |
7686 | /* alc883_mitac_mic_automute(codec); */ | |
7687 | break; | |
7688 | } | |
7689 | } | |
7690 | ||
7691 | static struct hda_verb alc883_mitac_verbs[] = { | |
7692 | /* HP */ | |
7693 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7695 | /* Subwoofer */ | |
7696 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
7697 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7698 | ||
7699 | /* enable unsolicited event */ | |
7700 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7701 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | |
7702 | ||
7703 | { } /* end */ | |
7704 | }; | |
7705 | ||
0c4cc443 | 7706 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
368c7a95 J |
7707 | /* HP */ |
7708 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7709 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7710 | /* Int speaker */ | |
7711 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7712 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7713 | ||
7714 | /* enable unsolicited event */ | |
7715 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
0c4cc443 | 7716 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
368c7a95 J |
7717 | |
7718 | { } /* end */ | |
7719 | }; | |
7720 | ||
fb97dc67 J |
7721 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
7722 | /* HP */ | |
7723 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7724 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7725 | /* Subwoofer */ | |
7726 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
7727 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7728 | ||
7729 | /* enable unsolicited event */ | |
7730 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7731 | ||
7732 | { } /* end */ | |
7733 | }; | |
7734 | ||
ccc656ce KY |
7735 | static struct hda_verb alc883_tagra_verbs[] = { |
7736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7737 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7738 | ||
7739 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7740 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
ea1fb29a | 7741 | |
ccc656ce KY |
7742 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
7743 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | |
7744 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | |
7745 | ||
7746 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
f12ab1e0 TI |
7747 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
7748 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
7749 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
ccc656ce KY |
7750 | |
7751 | { } /* end */ | |
7752 | }; | |
7753 | ||
bc9f98a9 KY |
7754 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
7755 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7756 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | |
7757 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | |
7758 | { } /* end */ | |
7759 | }; | |
7760 | ||
272a527c KY |
7761 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
7762 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7763 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7764 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7765 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7766 | { } /* end */ | |
7767 | }; | |
7768 | ||
7769 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | |
7770 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7771 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7772 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7773 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | |
7774 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7775 | { } /* end */ | |
7776 | }; | |
7777 | ||
189609ae KY |
7778 | static struct hda_verb alc883_haier_w66_verbs[] = { |
7779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7781 | ||
7782 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7783 | ||
7784 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7785 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7786 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7787 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7788 | { } /* end */ | |
7789 | }; | |
7790 | ||
e2757d5e KY |
7791 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
7792 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7793 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7794 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7795 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7796 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7797 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
7798 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
7799 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7800 | { } /* end */ | |
7801 | }; | |
7802 | ||
4723c022 | 7803 | static struct hda_verb alc888_3st_hp_verbs[] = { |
8341de60 | 7804 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
f32a19e3 HRK |
7805 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
7806 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | |
8341de60 CM |
7807 | { } |
7808 | }; | |
7809 | ||
5795b9e6 | 7810 | static struct hda_verb alc888_6st_dell_verbs[] = { |
5795b9e6 CM |
7811 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
7812 | { } | |
7813 | }; | |
7814 | ||
4723c022 | 7815 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
8341de60 CM |
7816 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
7817 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7818 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
7819 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
7820 | { } | |
7821 | }; | |
7822 | ||
4723c022 | 7823 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
8341de60 CM |
7824 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7825 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7826 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
7827 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
7828 | { } | |
7829 | }; | |
7830 | ||
4723c022 CM |
7831 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
7832 | { 2, alc888_3st_hp_2ch_init }, | |
7833 | { 6, alc888_3st_hp_6ch_init }, | |
8341de60 CM |
7834 | }; |
7835 | ||
272a527c KY |
7836 | /* toggle front-jack and RCA according to the hp-jack state */ |
7837 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |
7838 | { | |
7839 | unsigned int present; | |
ea1fb29a | 7840 | |
272a527c KY |
7841 | present = snd_hda_codec_read(codec, 0x1b, 0, |
7842 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7843 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
7844 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7845 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7846 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
7847 | } |
7848 | ||
7849 | /* toggle RCA according to the front-jack state */ | |
7850 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | |
7851 | { | |
7852 | unsigned int present; | |
ea1fb29a | 7853 | |
272a527c KY |
7854 | present = snd_hda_codec_read(codec, 0x14, 0, |
7855 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7856 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
7857 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c | 7858 | } |
47fd830a | 7859 | |
272a527c KY |
7860 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
7861 | unsigned int res) | |
7862 | { | |
7863 | if ((res >> 26) == ALC880_HP_EVENT) | |
7864 | alc888_lenovo_ms7195_front_automute(codec); | |
7865 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
7866 | alc888_lenovo_ms7195_rca_automute(codec); | |
7867 | } | |
7868 | ||
7869 | static struct hda_verb alc883_medion_md2_verbs[] = { | |
7870 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
7871 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
7872 | ||
7873 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7874 | ||
7875 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
7876 | { } /* end */ | |
7877 | }; | |
7878 | ||
7879 | /* toggle speaker-output according to the hp-jack state */ | |
7880 | static void alc883_medion_md2_automute(struct hda_codec *codec) | |
7881 | { | |
7882 | unsigned int present; | |
ea1fb29a | 7883 | |
272a527c KY |
7884 | present = snd_hda_codec_read(codec, 0x14, 0, |
7885 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7886 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
7887 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
7888 | } |
7889 | ||
7890 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, | |
7891 | unsigned int res) | |
7892 | { | |
7893 | if ((res >> 26) == ALC880_HP_EVENT) | |
7894 | alc883_medion_md2_automute(codec); | |
7895 | } | |
7896 | ||
ccc656ce KY |
7897 | /* toggle speaker-output according to the hp-jack state */ |
7898 | static void alc883_tagra_automute(struct hda_codec *codec) | |
7899 | { | |
7900 | unsigned int present; | |
f12ab1e0 | 7901 | unsigned char bits; |
ccc656ce KY |
7902 | |
7903 | present = snd_hda_codec_read(codec, 0x14, 0, | |
7904 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
7905 | bits = present ? HDA_AMP_MUTE : 0; |
7906 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
7907 | HDA_AMP_MUTE, bits); | |
82beb8fd TI |
7908 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
7909 | present ? 1 : 3); | |
ccc656ce KY |
7910 | } |
7911 | ||
7912 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) | |
7913 | { | |
7914 | if ((res >> 26) == ALC880_HP_EVENT) | |
7915 | alc883_tagra_automute(codec); | |
7916 | } | |
7917 | ||
368c7a95 | 7918 | /* toggle speaker-output according to the hp-jack state */ |
0c4cc443 | 7919 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
368c7a95 J |
7920 | { |
7921 | unsigned int present; | |
7922 | unsigned char bits; | |
7923 | ||
7924 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) | |
7925 | & AC_PINSENSE_PRESENCE; | |
7926 | bits = present ? HDA_AMP_MUTE : 0; | |
7927 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7928 | HDA_AMP_MUTE, bits); | |
7929 | } | |
7930 | ||
0c4cc443 HRK |
7931 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
7932 | { | |
7933 | unsigned int present; | |
7934 | ||
7935 | present = snd_hda_codec_read(codec, 0x18, 0, | |
7936 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7937 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
7938 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
7939 | } | |
7940 | ||
7941 | static void alc883_clevo_m720_automute(struct hda_codec *codec) | |
7942 | { | |
7943 | alc883_clevo_m720_hp_automute(codec); | |
7944 | alc883_clevo_m720_mic_automute(codec); | |
7945 | } | |
7946 | ||
7947 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | |
368c7a95 J |
7948 | unsigned int res) |
7949 | { | |
0c4cc443 HRK |
7950 | switch (res >> 26) { |
7951 | case ALC880_HP_EVENT: | |
7952 | alc883_clevo_m720_hp_automute(codec); | |
7953 | break; | |
7954 | case ALC880_MIC_EVENT: | |
7955 | alc883_clevo_m720_mic_automute(codec); | |
7956 | break; | |
7957 | } | |
368c7a95 J |
7958 | } |
7959 | ||
fb97dc67 J |
7960 | /* toggle speaker-output according to the hp-jack state */ |
7961 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) | |
7962 | { | |
7963 | unsigned int present; | |
7964 | unsigned char bits; | |
7965 | ||
7966 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) | |
7967 | & AC_PINSENSE_PRESENCE; | |
7968 | bits = present ? HDA_AMP_MUTE : 0; | |
7969 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
7970 | HDA_AMP_MUTE, bits); | |
7971 | } | |
7972 | ||
7973 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, | |
7974 | unsigned int res) | |
7975 | { | |
7976 | if ((res >> 26) == ALC880_HP_EVENT) | |
7977 | alc883_2ch_fujitsu_pi2515_automute(codec); | |
7978 | } | |
7979 | ||
189609ae KY |
7980 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
7981 | { | |
7982 | unsigned int present; | |
7983 | unsigned char bits; | |
7984 | ||
7985 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
7986 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
7987 | bits = present ? 0x80 : 0; | |
7988 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
7989 | 0x80, bits); | |
7990 | } | |
7991 | ||
7992 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, | |
7993 | unsigned int res) | |
7994 | { | |
7995 | if ((res >> 26) == ALC880_HP_EVENT) | |
7996 | alc883_haier_w66_automute(codec); | |
7997 | } | |
7998 | ||
bc9f98a9 KY |
7999 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
8000 | { | |
8001 | unsigned int present; | |
f12ab1e0 | 8002 | unsigned char bits; |
bc9f98a9 KY |
8003 | |
8004 | present = snd_hda_codec_read(codec, 0x14, 0, | |
8005 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
8006 | bits = present ? HDA_AMP_MUTE : 0; |
8007 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8008 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
8009 | } |
8010 | ||
8011 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | |
8012 | { | |
8013 | unsigned int present; | |
f12ab1e0 | 8014 | unsigned char bits; |
bc9f98a9 KY |
8015 | |
8016 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
8017 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
8018 | bits = present ? HDA_AMP_MUTE : 0; |
8019 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8020 | HDA_AMP_MUTE, bits); | |
8021 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8022 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
8023 | } |
8024 | ||
8025 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |
8026 | unsigned int res) | |
8027 | { | |
8028 | if ((res >> 26) == ALC880_HP_EVENT) | |
8029 | alc883_lenovo_101e_all_automute(codec); | |
8030 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
8031 | alc883_lenovo_101e_ispeaker_automute(codec); | |
8032 | } | |
8033 | ||
676a9b53 TI |
8034 | /* toggle speaker-output according to the hp-jack state */ |
8035 | static void alc883_acer_aspire_automute(struct hda_codec *codec) | |
8036 | { | |
8037 | unsigned int present; | |
ea1fb29a | 8038 | |
676a9b53 TI |
8039 | present = snd_hda_codec_read(codec, 0x14, 0, |
8040 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
8041 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8042 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8043 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
8044 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8045 | } | |
8046 | ||
8047 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, | |
8048 | unsigned int res) | |
8049 | { | |
8050 | if ((res >> 26) == ALC880_HP_EVENT) | |
8051 | alc883_acer_aspire_automute(codec); | |
8052 | } | |
8053 | ||
d1a991a6 KY |
8054 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
8055 | /* HP Pin: output 0 (0x0c) */ | |
8056 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8057 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
8058 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8059 | /* Front Pin: output 0 (0x0c) */ | |
676a9b53 TI |
8060 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
8061 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
d1a991a6 | 8062 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
d1a991a6 KY |
8063 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8064 | /* eanable EAPD on medion laptop */ | |
8065 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
8066 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
676a9b53 TI |
8067 | /* enable unsolicited event */ |
8068 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
d1a991a6 KY |
8069 | { } |
8070 | }; | |
8071 | ||
5795b9e6 CM |
8072 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
8073 | { | |
8074 | unsigned int present; | |
ea1fb29a | 8075 | |
5795b9e6 CM |
8076 | present = snd_hda_codec_read(codec, 0x1b, 0, |
8077 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
8078 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8079 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8080 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8081 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8082 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
8083 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8084 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
8085 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
8086 | } | |
8087 | ||
8088 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, | |
8089 | unsigned int res) | |
8090 | { | |
8091 | switch (res >> 26) { | |
8092 | case ALC880_HP_EVENT: | |
8093 | printk("hp_event\n"); | |
8094 | alc888_6st_dell_front_automute(codec); | |
8095 | break; | |
8096 | } | |
8097 | } | |
8098 | ||
e2757d5e KY |
8099 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
8100 | { | |
8101 | unsigned int mute; | |
8102 | unsigned int present; | |
8103 | ||
8104 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
8105 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
8106 | AC_VERB_GET_PIN_SENSE, 0); | |
8107 | present = (present & 0x80000000) != 0; | |
8108 | if (present) { | |
8109 | /* mute internal speaker */ | |
8110 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8111 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
8112 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8113 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
8114 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
8115 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
8116 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
8117 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
8118 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
8119 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
8120 | } else { | |
8121 | /* unmute internal speaker if necessary */ | |
8122 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
8123 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
8124 | HDA_AMP_MUTE, mute); | |
8125 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
8126 | HDA_AMP_MUTE, mute); | |
8127 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
8128 | HDA_AMP_MUTE, mute); | |
8129 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | |
8130 | HDA_AMP_MUTE, mute); | |
8131 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | |
8132 | HDA_AMP_MUTE, mute); | |
8133 | } | |
8134 | } | |
8135 | ||
8136 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, | |
8137 | unsigned int res) | |
8138 | { | |
8139 | if ((res >> 26) == ALC880_HP_EVENT) | |
8140 | alc888_lenovo_sky_front_automute(codec); | |
8141 | } | |
8142 | ||
9c7f852e TI |
8143 | /* |
8144 | * generic initialization of ADC, input mixers and output mixers | |
8145 | */ | |
8146 | static struct hda_verb alc883_auto_init_verbs[] = { | |
8147 | /* | |
8148 | * Unmute ADC0-2 and set the default input to mic-in | |
8149 | */ | |
8150 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8151 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8152 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
8153 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8154 | ||
cb53c626 | 8155 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 8156 | * mixer widget |
f12ab1e0 TI |
8157 | * Note: PASD motherboards uses the Line In 2 as the input for |
8158 | * front panel mic (mic 2) | |
9c7f852e TI |
8159 | */ |
8160 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
8161 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8162 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8163 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
8164 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
8165 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
8166 | |
8167 | /* | |
8168 | * Set up output mixers (0x0c - 0x0f) | |
8169 | */ | |
8170 | /* set vol=0 to output mixers */ | |
8171 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8172 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8173 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8174 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
8175 | /* set up input amps for analog loopback */ | |
8176 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
8177 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8178 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8179 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8180 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8181 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8182 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8183 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8184 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8185 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8186 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8187 | ||
8188 | /* FIXME: use matrix-type input source selection */ | |
8189 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
8190 | /* Input mixer1 */ | |
8191 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8192 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8193 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 8194 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
9c7f852e TI |
8195 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
8196 | /* Input mixer2 */ | |
8197 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8199 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 8200 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
e3cde64a | 8201 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
9c7f852e TI |
8202 | |
8203 | { } | |
8204 | }; | |
8205 | ||
8206 | /* capture mixer elements */ | |
54cbc9ab | 8207 | #define alc883_capture_mixer alc880_capture_alt_mixer /* 2 ADC ver */ |
9c7f852e | 8208 | |
e2757d5e KY |
8209 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
8210 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8211 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8212 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
8213 | /* enable unsolicited event */ | |
8214 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8215 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
8216 | { } /* end */ | |
8217 | }; | |
8218 | ||
8219 | static void alc883_nb_mic_automute(struct hda_codec *codec) | |
8220 | { | |
8221 | unsigned int present; | |
8222 | ||
8223 | present = snd_hda_codec_read(codec, 0x18, 0, | |
8224 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
8225 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
8226 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
8227 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
8228 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
8229 | } | |
8230 | ||
8231 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) | |
8232 | { | |
8233 | unsigned int present; | |
8234 | unsigned char bits; | |
8235 | ||
8236 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
8237 | AC_VERB_GET_PIN_SENSE, 0) | |
8238 | & AC_PINSENSE_PRESENCE; | |
8239 | bits = present ? 0 : PIN_OUT; | |
8240 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8241 | bits); | |
8242 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8243 | bits); | |
8244 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8245 | bits); | |
8246 | } | |
8247 | ||
8248 | static void alc883_mode2_unsol_event(struct hda_codec *codec, | |
8249 | unsigned int res) | |
8250 | { | |
8251 | switch (res >> 26) { | |
8252 | case ALC880_HP_EVENT: | |
8253 | alc883_M90V_speaker_automute(codec); | |
8254 | break; | |
8255 | case ALC880_MIC_EVENT: | |
8256 | alc883_nb_mic_automute(codec); | |
8257 | break; | |
8258 | } | |
8259 | } | |
8260 | ||
8261 | static void alc883_mode2_inithook(struct hda_codec *codec) | |
8262 | { | |
8263 | alc883_M90V_speaker_automute(codec); | |
8264 | alc883_nb_mic_automute(codec); | |
8265 | } | |
8266 | ||
8267 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | |
8268 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
8269 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
8270 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
8271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
8272 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
8273 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | |
8274 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | |
8275 | /* enable unsolicited event */ | |
8276 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
8277 | { } /* end */ | |
8278 | }; | |
8279 | ||
8280 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) | |
8281 | { | |
8282 | unsigned int present; | |
8283 | unsigned char bits; | |
8284 | ||
8285 | present = snd_hda_codec_read(codec, 0x14, 0, | |
8286 | AC_VERB_GET_PIN_SENSE, 0) | |
8287 | & AC_PINSENSE_PRESENCE; | |
8288 | bits = present ? 0 : PIN_OUT; | |
8289 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8290 | bits); | |
8291 | } | |
8292 | ||
8293 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, | |
8294 | unsigned int res) | |
8295 | { | |
8296 | switch (res >> 26) { | |
8297 | case ALC880_HP_EVENT: | |
8298 | alc883_eee1601_speaker_automute(codec); | |
8299 | break; | |
8300 | } | |
8301 | } | |
8302 | ||
8303 | static void alc883_eee1601_inithook(struct hda_codec *codec) | |
8304 | { | |
8305 | alc883_eee1601_speaker_automute(codec); | |
8306 | } | |
8307 | ||
cb53c626 TI |
8308 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
8309 | #define alc883_loopbacks alc880_loopbacks | |
8310 | #endif | |
8311 | ||
9c7f852e TI |
8312 | /* pcm configuration: identiacal with ALC880 */ |
8313 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback | |
8314 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 8315 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
9c7f852e TI |
8316 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
8317 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture | |
8318 | ||
8319 | /* | |
8320 | * configuration and preset | |
8321 | */ | |
f5fcc13c TI |
8322 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
8323 | [ALC883_3ST_2ch_DIG] = "3stack-dig", | |
8324 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | |
8325 | [ALC883_3ST_6ch] = "3stack-6ch", | |
8326 | [ALC883_6ST_DIG] = "6stack-dig", | |
8327 | [ALC883_TARGA_DIG] = "targa-dig", | |
8328 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | |
f5fcc13c | 8329 | [ALC883_ACER] = "acer", |
2880a867 | 8330 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
f5fcc13c | 8331 | [ALC883_MEDION] = "medion", |
272a527c | 8332 | [ALC883_MEDION_MD2] = "medion-md2", |
f5fcc13c | 8333 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
bc9f98a9 | 8334 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
272a527c KY |
8335 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
8336 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | |
e2757d5e | 8337 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
189609ae | 8338 | [ALC883_HAIER_W66] = "haier-w66", |
4723c022 | 8339 | [ALC888_3ST_HP] = "3stack-hp", |
5795b9e6 | 8340 | [ALC888_6ST_DELL] = "6stack-dell", |
a8848bd6 | 8341 | [ALC883_MITAC] = "mitac", |
0c4cc443 | 8342 | [ALC883_CLEVO_M720] = "clevo-m720", |
fb97dc67 | 8343 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
17bba1b7 | 8344 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
f5fcc13c TI |
8345 | [ALC883_AUTO] = "auto", |
8346 | }; | |
8347 | ||
8348 | static struct snd_pci_quirk alc883_cfg_tbl[] = { | |
8349 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), | |
ac3e3741 TI |
8350 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
8351 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | |
8352 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | |
0b18cb18 | 8353 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
ac3e3741 | 8354 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
5795b9e6 | 8355 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
febe3375 | 8356 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
ac3e3741 TI |
8357 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
8358 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | |
5d85f8d0 | 8359 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
a01c30cb | 8360 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
ac3e3741 | 8361 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
e2757d5e | 8362 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
97ec710c | 8363 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
f5fcc13c | 8364 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
ac3e3741 TI |
8365 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
8366 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | |
e2757d5e | 8367 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
ac3e3741 | 8368 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
57b14f24 | 8369 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
6f3bf657 | 8370 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
bba8dee7 | 8371 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 8372 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
4383fae0 | 8373 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
dd146a60 | 8374 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
82808236 | 8375 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
f5fcc13c | 8376 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 8377 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
8378 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
8379 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 | 8380 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
64ca1c29 | 8381 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
f5fcc13c TI |
8382 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
8383 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | |
8384 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | |
ac3e3741 TI |
8385 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
8386 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | |
8387 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | |
86d34b7e | 8388 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
ac3e3741 TI |
8389 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
8390 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | |
f5fcc13c | 8391 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
ac3e3741 | 8392 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
0c4cc443 HRK |
8393 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
8394 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | |
ac3e3741 | 8395 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
e60623b4 | 8396 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
f5fcc13c | 8397 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
fb97dc67 | 8398 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
272a527c | 8399 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
272a527c | 8400 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
ac3e3741 TI |
8401 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
8402 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | |
e2757d5e | 8403 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
272a527c | 8404 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
0b167bf4 | 8405 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
189609ae | 8406 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
17bba1b7 J |
8407 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
8408 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | |
ac3e3741 | 8409 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
9c7f852e TI |
8410 | {} |
8411 | }; | |
8412 | ||
8413 | static struct alc_config_preset alc883_presets[] = { | |
8414 | [ALC883_3ST_2ch_DIG] = { | |
8415 | .mixers = { alc883_3ST_2ch_mixer }, | |
8416 | .init_verbs = { alc883_init_verbs }, | |
8417 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8418 | .dac_nids = alc883_dac_nids, | |
8419 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
8420 | .dig_in_nid = ALC883_DIGIN_NID, |
8421 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8422 | .channel_mode = alc883_3ST_2ch_modes, | |
8423 | .input_mux = &alc883_capture_source, | |
8424 | }, | |
8425 | [ALC883_3ST_6ch_DIG] = { | |
8426 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8427 | .init_verbs = { alc883_init_verbs }, | |
8428 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8429 | .dac_nids = alc883_dac_nids, | |
8430 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
8431 | .dig_in_nid = ALC883_DIGIN_NID, |
8432 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
8433 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 8434 | .need_dac_fix = 1, |
9c7f852e | 8435 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 8436 | }, |
9c7f852e TI |
8437 | [ALC883_3ST_6ch] = { |
8438 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8439 | .init_verbs = { alc883_init_verbs }, | |
8440 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8441 | .dac_nids = alc883_dac_nids, | |
9c7f852e TI |
8442 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
8443 | .channel_mode = alc883_3ST_6ch_modes, | |
4e195a7b | 8444 | .need_dac_fix = 1, |
9c7f852e | 8445 | .input_mux = &alc883_capture_source, |
f12ab1e0 | 8446 | }, |
17bba1b7 J |
8447 | [ALC883_3ST_6ch_INTEL] = { |
8448 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | |
8449 | .init_verbs = { alc883_init_verbs }, | |
8450 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8451 | .dac_nids = alc883_dac_nids, | |
8452 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8453 | .dig_in_nid = ALC883_DIGIN_NID, | |
8454 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), | |
8455 | .channel_mode = alc883_3ST_6ch_intel_modes, | |
8456 | .need_dac_fix = 1, | |
8457 | .input_mux = &alc883_3stack_6ch_intel, | |
8458 | }, | |
9c7f852e TI |
8459 | [ALC883_6ST_DIG] = { |
8460 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | |
8461 | .init_verbs = { alc883_init_verbs }, | |
8462 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8463 | .dac_nids = alc883_dac_nids, | |
8464 | .dig_out_nid = ALC883_DIGOUT_NID, | |
9c7f852e TI |
8465 | .dig_in_nid = ALC883_DIGIN_NID, |
8466 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
8467 | .channel_mode = alc883_sixstack_modes, | |
8468 | .input_mux = &alc883_capture_source, | |
8469 | }, | |
ccc656ce KY |
8470 | [ALC883_TARGA_DIG] = { |
8471 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, | |
8472 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, | |
8473 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8474 | .dac_nids = alc883_dac_nids, | |
8475 | .dig_out_nid = ALC883_DIGOUT_NID, | |
ccc656ce KY |
8476 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
8477 | .channel_mode = alc883_3ST_6ch_modes, | |
8478 | .need_dac_fix = 1, | |
8479 | .input_mux = &alc883_capture_source, | |
8480 | .unsol_event = alc883_tagra_unsol_event, | |
8481 | .init_hook = alc883_tagra_automute, | |
8482 | }, | |
8483 | [ALC883_TARGA_2ch_DIG] = { | |
8484 | .mixers = { alc883_tagra_2ch_mixer}, | |
8485 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, | |
8486 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8487 | .dac_nids = alc883_dac_nids, | |
8488 | .dig_out_nid = ALC883_DIGOUT_NID, | |
ccc656ce KY |
8489 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8490 | .channel_mode = alc883_3ST_2ch_modes, | |
8491 | .input_mux = &alc883_capture_source, | |
8492 | .unsol_event = alc883_tagra_unsol_event, | |
8493 | .init_hook = alc883_tagra_automute, | |
8494 | }, | |
bab282b9 | 8495 | [ALC883_ACER] = { |
676a9b53 | 8496 | .mixers = { alc883_base_mixer }, |
bab282b9 VA |
8497 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
8498 | * and the headphone jack. Turn this on and rely on the | |
8499 | * standard mute methods whenever the user wants to turn | |
8500 | * these outputs off. | |
8501 | */ | |
8502 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | |
8503 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8504 | .dac_nids = alc883_dac_nids, | |
bab282b9 VA |
8505 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8506 | .channel_mode = alc883_3ST_2ch_modes, | |
8507 | .input_mux = &alc883_capture_source, | |
8508 | }, | |
2880a867 | 8509 | [ALC883_ACER_ASPIRE] = { |
676a9b53 | 8510 | .mixers = { alc883_acer_aspire_mixer }, |
d1a991a6 | 8511 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
2880a867 TD |
8512 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8513 | .dac_nids = alc883_dac_nids, | |
8514 | .dig_out_nid = ALC883_DIGOUT_NID, | |
2880a867 TD |
8515 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8516 | .channel_mode = alc883_3ST_2ch_modes, | |
8517 | .input_mux = &alc883_capture_source, | |
676a9b53 TI |
8518 | .unsol_event = alc883_acer_aspire_unsol_event, |
8519 | .init_hook = alc883_acer_aspire_automute, | |
d1a991a6 | 8520 | }, |
c07584c8 TD |
8521 | [ALC883_MEDION] = { |
8522 | .mixers = { alc883_fivestack_mixer, | |
8523 | alc883_chmode_mixer }, | |
8524 | .init_verbs = { alc883_init_verbs, | |
b373bdeb | 8525 | alc883_medion_eapd_verbs }, |
c07584c8 TD |
8526 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8527 | .dac_nids = alc883_dac_nids, | |
c07584c8 TD |
8528 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
8529 | .channel_mode = alc883_sixstack_modes, | |
8530 | .input_mux = &alc883_capture_source, | |
b373bdeb | 8531 | }, |
272a527c KY |
8532 | [ALC883_MEDION_MD2] = { |
8533 | .mixers = { alc883_medion_md2_mixer}, | |
8534 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, | |
8535 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8536 | .dac_nids = alc883_dac_nids, | |
8537 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
8538 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8539 | .channel_mode = alc883_3ST_2ch_modes, | |
8540 | .input_mux = &alc883_capture_source, | |
8541 | .unsol_event = alc883_medion_md2_unsol_event, | |
8542 | .init_hook = alc883_medion_md2_automute, | |
ea1fb29a | 8543 | }, |
b373bdeb | 8544 | [ALC883_LAPTOP_EAPD] = { |
676a9b53 | 8545 | .mixers = { alc883_base_mixer }, |
b373bdeb AN |
8546 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
8547 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8548 | .dac_nids = alc883_dac_nids, | |
b373bdeb AN |
8549 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8550 | .channel_mode = alc883_3ST_2ch_modes, | |
8551 | .input_mux = &alc883_capture_source, | |
8552 | }, | |
0c4cc443 HRK |
8553 | [ALC883_CLEVO_M720] = { |
8554 | .mixers = { alc883_clevo_m720_mixer }, | |
8555 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | |
368c7a95 J |
8556 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8557 | .dac_nids = alc883_dac_nids, | |
8558 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8559 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8560 | .channel_mode = alc883_3ST_2ch_modes, | |
8561 | .input_mux = &alc883_capture_source, | |
0c4cc443 HRK |
8562 | .unsol_event = alc883_clevo_m720_unsol_event, |
8563 | .init_hook = alc883_clevo_m720_automute, | |
368c7a95 | 8564 | }, |
bc9f98a9 KY |
8565 | [ALC883_LENOVO_101E_2ch] = { |
8566 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | |
8567 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | |
8568 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8569 | .dac_nids = alc883_dac_nids, | |
bc9f98a9 KY |
8570 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8571 | .channel_mode = alc883_3ST_2ch_modes, | |
8572 | .input_mux = &alc883_lenovo_101e_capture_source, | |
8573 | .unsol_event = alc883_lenovo_101e_unsol_event, | |
8574 | .init_hook = alc883_lenovo_101e_all_automute, | |
8575 | }, | |
272a527c KY |
8576 | [ALC883_LENOVO_NB0763] = { |
8577 | .mixers = { alc883_lenovo_nb0763_mixer }, | |
8578 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | |
8579 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8580 | .dac_nids = alc883_dac_nids, | |
272a527c KY |
8581 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8582 | .channel_mode = alc883_3ST_2ch_modes, | |
8583 | .need_dac_fix = 1, | |
8584 | .input_mux = &alc883_lenovo_nb0763_capture_source, | |
8585 | .unsol_event = alc883_medion_md2_unsol_event, | |
8586 | .init_hook = alc883_medion_md2_automute, | |
8587 | }, | |
8588 | [ALC888_LENOVO_MS7195_DIG] = { | |
8589 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8590 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | |
8591 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8592 | .dac_nids = alc883_dac_nids, | |
8593 | .dig_out_nid = ALC883_DIGOUT_NID, | |
272a527c KY |
8594 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
8595 | .channel_mode = alc883_3ST_6ch_modes, | |
8596 | .need_dac_fix = 1, | |
8597 | .input_mux = &alc883_capture_source, | |
8598 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | |
8599 | .init_hook = alc888_lenovo_ms7195_front_automute, | |
189609ae KY |
8600 | }, |
8601 | [ALC883_HAIER_W66] = { | |
8602 | .mixers = { alc883_tagra_2ch_mixer}, | |
8603 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, | |
8604 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8605 | .dac_nids = alc883_dac_nids, | |
8606 | .dig_out_nid = ALC883_DIGOUT_NID, | |
189609ae KY |
8607 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8608 | .channel_mode = alc883_3ST_2ch_modes, | |
8609 | .input_mux = &alc883_capture_source, | |
8610 | .unsol_event = alc883_haier_w66_unsol_event, | |
8611 | .init_hook = alc883_haier_w66_automute, | |
eea6419e | 8612 | }, |
4723c022 | 8613 | [ALC888_3ST_HP] = { |
eea6419e | 8614 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
4723c022 | 8615 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
8341de60 CM |
8616 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
8617 | .dac_nids = alc883_dac_nids, | |
4723c022 CM |
8618 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
8619 | .channel_mode = alc888_3st_hp_modes, | |
8341de60 CM |
8620 | .need_dac_fix = 1, |
8621 | .input_mux = &alc883_capture_source, | |
8622 | }, | |
5795b9e6 | 8623 | [ALC888_6ST_DELL] = { |
f24dbdc6 | 8624 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
5795b9e6 CM |
8625 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
8626 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8627 | .dac_nids = alc883_dac_nids, | |
8628 | .dig_out_nid = ALC883_DIGOUT_NID, | |
5795b9e6 CM |
8629 | .dig_in_nid = ALC883_DIGIN_NID, |
8630 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
8631 | .channel_mode = alc883_sixstack_modes, | |
8632 | .input_mux = &alc883_capture_source, | |
8633 | .unsol_event = alc888_6st_dell_unsol_event, | |
8634 | .init_hook = alc888_6st_dell_front_automute, | |
8635 | }, | |
a8848bd6 AS |
8636 | [ALC883_MITAC] = { |
8637 | .mixers = { alc883_mitac_mixer }, | |
8638 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | |
8639 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8640 | .dac_nids = alc883_dac_nids, | |
a8848bd6 AS |
8641 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
8642 | .channel_mode = alc883_3ST_2ch_modes, | |
8643 | .input_mux = &alc883_capture_source, | |
8644 | .unsol_event = alc883_mitac_unsol_event, | |
8645 | .init_hook = alc883_mitac_automute, | |
8646 | }, | |
fb97dc67 J |
8647 | [ALC883_FUJITSU_PI2515] = { |
8648 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | |
8649 | .init_verbs = { alc883_init_verbs, | |
8650 | alc883_2ch_fujitsu_pi2515_verbs}, | |
8651 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8652 | .dac_nids = alc883_dac_nids, | |
8653 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8654 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8655 | .channel_mode = alc883_3ST_2ch_modes, | |
8656 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
8657 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, | |
8658 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, | |
8659 | }, | |
e2757d5e KY |
8660 | [ALC888_LENOVO_SKY] = { |
8661 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | |
8662 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | |
8663 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8664 | .dac_nids = alc883_dac_nids, | |
8665 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8666 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | |
8667 | .adc_nids = alc883_adc_nids, | |
8668 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | |
8669 | .channel_mode = alc883_sixstack_modes, | |
8670 | .need_dac_fix = 1, | |
8671 | .input_mux = &alc883_lenovo_sky_capture_source, | |
8672 | .unsol_event = alc883_lenovo_sky_unsol_event, | |
8673 | .init_hook = alc888_lenovo_sky_front_automute, | |
8674 | }, | |
8675 | [ALC888_ASUS_M90V] = { | |
8676 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | |
8677 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | |
8678 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8679 | .dac_nids = alc883_dac_nids, | |
8680 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8681 | .dig_in_nid = ALC883_DIGIN_NID, | |
8682 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | |
8683 | .channel_mode = alc883_3ST_6ch_modes, | |
8684 | .need_dac_fix = 1, | |
8685 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | |
8686 | .unsol_event = alc883_mode2_unsol_event, | |
8687 | .init_hook = alc883_mode2_inithook, | |
8688 | }, | |
8689 | [ALC888_ASUS_EEE1601] = { | |
8690 | .mixers = { alc883_asus_eee1601_mixer }, | |
8691 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, | |
8692 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | |
8693 | .dac_nids = alc883_dac_nids, | |
8694 | .dig_out_nid = ALC883_DIGOUT_NID, | |
8695 | .dig_in_nid = ALC883_DIGIN_NID, | |
8696 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
8697 | .channel_mode = alc883_3ST_2ch_modes, | |
8698 | .need_dac_fix = 1, | |
8699 | .input_mux = &alc883_asus_eee1601_capture_source, | |
8700 | .unsol_event = alc883_eee1601_unsol_event, | |
8701 | .init_hook = alc883_eee1601_inithook, | |
8702 | }, | |
9c7f852e TI |
8703 | }; |
8704 | ||
8705 | ||
8706 | /* | |
8707 | * BIOS auto configuration | |
8708 | */ | |
8709 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | |
8710 | hda_nid_t nid, int pin_type, | |
8711 | int dac_idx) | |
8712 | { | |
8713 | /* set as output */ | |
8714 | struct alc_spec *spec = codec->spec; | |
f12ab1e0 TI |
8715 | int idx; |
8716 | ||
f6c7e546 | 8717 | alc_set_pin_output(codec, nid, pin_type); |
9c7f852e TI |
8718 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
8719 | idx = 4; | |
8720 | else | |
8721 | idx = spec->multiout.dac_nids[dac_idx] - 2; | |
9c7f852e TI |
8722 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
8723 | ||
8724 | } | |
8725 | ||
8726 | static void alc883_auto_init_multi_out(struct hda_codec *codec) | |
8727 | { | |
8728 | struct alc_spec *spec = codec->spec; | |
8729 | int i; | |
8730 | ||
bc9f98a9 | 8731 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
9c7f852e | 8732 | for (i = 0; i <= HDA_SIDE; i++) { |
f12ab1e0 | 8733 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
baba8ee9 | 8734 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
9c7f852e | 8735 | if (nid) |
baba8ee9 | 8736 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 8737 | i); |
9c7f852e TI |
8738 | } |
8739 | } | |
8740 | ||
8741 | static void alc883_auto_init_hp_out(struct hda_codec *codec) | |
8742 | { | |
8743 | struct alc_spec *spec = codec->spec; | |
8744 | hda_nid_t pin; | |
8745 | ||
eb06ed8f | 8746 | pin = spec->autocfg.hp_pins[0]; |
9c7f852e TI |
8747 | if (pin) /* connect to front */ |
8748 | /* use dac 0 */ | |
8749 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
8750 | pin = spec->autocfg.speaker_pins[0]; |
8751 | if (pin) | |
8752 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
9c7f852e TI |
8753 | } |
8754 | ||
8755 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) | |
8756 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID | |
8757 | ||
8758 | static void alc883_auto_init_analog_input(struct hda_codec *codec) | |
8759 | { | |
8760 | struct alc_spec *spec = codec->spec; | |
8761 | int i; | |
8762 | ||
8763 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
8764 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
8765 | if (alc883_is_input_pin(nid)) { | |
8766 | snd_hda_codec_write(codec, nid, 0, | |
8767 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8768 | (i <= AUTO_PIN_FRONT_MIC ? | |
8769 | PIN_VREF80 : PIN_IN)); | |
8770 | if (nid != ALC883_PIN_CD_NID) | |
8771 | snd_hda_codec_write(codec, nid, 0, | |
8772 | AC_VERB_SET_AMP_GAIN_MUTE, | |
8773 | AMP_OUT_MUTE); | |
8774 | } | |
8775 | } | |
8776 | } | |
8777 | ||
f511b01c TI |
8778 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
8779 | ||
9c7f852e TI |
8780 | /* almost identical with ALC880 parser... */ |
8781 | static int alc883_parse_auto_config(struct hda_codec *codec) | |
8782 | { | |
8783 | struct alc_spec *spec = codec->spec; | |
8784 | int err = alc880_parse_auto_config(codec); | |
8785 | ||
8786 | if (err < 0) | |
8787 | return err; | |
776e184e TI |
8788 | else if (!err) |
8789 | return 0; /* no config found */ | |
8790 | ||
8791 | err = alc_auto_add_mic_boost(codec); | |
8792 | if (err < 0) | |
8793 | return err; | |
8794 | ||
8795 | /* hack - override the init verbs */ | |
8796 | spec->init_verbs[0] = alc883_auto_init_verbs; | |
d88897ea | 8797 | add_mixer(spec, alc883_capture_mixer); |
776e184e TI |
8798 | |
8799 | return 1; /* config found */ | |
9c7f852e TI |
8800 | } |
8801 | ||
8802 | /* additional initialization for auto-configuration model */ | |
8803 | static void alc883_auto_init(struct hda_codec *codec) | |
8804 | { | |
f6c7e546 | 8805 | struct alc_spec *spec = codec->spec; |
9c7f852e TI |
8806 | alc883_auto_init_multi_out(codec); |
8807 | alc883_auto_init_hp_out(codec); | |
8808 | alc883_auto_init_analog_input(codec); | |
f511b01c | 8809 | alc883_auto_init_input_src(codec); |
f6c7e546 | 8810 | if (spec->unsol_event) |
7fb0d78f | 8811 | alc_inithook(codec); |
9c7f852e TI |
8812 | } |
8813 | ||
8814 | static int patch_alc883(struct hda_codec *codec) | |
8815 | { | |
8816 | struct alc_spec *spec; | |
8817 | int err, board_config; | |
8818 | ||
8819 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
8820 | if (spec == NULL) | |
8821 | return -ENOMEM; | |
8822 | ||
8823 | codec->spec = spec; | |
8824 | ||
2c3bf9ab TI |
8825 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
8826 | ||
f5fcc13c TI |
8827 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
8828 | alc883_models, | |
8829 | alc883_cfg_tbl); | |
8830 | if (board_config < 0) { | |
9c7f852e TI |
8831 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
8832 | "trying auto-probe from BIOS...\n"); | |
8833 | board_config = ALC883_AUTO; | |
8834 | } | |
8835 | ||
8836 | if (board_config == ALC883_AUTO) { | |
8837 | /* automatic parse from the BIOS config */ | |
8838 | err = alc883_parse_auto_config(codec); | |
8839 | if (err < 0) { | |
8840 | alc_free(codec); | |
8841 | return err; | |
f12ab1e0 | 8842 | } else if (!err) { |
9c7f852e TI |
8843 | printk(KERN_INFO |
8844 | "hda_codec: Cannot set up configuration " | |
8845 | "from BIOS. Using base mode...\n"); | |
8846 | board_config = ALC883_3ST_2ch_DIG; | |
8847 | } | |
8848 | } | |
8849 | ||
8850 | if (board_config != ALC883_AUTO) | |
8851 | setup_preset(spec, &alc883_presets[board_config]); | |
8852 | ||
2f893286 KY |
8853 | switch (codec->vendor_id) { |
8854 | case 0x10ec0888: | |
4442608d KY |
8855 | if (codec->revision_id == 0x100101) { |
8856 | spec->stream_name_analog = "ALC1200 Analog"; | |
8857 | spec->stream_name_digital = "ALC1200 Digital"; | |
8858 | } else { | |
8859 | spec->stream_name_analog = "ALC888 Analog"; | |
8860 | spec->stream_name_digital = "ALC888 Digital"; | |
8861 | } | |
2f893286 KY |
8862 | break; |
8863 | case 0x10ec0889: | |
8864 | spec->stream_name_analog = "ALC889 Analog"; | |
8865 | spec->stream_name_digital = "ALC889 Digital"; | |
8866 | break; | |
8867 | default: | |
8868 | spec->stream_name_analog = "ALC883 Analog"; | |
8869 | spec->stream_name_digital = "ALC883 Digital"; | |
8870 | break; | |
8871 | } | |
8872 | ||
9c7f852e TI |
8873 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
8874 | spec->stream_analog_capture = &alc883_pcm_analog_capture; | |
6330079f | 8875 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
9c7f852e | 8876 | |
9c7f852e TI |
8877 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
8878 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | |
8879 | ||
e1406348 TI |
8880 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
8881 | spec->adc_nids = alc883_adc_nids; | |
8882 | spec->capsrc_nids = alc883_capsrc_nids; | |
54cbc9ab | 8883 | spec->is_mix_capture = 1; /* matrix-style capture */ |
9c7f852e | 8884 | |
2134ea4f TI |
8885 | spec->vmaster_nid = 0x0c; |
8886 | ||
9c7f852e TI |
8887 | codec->patch_ops = alc_patch_ops; |
8888 | if (board_config == ALC883_AUTO) | |
8889 | spec->init_hook = alc883_auto_init; | |
f9423e7a | 8890 | |
cb53c626 TI |
8891 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
8892 | if (!spec->loopback.amplist) | |
8893 | spec->loopback.amplist = alc883_loopbacks; | |
8894 | #endif | |
9c7f852e TI |
8895 | |
8896 | return 0; | |
8897 | } | |
8898 | ||
8899 | /* | |
8900 | * ALC262 support | |
8901 | */ | |
8902 | ||
8903 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | |
8904 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | |
8905 | ||
8906 | #define alc262_dac_nids alc260_dac_nids | |
8907 | #define alc262_adc_nids alc882_adc_nids | |
8908 | #define alc262_adc_nids_alt alc882_adc_nids_alt | |
88c71a99 TI |
8909 | #define alc262_capsrc_nids alc882_capsrc_nids |
8910 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | |
9c7f852e TI |
8911 | |
8912 | #define alc262_modes alc260_modes | |
8913 | #define alc262_capture_source alc882_capture_source | |
8914 | ||
4e555fe5 KY |
8915 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
8916 | /* ADC0 */ | |
8917 | 0x09 | |
8918 | }; | |
8919 | ||
8920 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | |
8921 | ||
9c7f852e TI |
8922 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
8923 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8924 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8925 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8926 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8927 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8928 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8931 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
8932 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8933 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 8934 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e | 8935 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
31bffaa9 | 8936 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
9c7f852e TI |
8937 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
8938 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
8939 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | |
8940 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
8941 | { } /* end */ | |
8942 | }; | |
8943 | ||
ccc656ce KY |
8944 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
8945 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
8946 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
8948 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
8949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
8950 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
8951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
8952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 8953 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
ccc656ce KY |
8954 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8955 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 8956 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
ccc656ce | 8957 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
31bffaa9 | 8958 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
ccc656ce KY |
8959 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
8960 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
8961 | { } /* end */ | |
8962 | }; | |
8963 | ||
ce875f07 TI |
8964 | /* update HP, line and mono-out pins according to the master switch */ |
8965 | static void alc262_hp_master_update(struct hda_codec *codec) | |
8966 | { | |
8967 | struct alc_spec *spec = codec->spec; | |
8968 | int val = spec->master_sw; | |
8969 | ||
8970 | /* HP & line-out */ | |
8971 | snd_hda_codec_write_cache(codec, 0x1b, 0, | |
8972 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8973 | val ? PIN_HP : 0); | |
8974 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
8975 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8976 | val ? PIN_HP : 0); | |
8977 | /* mono (speaker) depending on the HP jack sense */ | |
8978 | val = val && !spec->jack_present; | |
8979 | snd_hda_codec_write_cache(codec, 0x16, 0, | |
8980 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
8981 | val ? PIN_OUT : 0); | |
8982 | } | |
8983 | ||
8984 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | |
8985 | { | |
8986 | struct alc_spec *spec = codec->spec; | |
8987 | unsigned int presence; | |
8988 | presence = snd_hda_codec_read(codec, 0x1b, 0, | |
8989 | AC_VERB_GET_PIN_SENSE, 0); | |
8990 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); | |
8991 | alc262_hp_master_update(codec); | |
8992 | } | |
8993 | ||
8994 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | |
8995 | { | |
8996 | if ((res >> 26) != ALC880_HP_EVENT) | |
8997 | return; | |
8998 | alc262_hp_bpc_automute(codec); | |
8999 | } | |
9000 | ||
9001 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | |
9002 | { | |
9003 | struct alc_spec *spec = codec->spec; | |
9004 | unsigned int presence; | |
9005 | presence = snd_hda_codec_read(codec, 0x15, 0, | |
9006 | AC_VERB_GET_PIN_SENSE, 0); | |
9007 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); | |
9008 | alc262_hp_master_update(codec); | |
9009 | } | |
9010 | ||
9011 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | |
9012 | unsigned int res) | |
9013 | { | |
9014 | if ((res >> 26) != ALC880_HP_EVENT) | |
9015 | return; | |
9016 | alc262_hp_wildwest_automute(codec); | |
9017 | } | |
9018 | ||
9019 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, | |
9020 | struct snd_ctl_elem_value *ucontrol) | |
9021 | { | |
9022 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9023 | struct alc_spec *spec = codec->spec; | |
9024 | *ucontrol->value.integer.value = spec->master_sw; | |
9025 | return 0; | |
9026 | } | |
9027 | ||
9028 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |
9029 | struct snd_ctl_elem_value *ucontrol) | |
9030 | { | |
9031 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9032 | struct alc_spec *spec = codec->spec; | |
9033 | int val = !!*ucontrol->value.integer.value; | |
9034 | ||
9035 | if (val == spec->master_sw) | |
9036 | return 0; | |
9037 | spec->master_sw = val; | |
9038 | alc262_hp_master_update(codec); | |
9039 | return 1; | |
9040 | } | |
9041 | ||
9c7f852e | 9042 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
ce875f07 TI |
9043 | { |
9044 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9045 | .name = "Master Playback Switch", | |
9046 | .info = snd_ctl_boolean_mono_info, | |
9047 | .get = alc262_hp_master_sw_get, | |
9048 | .put = alc262_hp_master_sw_put, | |
9049 | }, | |
9c7f852e TI |
9050 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9051 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9052 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
9053 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
9054 | HDA_OUTPUT), | |
9055 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
9056 | HDA_OUTPUT), | |
9c7f852e TI |
9057 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
9058 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 9059 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9c7f852e TI |
9060 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9061 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
cc69d12d | 9062 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9c7f852e TI |
9063 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
9064 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
9065 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9066 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9067 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
9068 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
9069 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | |
9070 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | |
9071 | { } /* end */ | |
9072 | }; | |
9073 | ||
cd7509a4 | 9074 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
ce875f07 TI |
9075 | { |
9076 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9077 | .name = "Master Playback Switch", | |
9078 | .info = snd_ctl_boolean_mono_info, | |
9079 | .get = alc262_hp_master_sw_get, | |
9080 | .put = alc262_hp_master_sw_put, | |
9081 | }, | |
cd7509a4 KY |
9082 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9083 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
9084 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
9085 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
ce875f07 TI |
9086 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
9087 | HDA_OUTPUT), | |
9088 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | |
9089 | HDA_OUTPUT), | |
cd7509a4 KY |
9090 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
9091 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
cc69d12d | 9092 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
cd7509a4 KY |
9093 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9094 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9095 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9096 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9097 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
9098 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
9099 | { } /* end */ | |
9100 | }; | |
9101 | ||
9102 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |
9103 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9104 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
cc69d12d | 9105 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
cd7509a4 KY |
9106 | { } /* end */ |
9107 | }; | |
9108 | ||
66d2a9d6 KY |
9109 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
9110 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) | |
9111 | { | |
9112 | struct alc_spec *spec = codec->spec; | |
66d2a9d6 KY |
9113 | |
9114 | if (force || !spec->sense_updated) { | |
9115 | unsigned int present; | |
9116 | present = snd_hda_codec_read(codec, 0x15, 0, | |
9117 | AC_VERB_GET_PIN_SENSE, 0); | |
4bb26130 | 9118 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
66d2a9d6 KY |
9119 | spec->sense_updated = 1; |
9120 | } | |
4bb26130 TI |
9121 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
9122 | spec->jack_present ? HDA_AMP_MUTE : 0); | |
66d2a9d6 KY |
9123 | } |
9124 | ||
9125 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, | |
9126 | unsigned int res) | |
9127 | { | |
9128 | if ((res >> 26) != ALC880_HP_EVENT) | |
9129 | return; | |
9130 | alc262_hp_t5735_automute(codec, 1); | |
9131 | } | |
9132 | ||
9133 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) | |
9134 | { | |
9135 | alc262_hp_t5735_automute(codec, 1); | |
9136 | } | |
9137 | ||
9138 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | |
86cd9298 TI |
9139 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9140 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
66d2a9d6 KY |
9141 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
9142 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9144 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9145 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9146 | { } /* end */ | |
9147 | }; | |
9148 | ||
9149 | static struct hda_verb alc262_hp_t5735_verbs[] = { | |
9150 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9151 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9152 | ||
9153 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
9154 | { } | |
9155 | }; | |
9156 | ||
8c427226 | 9157 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
f2f48e18 TI |
9158 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9159 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
86cd9298 TI |
9160 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
9161 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | |
8c427226 KY |
9162 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9163 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9164 | { } /* end */ | |
9165 | }; | |
9166 | ||
9167 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | |
9168 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9169 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9170 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9171 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9172 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
9173 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9174 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
9175 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
9176 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
9177 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | |
9178 | {} | |
9179 | }; | |
9180 | ||
9181 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | |
9182 | .num_items = 1, | |
9183 | .items = { | |
9184 | { "Line", 0x1 }, | |
9185 | }, | |
9186 | }; | |
9187 | ||
0724ea2a TI |
9188 | /* bind hp and internal speaker mute (with plug check) */ |
9189 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, | |
9190 | struct snd_ctl_elem_value *ucontrol) | |
9191 | { | |
9192 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9193 | long *valp = ucontrol->value.integer.value; | |
9194 | int change; | |
9195 | ||
9196 | /* change hp mute */ | |
9197 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, | |
9198 | HDA_AMP_MUTE, | |
9199 | valp[0] ? 0 : HDA_AMP_MUTE); | |
9200 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, | |
9201 | HDA_AMP_MUTE, | |
9202 | valp[1] ? 0 : HDA_AMP_MUTE); | |
9203 | if (change) { | |
9204 | /* change speaker according to HP jack state */ | |
9205 | struct alc_spec *spec = codec->spec; | |
9206 | unsigned int mute; | |
9207 | if (spec->jack_present) | |
9208 | mute = HDA_AMP_MUTE; | |
9209 | else | |
9210 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, | |
9211 | HDA_OUTPUT, 0); | |
9212 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9213 | HDA_AMP_MUTE, mute); | |
9214 | } | |
9215 | return change; | |
9216 | } | |
5b31954e | 9217 | |
272a527c | 9218 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
0724ea2a TI |
9219 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9220 | { | |
9221 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9222 | .name = "Master Playback Switch", | |
9223 | .info = snd_hda_mixer_amp_switch_info, | |
9224 | .get = snd_hda_mixer_amp_switch_get, | |
9225 | .put = alc262_sony_master_sw_put, | |
9226 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
9227 | }, | |
272a527c KY |
9228 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
9229 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9230 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
9231 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9232 | { } /* end */ | |
9233 | }; | |
9234 | ||
83c34218 KY |
9235 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
9236 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9237 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9238 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9239 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9240 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9241 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
9242 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9243 | { } /* end */ | |
9244 | }; | |
272a527c | 9245 | |
9c7f852e TI |
9246 | #define alc262_capture_mixer alc882_capture_mixer |
9247 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | |
9248 | ||
9249 | /* | |
9250 | * generic initialization of ADC, input mixers and output mixers | |
9251 | */ | |
9252 | static struct hda_verb alc262_init_verbs[] = { | |
9253 | /* | |
9254 | * Unmute ADC0-2 and set the default input to mic-in | |
9255 | */ | |
9256 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9257 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9258 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9259 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9260 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9261 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9262 | ||
cb53c626 | 9263 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 9264 | * mixer widget |
f12ab1e0 TI |
9265 | * Note: PASD motherboards uses the Line In 2 as the input for |
9266 | * front panel mic (mic 2) | |
9c7f852e TI |
9267 | */ |
9268 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
9269 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
9270 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9271 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9272 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9273 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9c7f852e TI |
9274 | |
9275 | /* | |
df694daa KY |
9276 | * Set up output mixers (0x0c - 0x0e) |
9277 | */ | |
9278 | /* set vol=0 to output mixers */ | |
9279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9280 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9281 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9282 | /* set up input amps for analog loopback */ | |
9283 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
9284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9285 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9286 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9287 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9288 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9289 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9290 | ||
9291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
9292 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
9293 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
9294 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9295 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9296 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
9297 | ||
9298 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9299 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9300 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9301 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9302 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
ea1fb29a | 9303 | |
df694daa KY |
9304 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
9305 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
ea1fb29a | 9306 | |
df694daa KY |
9307 | /* FIXME: use matrix-type input source selection */ |
9308 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
9309 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
9310 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9311 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9312 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9313 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9314 | /* Input mixer2 */ | |
9315 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9316 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9317 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
9318 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
9319 | /* Input mixer3 */ | |
9320 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
9321 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
9322 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
f12ab1e0 | 9323 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
df694daa KY |
9324 | |
9325 | { } | |
9326 | }; | |
1da177e4 | 9327 | |
4e555fe5 KY |
9328 | static struct hda_verb alc262_eapd_verbs[] = { |
9329 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
9330 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
9331 | { } | |
9332 | }; | |
9333 | ||
ccc656ce KY |
9334 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
9335 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9337 | {} | |
9338 | }; | |
9339 | ||
9340 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | |
9341 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
9342 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9343 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | |
9344 | ||
9345 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9346 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9347 | {} | |
9348 | }; | |
9349 | ||
272a527c KY |
9350 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
9351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
9352 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9353 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | |
9354 | ||
9355 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9356 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
7b1e8795 | 9357 | {} |
272a527c KY |
9358 | }; |
9359 | ||
4e555fe5 KY |
9360 | static struct hda_input_mux alc262_dmic_capture_source = { |
9361 | .num_items = 2, | |
9362 | .items = { | |
9363 | { "Int DMic", 0x9 }, | |
9364 | { "Mic", 0x0 }, | |
9365 | }, | |
9366 | }; | |
9367 | ||
9368 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | |
9369 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | |
9370 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
9371 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9372 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9373 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9374 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
9375 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
9376 | { | |
9377 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9378 | /* The multiple "Capture Source" controls confuse alsamixer | |
9379 | * So call somewhat different.. | |
9380 | */ | |
9381 | /* .name = "Capture Source", */ | |
9382 | .name = "Input Source", | |
9383 | .count = 1, | |
9384 | .info = alc_mux_enum_info, | |
9385 | .get = alc_mux_enum_get, | |
9386 | .put = alc_mux_enum_put, | |
9387 | }, | |
9388 | { } /* end */ | |
9389 | }; | |
9390 | ||
9391 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | |
9392 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
9393 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9394 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9395 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9396 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | |
9397 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9398 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
9399 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9400 | {} | |
9401 | }; | |
9402 | ||
9403 | static void alc262_dmic_automute(struct hda_codec *codec) | |
9404 | { | |
9405 | unsigned int present; | |
9406 | ||
9407 | present = snd_hda_codec_read(codec, 0x18, 0, | |
9408 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
9409 | snd_hda_codec_write(codec, 0x22, 0, | |
9410 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); | |
9411 | } | |
9412 | ||
9413 | /* toggle speaker-output according to the hp-jack state */ | |
9414 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) | |
9415 | { | |
9416 | unsigned int present; | |
9417 | unsigned char bits; | |
9418 | ||
9419 | present = snd_hda_codec_read(codec, 0x15, 0, | |
9420 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
9421 | bits = present ? 0 : PIN_OUT; | |
9422 | snd_hda_codec_write(codec, 0x14, 0, | |
9423 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
9424 | } | |
9425 | ||
9426 | ||
9427 | ||
9428 | /* unsolicited event for HP jack sensing */ | |
9429 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, | |
9430 | unsigned int res) | |
9431 | { | |
9432 | if ((res >> 26) == ALC880_HP_EVENT) | |
9433 | alc262_toshiba_s06_speaker_automute(codec); | |
9434 | if ((res >> 26) == ALC880_MIC_EVENT) | |
9435 | alc262_dmic_automute(codec); | |
9436 | ||
9437 | } | |
9438 | ||
9439 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) | |
9440 | { | |
9441 | alc262_toshiba_s06_speaker_automute(codec); | |
9442 | alc262_dmic_automute(codec); | |
9443 | } | |
9444 | ||
ccc656ce | 9445 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
5b31954e | 9446 | static void alc262_hippo_automute(struct hda_codec *codec) |
ccc656ce KY |
9447 | { |
9448 | struct alc_spec *spec = codec->spec; | |
9449 | unsigned int mute; | |
5b31954e | 9450 | unsigned int present; |
ccc656ce | 9451 | |
5b31954e TI |
9452 | /* need to execute and sync at first */ |
9453 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9454 | present = snd_hda_codec_read(codec, 0x15, 0, | |
9455 | AC_VERB_GET_PIN_SENSE, 0); | |
9456 | spec->jack_present = (present & 0x80000000) != 0; | |
ccc656ce KY |
9457 | if (spec->jack_present) { |
9458 | /* mute internal speaker */ | |
47fd830a TI |
9459 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9460 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
ccc656ce KY |
9461 | } else { |
9462 | /* unmute internal speaker if necessary */ | |
9463 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); | |
47fd830a TI |
9464 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9465 | HDA_AMP_MUTE, mute); | |
ccc656ce KY |
9466 | } |
9467 | } | |
9468 | ||
9469 | /* unsolicited event for HP jack sensing */ | |
9470 | static void alc262_hippo_unsol_event(struct hda_codec *codec, | |
9471 | unsigned int res) | |
9472 | { | |
9473 | if ((res >> 26) != ALC880_HP_EVENT) | |
9474 | return; | |
5b31954e | 9475 | alc262_hippo_automute(codec); |
ccc656ce KY |
9476 | } |
9477 | ||
5b31954e | 9478 | static void alc262_hippo1_automute(struct hda_codec *codec) |
ccc656ce | 9479 | { |
ccc656ce | 9480 | unsigned int mute; |
5b31954e | 9481 | unsigned int present; |
ccc656ce | 9482 | |
5b31954e TI |
9483 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
9484 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
9485 | AC_VERB_GET_PIN_SENSE, 0); | |
9486 | present = (present & 0x80000000) != 0; | |
9487 | if (present) { | |
ccc656ce | 9488 | /* mute internal speaker */ |
47fd830a TI |
9489 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9490 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
ccc656ce KY |
9491 | } else { |
9492 | /* unmute internal speaker if necessary */ | |
9493 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
47fd830a TI |
9494 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9495 | HDA_AMP_MUTE, mute); | |
ccc656ce KY |
9496 | } |
9497 | } | |
9498 | ||
9499 | /* unsolicited event for HP jack sensing */ | |
9500 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, | |
9501 | unsigned int res) | |
9502 | { | |
9503 | if ((res >> 26) != ALC880_HP_EVENT) | |
9504 | return; | |
5b31954e | 9505 | alc262_hippo1_automute(codec); |
ccc656ce KY |
9506 | } |
9507 | ||
e8f9ae2a PT |
9508 | /* |
9509 | * nec model | |
9510 | * 0x15 = headphone | |
9511 | * 0x16 = internal speaker | |
9512 | * 0x18 = external mic | |
9513 | */ | |
9514 | ||
9515 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | |
9516 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | |
9517 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | |
9518 | ||
9519 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9520 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9521 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9522 | ||
9523 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | |
9524 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
9525 | { } /* end */ | |
9526 | }; | |
9527 | ||
9528 | static struct hda_verb alc262_nec_verbs[] = { | |
9529 | /* Unmute Speaker */ | |
9530 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
9531 | ||
9532 | /* Headphone */ | |
9533 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9534 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9535 | ||
9536 | /* External mic to headphone */ | |
9537 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9538 | /* External mic to speaker */ | |
9539 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9540 | {} | |
9541 | }; | |
9542 | ||
834be88d TI |
9543 | /* |
9544 | * fujitsu model | |
5d9fab2d TV |
9545 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
9546 | * 0x1b = port replicator headphone out | |
834be88d TI |
9547 | */ |
9548 | ||
9549 | #define ALC_HP_EVENT 0x37 | |
9550 | ||
9551 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | |
9552 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
9553 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
5d9fab2d TV |
9554 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
9555 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
834be88d TI |
9556 | {} |
9557 | }; | |
9558 | ||
0e31daf7 J |
9559 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
9560 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | |
9561 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
9562 | {} | |
9563 | }; | |
9564 | ||
834be88d | 9565 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
39d3ed38 | 9566 | .num_items = 3, |
834be88d TI |
9567 | .items = { |
9568 | { "Mic", 0x0 }, | |
39d3ed38 | 9569 | { "Int Mic", 0x1 }, |
834be88d TI |
9570 | { "CD", 0x4 }, |
9571 | }, | |
9572 | }; | |
9573 | ||
9c7f852e TI |
9574 | static struct hda_input_mux alc262_HP_capture_source = { |
9575 | .num_items = 5, | |
9576 | .items = { | |
9577 | { "Mic", 0x0 }, | |
accbe498 | 9578 | { "Front Mic", 0x1 }, |
9c7f852e TI |
9579 | { "Line", 0x2 }, |
9580 | { "CD", 0x4 }, | |
9581 | { "AUX IN", 0x6 }, | |
9582 | }, | |
9583 | }; | |
9584 | ||
accbe498 | 9585 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
9586 | .num_items = 4, | |
9587 | .items = { | |
9588 | { "Mic", 0x0 }, | |
9589 | { "Front Mic", 0x2 }, | |
9590 | { "Line", 0x1 }, | |
9591 | { "CD", 0x4 }, | |
9592 | }, | |
9593 | }; | |
9594 | ||
ebc7a406 | 9595 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
834be88d TI |
9596 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
9597 | { | |
9598 | struct alc_spec *spec = codec->spec; | |
9599 | unsigned int mute; | |
9600 | ||
f12ab1e0 | 9601 | if (force || !spec->sense_updated) { |
ebc7a406 | 9602 | unsigned int present; |
834be88d TI |
9603 | /* need to execute and sync at first */ |
9604 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); | |
ebc7a406 TI |
9605 | /* check laptop HP jack */ |
9606 | present = snd_hda_codec_read(codec, 0x14, 0, | |
9607 | AC_VERB_GET_PIN_SENSE, 0); | |
9608 | /* need to execute and sync at first */ | |
9609 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9610 | /* check docking HP jack */ | |
9611 | present |= snd_hda_codec_read(codec, 0x1b, 0, | |
9612 | AC_VERB_GET_PIN_SENSE, 0); | |
9613 | if (present & AC_PINSENSE_PRESENCE) | |
9614 | spec->jack_present = 1; | |
9615 | else | |
9616 | spec->jack_present = 0; | |
834be88d TI |
9617 | spec->sense_updated = 1; |
9618 | } | |
ebc7a406 TI |
9619 | /* unmute internal speaker only if both HPs are unplugged and |
9620 | * master switch is on | |
9621 | */ | |
9622 | if (spec->jack_present) | |
9623 | mute = HDA_AMP_MUTE; | |
9624 | else | |
834be88d | 9625 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
ebc7a406 TI |
9626 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
9627 | HDA_AMP_MUTE, mute); | |
834be88d TI |
9628 | } |
9629 | ||
9630 | /* unsolicited event for HP jack sensing */ | |
9631 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | |
9632 | unsigned int res) | |
9633 | { | |
9634 | if ((res >> 26) != ALC_HP_EVENT) | |
9635 | return; | |
9636 | alc262_fujitsu_automute(codec, 1); | |
9637 | } | |
9638 | ||
ebc7a406 TI |
9639 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
9640 | { | |
9641 | alc262_fujitsu_automute(codec, 1); | |
9642 | } | |
9643 | ||
834be88d | 9644 | /* bind volumes of both NID 0x0c and 0x0d */ |
cca3b371 TI |
9645 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
9646 | .ops = &snd_hda_bind_vol, | |
9647 | .values = { | |
9648 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | |
9649 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | |
9650 | 0 | |
9651 | }, | |
9652 | }; | |
834be88d | 9653 | |
0e31daf7 J |
9654 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
9655 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | |
9656 | { | |
9657 | struct alc_spec *spec = codec->spec; | |
9658 | unsigned int mute; | |
9659 | ||
9660 | if (force || !spec->sense_updated) { | |
9661 | unsigned int present_int_hp; | |
9662 | /* need to execute and sync at first */ | |
9663 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9664 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, | |
9665 | AC_VERB_GET_PIN_SENSE, 0); | |
9666 | spec->jack_present = (present_int_hp & 0x80000000) != 0; | |
9667 | spec->sense_updated = 1; | |
9668 | } | |
9669 | if (spec->jack_present) { | |
9670 | /* mute internal speaker */ | |
9671 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9672 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
9673 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9674 | HDA_AMP_MUTE, HDA_AMP_MUTE); | |
9675 | } else { | |
9676 | /* unmute internal speaker if necessary */ | |
9677 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | |
9678 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9679 | HDA_AMP_MUTE, mute); | |
9680 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | |
9681 | HDA_AMP_MUTE, mute); | |
9682 | } | |
9683 | } | |
9684 | ||
9685 | /* unsolicited event for HP jack sensing */ | |
9686 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | |
9687 | unsigned int res) | |
9688 | { | |
9689 | if ((res >> 26) != ALC_HP_EVENT) | |
9690 | return; | |
9691 | alc262_lenovo_3000_automute(codec, 1); | |
9692 | } | |
9693 | ||
834be88d TI |
9694 | /* bind hp and internal speaker mute (with plug check) */ |
9695 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |
9696 | struct snd_ctl_elem_value *ucontrol) | |
9697 | { | |
9698 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9699 | long *valp = ucontrol->value.integer.value; | |
9700 | int change; | |
9701 | ||
5d9fab2d TV |
9702 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
9703 | HDA_AMP_MUTE, | |
9704 | valp ? 0 : HDA_AMP_MUTE); | |
9705 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
9706 | HDA_AMP_MUTE, | |
9707 | valp ? 0 : HDA_AMP_MUTE); | |
9708 | ||
82beb8fd TI |
9709 | if (change) |
9710 | alc262_fujitsu_automute(codec, 0); | |
834be88d TI |
9711 | return change; |
9712 | } | |
9713 | ||
9714 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |
cca3b371 | 9715 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
834be88d TI |
9716 | { |
9717 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9718 | .name = "Master Playback Switch", | |
9719 | .info = snd_hda_mixer_amp_switch_info, | |
9720 | .get = snd_hda_mixer_amp_switch_get, | |
9721 | .put = alc262_fujitsu_master_sw_put, | |
9722 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
9723 | }, | |
9724 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9725 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
06a9c30c TV |
9726 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
9727 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), | |
834be88d TI |
9728 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9729 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9730 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
39d3ed38 TI |
9731 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
9732 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9733 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
834be88d TI |
9734 | { } /* end */ |
9735 | }; | |
9736 | ||
0e31daf7 J |
9737 | /* bind hp and internal speaker mute (with plug check) */ |
9738 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | |
9739 | struct snd_ctl_elem_value *ucontrol) | |
9740 | { | |
9741 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9742 | long *valp = ucontrol->value.integer.value; | |
9743 | int change; | |
9744 | ||
9745 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
9746 | HDA_AMP_MUTE, | |
9747 | valp ? 0 : HDA_AMP_MUTE); | |
9748 | ||
9749 | if (change) | |
9750 | alc262_lenovo_3000_automute(codec, 0); | |
9751 | return change; | |
9752 | } | |
9753 | ||
9754 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |
9755 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
9756 | { | |
9757 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9758 | .name = "Master Playback Switch", | |
9759 | .info = snd_hda_mixer_amp_switch_info, | |
9760 | .get = snd_hda_mixer_amp_switch_get, | |
9761 | .put = alc262_lenovo_3000_master_sw_put, | |
9762 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
9763 | }, | |
9764 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
9765 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
9766 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9767 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9769 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
9770 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
9771 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
9772 | { } /* end */ | |
9773 | }; | |
9774 | ||
9f99a638 HM |
9775 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
9776 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | |
9777 | { | |
9778 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9779 | .name = "Master Playback Switch", | |
9780 | .info = snd_hda_mixer_amp_switch_info, | |
9781 | .get = snd_hda_mixer_amp_switch_get, | |
9782 | .put = alc262_sony_master_sw_put, | |
9783 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
9784 | }, | |
9785 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
9786 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
9787 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
9788 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
9789 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9790 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
9791 | { } /* end */ | |
9792 | }; | |
9793 | ||
304dcaac TI |
9794 | /* additional init verbs for Benq laptops */ |
9795 | static struct hda_verb alc262_EAPD_verbs[] = { | |
9796 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9797 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | |
9798 | {} | |
9799 | }; | |
9800 | ||
83c34218 KY |
9801 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
9802 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9803 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
9804 | ||
9805 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | |
9806 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | |
9807 | {} | |
9808 | }; | |
9809 | ||
f651b50b TD |
9810 | /* Samsung Q1 Ultra Vista model setup */ |
9811 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | |
bb9f76cd TI |
9812 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
9813 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | |
f651b50b TD |
9814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
9816 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | |
bb9f76cd | 9817 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
f651b50b TD |
9818 | { } /* end */ |
9819 | }; | |
9820 | ||
9821 | static struct hda_verb alc262_ultra_verbs[] = { | |
bb9f76cd TI |
9822 | /* output mixer */ |
9823 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9824 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9825 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
9826 | /* speaker */ | |
9827 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
9828 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
9829 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9830 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9831 | /* HP */ | |
f651b50b | 9832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
bb9f76cd TI |
9833 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
9834 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
9835 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
9836 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
9837 | /* internal mic */ | |
9838 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
9839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
9840 | /* ADC, choose mic */ | |
9841 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9842 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
9843 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
9844 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
9845 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
9846 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
9847 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
9848 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
9849 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
9850 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | |
f651b50b TD |
9851 | {} |
9852 | }; | |
9853 | ||
f651b50b TD |
9854 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
9855 | static void alc262_ultra_automute(struct hda_codec *codec) | |
9856 | { | |
9857 | struct alc_spec *spec = codec->spec; | |
9858 | unsigned int mute; | |
f651b50b | 9859 | |
bb9f76cd TI |
9860 | mute = 0; |
9861 | /* auto-mute only when HP is used as HP */ | |
9862 | if (!spec->cur_mux[0]) { | |
9863 | unsigned int present; | |
9864 | /* need to execute and sync at first */ | |
9865 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); | |
9866 | present = snd_hda_codec_read(codec, 0x15, 0, | |
9867 | AC_VERB_GET_PIN_SENSE, 0); | |
9868 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | |
9869 | if (spec->jack_present) | |
9870 | mute = HDA_AMP_MUTE; | |
f651b50b | 9871 | } |
bb9f76cd TI |
9872 | /* mute/unmute internal speaker */ |
9873 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
9874 | HDA_AMP_MUTE, mute); | |
9875 | /* mute/unmute HP */ | |
9876 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
9877 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | |
f651b50b TD |
9878 | } |
9879 | ||
9880 | /* unsolicited event for HP jack sensing */ | |
9881 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | |
9882 | unsigned int res) | |
9883 | { | |
9884 | if ((res >> 26) != ALC880_HP_EVENT) | |
9885 | return; | |
9886 | alc262_ultra_automute(codec); | |
9887 | } | |
9888 | ||
bb9f76cd TI |
9889 | static struct hda_input_mux alc262_ultra_capture_source = { |
9890 | .num_items = 2, | |
9891 | .items = { | |
9892 | { "Mic", 0x1 }, | |
9893 | { "Headphone", 0x7 }, | |
9894 | }, | |
9895 | }; | |
9896 | ||
9897 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | |
9898 | struct snd_ctl_elem_value *ucontrol) | |
9899 | { | |
9900 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
9901 | struct alc_spec *spec = codec->spec; | |
9902 | int ret; | |
9903 | ||
54cbc9ab | 9904 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
bb9f76cd TI |
9905 | if (!ret) |
9906 | return 0; | |
9907 | /* reprogram the HP pin as mic or HP according to the input source */ | |
9908 | snd_hda_codec_write_cache(codec, 0x15, 0, | |
9909 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
9910 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | |
9911 | alc262_ultra_automute(codec); /* mute/unmute HP */ | |
9912 | return ret; | |
9913 | } | |
9914 | ||
9915 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | |
9916 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | |
9917 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | |
9918 | { | |
9919 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
9920 | .name = "Capture Source", | |
54cbc9ab TI |
9921 | .info = alc_mux_enum_info, |
9922 | .get = alc_mux_enum_get, | |
bb9f76cd TI |
9923 | .put = alc262_ultra_mux_enum_put, |
9924 | }, | |
9925 | { } /* end */ | |
9926 | }; | |
9927 | ||
df694daa | 9928 | /* add playback controls from the parsed DAC table */ |
f12ab1e0 TI |
9929 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
9930 | const struct auto_pin_cfg *cfg) | |
df694daa KY |
9931 | { |
9932 | hda_nid_t nid; | |
9933 | int err; | |
9934 | ||
9935 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
9936 | spec->multiout.dac_nids = spec->private_dac_nids; | |
9937 | spec->multiout.dac_nids[0] = 2; | |
9938 | ||
9939 | nid = cfg->line_out_pins[0]; | |
9940 | if (nid) { | |
f12ab1e0 TI |
9941 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9942 | "Front Playback Volume", | |
9943 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); | |
9944 | if (err < 0) | |
df694daa | 9945 | return err; |
f12ab1e0 TI |
9946 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9947 | "Front Playback Switch", | |
9948 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
9949 | if (err < 0) | |
df694daa KY |
9950 | return err; |
9951 | } | |
9952 | ||
82bc955f | 9953 | nid = cfg->speaker_pins[0]; |
df694daa KY |
9954 | if (nid) { |
9955 | if (nid == 0x16) { | |
f12ab1e0 TI |
9956 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9957 | "Speaker Playback Volume", | |
9958 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | |
9959 | HDA_OUTPUT)); | |
9960 | if (err < 0) | |
df694daa | 9961 | return err; |
f12ab1e0 TI |
9962 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9963 | "Speaker Playback Switch", | |
9964 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
9965 | HDA_OUTPUT)); | |
9966 | if (err < 0) | |
df694daa KY |
9967 | return err; |
9968 | } else { | |
f12ab1e0 TI |
9969 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9970 | "Speaker Playback Switch", | |
9971 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
9972 | HDA_OUTPUT)); | |
9973 | if (err < 0) | |
df694daa KY |
9974 | return err; |
9975 | } | |
9976 | } | |
eb06ed8f | 9977 | nid = cfg->hp_pins[0]; |
df694daa KY |
9978 | if (nid) { |
9979 | /* spec->multiout.hp_nid = 2; */ | |
9980 | if (nid == 0x16) { | |
f12ab1e0 TI |
9981 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
9982 | "Headphone Playback Volume", | |
9983 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, | |
9984 | HDA_OUTPUT)); | |
9985 | if (err < 0) | |
df694daa | 9986 | return err; |
f12ab1e0 TI |
9987 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9988 | "Headphone Playback Switch", | |
9989 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
9990 | HDA_OUTPUT)); | |
9991 | if (err < 0) | |
df694daa KY |
9992 | return err; |
9993 | } else { | |
f12ab1e0 TI |
9994 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
9995 | "Headphone Playback Switch", | |
9996 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
9997 | HDA_OUTPUT)); | |
9998 | if (err < 0) | |
df694daa KY |
9999 | return err; |
10000 | } | |
10001 | } | |
f12ab1e0 | 10002 | return 0; |
df694daa KY |
10003 | } |
10004 | ||
10005 | /* identical with ALC880 */ | |
f12ab1e0 TI |
10006 | #define alc262_auto_create_analog_input_ctls \ |
10007 | alc880_auto_create_analog_input_ctls | |
df694daa KY |
10008 | |
10009 | /* | |
10010 | * generic initialization of ADC, input mixers and output mixers | |
10011 | */ | |
10012 | static struct hda_verb alc262_volume_init_verbs[] = { | |
10013 | /* | |
10014 | * Unmute ADC0-2 and set the default input to mic-in | |
10015 | */ | |
10016 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10018 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10019 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10020 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10021 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10022 | ||
cb53c626 | 10023 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
df694daa | 10024 | * mixer widget |
f12ab1e0 TI |
10025 | * Note: PASD motherboards uses the Line In 2 as the input for |
10026 | * front panel mic (mic 2) | |
df694daa KY |
10027 | */ |
10028 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
10029 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
10030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10031 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
10032 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
10033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
df694daa KY |
10034 | |
10035 | /* | |
10036 | * Set up output mixers (0x0c - 0x0f) | |
10037 | */ | |
10038 | /* set vol=0 to output mixers */ | |
10039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10040 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10041 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
ea1fb29a | 10042 | |
df694daa KY |
10043 | /* set up input amps for analog loopback */ |
10044 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
10045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10047 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10051 | ||
10052 | /* FIXME: use matrix-type input source selection */ | |
10053 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
10054 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
10055 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10056 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
10057 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
10058 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
10059 | /* Input mixer2 */ | |
10060 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10061 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
10062 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
10063 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
10064 | /* Input mixer3 */ | |
10065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10066 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | |
10067 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | |
10068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | |
10069 | ||
10070 | { } | |
10071 | }; | |
10072 | ||
9c7f852e TI |
10073 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
10074 | /* | |
10075 | * Unmute ADC0-2 and set the default input to mic-in | |
10076 | */ | |
10077 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10078 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10079 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10080 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10081 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10082 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10083 | ||
cb53c626 | 10084 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
9c7f852e | 10085 | * mixer widget |
f12ab1e0 TI |
10086 | * Note: PASD motherboards uses the Line In 2 as the input for |
10087 | * front panel mic (mic 2) | |
9c7f852e TI |
10088 | */ |
10089 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
10090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
10091 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10092 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
10093 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
10094 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
10095 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
10096 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
ea1fb29a | 10097 | |
9c7f852e TI |
10098 | /* |
10099 | * Set up output mixers (0x0c - 0x0e) | |
10100 | */ | |
10101 | /* set vol=0 to output mixers */ | |
10102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10103 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10104 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10105 | ||
10106 | /* set up input amps for analog loopback */ | |
10107 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
10108 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10109 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10110 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10111 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10112 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10113 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10114 | ||
ce875f07 | 10115 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
9c7f852e TI |
10116 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
10117 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
10118 | ||
10119 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
10120 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
10121 | ||
10122 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10123 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10124 | ||
10125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10126 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10127 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
10128 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10129 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
10130 | ||
10131 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
10132 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10133 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10134 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
10135 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10136 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10137 | ||
10138 | ||
10139 | /* FIXME: use matrix-type input source selection */ | |
10140 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
10141 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
10142 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10143 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10144 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10146 | /* Input mixer2 */ | |
10147 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10148 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10149 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10150 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10151 | /* Input mixer3 */ | |
10152 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10154 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10156 | ||
ce875f07 TI |
10157 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
10158 | ||
9c7f852e TI |
10159 | { } |
10160 | }; | |
10161 | ||
cd7509a4 KY |
10162 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
10163 | /* | |
10164 | * Unmute ADC0-2 and set the default input to mic-in | |
10165 | */ | |
10166 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10167 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10168 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10169 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10170 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10171 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10172 | ||
cb53c626 | 10173 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
cd7509a4 KY |
10174 | * mixer widget |
10175 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
10176 | * panel mic (mic 2) | |
10177 | */ | |
10178 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
10179 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
10180 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
10181 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
10182 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
10183 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
10184 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
10185 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | |
10186 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | |
cd7509a4 KY |
10187 | /* |
10188 | * Set up output mixers (0x0c - 0x0e) | |
10189 | */ | |
10190 | /* set vol=0 to output mixers */ | |
10191 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10192 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10193 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
10194 | ||
10195 | /* set up input amps for analog loopback */ | |
10196 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
10197 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10198 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10199 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10200 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10201 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
10202 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
10203 | ||
10204 | ||
10205 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | |
10206 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | |
10207 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | |
10208 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | |
10209 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
10210 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | |
10211 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | |
10212 | ||
10213 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
10214 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
10215 | ||
10216 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10217 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
10218 | ||
10219 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | |
10220 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10221 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10222 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | |
10223 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10224 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | |
10225 | ||
10226 | /* FIXME: use matrix-type input source selection */ | |
10227 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
10228 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
10229 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | |
10230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | |
10231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | |
10232 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | |
10233 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | |
10234 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
10235 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | |
10236 | /* Input mixer2 */ | |
10237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10238 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
10239 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10240 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10241 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10242 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
10243 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
10244 | /* Input mixer3 */ | |
10245 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | |
10246 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | |
10247 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | |
10248 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | |
10249 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | |
10250 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | |
10251 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | |
10252 | ||
ce875f07 TI |
10253 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
10254 | ||
cd7509a4 KY |
10255 | { } |
10256 | }; | |
10257 | ||
9f99a638 HM |
10258 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
10259 | ||
10260 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | |
10261 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
10262 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
10263 | ||
10264 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | |
10265 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | |
10266 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
10267 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | |
10268 | ||
10269 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | |
10270 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
10271 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
10272 | {} | |
10273 | }; | |
10274 | ||
10275 | ||
cb53c626 TI |
10276 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
10277 | #define alc262_loopbacks alc880_loopbacks | |
10278 | #endif | |
10279 | ||
df694daa KY |
10280 | /* pcm configuration: identiacal with ALC880 */ |
10281 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback | |
10282 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | |
10283 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | |
10284 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | |
10285 | ||
10286 | /* | |
10287 | * BIOS auto configuration | |
10288 | */ | |
10289 | static int alc262_parse_auto_config(struct hda_codec *codec) | |
10290 | { | |
10291 | struct alc_spec *spec = codec->spec; | |
10292 | int err; | |
10293 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | |
10294 | ||
f12ab1e0 TI |
10295 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
10296 | alc262_ignore); | |
10297 | if (err < 0) | |
df694daa | 10298 | return err; |
f12ab1e0 | 10299 | if (!spec->autocfg.line_outs) |
df694daa | 10300 | return 0; /* can't find valid BIOS pin config */ |
f12ab1e0 TI |
10301 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
10302 | if (err < 0) | |
10303 | return err; | |
10304 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
10305 | if (err < 0) | |
df694daa KY |
10306 | return err; |
10307 | ||
10308 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
10309 | ||
10310 | if (spec->autocfg.dig_out_pin) | |
10311 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; | |
10312 | if (spec->autocfg.dig_in_pin) | |
10313 | spec->dig_in_nid = ALC262_DIGIN_NID; | |
10314 | ||
603c4019 | 10315 | if (spec->kctls.list) |
d88897ea | 10316 | add_mixer(spec, spec->kctls.list); |
df694daa | 10317 | |
d88897ea | 10318 | add_verb(spec, alc262_volume_init_verbs); |
a1e8d2da | 10319 | spec->num_mux_defs = 1; |
df694daa KY |
10320 | spec->input_mux = &spec->private_imux; |
10321 | ||
776e184e TI |
10322 | err = alc_auto_add_mic_boost(codec); |
10323 | if (err < 0) | |
10324 | return err; | |
10325 | ||
e044c39a | 10326 | store_pin_configs(codec); |
df694daa KY |
10327 | return 1; |
10328 | } | |
10329 | ||
10330 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | |
10331 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | |
10332 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | |
f511b01c | 10333 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
df694daa KY |
10334 | |
10335 | ||
10336 | /* init callback for auto-configuration model -- overriding the default init */ | |
ae6b813a | 10337 | static void alc262_auto_init(struct hda_codec *codec) |
df694daa | 10338 | { |
f6c7e546 | 10339 | struct alc_spec *spec = codec->spec; |
df694daa KY |
10340 | alc262_auto_init_multi_out(codec); |
10341 | alc262_auto_init_hp_out(codec); | |
10342 | alc262_auto_init_analog_input(codec); | |
f511b01c | 10343 | alc262_auto_init_input_src(codec); |
f6c7e546 | 10344 | if (spec->unsol_event) |
7fb0d78f | 10345 | alc_inithook(codec); |
df694daa KY |
10346 | } |
10347 | ||
10348 | /* | |
10349 | * configuration and preset | |
10350 | */ | |
f5fcc13c TI |
10351 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
10352 | [ALC262_BASIC] = "basic", | |
10353 | [ALC262_HIPPO] = "hippo", | |
10354 | [ALC262_HIPPO_1] = "hippo_1", | |
10355 | [ALC262_FUJITSU] = "fujitsu", | |
10356 | [ALC262_HP_BPC] = "hp-bpc", | |
cd7509a4 | 10357 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
61dc35de | 10358 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
8c427226 | 10359 | [ALC262_HP_RP5700] = "hp-rp5700", |
f5fcc13c | 10360 | [ALC262_BENQ_ED8] = "benq", |
0f40502e TI |
10361 | [ALC262_BENQ_T31] = "benq-t31", |
10362 | [ALC262_SONY_ASSAMD] = "sony-assamd", | |
2922c9af | 10363 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
9f99a638 | 10364 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
f651b50b | 10365 | [ALC262_ULTRA] = "ultra", |
0e31daf7 | 10366 | [ALC262_LENOVO_3000] = "lenovo-3000", |
e8f9ae2a | 10367 | [ALC262_NEC] = "nec", |
f5fcc13c TI |
10368 | [ALC262_AUTO] = "auto", |
10369 | }; | |
10370 | ||
10371 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | |
10372 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | |
e8f9ae2a | 10373 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
f5fcc13c | 10374 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
7d87de2d | 10375 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
ac3e3741 TI |
10376 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
10377 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), | |
7d87de2d | 10378 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
b98f9334 | 10379 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
b98f9334 | 10380 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
b98f9334 | 10381 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
cd7509a4 | 10382 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 10383 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 10384 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 10385 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 10386 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 10387 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 | 10388 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
cd7509a4 | 10389 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
ac3e3741 TI |
10390 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
10391 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | |
10392 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | |
66d2a9d6 KY |
10393 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
10394 | ALC262_HP_TC_T5735), | |
8c427226 | 10395 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
ac3e3741 | 10396 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
f5fcc13c | 10397 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
5b31954e | 10398 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
272a527c | 10399 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
ac3e3741 | 10400 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
36ca6e13 | 10401 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
9f99a638 | 10402 | ALC262_TOSHIBA_RX1), |
80ffe869 | 10403 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
ac3e3741 | 10404 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
3f1eeaed | 10405 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
f651b50b | 10406 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
bb9f76cd | 10407 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
0e31daf7 | 10408 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
ac3e3741 TI |
10409 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
10410 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | |
10411 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | |
df694daa KY |
10412 | {} |
10413 | }; | |
10414 | ||
10415 | static struct alc_config_preset alc262_presets[] = { | |
10416 | [ALC262_BASIC] = { | |
10417 | .mixers = { alc262_base_mixer }, | |
10418 | .init_verbs = { alc262_init_verbs }, | |
10419 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10420 | .dac_nids = alc262_dac_nids, | |
10421 | .hp_nid = 0x03, | |
10422 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10423 | .channel_mode = alc262_modes, | |
a3bcba38 | 10424 | .input_mux = &alc262_capture_source, |
df694daa | 10425 | }, |
ccc656ce KY |
10426 | [ALC262_HIPPO] = { |
10427 | .mixers = { alc262_base_mixer }, | |
10428 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, | |
10429 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10430 | .dac_nids = alc262_dac_nids, | |
10431 | .hp_nid = 0x03, | |
10432 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10433 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10434 | .channel_mode = alc262_modes, | |
10435 | .input_mux = &alc262_capture_source, | |
10436 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 10437 | .init_hook = alc262_hippo_automute, |
ccc656ce KY |
10438 | }, |
10439 | [ALC262_HIPPO_1] = { | |
10440 | .mixers = { alc262_hippo1_mixer }, | |
10441 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | |
10442 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10443 | .dac_nids = alc262_dac_nids, | |
10444 | .hp_nid = 0x02, | |
10445 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10446 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10447 | .channel_mode = alc262_modes, | |
10448 | .input_mux = &alc262_capture_source, | |
10449 | .unsol_event = alc262_hippo1_unsol_event, | |
5b31954e | 10450 | .init_hook = alc262_hippo1_automute, |
ccc656ce | 10451 | }, |
834be88d TI |
10452 | [ALC262_FUJITSU] = { |
10453 | .mixers = { alc262_fujitsu_mixer }, | |
39d3ed38 TI |
10454 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
10455 | alc262_fujitsu_unsol_verbs }, | |
834be88d TI |
10456 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
10457 | .dac_nids = alc262_dac_nids, | |
10458 | .hp_nid = 0x03, | |
10459 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10460 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10461 | .channel_mode = alc262_modes, | |
10462 | .input_mux = &alc262_fujitsu_capture_source, | |
ae6b813a | 10463 | .unsol_event = alc262_fujitsu_unsol_event, |
ebc7a406 | 10464 | .init_hook = alc262_fujitsu_init_hook, |
834be88d | 10465 | }, |
9c7f852e TI |
10466 | [ALC262_HP_BPC] = { |
10467 | .mixers = { alc262_HP_BPC_mixer }, | |
10468 | .init_verbs = { alc262_HP_BPC_init_verbs }, | |
10469 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10470 | .dac_nids = alc262_dac_nids, | |
10471 | .hp_nid = 0x03, | |
10472 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10473 | .channel_mode = alc262_modes, | |
10474 | .input_mux = &alc262_HP_capture_source, | |
ce875f07 TI |
10475 | .unsol_event = alc262_hp_bpc_unsol_event, |
10476 | .init_hook = alc262_hp_bpc_automute, | |
f12ab1e0 | 10477 | }, |
cd7509a4 KY |
10478 | [ALC262_HP_BPC_D7000_WF] = { |
10479 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | |
10480 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
10481 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10482 | .dac_nids = alc262_dac_nids, | |
10483 | .hp_nid = 0x03, | |
10484 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10485 | .channel_mode = alc262_modes, | |
accbe498 | 10486 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
10487 | .unsol_event = alc262_hp_wildwest_unsol_event, |
10488 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 10489 | }, |
cd7509a4 KY |
10490 | [ALC262_HP_BPC_D7000_WL] = { |
10491 | .mixers = { alc262_HP_BPC_WildWest_mixer, | |
10492 | alc262_HP_BPC_WildWest_option_mixer }, | |
10493 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | |
10494 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10495 | .dac_nids = alc262_dac_nids, | |
10496 | .hp_nid = 0x03, | |
10497 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10498 | .channel_mode = alc262_modes, | |
accbe498 | 10499 | .input_mux = &alc262_HP_D7000_capture_source, |
ce875f07 TI |
10500 | .unsol_event = alc262_hp_wildwest_unsol_event, |
10501 | .init_hook = alc262_hp_wildwest_automute, | |
f12ab1e0 | 10502 | }, |
66d2a9d6 KY |
10503 | [ALC262_HP_TC_T5735] = { |
10504 | .mixers = { alc262_hp_t5735_mixer }, | |
10505 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | |
10506 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10507 | .dac_nids = alc262_dac_nids, | |
10508 | .hp_nid = 0x03, | |
10509 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10510 | .channel_mode = alc262_modes, | |
10511 | .input_mux = &alc262_capture_source, | |
10512 | .unsol_event = alc262_hp_t5735_unsol_event, | |
10513 | .init_hook = alc262_hp_t5735_init_hook, | |
8c427226 KY |
10514 | }, |
10515 | [ALC262_HP_RP5700] = { | |
10516 | .mixers = { alc262_hp_rp5700_mixer }, | |
10517 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | |
10518 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10519 | .dac_nids = alc262_dac_nids, | |
10520 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10521 | .channel_mode = alc262_modes, | |
10522 | .input_mux = &alc262_hp_rp5700_capture_source, | |
66d2a9d6 | 10523 | }, |
304dcaac TI |
10524 | [ALC262_BENQ_ED8] = { |
10525 | .mixers = { alc262_base_mixer }, | |
10526 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | |
10527 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10528 | .dac_nids = alc262_dac_nids, | |
10529 | .hp_nid = 0x03, | |
10530 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10531 | .channel_mode = alc262_modes, | |
10532 | .input_mux = &alc262_capture_source, | |
f12ab1e0 | 10533 | }, |
272a527c KY |
10534 | [ALC262_SONY_ASSAMD] = { |
10535 | .mixers = { alc262_sony_mixer }, | |
10536 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | |
10537 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10538 | .dac_nids = alc262_dac_nids, | |
10539 | .hp_nid = 0x02, | |
10540 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10541 | .channel_mode = alc262_modes, | |
10542 | .input_mux = &alc262_capture_source, | |
10543 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 10544 | .init_hook = alc262_hippo_automute, |
83c34218 KY |
10545 | }, |
10546 | [ALC262_BENQ_T31] = { | |
10547 | .mixers = { alc262_benq_t31_mixer }, | |
10548 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, | |
10549 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10550 | .dac_nids = alc262_dac_nids, | |
10551 | .hp_nid = 0x03, | |
10552 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10553 | .channel_mode = alc262_modes, | |
10554 | .input_mux = &alc262_capture_source, | |
10555 | .unsol_event = alc262_hippo_unsol_event, | |
5b31954e | 10556 | .init_hook = alc262_hippo_automute, |
ea1fb29a | 10557 | }, |
f651b50b | 10558 | [ALC262_ULTRA] = { |
bb9f76cd TI |
10559 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
10560 | .init_verbs = { alc262_ultra_verbs }, | |
f651b50b TD |
10561 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
10562 | .dac_nids = alc262_dac_nids, | |
f651b50b TD |
10563 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
10564 | .channel_mode = alc262_modes, | |
10565 | .input_mux = &alc262_ultra_capture_source, | |
bb9f76cd TI |
10566 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
10567 | .capsrc_nids = alc262_capsrc_nids, | |
10568 | .num_adc_nids = 1, /* single ADC */ | |
f651b50b TD |
10569 | .unsol_event = alc262_ultra_unsol_event, |
10570 | .init_hook = alc262_ultra_automute, | |
10571 | }, | |
0e31daf7 J |
10572 | [ALC262_LENOVO_3000] = { |
10573 | .mixers = { alc262_lenovo_3000_mixer }, | |
10574 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | |
10575 | alc262_lenovo_3000_unsol_verbs }, | |
10576 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10577 | .dac_nids = alc262_dac_nids, | |
10578 | .hp_nid = 0x03, | |
10579 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10580 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10581 | .channel_mode = alc262_modes, | |
10582 | .input_mux = &alc262_fujitsu_capture_source, | |
10583 | .unsol_event = alc262_lenovo_3000_unsol_event, | |
10584 | }, | |
e8f9ae2a PT |
10585 | [ALC262_NEC] = { |
10586 | .mixers = { alc262_nec_mixer }, | |
10587 | .init_verbs = { alc262_nec_verbs }, | |
10588 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10589 | .dac_nids = alc262_dac_nids, | |
10590 | .hp_nid = 0x03, | |
10591 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10592 | .channel_mode = alc262_modes, | |
10593 | .input_mux = &alc262_capture_source, | |
10594 | }, | |
4e555fe5 KY |
10595 | [ALC262_TOSHIBA_S06] = { |
10596 | .mixers = { alc262_toshiba_s06_mixer }, | |
10597 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | |
10598 | alc262_eapd_verbs }, | |
10599 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10600 | .capsrc_nids = alc262_dmic_capsrc_nids, | |
10601 | .dac_nids = alc262_dac_nids, | |
10602 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | |
10603 | .dig_out_nid = ALC262_DIGOUT_NID, | |
10604 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10605 | .channel_mode = alc262_modes, | |
10606 | .input_mux = &alc262_dmic_capture_source, | |
10607 | .unsol_event = alc262_toshiba_s06_unsol_event, | |
10608 | .init_hook = alc262_toshiba_s06_init_hook, | |
10609 | }, | |
9f99a638 HM |
10610 | [ALC262_TOSHIBA_RX1] = { |
10611 | .mixers = { alc262_toshiba_rx1_mixer }, | |
10612 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | |
10613 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | |
10614 | .dac_nids = alc262_dac_nids, | |
10615 | .hp_nid = 0x03, | |
10616 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | |
10617 | .channel_mode = alc262_modes, | |
10618 | .input_mux = &alc262_capture_source, | |
10619 | .unsol_event = alc262_hippo_unsol_event, | |
10620 | .init_hook = alc262_hippo_automute, | |
10621 | }, | |
df694daa KY |
10622 | }; |
10623 | ||
10624 | static int patch_alc262(struct hda_codec *codec) | |
10625 | { | |
10626 | struct alc_spec *spec; | |
10627 | int board_config; | |
10628 | int err; | |
10629 | ||
dc041e0b | 10630 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
10631 | if (spec == NULL) |
10632 | return -ENOMEM; | |
10633 | ||
10634 | codec->spec = spec; | |
10635 | #if 0 | |
f12ab1e0 TI |
10636 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
10637 | * under-run | |
10638 | */ | |
df694daa KY |
10639 | { |
10640 | int tmp; | |
10641 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
10642 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | |
10643 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | |
10644 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | |
10645 | } | |
10646 | #endif | |
10647 | ||
2c3bf9ab TI |
10648 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
10649 | ||
f5fcc13c TI |
10650 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
10651 | alc262_models, | |
10652 | alc262_cfg_tbl); | |
cd7509a4 | 10653 | |
f5fcc13c | 10654 | if (board_config < 0) { |
9c7f852e TI |
10655 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
10656 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
10657 | board_config = ALC262_AUTO; |
10658 | } | |
10659 | ||
10660 | if (board_config == ALC262_AUTO) { | |
10661 | /* automatic parse from the BIOS config */ | |
10662 | err = alc262_parse_auto_config(codec); | |
10663 | if (err < 0) { | |
10664 | alc_free(codec); | |
10665 | return err; | |
f12ab1e0 | 10666 | } else if (!err) { |
9c7f852e TI |
10667 | printk(KERN_INFO |
10668 | "hda_codec: Cannot set up configuration " | |
10669 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
10670 | board_config = ALC262_BASIC; |
10671 | } | |
10672 | } | |
10673 | ||
10674 | if (board_config != ALC262_AUTO) | |
10675 | setup_preset(spec, &alc262_presets[board_config]); | |
10676 | ||
10677 | spec->stream_name_analog = "ALC262 Analog"; | |
10678 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | |
10679 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | |
ea1fb29a | 10680 | |
df694daa KY |
10681 | spec->stream_name_digital = "ALC262 Digital"; |
10682 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | |
10683 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | |
10684 | ||
54cbc9ab | 10685 | spec->is_mix_capture = 1; |
f12ab1e0 | 10686 | if (!spec->adc_nids && spec->input_mux) { |
df694daa | 10687 | /* check whether NID 0x07 is valid */ |
4a471b7d TI |
10688 | unsigned int wcap = get_wcaps(codec, 0x07); |
10689 | ||
f12ab1e0 TI |
10690 | /* get type */ |
10691 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
df694daa KY |
10692 | if (wcap != AC_WID_AUD_IN) { |
10693 | spec->adc_nids = alc262_adc_nids_alt; | |
10694 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); | |
88c71a99 | 10695 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
d88897ea | 10696 | add_mixer(spec, alc262_capture_alt_mixer); |
df694daa KY |
10697 | } else { |
10698 | spec->adc_nids = alc262_adc_nids; | |
10699 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); | |
88c71a99 | 10700 | spec->capsrc_nids = alc262_capsrc_nids; |
d88897ea | 10701 | add_mixer(spec, alc262_capture_mixer); |
df694daa KY |
10702 | } |
10703 | } | |
10704 | ||
2134ea4f TI |
10705 | spec->vmaster_nid = 0x0c; |
10706 | ||
df694daa KY |
10707 | codec->patch_ops = alc_patch_ops; |
10708 | if (board_config == ALC262_AUTO) | |
ae6b813a | 10709 | spec->init_hook = alc262_auto_init; |
cb53c626 TI |
10710 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
10711 | if (!spec->loopback.amplist) | |
10712 | spec->loopback.amplist = alc262_loopbacks; | |
10713 | #endif | |
ea1fb29a | 10714 | |
df694daa KY |
10715 | return 0; |
10716 | } | |
10717 | ||
a361d84b KY |
10718 | /* |
10719 | * ALC268 channel source setting (2 channel) | |
10720 | */ | |
10721 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | |
10722 | #define alc268_modes alc260_modes | |
ea1fb29a | 10723 | |
a361d84b KY |
10724 | static hda_nid_t alc268_dac_nids[2] = { |
10725 | /* front, hp */ | |
10726 | 0x02, 0x03 | |
10727 | }; | |
10728 | ||
10729 | static hda_nid_t alc268_adc_nids[2] = { | |
10730 | /* ADC0-1 */ | |
10731 | 0x08, 0x07 | |
10732 | }; | |
10733 | ||
10734 | static hda_nid_t alc268_adc_nids_alt[1] = { | |
10735 | /* ADC0 */ | |
10736 | 0x08 | |
10737 | }; | |
10738 | ||
e1406348 TI |
10739 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
10740 | ||
a361d84b KY |
10741 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
10742 | /* output mixer control */ | |
10743 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
10744 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10745 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
10746 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
33bf17ab TI |
10747 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
10748 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
10749 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
a361d84b KY |
10750 | { } |
10751 | }; | |
10752 | ||
aef9d318 TI |
10753 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
10754 | static struct hda_bind_ctls alc268_bind_beep_sw = { | |
10755 | .ops = &snd_hda_bind_sw, | |
10756 | .values = { | |
10757 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
10758 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
10759 | 0 | |
10760 | }, | |
10761 | }; | |
10762 | ||
10763 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | |
10764 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
10765 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
10766 | { } | |
10767 | }; | |
10768 | ||
d1a991a6 KY |
10769 | static struct hda_verb alc268_eapd_verbs[] = { |
10770 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
10771 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
10772 | { } | |
10773 | }; | |
10774 | ||
d273809e TI |
10775 | /* Toshiba specific */ |
10776 | #define alc268_toshiba_automute alc262_hippo_automute | |
10777 | ||
10778 | static struct hda_verb alc268_toshiba_verbs[] = { | |
10779 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10780 | { } /* end */ | |
10781 | }; | |
10782 | ||
8ef355da KY |
10783 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
10784 | .num_items = 2, | |
10785 | .items = { | |
10786 | { "i-Mic", 0x6 }, | |
10787 | { "E-Mic", 0x0 }, | |
10788 | }, | |
10789 | }; | |
10790 | ||
d273809e | 10791 | /* Acer specific */ |
889c4395 | 10792 | /* bind volumes of both NID 0x02 and 0x03 */ |
6bc96857 TI |
10793 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
10794 | .ops = &snd_hda_bind_vol, | |
10795 | .values = { | |
10796 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
10797 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
10798 | 0 | |
10799 | }, | |
10800 | }; | |
10801 | ||
889c4395 TI |
10802 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
10803 | static void alc268_acer_automute(struct hda_codec *codec, int force) | |
10804 | { | |
10805 | struct alc_spec *spec = codec->spec; | |
10806 | unsigned int mute; | |
10807 | ||
10808 | if (force || !spec->sense_updated) { | |
10809 | unsigned int present; | |
10810 | present = snd_hda_codec_read(codec, 0x14, 0, | |
10811 | AC_VERB_GET_PIN_SENSE, 0); | |
10812 | spec->jack_present = (present & 0x80000000) != 0; | |
10813 | spec->sense_updated = 1; | |
10814 | } | |
10815 | if (spec->jack_present) | |
10816 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | |
10817 | else /* unmute internal speaker if necessary */ | |
10818 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
10819 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
10820 | HDA_AMP_MUTE, mute); | |
10821 | } | |
10822 | ||
10823 | ||
10824 | /* bind hp and internal speaker mute (with plug check) */ | |
10825 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |
10826 | struct snd_ctl_elem_value *ucontrol) | |
10827 | { | |
10828 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
10829 | long *valp = ucontrol->value.integer.value; | |
10830 | int change; | |
10831 | ||
10832 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | |
10833 | HDA_AMP_MUTE, | |
10834 | valp[0] ? 0 : HDA_AMP_MUTE); | |
10835 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | |
10836 | HDA_AMP_MUTE, | |
10837 | valp[1] ? 0 : HDA_AMP_MUTE); | |
10838 | if (change) | |
10839 | alc268_acer_automute(codec, 0); | |
10840 | return change; | |
10841 | } | |
d273809e | 10842 | |
8ef355da KY |
10843 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
10844 | /* output mixer control */ | |
10845 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
10846 | { | |
10847 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10848 | .name = "Master Playback Switch", | |
10849 | .info = snd_hda_mixer_amp_switch_info, | |
10850 | .get = snd_hda_mixer_amp_switch_get, | |
10851 | .put = alc268_acer_master_sw_put, | |
10852 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
10853 | }, | |
10854 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | |
10855 | { } | |
10856 | }; | |
10857 | ||
d273809e TI |
10858 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
10859 | /* output mixer control */ | |
10860 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
10861 | { | |
10862 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
10863 | .name = "Master Playback Switch", | |
10864 | .info = snd_hda_mixer_amp_switch_info, | |
10865 | .get = snd_hda_mixer_amp_switch_get, | |
10866 | .put = alc268_acer_master_sw_put, | |
10867 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
10868 | }, | |
33bf17ab TI |
10869 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
10870 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
10871 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | |
d273809e TI |
10872 | { } |
10873 | }; | |
10874 | ||
8ef355da KY |
10875 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
10876 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
10877 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10878 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10879 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
10880 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | |
10881 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | |
10882 | { } | |
10883 | }; | |
10884 | ||
d273809e | 10885 | static struct hda_verb alc268_acer_verbs[] = { |
0ccb541c TI |
10886 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
10887 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
d273809e TI |
10888 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
10889 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
0ccb541c TI |
10890 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
10891 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
d273809e TI |
10892 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
10893 | { } | |
10894 | }; | |
10895 | ||
10896 | /* unsolicited event for HP jack sensing */ | |
10897 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, | |
10898 | unsigned int res) | |
10899 | { | |
889c4395 | 10900 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
10901 | return; |
10902 | alc268_toshiba_automute(codec); | |
10903 | } | |
10904 | ||
10905 | static void alc268_acer_unsol_event(struct hda_codec *codec, | |
10906 | unsigned int res) | |
10907 | { | |
889c4395 | 10908 | if ((res >> 26) != ALC880_HP_EVENT) |
d273809e TI |
10909 | return; |
10910 | alc268_acer_automute(codec, 1); | |
10911 | } | |
10912 | ||
889c4395 TI |
10913 | static void alc268_acer_init_hook(struct hda_codec *codec) |
10914 | { | |
10915 | alc268_acer_automute(codec, 1); | |
10916 | } | |
10917 | ||
8ef355da KY |
10918 | /* toggle speaker-output according to the hp-jack state */ |
10919 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | |
10920 | { | |
10921 | unsigned int present; | |
10922 | unsigned char bits; | |
10923 | ||
10924 | present = snd_hda_codec_read(codec, 0x15, 0, | |
10925 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
10926 | bits = present ? AMP_IN_MUTE(0) : 0; | |
10927 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | |
10928 | AMP_IN_MUTE(0), bits); | |
10929 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | |
10930 | AMP_IN_MUTE(0), bits); | |
10931 | } | |
10932 | ||
10933 | ||
10934 | static void alc268_acer_mic_automute(struct hda_codec *codec) | |
10935 | { | |
10936 | unsigned int present; | |
10937 | ||
10938 | present = snd_hda_codec_read(codec, 0x18, 0, | |
10939 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
10940 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | |
10941 | present ? 0x0 : 0x6); | |
10942 | } | |
10943 | ||
10944 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | |
10945 | unsigned int res) | |
10946 | { | |
10947 | if ((res >> 26) == ALC880_HP_EVENT) | |
10948 | alc268_aspire_one_speaker_automute(codec); | |
10949 | if ((res >> 26) == ALC880_MIC_EVENT) | |
10950 | alc268_acer_mic_automute(codec); | |
10951 | } | |
10952 | ||
10953 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | |
10954 | { | |
10955 | alc268_aspire_one_speaker_automute(codec); | |
10956 | alc268_acer_mic_automute(codec); | |
10957 | } | |
10958 | ||
3866f0b0 TI |
10959 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
10960 | /* output mixer control */ | |
10961 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
10962 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
10963 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
10964 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
10965 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
10966 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
10967 | { } | |
10968 | }; | |
10969 | ||
10970 | static struct hda_verb alc268_dell_verbs[] = { | |
10971 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10972 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
10973 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
10974 | { } | |
10975 | }; | |
10976 | ||
10977 | /* mute/unmute internal speaker according to the hp jack and mute state */ | |
10978 | static void alc268_dell_automute(struct hda_codec *codec) | |
10979 | { | |
10980 | unsigned int present; | |
10981 | unsigned int mute; | |
10982 | ||
10983 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); | |
10984 | if (present & 0x80000000) | |
10985 | mute = HDA_AMP_MUTE; | |
10986 | else | |
10987 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); | |
10988 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
10989 | HDA_AMP_MUTE, mute); | |
10990 | } | |
10991 | ||
10992 | static void alc268_dell_unsol_event(struct hda_codec *codec, | |
10993 | unsigned int res) | |
10994 | { | |
10995 | if ((res >> 26) != ALC880_HP_EVENT) | |
10996 | return; | |
10997 | alc268_dell_automute(codec); | |
10998 | } | |
10999 | ||
11000 | #define alc268_dell_init_hook alc268_dell_automute | |
11001 | ||
eb5a6621 HRK |
11002 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
11003 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
11004 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11005 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | |
11006 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11007 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
11008 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | |
11009 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | |
11010 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
11011 | { } | |
11012 | }; | |
11013 | ||
11014 | static struct hda_verb alc267_quanta_il1_verbs[] = { | |
11015 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11016 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | |
11017 | { } | |
11018 | }; | |
11019 | ||
11020 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) | |
11021 | { | |
11022 | unsigned int present; | |
11023 | ||
11024 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) | |
11025 | & AC_PINSENSE_PRESENCE; | |
11026 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
11027 | present ? 0 : PIN_OUT); | |
11028 | } | |
11029 | ||
11030 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) | |
11031 | { | |
11032 | unsigned int present; | |
11033 | ||
11034 | present = snd_hda_codec_read(codec, 0x18, 0, | |
11035 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11036 | snd_hda_codec_write(codec, 0x23, 0, | |
11037 | AC_VERB_SET_CONNECT_SEL, | |
11038 | present ? 0x00 : 0x01); | |
11039 | } | |
11040 | ||
11041 | static void alc267_quanta_il1_automute(struct hda_codec *codec) | |
11042 | { | |
11043 | alc267_quanta_il1_hp_automute(codec); | |
11044 | alc267_quanta_il1_mic_automute(codec); | |
11045 | } | |
11046 | ||
11047 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, | |
11048 | unsigned int res) | |
11049 | { | |
11050 | switch (res >> 26) { | |
11051 | case ALC880_HP_EVENT: | |
11052 | alc267_quanta_il1_hp_automute(codec); | |
11053 | break; | |
11054 | case ALC880_MIC_EVENT: | |
11055 | alc267_quanta_il1_mic_automute(codec); | |
11056 | break; | |
11057 | } | |
11058 | } | |
11059 | ||
a361d84b KY |
11060 | /* |
11061 | * generic initialization of ADC, input mixers and output mixers | |
11062 | */ | |
11063 | static struct hda_verb alc268_base_init_verbs[] = { | |
11064 | /* Unmute DAC0-1 and set vol = 0 */ | |
11065 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11066 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11067 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11068 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11069 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11070 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11071 | ||
11072 | /* | |
11073 | * Set up output mixers (0x0c - 0x0e) | |
11074 | */ | |
11075 | /* set vol=0 to output mixers */ | |
11076 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11077 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11078 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11079 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11080 | ||
11081 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11082 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11083 | ||
11084 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11085 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | |
11086 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | |
11087 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11088 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11089 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11090 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11091 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11092 | ||
11093 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11094 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11095 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11096 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11097 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11098 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11099 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
aef9d318 TI |
11100 | |
11101 | /* set PCBEEP vol = 0, mute connections */ | |
11102 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11103 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11104 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b | 11105 | |
a9b3aa8a | 11106 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
ea1fb29a | 11107 | |
a9b3aa8a JZ |
11108 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
11109 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
11110 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
11111 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
a361d84b | 11112 | |
a361d84b KY |
11113 | { } |
11114 | }; | |
11115 | ||
11116 | /* | |
11117 | * generic initialization of ADC, input mixers and output mixers | |
11118 | */ | |
11119 | static struct hda_verb alc268_volume_init_verbs[] = { | |
11120 | /* set output DAC */ | |
11121 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11122 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11123 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11124 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11125 | ||
11126 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11127 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
11128 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11129 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11130 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | |
11131 | ||
11132 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
11133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11134 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
11135 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11136 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11137 | ||
11138 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11139 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11140 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11141 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
11142 | ||
aef9d318 TI |
11143 | /* set PCBEEP vol = 0, mute connections */ |
11144 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
11145 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
11146 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
a361d84b KY |
11147 | |
11148 | { } | |
11149 | }; | |
11150 | ||
a361d84b KY |
11151 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
11152 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
11153 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
11154 | { | |
11155 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11156 | /* The multiple "Capture Source" controls confuse alsamixer | |
11157 | * So call somewhat different.. | |
a361d84b KY |
11158 | */ |
11159 | /* .name = "Capture Source", */ | |
11160 | .name = "Input Source", | |
11161 | .count = 1, | |
54cbc9ab TI |
11162 | .info = alc_mux_enum_info, |
11163 | .get = alc_mux_enum_get, | |
11164 | .put = alc_mux_enum_put, | |
a361d84b KY |
11165 | }, |
11166 | { } /* end */ | |
11167 | }; | |
11168 | ||
11169 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | |
11170 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | |
11171 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | |
11172 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | |
11173 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | |
11174 | { | |
11175 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11176 | /* The multiple "Capture Source" controls confuse alsamixer | |
11177 | * So call somewhat different.. | |
a361d84b KY |
11178 | */ |
11179 | /* .name = "Capture Source", */ | |
11180 | .name = "Input Source", | |
11181 | .count = 2, | |
54cbc9ab TI |
11182 | .info = alc_mux_enum_info, |
11183 | .get = alc_mux_enum_get, | |
11184 | .put = alc_mux_enum_put, | |
a361d84b KY |
11185 | }, |
11186 | { } /* end */ | |
11187 | }; | |
11188 | ||
11189 | static struct hda_input_mux alc268_capture_source = { | |
11190 | .num_items = 4, | |
11191 | .items = { | |
11192 | { "Mic", 0x0 }, | |
11193 | { "Front Mic", 0x1 }, | |
11194 | { "Line", 0x2 }, | |
11195 | { "CD", 0x3 }, | |
11196 | }, | |
11197 | }; | |
11198 | ||
0ccb541c TI |
11199 | static struct hda_input_mux alc268_acer_capture_source = { |
11200 | .num_items = 3, | |
11201 | .items = { | |
11202 | { "Mic", 0x0 }, | |
11203 | { "Internal Mic", 0x6 }, | |
11204 | { "Line", 0x2 }, | |
11205 | }, | |
11206 | }; | |
11207 | ||
86c53bd2 JW |
11208 | #ifdef CONFIG_SND_DEBUG |
11209 | static struct snd_kcontrol_new alc268_test_mixer[] = { | |
86c53bd2 JW |
11210 | /* Volume widgets */ |
11211 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
11212 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
11213 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
11214 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | |
11215 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | |
11216 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | |
11217 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | |
11218 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | |
11219 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | |
11220 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | |
11221 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | |
11222 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | |
11223 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | |
f0747ee6 TI |
11224 | /* The below appears problematic on some hardwares */ |
11225 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | |
86c53bd2 JW |
11226 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
11227 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | |
11228 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | |
11229 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | |
11230 | ||
11231 | /* Modes for retasking pin widgets */ | |
11232 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | |
11233 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | |
11234 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | |
11235 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | |
11236 | ||
11237 | /* Controls for GPIO pins, assuming they are configured as outputs */ | |
11238 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | |
11239 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | |
11240 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | |
11241 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | |
11242 | ||
11243 | /* Switches to allow the digital SPDIF output pin to be enabled. | |
11244 | * The ALC268 does not have an SPDIF input. | |
11245 | */ | |
11246 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | |
11247 | ||
11248 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | |
11249 | * this output to turn on an external amplifier. | |
11250 | */ | |
11251 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | |
11252 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | |
11253 | ||
11254 | { } /* end */ | |
11255 | }; | |
11256 | #endif | |
11257 | ||
a361d84b KY |
11258 | /* create input playback/capture controls for the given pin */ |
11259 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |
11260 | const char *ctlname, int idx) | |
11261 | { | |
11262 | char name[32]; | |
11263 | int err; | |
11264 | ||
11265 | sprintf(name, "%s Playback Volume", ctlname); | |
11266 | if (nid == 0x14) { | |
11267 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
11268 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, | |
11269 | HDA_OUTPUT)); | |
11270 | if (err < 0) | |
11271 | return err; | |
11272 | } else if (nid == 0x15) { | |
11273 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
11274 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, | |
11275 | HDA_OUTPUT)); | |
11276 | if (err < 0) | |
11277 | return err; | |
11278 | } else | |
11279 | return -1; | |
11280 | sprintf(name, "%s Playback Switch", ctlname); | |
11281 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
11282 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | |
11283 | if (err < 0) | |
11284 | return err; | |
11285 | return 0; | |
11286 | } | |
11287 | ||
11288 | /* add playback controls from the parsed DAC table */ | |
11289 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |
11290 | const struct auto_pin_cfg *cfg) | |
11291 | { | |
11292 | hda_nid_t nid; | |
11293 | int err; | |
11294 | ||
11295 | spec->multiout.num_dacs = 2; /* only use one dac */ | |
11296 | spec->multiout.dac_nids = spec->private_dac_nids; | |
11297 | spec->multiout.dac_nids[0] = 2; | |
11298 | spec->multiout.dac_nids[1] = 3; | |
11299 | ||
11300 | nid = cfg->line_out_pins[0]; | |
11301 | if (nid) | |
ea1fb29a | 11302 | alc268_new_analog_output(spec, nid, "Front", 0); |
a361d84b KY |
11303 | |
11304 | nid = cfg->speaker_pins[0]; | |
11305 | if (nid == 0x1d) { | |
11306 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
11307 | "Speaker Playback Volume", | |
11308 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | |
11309 | if (err < 0) | |
11310 | return err; | |
11311 | } | |
11312 | nid = cfg->hp_pins[0]; | |
11313 | if (nid) | |
11314 | alc268_new_analog_output(spec, nid, "Headphone", 0); | |
11315 | ||
11316 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | |
11317 | if (nid == 0x16) { | |
11318 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
11319 | "Mono Playback Switch", | |
11320 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); | |
11321 | if (err < 0) | |
11322 | return err; | |
11323 | } | |
ea1fb29a | 11324 | return 0; |
a361d84b KY |
11325 | } |
11326 | ||
11327 | /* create playback/capture controls for input pins */ | |
11328 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | |
11329 | const struct auto_pin_cfg *cfg) | |
11330 | { | |
11331 | struct hda_input_mux *imux = &spec->private_imux; | |
11332 | int i, idx1; | |
11333 | ||
11334 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
11335 | switch(cfg->input_pins[i]) { | |
11336 | case 0x18: | |
11337 | idx1 = 0; /* Mic 1 */ | |
11338 | break; | |
11339 | case 0x19: | |
11340 | idx1 = 1; /* Mic 2 */ | |
11341 | break; | |
11342 | case 0x1a: | |
11343 | idx1 = 2; /* Line In */ | |
11344 | break; | |
ea1fb29a | 11345 | case 0x1c: |
a361d84b KY |
11346 | idx1 = 3; /* CD */ |
11347 | break; | |
7194cae6 TI |
11348 | case 0x12: |
11349 | case 0x13: | |
11350 | idx1 = 6; /* digital mics */ | |
11351 | break; | |
a361d84b KY |
11352 | default: |
11353 | continue; | |
11354 | } | |
11355 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | |
11356 | imux->items[imux->num_items].index = idx1; | |
ea1fb29a | 11357 | imux->num_items++; |
a361d84b KY |
11358 | } |
11359 | return 0; | |
11360 | } | |
11361 | ||
11362 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |
11363 | { | |
11364 | struct alc_spec *spec = codec->spec; | |
11365 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | |
11366 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | |
11367 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | |
11368 | unsigned int dac_vol1, dac_vol2; | |
11369 | ||
11370 | if (speaker_nid) { | |
11371 | snd_hda_codec_write(codec, speaker_nid, 0, | |
11372 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
11373 | snd_hda_codec_write(codec, 0x0f, 0, | |
11374 | AC_VERB_SET_AMP_GAIN_MUTE, | |
11375 | AMP_IN_UNMUTE(1)); | |
11376 | snd_hda_codec_write(codec, 0x10, 0, | |
11377 | AC_VERB_SET_AMP_GAIN_MUTE, | |
11378 | AMP_IN_UNMUTE(1)); | |
11379 | } else { | |
11380 | snd_hda_codec_write(codec, 0x0f, 0, | |
11381 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
11382 | snd_hda_codec_write(codec, 0x10, 0, | |
11383 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | |
11384 | } | |
11385 | ||
11386 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | |
ea1fb29a | 11387 | if (line_nid == 0x14) |
a361d84b KY |
11388 | dac_vol2 = AMP_OUT_ZERO; |
11389 | else if (line_nid == 0x15) | |
11390 | dac_vol1 = AMP_OUT_ZERO; | |
ea1fb29a | 11391 | if (hp_nid == 0x14) |
a361d84b KY |
11392 | dac_vol2 = AMP_OUT_ZERO; |
11393 | else if (hp_nid == 0x15) | |
11394 | dac_vol1 = AMP_OUT_ZERO; | |
11395 | if (line_nid != 0x16 || hp_nid != 0x16 || | |
11396 | spec->autocfg.line_out_pins[1] != 0x16 || | |
11397 | spec->autocfg.line_out_pins[2] != 0x16) | |
11398 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | |
11399 | ||
11400 | snd_hda_codec_write(codec, 0x02, 0, | |
11401 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | |
11402 | snd_hda_codec_write(codec, 0x03, 0, | |
11403 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | |
11404 | } | |
11405 | ||
11406 | /* pcm configuration: identiacal with ALC880 */ | |
11407 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback | |
11408 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | |
6330079f | 11409 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
a361d84b KY |
11410 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
11411 | ||
11412 | /* | |
11413 | * BIOS auto configuration | |
11414 | */ | |
11415 | static int alc268_parse_auto_config(struct hda_codec *codec) | |
11416 | { | |
11417 | struct alc_spec *spec = codec->spec; | |
11418 | int err; | |
11419 | static hda_nid_t alc268_ignore[] = { 0 }; | |
11420 | ||
11421 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
11422 | alc268_ignore); | |
11423 | if (err < 0) | |
11424 | return err; | |
11425 | if (!spec->autocfg.line_outs) | |
11426 | return 0; /* can't find valid BIOS pin config */ | |
11427 | ||
11428 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
11429 | if (err < 0) | |
11430 | return err; | |
11431 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
11432 | if (err < 0) | |
11433 | return err; | |
11434 | ||
11435 | spec->multiout.max_channels = 2; | |
11436 | ||
11437 | /* digital only support output */ | |
11438 | if (spec->autocfg.dig_out_pin) | |
11439 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; | |
11440 | ||
603c4019 | 11441 | if (spec->kctls.list) |
d88897ea | 11442 | add_mixer(spec, spec->kctls.list); |
a361d84b | 11443 | |
aef9d318 | 11444 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
d88897ea | 11445 | add_mixer(spec, alc268_beep_mixer); |
aef9d318 | 11446 | |
d88897ea | 11447 | add_verb(spec, alc268_volume_init_verbs); |
a361d84b KY |
11448 | spec->num_mux_defs = 1; |
11449 | spec->input_mux = &spec->private_imux; | |
11450 | ||
776e184e TI |
11451 | err = alc_auto_add_mic_boost(codec); |
11452 | if (err < 0) | |
11453 | return err; | |
11454 | ||
e044c39a | 11455 | store_pin_configs(codec); |
a361d84b KY |
11456 | return 1; |
11457 | } | |
11458 | ||
11459 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out | |
11460 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out | |
11461 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | |
11462 | ||
11463 | /* init callback for auto-configuration model -- overriding the default init */ | |
11464 | static void alc268_auto_init(struct hda_codec *codec) | |
11465 | { | |
f6c7e546 | 11466 | struct alc_spec *spec = codec->spec; |
a361d84b KY |
11467 | alc268_auto_init_multi_out(codec); |
11468 | alc268_auto_init_hp_out(codec); | |
11469 | alc268_auto_init_mono_speaker_out(codec); | |
11470 | alc268_auto_init_analog_input(codec); | |
f6c7e546 | 11471 | if (spec->unsol_event) |
7fb0d78f | 11472 | alc_inithook(codec); |
a361d84b KY |
11473 | } |
11474 | ||
11475 | /* | |
11476 | * configuration and preset | |
11477 | */ | |
11478 | static const char *alc268_models[ALC268_MODEL_LAST] = { | |
eb5a6621 | 11479 | [ALC267_QUANTA_IL1] = "quanta-il1", |
a361d84b | 11480 | [ALC268_3ST] = "3stack", |
983f8ae4 | 11481 | [ALC268_TOSHIBA] = "toshiba", |
d273809e | 11482 | [ALC268_ACER] = "acer", |
8ef355da | 11483 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
3866f0b0 | 11484 | [ALC268_DELL] = "dell", |
f12462c5 | 11485 | [ALC268_ZEPTO] = "zepto", |
86c53bd2 JW |
11486 | #ifdef CONFIG_SND_DEBUG |
11487 | [ALC268_TEST] = "test", | |
11488 | #endif | |
a361d84b KY |
11489 | [ALC268_AUTO] = "auto", |
11490 | }; | |
11491 | ||
11492 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | |
a0b8f7d8 | 11493 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
ac3e3741 | 11494 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
dafc8357 | 11495 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
ac3e3741 | 11496 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
29a52c24 | 11497 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
8ef355da KY |
11498 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
11499 | ALC268_ACER_ASPIRE_ONE), | |
3866f0b0 | 11500 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
ac3e3741 | 11501 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
a361d84b | 11502 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
d1a991a6 | 11503 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
8e7f00f9 | 11504 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
2346d0cd | 11505 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
378bd6a5 | 11506 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
b875bf3a | 11507 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
eb5a6621 | 11508 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
f12462c5 | 11509 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
a361d84b KY |
11510 | {} |
11511 | }; | |
11512 | ||
11513 | static struct alc_config_preset alc268_presets[] = { | |
eb5a6621 HRK |
11514 | [ALC267_QUANTA_IL1] = { |
11515 | .mixers = { alc267_quanta_il1_mixer }, | |
11516 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
11517 | alc267_quanta_il1_verbs }, | |
11518 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11519 | .dac_nids = alc268_dac_nids, | |
11520 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11521 | .adc_nids = alc268_adc_nids_alt, | |
11522 | .hp_nid = 0x03, | |
11523 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11524 | .channel_mode = alc268_modes, | |
11525 | .input_mux = &alc268_capture_source, | |
11526 | .unsol_event = alc267_quanta_il1_unsol_event, | |
11527 | .init_hook = alc267_quanta_il1_automute, | |
11528 | }, | |
a361d84b | 11529 | [ALC268_3ST] = { |
aef9d318 TI |
11530 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
11531 | alc268_beep_mixer }, | |
a361d84b KY |
11532 | .init_verbs = { alc268_base_init_verbs }, |
11533 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11534 | .dac_nids = alc268_dac_nids, | |
11535 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11536 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11537 | .capsrc_nids = alc268_capsrc_nids, |
a361d84b KY |
11538 | .hp_nid = 0x03, |
11539 | .dig_out_nid = ALC268_DIGOUT_NID, | |
11540 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11541 | .channel_mode = alc268_modes, | |
11542 | .input_mux = &alc268_capture_source, | |
11543 | }, | |
d1a991a6 | 11544 | [ALC268_TOSHIBA] = { |
aef9d318 TI |
11545 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
11546 | alc268_beep_mixer }, | |
d273809e TI |
11547 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11548 | alc268_toshiba_verbs }, | |
d1a991a6 KY |
11549 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
11550 | .dac_nids = alc268_dac_nids, | |
11551 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11552 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11553 | .capsrc_nids = alc268_capsrc_nids, |
d1a991a6 KY |
11554 | .hp_nid = 0x03, |
11555 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11556 | .channel_mode = alc268_modes, | |
11557 | .input_mux = &alc268_capture_source, | |
d273809e TI |
11558 | .unsol_event = alc268_toshiba_unsol_event, |
11559 | .init_hook = alc268_toshiba_automute, | |
11560 | }, | |
11561 | [ALC268_ACER] = { | |
aef9d318 TI |
11562 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
11563 | alc268_beep_mixer }, | |
d273809e TI |
11564 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11565 | alc268_acer_verbs }, | |
11566 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11567 | .dac_nids = alc268_dac_nids, | |
11568 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11569 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11570 | .capsrc_nids = alc268_capsrc_nids, |
d273809e TI |
11571 | .hp_nid = 0x02, |
11572 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11573 | .channel_mode = alc268_modes, | |
0ccb541c | 11574 | .input_mux = &alc268_acer_capture_source, |
d273809e | 11575 | .unsol_event = alc268_acer_unsol_event, |
889c4395 | 11576 | .init_hook = alc268_acer_init_hook, |
d1a991a6 | 11577 | }, |
8ef355da KY |
11578 | [ALC268_ACER_ASPIRE_ONE] = { |
11579 | .mixers = { alc268_acer_aspire_one_mixer, | |
11580 | alc268_capture_alt_mixer }, | |
11581 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
11582 | alc268_acer_aspire_one_verbs }, | |
11583 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11584 | .dac_nids = alc268_dac_nids, | |
11585 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11586 | .adc_nids = alc268_adc_nids_alt, | |
11587 | .capsrc_nids = alc268_capsrc_nids, | |
11588 | .hp_nid = 0x03, | |
11589 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11590 | .channel_mode = alc268_modes, | |
11591 | .input_mux = &alc268_acer_lc_capture_source, | |
11592 | .unsol_event = alc268_acer_lc_unsol_event, | |
11593 | .init_hook = alc268_acer_lc_init_hook, | |
11594 | }, | |
3866f0b0 | 11595 | [ALC268_DELL] = { |
aef9d318 | 11596 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
3866f0b0 TI |
11597 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11598 | alc268_dell_verbs }, | |
11599 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11600 | .dac_nids = alc268_dac_nids, | |
11601 | .hp_nid = 0x02, | |
11602 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11603 | .channel_mode = alc268_modes, | |
11604 | .unsol_event = alc268_dell_unsol_event, | |
11605 | .init_hook = alc268_dell_init_hook, | |
11606 | .input_mux = &alc268_capture_source, | |
11607 | }, | |
f12462c5 | 11608 | [ALC268_ZEPTO] = { |
aef9d318 TI |
11609 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
11610 | alc268_beep_mixer }, | |
f12462c5 MT |
11611 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11612 | alc268_toshiba_verbs }, | |
11613 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11614 | .dac_nids = alc268_dac_nids, | |
11615 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11616 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11617 | .capsrc_nids = alc268_capsrc_nids, |
f12462c5 MT |
11618 | .hp_nid = 0x03, |
11619 | .dig_out_nid = ALC268_DIGOUT_NID, | |
11620 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11621 | .channel_mode = alc268_modes, | |
11622 | .input_mux = &alc268_capture_source, | |
11623 | .unsol_event = alc268_toshiba_unsol_event, | |
11624 | .init_hook = alc268_toshiba_automute | |
11625 | }, | |
86c53bd2 JW |
11626 | #ifdef CONFIG_SND_DEBUG |
11627 | [ALC268_TEST] = { | |
11628 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | |
11629 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | |
11630 | alc268_volume_init_verbs }, | |
11631 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | |
11632 | .dac_nids = alc268_dac_nids, | |
11633 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | |
11634 | .adc_nids = alc268_adc_nids_alt, | |
e1406348 | 11635 | .capsrc_nids = alc268_capsrc_nids, |
86c53bd2 JW |
11636 | .hp_nid = 0x03, |
11637 | .dig_out_nid = ALC268_DIGOUT_NID, | |
11638 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | |
11639 | .channel_mode = alc268_modes, | |
11640 | .input_mux = &alc268_capture_source, | |
11641 | }, | |
11642 | #endif | |
a361d84b KY |
11643 | }; |
11644 | ||
11645 | static int patch_alc268(struct hda_codec *codec) | |
11646 | { | |
11647 | struct alc_spec *spec; | |
11648 | int board_config; | |
11649 | int err; | |
11650 | ||
11651 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | |
11652 | if (spec == NULL) | |
11653 | return -ENOMEM; | |
11654 | ||
11655 | codec->spec = spec; | |
11656 | ||
11657 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | |
11658 | alc268_models, | |
11659 | alc268_cfg_tbl); | |
11660 | ||
11661 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | |
11662 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " | |
11663 | "trying auto-probe from BIOS...\n"); | |
11664 | board_config = ALC268_AUTO; | |
11665 | } | |
11666 | ||
11667 | if (board_config == ALC268_AUTO) { | |
11668 | /* automatic parse from the BIOS config */ | |
11669 | err = alc268_parse_auto_config(codec); | |
11670 | if (err < 0) { | |
11671 | alc_free(codec); | |
11672 | return err; | |
11673 | } else if (!err) { | |
11674 | printk(KERN_INFO | |
11675 | "hda_codec: Cannot set up configuration " | |
11676 | "from BIOS. Using base mode...\n"); | |
11677 | board_config = ALC268_3ST; | |
11678 | } | |
11679 | } | |
11680 | ||
11681 | if (board_config != ALC268_AUTO) | |
11682 | setup_preset(spec, &alc268_presets[board_config]); | |
11683 | ||
2f893286 KY |
11684 | if (codec->vendor_id == 0x10ec0267) { |
11685 | spec->stream_name_analog = "ALC267 Analog"; | |
11686 | spec->stream_name_digital = "ALC267 Digital"; | |
11687 | } else { | |
11688 | spec->stream_name_analog = "ALC268 Analog"; | |
11689 | spec->stream_name_digital = "ALC268 Digital"; | |
11690 | } | |
11691 | ||
a361d84b KY |
11692 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
11693 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | |
6330079f | 11694 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
a361d84b | 11695 | |
a361d84b KY |
11696 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
11697 | ||
aef9d318 TI |
11698 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
11699 | /* override the amp caps for beep generator */ | |
11700 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
11701 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | |
11702 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
11703 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
11704 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
11705 | ||
3866f0b0 TI |
11706 | if (!spec->adc_nids && spec->input_mux) { |
11707 | /* check whether NID 0x07 is valid */ | |
11708 | unsigned int wcap = get_wcaps(codec, 0x07); | |
85860c06 | 11709 | int i; |
3866f0b0 TI |
11710 | |
11711 | /* get type */ | |
11712 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | |
67ebcb03 | 11713 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
3866f0b0 TI |
11714 | spec->adc_nids = alc268_adc_nids_alt; |
11715 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | |
d88897ea | 11716 | add_mixer(spec, alc268_capture_alt_mixer); |
3866f0b0 TI |
11717 | } else { |
11718 | spec->adc_nids = alc268_adc_nids; | |
11719 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | |
d88897ea | 11720 | add_mixer(spec, alc268_capture_mixer); |
a361d84b | 11721 | } |
e1406348 | 11722 | spec->capsrc_nids = alc268_capsrc_nids; |
85860c06 TI |
11723 | /* set default input source */ |
11724 | for (i = 0; i < spec->num_adc_nids; i++) | |
11725 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | |
11726 | 0, AC_VERB_SET_CONNECT_SEL, | |
11727 | spec->input_mux->items[0].index); | |
a361d84b | 11728 | } |
2134ea4f TI |
11729 | |
11730 | spec->vmaster_nid = 0x02; | |
11731 | ||
a361d84b KY |
11732 | codec->patch_ops = alc_patch_ops; |
11733 | if (board_config == ALC268_AUTO) | |
11734 | spec->init_hook = alc268_auto_init; | |
ea1fb29a | 11735 | |
a361d84b KY |
11736 | return 0; |
11737 | } | |
11738 | ||
f6a92248 KY |
11739 | /* |
11740 | * ALC269 channel source setting (2 channel) | |
11741 | */ | |
11742 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | |
11743 | ||
11744 | #define alc269_dac_nids alc260_dac_nids | |
11745 | ||
11746 | static hda_nid_t alc269_adc_nids[1] = { | |
11747 | /* ADC1 */ | |
f53281e6 KY |
11748 | 0x08, |
11749 | }; | |
11750 | ||
e01bf509 TI |
11751 | static hda_nid_t alc269_capsrc_nids[1] = { |
11752 | 0x23, | |
11753 | }; | |
11754 | ||
11755 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), | |
11756 | * not a mux! | |
11757 | */ | |
11758 | ||
f53281e6 KY |
11759 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
11760 | .num_items = 2, | |
11761 | .items = { | |
11762 | { "i-Mic", 0x5 }, | |
11763 | { "e-Mic", 0x0 }, | |
11764 | }, | |
11765 | }; | |
11766 | ||
11767 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { | |
11768 | .num_items = 2, | |
11769 | .items = { | |
11770 | { "i-Mic", 0x1 }, | |
11771 | { "e-Mic", 0x0 }, | |
11772 | }, | |
f6a92248 KY |
11773 | }; |
11774 | ||
11775 | #define alc269_modes alc260_modes | |
11776 | #define alc269_capture_source alc880_lg_lw_capture_source | |
11777 | ||
11778 | static struct snd_kcontrol_new alc269_base_mixer[] = { | |
11779 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
11780 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11781 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
11782 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
11783 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11784 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
2005af24 TI |
11785 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
11786 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
f6a92248 KY |
11787 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
11788 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11789 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11790 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
11791 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11792 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | |
11793 | { } /* end */ | |
11794 | }; | |
11795 | ||
60db6b53 KY |
11796 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
11797 | /* output mixer control */ | |
11798 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | |
11799 | { | |
11800 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11801 | .name = "Master Playback Switch", | |
11802 | .info = snd_hda_mixer_amp_switch_info, | |
11803 | .get = snd_hda_mixer_amp_switch_get, | |
11804 | .put = alc268_acer_master_sw_put, | |
11805 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
11806 | }, | |
11807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
11808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
11809 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
11810 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | |
11811 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | |
11812 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | |
11813 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
11814 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
11815 | { } | |
11816 | }; | |
11817 | ||
f53281e6 KY |
11818 | /* bind volumes of both NID 0x0c and 0x0d */ |
11819 | static struct hda_bind_ctls alc269_epc_bind_vol = { | |
11820 | .ops = &snd_hda_bind_vol, | |
11821 | .values = { | |
11822 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
11823 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
11824 | 0 | |
11825 | }, | |
11826 | }; | |
11827 | ||
11828 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { | |
11829 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
11830 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), | |
11831 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
11832 | { } /* end */ | |
11833 | }; | |
11834 | ||
f6a92248 KY |
11835 | /* capture mixer elements */ |
11836 | static struct snd_kcontrol_new alc269_capture_mixer[] = { | |
f53281e6 KY |
11837 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
11838 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
f6a92248 KY |
11839 | { |
11840 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
11841 | /* The multiple "Capture Source" controls confuse alsamixer | |
11842 | * So call somewhat different.. | |
f6a92248 KY |
11843 | */ |
11844 | /* .name = "Capture Source", */ | |
11845 | .name = "Input Source", | |
11846 | .count = 1, | |
11847 | .info = alc_mux_enum_info, | |
11848 | .get = alc_mux_enum_get, | |
11849 | .put = alc_mux_enum_put, | |
11850 | }, | |
11851 | { } /* end */ | |
11852 | }; | |
11853 | ||
f53281e6 KY |
11854 | /* capture mixer elements */ |
11855 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { | |
11856 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
11857 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
11858 | { } /* end */ | |
11859 | }; | |
11860 | ||
2005af24 TI |
11861 | /* beep control */ |
11862 | static struct snd_kcontrol_new alc269_beep_mixer[] = { | |
11863 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), | |
11864 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), | |
11865 | { } /* end */ | |
11866 | }; | |
11867 | ||
60db6b53 KY |
11868 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
11869 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11870 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11871 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
11872 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | |
11873 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11874 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11875 | { } | |
11876 | }; | |
f6a92248 | 11877 | |
60db6b53 KY |
11878 | /* toggle speaker-output according to the hp-jack state */ |
11879 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | |
11880 | { | |
11881 | unsigned int present; | |
11882 | unsigned char bits; | |
f6a92248 | 11883 | |
60db6b53 KY |
11884 | present = snd_hda_codec_read(codec, 0x15, 0, |
11885 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11886 | bits = present ? AMP_IN_MUTE(0) : 0; | |
11887 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
11888 | AMP_IN_MUTE(0), bits); | |
11889 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
11890 | AMP_IN_MUTE(0), bits); | |
f6a92248 | 11891 | |
60db6b53 KY |
11892 | snd_hda_codec_write(codec, 0x20, 0, |
11893 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
11894 | snd_hda_codec_write(codec, 0x20, 0, | |
11895 | AC_VERB_SET_PROC_COEF, 0x680); | |
f6a92248 | 11896 | |
60db6b53 KY |
11897 | snd_hda_codec_write(codec, 0x20, 0, |
11898 | AC_VERB_SET_COEF_INDEX, 0x0c); | |
11899 | snd_hda_codec_write(codec, 0x20, 0, | |
11900 | AC_VERB_SET_PROC_COEF, 0x480); | |
11901 | } | |
f6a92248 | 11902 | |
60db6b53 KY |
11903 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
11904 | { | |
11905 | unsigned int present; | |
f6a92248 | 11906 | |
60db6b53 KY |
11907 | present = snd_hda_codec_read(codec, 0x18, 0, |
11908 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11909 | snd_hda_codec_write(codec, 0x23, 0, | |
11910 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); | |
11911 | } | |
f6a92248 | 11912 | |
60db6b53 KY |
11913 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
11914 | unsigned int res) | |
11915 | { | |
11916 | if ((res >> 26) == ALC880_HP_EVENT) | |
11917 | alc269_quanta_fl1_speaker_automute(codec); | |
11918 | if ((res >> 26) == ALC880_MIC_EVENT) | |
11919 | alc269_quanta_fl1_mic_automute(codec); | |
11920 | } | |
f6a92248 | 11921 | |
60db6b53 KY |
11922 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
11923 | { | |
11924 | alc269_quanta_fl1_speaker_automute(codec); | |
11925 | alc269_quanta_fl1_mic_automute(codec); | |
11926 | } | |
f6a92248 | 11927 | |
f53281e6 KY |
11928 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
11929 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11930 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | |
11931 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
11932 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | |
11933 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
11934 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11935 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11936 | {} | |
11937 | }; | |
11938 | ||
11939 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { | |
11940 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11941 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
11942 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | |
11943 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | |
11944 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
11945 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
11946 | {} | |
11947 | }; | |
11948 | ||
11949 | /* toggle speaker-output according to the hp-jack state */ | |
11950 | static void alc269_speaker_automute(struct hda_codec *codec) | |
11951 | { | |
11952 | unsigned int present; | |
60db6b53 | 11953 | unsigned char bits; |
f53281e6 KY |
11954 | |
11955 | present = snd_hda_codec_read(codec, 0x15, 0, | |
60db6b53 | 11956 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
f53281e6 KY |
11957 | bits = present ? AMP_IN_MUTE(0) : 0; |
11958 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
60db6b53 | 11959 | AMP_IN_MUTE(0), bits); |
f53281e6 | 11960 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
60db6b53 | 11961 | AMP_IN_MUTE(0), bits); |
f53281e6 KY |
11962 | } |
11963 | ||
11964 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) | |
11965 | { | |
11966 | unsigned int present; | |
11967 | ||
60db6b53 KY |
11968 | present = snd_hda_codec_read(codec, 0x18, 0, |
11969 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
11970 | snd_hda_codec_write(codec, 0x23, 0, | |
11971 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); | |
f53281e6 KY |
11972 | } |
11973 | ||
11974 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) | |
11975 | { | |
11976 | unsigned int present; | |
11977 | ||
60db6b53 KY |
11978 | present = snd_hda_codec_read(codec, 0x18, 0, |
11979 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
f53281e6 | 11980 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
60db6b53 | 11981 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
f53281e6 | 11982 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
60db6b53 | 11983 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
f53281e6 KY |
11984 | } |
11985 | ||
11986 | /* unsolicited event for HP jack sensing */ | |
11987 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, | |
60db6b53 | 11988 | unsigned int res) |
f53281e6 KY |
11989 | { |
11990 | if ((res >> 26) == ALC880_HP_EVENT) | |
11991 | alc269_speaker_automute(codec); | |
11992 | ||
11993 | if ((res >> 26) == ALC880_MIC_EVENT) | |
11994 | alc269_eeepc_dmic_automute(codec); | |
11995 | } | |
11996 | ||
11997 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) | |
11998 | { | |
11999 | alc269_speaker_automute(codec); | |
12000 | alc269_eeepc_dmic_automute(codec); | |
12001 | } | |
12002 | ||
12003 | /* unsolicited event for HP jack sensing */ | |
12004 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, | |
ea1fb29a | 12005 | unsigned int res) |
f53281e6 KY |
12006 | { |
12007 | if ((res >> 26) == ALC880_HP_EVENT) | |
12008 | alc269_speaker_automute(codec); | |
12009 | ||
12010 | if ((res >> 26) == ALC880_MIC_EVENT) | |
12011 | alc269_eeepc_amic_automute(codec); | |
12012 | } | |
12013 | ||
12014 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) | |
12015 | { | |
12016 | alc269_speaker_automute(codec); | |
12017 | alc269_eeepc_amic_automute(codec); | |
12018 | } | |
12019 | ||
60db6b53 KY |
12020 | /* |
12021 | * generic initialization of ADC, input mixers and output mixers | |
12022 | */ | |
12023 | static struct hda_verb alc269_init_verbs[] = { | |
12024 | /* | |
12025 | * Unmute ADC0 and set the default input to mic-in | |
12026 | */ | |
12027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12028 | ||
12029 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the | |
12030 | * analog-loopback mixer widget | |
12031 | * Note: PASD motherboards uses the Line In 2 as the input for | |
12032 | * front panel mic (mic 2) | |
12033 | */ | |
12034 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
12035 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12036 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
12037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
12040 | ||
12041 | /* | |
12042 | * Set up output mixers (0x0c - 0x0e) | |
12043 | */ | |
12044 | /* set vol=0 to output mixers */ | |
12045 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12046 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
12047 | ||
12048 | /* set up input amps for analog loopback */ | |
12049 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
12050 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12051 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12052 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12053 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12054 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12056 | ||
12057 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12058 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
12059 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
12060 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12061 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
12062 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12063 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
12064 | ||
12065 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12066 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12067 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12068 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12069 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12070 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12071 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12072 | ||
12073 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12074 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12075 | ||
12076 | /* FIXME: use matrix-type input source selection */ | |
12077 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | |
12078 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | |
12079 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
12080 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
12082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
12083 | ||
12084 | /* set EAPD */ | |
12085 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12086 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
12087 | { } | |
12088 | }; | |
12089 | ||
f6a92248 KY |
12090 | /* add playback controls from the parsed DAC table */ |
12091 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | |
12092 | const struct auto_pin_cfg *cfg) | |
12093 | { | |
12094 | hda_nid_t nid; | |
12095 | int err; | |
12096 | ||
12097 | spec->multiout.num_dacs = 1; /* only use one dac */ | |
12098 | spec->multiout.dac_nids = spec->private_dac_nids; | |
12099 | spec->multiout.dac_nids[0] = 2; | |
12100 | ||
12101 | nid = cfg->line_out_pins[0]; | |
12102 | if (nid) { | |
12103 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
12104 | "Front Playback Volume", | |
12105 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); | |
12106 | if (err < 0) | |
12107 | return err; | |
12108 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12109 | "Front Playback Switch", | |
12110 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
12111 | if (err < 0) | |
12112 | return err; | |
12113 | } | |
12114 | ||
12115 | nid = cfg->speaker_pins[0]; | |
12116 | if (nid) { | |
12117 | if (!cfg->line_out_pins[0]) { | |
12118 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
12119 | "Speaker Playback Volume", | |
12120 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | |
12121 | HDA_OUTPUT)); | |
12122 | if (err < 0) | |
12123 | return err; | |
12124 | } | |
12125 | if (nid == 0x16) { | |
12126 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12127 | "Speaker Playback Switch", | |
12128 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
12129 | HDA_OUTPUT)); | |
12130 | if (err < 0) | |
12131 | return err; | |
12132 | } else { | |
12133 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12134 | "Speaker Playback Switch", | |
12135 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
12136 | HDA_OUTPUT)); | |
12137 | if (err < 0) | |
12138 | return err; | |
12139 | } | |
12140 | } | |
12141 | nid = cfg->hp_pins[0]; | |
12142 | if (nid) { | |
12143 | /* spec->multiout.hp_nid = 2; */ | |
12144 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { | |
12145 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
12146 | "Headphone Playback Volume", | |
12147 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, | |
12148 | HDA_OUTPUT)); | |
12149 | if (err < 0) | |
12150 | return err; | |
12151 | } | |
12152 | if (nid == 0x16) { | |
12153 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12154 | "Headphone Playback Switch", | |
12155 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
12156 | HDA_OUTPUT)); | |
12157 | if (err < 0) | |
12158 | return err; | |
12159 | } else { | |
12160 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | |
12161 | "Headphone Playback Switch", | |
12162 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
12163 | HDA_OUTPUT)); | |
12164 | if (err < 0) | |
12165 | return err; | |
12166 | } | |
12167 | } | |
12168 | return 0; | |
12169 | } | |
12170 | ||
ee956e09 TI |
12171 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
12172 | const struct auto_pin_cfg *cfg) | |
12173 | { | |
12174 | int err; | |
12175 | ||
12176 | err = alc880_auto_create_analog_input_ctls(spec, cfg); | |
12177 | if (err < 0) | |
12178 | return err; | |
12179 | /* digital-mic input pin is excluded in alc880_auto_create..() | |
12180 | * because it's under 0x18 | |
12181 | */ | |
12182 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | |
12183 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | |
12184 | struct hda_input_mux *imux = &spec->private_imux; | |
12185 | imux->items[imux->num_items].label = "Int Mic"; | |
12186 | imux->items[imux->num_items].index = 0x05; | |
12187 | imux->num_items++; | |
12188 | } | |
12189 | return 0; | |
12190 | } | |
f6a92248 KY |
12191 | |
12192 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
12193 | #define alc269_loopbacks alc880_loopbacks | |
12194 | #endif | |
12195 | ||
12196 | /* pcm configuration: identiacal with ALC880 */ | |
12197 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback | |
12198 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | |
12199 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | |
12200 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | |
12201 | ||
12202 | /* | |
12203 | * BIOS auto configuration | |
12204 | */ | |
12205 | static int alc269_parse_auto_config(struct hda_codec *codec) | |
12206 | { | |
12207 | struct alc_spec *spec = codec->spec; | |
2005af24 | 12208 | int i, err; |
f6a92248 KY |
12209 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
12210 | ||
12211 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
12212 | alc269_ignore); | |
12213 | if (err < 0) | |
12214 | return err; | |
12215 | ||
12216 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
12217 | if (err < 0) | |
12218 | return err; | |
12219 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
12220 | if (err < 0) | |
12221 | return err; | |
12222 | ||
12223 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
12224 | ||
12225 | if (spec->autocfg.dig_out_pin) | |
12226 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; | |
12227 | ||
603c4019 | 12228 | if (spec->kctls.list) |
d88897ea | 12229 | add_mixer(spec, spec->kctls.list); |
f6a92248 | 12230 | |
2005af24 TI |
12231 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
12232 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) | |
12233 | if (spec->autocfg.input_pins[i] == 0x1d) | |
12234 | break; | |
12235 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) | |
d88897ea | 12236 | add_mixer(spec, alc269_beep_mixer); |
2005af24 | 12237 | |
d88897ea | 12238 | add_verb(spec, alc269_init_verbs); |
f6a92248 KY |
12239 | spec->num_mux_defs = 1; |
12240 | spec->input_mux = &spec->private_imux; | |
e01bf509 TI |
12241 | /* set default input source */ |
12242 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], | |
12243 | 0, AC_VERB_SET_CONNECT_SEL, | |
12244 | spec->input_mux->items[0].index); | |
f6a92248 KY |
12245 | |
12246 | err = alc_auto_add_mic_boost(codec); | |
12247 | if (err < 0) | |
12248 | return err; | |
12249 | ||
d88897ea | 12250 | add_mixer(spec, alc269_capture_mixer); |
f53281e6 | 12251 | |
e044c39a | 12252 | store_pin_configs(codec); |
f6a92248 KY |
12253 | return 1; |
12254 | } | |
12255 | ||
12256 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out | |
12257 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out | |
12258 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | |
12259 | ||
12260 | ||
12261 | /* init callback for auto-configuration model -- overriding the default init */ | |
12262 | static void alc269_auto_init(struct hda_codec *codec) | |
12263 | { | |
f6c7e546 | 12264 | struct alc_spec *spec = codec->spec; |
f6a92248 KY |
12265 | alc269_auto_init_multi_out(codec); |
12266 | alc269_auto_init_hp_out(codec); | |
12267 | alc269_auto_init_analog_input(codec); | |
f6c7e546 | 12268 | if (spec->unsol_event) |
7fb0d78f | 12269 | alc_inithook(codec); |
f6a92248 KY |
12270 | } |
12271 | ||
12272 | /* | |
12273 | * configuration and preset | |
12274 | */ | |
12275 | static const char *alc269_models[ALC269_MODEL_LAST] = { | |
60db6b53 | 12276 | [ALC269_BASIC] = "basic", |
2922c9af TI |
12277 | [ALC269_QUANTA_FL1] = "quanta", |
12278 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", | |
12279 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901" | |
f6a92248 KY |
12280 | }; |
12281 | ||
12282 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | |
60db6b53 | 12283 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
f53281e6 KY |
12284 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
12285 | ALC269_ASUS_EEEPC_P703), | |
12286 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | |
12287 | ALC269_ASUS_EEEPC_P901), | |
60db6b53 KY |
12288 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
12289 | ALC269_ASUS_EEEPC_P901), | |
f6a92248 KY |
12290 | {} |
12291 | }; | |
12292 | ||
12293 | static struct alc_config_preset alc269_presets[] = { | |
12294 | [ALC269_BASIC] = { | |
f53281e6 | 12295 | .mixers = { alc269_base_mixer, alc269_capture_mixer }, |
f6a92248 KY |
12296 | .init_verbs = { alc269_init_verbs }, |
12297 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12298 | .dac_nids = alc269_dac_nids, | |
12299 | .hp_nid = 0x03, | |
12300 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12301 | .channel_mode = alc269_modes, | |
12302 | .input_mux = &alc269_capture_source, | |
12303 | }, | |
60db6b53 KY |
12304 | [ALC269_QUANTA_FL1] = { |
12305 | .mixers = { alc269_quanta_fl1_mixer }, | |
12306 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | |
12307 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12308 | .dac_nids = alc269_dac_nids, | |
12309 | .hp_nid = 0x03, | |
12310 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12311 | .channel_mode = alc269_modes, | |
12312 | .input_mux = &alc269_capture_source, | |
12313 | .unsol_event = alc269_quanta_fl1_unsol_event, | |
12314 | .init_hook = alc269_quanta_fl1_init_hook, | |
12315 | }, | |
f53281e6 KY |
12316 | [ALC269_ASUS_EEEPC_P703] = { |
12317 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, | |
12318 | .init_verbs = { alc269_init_verbs, | |
12319 | alc269_eeepc_amic_init_verbs }, | |
12320 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12321 | .dac_nids = alc269_dac_nids, | |
12322 | .hp_nid = 0x03, | |
12323 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12324 | .channel_mode = alc269_modes, | |
12325 | .input_mux = &alc269_eeepc_amic_capture_source, | |
12326 | .unsol_event = alc269_eeepc_amic_unsol_event, | |
12327 | .init_hook = alc269_eeepc_amic_inithook, | |
12328 | }, | |
12329 | [ALC269_ASUS_EEEPC_P901] = { | |
12330 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer}, | |
12331 | .init_verbs = { alc269_init_verbs, | |
12332 | alc269_eeepc_dmic_init_verbs }, | |
12333 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | |
12334 | .dac_nids = alc269_dac_nids, | |
12335 | .hp_nid = 0x03, | |
12336 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | |
12337 | .channel_mode = alc269_modes, | |
12338 | .input_mux = &alc269_eeepc_dmic_capture_source, | |
12339 | .unsol_event = alc269_eeepc_dmic_unsol_event, | |
12340 | .init_hook = alc269_eeepc_dmic_inithook, | |
12341 | }, | |
f6a92248 KY |
12342 | }; |
12343 | ||
12344 | static int patch_alc269(struct hda_codec *codec) | |
12345 | { | |
12346 | struct alc_spec *spec; | |
12347 | int board_config; | |
12348 | int err; | |
12349 | ||
12350 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
12351 | if (spec == NULL) | |
12352 | return -ENOMEM; | |
12353 | ||
12354 | codec->spec = spec; | |
12355 | ||
2c3bf9ab TI |
12356 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
12357 | ||
f6a92248 KY |
12358 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
12359 | alc269_models, | |
12360 | alc269_cfg_tbl); | |
12361 | ||
12362 | if (board_config < 0) { | |
12363 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " | |
12364 | "trying auto-probe from BIOS...\n"); | |
12365 | board_config = ALC269_AUTO; | |
12366 | } | |
12367 | ||
12368 | if (board_config == ALC269_AUTO) { | |
12369 | /* automatic parse from the BIOS config */ | |
12370 | err = alc269_parse_auto_config(codec); | |
12371 | if (err < 0) { | |
12372 | alc_free(codec); | |
12373 | return err; | |
12374 | } else if (!err) { | |
12375 | printk(KERN_INFO | |
12376 | "hda_codec: Cannot set up configuration " | |
12377 | "from BIOS. Using base mode...\n"); | |
12378 | board_config = ALC269_BASIC; | |
12379 | } | |
12380 | } | |
12381 | ||
12382 | if (board_config != ALC269_AUTO) | |
12383 | setup_preset(spec, &alc269_presets[board_config]); | |
12384 | ||
12385 | spec->stream_name_analog = "ALC269 Analog"; | |
12386 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | |
12387 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | |
12388 | ||
12389 | spec->stream_name_digital = "ALC269 Digital"; | |
12390 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | |
12391 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | |
12392 | ||
12393 | spec->adc_nids = alc269_adc_nids; | |
12394 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | |
e01bf509 | 12395 | spec->capsrc_nids = alc269_capsrc_nids; |
f6a92248 KY |
12396 | |
12397 | codec->patch_ops = alc_patch_ops; | |
12398 | if (board_config == ALC269_AUTO) | |
12399 | spec->init_hook = alc269_auto_init; | |
12400 | #ifdef CONFIG_SND_HDA_POWER_SAVE | |
12401 | if (!spec->loopback.amplist) | |
12402 | spec->loopback.amplist = alc269_loopbacks; | |
12403 | #endif | |
12404 | ||
12405 | return 0; | |
12406 | } | |
12407 | ||
df694daa KY |
12408 | /* |
12409 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | |
12410 | */ | |
12411 | ||
12412 | /* | |
12413 | * set the path ways for 2 channel output | |
12414 | * need to set the codec line out and mic 1 pin widgets to inputs | |
12415 | */ | |
12416 | static struct hda_verb alc861_threestack_ch2_init[] = { | |
12417 | /* set pin widget 1Ah (line in) for input */ | |
12418 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
12419 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
12420 | * the vref | |
12421 | */ | |
df694daa KY |
12422 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
12423 | ||
9c7f852e TI |
12424 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
12425 | #if 0 | |
12426 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
12427 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
12428 | #endif | |
df694daa KY |
12429 | { } /* end */ |
12430 | }; | |
12431 | /* | |
12432 | * 6ch mode | |
12433 | * need to set the codec line out and mic 1 pin widgets to outputs | |
12434 | */ | |
12435 | static struct hda_verb alc861_threestack_ch6_init[] = { | |
12436 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
12437 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12438 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
12439 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12440 | ||
12441 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
9c7f852e | 12442 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa | 12443 | |
9c7f852e TI |
12444 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
12445 | #if 0 | |
12446 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
12447 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
12448 | #endif | |
df694daa KY |
12449 | { } /* end */ |
12450 | }; | |
12451 | ||
12452 | static struct hda_channel_mode alc861_threestack_modes[2] = { | |
12453 | { 2, alc861_threestack_ch2_init }, | |
12454 | { 6, alc861_threestack_ch6_init }, | |
12455 | }; | |
22309c3e TI |
12456 | /* Set mic1 as input and unmute the mixer */ |
12457 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | |
12458 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12459 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
12460 | { } /* end */ | |
12461 | }; | |
12462 | /* Set mic1 as output and mute mixer */ | |
12463 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | |
12464 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12465 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
12466 | { } /* end */ | |
12467 | }; | |
12468 | ||
12469 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | |
12470 | { 2, alc861_uniwill_m31_ch2_init }, | |
12471 | { 4, alc861_uniwill_m31_ch4_init }, | |
12472 | }; | |
df694daa | 12473 | |
7cdbff94 MD |
12474 | /* Set mic1 and line-in as input and unmute the mixer */ |
12475 | static struct hda_verb alc861_asus_ch2_init[] = { | |
12476 | /* set pin widget 1Ah (line in) for input */ | |
12477 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
f12ab1e0 TI |
12478 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
12479 | * the vref | |
12480 | */ | |
7cdbff94 MD |
12481 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
12482 | ||
12483 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | |
12484 | #if 0 | |
12485 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | |
12486 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | |
12487 | #endif | |
12488 | { } /* end */ | |
12489 | }; | |
12490 | /* Set mic1 nad line-in as output and mute mixer */ | |
12491 | static struct hda_verb alc861_asus_ch6_init[] = { | |
12492 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | |
12493 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12494 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
12495 | /* set pin widget 18h (mic1) for output (CLFE)*/ | |
12496 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12497 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | |
12498 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12499 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12500 | ||
12501 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | |
12502 | #if 0 | |
12503 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | |
12504 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | |
12505 | #endif | |
12506 | { } /* end */ | |
12507 | }; | |
12508 | ||
12509 | static struct hda_channel_mode alc861_asus_modes[2] = { | |
12510 | { 2, alc861_asus_ch2_init }, | |
12511 | { 6, alc861_asus_ch6_init }, | |
12512 | }; | |
12513 | ||
df694daa KY |
12514 | /* patch-ALC861 */ |
12515 | ||
12516 | static struct snd_kcontrol_new alc861_base_mixer[] = { | |
12517 | /* output mixer control */ | |
12518 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12519 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
12520 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
12521 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
12522 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
12523 | ||
12524 | /*Input mixer control */ | |
12525 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
12526 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
12527 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
12528 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12529 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
12530 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
12531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
12533 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
12534 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 12535 | |
df694daa KY |
12536 | /* Capture mixer control */ |
12537 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
12538 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
12539 | { | |
12540 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12541 | .name = "Capture Source", | |
12542 | .count = 1, | |
12543 | .info = alc_mux_enum_info, | |
12544 | .get = alc_mux_enum_get, | |
12545 | .put = alc_mux_enum_put, | |
12546 | }, | |
12547 | { } /* end */ | |
12548 | }; | |
12549 | ||
12550 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | |
12551 | /* output mixer control */ | |
12552 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12553 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
12554 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
12555 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
12556 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
12557 | ||
12558 | /* Input mixer control */ | |
12559 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
12560 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
12561 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
12562 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12563 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
12564 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
12565 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12566 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
12567 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
12568 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 12569 | |
df694daa KY |
12570 | /* Capture mixer control */ |
12571 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
12572 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
12573 | { | |
12574 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12575 | .name = "Capture Source", | |
12576 | .count = 1, | |
12577 | .info = alc_mux_enum_info, | |
12578 | .get = alc_mux_enum_get, | |
12579 | .put = alc_mux_enum_put, | |
12580 | }, | |
12581 | { | |
12582 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12583 | .name = "Channel Mode", | |
12584 | .info = alc_ch_mode_info, | |
12585 | .get = alc_ch_mode_get, | |
12586 | .put = alc_ch_mode_put, | |
12587 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | |
12588 | }, | |
12589 | { } /* end */ | |
a53d1aec TD |
12590 | }; |
12591 | ||
d1d985f0 | 12592 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
a53d1aec TD |
12593 | /* output mixer control */ |
12594 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12595 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12596 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
ea1fb29a | 12597 | |
a53d1aec TD |
12598 | /*Capture mixer control */ |
12599 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
12600 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
12601 | { | |
12602 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12603 | .name = "Capture Source", | |
12604 | .count = 1, | |
12605 | .info = alc_mux_enum_info, | |
12606 | .get = alc_mux_enum_get, | |
12607 | .put = alc_mux_enum_put, | |
12608 | }, | |
12609 | ||
12610 | { } /* end */ | |
f12ab1e0 | 12611 | }; |
a53d1aec | 12612 | |
22309c3e TI |
12613 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
12614 | /* output mixer control */ | |
12615 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12616 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
12617 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
12618 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
12619 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | |
12620 | ||
12621 | /* Input mixer control */ | |
12622 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
12623 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | |
12624 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
12625 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12626 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
12627 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
12628 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12629 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
12630 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
12631 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | |
f12ab1e0 | 12632 | |
22309c3e TI |
12633 | /* Capture mixer control */ |
12634 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
12635 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
12636 | { | |
12637 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12638 | .name = "Capture Source", | |
12639 | .count = 1, | |
12640 | .info = alc_mux_enum_info, | |
12641 | .get = alc_mux_enum_get, | |
12642 | .put = alc_mux_enum_put, | |
12643 | }, | |
12644 | { | |
12645 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12646 | .name = "Channel Mode", | |
12647 | .info = alc_ch_mode_info, | |
12648 | .get = alc_ch_mode_get, | |
12649 | .put = alc_ch_mode_put, | |
12650 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
12651 | }, | |
12652 | { } /* end */ | |
f12ab1e0 | 12653 | }; |
7cdbff94 MD |
12654 | |
12655 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | |
12656 | /* output mixer control */ | |
12657 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | |
12658 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | |
12659 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | |
12660 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | |
12661 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | |
12662 | ||
12663 | /* Input mixer control */ | |
12664 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | |
12665 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
12666 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | |
12667 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12668 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | |
12669 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | |
12670 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | |
12671 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | |
12672 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | |
f12ab1e0 TI |
12673 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
12674 | ||
7cdbff94 MD |
12675 | /* Capture mixer control */ |
12676 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
12677 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
12678 | { | |
12679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12680 | .name = "Capture Source", | |
12681 | .count = 1, | |
12682 | .info = alc_mux_enum_info, | |
12683 | .get = alc_mux_enum_get, | |
12684 | .put = alc_mux_enum_put, | |
12685 | }, | |
12686 | { | |
12687 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
12688 | .name = "Channel Mode", | |
12689 | .info = alc_ch_mode_info, | |
12690 | .get = alc_ch_mode_get, | |
12691 | .put = alc_ch_mode_put, | |
12692 | .private_value = ARRAY_SIZE(alc861_asus_modes), | |
12693 | }, | |
12694 | { } | |
56bb0cab TI |
12695 | }; |
12696 | ||
12697 | /* additional mixer */ | |
d1d985f0 | 12698 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
56bb0cab TI |
12699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
12700 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | |
12701 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), | |
12702 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), | |
12703 | { } | |
12704 | }; | |
7cdbff94 | 12705 | |
df694daa KY |
12706 | /* |
12707 | * generic initialization of ADC, input mixers and output mixers | |
12708 | */ | |
12709 | static struct hda_verb alc861_base_init_verbs[] = { | |
12710 | /* | |
12711 | * Unmute ADC0 and set the default input to mic-in | |
12712 | */ | |
12713 | /* port-A for surround (rear panel) */ | |
12714 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12715 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12716 | /* port-B for mic-in (rear panel) with vref */ | |
12717 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12718 | /* port-C for line-in (rear panel) */ | |
12719 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12720 | /* port-D for Front */ | |
12721 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12722 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12723 | /* port-E for HP out (front panel) */ | |
12724 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
12725 | /* route front PCM to HP */ | |
9dece1d7 | 12726 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
12727 | /* port-F for mic-in (front panel) with vref */ |
12728 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12729 | /* port-G for CLFE (rear panel) */ | |
12730 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12731 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12732 | /* port-H for side (rear panel) */ | |
12733 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12734 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12735 | /* CD-in */ | |
12736 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12737 | /* route front mic to ADC1*/ | |
12738 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12739 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
ea1fb29a | 12740 | |
df694daa KY |
12741 | /* Unmute DAC0~3 & spdif out*/ |
12742 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12743 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12744 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12745 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12746 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 12747 | |
df694daa KY |
12748 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12749 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12750 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12751 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12752 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12753 | |
df694daa KY |
12754 | /* Unmute Stereo Mixer 15 */ |
12755 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12756 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12757 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 12758 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
12759 | |
12760 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12761 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12762 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12763 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12764 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12765 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12766 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12767 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
12768 | /* hp used DAC 3 (Front) */ |
12769 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
12770 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12771 | ||
12772 | { } | |
12773 | }; | |
12774 | ||
12775 | static struct hda_verb alc861_threestack_init_verbs[] = { | |
12776 | /* | |
12777 | * Unmute ADC0 and set the default input to mic-in | |
12778 | */ | |
12779 | /* port-A for surround (rear panel) */ | |
12780 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12781 | /* port-B for mic-in (rear panel) with vref */ | |
12782 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12783 | /* port-C for line-in (rear panel) */ | |
12784 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12785 | /* port-D for Front */ | |
12786 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12787 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12788 | /* port-E for HP out (front panel) */ | |
12789 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | |
12790 | /* route front PCM to HP */ | |
9dece1d7 | 12791 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
df694daa KY |
12792 | /* port-F for mic-in (front panel) with vref */ |
12793 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12794 | /* port-G for CLFE (rear panel) */ | |
12795 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12796 | /* port-H for side (rear panel) */ | |
12797 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12798 | /* CD-in */ | |
12799 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12800 | /* route front mic to ADC1*/ | |
12801 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12802 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12803 | /* Unmute DAC0~3 & spdif out*/ | |
12804 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12805 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12806 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12807 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12808 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 12809 | |
df694daa KY |
12810 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12811 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12812 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12813 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12814 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12815 | |
df694daa KY |
12816 | /* Unmute Stereo Mixer 15 */ |
12817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12818 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12819 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 12820 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
df694daa KY |
12821 | |
12822 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12823 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12824 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12825 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12826 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12827 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12828 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12829 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
12830 | /* hp used DAC 3 (Front) */ |
12831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
12832 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12833 | { } | |
12834 | }; | |
22309c3e TI |
12835 | |
12836 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |
12837 | /* | |
12838 | * Unmute ADC0 and set the default input to mic-in | |
12839 | */ | |
12840 | /* port-A for surround (rear panel) */ | |
12841 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12842 | /* port-B for mic-in (rear panel) with vref */ | |
12843 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12844 | /* port-C for line-in (rear panel) */ | |
12845 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12846 | /* port-D for Front */ | |
12847 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12848 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12849 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
12850 | /* this has to be set to VREF80 */ |
12851 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
22309c3e | 12852 | /* route front PCM to HP */ |
9dece1d7 | 12853 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
22309c3e TI |
12854 | /* port-F for mic-in (front panel) with vref */ |
12855 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12856 | /* port-G for CLFE (rear panel) */ | |
12857 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12858 | /* port-H for side (rear panel) */ | |
12859 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
12860 | /* CD-in */ | |
12861 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12862 | /* route front mic to ADC1*/ | |
12863 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12864 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12865 | /* Unmute DAC0~3 & spdif out*/ | |
12866 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12867 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12868 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12869 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12870 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 12871 | |
22309c3e TI |
12872 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12873 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12874 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12875 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12876 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12877 | |
22309c3e TI |
12878 | /* Unmute Stereo Mixer 15 */ |
12879 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12880 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12881 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 12882 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
22309c3e TI |
12883 | |
12884 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12885 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12886 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12887 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12888 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12889 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12890 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12891 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
12892 | /* hp used DAC 3 (Front) */ |
12893 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
22309c3e TI |
12894 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12895 | { } | |
12896 | }; | |
12897 | ||
7cdbff94 MD |
12898 | static struct hda_verb alc861_asus_init_verbs[] = { |
12899 | /* | |
12900 | * Unmute ADC0 and set the default input to mic-in | |
12901 | */ | |
f12ab1e0 TI |
12902 | /* port-A for surround (rear panel) |
12903 | * according to codec#0 this is the HP jack | |
12904 | */ | |
7cdbff94 MD |
12905 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
12906 | /* route front PCM to HP */ | |
12907 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
12908 | /* port-B for mic-in (rear panel) with vref */ | |
12909 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12910 | /* port-C for line-in (rear panel) */ | |
12911 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12912 | /* port-D for Front */ | |
12913 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12914 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | |
12915 | /* port-E for HP out (front panel) */ | |
f12ab1e0 TI |
12916 | /* this has to be set to VREF80 */ |
12917 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
7cdbff94 | 12918 | /* route front PCM to HP */ |
9dece1d7 | 12919 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
7cdbff94 MD |
12920 | /* port-F for mic-in (front panel) with vref */ |
12921 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | |
12922 | /* port-G for CLFE (rear panel) */ | |
12923 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12924 | /* port-H for side (rear panel) */ | |
12925 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | |
12926 | /* CD-in */ | |
12927 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | |
12928 | /* route front mic to ADC1*/ | |
12929 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
12930 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12931 | /* Unmute DAC0~3 & spdif out*/ | |
12932 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12933 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12934 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12935 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
12937 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | |
12938 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12939 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12940 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12941 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12942 | |
7cdbff94 MD |
12943 | /* Unmute Stereo Mixer 15 */ |
12944 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12945 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12946 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f12ab1e0 | 12947 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
7cdbff94 MD |
12948 | |
12949 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12950 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12951 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12952 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12953 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12954 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12955 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12956 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
f12ab1e0 TI |
12957 | /* hp used DAC 3 (Front) */ |
12958 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
7cdbff94 MD |
12959 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
12960 | { } | |
12961 | }; | |
12962 | ||
56bb0cab TI |
12963 | /* additional init verbs for ASUS laptops */ |
12964 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | |
12965 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | |
12966 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | |
12967 | { } | |
12968 | }; | |
7cdbff94 | 12969 | |
df694daa KY |
12970 | /* |
12971 | * generic initialization of ADC, input mixers and output mixers | |
12972 | */ | |
12973 | static struct hda_verb alc861_auto_init_verbs[] = { | |
12974 | /* | |
12975 | * Unmute ADC0 and set the default input to mic-in | |
12976 | */ | |
f12ab1e0 | 12977 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
df694daa | 12978 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
ea1fb29a | 12979 | |
df694daa KY |
12980 | /* Unmute DAC0~3 & spdif out*/ |
12981 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12982 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12983 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12984 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
12985 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
ea1fb29a | 12986 | |
df694daa KY |
12987 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12988 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12989 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12990 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12991 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
ea1fb29a | 12992 | |
df694daa KY |
12993 | /* Unmute Stereo Mixer 15 */ |
12994 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
12995 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
12996 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
12997 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | |
12998 | ||
12999 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13000 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13001 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13002 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13003 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13004 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13005 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13006 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13007 | ||
13008 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13009 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
f12ab1e0 TI |
13010 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
13011 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa KY |
13012 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13013 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
f12ab1e0 TI |
13014 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
13015 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | |
df694daa | 13016 | |
f12ab1e0 | 13017 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
df694daa KY |
13018 | |
13019 | { } | |
13020 | }; | |
13021 | ||
a53d1aec TD |
13022 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
13023 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f12ab1e0 | 13024 | |
a53d1aec TD |
13025 | { } |
13026 | }; | |
13027 | ||
13028 | /* toggle speaker-output according to the hp-jack state */ | |
13029 | static void alc861_toshiba_automute(struct hda_codec *codec) | |
13030 | { | |
13031 | unsigned int present; | |
13032 | ||
13033 | present = snd_hda_codec_read(codec, 0x0f, 0, | |
13034 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
13035 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
13036 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
13037 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | |
13038 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | |
a53d1aec TD |
13039 | } |
13040 | ||
13041 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | |
13042 | unsigned int res) | |
13043 | { | |
a53d1aec TD |
13044 | if ((res >> 26) == ALC880_HP_EVENT) |
13045 | alc861_toshiba_automute(codec); | |
13046 | } | |
13047 | ||
df694daa KY |
13048 | /* pcm configuration: identiacal with ALC880 */ |
13049 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback | |
13050 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | |
13051 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | |
13052 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | |
13053 | ||
13054 | ||
13055 | #define ALC861_DIGOUT_NID 0x07 | |
13056 | ||
13057 | static struct hda_channel_mode alc861_8ch_modes[1] = { | |
13058 | { 8, NULL } | |
13059 | }; | |
13060 | ||
13061 | static hda_nid_t alc861_dac_nids[4] = { | |
13062 | /* front, surround, clfe, side */ | |
13063 | 0x03, 0x06, 0x05, 0x04 | |
13064 | }; | |
13065 | ||
9c7f852e TI |
13066 | static hda_nid_t alc660_dac_nids[3] = { |
13067 | /* front, clfe, surround */ | |
13068 | 0x03, 0x05, 0x06 | |
13069 | }; | |
13070 | ||
df694daa KY |
13071 | static hda_nid_t alc861_adc_nids[1] = { |
13072 | /* ADC0-2 */ | |
13073 | 0x08, | |
13074 | }; | |
13075 | ||
13076 | static struct hda_input_mux alc861_capture_source = { | |
13077 | .num_items = 5, | |
13078 | .items = { | |
13079 | { "Mic", 0x0 }, | |
13080 | { "Front Mic", 0x3 }, | |
13081 | { "Line", 0x1 }, | |
13082 | { "CD", 0x4 }, | |
13083 | { "Mixer", 0x5 }, | |
13084 | }, | |
13085 | }; | |
13086 | ||
13087 | /* fill in the dac_nids table from the parsed pin configuration */ | |
f12ab1e0 TI |
13088 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
13089 | const struct auto_pin_cfg *cfg) | |
df694daa KY |
13090 | { |
13091 | int i; | |
13092 | hda_nid_t nid; | |
13093 | ||
13094 | spec->multiout.dac_nids = spec->private_dac_nids; | |
13095 | for (i = 0; i < cfg->line_outs; i++) { | |
13096 | nid = cfg->line_out_pins[i]; | |
13097 | if (nid) { | |
13098 | if (i >= ARRAY_SIZE(alc861_dac_nids)) | |
13099 | continue; | |
13100 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; | |
13101 | } | |
13102 | } | |
13103 | spec->multiout.num_dacs = cfg->line_outs; | |
13104 | return 0; | |
13105 | } | |
13106 | ||
13107 | /* add playback controls from the parsed DAC table */ | |
13108 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, | |
13109 | const struct auto_pin_cfg *cfg) | |
13110 | { | |
13111 | char name[32]; | |
f12ab1e0 TI |
13112 | static const char *chname[4] = { |
13113 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
13114 | }; | |
df694daa KY |
13115 | hda_nid_t nid; |
13116 | int i, idx, err; | |
13117 | ||
13118 | for (i = 0; i < cfg->line_outs; i++) { | |
13119 | nid = spec->multiout.dac_nids[i]; | |
f12ab1e0 | 13120 | if (!nid) |
df694daa KY |
13121 | continue; |
13122 | if (nid == 0x05) { | |
13123 | /* Center/LFE */ | |
f12ab1e0 TI |
13124 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
13125 | "Center Playback Switch", | |
13126 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | |
13127 | HDA_OUTPUT)); | |
13128 | if (err < 0) | |
df694daa | 13129 | return err; |
f12ab1e0 TI |
13130 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
13131 | "LFE Playback Switch", | |
13132 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | |
13133 | HDA_OUTPUT)); | |
13134 | if (err < 0) | |
df694daa KY |
13135 | return err; |
13136 | } else { | |
f12ab1e0 TI |
13137 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
13138 | idx++) | |
df694daa KY |
13139 | if (nid == alc861_dac_nids[idx]) |
13140 | break; | |
13141 | sprintf(name, "%s Playback Switch", chname[idx]); | |
f12ab1e0 TI |
13142 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
13143 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | |
13144 | HDA_OUTPUT)); | |
13145 | if (err < 0) | |
df694daa KY |
13146 | return err; |
13147 | } | |
13148 | } | |
13149 | return 0; | |
13150 | } | |
13151 | ||
13152 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | |
13153 | { | |
13154 | int err; | |
13155 | hda_nid_t nid; | |
13156 | ||
f12ab1e0 | 13157 | if (!pin) |
df694daa KY |
13158 | return 0; |
13159 | ||
13160 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | |
13161 | nid = 0x03; | |
f12ab1e0 TI |
13162 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
13163 | "Headphone Playback Switch", | |
13164 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
13165 | if (err < 0) | |
df694daa KY |
13166 | return err; |
13167 | spec->multiout.hp_nid = nid; | |
13168 | } | |
13169 | return 0; | |
13170 | } | |
13171 | ||
13172 | /* create playback/capture controls for input pins */ | |
f12ab1e0 TI |
13173 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
13174 | const struct auto_pin_cfg *cfg) | |
df694daa | 13175 | { |
df694daa KY |
13176 | struct hda_input_mux *imux = &spec->private_imux; |
13177 | int i, err, idx, idx1; | |
13178 | ||
13179 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
f12ab1e0 | 13180 | switch (cfg->input_pins[i]) { |
df694daa KY |
13181 | case 0x0c: |
13182 | idx1 = 1; | |
f12ab1e0 | 13183 | idx = 2; /* Line In */ |
df694daa KY |
13184 | break; |
13185 | case 0x0f: | |
13186 | idx1 = 2; | |
f12ab1e0 | 13187 | idx = 2; /* Line In */ |
df694daa KY |
13188 | break; |
13189 | case 0x0d: | |
13190 | idx1 = 0; | |
f12ab1e0 | 13191 | idx = 1; /* Mic In */ |
df694daa | 13192 | break; |
f12ab1e0 | 13193 | case 0x10: |
df694daa | 13194 | idx1 = 3; |
f12ab1e0 | 13195 | idx = 1; /* Mic In */ |
df694daa KY |
13196 | break; |
13197 | case 0x11: | |
13198 | idx1 = 4; | |
f12ab1e0 | 13199 | idx = 0; /* CD */ |
df694daa KY |
13200 | break; |
13201 | default: | |
13202 | continue; | |
13203 | } | |
13204 | ||
4a471b7d TI |
13205 | err = new_analog_input(spec, cfg->input_pins[i], |
13206 | auto_pin_cfg_labels[i], idx, 0x15); | |
df694daa KY |
13207 | if (err < 0) |
13208 | return err; | |
13209 | ||
4a471b7d | 13210 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
df694daa | 13211 | imux->items[imux->num_items].index = idx1; |
f12ab1e0 | 13212 | imux->num_items++; |
df694daa KY |
13213 | } |
13214 | return 0; | |
13215 | } | |
13216 | ||
13217 | static struct snd_kcontrol_new alc861_capture_mixer[] = { | |
13218 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | |
13219 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | |
13220 | ||
13221 | { | |
13222 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13223 | /* The multiple "Capture Source" controls confuse alsamixer | |
13224 | * So call somewhat different.. | |
df694daa KY |
13225 | */ |
13226 | /* .name = "Capture Source", */ | |
13227 | .name = "Input Source", | |
13228 | .count = 1, | |
13229 | .info = alc_mux_enum_info, | |
13230 | .get = alc_mux_enum_get, | |
13231 | .put = alc_mux_enum_put, | |
13232 | }, | |
13233 | { } /* end */ | |
13234 | }; | |
13235 | ||
f12ab1e0 TI |
13236 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
13237 | hda_nid_t nid, | |
df694daa KY |
13238 | int pin_type, int dac_idx) |
13239 | { | |
564c5bea JL |
13240 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
13241 | pin_type); | |
13242 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
13243 | AMP_OUT_UNMUTE); | |
df694daa KY |
13244 | } |
13245 | ||
13246 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | |
13247 | { | |
13248 | struct alc_spec *spec = codec->spec; | |
13249 | int i; | |
13250 | ||
bc9f98a9 | 13251 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
df694daa KY |
13252 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
13253 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 13254 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
df694daa | 13255 | if (nid) |
baba8ee9 | 13256 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
f12ab1e0 | 13257 | spec->multiout.dac_nids[i]); |
df694daa KY |
13258 | } |
13259 | } | |
13260 | ||
13261 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | |
13262 | { | |
13263 | struct alc_spec *spec = codec->spec; | |
13264 | hda_nid_t pin; | |
13265 | ||
eb06ed8f | 13266 | pin = spec->autocfg.hp_pins[0]; |
df694daa | 13267 | if (pin) /* connect to front */ |
f12ab1e0 TI |
13268 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
13269 | spec->multiout.dac_nids[0]); | |
f6c7e546 TI |
13270 | pin = spec->autocfg.speaker_pins[0]; |
13271 | if (pin) | |
13272 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
df694daa KY |
13273 | } |
13274 | ||
13275 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | |
13276 | { | |
13277 | struct alc_spec *spec = codec->spec; | |
13278 | int i; | |
13279 | ||
13280 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
13281 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
f12ab1e0 TI |
13282 | if (nid >= 0x0c && nid <= 0x11) { |
13283 | snd_hda_codec_write(codec, nid, 0, | |
13284 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
13285 | i <= AUTO_PIN_FRONT_MIC ? | |
13286 | PIN_VREF80 : PIN_IN); | |
df694daa KY |
13287 | } |
13288 | } | |
13289 | } | |
13290 | ||
13291 | /* parse the BIOS configuration and set up the alc_spec */ | |
f12ab1e0 TI |
13292 | /* return 1 if successful, 0 if the proper config is not found, |
13293 | * or a negative error code | |
13294 | */ | |
df694daa KY |
13295 | static int alc861_parse_auto_config(struct hda_codec *codec) |
13296 | { | |
13297 | struct alc_spec *spec = codec->spec; | |
13298 | int err; | |
13299 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | |
13300 | ||
f12ab1e0 TI |
13301 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
13302 | alc861_ignore); | |
13303 | if (err < 0) | |
df694daa | 13304 | return err; |
f12ab1e0 | 13305 | if (!spec->autocfg.line_outs) |
df694daa KY |
13306 | return 0; /* can't find valid BIOS pin config */ |
13307 | ||
f12ab1e0 TI |
13308 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
13309 | if (err < 0) | |
13310 | return err; | |
13311 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
13312 | if (err < 0) | |
13313 | return err; | |
13314 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); | |
13315 | if (err < 0) | |
13316 | return err; | |
13317 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
13318 | if (err < 0) | |
df694daa KY |
13319 | return err; |
13320 | ||
13321 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
13322 | ||
13323 | if (spec->autocfg.dig_out_pin) | |
13324 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; | |
13325 | ||
603c4019 | 13326 | if (spec->kctls.list) |
d88897ea | 13327 | add_mixer(spec, spec->kctls.list); |
df694daa | 13328 | |
d88897ea | 13329 | add_verb(spec, alc861_auto_init_verbs); |
df694daa | 13330 | |
a1e8d2da | 13331 | spec->num_mux_defs = 1; |
df694daa KY |
13332 | spec->input_mux = &spec->private_imux; |
13333 | ||
13334 | spec->adc_nids = alc861_adc_nids; | |
13335 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | |
d88897ea | 13336 | add_mixer(spec, alc861_capture_mixer); |
df694daa | 13337 | |
e044c39a | 13338 | store_pin_configs(codec); |
df694daa KY |
13339 | return 1; |
13340 | } | |
13341 | ||
ae6b813a TI |
13342 | /* additional initialization for auto-configuration model */ |
13343 | static void alc861_auto_init(struct hda_codec *codec) | |
df694daa | 13344 | { |
f6c7e546 | 13345 | struct alc_spec *spec = codec->spec; |
df694daa KY |
13346 | alc861_auto_init_multi_out(codec); |
13347 | alc861_auto_init_hp_out(codec); | |
13348 | alc861_auto_init_analog_input(codec); | |
f6c7e546 | 13349 | if (spec->unsol_event) |
7fb0d78f | 13350 | alc_inithook(codec); |
df694daa KY |
13351 | } |
13352 | ||
cb53c626 TI |
13353 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
13354 | static struct hda_amp_list alc861_loopbacks[] = { | |
13355 | { 0x15, HDA_INPUT, 0 }, | |
13356 | { 0x15, HDA_INPUT, 1 }, | |
13357 | { 0x15, HDA_INPUT, 2 }, | |
13358 | { 0x15, HDA_INPUT, 3 }, | |
13359 | { } /* end */ | |
13360 | }; | |
13361 | #endif | |
13362 | ||
df694daa KY |
13363 | |
13364 | /* | |
13365 | * configuration and preset | |
13366 | */ | |
f5fcc13c TI |
13367 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
13368 | [ALC861_3ST] = "3stack", | |
13369 | [ALC660_3ST] = "3stack-660", | |
13370 | [ALC861_3ST_DIG] = "3stack-dig", | |
13371 | [ALC861_6ST_DIG] = "6stack-dig", | |
13372 | [ALC861_UNIWILL_M31] = "uniwill-m31", | |
13373 | [ALC861_TOSHIBA] = "toshiba", | |
13374 | [ALC861_ASUS] = "asus", | |
13375 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | |
13376 | [ALC861_AUTO] = "auto", | |
13377 | }; | |
13378 | ||
13379 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | |
687a47bd | 13380 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
f5fcc13c TI |
13381 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
13382 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | |
13383 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | |
ac3e3741 | 13384 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
83c34218 | 13385 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
ad5e7737 | 13386 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
341d4eb0 TI |
13387 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
13388 | * Any other models that need this preset? | |
13389 | */ | |
13390 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | |
ac3e3741 TI |
13391 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
13392 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | |
4147dab6 | 13393 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
ac3e3741 TI |
13394 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
13395 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | |
13396 | /* FIXME: the below seems conflict */ | |
13397 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | |
07e038b3 | 13398 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
f5fcc13c | 13399 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
df694daa KY |
13400 | {} |
13401 | }; | |
13402 | ||
13403 | static struct alc_config_preset alc861_presets[] = { | |
13404 | [ALC861_3ST] = { | |
13405 | .mixers = { alc861_3ST_mixer }, | |
13406 | .init_verbs = { alc861_threestack_init_verbs }, | |
13407 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13408 | .dac_nids = alc861_dac_nids, | |
13409 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
13410 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 13411 | .need_dac_fix = 1, |
df694daa KY |
13412 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
13413 | .adc_nids = alc861_adc_nids, | |
13414 | .input_mux = &alc861_capture_source, | |
13415 | }, | |
13416 | [ALC861_3ST_DIG] = { | |
13417 | .mixers = { alc861_base_mixer }, | |
13418 | .init_verbs = { alc861_threestack_init_verbs }, | |
13419 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13420 | .dac_nids = alc861_dac_nids, | |
13421 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13422 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
13423 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 13424 | .need_dac_fix = 1, |
df694daa KY |
13425 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
13426 | .adc_nids = alc861_adc_nids, | |
13427 | .input_mux = &alc861_capture_source, | |
13428 | }, | |
13429 | [ALC861_6ST_DIG] = { | |
13430 | .mixers = { alc861_base_mixer }, | |
13431 | .init_verbs = { alc861_base_init_verbs }, | |
13432 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13433 | .dac_nids = alc861_dac_nids, | |
13434 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13435 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | |
13436 | .channel_mode = alc861_8ch_modes, | |
13437 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13438 | .adc_nids = alc861_adc_nids, | |
13439 | .input_mux = &alc861_capture_source, | |
13440 | }, | |
9c7f852e TI |
13441 | [ALC660_3ST] = { |
13442 | .mixers = { alc861_3ST_mixer }, | |
13443 | .init_verbs = { alc861_threestack_init_verbs }, | |
13444 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | |
13445 | .dac_nids = alc660_dac_nids, | |
13446 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | |
13447 | .channel_mode = alc861_threestack_modes, | |
4e195a7b | 13448 | .need_dac_fix = 1, |
9c7f852e TI |
13449 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
13450 | .adc_nids = alc861_adc_nids, | |
13451 | .input_mux = &alc861_capture_source, | |
13452 | }, | |
22309c3e TI |
13453 | [ALC861_UNIWILL_M31] = { |
13454 | .mixers = { alc861_uniwill_m31_mixer }, | |
13455 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | |
13456 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13457 | .dac_nids = alc861_dac_nids, | |
13458 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13459 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | |
13460 | .channel_mode = alc861_uniwill_m31_modes, | |
13461 | .need_dac_fix = 1, | |
13462 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13463 | .adc_nids = alc861_adc_nids, | |
13464 | .input_mux = &alc861_capture_source, | |
13465 | }, | |
a53d1aec TD |
13466 | [ALC861_TOSHIBA] = { |
13467 | .mixers = { alc861_toshiba_mixer }, | |
f12ab1e0 TI |
13468 | .init_verbs = { alc861_base_init_verbs, |
13469 | alc861_toshiba_init_verbs }, | |
a53d1aec TD |
13470 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
13471 | .dac_nids = alc861_dac_nids, | |
13472 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
13473 | .channel_mode = alc883_3ST_2ch_modes, | |
13474 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13475 | .adc_nids = alc861_adc_nids, | |
13476 | .input_mux = &alc861_capture_source, | |
13477 | .unsol_event = alc861_toshiba_unsol_event, | |
13478 | .init_hook = alc861_toshiba_automute, | |
13479 | }, | |
7cdbff94 MD |
13480 | [ALC861_ASUS] = { |
13481 | .mixers = { alc861_asus_mixer }, | |
13482 | .init_verbs = { alc861_asus_init_verbs }, | |
13483 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13484 | .dac_nids = alc861_dac_nids, | |
13485 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13486 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | |
13487 | .channel_mode = alc861_asus_modes, | |
13488 | .need_dac_fix = 1, | |
13489 | .hp_nid = 0x06, | |
13490 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13491 | .adc_nids = alc861_adc_nids, | |
13492 | .input_mux = &alc861_capture_source, | |
13493 | }, | |
56bb0cab TI |
13494 | [ALC861_ASUS_LAPTOP] = { |
13495 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | |
13496 | .init_verbs = { alc861_asus_init_verbs, | |
13497 | alc861_asus_laptop_init_verbs }, | |
13498 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | |
13499 | .dac_nids = alc861_dac_nids, | |
13500 | .dig_out_nid = ALC861_DIGOUT_NID, | |
13501 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | |
13502 | .channel_mode = alc883_3ST_2ch_modes, | |
13503 | .need_dac_fix = 1, | |
13504 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | |
13505 | .adc_nids = alc861_adc_nids, | |
13506 | .input_mux = &alc861_capture_source, | |
13507 | }, | |
13508 | }; | |
df694daa KY |
13509 | |
13510 | ||
13511 | static int patch_alc861(struct hda_codec *codec) | |
13512 | { | |
13513 | struct alc_spec *spec; | |
13514 | int board_config; | |
13515 | int err; | |
13516 | ||
dc041e0b | 13517 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
df694daa KY |
13518 | if (spec == NULL) |
13519 | return -ENOMEM; | |
13520 | ||
f12ab1e0 | 13521 | codec->spec = spec; |
df694daa | 13522 | |
f5fcc13c TI |
13523 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
13524 | alc861_models, | |
13525 | alc861_cfg_tbl); | |
9c7f852e | 13526 | |
f5fcc13c | 13527 | if (board_config < 0) { |
9c7f852e TI |
13528 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
13529 | "trying auto-probe from BIOS...\n"); | |
df694daa KY |
13530 | board_config = ALC861_AUTO; |
13531 | } | |
13532 | ||
13533 | if (board_config == ALC861_AUTO) { | |
13534 | /* automatic parse from the BIOS config */ | |
13535 | err = alc861_parse_auto_config(codec); | |
13536 | if (err < 0) { | |
13537 | alc_free(codec); | |
13538 | return err; | |
f12ab1e0 | 13539 | } else if (!err) { |
9c7f852e TI |
13540 | printk(KERN_INFO |
13541 | "hda_codec: Cannot set up configuration " | |
13542 | "from BIOS. Using base mode...\n"); | |
df694daa KY |
13543 | board_config = ALC861_3ST_DIG; |
13544 | } | |
13545 | } | |
13546 | ||
13547 | if (board_config != ALC861_AUTO) | |
13548 | setup_preset(spec, &alc861_presets[board_config]); | |
13549 | ||
13550 | spec->stream_name_analog = "ALC861 Analog"; | |
13551 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | |
13552 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | |
13553 | ||
13554 | spec->stream_name_digital = "ALC861 Digital"; | |
13555 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | |
13556 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | |
13557 | ||
2134ea4f TI |
13558 | spec->vmaster_nid = 0x03; |
13559 | ||
df694daa KY |
13560 | codec->patch_ops = alc_patch_ops; |
13561 | if (board_config == ALC861_AUTO) | |
ae6b813a | 13562 | spec->init_hook = alc861_auto_init; |
cb53c626 TI |
13563 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
13564 | if (!spec->loopback.amplist) | |
13565 | spec->loopback.amplist = alc861_loopbacks; | |
13566 | #endif | |
ea1fb29a | 13567 | |
1da177e4 LT |
13568 | return 0; |
13569 | } | |
13570 | ||
f32610ed JS |
13571 | /* |
13572 | * ALC861-VD support | |
13573 | * | |
13574 | * Based on ALC882 | |
13575 | * | |
13576 | * In addition, an independent DAC | |
13577 | */ | |
13578 | #define ALC861VD_DIGOUT_NID 0x06 | |
13579 | ||
13580 | static hda_nid_t alc861vd_dac_nids[4] = { | |
13581 | /* front, surr, clfe, side surr */ | |
13582 | 0x02, 0x03, 0x04, 0x05 | |
13583 | }; | |
13584 | ||
13585 | /* dac_nids for ALC660vd are in a different order - according to | |
13586 | * Realtek's driver. | |
13587 | * This should probably tesult in a different mixer for 6stack models | |
13588 | * of ALC660vd codecs, but for now there is only 3stack mixer | |
13589 | * - and it is the same as in 861vd. | |
13590 | * adc_nids in ALC660vd are (is) the same as in 861vd | |
13591 | */ | |
13592 | static hda_nid_t alc660vd_dac_nids[3] = { | |
13593 | /* front, rear, clfe, rear_surr */ | |
13594 | 0x02, 0x04, 0x03 | |
13595 | }; | |
13596 | ||
13597 | static hda_nid_t alc861vd_adc_nids[1] = { | |
13598 | /* ADC0 */ | |
13599 | 0x09, | |
13600 | }; | |
13601 | ||
e1406348 TI |
13602 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
13603 | ||
f32610ed JS |
13604 | /* input MUX */ |
13605 | /* FIXME: should be a matrix-type input source selection */ | |
13606 | static struct hda_input_mux alc861vd_capture_source = { | |
13607 | .num_items = 4, | |
13608 | .items = { | |
13609 | { "Mic", 0x0 }, | |
13610 | { "Front Mic", 0x1 }, | |
13611 | { "Line", 0x2 }, | |
13612 | { "CD", 0x4 }, | |
13613 | }, | |
13614 | }; | |
13615 | ||
272a527c | 13616 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
b419f346 | 13617 | .num_items = 2, |
272a527c | 13618 | .items = { |
b419f346 TD |
13619 | { "Ext Mic", 0x0 }, |
13620 | { "Int Mic", 0x1 }, | |
272a527c KY |
13621 | }, |
13622 | }; | |
13623 | ||
d1a991a6 KY |
13624 | static struct hda_input_mux alc861vd_hp_capture_source = { |
13625 | .num_items = 2, | |
13626 | .items = { | |
13627 | { "Front Mic", 0x0 }, | |
13628 | { "ATAPI Mic", 0x1 }, | |
13629 | }, | |
13630 | }; | |
13631 | ||
f32610ed JS |
13632 | /* |
13633 | * 2ch mode | |
13634 | */ | |
13635 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | |
13636 | { 2, NULL } | |
13637 | }; | |
13638 | ||
13639 | /* | |
13640 | * 6ch mode | |
13641 | */ | |
13642 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | |
13643 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
13644 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13645 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13646 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13647 | { } /* end */ | |
13648 | }; | |
13649 | ||
13650 | /* | |
13651 | * 8ch mode | |
13652 | */ | |
13653 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | |
13654 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13655 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13656 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13657 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
13658 | { } /* end */ | |
13659 | }; | |
13660 | ||
13661 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | |
13662 | { 6, alc861vd_6stack_ch6_init }, | |
13663 | { 8, alc861vd_6stack_ch8_init }, | |
13664 | }; | |
13665 | ||
13666 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | |
13667 | { | |
13668 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13669 | .name = "Channel Mode", | |
13670 | .info = alc_ch_mode_info, | |
13671 | .get = alc_ch_mode_get, | |
13672 | .put = alc_ch_mode_put, | |
13673 | }, | |
13674 | { } /* end */ | |
13675 | }; | |
13676 | ||
13677 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { | |
13678 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
13679 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
13680 | ||
13681 | { | |
13682 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
13683 | /* The multiple "Capture Source" controls confuse alsamixer | |
13684 | * So call somewhat different.. | |
f32610ed JS |
13685 | */ |
13686 | /* .name = "Capture Source", */ | |
13687 | .name = "Input Source", | |
13688 | .count = 1, | |
54cbc9ab TI |
13689 | .info = alc_mux_enum_info, |
13690 | .get = alc_mux_enum_get, | |
13691 | .put = alc_mux_enum_put, | |
f32610ed JS |
13692 | }, |
13693 | { } /* end */ | |
13694 | }; | |
13695 | ||
13696 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
13697 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
13698 | */ | |
13699 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |
13700 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13701 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
13702 | ||
13703 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13704 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | |
13705 | ||
13706 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | |
13707 | HDA_OUTPUT), | |
13708 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | |
13709 | HDA_OUTPUT), | |
13710 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | |
13711 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | |
13712 | ||
13713 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | |
13714 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | |
13715 | ||
13716 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
13717 | ||
13718 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13721 | ||
13722 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13723 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13724 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13725 | ||
13726 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13727 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13728 | ||
13729 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
13730 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
13731 | ||
13732 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
13733 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
13734 | ||
13735 | { } /* end */ | |
13736 | }; | |
13737 | ||
13738 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |
13739 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13740 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
13741 | ||
13742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
13743 | ||
13744 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13745 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13746 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13747 | ||
13748 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13749 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13750 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13751 | ||
13752 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
13753 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
13754 | ||
13755 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
13756 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
13757 | ||
13758 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
13759 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
13760 | ||
13761 | { } /* end */ | |
13762 | }; | |
13763 | ||
bdd148a3 KY |
13764 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
13765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13766 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | |
13767 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
13768 | ||
13769 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
13770 | ||
13771 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | |
13772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13774 | ||
13775 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | |
13776 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13777 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13778 | ||
13779 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
13780 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
13781 | ||
13782 | { } /* end */ | |
13783 | }; | |
13784 | ||
b419f346 TD |
13785 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
13786 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | |
272a527c KY |
13787 | */ |
13788 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |
b419f346 TD |
13789 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
13790 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | |
272a527c KY |
13791 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
13792 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
b419f346 TD |
13793 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
13794 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13795 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13796 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | |
13797 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13798 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
13799 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), | |
13800 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), | |
272a527c KY |
13801 | { } /* end */ |
13802 | }; | |
13803 | ||
d1a991a6 KY |
13804 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
13805 | * Front Mic=0x18, ATAPI Mic = 0x19, | |
13806 | */ | |
13807 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |
13808 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
13809 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | |
13810 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
13811 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | |
13812 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
13813 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
13814 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
13815 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
ea1fb29a | 13816 | |
d1a991a6 KY |
13817 | { } /* end */ |
13818 | }; | |
13819 | ||
f32610ed JS |
13820 | /* |
13821 | * generic initialization of ADC, input mixers and output mixers | |
13822 | */ | |
13823 | static struct hda_verb alc861vd_volume_init_verbs[] = { | |
13824 | /* | |
13825 | * Unmute ADC0 and set the default input to mic-in | |
13826 | */ | |
13827 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13828 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13829 | ||
13830 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | |
13831 | * the analog-loopback mixer widget | |
13832 | */ | |
13833 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
13834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
13837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
13838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
f32610ed JS |
13839 | |
13840 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | |
bdd148a3 KY |
13841 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
13842 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13843 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
f32610ed | 13844 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
f32610ed JS |
13845 | |
13846 | /* | |
13847 | * Set up output mixers (0x02 - 0x05) | |
13848 | */ | |
13849 | /* set vol=0 to output mixers */ | |
13850 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13851 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13852 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13853 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
13854 | ||
13855 | /* set up input amps for analog loopback */ | |
13856 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
13857 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13858 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13859 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13860 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13861 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13862 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13863 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
13864 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
13865 | ||
13866 | { } | |
13867 | }; | |
13868 | ||
13869 | /* | |
13870 | * 3-stack pin configuration: | |
13871 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | |
13872 | */ | |
13873 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | |
13874 | /* | |
13875 | * Set pin mode and muting | |
13876 | */ | |
13877 | /* set front pin widgets 0x14 for output */ | |
13878 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13879 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13880 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13881 | ||
13882 | /* Mic (rear) pin: input vref at 80% */ | |
13883 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13884 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13885 | /* Front Mic pin: input vref at 80% */ | |
13886 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13887 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13888 | /* Line In pin: input */ | |
13889 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13890 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13891 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
13892 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13893 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13894 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13895 | /* CD pin widget for input */ | |
13896 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13897 | ||
13898 | { } | |
13899 | }; | |
13900 | ||
13901 | /* | |
13902 | * 6-stack pin configuration: | |
13903 | */ | |
13904 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | |
13905 | /* | |
13906 | * Set pin mode and muting | |
13907 | */ | |
13908 | /* set front pin widgets 0x14 for output */ | |
13909 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13910 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13911 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13912 | ||
13913 | /* Rear Pin: output 1 (0x0d) */ | |
13914 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13915 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13916 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | |
13917 | /* CLFE Pin: output 2 (0x0e) */ | |
13918 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13919 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13920 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | |
13921 | /* Side Pin: output 3 (0x0f) */ | |
13922 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
13923 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13924 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | |
13925 | ||
13926 | /* Mic (rear) pin: input vref at 80% */ | |
13927 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13928 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13929 | /* Front Mic pin: input vref at 80% */ | |
13930 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
13931 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13932 | /* Line In pin: input */ | |
13933 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13934 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
13935 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
13936 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
13937 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
13938 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
13939 | /* CD pin widget for input */ | |
13940 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
13941 | ||
13942 | { } | |
13943 | }; | |
13944 | ||
bdd148a3 KY |
13945 | static struct hda_verb alc861vd_eapd_verbs[] = { |
13946 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13947 | { } | |
13948 | }; | |
13949 | ||
f9423e7a KY |
13950 | static struct hda_verb alc660vd_eapd_verbs[] = { |
13951 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13952 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
13953 | { } | |
13954 | }; | |
13955 | ||
bdd148a3 KY |
13956 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
13957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
13958 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
13959 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | |
13960 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
ea1fb29a | 13961 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
bdd148a3 KY |
13962 | {} |
13963 | }; | |
13964 | ||
13965 | /* toggle speaker-output according to the hp-jack state */ | |
13966 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) | |
13967 | { | |
13968 | unsigned int present; | |
13969 | unsigned char bits; | |
13970 | ||
13971 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
13972 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
13973 | bits = present ? HDA_AMP_MUTE : 0; |
13974 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
13975 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
13976 | } |
13977 | ||
13978 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | |
13979 | { | |
13980 | unsigned int present; | |
13981 | unsigned char bits; | |
13982 | ||
13983 | present = snd_hda_codec_read(codec, 0x18, 0, | |
13984 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
13985 | bits = present ? HDA_AMP_MUTE : 0; |
13986 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | |
13987 | HDA_AMP_MUTE, bits); | |
bdd148a3 KY |
13988 | } |
13989 | ||
13990 | static void alc861vd_lenovo_automute(struct hda_codec *codec) | |
13991 | { | |
13992 | alc861vd_lenovo_hp_automute(codec); | |
13993 | alc861vd_lenovo_mic_automute(codec); | |
13994 | } | |
13995 | ||
13996 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | |
13997 | unsigned int res) | |
13998 | { | |
13999 | switch (res >> 26) { | |
14000 | case ALC880_HP_EVENT: | |
14001 | alc861vd_lenovo_hp_automute(codec); | |
14002 | break; | |
14003 | case ALC880_MIC_EVENT: | |
14004 | alc861vd_lenovo_mic_automute(codec); | |
14005 | break; | |
14006 | } | |
14007 | } | |
14008 | ||
272a527c KY |
14009 | static struct hda_verb alc861vd_dallas_verbs[] = { |
14010 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14011 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14012 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14013 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
14014 | ||
14015 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14016 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14017 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14018 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14019 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14020 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14021 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14022 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
ea1fb29a | 14023 | |
272a527c KY |
14024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
14025 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14028 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14029 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14030 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14031 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14032 | ||
14033 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
14034 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14035 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | |
14036 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14037 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14038 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14039 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14040 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14041 | ||
14042 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14043 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
14044 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
14045 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
14046 | ||
14047 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
ea1fb29a | 14048 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
272a527c KY |
14049 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
14050 | ||
14051 | { } /* end */ | |
14052 | }; | |
14053 | ||
14054 | /* toggle speaker-output according to the hp-jack state */ | |
14055 | static void alc861vd_dallas_automute(struct hda_codec *codec) | |
14056 | { | |
14057 | unsigned int present; | |
14058 | ||
14059 | present = snd_hda_codec_read(codec, 0x15, 0, | |
14060 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
14061 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
14062 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | |
272a527c KY |
14063 | } |
14064 | ||
14065 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) | |
14066 | { | |
14067 | if ((res >> 26) == ALC880_HP_EVENT) | |
14068 | alc861vd_dallas_automute(codec); | |
14069 | } | |
14070 | ||
cb53c626 TI |
14071 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14072 | #define alc861vd_loopbacks alc880_loopbacks | |
14073 | #endif | |
14074 | ||
f32610ed JS |
14075 | /* pcm configuration: identiacal with ALC880 */ |
14076 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback | |
14077 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | |
14078 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | |
14079 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | |
14080 | ||
14081 | /* | |
14082 | * configuration and preset | |
14083 | */ | |
14084 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |
14085 | [ALC660VD_3ST] = "3stack-660", | |
983f8ae4 | 14086 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
f32610ed JS |
14087 | [ALC861VD_3ST] = "3stack", |
14088 | [ALC861VD_3ST_DIG] = "3stack-digout", | |
14089 | [ALC861VD_6ST_DIG] = "6stack-digout", | |
bdd148a3 | 14090 | [ALC861VD_LENOVO] = "lenovo", |
272a527c | 14091 | [ALC861VD_DALLAS] = "dallas", |
983f8ae4 | 14092 | [ALC861VD_HP] = "hp", |
f32610ed JS |
14093 | [ALC861VD_AUTO] = "auto", |
14094 | }; | |
14095 | ||
14096 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |
ac3e3741 TI |
14097 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
14098 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | |
07e038b3 | 14099 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
f32610ed | 14100 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
2522d735 | 14101 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO), |
6963f84c | 14102 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
f32610ed | 14103 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
ac3e3741 | 14104 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
38baf5ad | 14105 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
272a527c | 14106 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
542d7c66 | 14107 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
b419f346 | 14108 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
39c5d41f | 14109 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
ac3e3741 TI |
14110 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
14111 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), | |
be321a89 | 14112 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
625dc0bf | 14113 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
f32610ed JS |
14114 | {} |
14115 | }; | |
14116 | ||
14117 | static struct alc_config_preset alc861vd_presets[] = { | |
14118 | [ALC660VD_3ST] = { | |
14119 | .mixers = { alc861vd_3st_mixer }, | |
14120 | .init_verbs = { alc861vd_volume_init_verbs, | |
14121 | alc861vd_3stack_init_verbs }, | |
14122 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
14123 | .dac_nids = alc660vd_dac_nids, | |
f32610ed JS |
14124 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14125 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14126 | .input_mux = &alc861vd_capture_source, | |
14127 | }, | |
6963f84c MC |
14128 | [ALC660VD_3ST_DIG] = { |
14129 | .mixers = { alc861vd_3st_mixer }, | |
14130 | .init_verbs = { alc861vd_volume_init_verbs, | |
14131 | alc861vd_3stack_init_verbs }, | |
14132 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
14133 | .dac_nids = alc660vd_dac_nids, | |
14134 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
6963f84c MC |
14135 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14136 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14137 | .input_mux = &alc861vd_capture_source, | |
14138 | }, | |
f32610ed JS |
14139 | [ALC861VD_3ST] = { |
14140 | .mixers = { alc861vd_3st_mixer }, | |
14141 | .init_verbs = { alc861vd_volume_init_verbs, | |
14142 | alc861vd_3stack_init_verbs }, | |
14143 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14144 | .dac_nids = alc861vd_dac_nids, | |
14145 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
14146 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14147 | .input_mux = &alc861vd_capture_source, | |
14148 | }, | |
14149 | [ALC861VD_3ST_DIG] = { | |
14150 | .mixers = { alc861vd_3st_mixer }, | |
14151 | .init_verbs = { alc861vd_volume_init_verbs, | |
14152 | alc861vd_3stack_init_verbs }, | |
14153 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14154 | .dac_nids = alc861vd_dac_nids, | |
14155 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
14156 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | |
14157 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14158 | .input_mux = &alc861vd_capture_source, | |
14159 | }, | |
14160 | [ALC861VD_6ST_DIG] = { | |
14161 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | |
14162 | .init_verbs = { alc861vd_volume_init_verbs, | |
14163 | alc861vd_6stack_init_verbs }, | |
14164 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14165 | .dac_nids = alc861vd_dac_nids, | |
14166 | .dig_out_nid = ALC861VD_DIGOUT_NID, | |
14167 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | |
14168 | .channel_mode = alc861vd_6stack_modes, | |
14169 | .input_mux = &alc861vd_capture_source, | |
14170 | }, | |
bdd148a3 KY |
14171 | [ALC861VD_LENOVO] = { |
14172 | .mixers = { alc861vd_lenovo_mixer }, | |
14173 | .init_verbs = { alc861vd_volume_init_verbs, | |
14174 | alc861vd_3stack_init_verbs, | |
14175 | alc861vd_eapd_verbs, | |
14176 | alc861vd_lenovo_unsol_verbs }, | |
14177 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | |
14178 | .dac_nids = alc660vd_dac_nids, | |
bdd148a3 KY |
14179 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14180 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14181 | .input_mux = &alc861vd_capture_source, | |
14182 | .unsol_event = alc861vd_lenovo_unsol_event, | |
14183 | .init_hook = alc861vd_lenovo_automute, | |
14184 | }, | |
272a527c KY |
14185 | [ALC861VD_DALLAS] = { |
14186 | .mixers = { alc861vd_dallas_mixer }, | |
14187 | .init_verbs = { alc861vd_dallas_verbs }, | |
14188 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14189 | .dac_nids = alc861vd_dac_nids, | |
272a527c KY |
14190 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14191 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14192 | .input_mux = &alc861vd_dallas_capture_source, | |
14193 | .unsol_event = alc861vd_dallas_unsol_event, | |
14194 | .init_hook = alc861vd_dallas_automute, | |
d1a991a6 KY |
14195 | }, |
14196 | [ALC861VD_HP] = { | |
14197 | .mixers = { alc861vd_hp_mixer }, | |
14198 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | |
14199 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | |
14200 | .dac_nids = alc861vd_dac_nids, | |
d1a991a6 | 14201 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
d1a991a6 KY |
14202 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
14203 | .channel_mode = alc861vd_3stack_2ch_modes, | |
14204 | .input_mux = &alc861vd_hp_capture_source, | |
14205 | .unsol_event = alc861vd_dallas_unsol_event, | |
14206 | .init_hook = alc861vd_dallas_automute, | |
ea1fb29a | 14207 | }, |
f32610ed JS |
14208 | }; |
14209 | ||
14210 | /* | |
14211 | * BIOS auto configuration | |
14212 | */ | |
14213 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | |
14214 | hda_nid_t nid, int pin_type, int dac_idx) | |
14215 | { | |
f6c7e546 | 14216 | alc_set_pin_output(codec, nid, pin_type); |
f32610ed JS |
14217 | } |
14218 | ||
14219 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | |
14220 | { | |
14221 | struct alc_spec *spec = codec->spec; | |
14222 | int i; | |
14223 | ||
bc9f98a9 | 14224 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
f32610ed JS |
14225 | for (i = 0; i <= HDA_SIDE; i++) { |
14226 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 14227 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
f32610ed JS |
14228 | if (nid) |
14229 | alc861vd_auto_set_output_and_unmute(codec, nid, | |
baba8ee9 | 14230 | pin_type, i); |
f32610ed JS |
14231 | } |
14232 | } | |
14233 | ||
14234 | ||
14235 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |
14236 | { | |
14237 | struct alc_spec *spec = codec->spec; | |
14238 | hda_nid_t pin; | |
14239 | ||
14240 | pin = spec->autocfg.hp_pins[0]; | |
14241 | if (pin) /* connect to front and use dac 0 */ | |
14242 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
14243 | pin = spec->autocfg.speaker_pins[0]; |
14244 | if (pin) | |
14245 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
f32610ed JS |
14246 | } |
14247 | ||
14248 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) | |
14249 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | |
14250 | ||
14251 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |
14252 | { | |
14253 | struct alc_spec *spec = codec->spec; | |
14254 | int i; | |
14255 | ||
14256 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
14257 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
14258 | if (alc861vd_is_input_pin(nid)) { | |
14259 | snd_hda_codec_write(codec, nid, 0, | |
14260 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
14261 | i <= AUTO_PIN_FRONT_MIC ? | |
14262 | PIN_VREF80 : PIN_IN); | |
14263 | if (nid != ALC861VD_PIN_CD_NID) | |
14264 | snd_hda_codec_write(codec, nid, 0, | |
14265 | AC_VERB_SET_AMP_GAIN_MUTE, | |
14266 | AMP_OUT_MUTE); | |
14267 | } | |
14268 | } | |
14269 | } | |
14270 | ||
f511b01c TI |
14271 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
14272 | ||
f32610ed JS |
14273 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
14274 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | |
14275 | ||
14276 | /* add playback controls from the parsed DAC table */ | |
14277 | /* Based on ALC880 version. But ALC861VD has separate, | |
14278 | * different NIDs for mute/unmute switch and volume control */ | |
14279 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | |
14280 | const struct auto_pin_cfg *cfg) | |
14281 | { | |
14282 | char name[32]; | |
14283 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; | |
14284 | hda_nid_t nid_v, nid_s; | |
14285 | int i, err; | |
14286 | ||
14287 | for (i = 0; i < cfg->line_outs; i++) { | |
f12ab1e0 | 14288 | if (!spec->multiout.dac_nids[i]) |
f32610ed JS |
14289 | continue; |
14290 | nid_v = alc861vd_idx_to_mixer_vol( | |
14291 | alc880_dac_to_idx( | |
14292 | spec->multiout.dac_nids[i])); | |
14293 | nid_s = alc861vd_idx_to_mixer_switch( | |
14294 | alc880_dac_to_idx( | |
14295 | spec->multiout.dac_nids[i])); | |
14296 | ||
14297 | if (i == 2) { | |
14298 | /* Center/LFE */ | |
f12ab1e0 TI |
14299 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
14300 | "Center Playback Volume", | |
14301 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, | |
14302 | HDA_OUTPUT)); | |
14303 | if (err < 0) | |
f32610ed | 14304 | return err; |
f12ab1e0 TI |
14305 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
14306 | "LFE Playback Volume", | |
14307 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, | |
14308 | HDA_OUTPUT)); | |
14309 | if (err < 0) | |
f32610ed | 14310 | return err; |
f12ab1e0 TI |
14311 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
14312 | "Center Playback Switch", | |
14313 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, | |
14314 | HDA_INPUT)); | |
14315 | if (err < 0) | |
f32610ed | 14316 | return err; |
f12ab1e0 TI |
14317 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
14318 | "LFE Playback Switch", | |
14319 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, | |
14320 | HDA_INPUT)); | |
14321 | if (err < 0) | |
f32610ed JS |
14322 | return err; |
14323 | } else { | |
14324 | sprintf(name, "%s Playback Volume", chname[i]); | |
f12ab1e0 TI |
14325 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
14326 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | |
14327 | HDA_OUTPUT)); | |
14328 | if (err < 0) | |
f32610ed JS |
14329 | return err; |
14330 | sprintf(name, "%s Playback Switch", chname[i]); | |
f12ab1e0 | 14331 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
bdd148a3 | 14332 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
f12ab1e0 TI |
14333 | HDA_INPUT)); |
14334 | if (err < 0) | |
f32610ed JS |
14335 | return err; |
14336 | } | |
14337 | } | |
14338 | return 0; | |
14339 | } | |
14340 | ||
14341 | /* add playback controls for speaker and HP outputs */ | |
14342 | /* Based on ALC880 version. But ALC861VD has separate, | |
14343 | * different NIDs for mute/unmute switch and volume control */ | |
14344 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | |
14345 | hda_nid_t pin, const char *pfx) | |
14346 | { | |
14347 | hda_nid_t nid_v, nid_s; | |
14348 | int err; | |
14349 | char name[32]; | |
14350 | ||
f12ab1e0 | 14351 | if (!pin) |
f32610ed JS |
14352 | return 0; |
14353 | ||
14354 | if (alc880_is_fixed_pin(pin)) { | |
14355 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
14356 | /* specify the DAC as the extra output */ | |
f12ab1e0 | 14357 | if (!spec->multiout.hp_nid) |
f32610ed JS |
14358 | spec->multiout.hp_nid = nid_v; |
14359 | else | |
14360 | spec->multiout.extra_out_nid[0] = nid_v; | |
14361 | /* control HP volume/switch on the output mixer amp */ | |
14362 | nid_v = alc861vd_idx_to_mixer_vol( | |
14363 | alc880_fixed_pin_idx(pin)); | |
14364 | nid_s = alc861vd_idx_to_mixer_switch( | |
14365 | alc880_fixed_pin_idx(pin)); | |
14366 | ||
14367 | sprintf(name, "%s Playback Volume", pfx); | |
f12ab1e0 TI |
14368 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
14369 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); | |
14370 | if (err < 0) | |
f32610ed JS |
14371 | return err; |
14372 | sprintf(name, "%s Playback Switch", pfx); | |
f12ab1e0 TI |
14373 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
14374 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); | |
14375 | if (err < 0) | |
f32610ed JS |
14376 | return err; |
14377 | } else if (alc880_is_multi_pin(pin)) { | |
14378 | /* set manual connection */ | |
14379 | /* we have only a switch on HP-out PIN */ | |
14380 | sprintf(name, "%s Playback Switch", pfx); | |
f12ab1e0 TI |
14381 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
14382 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
14383 | if (err < 0) | |
f32610ed JS |
14384 | return err; |
14385 | } | |
14386 | return 0; | |
14387 | } | |
14388 | ||
14389 | /* parse the BIOS configuration and set up the alc_spec | |
14390 | * return 1 if successful, 0 if the proper config is not found, | |
14391 | * or a negative error code | |
14392 | * Based on ALC880 version - had to change it to override | |
14393 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | |
14394 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | |
14395 | { | |
14396 | struct alc_spec *spec = codec->spec; | |
14397 | int err; | |
14398 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | |
14399 | ||
f12ab1e0 TI |
14400 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
14401 | alc861vd_ignore); | |
14402 | if (err < 0) | |
f32610ed | 14403 | return err; |
f12ab1e0 | 14404 | if (!spec->autocfg.line_outs) |
f32610ed JS |
14405 | return 0; /* can't find valid BIOS pin config */ |
14406 | ||
f12ab1e0 TI |
14407 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
14408 | if (err < 0) | |
14409 | return err; | |
14410 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
14411 | if (err < 0) | |
14412 | return err; | |
14413 | err = alc861vd_auto_create_extra_out(spec, | |
14414 | spec->autocfg.speaker_pins[0], | |
14415 | "Speaker"); | |
14416 | if (err < 0) | |
14417 | return err; | |
14418 | err = alc861vd_auto_create_extra_out(spec, | |
14419 | spec->autocfg.hp_pins[0], | |
14420 | "Headphone"); | |
14421 | if (err < 0) | |
14422 | return err; | |
14423 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
14424 | if (err < 0) | |
f32610ed JS |
14425 | return err; |
14426 | ||
14427 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
14428 | ||
14429 | if (spec->autocfg.dig_out_pin) | |
14430 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; | |
14431 | ||
603c4019 | 14432 | if (spec->kctls.list) |
d88897ea | 14433 | add_mixer(spec, spec->kctls.list); |
f32610ed | 14434 | |
d88897ea | 14435 | add_verb(spec, alc861vd_volume_init_verbs); |
f32610ed JS |
14436 | |
14437 | spec->num_mux_defs = 1; | |
14438 | spec->input_mux = &spec->private_imux; | |
14439 | ||
776e184e TI |
14440 | err = alc_auto_add_mic_boost(codec); |
14441 | if (err < 0) | |
14442 | return err; | |
14443 | ||
e044c39a | 14444 | store_pin_configs(codec); |
f32610ed JS |
14445 | return 1; |
14446 | } | |
14447 | ||
14448 | /* additional initialization for auto-configuration model */ | |
14449 | static void alc861vd_auto_init(struct hda_codec *codec) | |
14450 | { | |
f6c7e546 | 14451 | struct alc_spec *spec = codec->spec; |
f32610ed JS |
14452 | alc861vd_auto_init_multi_out(codec); |
14453 | alc861vd_auto_init_hp_out(codec); | |
14454 | alc861vd_auto_init_analog_input(codec); | |
f511b01c | 14455 | alc861vd_auto_init_input_src(codec); |
f6c7e546 | 14456 | if (spec->unsol_event) |
7fb0d78f | 14457 | alc_inithook(codec); |
f32610ed JS |
14458 | } |
14459 | ||
14460 | static int patch_alc861vd(struct hda_codec *codec) | |
14461 | { | |
14462 | struct alc_spec *spec; | |
14463 | int err, board_config; | |
14464 | ||
14465 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
14466 | if (spec == NULL) | |
14467 | return -ENOMEM; | |
14468 | ||
14469 | codec->spec = spec; | |
14470 | ||
14471 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | |
14472 | alc861vd_models, | |
14473 | alc861vd_cfg_tbl); | |
14474 | ||
14475 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | |
14476 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" | |
14477 | "ALC861VD, trying auto-probe from BIOS...\n"); | |
14478 | board_config = ALC861VD_AUTO; | |
14479 | } | |
14480 | ||
14481 | if (board_config == ALC861VD_AUTO) { | |
14482 | /* automatic parse from the BIOS config */ | |
14483 | err = alc861vd_parse_auto_config(codec); | |
14484 | if (err < 0) { | |
14485 | alc_free(codec); | |
14486 | return err; | |
f12ab1e0 | 14487 | } else if (!err) { |
f32610ed JS |
14488 | printk(KERN_INFO |
14489 | "hda_codec: Cannot set up configuration " | |
14490 | "from BIOS. Using base mode...\n"); | |
14491 | board_config = ALC861VD_3ST; | |
14492 | } | |
14493 | } | |
14494 | ||
14495 | if (board_config != ALC861VD_AUTO) | |
14496 | setup_preset(spec, &alc861vd_presets[board_config]); | |
14497 | ||
2f893286 KY |
14498 | if (codec->vendor_id == 0x10ec0660) { |
14499 | spec->stream_name_analog = "ALC660-VD Analog"; | |
14500 | spec->stream_name_digital = "ALC660-VD Digital"; | |
f9423e7a | 14501 | /* always turn on EAPD */ |
d88897ea | 14502 | add_verb(spec, alc660vd_eapd_verbs); |
2f893286 KY |
14503 | } else { |
14504 | spec->stream_name_analog = "ALC861VD Analog"; | |
14505 | spec->stream_name_digital = "ALC861VD Digital"; | |
14506 | } | |
14507 | ||
f32610ed JS |
14508 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
14509 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | |
14510 | ||
f32610ed JS |
14511 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
14512 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | |
14513 | ||
14514 | spec->adc_nids = alc861vd_adc_nids; | |
14515 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | |
e1406348 | 14516 | spec->capsrc_nids = alc861vd_capsrc_nids; |
54cbc9ab | 14517 | spec->is_mix_capture = 1; |
f32610ed | 14518 | |
d88897ea | 14519 | add_mixer(spec, alc861vd_capture_mixer); |
f32610ed | 14520 | |
2134ea4f TI |
14521 | spec->vmaster_nid = 0x02; |
14522 | ||
f32610ed JS |
14523 | codec->patch_ops = alc_patch_ops; |
14524 | ||
14525 | if (board_config == ALC861VD_AUTO) | |
14526 | spec->init_hook = alc861vd_auto_init; | |
cb53c626 TI |
14527 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14528 | if (!spec->loopback.amplist) | |
14529 | spec->loopback.amplist = alc861vd_loopbacks; | |
14530 | #endif | |
f32610ed JS |
14531 | |
14532 | return 0; | |
14533 | } | |
14534 | ||
bc9f98a9 KY |
14535 | /* |
14536 | * ALC662 support | |
14537 | * | |
14538 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
14539 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
14540 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
14541 | * 6-channel independent captures. | |
14542 | * | |
14543 | * In addition, an independent DAC for the multi-playback (not used in this | |
14544 | * driver yet). | |
14545 | */ | |
14546 | #define ALC662_DIGOUT_NID 0x06 | |
14547 | #define ALC662_DIGIN_NID 0x0a | |
14548 | ||
14549 | static hda_nid_t alc662_dac_nids[4] = { | |
14550 | /* front, rear, clfe, rear_surr */ | |
14551 | 0x02, 0x03, 0x04 | |
14552 | }; | |
14553 | ||
14554 | static hda_nid_t alc662_adc_nids[1] = { | |
14555 | /* ADC1-2 */ | |
14556 | 0x09, | |
14557 | }; | |
e1406348 | 14558 | |
77a261b7 | 14559 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
e1406348 | 14560 | |
bc9f98a9 KY |
14561 | /* input MUX */ |
14562 | /* FIXME: should be a matrix-type input source selection */ | |
bc9f98a9 KY |
14563 | static struct hda_input_mux alc662_capture_source = { |
14564 | .num_items = 4, | |
14565 | .items = { | |
14566 | { "Mic", 0x0 }, | |
14567 | { "Front Mic", 0x1 }, | |
14568 | { "Line", 0x2 }, | |
14569 | { "CD", 0x4 }, | |
14570 | }, | |
14571 | }; | |
14572 | ||
14573 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | |
14574 | .num_items = 2, | |
14575 | .items = { | |
14576 | { "Mic", 0x1 }, | |
14577 | { "Line", 0x2 }, | |
14578 | }, | |
14579 | }; | |
291702f0 KY |
14580 | |
14581 | static struct hda_input_mux alc662_eeepc_capture_source = { | |
14582 | .num_items = 2, | |
14583 | .items = { | |
14584 | { "i-Mic", 0x1 }, | |
14585 | { "e-Mic", 0x0 }, | |
14586 | }, | |
14587 | }; | |
14588 | ||
6dda9f4a KY |
14589 | static struct hda_input_mux alc663_capture_source = { |
14590 | .num_items = 3, | |
14591 | .items = { | |
14592 | { "Mic", 0x0 }, | |
14593 | { "Front Mic", 0x1 }, | |
14594 | { "Line", 0x2 }, | |
14595 | }, | |
14596 | }; | |
14597 | ||
14598 | static struct hda_input_mux alc663_m51va_capture_source = { | |
14599 | .num_items = 2, | |
14600 | .items = { | |
14601 | { "Ext-Mic", 0x0 }, | |
14602 | { "D-Mic", 0x9 }, | |
14603 | }, | |
14604 | }; | |
14605 | ||
bc9f98a9 KY |
14606 | /* |
14607 | * 2ch mode | |
14608 | */ | |
14609 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | |
14610 | { 2, NULL } | |
14611 | }; | |
14612 | ||
14613 | /* | |
14614 | * 2ch mode | |
14615 | */ | |
14616 | static struct hda_verb alc662_3ST_ch2_init[] = { | |
14617 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | |
14618 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
14619 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | |
14620 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | |
14621 | { } /* end */ | |
14622 | }; | |
14623 | ||
14624 | /* | |
14625 | * 6ch mode | |
14626 | */ | |
14627 | static struct hda_verb alc662_3ST_ch6_init[] = { | |
14628 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14629 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
14630 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | |
14631 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14632 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | |
14633 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | |
14634 | { } /* end */ | |
14635 | }; | |
14636 | ||
14637 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | |
14638 | { 2, alc662_3ST_ch2_init }, | |
14639 | { 6, alc662_3ST_ch6_init }, | |
14640 | }; | |
14641 | ||
14642 | /* | |
14643 | * 2ch mode | |
14644 | */ | |
14645 | static struct hda_verb alc662_sixstack_ch6_init[] = { | |
14646 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14647 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | |
14648 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14649 | { } /* end */ | |
14650 | }; | |
14651 | ||
14652 | /* | |
14653 | * 6ch mode | |
14654 | */ | |
14655 | static struct hda_verb alc662_sixstack_ch8_init[] = { | |
14656 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14657 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14658 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
14659 | { } /* end */ | |
14660 | }; | |
14661 | ||
14662 | static struct hda_channel_mode alc662_5stack_modes[2] = { | |
14663 | { 2, alc662_sixstack_ch6_init }, | |
14664 | { 6, alc662_sixstack_ch8_init }, | |
14665 | }; | |
14666 | ||
14667 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | |
14668 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | |
14669 | */ | |
14670 | ||
14671 | static struct snd_kcontrol_new alc662_base_mixer[] = { | |
14672 | /* output mixer control */ | |
14673 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | |
7055ad8a | 14674 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 14675 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
7055ad8a | 14676 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
14677 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
14678 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
14679 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
14680 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
14681 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14682 | ||
14683 | /*Input mixer control */ | |
14684 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | |
14685 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | |
14686 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | |
14687 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | |
14688 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | |
14689 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | |
14690 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | |
14691 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | |
bc9f98a9 KY |
14692 | { } /* end */ |
14693 | }; | |
14694 | ||
14695 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |
14696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 14697 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 KY |
14698 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
14700 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
14701 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14702 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14703 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14704 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14705 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14706 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14707 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
14708 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
bc9f98a9 KY |
14709 | { } /* end */ |
14710 | }; | |
14711 | ||
14712 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |
14713 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
7055ad8a | 14714 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
bc9f98a9 | 14715 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
7055ad8a | 14716 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
bc9f98a9 KY |
14717 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
14718 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
7055ad8a HRK |
14719 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
14720 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | |
bc9f98a9 KY |
14721 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14722 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | |
14723 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | |
14724 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14725 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14726 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14727 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14728 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14729 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14730 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | |
14731 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | |
bc9f98a9 KY |
14732 | { } /* end */ |
14733 | }; | |
14734 | ||
14735 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | |
14736 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14737 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | |
86cd9298 TI |
14738 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
14739 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | |
bc9f98a9 KY |
14740 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14741 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14742 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14744 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
bc9f98a9 KY |
14745 | { } /* end */ |
14746 | }; | |
14747 | ||
291702f0 | 14748 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
86cd9298 | 14749 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
291702f0 | 14750 | |
b4818494 HRK |
14751 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
14752 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | |
291702f0 KY |
14753 | |
14754 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | |
14755 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14756 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14757 | ||
14758 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
14759 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14760 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14761 | { } /* end */ | |
14762 | }; | |
14763 | ||
8c427226 | 14764 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
31bffaa9 TI |
14765 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
14766 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
8c427226 KY |
14767 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
14768 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), | |
14769 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | |
14770 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | |
14771 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), | |
14772 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), | |
86cd9298 | 14773 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
8c427226 KY |
14774 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
14775 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14776 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14778 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14779 | { } /* end */ | |
14780 | }; | |
14781 | ||
f1d4e28b KY |
14782 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
14783 | .ops = &snd_hda_bind_vol, | |
14784 | .values = { | |
14785 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
14786 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | |
14787 | 0 | |
14788 | }, | |
14789 | }; | |
14790 | ||
14791 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | |
14792 | .ops = &snd_hda_bind_sw, | |
14793 | .values = { | |
14794 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14795 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
14796 | 0 | |
14797 | }, | |
14798 | }; | |
14799 | ||
6dda9f4a | 14800 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
f1d4e28b KY |
14801 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
14802 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_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 | { } /* end */ | |
14806 | }; | |
14807 | ||
14808 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | |
14809 | .ops = &snd_hda_bind_sw, | |
14810 | .values = { | |
14811 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14812 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
14813 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | |
14814 | 0 | |
14815 | }, | |
14816 | }; | |
14817 | ||
14818 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | |
14819 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
14820 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | |
14821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14823 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14824 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14825 | ||
14826 | { } /* end */ | |
14827 | }; | |
14828 | ||
14829 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | |
14830 | .ops = &snd_hda_bind_sw, | |
14831 | .values = { | |
14832 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14833 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | |
14834 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
14835 | 0 | |
14836 | }, | |
14837 | }; | |
14838 | ||
14839 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | |
14840 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
14841 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | |
14842 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14843 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14844 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14845 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14846 | { } /* end */ | |
14847 | }; | |
14848 | ||
14849 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | |
6dda9f4a KY |
14850 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
14851 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
f1d4e28b KY |
14852 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
14853 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14854 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14855 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14856 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14857 | { } /* end */ | |
14858 | }; | |
14859 | ||
14860 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | |
14861 | .ops = &snd_hda_bind_vol, | |
14862 | .values = { | |
14863 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | |
14864 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | |
14865 | 0 | |
14866 | }, | |
14867 | }; | |
14868 | ||
14869 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | |
14870 | .ops = &snd_hda_bind_sw, | |
14871 | .values = { | |
14872 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | |
14873 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | |
14874 | 0 | |
14875 | }, | |
14876 | }; | |
14877 | ||
14878 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | |
14879 | HDA_BIND_VOL("Master Playback Volume", | |
14880 | &alc663_asus_two_bind_master_vol), | |
14881 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
14882 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
6dda9f4a KY |
14883 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
14884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14885 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
f1d4e28b KY |
14886 | { } /* end */ |
14887 | }; | |
14888 | ||
14889 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | |
14890 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | |
14891 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | |
14892 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
14893 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
6dda9f4a KY |
14896 | { } /* end */ |
14897 | }; | |
14898 | ||
14899 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | |
14900 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14901 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14902 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | |
14903 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | |
14904 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
14905 | ||
14906 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14907 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14908 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14909 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14910 | { } /* end */ | |
14911 | }; | |
14912 | ||
14913 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |
14914 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
14915 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | |
14916 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | |
14917 | ||
14918 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
14919 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
14920 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
14921 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
14922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | |
14923 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | |
14924 | { } /* end */ | |
14925 | }; | |
14926 | ||
bc9f98a9 KY |
14927 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
14928 | { | |
14929 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
14930 | .name = "Channel Mode", | |
14931 | .info = alc_ch_mode_info, | |
14932 | .get = alc_ch_mode_get, | |
14933 | .put = alc_ch_mode_put, | |
14934 | }, | |
14935 | { } /* end */ | |
14936 | }; | |
14937 | ||
14938 | static struct hda_verb alc662_init_verbs[] = { | |
14939 | /* ADC: mute amp left and right */ | |
14940 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
14941 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14942 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | |
14943 | ||
cb53c626 TI |
14944 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
14945 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
14946 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
14947 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
14948 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
bc9f98a9 | 14949 | |
b60dd394 KY |
14950 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
14951 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14952 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14953 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14954 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14955 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
14956 | |
14957 | /* Front Pin: output 0 (0x0c) */ | |
14958 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14959 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14960 | ||
14961 | /* Rear Pin: output 1 (0x0d) */ | |
14962 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14963 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14964 | ||
14965 | /* CLFE Pin: output 2 (0x0e) */ | |
14966 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
14967 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14968 | ||
14969 | /* Mic (rear) pin: input vref at 80% */ | |
14970 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14971 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14972 | /* Front Mic pin: input vref at 80% */ | |
14973 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | |
14974 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14975 | /* Line In pin: input */ | |
14976 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14977 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | |
14978 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | |
14979 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
14980 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
14981 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
14982 | /* CD pin widget for input */ | |
14983 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
14984 | ||
14985 | /* FIXME: use matrix-type input source selection */ | |
14986 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
14987 | /* Input mixer */ | |
14988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14989 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14990 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14991 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
291702f0 KY |
14992 | |
14993 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
14994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
14995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | |
14996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | |
6dda9f4a KY |
14997 | |
14998 | /* always trun on EAPD */ | |
14999 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
15000 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | |
15001 | ||
bc9f98a9 KY |
15002 | { } |
15003 | }; | |
15004 | ||
15005 | static struct hda_verb alc662_sue_init_verbs[] = { | |
15006 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
15007 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
291702f0 KY |
15008 | {} |
15009 | }; | |
15010 | ||
15011 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | |
15012 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15013 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15014 | {} | |
bc9f98a9 KY |
15015 | }; |
15016 | ||
8c427226 KY |
15017 | /* Set Unsolicited Event*/ |
15018 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | |
15019 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | |
15020 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15021 | {} | |
15022 | }; | |
15023 | ||
bc9f98a9 KY |
15024 | /* |
15025 | * generic initialization of ADC, input mixers and output mixers | |
15026 | */ | |
15027 | static struct hda_verb alc662_auto_init_verbs[] = { | |
15028 | /* | |
15029 | * Unmute ADC and set the default input to mic-in | |
15030 | */ | |
15031 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | |
15032 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15033 | ||
15034 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | |
15035 | * mixer widget | |
15036 | * Note: PASD motherboards uses the Line In 2 as the input for front | |
15037 | * panel mic (mic 2) | |
15038 | */ | |
15039 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | |
cb53c626 TI |
15040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
15041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
15042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | |
15043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | |
15044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | |
bc9f98a9 KY |
15045 | |
15046 | /* | |
15047 | * Set up output mixers (0x0c - 0x0f) | |
15048 | */ | |
15049 | /* set vol=0 to output mixers */ | |
15050 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15051 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15052 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | |
15053 | ||
15054 | /* set up input amps for analog loopback */ | |
15055 | /* Amp Indices: DAC = 0, mixer = 1 */ | |
b60dd394 KY |
15056 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
15057 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15058 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15059 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15060 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15061 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
bc9f98a9 KY |
15062 | |
15063 | ||
15064 | /* FIXME: use matrix-type input source selection */ | |
15065 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | |
15066 | /* Input mixer */ | |
15067 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
d1a991a6 | 15068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
bc9f98a9 KY |
15069 | { } |
15070 | }; | |
15071 | ||
24fb9173 TI |
15072 | /* additional verbs for ALC663 */ |
15073 | static struct hda_verb alc663_auto_init_verbs[] = { | |
15074 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
15075 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15076 | { } | |
15077 | }; | |
15078 | ||
6dda9f4a | 15079 | static struct hda_verb alc663_m51va_init_verbs[] = { |
f1d4e28b KY |
15080 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
15081 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
6dda9f4a KY |
15082 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
15083 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
f1d4e28b KY |
15084 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
15085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | |
15087 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15088 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15089 | {} | |
15090 | }; | |
15091 | ||
15092 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | |
15093 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15094 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15095 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
15096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15098 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15099 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15100 | {} | |
15101 | }; | |
15102 | ||
15103 | static struct hda_verb alc662_1bjd_amic_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, 0x00}, /* Headphone */ | |
15108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15110 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15111 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15112 | {} | |
15113 | }; | |
6dda9f4a | 15114 | |
f1d4e28b KY |
15115 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
15116 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15117 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15118 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
15119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15120 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15121 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15122 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15123 | {} | |
15124 | }; | |
6dda9f4a | 15125 | |
f1d4e28b KY |
15126 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
15127 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15128 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15129 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15130 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
15131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15132 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15133 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | |
15134 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15135 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
6dda9f4a KY |
15136 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
15137 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
f1d4e28b KY |
15138 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
15139 | {} | |
15140 | }; | |
15141 | ||
15142 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | |
15143 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | |
15144 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15145 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15146 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
15147 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15148 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15149 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | |
15150 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15151 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | |
15152 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15153 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15154 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
6dda9f4a KY |
15155 | {} |
15156 | }; | |
15157 | ||
15158 | static struct hda_verb alc663_g71v_init_verbs[] = { | |
15159 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15160 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | |
15161 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | |
15162 | ||
15163 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15164 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15165 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
15166 | ||
15167 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | |
15168 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | |
15169 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | |
15170 | {} | |
15171 | }; | |
15172 | ||
15173 | static struct hda_verb alc663_g50v_init_verbs[] = { | |
15174 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | |
15175 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | |
15176 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | |
15177 | ||
15178 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15179 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15180 | {} | |
15181 | }; | |
15182 | ||
f1d4e28b KY |
15183 | static struct hda_verb alc662_ecs_init_verbs[] = { |
15184 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | |
15185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | |
15186 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | |
15187 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | |
15188 | {} | |
15189 | }; | |
15190 | ||
bc9f98a9 KY |
15191 | /* capture mixer elements */ |
15192 | static struct snd_kcontrol_new alc662_capture_mixer[] = { | |
15193 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
15194 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
15195 | { | |
15196 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15197 | /* The multiple "Capture Source" controls confuse alsamixer | |
15198 | * So call somewhat different.. | |
bc9f98a9 KY |
15199 | */ |
15200 | /* .name = "Capture Source", */ | |
15201 | .name = "Input Source", | |
15202 | .count = 1, | |
54cbc9ab TI |
15203 | .info = alc_mux_enum_info, |
15204 | .get = alc_mux_enum_get, | |
15205 | .put = alc_mux_enum_put, | |
bc9f98a9 KY |
15206 | }, |
15207 | { } /* end */ | |
15208 | }; | |
15209 | ||
f1d4e28b KY |
15210 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
15211 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | |
15212 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | |
15213 | { } /* end */ | |
15214 | }; | |
15215 | ||
bc9f98a9 KY |
15216 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
15217 | { | |
15218 | unsigned int present; | |
f12ab1e0 | 15219 | unsigned char bits; |
bc9f98a9 KY |
15220 | |
15221 | present = snd_hda_codec_read(codec, 0x14, 0, | |
15222 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
15223 | bits = present ? HDA_AMP_MUTE : 0; |
15224 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
15225 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
15226 | } |
15227 | ||
15228 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | |
15229 | { | |
15230 | unsigned int present; | |
f12ab1e0 | 15231 | unsigned char bits; |
bc9f98a9 KY |
15232 | |
15233 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
15234 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
47fd830a TI |
15235 | bits = present ? HDA_AMP_MUTE : 0; |
15236 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
15237 | HDA_AMP_MUTE, bits); | |
15238 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
15239 | HDA_AMP_MUTE, bits); | |
bc9f98a9 KY |
15240 | } |
15241 | ||
15242 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | |
15243 | unsigned int res) | |
15244 | { | |
15245 | if ((res >> 26) == ALC880_HP_EVENT) | |
15246 | alc662_lenovo_101e_all_automute(codec); | |
15247 | if ((res >> 26) == ALC880_FRONT_EVENT) | |
15248 | alc662_lenovo_101e_ispeaker_automute(codec); | |
15249 | } | |
15250 | ||
291702f0 KY |
15251 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
15252 | { | |
15253 | unsigned int present; | |
15254 | ||
15255 | present = snd_hda_codec_read(codec, 0x18, 0, | |
15256 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | |
15257 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15258 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
15259 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15260 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | |
15261 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15262 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
15263 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
15264 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | |
15265 | } | |
15266 | ||
15267 | /* unsolicited event for HP jack sensing */ | |
15268 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | |
15269 | unsigned int res) | |
15270 | { | |
15271 | if ((res >> 26) == ALC880_HP_EVENT) | |
15272 | alc262_hippo1_automute( codec ); | |
15273 | ||
15274 | if ((res >> 26) == ALC880_MIC_EVENT) | |
15275 | alc662_eeepc_mic_automute(codec); | |
15276 | } | |
15277 | ||
15278 | static void alc662_eeepc_inithook(struct hda_codec *codec) | |
15279 | { | |
15280 | alc262_hippo1_automute( codec ); | |
15281 | alc662_eeepc_mic_automute(codec); | |
15282 | } | |
15283 | ||
8c427226 KY |
15284 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
15285 | { | |
15286 | unsigned int mute; | |
15287 | unsigned int present; | |
15288 | ||
15289 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); | |
15290 | present = snd_hda_codec_read(codec, 0x14, 0, | |
15291 | AC_VERB_GET_PIN_SENSE, 0); | |
15292 | present = (present & 0x80000000) != 0; | |
15293 | if (present) { | |
15294 | /* mute internal speaker */ | |
15295 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
ea1fb29a | 15296 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
8c427226 KY |
15297 | } else { |
15298 | /* unmute internal speaker if necessary */ | |
15299 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | |
15300 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | |
ea1fb29a | 15301 | HDA_AMP_MUTE, mute); |
8c427226 KY |
15302 | } |
15303 | } | |
15304 | ||
15305 | /* unsolicited event for HP jack sensing */ | |
15306 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, | |
15307 | unsigned int res) | |
15308 | { | |
15309 | if ((res >> 26) == ALC880_HP_EVENT) | |
15310 | alc662_eeepc_ep20_automute(codec); | |
15311 | } | |
15312 | ||
15313 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) | |
15314 | { | |
15315 | alc662_eeepc_ep20_automute(codec); | |
15316 | } | |
15317 | ||
6dda9f4a KY |
15318 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
15319 | { | |
15320 | unsigned int present; | |
15321 | unsigned char bits; | |
15322 | ||
15323 | present = snd_hda_codec_read(codec, 0x21, 0, | |
f1d4e28b KY |
15324 | AC_VERB_GET_PIN_SENSE, 0) |
15325 | & AC_PINSENSE_PRESENCE; | |
6dda9f4a | 15326 | bits = present ? HDA_AMP_MUTE : 0; |
f1d4e28b KY |
15327 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
15328 | AMP_IN_MUTE(0), bits); | |
15329 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15330 | AMP_IN_MUTE(0), bits); | |
15331 | } | |
15332 | ||
15333 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | |
15334 | { | |
15335 | unsigned int present; | |
15336 | unsigned char bits; | |
15337 | ||
15338 | present = snd_hda_codec_read(codec, 0x21, 0, | |
15339 | AC_VERB_GET_PIN_SENSE, 0) | |
15340 | & AC_PINSENSE_PRESENCE; | |
15341 | bits = present ? HDA_AMP_MUTE : 0; | |
15342 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
15343 | AMP_IN_MUTE(0), bits); | |
15344 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15345 | AMP_IN_MUTE(0), bits); | |
15346 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
15347 | AMP_IN_MUTE(0), bits); | |
15348 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
15349 | AMP_IN_MUTE(0), bits); | |
15350 | } | |
15351 | ||
15352 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | |
15353 | { | |
15354 | unsigned int present; | |
15355 | unsigned char bits; | |
15356 | ||
15357 | present = snd_hda_codec_read(codec, 0x15, 0, | |
15358 | AC_VERB_GET_PIN_SENSE, 0) | |
15359 | & AC_PINSENSE_PRESENCE; | |
15360 | bits = present ? HDA_AMP_MUTE : 0; | |
15361 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
15362 | AMP_IN_MUTE(0), bits); | |
15363 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15364 | AMP_IN_MUTE(0), bits); | |
15365 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | |
15366 | AMP_IN_MUTE(0), bits); | |
15367 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | |
15368 | AMP_IN_MUTE(0), bits); | |
15369 | } | |
15370 | ||
15371 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | |
15372 | { | |
15373 | unsigned int present; | |
15374 | unsigned char bits; | |
15375 | ||
15376 | present = snd_hda_codec_read(codec, 0x1b, 0, | |
15377 | AC_VERB_GET_PIN_SENSE, 0) | |
15378 | & AC_PINSENSE_PRESENCE; | |
15379 | bits = present ? 0 : PIN_OUT; | |
15380 | snd_hda_codec_write(codec, 0x14, 0, | |
15381 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | |
15382 | } | |
15383 | ||
15384 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | |
15385 | { | |
15386 | unsigned int present1, present2; | |
15387 | ||
15388 | present1 = snd_hda_codec_read(codec, 0x21, 0, | |
15389 | AC_VERB_GET_PIN_SENSE, 0) | |
15390 | & AC_PINSENSE_PRESENCE; | |
15391 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
15392 | AC_VERB_GET_PIN_SENSE, 0) | |
15393 | & AC_PINSENSE_PRESENCE; | |
15394 | ||
15395 | if (present1 || present2) { | |
15396 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
15397 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
15398 | } else { | |
15399 | snd_hda_codec_write_cache(codec, 0x14, 0, | |
15400 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
15401 | } | |
15402 | } | |
15403 | ||
15404 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |
15405 | { | |
15406 | unsigned int present1, present2; | |
15407 | ||
15408 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | |
15409 | AC_VERB_GET_PIN_SENSE, 0) | |
15410 | & AC_PINSENSE_PRESENCE; | |
15411 | present2 = snd_hda_codec_read(codec, 0x15, 0, | |
15412 | AC_VERB_GET_PIN_SENSE, 0) | |
15413 | & AC_PINSENSE_PRESENCE; | |
15414 | ||
15415 | if (present1 || present2) { | |
15416 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
15417 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | |
15418 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15419 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | |
15420 | } else { | |
15421 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | |
15422 | AMP_IN_MUTE(0), 0); | |
15423 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | |
15424 | AMP_IN_MUTE(0), 0); | |
15425 | } | |
6dda9f4a KY |
15426 | } |
15427 | ||
15428 | static void alc663_m51va_mic_automute(struct hda_codec *codec) | |
15429 | { | |
15430 | unsigned int present; | |
15431 | ||
15432 | present = snd_hda_codec_read(codec, 0x18, 0, | |
ea1fb29a KY |
15433 | AC_VERB_GET_PIN_SENSE, 0) |
15434 | & AC_PINSENSE_PRESENCE; | |
6dda9f4a | 15435 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
ea1fb29a | 15436 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
6dda9f4a | 15437 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
ea1fb29a | 15438 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
6dda9f4a | 15439 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
ea1fb29a | 15440 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
6dda9f4a | 15441 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
ea1fb29a | 15442 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
6dda9f4a KY |
15443 | } |
15444 | ||
15445 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | |
15446 | unsigned int res) | |
15447 | { | |
15448 | switch (res >> 26) { | |
15449 | case ALC880_HP_EVENT: | |
15450 | alc663_m51va_speaker_automute(codec); | |
15451 | break; | |
15452 | case ALC880_MIC_EVENT: | |
15453 | alc663_m51va_mic_automute(codec); | |
15454 | break; | |
15455 | } | |
15456 | } | |
15457 | ||
15458 | static void alc663_m51va_inithook(struct hda_codec *codec) | |
15459 | { | |
15460 | alc663_m51va_speaker_automute(codec); | |
15461 | alc663_m51va_mic_automute(codec); | |
15462 | } | |
15463 | ||
f1d4e28b KY |
15464 | /* ***************** Mode1 ******************************/ |
15465 | static void alc663_mode1_unsol_event(struct hda_codec *codec, | |
15466 | unsigned int res) | |
15467 | { | |
15468 | switch (res >> 26) { | |
15469 | case ALC880_HP_EVENT: | |
15470 | alc663_m51va_speaker_automute(codec); | |
15471 | break; | |
15472 | case ALC880_MIC_EVENT: | |
15473 | alc662_eeepc_mic_automute(codec); | |
15474 | break; | |
15475 | } | |
15476 | } | |
15477 | ||
15478 | static void alc663_mode1_inithook(struct hda_codec *codec) | |
15479 | { | |
15480 | alc663_m51va_speaker_automute(codec); | |
15481 | alc662_eeepc_mic_automute(codec); | |
15482 | } | |
15483 | /* ***************** Mode2 ******************************/ | |
15484 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | |
15485 | unsigned int res) | |
15486 | { | |
15487 | switch (res >> 26) { | |
15488 | case ALC880_HP_EVENT: | |
15489 | alc662_f5z_speaker_automute(codec); | |
15490 | break; | |
15491 | case ALC880_MIC_EVENT: | |
15492 | alc662_eeepc_mic_automute(codec); | |
15493 | break; | |
15494 | } | |
15495 | } | |
15496 | ||
15497 | static void alc662_mode2_inithook(struct hda_codec *codec) | |
15498 | { | |
15499 | alc662_f5z_speaker_automute(codec); | |
15500 | alc662_eeepc_mic_automute(codec); | |
15501 | } | |
15502 | /* ***************** Mode3 ******************************/ | |
15503 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | |
15504 | unsigned int res) | |
15505 | { | |
15506 | switch (res >> 26) { | |
15507 | case ALC880_HP_EVENT: | |
15508 | alc663_two_hp_m1_speaker_automute(codec); | |
15509 | break; | |
15510 | case ALC880_MIC_EVENT: | |
15511 | alc662_eeepc_mic_automute(codec); | |
15512 | break; | |
15513 | } | |
15514 | } | |
15515 | ||
15516 | static void alc663_mode3_inithook(struct hda_codec *codec) | |
15517 | { | |
15518 | alc663_two_hp_m1_speaker_automute(codec); | |
15519 | alc662_eeepc_mic_automute(codec); | |
15520 | } | |
15521 | /* ***************** Mode4 ******************************/ | |
15522 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | |
15523 | unsigned int res) | |
15524 | { | |
15525 | switch (res >> 26) { | |
15526 | case ALC880_HP_EVENT: | |
15527 | alc663_21jd_two_speaker_automute(codec); | |
15528 | break; | |
15529 | case ALC880_MIC_EVENT: | |
15530 | alc662_eeepc_mic_automute(codec); | |
15531 | break; | |
15532 | } | |
15533 | } | |
15534 | ||
15535 | static void alc663_mode4_inithook(struct hda_codec *codec) | |
15536 | { | |
15537 | alc663_21jd_two_speaker_automute(codec); | |
15538 | alc662_eeepc_mic_automute(codec); | |
15539 | } | |
15540 | /* ***************** Mode5 ******************************/ | |
15541 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | |
15542 | unsigned int res) | |
15543 | { | |
15544 | switch (res >> 26) { | |
15545 | case ALC880_HP_EVENT: | |
15546 | alc663_15jd_two_speaker_automute(codec); | |
15547 | break; | |
15548 | case ALC880_MIC_EVENT: | |
15549 | alc662_eeepc_mic_automute(codec); | |
15550 | break; | |
15551 | } | |
15552 | } | |
15553 | ||
15554 | static void alc663_mode5_inithook(struct hda_codec *codec) | |
15555 | { | |
15556 | alc663_15jd_two_speaker_automute(codec); | |
15557 | alc662_eeepc_mic_automute(codec); | |
15558 | } | |
15559 | /* ***************** Mode6 ******************************/ | |
15560 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | |
15561 | unsigned int res) | |
15562 | { | |
15563 | switch (res >> 26) { | |
15564 | case ALC880_HP_EVENT: | |
15565 | alc663_two_hp_m2_speaker_automute(codec); | |
15566 | break; | |
15567 | case ALC880_MIC_EVENT: | |
15568 | alc662_eeepc_mic_automute(codec); | |
15569 | break; | |
15570 | } | |
15571 | } | |
15572 | ||
15573 | static void alc663_mode6_inithook(struct hda_codec *codec) | |
15574 | { | |
15575 | alc663_two_hp_m2_speaker_automute(codec); | |
15576 | alc662_eeepc_mic_automute(codec); | |
15577 | } | |
15578 | ||
6dda9f4a KY |
15579 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
15580 | { | |
15581 | unsigned int present; | |
15582 | unsigned char bits; | |
15583 | ||
15584 | present = snd_hda_codec_read(codec, 0x21, 0, | |
15585 | AC_VERB_GET_PIN_SENSE, 0) | |
15586 | & AC_PINSENSE_PRESENCE; | |
15587 | bits = present ? HDA_AMP_MUTE : 0; | |
15588 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | |
15589 | HDA_AMP_MUTE, bits); | |
15590 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
15591 | HDA_AMP_MUTE, bits); | |
15592 | } | |
15593 | ||
15594 | static void alc663_g71v_front_automute(struct hda_codec *codec) | |
15595 | { | |
15596 | unsigned int present; | |
15597 | unsigned char bits; | |
15598 | ||
15599 | present = snd_hda_codec_read(codec, 0x15, 0, | |
15600 | AC_VERB_GET_PIN_SENSE, 0) | |
15601 | & AC_PINSENSE_PRESENCE; | |
15602 | bits = present ? HDA_AMP_MUTE : 0; | |
15603 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | |
15604 | HDA_AMP_MUTE, bits); | |
15605 | } | |
15606 | ||
15607 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | |
15608 | unsigned int res) | |
15609 | { | |
15610 | switch (res >> 26) { | |
15611 | case ALC880_HP_EVENT: | |
15612 | alc663_g71v_hp_automute(codec); | |
15613 | break; | |
15614 | case ALC880_FRONT_EVENT: | |
15615 | alc663_g71v_front_automute(codec); | |
15616 | break; | |
15617 | case ALC880_MIC_EVENT: | |
15618 | alc662_eeepc_mic_automute(codec); | |
15619 | break; | |
15620 | } | |
15621 | } | |
15622 | ||
15623 | static void alc663_g71v_inithook(struct hda_codec *codec) | |
15624 | { | |
15625 | alc663_g71v_front_automute(codec); | |
15626 | alc663_g71v_hp_automute(codec); | |
15627 | alc662_eeepc_mic_automute(codec); | |
15628 | } | |
15629 | ||
15630 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | |
15631 | unsigned int res) | |
15632 | { | |
15633 | switch (res >> 26) { | |
15634 | case ALC880_HP_EVENT: | |
15635 | alc663_m51va_speaker_automute(codec); | |
15636 | break; | |
15637 | case ALC880_MIC_EVENT: | |
15638 | alc662_eeepc_mic_automute(codec); | |
15639 | break; | |
15640 | } | |
15641 | } | |
15642 | ||
15643 | static void alc663_g50v_inithook(struct hda_codec *codec) | |
15644 | { | |
15645 | alc663_m51va_speaker_automute(codec); | |
15646 | alc662_eeepc_mic_automute(codec); | |
15647 | } | |
15648 | ||
f1d4e28b KY |
15649 | /* bind hp and internal speaker mute (with plug check) */ |
15650 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, | |
15651 | struct snd_ctl_elem_value *ucontrol) | |
15652 | { | |
15653 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
15654 | long *valp = ucontrol->value.integer.value; | |
15655 | int change; | |
15656 | ||
15657 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, | |
15658 | HDA_AMP_MUTE, | |
15659 | valp[0] ? 0 : HDA_AMP_MUTE); | |
15660 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, | |
15661 | HDA_AMP_MUTE, | |
15662 | valp[1] ? 0 : HDA_AMP_MUTE); | |
15663 | if (change) | |
15664 | alc262_hippo1_automute(codec); | |
15665 | return change; | |
15666 | } | |
15667 | ||
15668 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | |
15669 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | |
15670 | { | |
15671 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
15672 | .name = "Master Playback Switch", | |
15673 | .info = snd_hda_mixer_amp_switch_info, | |
15674 | .get = snd_hda_mixer_amp_switch_get, | |
15675 | .put = alc662_ecs_master_sw_put, | |
15676 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | |
15677 | }, | |
15678 | ||
15679 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | |
15680 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | |
15681 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | |
15682 | ||
15683 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | |
15684 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | |
15685 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | |
15686 | { } /* end */ | |
15687 | }; | |
15688 | ||
cb53c626 TI |
15689 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15690 | #define alc662_loopbacks alc880_loopbacks | |
15691 | #endif | |
15692 | ||
bc9f98a9 KY |
15693 | |
15694 | /* pcm configuration: identiacal with ALC880 */ | |
15695 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback | |
15696 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | |
15697 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | |
15698 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | |
15699 | ||
15700 | /* | |
15701 | * configuration and preset | |
15702 | */ | |
15703 | static const char *alc662_models[ALC662_MODEL_LAST] = { | |
15704 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | |
15705 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | |
15706 | [ALC662_3ST_6ch] = "3stack-6ch", | |
15707 | [ALC662_5ST_DIG] = "6stack-dig", | |
15708 | [ALC662_LENOVO_101E] = "lenovo-101e", | |
b995d76d | 15709 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
8c427226 | 15710 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
f1d4e28b | 15711 | [ALC662_ECS] = "ecs", |
6dda9f4a KY |
15712 | [ALC663_ASUS_M51VA] = "m51va", |
15713 | [ALC663_ASUS_G71V] = "g71v", | |
15714 | [ALC663_ASUS_H13] = "h13", | |
15715 | [ALC663_ASUS_G50V] = "g50v", | |
f1d4e28b KY |
15716 | [ALC663_ASUS_MODE1] = "asus-mode1", |
15717 | [ALC662_ASUS_MODE2] = "asus-mode2", | |
15718 | [ALC663_ASUS_MODE3] = "asus-mode3", | |
15719 | [ALC663_ASUS_MODE4] = "asus-mode4", | |
15720 | [ALC663_ASUS_MODE5] = "asus-mode5", | |
15721 | [ALC663_ASUS_MODE6] = "asus-mode6", | |
bc9f98a9 KY |
15722 | [ALC662_AUTO] = "auto", |
15723 | }; | |
15724 | ||
15725 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | |
6dda9f4a | 15726 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
80ffe869 | 15727 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
3da23cac | 15728 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
291702f0 | 15729 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
8c427226 | 15730 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
f1d4e28b KY |
15731 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
15732 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), | |
15733 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | |
15734 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | |
15735 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | |
15736 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), | |
15737 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | |
15738 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | |
15739 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | |
80ffe869 | 15740 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
f1d4e28b KY |
15741 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
15742 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | |
15743 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | |
15744 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | |
15745 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | |
15746 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | |
15747 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | |
15748 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | |
15749 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | |
15750 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | |
15751 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | |
15752 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | |
15753 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | |
15754 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | |
15755 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | |
15756 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | |
15757 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | |
15758 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | |
15759 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | |
15760 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | |
15761 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | |
15762 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | |
95fe5f2c HRK |
15763 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
15764 | ALC662_3ST_6ch_DIG), | |
ac3e3741 | 15765 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
f1d4e28b KY |
15766 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
15767 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | |
cb55974c HRK |
15768 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
15769 | ALC662_3ST_6ch_DIG), | |
19c009aa | 15770 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
238713d4 | 15771 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
19c009aa | 15772 | ALC662_3ST_6ch_DIG), |
6dda9f4a KY |
15773 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
15774 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), | |
15775 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), | |
bc9f98a9 KY |
15776 | {} |
15777 | }; | |
15778 | ||
15779 | static struct alc_config_preset alc662_presets[] = { | |
15780 | [ALC662_3ST_2ch_DIG] = { | |
291702f0 | 15781 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
bc9f98a9 KY |
15782 | .init_verbs = { alc662_init_verbs }, |
15783 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15784 | .dac_nids = alc662_dac_nids, | |
15785 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
15786 | .dig_in_nid = ALC662_DIGIN_NID, |
15787 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15788 | .channel_mode = alc662_3ST_2ch_modes, | |
15789 | .input_mux = &alc662_capture_source, | |
15790 | }, | |
15791 | [ALC662_3ST_6ch_DIG] = { | |
291702f0 KY |
15792 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
15793 | alc662_capture_mixer }, | |
bc9f98a9 KY |
15794 | .init_verbs = { alc662_init_verbs }, |
15795 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15796 | .dac_nids = alc662_dac_nids, | |
15797 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
15798 | .dig_in_nid = ALC662_DIGIN_NID, |
15799 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
15800 | .channel_mode = alc662_3ST_6ch_modes, | |
15801 | .need_dac_fix = 1, | |
15802 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 15803 | }, |
bc9f98a9 | 15804 | [ALC662_3ST_6ch] = { |
291702f0 KY |
15805 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
15806 | alc662_capture_mixer }, | |
bc9f98a9 KY |
15807 | .init_verbs = { alc662_init_verbs }, |
15808 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15809 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
15810 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
15811 | .channel_mode = alc662_3ST_6ch_modes, | |
15812 | .need_dac_fix = 1, | |
15813 | .input_mux = &alc662_capture_source, | |
f12ab1e0 | 15814 | }, |
bc9f98a9 | 15815 | [ALC662_5ST_DIG] = { |
291702f0 KY |
15816 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
15817 | alc662_capture_mixer }, | |
bc9f98a9 KY |
15818 | .init_verbs = { alc662_init_verbs }, |
15819 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15820 | .dac_nids = alc662_dac_nids, | |
15821 | .dig_out_nid = ALC662_DIGOUT_NID, | |
bc9f98a9 KY |
15822 | .dig_in_nid = ALC662_DIGIN_NID, |
15823 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | |
15824 | .channel_mode = alc662_5stack_modes, | |
15825 | .input_mux = &alc662_capture_source, | |
15826 | }, | |
15827 | [ALC662_LENOVO_101E] = { | |
291702f0 | 15828 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
bc9f98a9 KY |
15829 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
15830 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15831 | .dac_nids = alc662_dac_nids, | |
bc9f98a9 KY |
15832 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
15833 | .channel_mode = alc662_3ST_2ch_modes, | |
15834 | .input_mux = &alc662_lenovo_101e_capture_source, | |
15835 | .unsol_event = alc662_lenovo_101e_unsol_event, | |
15836 | .init_hook = alc662_lenovo_101e_all_automute, | |
15837 | }, | |
291702f0 KY |
15838 | [ALC662_ASUS_EEEPC_P701] = { |
15839 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, | |
15840 | .init_verbs = { alc662_init_verbs, | |
15841 | alc662_eeepc_sue_init_verbs }, | |
15842 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15843 | .dac_nids = alc662_dac_nids, | |
291702f0 KY |
15844 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
15845 | .channel_mode = alc662_3ST_2ch_modes, | |
15846 | .input_mux = &alc662_eeepc_capture_source, | |
15847 | .unsol_event = alc662_eeepc_unsol_event, | |
15848 | .init_hook = alc662_eeepc_inithook, | |
15849 | }, | |
8c427226 KY |
15850 | [ALC662_ASUS_EEEPC_EP20] = { |
15851 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, | |
15852 | alc662_chmode_mixer }, | |
15853 | .init_verbs = { alc662_init_verbs, | |
15854 | alc662_eeepc_ep20_sue_init_verbs }, | |
15855 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15856 | .dac_nids = alc662_dac_nids, | |
8c427226 KY |
15857 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
15858 | .channel_mode = alc662_3ST_6ch_modes, | |
15859 | .input_mux = &alc662_lenovo_101e_capture_source, | |
15860 | .unsol_event = alc662_eeepc_ep20_unsol_event, | |
15861 | .init_hook = alc662_eeepc_ep20_inithook, | |
15862 | }, | |
f1d4e28b KY |
15863 | [ALC662_ECS] = { |
15864 | .mixers = { alc662_ecs_mixer, alc662_capture_mixer }, | |
15865 | .init_verbs = { alc662_init_verbs, | |
15866 | alc662_ecs_init_verbs }, | |
15867 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15868 | .dac_nids = alc662_dac_nids, | |
15869 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15870 | .channel_mode = alc662_3ST_2ch_modes, | |
15871 | .input_mux = &alc662_eeepc_capture_source, | |
15872 | .unsol_event = alc662_eeepc_unsol_event, | |
15873 | .init_hook = alc662_eeepc_inithook, | |
15874 | }, | |
6dda9f4a KY |
15875 | [ALC663_ASUS_M51VA] = { |
15876 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, | |
15877 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
15878 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15879 | .dac_nids = alc662_dac_nids, | |
15880 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15881 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15882 | .channel_mode = alc662_3ST_2ch_modes, | |
15883 | .input_mux = &alc663_m51va_capture_source, | |
15884 | .unsol_event = alc663_m51va_unsol_event, | |
15885 | .init_hook = alc663_m51va_inithook, | |
15886 | }, | |
15887 | [ALC663_ASUS_G71V] = { | |
15888 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, | |
15889 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, | |
15890 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15891 | .dac_nids = alc662_dac_nids, | |
15892 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15893 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15894 | .channel_mode = alc662_3ST_2ch_modes, | |
15895 | .input_mux = &alc662_eeepc_capture_source, | |
15896 | .unsol_event = alc663_g71v_unsol_event, | |
15897 | .init_hook = alc663_g71v_inithook, | |
15898 | }, | |
15899 | [ALC663_ASUS_H13] = { | |
15900 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, | |
15901 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | |
15902 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15903 | .dac_nids = alc662_dac_nids, | |
15904 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15905 | .channel_mode = alc662_3ST_2ch_modes, | |
15906 | .input_mux = &alc663_m51va_capture_source, | |
15907 | .unsol_event = alc663_m51va_unsol_event, | |
15908 | .init_hook = alc663_m51va_inithook, | |
15909 | }, | |
15910 | [ALC663_ASUS_G50V] = { | |
15911 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, | |
15912 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, | |
15913 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15914 | .dac_nids = alc662_dac_nids, | |
15915 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15916 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | |
15917 | .channel_mode = alc662_3ST_6ch_modes, | |
15918 | .input_mux = &alc663_capture_source, | |
15919 | .unsol_event = alc663_g50v_unsol_event, | |
15920 | .init_hook = alc663_g50v_inithook, | |
15921 | }, | |
f1d4e28b KY |
15922 | [ALC663_ASUS_MODE1] = { |
15923 | .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer }, | |
15924 | .init_verbs = { alc662_init_verbs, | |
15925 | alc663_21jd_amic_init_verbs }, | |
15926 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15927 | .hp_nid = 0x03, | |
15928 | .dac_nids = alc662_dac_nids, | |
15929 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15930 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15931 | .channel_mode = alc662_3ST_2ch_modes, | |
15932 | .input_mux = &alc662_eeepc_capture_source, | |
15933 | .unsol_event = alc663_mode1_unsol_event, | |
15934 | .init_hook = alc663_mode1_inithook, | |
15935 | }, | |
15936 | [ALC662_ASUS_MODE2] = { | |
15937 | .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer }, | |
15938 | .init_verbs = { alc662_init_verbs, | |
15939 | alc662_1bjd_amic_init_verbs }, | |
15940 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15941 | .dac_nids = alc662_dac_nids, | |
15942 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15944 | .channel_mode = alc662_3ST_2ch_modes, | |
15945 | .input_mux = &alc662_eeepc_capture_source, | |
15946 | .unsol_event = alc662_mode2_unsol_event, | |
15947 | .init_hook = alc662_mode2_inithook, | |
15948 | }, | |
15949 | [ALC663_ASUS_MODE3] = { | |
15950 | .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer }, | |
15951 | .init_verbs = { alc662_init_verbs, | |
15952 | alc663_two_hp_amic_m1_init_verbs }, | |
15953 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15954 | .hp_nid = 0x03, | |
15955 | .dac_nids = alc662_dac_nids, | |
15956 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15957 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15958 | .channel_mode = alc662_3ST_2ch_modes, | |
15959 | .input_mux = &alc662_eeepc_capture_source, | |
15960 | .unsol_event = alc663_mode3_unsol_event, | |
15961 | .init_hook = alc663_mode3_inithook, | |
15962 | }, | |
15963 | [ALC663_ASUS_MODE4] = { | |
15964 | .mixers = { alc663_asus_21jd_clfe_mixer, | |
15965 | alc662_auto_capture_mixer}, | |
15966 | .init_verbs = { alc662_init_verbs, | |
15967 | alc663_21jd_amic_init_verbs}, | |
15968 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15969 | .hp_nid = 0x03, | |
15970 | .dac_nids = alc662_dac_nids, | |
15971 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15972 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15973 | .channel_mode = alc662_3ST_2ch_modes, | |
15974 | .input_mux = &alc662_eeepc_capture_source, | |
15975 | .unsol_event = alc663_mode4_unsol_event, | |
15976 | .init_hook = alc663_mode4_inithook, | |
15977 | }, | |
15978 | [ALC663_ASUS_MODE5] = { | |
15979 | .mixers = { alc663_asus_15jd_clfe_mixer, | |
15980 | alc662_auto_capture_mixer }, | |
15981 | .init_verbs = { alc662_init_verbs, | |
15982 | alc663_15jd_amic_init_verbs }, | |
15983 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15984 | .hp_nid = 0x03, | |
15985 | .dac_nids = alc662_dac_nids, | |
15986 | .dig_out_nid = ALC662_DIGOUT_NID, | |
15987 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
15988 | .channel_mode = alc662_3ST_2ch_modes, | |
15989 | .input_mux = &alc662_eeepc_capture_source, | |
15990 | .unsol_event = alc663_mode5_unsol_event, | |
15991 | .init_hook = alc663_mode5_inithook, | |
15992 | }, | |
15993 | [ALC663_ASUS_MODE6] = { | |
15994 | .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer }, | |
15995 | .init_verbs = { alc662_init_verbs, | |
15996 | alc663_two_hp_amic_m2_init_verbs }, | |
15997 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | |
15998 | .hp_nid = 0x03, | |
15999 | .dac_nids = alc662_dac_nids, | |
16000 | .dig_out_nid = ALC662_DIGOUT_NID, | |
16001 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | |
16002 | .channel_mode = alc662_3ST_2ch_modes, | |
16003 | .input_mux = &alc662_eeepc_capture_source, | |
16004 | .unsol_event = alc663_mode6_unsol_event, | |
16005 | .init_hook = alc663_mode6_inithook, | |
16006 | }, | |
bc9f98a9 KY |
16007 | }; |
16008 | ||
16009 | ||
16010 | /* | |
16011 | * BIOS auto configuration | |
16012 | */ | |
16013 | ||
16014 | /* add playback controls from the parsed DAC table */ | |
16015 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |
16016 | const struct auto_pin_cfg *cfg) | |
16017 | { | |
16018 | char name[32]; | |
16019 | static const char *chname[4] = { | |
16020 | "Front", "Surround", NULL /*CLFE*/, "Side" | |
16021 | }; | |
16022 | hda_nid_t nid; | |
16023 | int i, err; | |
16024 | ||
16025 | for (i = 0; i < cfg->line_outs; i++) { | |
16026 | if (!spec->multiout.dac_nids[i]) | |
16027 | continue; | |
b60dd394 | 16028 | nid = alc880_idx_to_dac(i); |
bc9f98a9 KY |
16029 | if (i == 2) { |
16030 | /* Center/LFE */ | |
16031 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
16032 | "Center Playback Volume", | |
f12ab1e0 TI |
16033 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
16034 | HDA_OUTPUT)); | |
bc9f98a9 KY |
16035 | if (err < 0) |
16036 | return err; | |
16037 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | |
16038 | "LFE Playback Volume", | |
f12ab1e0 TI |
16039 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
16040 | HDA_OUTPUT)); | |
bc9f98a9 KY |
16041 | if (err < 0) |
16042 | return err; | |
b69ce01a | 16043 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
bc9f98a9 | 16044 | "Center Playback Switch", |
b69ce01a | 16045 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
f12ab1e0 | 16046 | HDA_INPUT)); |
bc9f98a9 KY |
16047 | if (err < 0) |
16048 | return err; | |
b69ce01a | 16049 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
bc9f98a9 | 16050 | "LFE Playback Switch", |
b69ce01a | 16051 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
f12ab1e0 | 16052 | HDA_INPUT)); |
bc9f98a9 KY |
16053 | if (err < 0) |
16054 | return err; | |
16055 | } else { | |
16056 | sprintf(name, "%s Playback Volume", chname[i]); | |
16057 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
f12ab1e0 TI |
16058 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
16059 | HDA_OUTPUT)); | |
bc9f98a9 KY |
16060 | if (err < 0) |
16061 | return err; | |
16062 | sprintf(name, "%s Playback Switch", chname[i]); | |
b69ce01a HRK |
16063 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
16064 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), | |
16065 | 3, 0, HDA_INPUT)); | |
bc9f98a9 KY |
16066 | if (err < 0) |
16067 | return err; | |
16068 | } | |
16069 | } | |
16070 | return 0; | |
16071 | } | |
16072 | ||
16073 | /* add playback controls for speaker and HP outputs */ | |
16074 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |
16075 | const char *pfx) | |
16076 | { | |
16077 | hda_nid_t nid; | |
16078 | int err; | |
16079 | char name[32]; | |
16080 | ||
16081 | if (!pin) | |
16082 | return 0; | |
16083 | ||
24fb9173 TI |
16084 | if (pin == 0x17) { |
16085 | /* ALC663 has a mono output pin on 0x17 */ | |
16086 | sprintf(name, "%s Playback Switch", pfx); | |
16087 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
16088 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); | |
16089 | return err; | |
16090 | } | |
16091 | ||
bc9f98a9 KY |
16092 | if (alc880_is_fixed_pin(pin)) { |
16093 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
16094 | /* printk("DAC nid=%x\n",nid); */ | |
16095 | /* specify the DAC as the extra output */ | |
16096 | if (!spec->multiout.hp_nid) | |
16097 | spec->multiout.hp_nid = nid; | |
16098 | else | |
16099 | spec->multiout.extra_out_nid[0] = nid; | |
16100 | /* control HP volume/switch on the output mixer amp */ | |
16101 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | |
16102 | sprintf(name, "%s Playback Volume", pfx); | |
16103 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | |
16104 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | |
16105 | if (err < 0) | |
16106 | return err; | |
16107 | sprintf(name, "%s Playback Switch", pfx); | |
16108 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | |
16109 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | |
16110 | if (err < 0) | |
16111 | return err; | |
16112 | } else if (alc880_is_multi_pin(pin)) { | |
16113 | /* set manual connection */ | |
16114 | /* we have only a switch on HP-out PIN */ | |
16115 | sprintf(name, "%s Playback Switch", pfx); | |
16116 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | |
16117 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | |
16118 | if (err < 0) | |
16119 | return err; | |
16120 | } | |
16121 | return 0; | |
16122 | } | |
16123 | ||
16124 | /* create playback/capture controls for input pins */ | |
16125 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, | |
16126 | const struct auto_pin_cfg *cfg) | |
16127 | { | |
16128 | struct hda_input_mux *imux = &spec->private_imux; | |
16129 | int i, err, idx; | |
16130 | ||
16131 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
16132 | if (alc880_is_input_pin(cfg->input_pins[i])) { | |
16133 | idx = alc880_input_pin_idx(cfg->input_pins[i]); | |
16134 | err = new_analog_input(spec, cfg->input_pins[i], | |
16135 | auto_pin_cfg_labels[i], | |
16136 | idx, 0x0b); | |
16137 | if (err < 0) | |
16138 | return err; | |
16139 | imux->items[imux->num_items].label = | |
16140 | auto_pin_cfg_labels[i]; | |
16141 | imux->items[imux->num_items].index = | |
16142 | alc880_input_pin_idx(cfg->input_pins[i]); | |
16143 | imux->num_items++; | |
16144 | } | |
16145 | } | |
16146 | return 0; | |
16147 | } | |
16148 | ||
16149 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |
16150 | hda_nid_t nid, int pin_type, | |
16151 | int dac_idx) | |
16152 | { | |
f6c7e546 | 16153 | alc_set_pin_output(codec, nid, pin_type); |
bc9f98a9 KY |
16154 | /* need the manual connection? */ |
16155 | if (alc880_is_multi_pin(nid)) { | |
16156 | struct alc_spec *spec = codec->spec; | |
16157 | int idx = alc880_multi_pin_idx(nid); | |
16158 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | |
16159 | AC_VERB_SET_CONNECT_SEL, | |
16160 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | |
16161 | } | |
16162 | } | |
16163 | ||
16164 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | |
16165 | { | |
16166 | struct alc_spec *spec = codec->spec; | |
16167 | int i; | |
16168 | ||
8c427226 | 16169 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
bc9f98a9 KY |
16170 | for (i = 0; i <= HDA_SIDE; i++) { |
16171 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | |
baba8ee9 | 16172 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
bc9f98a9 | 16173 | if (nid) |
baba8ee9 | 16174 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
bc9f98a9 KY |
16175 | i); |
16176 | } | |
16177 | } | |
16178 | ||
16179 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | |
16180 | { | |
16181 | struct alc_spec *spec = codec->spec; | |
16182 | hda_nid_t pin; | |
16183 | ||
16184 | pin = spec->autocfg.hp_pins[0]; | |
16185 | if (pin) /* connect to front */ | |
16186 | /* use dac 0 */ | |
16187 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | |
f6c7e546 TI |
16188 | pin = spec->autocfg.speaker_pins[0]; |
16189 | if (pin) | |
16190 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | |
bc9f98a9 KY |
16191 | } |
16192 | ||
16193 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) | |
16194 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | |
16195 | ||
16196 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | |
16197 | { | |
16198 | struct alc_spec *spec = codec->spec; | |
16199 | int i; | |
16200 | ||
16201 | for (i = 0; i < AUTO_PIN_LAST; i++) { | |
16202 | hda_nid_t nid = spec->autocfg.input_pins[i]; | |
16203 | if (alc662_is_input_pin(nid)) { | |
16204 | snd_hda_codec_write(codec, nid, 0, | |
16205 | AC_VERB_SET_PIN_WIDGET_CONTROL, | |
16206 | (i <= AUTO_PIN_FRONT_MIC ? | |
16207 | PIN_VREF80 : PIN_IN)); | |
16208 | if (nid != ALC662_PIN_CD_NID) | |
16209 | snd_hda_codec_write(codec, nid, 0, | |
16210 | AC_VERB_SET_AMP_GAIN_MUTE, | |
16211 | AMP_OUT_MUTE); | |
16212 | } | |
16213 | } | |
16214 | } | |
16215 | ||
f511b01c TI |
16216 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
16217 | ||
bc9f98a9 KY |
16218 | static int alc662_parse_auto_config(struct hda_codec *codec) |
16219 | { | |
16220 | struct alc_spec *spec = codec->spec; | |
16221 | int err; | |
16222 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | |
16223 | ||
16224 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | |
16225 | alc662_ignore); | |
16226 | if (err < 0) | |
16227 | return err; | |
16228 | if (!spec->autocfg.line_outs) | |
16229 | return 0; /* can't find valid BIOS pin config */ | |
16230 | ||
f12ab1e0 TI |
16231 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
16232 | if (err < 0) | |
16233 | return err; | |
16234 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); | |
16235 | if (err < 0) | |
16236 | return err; | |
16237 | err = alc662_auto_create_extra_out(spec, | |
16238 | spec->autocfg.speaker_pins[0], | |
16239 | "Speaker"); | |
16240 | if (err < 0) | |
16241 | return err; | |
16242 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | |
16243 | "Headphone"); | |
16244 | if (err < 0) | |
16245 | return err; | |
16246 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); | |
16247 | if (err < 0) | |
bc9f98a9 KY |
16248 | return err; |
16249 | ||
16250 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | |
16251 | ||
16252 | if (spec->autocfg.dig_out_pin) | |
16253 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | |
16254 | ||
603c4019 | 16255 | if (spec->kctls.list) |
d88897ea | 16256 | add_mixer(spec, spec->kctls.list); |
bc9f98a9 KY |
16257 | |
16258 | spec->num_mux_defs = 1; | |
16259 | spec->input_mux = &spec->private_imux; | |
ea1fb29a | 16260 | |
d88897ea | 16261 | add_verb(spec, alc662_auto_init_verbs); |
24fb9173 | 16262 | if (codec->vendor_id == 0x10ec0663) |
d88897ea | 16263 | add_verb(spec, alc663_auto_init_verbs); |
ee979a14 TI |
16264 | |
16265 | err = alc_auto_add_mic_boost(codec); | |
16266 | if (err < 0) | |
16267 | return err; | |
16268 | ||
d88897ea | 16269 | add_mixer(spec, alc662_capture_mixer); |
e044c39a TI |
16270 | |
16271 | store_pin_configs(codec); | |
8c87286f | 16272 | return 1; |
bc9f98a9 KY |
16273 | } |
16274 | ||
16275 | /* additional initialization for auto-configuration model */ | |
16276 | static void alc662_auto_init(struct hda_codec *codec) | |
16277 | { | |
f6c7e546 | 16278 | struct alc_spec *spec = codec->spec; |
bc9f98a9 KY |
16279 | alc662_auto_init_multi_out(codec); |
16280 | alc662_auto_init_hp_out(codec); | |
16281 | alc662_auto_init_analog_input(codec); | |
f511b01c | 16282 | alc662_auto_init_input_src(codec); |
f6c7e546 | 16283 | if (spec->unsol_event) |
7fb0d78f | 16284 | alc_inithook(codec); |
bc9f98a9 KY |
16285 | } |
16286 | ||
16287 | static int patch_alc662(struct hda_codec *codec) | |
16288 | { | |
16289 | struct alc_spec *spec; | |
16290 | int err, board_config; | |
16291 | ||
16292 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
16293 | if (!spec) | |
16294 | return -ENOMEM; | |
16295 | ||
16296 | codec->spec = spec; | |
16297 | ||
2c3bf9ab TI |
16298 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
16299 | ||
bc9f98a9 KY |
16300 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
16301 | alc662_models, | |
16302 | alc662_cfg_tbl); | |
16303 | if (board_config < 0) { | |
16304 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " | |
16305 | "trying auto-probe from BIOS...\n"); | |
16306 | board_config = ALC662_AUTO; | |
16307 | } | |
16308 | ||
16309 | if (board_config == ALC662_AUTO) { | |
16310 | /* automatic parse from the BIOS config */ | |
16311 | err = alc662_parse_auto_config(codec); | |
16312 | if (err < 0) { | |
16313 | alc_free(codec); | |
16314 | return err; | |
8c87286f | 16315 | } else if (!err) { |
bc9f98a9 KY |
16316 | printk(KERN_INFO |
16317 | "hda_codec: Cannot set up configuration " | |
16318 | "from BIOS. Using base mode...\n"); | |
16319 | board_config = ALC662_3ST_2ch_DIG; | |
16320 | } | |
16321 | } | |
16322 | ||
16323 | if (board_config != ALC662_AUTO) | |
16324 | setup_preset(spec, &alc662_presets[board_config]); | |
16325 | ||
6dda9f4a KY |
16326 | if (codec->vendor_id == 0x10ec0663) { |
16327 | spec->stream_name_analog = "ALC663 Analog"; | |
16328 | spec->stream_name_digital = "ALC663 Digital"; | |
01afd41f KY |
16329 | } else if (codec->vendor_id == 0x10ec0272) { |
16330 | spec->stream_name_analog = "ALC272 Analog"; | |
16331 | spec->stream_name_digital = "ALC272 Digital"; | |
6dda9f4a KY |
16332 | } else { |
16333 | spec->stream_name_analog = "ALC662 Analog"; | |
16334 | spec->stream_name_digital = "ALC662 Digital"; | |
16335 | } | |
16336 | ||
bc9f98a9 KY |
16337 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
16338 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | |
16339 | ||
bc9f98a9 KY |
16340 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
16341 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | |
16342 | ||
e1406348 TI |
16343 | spec->adc_nids = alc662_adc_nids; |
16344 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | |
16345 | spec->capsrc_nids = alc662_capsrc_nids; | |
54cbc9ab | 16346 | spec->is_mix_capture = 1; |
bc9f98a9 | 16347 | |
2134ea4f TI |
16348 | spec->vmaster_nid = 0x02; |
16349 | ||
bc9f98a9 KY |
16350 | codec->patch_ops = alc_patch_ops; |
16351 | if (board_config == ALC662_AUTO) | |
16352 | spec->init_hook = alc662_auto_init; | |
cb53c626 TI |
16353 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
16354 | if (!spec->loopback.amplist) | |
16355 | spec->loopback.amplist = alc662_loopbacks; | |
16356 | #endif | |
bc9f98a9 KY |
16357 | |
16358 | return 0; | |
16359 | } | |
16360 | ||
1da177e4 LT |
16361 | /* |
16362 | * patch entries | |
16363 | */ | |
16364 | struct hda_codec_preset snd_hda_preset_realtek[] = { | |
16365 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | |
df694daa | 16366 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
f6a92248 | 16367 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
a361d84b | 16368 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
f6a92248 | 16369 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
01afd41f | 16370 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
f32610ed | 16371 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
bc9f98a9 | 16372 | .patch = patch_alc861 }, |
f32610ed JS |
16373 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
16374 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
16375 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
bc9f98a9 KY |
16376 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
16377 | .patch = patch_alc883 }, | |
16378 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | |
16379 | .patch = patch_alc662 }, | |
6dda9f4a | 16380 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
f32610ed | 16381 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
1da177e4 | 16382 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
9c7f852e | 16383 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
669faba2 CM |
16384 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
16385 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | |
cb308f97 | 16386 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
7943a8ab | 16387 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
df694daa | 16388 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
a385a529 | 16389 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
9c7f852e | 16390 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
4442608d KY |
16391 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
16392 | .patch = patch_alc883 }, | |
f6a92248 | 16393 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
1da177e4 LT |
16394 | {} /* terminator */ |
16395 | }; |