Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Universal Interface for Intel High Definition Audio Codec | |
3 | * | |
1d045db9 | 4 | * HD audio interface patch for Realtek ALC codecs |
1da177e4 | 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> |
409a3e98 | 9 | * Jonathan Woithe <jwoithe@just42.net> |
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> | |
08fb0d0e | 30 | #include <linux/dmi.h> |
da155d5b | 31 | #include <linux/module.h> |
1da177e4 | 32 | #include <sound/core.h> |
9ad0e496 | 33 | #include <sound/jack.h> |
1da177e4 LT |
34 | #include "hda_codec.h" |
35 | #include "hda_local.h" | |
23d30f28 | 36 | #include "hda_auto_parser.h" |
1835a0f9 | 37 | #include "hda_jack.h" |
08c189f2 | 38 | #include "hda_generic.h" |
1da177e4 | 39 | |
cd63a5ff TI |
40 | /* keep halting ALC5505 DSP, for power saving */ |
41 | #define HALT_REALTEK_ALC5505 | |
42 | ||
df694daa KY |
43 | /* for GPIO Poll */ |
44 | #define GPIO_MASK 0x03 | |
45 | ||
4a79ba34 TI |
46 | /* extra amp-initialization sequence types */ |
47 | enum { | |
48 | ALC_INIT_NONE, | |
49 | ALC_INIT_DEFAULT, | |
50 | ALC_INIT_GPIO1, | |
51 | ALC_INIT_GPIO2, | |
52 | ALC_INIT_GPIO3, | |
53 | }; | |
54 | ||
73bdd597 DH |
55 | enum { |
56 | ALC_HEADSET_MODE_UNKNOWN, | |
57 | ALC_HEADSET_MODE_UNPLUGGED, | |
58 | ALC_HEADSET_MODE_HEADSET, | |
59 | ALC_HEADSET_MODE_MIC, | |
60 | ALC_HEADSET_MODE_HEADPHONE, | |
61 | }; | |
62 | ||
63 | enum { | |
64 | ALC_HEADSET_TYPE_UNKNOWN, | |
65 | ALC_HEADSET_TYPE_CTIA, | |
66 | ALC_HEADSET_TYPE_OMTP, | |
67 | }; | |
68 | ||
da00c244 KY |
69 | struct alc_customize_define { |
70 | unsigned int sku_cfg; | |
71 | unsigned char port_connectivity; | |
72 | unsigned char check_sum; | |
73 | unsigned char customization; | |
74 | unsigned char external_amp; | |
75 | unsigned int enable_pcbeep:1; | |
76 | unsigned int platform_type:1; | |
77 | unsigned int swap:1; | |
78 | unsigned int override:1; | |
90622917 | 79 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
da00c244 KY |
80 | }; |
81 | ||
1da177e4 | 82 | struct alc_spec { |
08c189f2 | 83 | struct hda_gen_spec gen; /* must be at head */ |
23d30f28 | 84 | |
1da177e4 | 85 | /* codec parameterization */ |
a9111321 | 86 | const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
1da177e4 | 87 | unsigned int num_mixers; |
45bdd1c1 | 88 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
1da177e4 | 89 | |
da00c244 | 90 | struct alc_customize_define cdefine; |
08c189f2 | 91 | unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ |
834be88d | 92 | |
08fb0d0e TI |
93 | /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */ |
94 | int mute_led_polarity; | |
95 | hda_nid_t mute_led_nid; | |
9c5dc3bf | 96 | hda_nid_t cap_mute_led_nid; |
08fb0d0e | 97 | |
9f5c6faf | 98 | unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */ |
0f32fd19 TI |
99 | unsigned int gpio_mute_led_mask; |
100 | unsigned int gpio_mic_led_mask; | |
9f5c6faf | 101 | |
73bdd597 DH |
102 | hda_nid_t headset_mic_pin; |
103 | hda_nid_t headphone_mic_pin; | |
104 | int current_headset_mode; | |
105 | int current_headset_type; | |
106 | ||
ae6b813a TI |
107 | /* hooks */ |
108 | void (*init_hook)(struct hda_codec *codec); | |
83012a7c | 109 | #ifdef CONFIG_PM |
c97259df | 110 | void (*power_hook)(struct hda_codec *codec); |
f5de24b0 | 111 | #endif |
1c716153 | 112 | void (*shutup)(struct hda_codec *codec); |
d922b51d | 113 | |
4a79ba34 | 114 | int init_amp; |
d433a678 | 115 | int codec_variant; /* flag for other variants */ |
97a26570 KY |
116 | unsigned int has_alc5505_dsp:1; |
117 | unsigned int no_depop_delay:1; | |
e64f14f4 | 118 | |
2c3bf9ab TI |
119 | /* for PLL fix */ |
120 | hda_nid_t pll_nid; | |
121 | unsigned int pll_coef_idx, pll_coef_bit; | |
1bb7e43e | 122 | unsigned int coef0; |
df694daa KY |
123 | }; |
124 | ||
f2a227cd TI |
125 | /* |
126 | * COEF access helper functions | |
127 | */ | |
128 | ||
129 | static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, | |
130 | unsigned int coef_idx) | |
131 | { | |
132 | unsigned int val; | |
133 | ||
134 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); | |
135 | val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); | |
136 | return val; | |
137 | } | |
138 | ||
139 | #define alc_read_coef_idx(codec, coef_idx) \ | |
140 | alc_read_coefex_idx(codec, 0x20, coef_idx) | |
141 | ||
142 | static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, | |
143 | unsigned int coef_idx, unsigned int coef_val) | |
144 | { | |
145 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); | |
146 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); | |
147 | } | |
148 | ||
149 | #define alc_write_coef_idx(codec, coef_idx, coef_val) \ | |
150 | alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val) | |
151 | ||
98b24883 TI |
152 | static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
153 | unsigned int coef_idx, unsigned int mask, | |
154 | unsigned int bits_set) | |
155 | { | |
156 | unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); | |
157 | ||
158 | if (val != -1) | |
159 | alc_write_coefex_idx(codec, nid, coef_idx, | |
160 | (val & ~mask) | bits_set); | |
161 | } | |
162 | ||
163 | #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ | |
164 | alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set) | |
165 | ||
f2a227cd TI |
166 | /* a special bypass for COEF 0; read the cached value at the second time */ |
167 | static unsigned int alc_get_coef0(struct hda_codec *codec) | |
168 | { | |
169 | struct alc_spec *spec = codec->spec; | |
170 | ||
171 | if (!spec->coef0) | |
172 | spec->coef0 = alc_read_coef_idx(codec, 0); | |
173 | return spec->coef0; | |
174 | } | |
175 | ||
54db6c39 TI |
176 | /* coef writes/updates batch */ |
177 | struct coef_fw { | |
178 | unsigned char nid; | |
179 | unsigned char idx; | |
180 | unsigned short mask; | |
181 | unsigned short val; | |
182 | }; | |
183 | ||
184 | #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \ | |
185 | { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) } | |
186 | #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val) | |
187 | #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val) | |
188 | #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val) | |
189 | ||
190 | static void alc_process_coef_fw(struct hda_codec *codec, | |
191 | const struct coef_fw *fw) | |
192 | { | |
193 | for (; fw->nid; fw++) { | |
194 | if (fw->mask == (unsigned short)-1) | |
195 | alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); | |
196 | else | |
197 | alc_update_coefex_idx(codec, fw->nid, fw->idx, | |
198 | fw->mask, fw->val); | |
199 | } | |
200 | } | |
201 | ||
d88897ea | 202 | /* |
1d045db9 TI |
203 | * Append the given mixer and verb elements for the later use |
204 | * The mixer array is referred in build_controls(), and init_verbs are | |
205 | * called in init(). | |
d88897ea | 206 | */ |
a9111321 | 207 | static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix) |
d88897ea TI |
208 | { |
209 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
210 | return; | |
211 | spec->mixers[spec->num_mixers++] = mix; | |
212 | } | |
213 | ||
df694daa | 214 | /* |
1d045db9 | 215 | * GPIO setup tables, used in initialization |
df694daa | 216 | */ |
bc9f98a9 | 217 | /* Enable GPIO mask and set output */ |
a9111321 | 218 | static const struct hda_verb alc_gpio1_init_verbs[] = { |
bc9f98a9 KY |
219 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
220 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
221 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
222 | { } | |
223 | }; | |
224 | ||
a9111321 | 225 | static const struct hda_verb alc_gpio2_init_verbs[] = { |
bc9f98a9 KY |
226 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
227 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
228 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
229 | { } | |
230 | }; | |
231 | ||
a9111321 | 232 | static const struct hda_verb alc_gpio3_init_verbs[] = { |
bdd148a3 KY |
233 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
234 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
235 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
236 | { } | |
237 | }; | |
238 | ||
2c3bf9ab TI |
239 | /* |
240 | * Fix hardware PLL issue | |
241 | * On some codecs, the analog PLL gating control must be off while | |
242 | * the default value is 1. | |
243 | */ | |
244 | static void alc_fix_pll(struct hda_codec *codec) | |
245 | { | |
246 | struct alc_spec *spec = codec->spec; | |
2c3bf9ab | 247 | |
98b24883 TI |
248 | if (spec->pll_nid) |
249 | alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, | |
250 | 1 << spec->pll_coef_bit, 0); | |
2c3bf9ab TI |
251 | } |
252 | ||
253 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
254 | unsigned int coef_idx, unsigned int coef_bit) | |
255 | { | |
256 | struct alc_spec *spec = codec->spec; | |
257 | spec->pll_nid = nid; | |
258 | spec->pll_coef_idx = coef_idx; | |
259 | spec->pll_coef_bit = coef_bit; | |
260 | alc_fix_pll(codec); | |
261 | } | |
262 | ||
cf5a2279 | 263 | /* update the master volume per volume-knob's unsol event */ |
1a4f69d5 TI |
264 | static void alc_update_knob_master(struct hda_codec *codec, |
265 | struct hda_jack_callback *jack) | |
cf5a2279 TI |
266 | { |
267 | unsigned int val; | |
268 | struct snd_kcontrol *kctl; | |
269 | struct snd_ctl_elem_value *uctl; | |
270 | ||
271 | kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); | |
272 | if (!kctl) | |
273 | return; | |
274 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | |
275 | if (!uctl) | |
276 | return; | |
1a4f69d5 | 277 | val = snd_hda_codec_read(codec, jack->tbl->nid, 0, |
cf5a2279 TI |
278 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
279 | val &= HDA_AMP_VOLMASK; | |
280 | uctl->value.integer.value[0] = val; | |
281 | uctl->value.integer.value[1] = val; | |
282 | kctl->put(kctl, uctl); | |
283 | kfree(uctl); | |
284 | } | |
285 | ||
29adc4b9 | 286 | static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) |
f21d78e2 | 287 | { |
29adc4b9 DH |
288 | /* For some reason, the res given from ALC880 is broken. |
289 | Here we adjust it properly. */ | |
290 | snd_hda_jack_unsol_event(codec, res >> 2); | |
f21d78e2 TI |
291 | } |
292 | ||
394c97f8 KY |
293 | /* Change EAPD to verb control */ |
294 | static void alc_fill_eapd_coef(struct hda_codec *codec) | |
295 | { | |
296 | int coef; | |
297 | ||
298 | coef = alc_get_coef0(codec); | |
299 | ||
300 | switch (codec->vendor_id) { | |
301 | case 0x10ec0262: | |
302 | alc_update_coef_idx(codec, 0x7, 0, 1<<5); | |
303 | break; | |
304 | case 0x10ec0267: | |
305 | case 0x10ec0268: | |
306 | alc_update_coef_idx(codec, 0x7, 0, 1<<13); | |
307 | break; | |
308 | case 0x10ec0269: | |
309 | if ((coef & 0x00f0) == 0x0010) | |
310 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); | |
311 | if ((coef & 0x00f0) == 0x0020) | |
312 | alc_update_coef_idx(codec, 0x4, 1<<15, 0); | |
313 | if ((coef & 0x00f0) == 0x0030) | |
314 | alc_update_coef_idx(codec, 0x10, 1<<9, 0); | |
315 | break; | |
316 | case 0x10ec0280: | |
317 | case 0x10ec0284: | |
318 | case 0x10ec0290: | |
319 | case 0x10ec0292: | |
320 | alc_update_coef_idx(codec, 0x4, 1<<15, 0); | |
321 | break; | |
322 | case 0x10ec0233: | |
323 | case 0x10ec0255: | |
324 | case 0x10ec0282: | |
325 | case 0x10ec0283: | |
326 | case 0x10ec0286: | |
327 | case 0x10ec0288: | |
328 | alc_update_coef_idx(codec, 0x10, 1<<9, 0); | |
329 | break; | |
330 | case 0x10ec0285: | |
331 | case 0x10ec0293: | |
332 | alc_update_coef_idx(codec, 0xa, 1<<13, 0); | |
333 | break; | |
334 | case 0x10ec0662: | |
335 | if ((coef & 0x00f0) == 0x0030) | |
336 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ | |
337 | break; | |
338 | case 0x10ec0272: | |
339 | case 0x10ec0273: | |
340 | case 0x10ec0663: | |
341 | case 0x10ec0665: | |
342 | case 0x10ec0670: | |
343 | case 0x10ec0671: | |
344 | case 0x10ec0672: | |
345 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ | |
346 | break; | |
347 | case 0x10ec0668: | |
348 | alc_update_coef_idx(codec, 0x7, 3<<13, 0); | |
349 | break; | |
350 | case 0x10ec0867: | |
351 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); | |
352 | break; | |
353 | case 0x10ec0888: | |
354 | if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030) | |
355 | alc_update_coef_idx(codec, 0x7, 1<<5, 0); | |
356 | break; | |
357 | case 0x10ec0892: | |
358 | alc_update_coef_idx(codec, 0x7, 1<<5, 0); | |
359 | break; | |
360 | case 0x10ec0899: | |
361 | case 0x10ec0900: | |
362 | alc_update_coef_idx(codec, 0x7, 1<<1, 0); | |
363 | break; | |
364 | } | |
365 | } | |
366 | ||
f9423e7a KY |
367 | /* additional initialization for ALC888 variants */ |
368 | static void alc888_coef_init(struct hda_codec *codec) | |
369 | { | |
1df8874b KY |
370 | switch (alc_get_coef0(codec) & 0x00f0) { |
371 | /* alc888-VA */ | |
372 | case 0x00: | |
373 | /* alc888-VB */ | |
374 | case 0x10: | |
375 | alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ | |
376 | break; | |
377 | } | |
87a8c370 JK |
378 | } |
379 | ||
3fb4a508 TI |
380 | /* turn on/off EAPD control (only if available) */ |
381 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | |
382 | { | |
383 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | |
384 | return; | |
385 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | |
386 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
387 | on ? 2 : 0); | |
388 | } | |
389 | ||
691f1fcc TI |
390 | /* turn on/off EAPD controls of the codec */ |
391 | static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) | |
392 | { | |
393 | /* We currently only handle front, HP */ | |
39fa84e9 TI |
394 | static hda_nid_t pins[] = { |
395 | 0x0f, 0x10, 0x14, 0x15, 0 | |
396 | }; | |
397 | hda_nid_t *p; | |
398 | for (p = pins; *p; p++) | |
399 | set_eapd(codec, *p, on); | |
691f1fcc TI |
400 | } |
401 | ||
1c716153 TI |
402 | /* generic shutup callback; |
403 | * just turning off EPAD and a little pause for avoiding pop-noise | |
404 | */ | |
405 | static void alc_eapd_shutup(struct hda_codec *codec) | |
406 | { | |
97a26570 KY |
407 | struct alc_spec *spec = codec->spec; |
408 | ||
1c716153 | 409 | alc_auto_setup_eapd(codec, false); |
97a26570 KY |
410 | if (!spec->no_depop_delay) |
411 | msleep(200); | |
9bfb2844 | 412 | snd_hda_shutup_pins(codec); |
1c716153 TI |
413 | } |
414 | ||
1d045db9 | 415 | /* generic EAPD initialization */ |
4a79ba34 | 416 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
bc9f98a9 | 417 | { |
394c97f8 | 418 | alc_fill_eapd_coef(codec); |
39fa84e9 | 419 | alc_auto_setup_eapd(codec, true); |
4a79ba34 TI |
420 | switch (type) { |
421 | case ALC_INIT_GPIO1: | |
bc9f98a9 KY |
422 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
423 | break; | |
4a79ba34 | 424 | case ALC_INIT_GPIO2: |
bc9f98a9 KY |
425 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
426 | break; | |
4a79ba34 | 427 | case ALC_INIT_GPIO3: |
bdd148a3 KY |
428 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
429 | break; | |
4a79ba34 | 430 | case ALC_INIT_DEFAULT: |
c9b58006 KY |
431 | switch (codec->vendor_id) { |
432 | case 0x10ec0260: | |
98b24883 | 433 | alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); |
c9b58006 | 434 | break; |
c9b58006 KY |
435 | case 0x10ec0880: |
436 | case 0x10ec0882: | |
437 | case 0x10ec0883: | |
438 | case 0x10ec0885: | |
1df8874b | 439 | alc_update_coef_idx(codec, 7, 0, 0x2030); |
c9b58006 | 440 | break; |
f9423e7a | 441 | case 0x10ec0888: |
4a79ba34 | 442 | alc888_coef_init(codec); |
f9423e7a | 443 | break; |
bc9f98a9 | 444 | } |
4a79ba34 TI |
445 | break; |
446 | } | |
447 | } | |
448 | ||
08c189f2 | 449 | |
1d045db9 | 450 | /* |
08c189f2 | 451 | * Realtek SSID verification |
1d045db9 | 452 | */ |
42cf0d01 | 453 | |
08c189f2 TI |
454 | /* Could be any non-zero and even value. When used as fixup, tells |
455 | * the driver to ignore any present sku defines. | |
456 | */ | |
457 | #define ALC_FIXUP_SKU_IGNORE (2) | |
1a1455de | 458 | |
08c189f2 TI |
459 | static void alc_fixup_sku_ignore(struct hda_codec *codec, |
460 | const struct hda_fixup *fix, int action) | |
1a1455de | 461 | { |
1a1455de | 462 | struct alc_spec *spec = codec->spec; |
08c189f2 TI |
463 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
464 | spec->cdefine.fixup = 1; | |
465 | spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE; | |
1a1455de | 466 | } |
1a1455de TI |
467 | } |
468 | ||
b5c6611f ML |
469 | static void alc_fixup_no_depop_delay(struct hda_codec *codec, |
470 | const struct hda_fixup *fix, int action) | |
471 | { | |
472 | struct alc_spec *spec = codec->spec; | |
473 | ||
84d2dc3e | 474 | if (action == HDA_FIXUP_ACT_PROBE) { |
b5c6611f | 475 | spec->no_depop_delay = 1; |
84d2dc3e ML |
476 | codec->depop_delay = 0; |
477 | } | |
b5c6611f ML |
478 | } |
479 | ||
08c189f2 | 480 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
4a79ba34 | 481 | { |
08c189f2 TI |
482 | unsigned int ass, tmp, i; |
483 | unsigned nid = 0; | |
4a79ba34 TI |
484 | struct alc_spec *spec = codec->spec; |
485 | ||
08c189f2 | 486 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
4a79ba34 | 487 | |
08c189f2 TI |
488 | if (spec->cdefine.fixup) { |
489 | ass = spec->cdefine.sku_cfg; | |
490 | if (ass == ALC_FIXUP_SKU_IGNORE) | |
491 | return -1; | |
492 | goto do_sku; | |
bb35febd TI |
493 | } |
494 | ||
5100cd07 TI |
495 | if (!codec->bus->pci) |
496 | return -1; | |
08c189f2 TI |
497 | ass = codec->subsystem_id & 0xffff; |
498 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) | |
499 | goto do_sku; | |
4a79ba34 | 500 | |
08c189f2 TI |
501 | nid = 0x1d; |
502 | if (codec->vendor_id == 0x10ec0260) | |
503 | nid = 0x17; | |
504 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
42cf0d01 | 505 | |
08c189f2 | 506 | if (!(ass & 1)) { |
4e76a883 TI |
507 | codec_info(codec, "%s: SKU not ready 0x%08x\n", |
508 | codec->chip_name, ass); | |
08c189f2 | 509 | return -1; |
42cf0d01 DH |
510 | } |
511 | ||
08c189f2 TI |
512 | /* check sum */ |
513 | tmp = 0; | |
514 | for (i = 1; i < 16; i++) { | |
515 | if ((ass >> i) & 1) | |
516 | tmp++; | |
ae8a60a5 | 517 | } |
08c189f2 TI |
518 | if (((ass >> 16) & 0xf) != tmp) |
519 | return -1; | |
ae8a60a5 | 520 | |
da00c244 KY |
521 | spec->cdefine.port_connectivity = ass >> 30; |
522 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; | |
523 | spec->cdefine.check_sum = (ass >> 16) & 0xf; | |
524 | spec->cdefine.customization = ass >> 8; | |
525 | do_sku: | |
526 | spec->cdefine.sku_cfg = ass; | |
527 | spec->cdefine.external_amp = (ass & 0x38) >> 3; | |
528 | spec->cdefine.platform_type = (ass & 0x4) >> 2; | |
529 | spec->cdefine.swap = (ass & 0x2) >> 1; | |
530 | spec->cdefine.override = ass & 0x1; | |
531 | ||
4e76a883 | 532 | codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", |
da00c244 | 533 | nid, spec->cdefine.sku_cfg); |
4e76a883 | 534 | codec_dbg(codec, "SKU: port_connectivity=0x%x\n", |
da00c244 | 535 | spec->cdefine.port_connectivity); |
4e76a883 TI |
536 | codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
537 | codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); | |
538 | codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); | |
539 | codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); | |
540 | codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); | |
541 | codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); | |
542 | codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); | |
da00c244 KY |
543 | |
544 | return 0; | |
545 | } | |
546 | ||
08c189f2 TI |
547 | /* return the position of NID in the list, or -1 if not found */ |
548 | static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) | |
549 | { | |
550 | int i; | |
551 | for (i = 0; i < nums; i++) | |
552 | if (list[i] == nid) | |
553 | return i; | |
554 | return -1; | |
555 | } | |
1d045db9 | 556 | /* return true if the given NID is found in the list */ |
3af9ee6b TI |
557 | static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) |
558 | { | |
21268961 | 559 | return find_idx_in_nid_list(nid, list, nums) >= 0; |
3af9ee6b TI |
560 | } |
561 | ||
4a79ba34 TI |
562 | /* check subsystem ID and set up device-specific initialization; |
563 | * return 1 if initialized, 0 if invalid SSID | |
564 | */ | |
565 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | |
566 | * 31 ~ 16 : Manufacture ID | |
567 | * 15 ~ 8 : SKU ID | |
568 | * 7 ~ 0 : Assembly ID | |
569 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
570 | */ | |
58c57cfa | 571 | static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) |
4a79ba34 TI |
572 | { |
573 | unsigned int ass, tmp, i; | |
574 | unsigned nid; | |
575 | struct alc_spec *spec = codec->spec; | |
576 | ||
90622917 DH |
577 | if (spec->cdefine.fixup) { |
578 | ass = spec->cdefine.sku_cfg; | |
579 | if (ass == ALC_FIXUP_SKU_IGNORE) | |
580 | return 0; | |
581 | goto do_sku; | |
582 | } | |
583 | ||
4a79ba34 | 584 | ass = codec->subsystem_id & 0xffff; |
5100cd07 TI |
585 | if (codec->bus->pci && |
586 | ass != codec->bus->pci->subsystem_device && (ass & 1)) | |
4a79ba34 TI |
587 | goto do_sku; |
588 | ||
589 | /* invalid SSID, check the special NID pin defcfg instead */ | |
590 | /* | |
def319f9 | 591 | * 31~30 : port connectivity |
4a79ba34 TI |
592 | * 29~21 : reserve |
593 | * 20 : PCBEEP input | |
594 | * 19~16 : Check sum (15:1) | |
595 | * 15~1 : Custom | |
596 | * 0 : override | |
597 | */ | |
598 | nid = 0x1d; | |
599 | if (codec->vendor_id == 0x10ec0260) | |
600 | nid = 0x17; | |
601 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
4e76a883 TI |
602 | codec_dbg(codec, |
603 | "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n", | |
cb6605c1 | 604 | ass, nid); |
6227cdce | 605 | if (!(ass & 1)) |
4a79ba34 TI |
606 | return 0; |
607 | if ((ass >> 30) != 1) /* no physical connection */ | |
608 | return 0; | |
609 | ||
610 | /* check sum */ | |
611 | tmp = 0; | |
612 | for (i = 1; i < 16; i++) { | |
613 | if ((ass >> i) & 1) | |
614 | tmp++; | |
615 | } | |
616 | if (((ass >> 16) & 0xf) != tmp) | |
617 | return 0; | |
618 | do_sku: | |
4e76a883 | 619 | codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
4a79ba34 TI |
620 | ass & 0xffff, codec->vendor_id); |
621 | /* | |
622 | * 0 : override | |
623 | * 1 : Swap Jack | |
624 | * 2 : 0 --> Desktop, 1 --> Laptop | |
625 | * 3~5 : External Amplifier control | |
626 | * 7~6 : Reserved | |
627 | */ | |
628 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | |
629 | switch (tmp) { | |
630 | case 1: | |
631 | spec->init_amp = ALC_INIT_GPIO1; | |
632 | break; | |
633 | case 3: | |
634 | spec->init_amp = ALC_INIT_GPIO2; | |
635 | break; | |
636 | case 7: | |
637 | spec->init_amp = ALC_INIT_GPIO3; | |
638 | break; | |
639 | case 5: | |
5a8cfb4e | 640 | default: |
4a79ba34 | 641 | spec->init_amp = ALC_INIT_DEFAULT; |
bc9f98a9 KY |
642 | break; |
643 | } | |
ea1fb29a | 644 | |
8c427226 | 645 | /* is laptop or Desktop and enable the function "Mute internal speaker |
c9b58006 KY |
646 | * when the external headphone out jack is plugged" |
647 | */ | |
8c427226 | 648 | if (!(ass & 0x8000)) |
4a79ba34 | 649 | return 1; |
c9b58006 KY |
650 | /* |
651 | * 10~8 : Jack location | |
652 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
653 | * 14~13: Resvered | |
654 | * 15 : 1 --> enable the function "Mute internal speaker | |
655 | * when the external headphone out jack is plugged" | |
656 | */ | |
08c189f2 TI |
657 | if (!spec->gen.autocfg.hp_pins[0] && |
658 | !(spec->gen.autocfg.line_out_pins[0] && | |
659 | spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) { | |
01d4825d | 660 | hda_nid_t nid; |
c9b58006 | 661 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
58c57cfa | 662 | nid = ports[tmp]; |
08c189f2 TI |
663 | if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins, |
664 | spec->gen.autocfg.line_outs)) | |
3af9ee6b | 665 | return 1; |
08c189f2 | 666 | spec->gen.autocfg.hp_pins[0] = nid; |
c9b58006 | 667 | } |
4a79ba34 TI |
668 | return 1; |
669 | } | |
ea1fb29a | 670 | |
3e6179b8 TI |
671 | /* Check the validity of ALC subsystem-id |
672 | * ports contains an array of 4 pin NIDs for port-A, E, D and I */ | |
673 | static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) | |
4a79ba34 | 674 | { |
58c57cfa | 675 | if (!alc_subsystem_id(codec, ports)) { |
4a79ba34 | 676 | struct alc_spec *spec = codec->spec; |
4e76a883 TI |
677 | codec_dbg(codec, |
678 | "realtek: Enable default setup for auto mode as fallback\n"); | |
4a79ba34 | 679 | spec->init_amp = ALC_INIT_DEFAULT; |
4a79ba34 | 680 | } |
21268961 | 681 | } |
1a1455de | 682 | |
1d045db9 | 683 | /* |
ef8ef5fb | 684 | */ |
f9e336f6 | 685 | |
9d36a7dc DH |
686 | static void alc_fixup_inv_dmic(struct hda_codec *codec, |
687 | const struct hda_fixup *fix, int action) | |
125821ae TI |
688 | { |
689 | struct alc_spec *spec = codec->spec; | |
668d1e96 | 690 | |
9d36a7dc | 691 | spec->gen.inv_dmic_split = 1; |
6e72aa5f TI |
692 | } |
693 | ||
e9edcee0 | 694 | |
1d045db9 TI |
695 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
696 | /* additional beep mixers; the actual parameters are overwritten at build */ | |
697 | static const struct snd_kcontrol_new alc_beep_mixer[] = { | |
698 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | |
699 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), | |
16ded525 TI |
700 | { } /* end */ |
701 | }; | |
1d045db9 | 702 | #endif |
16ded525 | 703 | |
08c189f2 | 704 | static int alc_build_controls(struct hda_codec *codec) |
1d045db9 TI |
705 | { |
706 | struct alc_spec *spec = codec->spec; | |
08c189f2 | 707 | int i, err; |
e9427969 | 708 | |
08c189f2 TI |
709 | err = snd_hda_gen_build_controls(codec); |
710 | if (err < 0) | |
711 | return err; | |
1da177e4 LT |
712 | |
713 | for (i = 0; i < spec->num_mixers; i++) { | |
714 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
715 | if (err < 0) | |
716 | return err; | |
717 | } | |
2134ea4f | 718 | |
67d634c0 | 719 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
720 | /* create beep controls if needed */ |
721 | if (spec->beep_amp) { | |
a9111321 | 722 | const struct snd_kcontrol_new *knew; |
45bdd1c1 TI |
723 | for (knew = alc_beep_mixer; knew->name; knew++) { |
724 | struct snd_kcontrol *kctl; | |
725 | kctl = snd_ctl_new1(knew, codec); | |
726 | if (!kctl) | |
08c189f2 TI |
727 | return -ENOMEM; |
728 | kctl->private_value = spec->beep_amp; | |
729 | err = snd_hda_ctl_add(codec, 0, kctl); | |
730 | if (err < 0) | |
731 | return err; | |
1d045db9 | 732 | } |
863b4518 | 733 | } |
08c189f2 | 734 | #endif |
1c4a54b4 | 735 | |
1727a771 | 736 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); |
1c4a54b4 | 737 | return 0; |
a361d84b KY |
738 | } |
739 | ||
a361d84b | 740 | |
df694daa | 741 | /* |
08c189f2 | 742 | * Common callbacks |
df694daa | 743 | */ |
a361d84b | 744 | |
08c189f2 | 745 | static int alc_init(struct hda_codec *codec) |
1d045db9 TI |
746 | { |
747 | struct alc_spec *spec = codec->spec; | |
a361d84b | 748 | |
08c189f2 TI |
749 | if (spec->init_hook) |
750 | spec->init_hook(codec); | |
a361d84b | 751 | |
08c189f2 TI |
752 | alc_fix_pll(codec); |
753 | alc_auto_init_amp(codec, spec->init_amp); | |
3abf2f36 | 754 | |
08c189f2 | 755 | snd_hda_gen_init(codec); |
a361d84b | 756 | |
1727a771 | 757 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); |
a361d84b | 758 | |
1d045db9 TI |
759 | return 0; |
760 | } | |
a361d84b | 761 | |
08c189f2 | 762 | static inline void alc_shutup(struct hda_codec *codec) |
1d045db9 TI |
763 | { |
764 | struct alc_spec *spec = codec->spec; | |
a361d84b | 765 | |
08c189f2 TI |
766 | if (spec && spec->shutup) |
767 | spec->shutup(codec); | |
9bfb2844 TI |
768 | else |
769 | snd_hda_shutup_pins(codec); | |
1d045db9 TI |
770 | } |
771 | ||
8a02c0cc | 772 | #define alc_free snd_hda_gen_free |
2134ea4f | 773 | |
08c189f2 TI |
774 | #ifdef CONFIG_PM |
775 | static void alc_power_eapd(struct hda_codec *codec) | |
1d045db9 | 776 | { |
08c189f2 | 777 | alc_auto_setup_eapd(codec, false); |
1d045db9 | 778 | } |
2134ea4f | 779 | |
08c189f2 | 780 | static int alc_suspend(struct hda_codec *codec) |
1d045db9 TI |
781 | { |
782 | struct alc_spec *spec = codec->spec; | |
08c189f2 TI |
783 | alc_shutup(codec); |
784 | if (spec && spec->power_hook) | |
785 | spec->power_hook(codec); | |
a361d84b KY |
786 | return 0; |
787 | } | |
08c189f2 | 788 | #endif |
a361d84b | 789 | |
08c189f2 TI |
790 | #ifdef CONFIG_PM |
791 | static int alc_resume(struct hda_codec *codec) | |
1d045db9 | 792 | { |
97a26570 KY |
793 | struct alc_spec *spec = codec->spec; |
794 | ||
795 | if (!spec->no_depop_delay) | |
796 | msleep(150); /* to avoid pop noise */ | |
08c189f2 TI |
797 | codec->patch_ops.init(codec); |
798 | snd_hda_codec_resume_amp(codec); | |
799 | snd_hda_codec_resume_cache(codec); | |
08c189f2 TI |
800 | hda_call_check_power_status(codec, 0x01); |
801 | return 0; | |
1d045db9 | 802 | } |
08c189f2 | 803 | #endif |
f6a92248 | 804 | |
1d045db9 | 805 | /* |
1d045db9 | 806 | */ |
08c189f2 TI |
807 | static const struct hda_codec_ops alc_patch_ops = { |
808 | .build_controls = alc_build_controls, | |
809 | .build_pcms = snd_hda_gen_build_pcms, | |
810 | .init = alc_init, | |
811 | .free = alc_free, | |
812 | .unsol_event = snd_hda_jack_unsol_event, | |
813 | #ifdef CONFIG_PM | |
814 | .resume = alc_resume, | |
08c189f2 | 815 | .suspend = alc_suspend, |
fce52a3b | 816 | .check_power_status = snd_hda_gen_check_power_status, |
08c189f2 TI |
817 | #endif |
818 | .reboot_notify = alc_shutup, | |
819 | }; | |
f6a92248 | 820 | |
f53281e6 | 821 | |
08c189f2 TI |
822 | /* replace the codec chip_name with the given string */ |
823 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | |
1d045db9 | 824 | { |
08c189f2 TI |
825 | kfree(codec->chip_name); |
826 | codec->chip_name = kstrdup(name, GFP_KERNEL); | |
827 | if (!codec->chip_name) { | |
828 | alc_free(codec); | |
829 | return -ENOMEM; | |
1d045db9 | 830 | } |
a361d84b | 831 | return 0; |
1d045db9 | 832 | } |
e01bf509 | 833 | |
e4770629 | 834 | /* |
4b016931 | 835 | * Rename codecs appropriately from COEF value or subvendor id |
e4770629 | 836 | */ |
08c189f2 TI |
837 | struct alc_codec_rename_table { |
838 | unsigned int vendor_id; | |
839 | unsigned short coef_mask; | |
840 | unsigned short coef_bits; | |
841 | const char *name; | |
842 | }; | |
84898e87 | 843 | |
4b016931 KY |
844 | struct alc_codec_rename_pci_table { |
845 | unsigned int codec_vendor_id; | |
846 | unsigned short pci_subvendor; | |
847 | unsigned short pci_subdevice; | |
848 | const char *name; | |
849 | }; | |
850 | ||
08c189f2 | 851 | static struct alc_codec_rename_table rename_tbl[] = { |
e6e5f7ad | 852 | { 0x10ec0221, 0xf00f, 0x1003, "ALC231" }, |
08c189f2 TI |
853 | { 0x10ec0269, 0xfff0, 0x3010, "ALC277" }, |
854 | { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" }, | |
855 | { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" }, | |
856 | { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" }, | |
857 | { 0x10ec0269, 0xffff, 0xa023, "ALC259" }, | |
858 | { 0x10ec0269, 0xffff, 0x6023, "ALC281X" }, | |
859 | { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" }, | |
860 | { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" }, | |
e6e5f7ad | 861 | { 0x10ec0662, 0xffff, 0x4020, "ALC656" }, |
08c189f2 TI |
862 | { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" }, |
863 | { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" }, | |
864 | { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" }, | |
865 | { 0x10ec0899, 0x2000, 0x2000, "ALC899" }, | |
866 | { 0x10ec0892, 0xffff, 0x8020, "ALC661" }, | |
867 | { 0x10ec0892, 0xffff, 0x8011, "ALC661" }, | |
868 | { 0x10ec0892, 0xffff, 0x4011, "ALC656" }, | |
869 | { } /* terminator */ | |
870 | }; | |
84898e87 | 871 | |
4b016931 KY |
872 | static struct alc_codec_rename_pci_table rename_pci_tbl[] = { |
873 | { 0x10ec0280, 0x1028, 0, "ALC3220" }, | |
874 | { 0x10ec0282, 0x1028, 0, "ALC3221" }, | |
875 | { 0x10ec0283, 0x1028, 0, "ALC3223" }, | |
193177de | 876 | { 0x10ec0288, 0x1028, 0, "ALC3263" }, |
4b016931 | 877 | { 0x10ec0292, 0x1028, 0, "ALC3226" }, |
193177de | 878 | { 0x10ec0293, 0x1028, 0, "ALC3235" }, |
4b016931 KY |
879 | { 0x10ec0255, 0x1028, 0, "ALC3234" }, |
880 | { 0x10ec0668, 0x1028, 0, "ALC3661" }, | |
e6e5f7ad KY |
881 | { 0x10ec0275, 0x1028, 0, "ALC3260" }, |
882 | { 0x10ec0899, 0x1028, 0, "ALC3861" }, | |
883 | { 0x10ec0670, 0x1025, 0, "ALC669X" }, | |
884 | { 0x10ec0676, 0x1025, 0, "ALC679X" }, | |
885 | { 0x10ec0282, 0x1043, 0, "ALC3229" }, | |
886 | { 0x10ec0233, 0x1043, 0, "ALC3236" }, | |
887 | { 0x10ec0280, 0x103c, 0, "ALC3228" }, | |
888 | { 0x10ec0282, 0x103c, 0, "ALC3227" }, | |
889 | { 0x10ec0286, 0x103c, 0, "ALC3242" }, | |
890 | { 0x10ec0290, 0x103c, 0, "ALC3241" }, | |
891 | { 0x10ec0668, 0x103c, 0, "ALC3662" }, | |
892 | { 0x10ec0283, 0x17aa, 0, "ALC3239" }, | |
893 | { 0x10ec0292, 0x17aa, 0, "ALC3232" }, | |
4b016931 KY |
894 | { } /* terminator */ |
895 | }; | |
896 | ||
08c189f2 | 897 | static int alc_codec_rename_from_preset(struct hda_codec *codec) |
1d045db9 | 898 | { |
08c189f2 | 899 | const struct alc_codec_rename_table *p; |
4b016931 | 900 | const struct alc_codec_rename_pci_table *q; |
60db6b53 | 901 | |
08c189f2 TI |
902 | for (p = rename_tbl; p->vendor_id; p++) { |
903 | if (p->vendor_id != codec->vendor_id) | |
904 | continue; | |
905 | if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) | |
906 | return alc_codec_rename(codec, p->name); | |
1d045db9 | 907 | } |
4b016931 | 908 | |
5100cd07 TI |
909 | if (!codec->bus->pci) |
910 | return 0; | |
4b016931 KY |
911 | for (q = rename_pci_tbl; q->codec_vendor_id; q++) { |
912 | if (q->codec_vendor_id != codec->vendor_id) | |
913 | continue; | |
914 | if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) | |
915 | continue; | |
916 | if (!q->pci_subdevice || | |
917 | q->pci_subdevice == codec->bus->pci->subsystem_device) | |
918 | return alc_codec_rename(codec, q->name); | |
919 | } | |
920 | ||
08c189f2 | 921 | return 0; |
1d045db9 | 922 | } |
f53281e6 | 923 | |
e4770629 | 924 | |
1d045db9 TI |
925 | /* |
926 | * Digital-beep handlers | |
927 | */ | |
928 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
929 | #define set_beep_amp(spec, nid, idx, dir) \ | |
930 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | |
84898e87 | 931 | |
1d045db9 | 932 | static const struct snd_pci_quirk beep_white_list[] = { |
7110005e | 933 | SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1), |
a4b7f21d | 934 | SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1), |
1d045db9 | 935 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
8554ee40 | 936 | SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1), |
1d045db9 TI |
937 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
938 | SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), | |
939 | SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1), | |
78f8baf1 | 940 | SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1), |
1d045db9 TI |
941 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
942 | {} | |
fe3eb0a7 KY |
943 | }; |
944 | ||
1d045db9 TI |
945 | static inline int has_cdefine_beep(struct hda_codec *codec) |
946 | { | |
947 | struct alc_spec *spec = codec->spec; | |
948 | const struct snd_pci_quirk *q; | |
949 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); | |
950 | if (q) | |
951 | return q->value; | |
952 | return spec->cdefine.enable_pcbeep; | |
953 | } | |
954 | #else | |
955 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | |
956 | #define has_cdefine_beep(codec) 0 | |
957 | #endif | |
84898e87 | 958 | |
1d045db9 TI |
959 | /* parse the BIOS configuration and set up the alc_spec */ |
960 | /* return 1 if successful, 0 if the proper config is not found, | |
961 | * or a negative error code | |
962 | */ | |
3e6179b8 TI |
963 | static int alc_parse_auto_config(struct hda_codec *codec, |
964 | const hda_nid_t *ignore_nids, | |
965 | const hda_nid_t *ssid_nids) | |
1d045db9 TI |
966 | { |
967 | struct alc_spec *spec = codec->spec; | |
08c189f2 | 968 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; |
1d045db9 | 969 | int err; |
26f5df26 | 970 | |
53c334ad TI |
971 | err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, |
972 | spec->parse_flags); | |
1d045db9 TI |
973 | if (err < 0) |
974 | return err; | |
3e6179b8 TI |
975 | |
976 | if (ssid_nids) | |
977 | alc_ssid_check(codec, ssid_nids); | |
64154835 | 978 | |
08c189f2 TI |
979 | err = snd_hda_gen_parse_auto_config(codec, cfg); |
980 | if (err < 0) | |
981 | return err; | |
070cff4c | 982 | |
1d045db9 | 983 | return 1; |
60db6b53 | 984 | } |
f6a92248 | 985 | |
3de95173 TI |
986 | /* common preparation job for alc_spec */ |
987 | static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) | |
988 | { | |
989 | struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
990 | int err; | |
991 | ||
992 | if (!spec) | |
993 | return -ENOMEM; | |
994 | codec->spec = spec; | |
08c189f2 TI |
995 | snd_hda_gen_spec_init(&spec->gen); |
996 | spec->gen.mixer_nid = mixer_nid; | |
997 | spec->gen.own_eapd_ctl = 1; | |
1098b7c2 | 998 | codec->single_adc_amp = 1; |
08c189f2 TI |
999 | /* FIXME: do we need this for all Realtek codec models? */ |
1000 | codec->spdif_status_reset = 1; | |
3de95173 TI |
1001 | |
1002 | err = alc_codec_rename_from_preset(codec); | |
1003 | if (err < 0) { | |
1004 | kfree(spec); | |
1005 | return err; | |
1006 | } | |
1007 | return 0; | |
1008 | } | |
1009 | ||
3e6179b8 TI |
1010 | static int alc880_parse_auto_config(struct hda_codec *codec) |
1011 | { | |
1012 | static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; | |
7d7eb9ea | 1013 | static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
3e6179b8 TI |
1014 | return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); |
1015 | } | |
1016 | ||
ee3b2969 TI |
1017 | /* |
1018 | * ALC880 fix-ups | |
1019 | */ | |
1020 | enum { | |
411225a0 | 1021 | ALC880_FIXUP_GPIO1, |
ee3b2969 TI |
1022 | ALC880_FIXUP_GPIO2, |
1023 | ALC880_FIXUP_MEDION_RIM, | |
dc6af52d | 1024 | ALC880_FIXUP_LG, |
db8a38e5 | 1025 | ALC880_FIXUP_LG_LW25, |
f02aab5d | 1026 | ALC880_FIXUP_W810, |
27e917f8 | 1027 | ALC880_FIXUP_EAPD_COEF, |
b9368f5c | 1028 | ALC880_FIXUP_TCL_S700, |
cf5a2279 TI |
1029 | ALC880_FIXUP_VOL_KNOB, |
1030 | ALC880_FIXUP_FUJITSU, | |
ba533818 | 1031 | ALC880_FIXUP_F1734, |
817de92f | 1032 | ALC880_FIXUP_UNIWILL, |
967b88c4 | 1033 | ALC880_FIXUP_UNIWILL_DIG, |
96e225f6 | 1034 | ALC880_FIXUP_Z71V, |
487a588d | 1035 | ALC880_FIXUP_ASUS_W5A, |
67b6ec31 TI |
1036 | ALC880_FIXUP_3ST_BASE, |
1037 | ALC880_FIXUP_3ST, | |
1038 | ALC880_FIXUP_3ST_DIG, | |
1039 | ALC880_FIXUP_5ST_BASE, | |
1040 | ALC880_FIXUP_5ST, | |
1041 | ALC880_FIXUP_5ST_DIG, | |
1042 | ALC880_FIXUP_6ST_BASE, | |
1043 | ALC880_FIXUP_6ST, | |
1044 | ALC880_FIXUP_6ST_DIG, | |
5397145f | 1045 | ALC880_FIXUP_6ST_AUTOMUTE, |
ee3b2969 TI |
1046 | }; |
1047 | ||
cf5a2279 TI |
1048 | /* enable the volume-knob widget support on NID 0x21 */ |
1049 | static void alc880_fixup_vol_knob(struct hda_codec *codec, | |
1727a771 | 1050 | const struct hda_fixup *fix, int action) |
cf5a2279 | 1051 | { |
1727a771 | 1052 | if (action == HDA_FIXUP_ACT_PROBE) |
62f949bf TI |
1053 | snd_hda_jack_detect_enable_callback(codec, 0x21, |
1054 | alc_update_knob_master); | |
cf5a2279 TI |
1055 | } |
1056 | ||
1727a771 | 1057 | static const struct hda_fixup alc880_fixups[] = { |
411225a0 | 1058 | [ALC880_FIXUP_GPIO1] = { |
1727a771 | 1059 | .type = HDA_FIXUP_VERBS, |
411225a0 TI |
1060 | .v.verbs = alc_gpio1_init_verbs, |
1061 | }, | |
ee3b2969 | 1062 | [ALC880_FIXUP_GPIO2] = { |
1727a771 | 1063 | .type = HDA_FIXUP_VERBS, |
ee3b2969 TI |
1064 | .v.verbs = alc_gpio2_init_verbs, |
1065 | }, | |
1066 | [ALC880_FIXUP_MEDION_RIM] = { | |
1727a771 | 1067 | .type = HDA_FIXUP_VERBS, |
ee3b2969 TI |
1068 | .v.verbs = (const struct hda_verb[]) { |
1069 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
1070 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, | |
1071 | { } | |
1072 | }, | |
1073 | .chained = true, | |
1074 | .chain_id = ALC880_FIXUP_GPIO2, | |
1075 | }, | |
dc6af52d | 1076 | [ALC880_FIXUP_LG] = { |
1727a771 TI |
1077 | .type = HDA_FIXUP_PINS, |
1078 | .v.pins = (const struct hda_pintbl[]) { | |
dc6af52d TI |
1079 | /* disable bogus unused pins */ |
1080 | { 0x16, 0x411111f0 }, | |
1081 | { 0x18, 0x411111f0 }, | |
1082 | { 0x1a, 0x411111f0 }, | |
1083 | { } | |
1084 | } | |
1085 | }, | |
db8a38e5 TI |
1086 | [ALC880_FIXUP_LG_LW25] = { |
1087 | .type = HDA_FIXUP_PINS, | |
1088 | .v.pins = (const struct hda_pintbl[]) { | |
1089 | { 0x1a, 0x0181344f }, /* line-in */ | |
1090 | { 0x1b, 0x0321403f }, /* headphone */ | |
1091 | { } | |
1092 | } | |
1093 | }, | |
f02aab5d | 1094 | [ALC880_FIXUP_W810] = { |
1727a771 TI |
1095 | .type = HDA_FIXUP_PINS, |
1096 | .v.pins = (const struct hda_pintbl[]) { | |
f02aab5d TI |
1097 | /* disable bogus unused pins */ |
1098 | { 0x17, 0x411111f0 }, | |
1099 | { } | |
1100 | }, | |
1101 | .chained = true, | |
1102 | .chain_id = ALC880_FIXUP_GPIO2, | |
1103 | }, | |
27e917f8 | 1104 | [ALC880_FIXUP_EAPD_COEF] = { |
1727a771 | 1105 | .type = HDA_FIXUP_VERBS, |
27e917f8 TI |
1106 | .v.verbs = (const struct hda_verb[]) { |
1107 | /* change to EAPD mode */ | |
1108 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
1109 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, | |
1110 | {} | |
1111 | }, | |
1112 | }, | |
b9368f5c | 1113 | [ALC880_FIXUP_TCL_S700] = { |
1727a771 | 1114 | .type = HDA_FIXUP_VERBS, |
b9368f5c TI |
1115 | .v.verbs = (const struct hda_verb[]) { |
1116 | /* change to EAPD mode */ | |
1117 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
1118 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, | |
1119 | {} | |
1120 | }, | |
1121 | .chained = true, | |
1122 | .chain_id = ALC880_FIXUP_GPIO2, | |
1123 | }, | |
cf5a2279 | 1124 | [ALC880_FIXUP_VOL_KNOB] = { |
1727a771 | 1125 | .type = HDA_FIXUP_FUNC, |
cf5a2279 TI |
1126 | .v.func = alc880_fixup_vol_knob, |
1127 | }, | |
1128 | [ALC880_FIXUP_FUJITSU] = { | |
1129 | /* override all pins as BIOS on old Amilo is broken */ | |
1727a771 TI |
1130 | .type = HDA_FIXUP_PINS, |
1131 | .v.pins = (const struct hda_pintbl[]) { | |
cf5a2279 TI |
1132 | { 0x14, 0x0121411f }, /* HP */ |
1133 | { 0x15, 0x99030120 }, /* speaker */ | |
1134 | { 0x16, 0x99030130 }, /* bass speaker */ | |
1135 | { 0x17, 0x411111f0 }, /* N/A */ | |
1136 | { 0x18, 0x411111f0 }, /* N/A */ | |
1137 | { 0x19, 0x01a19950 }, /* mic-in */ | |
1138 | { 0x1a, 0x411111f0 }, /* N/A */ | |
1139 | { 0x1b, 0x411111f0 }, /* N/A */ | |
1140 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1141 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1142 | { 0x1e, 0x01454140 }, /* SPDIF out */ | |
1143 | { } | |
1144 | }, | |
1145 | .chained = true, | |
1146 | .chain_id = ALC880_FIXUP_VOL_KNOB, | |
1147 | }, | |
ba533818 TI |
1148 | [ALC880_FIXUP_F1734] = { |
1149 | /* almost compatible with FUJITSU, but no bass and SPDIF */ | |
1727a771 TI |
1150 | .type = HDA_FIXUP_PINS, |
1151 | .v.pins = (const struct hda_pintbl[]) { | |
ba533818 TI |
1152 | { 0x14, 0x0121411f }, /* HP */ |
1153 | { 0x15, 0x99030120 }, /* speaker */ | |
1154 | { 0x16, 0x411111f0 }, /* N/A */ | |
1155 | { 0x17, 0x411111f0 }, /* N/A */ | |
1156 | { 0x18, 0x411111f0 }, /* N/A */ | |
1157 | { 0x19, 0x01a19950 }, /* mic-in */ | |
1158 | { 0x1a, 0x411111f0 }, /* N/A */ | |
1159 | { 0x1b, 0x411111f0 }, /* N/A */ | |
1160 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1161 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1162 | { 0x1e, 0x411111f0 }, /* N/A */ | |
1163 | { } | |
1164 | }, | |
1165 | .chained = true, | |
1166 | .chain_id = ALC880_FIXUP_VOL_KNOB, | |
1167 | }, | |
817de92f TI |
1168 | [ALC880_FIXUP_UNIWILL] = { |
1169 | /* need to fix HP and speaker pins to be parsed correctly */ | |
1727a771 TI |
1170 | .type = HDA_FIXUP_PINS, |
1171 | .v.pins = (const struct hda_pintbl[]) { | |
817de92f TI |
1172 | { 0x14, 0x0121411f }, /* HP */ |
1173 | { 0x15, 0x99030120 }, /* speaker */ | |
1174 | { 0x16, 0x99030130 }, /* bass speaker */ | |
1175 | { } | |
1176 | }, | |
1177 | }, | |
967b88c4 | 1178 | [ALC880_FIXUP_UNIWILL_DIG] = { |
1727a771 TI |
1179 | .type = HDA_FIXUP_PINS, |
1180 | .v.pins = (const struct hda_pintbl[]) { | |
967b88c4 TI |
1181 | /* disable bogus unused pins */ |
1182 | { 0x17, 0x411111f0 }, | |
1183 | { 0x19, 0x411111f0 }, | |
1184 | { 0x1b, 0x411111f0 }, | |
1185 | { 0x1f, 0x411111f0 }, | |
1186 | { } | |
1187 | } | |
1188 | }, | |
96e225f6 | 1189 | [ALC880_FIXUP_Z71V] = { |
1727a771 TI |
1190 | .type = HDA_FIXUP_PINS, |
1191 | .v.pins = (const struct hda_pintbl[]) { | |
96e225f6 TI |
1192 | /* set up the whole pins as BIOS is utterly broken */ |
1193 | { 0x14, 0x99030120 }, /* speaker */ | |
1194 | { 0x15, 0x0121411f }, /* HP */ | |
1195 | { 0x16, 0x411111f0 }, /* N/A */ | |
1196 | { 0x17, 0x411111f0 }, /* N/A */ | |
1197 | { 0x18, 0x01a19950 }, /* mic-in */ | |
1198 | { 0x19, 0x411111f0 }, /* N/A */ | |
1199 | { 0x1a, 0x01813031 }, /* line-in */ | |
1200 | { 0x1b, 0x411111f0 }, /* N/A */ | |
1201 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1202 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1203 | { 0x1e, 0x0144111e }, /* SPDIF */ | |
1204 | { } | |
1205 | } | |
1206 | }, | |
487a588d TI |
1207 | [ALC880_FIXUP_ASUS_W5A] = { |
1208 | .type = HDA_FIXUP_PINS, | |
1209 | .v.pins = (const struct hda_pintbl[]) { | |
1210 | /* set up the whole pins as BIOS is utterly broken */ | |
1211 | { 0x14, 0x0121411f }, /* HP */ | |
1212 | { 0x15, 0x411111f0 }, /* N/A */ | |
1213 | { 0x16, 0x411111f0 }, /* N/A */ | |
1214 | { 0x17, 0x411111f0 }, /* N/A */ | |
1215 | { 0x18, 0x90a60160 }, /* mic */ | |
1216 | { 0x19, 0x411111f0 }, /* N/A */ | |
1217 | { 0x1a, 0x411111f0 }, /* N/A */ | |
1218 | { 0x1b, 0x411111f0 }, /* N/A */ | |
1219 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1220 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1221 | { 0x1e, 0xb743111e }, /* SPDIF out */ | |
1222 | { } | |
1223 | }, | |
1224 | .chained = true, | |
1225 | .chain_id = ALC880_FIXUP_GPIO1, | |
1226 | }, | |
67b6ec31 | 1227 | [ALC880_FIXUP_3ST_BASE] = { |
1727a771 TI |
1228 | .type = HDA_FIXUP_PINS, |
1229 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1230 | { 0x14, 0x01014010 }, /* line-out */ |
1231 | { 0x15, 0x411111f0 }, /* N/A */ | |
1232 | { 0x16, 0x411111f0 }, /* N/A */ | |
1233 | { 0x17, 0x411111f0 }, /* N/A */ | |
1234 | { 0x18, 0x01a19c30 }, /* mic-in */ | |
1235 | { 0x19, 0x0121411f }, /* HP */ | |
1236 | { 0x1a, 0x01813031 }, /* line-in */ | |
1237 | { 0x1b, 0x02a19c40 }, /* front-mic */ | |
1238 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1239 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1240 | /* 0x1e is filled in below */ | |
1241 | { 0x1f, 0x411111f0 }, /* N/A */ | |
1242 | { } | |
1243 | } | |
1244 | }, | |
1245 | [ALC880_FIXUP_3ST] = { | |
1727a771 TI |
1246 | .type = HDA_FIXUP_PINS, |
1247 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1248 | { 0x1e, 0x411111f0 }, /* N/A */ |
1249 | { } | |
1250 | }, | |
1251 | .chained = true, | |
1252 | .chain_id = ALC880_FIXUP_3ST_BASE, | |
1253 | }, | |
1254 | [ALC880_FIXUP_3ST_DIG] = { | |
1727a771 TI |
1255 | .type = HDA_FIXUP_PINS, |
1256 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1257 | { 0x1e, 0x0144111e }, /* SPDIF */ |
1258 | { } | |
1259 | }, | |
1260 | .chained = true, | |
1261 | .chain_id = ALC880_FIXUP_3ST_BASE, | |
1262 | }, | |
1263 | [ALC880_FIXUP_5ST_BASE] = { | |
1727a771 TI |
1264 | .type = HDA_FIXUP_PINS, |
1265 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1266 | { 0x14, 0x01014010 }, /* front */ |
1267 | { 0x15, 0x411111f0 }, /* N/A */ | |
1268 | { 0x16, 0x01011411 }, /* CLFE */ | |
1269 | { 0x17, 0x01016412 }, /* surr */ | |
1270 | { 0x18, 0x01a19c30 }, /* mic-in */ | |
1271 | { 0x19, 0x0121411f }, /* HP */ | |
1272 | { 0x1a, 0x01813031 }, /* line-in */ | |
1273 | { 0x1b, 0x02a19c40 }, /* front-mic */ | |
1274 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1275 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1276 | /* 0x1e is filled in below */ | |
1277 | { 0x1f, 0x411111f0 }, /* N/A */ | |
1278 | { } | |
1279 | } | |
1280 | }, | |
1281 | [ALC880_FIXUP_5ST] = { | |
1727a771 TI |
1282 | .type = HDA_FIXUP_PINS, |
1283 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1284 | { 0x1e, 0x411111f0 }, /* N/A */ |
1285 | { } | |
1286 | }, | |
1287 | .chained = true, | |
1288 | .chain_id = ALC880_FIXUP_5ST_BASE, | |
1289 | }, | |
1290 | [ALC880_FIXUP_5ST_DIG] = { | |
1727a771 TI |
1291 | .type = HDA_FIXUP_PINS, |
1292 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1293 | { 0x1e, 0x0144111e }, /* SPDIF */ |
1294 | { } | |
1295 | }, | |
1296 | .chained = true, | |
1297 | .chain_id = ALC880_FIXUP_5ST_BASE, | |
1298 | }, | |
1299 | [ALC880_FIXUP_6ST_BASE] = { | |
1727a771 TI |
1300 | .type = HDA_FIXUP_PINS, |
1301 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1302 | { 0x14, 0x01014010 }, /* front */ |
1303 | { 0x15, 0x01016412 }, /* surr */ | |
1304 | { 0x16, 0x01011411 }, /* CLFE */ | |
1305 | { 0x17, 0x01012414 }, /* side */ | |
1306 | { 0x18, 0x01a19c30 }, /* mic-in */ | |
1307 | { 0x19, 0x02a19c40 }, /* front-mic */ | |
1308 | { 0x1a, 0x01813031 }, /* line-in */ | |
1309 | { 0x1b, 0x0121411f }, /* HP */ | |
1310 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1311 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1312 | /* 0x1e is filled in below */ | |
1313 | { 0x1f, 0x411111f0 }, /* N/A */ | |
1314 | { } | |
1315 | } | |
1316 | }, | |
1317 | [ALC880_FIXUP_6ST] = { | |
1727a771 TI |
1318 | .type = HDA_FIXUP_PINS, |
1319 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1320 | { 0x1e, 0x411111f0 }, /* N/A */ |
1321 | { } | |
1322 | }, | |
1323 | .chained = true, | |
1324 | .chain_id = ALC880_FIXUP_6ST_BASE, | |
1325 | }, | |
1326 | [ALC880_FIXUP_6ST_DIG] = { | |
1727a771 TI |
1327 | .type = HDA_FIXUP_PINS, |
1328 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1329 | { 0x1e, 0x0144111e }, /* SPDIF */ |
1330 | { } | |
1331 | }, | |
1332 | .chained = true, | |
1333 | .chain_id = ALC880_FIXUP_6ST_BASE, | |
1334 | }, | |
5397145f TI |
1335 | [ALC880_FIXUP_6ST_AUTOMUTE] = { |
1336 | .type = HDA_FIXUP_PINS, | |
1337 | .v.pins = (const struct hda_pintbl[]) { | |
1338 | { 0x1b, 0x0121401f }, /* HP with jack detect */ | |
1339 | { } | |
1340 | }, | |
1341 | .chained_before = true, | |
1342 | .chain_id = ALC880_FIXUP_6ST_BASE, | |
1343 | }, | |
ee3b2969 TI |
1344 | }; |
1345 | ||
1346 | static const struct snd_pci_quirk alc880_fixup_tbl[] = { | |
f02aab5d | 1347 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810), |
487a588d | 1348 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A), |
96e225f6 | 1349 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V), |
29e3fdcc | 1350 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1), |
6538de03 | 1351 | SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE), |
29e3fdcc | 1352 | SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2), |
27e917f8 | 1353 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF), |
967b88c4 | 1354 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG), |
ba533818 | 1355 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734), |
817de92f | 1356 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL), |
7833c7e8 | 1357 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB), |
f02aab5d | 1358 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), |
ee3b2969 | 1359 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), |
5397145f | 1360 | SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE), |
ba533818 | 1361 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734), |
cf5a2279 | 1362 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU), |
ba533818 | 1363 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734), |
cf5a2279 | 1364 | SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU), |
dc6af52d TI |
1365 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG), |
1366 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG), | |
1367 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG), | |
db8a38e5 | 1368 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25), |
b9368f5c | 1369 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700), |
67b6ec31 TI |
1370 | |
1371 | /* Below is the copied entries from alc880_quirks.c. | |
1372 | * It's not quite sure whether BIOS sets the correct pin-config table | |
1373 | * on these machines, thus they are kept to be compatible with | |
1374 | * the old static quirks. Once when it's confirmed to work without | |
1375 | * these overrides, it'd be better to remove. | |
1376 | */ | |
1377 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG), | |
1378 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST), | |
1379 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG), | |
1380 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG), | |
1381 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG), | |
1382 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG), | |
1383 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG), | |
1384 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST), | |
1385 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG), | |
1386 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST), | |
1387 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST), | |
1388 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST), | |
1389 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST), | |
1390 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST), | |
1391 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG), | |
1392 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG), | |
1393 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG), | |
1394 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG), | |
1395 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG), | |
1396 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG), | |
1397 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG), | |
1398 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */ | |
1399 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG), | |
1400 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1401 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1402 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1403 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG), | |
1404 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1405 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG), | |
1406 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG), | |
1407 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1408 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1409 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1410 | /* default Intel */ | |
1411 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST), | |
1412 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG), | |
1413 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG), | |
1414 | {} | |
1415 | }; | |
1416 | ||
1727a771 | 1417 | static const struct hda_model_fixup alc880_fixup_models[] = { |
67b6ec31 TI |
1418 | {.id = ALC880_FIXUP_3ST, .name = "3stack"}, |
1419 | {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"}, | |
1420 | {.id = ALC880_FIXUP_5ST, .name = "5stack"}, | |
1421 | {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"}, | |
1422 | {.id = ALC880_FIXUP_6ST, .name = "6stack"}, | |
1423 | {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"}, | |
5397145f | 1424 | {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"}, |
ee3b2969 TI |
1425 | {} |
1426 | }; | |
1427 | ||
1428 | ||
1d045db9 TI |
1429 | /* |
1430 | * OK, here we have finally the patch for ALC880 | |
1431 | */ | |
1d045db9 | 1432 | static int patch_alc880(struct hda_codec *codec) |
60db6b53 | 1433 | { |
1d045db9 | 1434 | struct alc_spec *spec; |
1d045db9 | 1435 | int err; |
f6a92248 | 1436 | |
3de95173 TI |
1437 | err = alc_alloc_spec(codec, 0x0b); |
1438 | if (err < 0) | |
1439 | return err; | |
64154835 | 1440 | |
3de95173 | 1441 | spec = codec->spec; |
08c189f2 | 1442 | spec->gen.need_dac_fix = 1; |
7504b6cd | 1443 | spec->gen.beep_nid = 0x01; |
f53281e6 | 1444 | |
1727a771 | 1445 | snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, |
67b6ec31 | 1446 | alc880_fixups); |
1727a771 | 1447 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
ee3b2969 | 1448 | |
67b6ec31 TI |
1449 | /* automatic parse from the BIOS config */ |
1450 | err = alc880_parse_auto_config(codec); | |
1451 | if (err < 0) | |
1452 | goto error; | |
fe3eb0a7 | 1453 | |
7504b6cd | 1454 | if (!spec->gen.no_analog) |
3e6179b8 | 1455 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
f53281e6 | 1456 | |
1d045db9 | 1457 | codec->patch_ops = alc_patch_ops; |
29adc4b9 DH |
1458 | codec->patch_ops.unsol_event = alc880_unsol_event; |
1459 | ||
f53281e6 | 1460 | |
1727a771 | 1461 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 1462 | |
1d045db9 | 1463 | return 0; |
e16fb6d1 TI |
1464 | |
1465 | error: | |
1466 | alc_free(codec); | |
1467 | return err; | |
226b1ec8 KY |
1468 | } |
1469 | ||
1d045db9 | 1470 | |
60db6b53 | 1471 | /* |
1d045db9 | 1472 | * ALC260 support |
60db6b53 | 1473 | */ |
1d045db9 | 1474 | static int alc260_parse_auto_config(struct hda_codec *codec) |
f6a92248 | 1475 | { |
1d045db9 | 1476 | static const hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
3e6179b8 TI |
1477 | static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 }; |
1478 | return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); | |
f6a92248 KY |
1479 | } |
1480 | ||
1d045db9 TI |
1481 | /* |
1482 | * Pin config fixes | |
1483 | */ | |
1484 | enum { | |
ca8f0424 TI |
1485 | ALC260_FIXUP_HP_DC5750, |
1486 | ALC260_FIXUP_HP_PIN_0F, | |
1487 | ALC260_FIXUP_COEF, | |
15317ab2 | 1488 | ALC260_FIXUP_GPIO1, |
20f7d928 TI |
1489 | ALC260_FIXUP_GPIO1_TOGGLE, |
1490 | ALC260_FIXUP_REPLACER, | |
0a1c4fa2 | 1491 | ALC260_FIXUP_HP_B1900, |
118cb4a4 | 1492 | ALC260_FIXUP_KN1, |
39aedee7 | 1493 | ALC260_FIXUP_FSC_S7020, |
5ebd3bbd | 1494 | ALC260_FIXUP_FSC_S7020_JWSE, |
d08c5ef2 | 1495 | ALC260_FIXUP_VAIO_PINS, |
1d045db9 TI |
1496 | }; |
1497 | ||
20f7d928 TI |
1498 | static void alc260_gpio1_automute(struct hda_codec *codec) |
1499 | { | |
1500 | struct alc_spec *spec = codec->spec; | |
1501 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | |
08c189f2 | 1502 | spec->gen.hp_jack_present); |
20f7d928 TI |
1503 | } |
1504 | ||
1505 | static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, | |
1727a771 | 1506 | const struct hda_fixup *fix, int action) |
20f7d928 TI |
1507 | { |
1508 | struct alc_spec *spec = codec->spec; | |
1727a771 | 1509 | if (action == HDA_FIXUP_ACT_PROBE) { |
20f7d928 TI |
1510 | /* although the machine has only one output pin, we need to |
1511 | * toggle GPIO1 according to the jack state | |
1512 | */ | |
08c189f2 TI |
1513 | spec->gen.automute_hook = alc260_gpio1_automute; |
1514 | spec->gen.detect_hp = 1; | |
1515 | spec->gen.automute_speaker = 1; | |
1516 | spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ | |
62f949bf | 1517 | snd_hda_jack_detect_enable_callback(codec, 0x0f, |
08c189f2 | 1518 | snd_hda_gen_hp_automute); |
c9ce6b26 | 1519 | snd_hda_add_verbs(codec, alc_gpio1_init_verbs); |
20f7d928 TI |
1520 | } |
1521 | } | |
1522 | ||
118cb4a4 | 1523 | static void alc260_fixup_kn1(struct hda_codec *codec, |
1727a771 | 1524 | const struct hda_fixup *fix, int action) |
118cb4a4 TI |
1525 | { |
1526 | struct alc_spec *spec = codec->spec; | |
1727a771 | 1527 | static const struct hda_pintbl pincfgs[] = { |
118cb4a4 TI |
1528 | { 0x0f, 0x02214000 }, /* HP/speaker */ |
1529 | { 0x12, 0x90a60160 }, /* int mic */ | |
1530 | { 0x13, 0x02a19000 }, /* ext mic */ | |
1531 | { 0x18, 0x01446000 }, /* SPDIF out */ | |
1532 | /* disable bogus I/O pins */ | |
1533 | { 0x10, 0x411111f0 }, | |
1534 | { 0x11, 0x411111f0 }, | |
1535 | { 0x14, 0x411111f0 }, | |
1536 | { 0x15, 0x411111f0 }, | |
1537 | { 0x16, 0x411111f0 }, | |
1538 | { 0x17, 0x411111f0 }, | |
1539 | { 0x19, 0x411111f0 }, | |
1540 | { } | |
1541 | }; | |
1542 | ||
1543 | switch (action) { | |
1727a771 TI |
1544 | case HDA_FIXUP_ACT_PRE_PROBE: |
1545 | snd_hda_apply_pincfgs(codec, pincfgs); | |
118cb4a4 | 1546 | break; |
1727a771 | 1547 | case HDA_FIXUP_ACT_PROBE: |
118cb4a4 TI |
1548 | spec->init_amp = ALC_INIT_NONE; |
1549 | break; | |
1550 | } | |
1551 | } | |
1552 | ||
39aedee7 TI |
1553 | static void alc260_fixup_fsc_s7020(struct hda_codec *codec, |
1554 | const struct hda_fixup *fix, int action) | |
1555 | { | |
1556 | struct alc_spec *spec = codec->spec; | |
5ebd3bbd TI |
1557 | if (action == HDA_FIXUP_ACT_PROBE) |
1558 | spec->init_amp = ALC_INIT_NONE; | |
1559 | } | |
39aedee7 | 1560 | |
5ebd3bbd TI |
1561 | static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, |
1562 | const struct hda_fixup *fix, int action) | |
1563 | { | |
1564 | struct alc_spec *spec = codec->spec; | |
1565 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
f811c3cf | 1566 | spec->gen.add_jack_modes = 1; |
5ebd3bbd | 1567 | spec->gen.hp_mic = 1; |
e6e0ee50 | 1568 | } |
39aedee7 TI |
1569 | } |
1570 | ||
1727a771 | 1571 | static const struct hda_fixup alc260_fixups[] = { |
ca8f0424 | 1572 | [ALC260_FIXUP_HP_DC5750] = { |
1727a771 TI |
1573 | .type = HDA_FIXUP_PINS, |
1574 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
1575 | { 0x11, 0x90130110 }, /* speaker */ |
1576 | { } | |
1577 | } | |
1578 | }, | |
ca8f0424 | 1579 | [ALC260_FIXUP_HP_PIN_0F] = { |
1727a771 TI |
1580 | .type = HDA_FIXUP_PINS, |
1581 | .v.pins = (const struct hda_pintbl[]) { | |
ca8f0424 TI |
1582 | { 0x0f, 0x01214000 }, /* HP */ |
1583 | { } | |
1584 | } | |
1585 | }, | |
1586 | [ALC260_FIXUP_COEF] = { | |
1727a771 | 1587 | .type = HDA_FIXUP_VERBS, |
ca8f0424 | 1588 | .v.verbs = (const struct hda_verb[]) { |
e30cf2d2 RM |
1589 | { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 }, |
1590 | { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 }, | |
ca8f0424 TI |
1591 | { } |
1592 | }, | |
ca8f0424 | 1593 | }, |
15317ab2 | 1594 | [ALC260_FIXUP_GPIO1] = { |
1727a771 | 1595 | .type = HDA_FIXUP_VERBS, |
15317ab2 TI |
1596 | .v.verbs = alc_gpio1_init_verbs, |
1597 | }, | |
20f7d928 | 1598 | [ALC260_FIXUP_GPIO1_TOGGLE] = { |
1727a771 | 1599 | .type = HDA_FIXUP_FUNC, |
20f7d928 TI |
1600 | .v.func = alc260_fixup_gpio1_toggle, |
1601 | .chained = true, | |
1602 | .chain_id = ALC260_FIXUP_HP_PIN_0F, | |
1603 | }, | |
1604 | [ALC260_FIXUP_REPLACER] = { | |
1727a771 | 1605 | .type = HDA_FIXUP_VERBS, |
20f7d928 | 1606 | .v.verbs = (const struct hda_verb[]) { |
192a98e2 TI |
1607 | { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 }, |
1608 | { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 }, | |
20f7d928 TI |
1609 | { } |
1610 | }, | |
1611 | .chained = true, | |
1612 | .chain_id = ALC260_FIXUP_GPIO1_TOGGLE, | |
1613 | }, | |
0a1c4fa2 | 1614 | [ALC260_FIXUP_HP_B1900] = { |
1727a771 | 1615 | .type = HDA_FIXUP_FUNC, |
0a1c4fa2 TI |
1616 | .v.func = alc260_fixup_gpio1_toggle, |
1617 | .chained = true, | |
1618 | .chain_id = ALC260_FIXUP_COEF, | |
118cb4a4 TI |
1619 | }, |
1620 | [ALC260_FIXUP_KN1] = { | |
1727a771 | 1621 | .type = HDA_FIXUP_FUNC, |
118cb4a4 TI |
1622 | .v.func = alc260_fixup_kn1, |
1623 | }, | |
39aedee7 TI |
1624 | [ALC260_FIXUP_FSC_S7020] = { |
1625 | .type = HDA_FIXUP_FUNC, | |
1626 | .v.func = alc260_fixup_fsc_s7020, | |
1627 | }, | |
5ebd3bbd TI |
1628 | [ALC260_FIXUP_FSC_S7020_JWSE] = { |
1629 | .type = HDA_FIXUP_FUNC, | |
1630 | .v.func = alc260_fixup_fsc_s7020_jwse, | |
1631 | .chained = true, | |
1632 | .chain_id = ALC260_FIXUP_FSC_S7020, | |
1633 | }, | |
d08c5ef2 TI |
1634 | [ALC260_FIXUP_VAIO_PINS] = { |
1635 | .type = HDA_FIXUP_PINS, | |
1636 | .v.pins = (const struct hda_pintbl[]) { | |
1637 | /* Pin configs are missing completely on some VAIOs */ | |
1638 | { 0x0f, 0x01211020 }, | |
1639 | { 0x10, 0x0001003f }, | |
1640 | { 0x11, 0x411111f0 }, | |
1641 | { 0x12, 0x01a15930 }, | |
1642 | { 0x13, 0x411111f0 }, | |
1643 | { 0x14, 0x411111f0 }, | |
1644 | { 0x15, 0x411111f0 }, | |
1645 | { 0x16, 0x411111f0 }, | |
1646 | { 0x17, 0x411111f0 }, | |
1647 | { 0x18, 0x411111f0 }, | |
1648 | { 0x19, 0x411111f0 }, | |
1649 | { } | |
1650 | } | |
1651 | }, | |
1d045db9 TI |
1652 | }; |
1653 | ||
1654 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { | |
15317ab2 | 1655 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1), |
ca8f0424 | 1656 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF), |
15317ab2 | 1657 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1), |
ca8f0424 | 1658 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), |
0a1c4fa2 | 1659 | SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), |
d08c5ef2 | 1660 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS), |
0f5a5b85 | 1661 | SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F), |
39aedee7 | 1662 | SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020), |
b1f58085 | 1663 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), |
118cb4a4 | 1664 | SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1), |
20f7d928 | 1665 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), |
ca8f0424 | 1666 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), |
1d045db9 TI |
1667 | {} |
1668 | }; | |
1669 | ||
5ebd3bbd TI |
1670 | static const struct hda_model_fixup alc260_fixup_models[] = { |
1671 | {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"}, | |
1672 | {.id = ALC260_FIXUP_COEF, .name = "coef"}, | |
1673 | {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"}, | |
1674 | {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"}, | |
1675 | {} | |
1676 | }; | |
1677 | ||
1d045db9 TI |
1678 | /* |
1679 | */ | |
1d045db9 | 1680 | static int patch_alc260(struct hda_codec *codec) |
977ddd6b | 1681 | { |
1d045db9 | 1682 | struct alc_spec *spec; |
c3c2c9e7 | 1683 | int err; |
1d045db9 | 1684 | |
3de95173 TI |
1685 | err = alc_alloc_spec(codec, 0x07); |
1686 | if (err < 0) | |
1687 | return err; | |
1d045db9 | 1688 | |
3de95173 | 1689 | spec = codec->spec; |
ea46c3c8 TI |
1690 | /* as quite a few machines require HP amp for speaker outputs, |
1691 | * it's easier to enable it unconditionally; even if it's unneeded, | |
1692 | * it's almost harmless. | |
1693 | */ | |
1694 | spec->gen.prefer_hp_amp = 1; | |
7504b6cd | 1695 | spec->gen.beep_nid = 0x01; |
1d045db9 | 1696 | |
5ebd3bbd TI |
1697 | snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, |
1698 | alc260_fixups); | |
1727a771 | 1699 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
977ddd6b | 1700 | |
c3c2c9e7 TI |
1701 | /* automatic parse from the BIOS config */ |
1702 | err = alc260_parse_auto_config(codec); | |
1703 | if (err < 0) | |
1704 | goto error; | |
977ddd6b | 1705 | |
7504b6cd | 1706 | if (!spec->gen.no_analog) |
3e6179b8 | 1707 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
977ddd6b | 1708 | |
1d045db9 | 1709 | codec->patch_ops = alc_patch_ops; |
1d045db9 | 1710 | spec->shutup = alc_eapd_shutup; |
6981d184 | 1711 | |
1727a771 | 1712 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 1713 | |
1d045db9 | 1714 | return 0; |
e16fb6d1 TI |
1715 | |
1716 | error: | |
1717 | alc_free(codec); | |
1718 | return err; | |
6981d184 TI |
1719 | } |
1720 | ||
1d045db9 TI |
1721 | |
1722 | /* | |
1723 | * ALC882/883/885/888/889 support | |
1724 | * | |
1725 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
1726 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
1727 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
1728 | * 6-channel independent captures. | |
1729 | * | |
1730 | * In addition, an independent DAC for the multi-playback (not used in this | |
1731 | * driver yet). | |
1732 | */ | |
1d045db9 TI |
1733 | |
1734 | /* | |
1735 | * Pin config fixes | |
1736 | */ | |
ff818c24 | 1737 | enum { |
5c0ebfbe TI |
1738 | ALC882_FIXUP_ABIT_AW9D_MAX, |
1739 | ALC882_FIXUP_LENOVO_Y530, | |
1740 | ALC882_FIXUP_PB_M5210, | |
1741 | ALC882_FIXUP_ACER_ASPIRE_7736, | |
1742 | ALC882_FIXUP_ASUS_W90V, | |
8f239214 | 1743 | ALC889_FIXUP_CD, |
b2c53e20 | 1744 | ALC889_FIXUP_FRONT_HP_NO_PRESENCE, |
5c0ebfbe | 1745 | ALC889_FIXUP_VAIO_TT, |
0e7cc2e7 | 1746 | ALC888_FIXUP_EEE1601, |
177943a3 | 1747 | ALC882_FIXUP_EAPD, |
7a6069bf | 1748 | ALC883_FIXUP_EAPD, |
8812c4f9 | 1749 | ALC883_FIXUP_ACER_EAPD, |
1a97b7f2 TI |
1750 | ALC882_FIXUP_GPIO1, |
1751 | ALC882_FIXUP_GPIO2, | |
eb844d51 | 1752 | ALC882_FIXUP_GPIO3, |
68ef0561 TI |
1753 | ALC889_FIXUP_COEF, |
1754 | ALC882_FIXUP_ASUS_W2JC, | |
c3e837bb TI |
1755 | ALC882_FIXUP_ACER_ASPIRE_4930G, |
1756 | ALC882_FIXUP_ACER_ASPIRE_8930G, | |
1757 | ALC882_FIXUP_ASPIRE_8930G_VERBS, | |
5671087f | 1758 | ALC885_FIXUP_MACPRO_GPIO, |
02a237b2 | 1759 | ALC889_FIXUP_DAC_ROUTE, |
1a97b7f2 TI |
1760 | ALC889_FIXUP_MBP_VREF, |
1761 | ALC889_FIXUP_IMAC91_VREF, | |
e7729a41 | 1762 | ALC889_FIXUP_MBA11_VREF, |
0756f09c | 1763 | ALC889_FIXUP_MBA21_VREF, |
c20f31ec | 1764 | ALC889_FIXUP_MP11_VREF, |
6e72aa5f | 1765 | ALC882_FIXUP_INV_DMIC, |
e427c237 | 1766 | ALC882_FIXUP_NO_PRIMARY_HP, |
1f0bbf03 | 1767 | ALC887_FIXUP_ASUS_BASS, |
eb9ca3ab | 1768 | ALC887_FIXUP_BASS_CHMAP, |
ff818c24 TI |
1769 | }; |
1770 | ||
68ef0561 | 1771 | static void alc889_fixup_coef(struct hda_codec *codec, |
1727a771 | 1772 | const struct hda_fixup *fix, int action) |
68ef0561 | 1773 | { |
1727a771 | 1774 | if (action != HDA_FIXUP_ACT_INIT) |
68ef0561 | 1775 | return; |
1df8874b | 1776 | alc_update_coef_idx(codec, 7, 0, 0x2030); |
68ef0561 TI |
1777 | } |
1778 | ||
5671087f TI |
1779 | /* toggle speaker-output according to the hp-jack state */ |
1780 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | |
1781 | { | |
1782 | unsigned int gpiostate, gpiomask, gpiodir; | |
1783 | ||
1784 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
1785 | AC_VERB_GET_GPIO_DATA, 0); | |
1786 | ||
1787 | if (!muted) | |
1788 | gpiostate |= (1 << pin); | |
1789 | else | |
1790 | gpiostate &= ~(1 << pin); | |
1791 | ||
1792 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
1793 | AC_VERB_GET_GPIO_MASK, 0); | |
1794 | gpiomask |= (1 << pin); | |
1795 | ||
1796 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
1797 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
1798 | gpiodir |= (1 << pin); | |
1799 | ||
1800 | ||
1801 | snd_hda_codec_write(codec, codec->afg, 0, | |
1802 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
1803 | snd_hda_codec_write(codec, codec->afg, 0, | |
1804 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
1805 | ||
1806 | msleep(1); | |
1807 | ||
1808 | snd_hda_codec_write(codec, codec->afg, 0, | |
1809 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
1810 | } | |
1811 | ||
1812 | /* set up GPIO at initialization */ | |
1813 | static void alc885_fixup_macpro_gpio(struct hda_codec *codec, | |
1727a771 | 1814 | const struct hda_fixup *fix, int action) |
5671087f | 1815 | { |
1727a771 | 1816 | if (action != HDA_FIXUP_ACT_INIT) |
5671087f TI |
1817 | return; |
1818 | alc882_gpio_mute(codec, 0, 0); | |
1819 | alc882_gpio_mute(codec, 1, 0); | |
1820 | } | |
1821 | ||
02a237b2 TI |
1822 | /* Fix the connection of some pins for ALC889: |
1823 | * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't | |
1824 | * work correctly (bko#42740) | |
1825 | */ | |
1826 | static void alc889_fixup_dac_route(struct hda_codec *codec, | |
1727a771 | 1827 | const struct hda_fixup *fix, int action) |
02a237b2 | 1828 | { |
1727a771 | 1829 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
ef8d60fb | 1830 | /* fake the connections during parsing the tree */ |
02a237b2 TI |
1831 | hda_nid_t conn1[2] = { 0x0c, 0x0d }; |
1832 | hda_nid_t conn2[2] = { 0x0e, 0x0f }; | |
1833 | snd_hda_override_conn_list(codec, 0x14, 2, conn1); | |
1834 | snd_hda_override_conn_list(codec, 0x15, 2, conn1); | |
1835 | snd_hda_override_conn_list(codec, 0x18, 2, conn2); | |
1836 | snd_hda_override_conn_list(codec, 0x1a, 2, conn2); | |
1727a771 | 1837 | } else if (action == HDA_FIXUP_ACT_PROBE) { |
ef8d60fb TI |
1838 | /* restore the connections */ |
1839 | hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 }; | |
1840 | snd_hda_override_conn_list(codec, 0x14, 5, conn); | |
1841 | snd_hda_override_conn_list(codec, 0x15, 5, conn); | |
1842 | snd_hda_override_conn_list(codec, 0x18, 5, conn); | |
1843 | snd_hda_override_conn_list(codec, 0x1a, 5, conn); | |
02a237b2 TI |
1844 | } |
1845 | } | |
1846 | ||
1a97b7f2 TI |
1847 | /* Set VREF on HP pin */ |
1848 | static void alc889_fixup_mbp_vref(struct hda_codec *codec, | |
1727a771 | 1849 | const struct hda_fixup *fix, int action) |
1a97b7f2 TI |
1850 | { |
1851 | struct alc_spec *spec = codec->spec; | |
1852 | static hda_nid_t nids[2] = { 0x14, 0x15 }; | |
1853 | int i; | |
1854 | ||
1727a771 | 1855 | if (action != HDA_FIXUP_ACT_INIT) |
1a97b7f2 TI |
1856 | return; |
1857 | for (i = 0; i < ARRAY_SIZE(nids); i++) { | |
1858 | unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); | |
1859 | if (get_defcfg_device(val) != AC_JACK_HP_OUT) | |
1860 | continue; | |
d3f02d60 | 1861 | val = snd_hda_codec_get_pin_target(codec, nids[i]); |
1a97b7f2 | 1862 | val |= AC_PINCTL_VREF_80; |
cdd03ced | 1863 | snd_hda_set_pin_ctl(codec, nids[i], val); |
08c189f2 | 1864 | spec->gen.keep_vref_in_automute = 1; |
1a97b7f2 TI |
1865 | break; |
1866 | } | |
1867 | } | |
1868 | ||
0756f09c TI |
1869 | static void alc889_fixup_mac_pins(struct hda_codec *codec, |
1870 | const hda_nid_t *nids, int num_nids) | |
1a97b7f2 TI |
1871 | { |
1872 | struct alc_spec *spec = codec->spec; | |
1a97b7f2 TI |
1873 | int i; |
1874 | ||
0756f09c | 1875 | for (i = 0; i < num_nids; i++) { |
1a97b7f2 | 1876 | unsigned int val; |
d3f02d60 | 1877 | val = snd_hda_codec_get_pin_target(codec, nids[i]); |
1a97b7f2 | 1878 | val |= AC_PINCTL_VREF_50; |
cdd03ced | 1879 | snd_hda_set_pin_ctl(codec, nids[i], val); |
1a97b7f2 | 1880 | } |
08c189f2 | 1881 | spec->gen.keep_vref_in_automute = 1; |
1a97b7f2 TI |
1882 | } |
1883 | ||
0756f09c TI |
1884 | /* Set VREF on speaker pins on imac91 */ |
1885 | static void alc889_fixup_imac91_vref(struct hda_codec *codec, | |
1886 | const struct hda_fixup *fix, int action) | |
1887 | { | |
1888 | static hda_nid_t nids[2] = { 0x18, 0x1a }; | |
1889 | ||
1890 | if (action == HDA_FIXUP_ACT_INIT) | |
1891 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); | |
1892 | } | |
1893 | ||
e7729a41 AV |
1894 | /* Set VREF on speaker pins on mba11 */ |
1895 | static void alc889_fixup_mba11_vref(struct hda_codec *codec, | |
1896 | const struct hda_fixup *fix, int action) | |
1897 | { | |
1898 | static hda_nid_t nids[1] = { 0x18 }; | |
1899 | ||
1900 | if (action == HDA_FIXUP_ACT_INIT) | |
1901 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); | |
1902 | } | |
1903 | ||
0756f09c TI |
1904 | /* Set VREF on speaker pins on mba21 */ |
1905 | static void alc889_fixup_mba21_vref(struct hda_codec *codec, | |
1906 | const struct hda_fixup *fix, int action) | |
1907 | { | |
1908 | static hda_nid_t nids[2] = { 0x18, 0x19 }; | |
1909 | ||
1910 | if (action == HDA_FIXUP_ACT_INIT) | |
1911 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); | |
1912 | } | |
1913 | ||
e427c237 | 1914 | /* Don't take HP output as primary |
d9111496 FLVC |
1915 | * Strangely, the speaker output doesn't work on Vaio Z and some Vaio |
1916 | * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05 | |
e427c237 TI |
1917 | */ |
1918 | static void alc882_fixup_no_primary_hp(struct hda_codec *codec, | |
1727a771 | 1919 | const struct hda_fixup *fix, int action) |
e427c237 TI |
1920 | { |
1921 | struct alc_spec *spec = codec->spec; | |
da96fb5b | 1922 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
08c189f2 | 1923 | spec->gen.no_primary_hp = 1; |
da96fb5b TI |
1924 | spec->gen.no_multi_io = 1; |
1925 | } | |
e427c237 TI |
1926 | } |
1927 | ||
eb9ca3ab TI |
1928 | static void alc_fixup_bass_chmap(struct hda_codec *codec, |
1929 | const struct hda_fixup *fix, int action); | |
1930 | ||
1727a771 | 1931 | static const struct hda_fixup alc882_fixups[] = { |
5c0ebfbe | 1932 | [ALC882_FIXUP_ABIT_AW9D_MAX] = { |
1727a771 TI |
1933 | .type = HDA_FIXUP_PINS, |
1934 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
1935 | { 0x15, 0x01080104 }, /* side */ |
1936 | { 0x16, 0x01011012 }, /* rear */ | |
1937 | { 0x17, 0x01016011 }, /* clfe */ | |
2785591a | 1938 | { } |
145a902b DH |
1939 | } |
1940 | }, | |
5c0ebfbe | 1941 | [ALC882_FIXUP_LENOVO_Y530] = { |
1727a771 TI |
1942 | .type = HDA_FIXUP_PINS, |
1943 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
1944 | { 0x15, 0x99130112 }, /* rear int speakers */ |
1945 | { 0x16, 0x99130111 }, /* subwoofer */ | |
ac612407 DH |
1946 | { } |
1947 | } | |
1948 | }, | |
5c0ebfbe | 1949 | [ALC882_FIXUP_PB_M5210] = { |
fd108215 TI |
1950 | .type = HDA_FIXUP_PINCTLS, |
1951 | .v.pins = (const struct hda_pintbl[]) { | |
1952 | { 0x19, PIN_VREF50 }, | |
357f915e KY |
1953 | {} |
1954 | } | |
1955 | }, | |
5c0ebfbe | 1956 | [ALC882_FIXUP_ACER_ASPIRE_7736] = { |
1727a771 | 1957 | .type = HDA_FIXUP_FUNC, |
23d30f28 | 1958 | .v.func = alc_fixup_sku_ignore, |
6981d184 | 1959 | }, |
5c0ebfbe | 1960 | [ALC882_FIXUP_ASUS_W90V] = { |
1727a771 TI |
1961 | .type = HDA_FIXUP_PINS, |
1962 | .v.pins = (const struct hda_pintbl[]) { | |
5cdf745e TI |
1963 | { 0x16, 0x99130110 }, /* fix sequence for CLFE */ |
1964 | { } | |
1965 | } | |
1966 | }, | |
8f239214 | 1967 | [ALC889_FIXUP_CD] = { |
1727a771 TI |
1968 | .type = HDA_FIXUP_PINS, |
1969 | .v.pins = (const struct hda_pintbl[]) { | |
8f239214 MB |
1970 | { 0x1c, 0x993301f0 }, /* CD */ |
1971 | { } | |
1972 | } | |
1973 | }, | |
b2c53e20 DH |
1974 | [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = { |
1975 | .type = HDA_FIXUP_PINS, | |
1976 | .v.pins = (const struct hda_pintbl[]) { | |
1977 | { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */ | |
1978 | { } | |
1979 | }, | |
1980 | .chained = true, | |
1981 | .chain_id = ALC889_FIXUP_CD, | |
1982 | }, | |
5c0ebfbe | 1983 | [ALC889_FIXUP_VAIO_TT] = { |
1727a771 TI |
1984 | .type = HDA_FIXUP_PINS, |
1985 | .v.pins = (const struct hda_pintbl[]) { | |
5c0ebfbe TI |
1986 | { 0x17, 0x90170111 }, /* hidden surround speaker */ |
1987 | { } | |
1988 | } | |
1989 | }, | |
0e7cc2e7 | 1990 | [ALC888_FIXUP_EEE1601] = { |
1727a771 | 1991 | .type = HDA_FIXUP_VERBS, |
0e7cc2e7 TI |
1992 | .v.verbs = (const struct hda_verb[]) { |
1993 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, | |
1994 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 }, | |
1995 | { } | |
1996 | } | |
177943a3 TI |
1997 | }, |
1998 | [ALC882_FIXUP_EAPD] = { | |
1727a771 | 1999 | .type = HDA_FIXUP_VERBS, |
177943a3 TI |
2000 | .v.verbs = (const struct hda_verb[]) { |
2001 | /* change to EAPD mode */ | |
2002 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2003 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, | |
2004 | { } | |
2005 | } | |
2006 | }, | |
7a6069bf | 2007 | [ALC883_FIXUP_EAPD] = { |
1727a771 | 2008 | .type = HDA_FIXUP_VERBS, |
7a6069bf TI |
2009 | .v.verbs = (const struct hda_verb[]) { |
2010 | /* change to EAPD mode */ | |
2011 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2012 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, | |
2013 | { } | |
2014 | } | |
2015 | }, | |
8812c4f9 | 2016 | [ALC883_FIXUP_ACER_EAPD] = { |
1727a771 | 2017 | .type = HDA_FIXUP_VERBS, |
8812c4f9 TI |
2018 | .v.verbs = (const struct hda_verb[]) { |
2019 | /* eanable EAPD on Acer laptops */ | |
2020 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2021 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | |
2022 | { } | |
2023 | } | |
2024 | }, | |
1a97b7f2 | 2025 | [ALC882_FIXUP_GPIO1] = { |
1727a771 | 2026 | .type = HDA_FIXUP_VERBS, |
1a97b7f2 TI |
2027 | .v.verbs = alc_gpio1_init_verbs, |
2028 | }, | |
2029 | [ALC882_FIXUP_GPIO2] = { | |
1727a771 | 2030 | .type = HDA_FIXUP_VERBS, |
1a97b7f2 TI |
2031 | .v.verbs = alc_gpio2_init_verbs, |
2032 | }, | |
eb844d51 | 2033 | [ALC882_FIXUP_GPIO3] = { |
1727a771 | 2034 | .type = HDA_FIXUP_VERBS, |
eb844d51 TI |
2035 | .v.verbs = alc_gpio3_init_verbs, |
2036 | }, | |
68ef0561 | 2037 | [ALC882_FIXUP_ASUS_W2JC] = { |
1727a771 | 2038 | .type = HDA_FIXUP_VERBS, |
68ef0561 TI |
2039 | .v.verbs = alc_gpio1_init_verbs, |
2040 | .chained = true, | |
2041 | .chain_id = ALC882_FIXUP_EAPD, | |
2042 | }, | |
2043 | [ALC889_FIXUP_COEF] = { | |
1727a771 | 2044 | .type = HDA_FIXUP_FUNC, |
68ef0561 TI |
2045 | .v.func = alc889_fixup_coef, |
2046 | }, | |
c3e837bb | 2047 | [ALC882_FIXUP_ACER_ASPIRE_4930G] = { |
1727a771 TI |
2048 | .type = HDA_FIXUP_PINS, |
2049 | .v.pins = (const struct hda_pintbl[]) { | |
c3e837bb TI |
2050 | { 0x16, 0x99130111 }, /* CLFE speaker */ |
2051 | { 0x17, 0x99130112 }, /* surround speaker */ | |
2052 | { } | |
038d4fef TI |
2053 | }, |
2054 | .chained = true, | |
2055 | .chain_id = ALC882_FIXUP_GPIO1, | |
c3e837bb TI |
2056 | }, |
2057 | [ALC882_FIXUP_ACER_ASPIRE_8930G] = { | |
1727a771 TI |
2058 | .type = HDA_FIXUP_PINS, |
2059 | .v.pins = (const struct hda_pintbl[]) { | |
c3e837bb TI |
2060 | { 0x16, 0x99130111 }, /* CLFE speaker */ |
2061 | { 0x1b, 0x99130112 }, /* surround speaker */ | |
2062 | { } | |
2063 | }, | |
2064 | .chained = true, | |
2065 | .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS, | |
2066 | }, | |
2067 | [ALC882_FIXUP_ASPIRE_8930G_VERBS] = { | |
2068 | /* additional init verbs for Acer Aspire 8930G */ | |
1727a771 | 2069 | .type = HDA_FIXUP_VERBS, |
c3e837bb TI |
2070 | .v.verbs = (const struct hda_verb[]) { |
2071 | /* Enable all DACs */ | |
2072 | /* DAC DISABLE/MUTE 1? */ | |
2073 | /* setting bits 1-5 disables DAC nids 0x02-0x06 | |
2074 | * apparently. Init=0x38 */ | |
2075 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 }, | |
2076 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, | |
2077 | /* DAC DISABLE/MUTE 2? */ | |
2078 | /* some bit here disables the other DACs. | |
2079 | * Init=0x4900 */ | |
2080 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 }, | |
2081 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, | |
2082 | /* DMIC fix | |
2083 | * This laptop has a stereo digital microphone. | |
2084 | * The mics are only 1cm apart which makes the stereo | |
2085 | * useless. However, either the mic or the ALC889 | |
2086 | * makes the signal become a difference/sum signal | |
2087 | * instead of standard stereo, which is annoying. | |
2088 | * So instead we flip this bit which makes the | |
2089 | * codec replicate the sum signal to both channels, | |
2090 | * turning it into a normal mono mic. | |
2091 | */ | |
2092 | /* DMIC_CONTROL? Init value = 0x0001 */ | |
2093 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, | |
2094 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 }, | |
2095 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2096 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | |
2097 | { } | |
038d4fef TI |
2098 | }, |
2099 | .chained = true, | |
2100 | .chain_id = ALC882_FIXUP_GPIO1, | |
c3e837bb | 2101 | }, |
5671087f | 2102 | [ALC885_FIXUP_MACPRO_GPIO] = { |
1727a771 | 2103 | .type = HDA_FIXUP_FUNC, |
5671087f TI |
2104 | .v.func = alc885_fixup_macpro_gpio, |
2105 | }, | |
02a237b2 | 2106 | [ALC889_FIXUP_DAC_ROUTE] = { |
1727a771 | 2107 | .type = HDA_FIXUP_FUNC, |
02a237b2 TI |
2108 | .v.func = alc889_fixup_dac_route, |
2109 | }, | |
1a97b7f2 | 2110 | [ALC889_FIXUP_MBP_VREF] = { |
1727a771 | 2111 | .type = HDA_FIXUP_FUNC, |
1a97b7f2 TI |
2112 | .v.func = alc889_fixup_mbp_vref, |
2113 | .chained = true, | |
2114 | .chain_id = ALC882_FIXUP_GPIO1, | |
2115 | }, | |
2116 | [ALC889_FIXUP_IMAC91_VREF] = { | |
1727a771 | 2117 | .type = HDA_FIXUP_FUNC, |
1a97b7f2 TI |
2118 | .v.func = alc889_fixup_imac91_vref, |
2119 | .chained = true, | |
2120 | .chain_id = ALC882_FIXUP_GPIO1, | |
2121 | }, | |
e7729a41 AV |
2122 | [ALC889_FIXUP_MBA11_VREF] = { |
2123 | .type = HDA_FIXUP_FUNC, | |
2124 | .v.func = alc889_fixup_mba11_vref, | |
2125 | .chained = true, | |
2126 | .chain_id = ALC889_FIXUP_MBP_VREF, | |
2127 | }, | |
0756f09c TI |
2128 | [ALC889_FIXUP_MBA21_VREF] = { |
2129 | .type = HDA_FIXUP_FUNC, | |
2130 | .v.func = alc889_fixup_mba21_vref, | |
2131 | .chained = true, | |
2132 | .chain_id = ALC889_FIXUP_MBP_VREF, | |
2133 | }, | |
c20f31ec TI |
2134 | [ALC889_FIXUP_MP11_VREF] = { |
2135 | .type = HDA_FIXUP_FUNC, | |
2136 | .v.func = alc889_fixup_mba11_vref, | |
2137 | .chained = true, | |
2138 | .chain_id = ALC885_FIXUP_MACPRO_GPIO, | |
2139 | }, | |
6e72aa5f | 2140 | [ALC882_FIXUP_INV_DMIC] = { |
1727a771 | 2141 | .type = HDA_FIXUP_FUNC, |
9d36a7dc | 2142 | .v.func = alc_fixup_inv_dmic, |
6e72aa5f | 2143 | }, |
e427c237 | 2144 | [ALC882_FIXUP_NO_PRIMARY_HP] = { |
1727a771 | 2145 | .type = HDA_FIXUP_FUNC, |
e427c237 TI |
2146 | .v.func = alc882_fixup_no_primary_hp, |
2147 | }, | |
1f0bbf03 TI |
2148 | [ALC887_FIXUP_ASUS_BASS] = { |
2149 | .type = HDA_FIXUP_PINS, | |
2150 | .v.pins = (const struct hda_pintbl[]) { | |
2151 | {0x16, 0x99130130}, /* bass speaker */ | |
2152 | {} | |
2153 | }, | |
eb9ca3ab TI |
2154 | .chained = true, |
2155 | .chain_id = ALC887_FIXUP_BASS_CHMAP, | |
2156 | }, | |
2157 | [ALC887_FIXUP_BASS_CHMAP] = { | |
2158 | .type = HDA_FIXUP_FUNC, | |
2159 | .v.func = alc_fixup_bass_chmap, | |
1f0bbf03 | 2160 | }, |
ff818c24 TI |
2161 | }; |
2162 | ||
1d045db9 | 2163 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
8812c4f9 TI |
2164 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD), |
2165 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), | |
2166 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD), | |
2167 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), | |
2168 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), | |
2169 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD), | |
c3e837bb TI |
2170 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
2171 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
2172 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | |
2173 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
2174 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | |
2175 | ALC882_FIXUP_ACER_ASPIRE_8930G), | |
2176 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | |
2177 | ALC882_FIXUP_ACER_ASPIRE_8930G), | |
2178 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | |
2179 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
2180 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | |
2181 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
2182 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | |
2183 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
5c0ebfbe | 2184 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), |
f5c53d89 TI |
2185 | SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G", |
2186 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
02a237b2 | 2187 | SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), |
fe97da1f | 2188 | SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G), |
ac9b1cdd | 2189 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), |
177943a3 | 2190 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), |
5c0ebfbe | 2191 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), |
68ef0561 | 2192 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), |
0e7cc2e7 | 2193 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), |
1f0bbf03 | 2194 | SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), |
ac9b1cdd | 2195 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), |
e427c237 | 2196 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), |
12e31a78 | 2197 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), |
5671087f TI |
2198 | |
2199 | /* All Apple entries are in codec SSIDs */ | |
1a97b7f2 TI |
2200 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), |
2201 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF), | |
2202 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), | |
c20f31ec | 2203 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF), |
5671087f TI |
2204 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), |
2205 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), | |
1a97b7f2 TI |
2206 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF), |
2207 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF), | |
5671087f | 2208 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), |
e7729a41 | 2209 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF), |
0756f09c | 2210 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF), |
1a97b7f2 TI |
2211 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF), |
2212 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), | |
5671087f | 2213 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), |
1a97b7f2 TI |
2214 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF), |
2215 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), | |
2216 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), | |
29ebe402 | 2217 | SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO), |
05193639 | 2218 | SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), |
1a97b7f2 TI |
2219 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), |
2220 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), | |
2221 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), | |
5671087f | 2222 | |
7a6069bf | 2223 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), |
bca40138 | 2224 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), |
eb844d51 | 2225 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), |
b2c53e20 | 2226 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), |
5c0ebfbe | 2227 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), |
7a6069bf TI |
2228 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), |
2229 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), | |
ac9b1cdd | 2230 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), |
68ef0561 | 2231 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF), |
ff818c24 TI |
2232 | {} |
2233 | }; | |
2234 | ||
1727a771 | 2235 | static const struct hda_model_fixup alc882_fixup_models[] = { |
912093bc TI |
2236 | {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"}, |
2237 | {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"}, | |
2238 | {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"}, | |
6e72aa5f | 2239 | {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
e427c237 | 2240 | {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"}, |
912093bc TI |
2241 | {} |
2242 | }; | |
2243 | ||
f6a92248 | 2244 | /* |
1d045db9 | 2245 | * BIOS auto configuration |
f6a92248 | 2246 | */ |
1d045db9 TI |
2247 | /* almost identical with ALC880 parser... */ |
2248 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
2249 | { | |
1d045db9 | 2250 | static const hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
2251 | static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
2252 | return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); | |
1d045db9 | 2253 | } |
b896b4eb | 2254 | |
1d045db9 TI |
2255 | /* |
2256 | */ | |
1d045db9 | 2257 | static int patch_alc882(struct hda_codec *codec) |
f6a92248 KY |
2258 | { |
2259 | struct alc_spec *spec; | |
1a97b7f2 | 2260 | int err; |
f6a92248 | 2261 | |
3de95173 TI |
2262 | err = alc_alloc_spec(codec, 0x0b); |
2263 | if (err < 0) | |
2264 | return err; | |
f6a92248 | 2265 | |
3de95173 | 2266 | spec = codec->spec; |
1f0f4b80 | 2267 | |
1d045db9 TI |
2268 | switch (codec->vendor_id) { |
2269 | case 0x10ec0882: | |
2270 | case 0x10ec0885: | |
acf08081 | 2271 | case 0x10ec0900: |
1d045db9 TI |
2272 | break; |
2273 | default: | |
2274 | /* ALC883 and variants */ | |
2275 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
2276 | break; | |
c793bec5 | 2277 | } |
977ddd6b | 2278 | |
1727a771 | 2279 | snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, |
912093bc | 2280 | alc882_fixups); |
1727a771 | 2281 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
ff818c24 | 2282 | |
1d045db9 TI |
2283 | alc_auto_parse_customize_define(codec); |
2284 | ||
7504b6cd TI |
2285 | if (has_cdefine_beep(codec)) |
2286 | spec->gen.beep_nid = 0x01; | |
2287 | ||
1a97b7f2 TI |
2288 | /* automatic parse from the BIOS config */ |
2289 | err = alc882_parse_auto_config(codec); | |
2290 | if (err < 0) | |
2291 | goto error; | |
f6a92248 | 2292 | |
7504b6cd | 2293 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
1d045db9 | 2294 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
f6a92248 KY |
2295 | |
2296 | codec->patch_ops = alc_patch_ops; | |
bf1b0225 | 2297 | |
1727a771 | 2298 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 2299 | |
f6a92248 | 2300 | return 0; |
e16fb6d1 TI |
2301 | |
2302 | error: | |
2303 | alc_free(codec); | |
2304 | return err; | |
f6a92248 KY |
2305 | } |
2306 | ||
df694daa | 2307 | |
df694daa | 2308 | /* |
1d045db9 | 2309 | * ALC262 support |
df694daa | 2310 | */ |
1d045db9 | 2311 | static int alc262_parse_auto_config(struct hda_codec *codec) |
df694daa | 2312 | { |
1d045db9 | 2313 | static const hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
2314 | static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
2315 | return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); | |
df694daa KY |
2316 | } |
2317 | ||
df694daa | 2318 | /* |
1d045db9 | 2319 | * Pin config fixes |
df694daa | 2320 | */ |
cfc9b06f | 2321 | enum { |
ea4e7af1 | 2322 | ALC262_FIXUP_FSC_H270, |
7513e6da | 2323 | ALC262_FIXUP_FSC_S7110, |
ea4e7af1 TI |
2324 | ALC262_FIXUP_HP_Z200, |
2325 | ALC262_FIXUP_TYAN, | |
c470150c | 2326 | ALC262_FIXUP_LENOVO_3000, |
b42590b8 TI |
2327 | ALC262_FIXUP_BENQ, |
2328 | ALC262_FIXUP_BENQ_T31, | |
6e72aa5f | 2329 | ALC262_FIXUP_INV_DMIC, |
b5c6611f | 2330 | ALC262_FIXUP_INTEL_BAYLEYBAY, |
cfc9b06f TI |
2331 | }; |
2332 | ||
1727a771 | 2333 | static const struct hda_fixup alc262_fixups[] = { |
ea4e7af1 | 2334 | [ALC262_FIXUP_FSC_H270] = { |
1727a771 TI |
2335 | .type = HDA_FIXUP_PINS, |
2336 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
2337 | { 0x14, 0x99130110 }, /* speaker */ |
2338 | { 0x15, 0x0221142f }, /* front HP */ | |
2339 | { 0x1b, 0x0121141f }, /* rear HP */ | |
2340 | { } | |
2341 | } | |
2342 | }, | |
7513e6da TI |
2343 | [ALC262_FIXUP_FSC_S7110] = { |
2344 | .type = HDA_FIXUP_PINS, | |
2345 | .v.pins = (const struct hda_pintbl[]) { | |
2346 | { 0x15, 0x90170110 }, /* speaker */ | |
2347 | { } | |
2348 | }, | |
2349 | .chained = true, | |
2350 | .chain_id = ALC262_FIXUP_BENQ, | |
2351 | }, | |
ea4e7af1 | 2352 | [ALC262_FIXUP_HP_Z200] = { |
1727a771 TI |
2353 | .type = HDA_FIXUP_PINS, |
2354 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 | 2355 | { 0x16, 0x99130120 }, /* internal speaker */ |
73413b12 TI |
2356 | { } |
2357 | } | |
cfc9b06f | 2358 | }, |
ea4e7af1 | 2359 | [ALC262_FIXUP_TYAN] = { |
1727a771 TI |
2360 | .type = HDA_FIXUP_PINS, |
2361 | .v.pins = (const struct hda_pintbl[]) { | |
ea4e7af1 TI |
2362 | { 0x14, 0x1993e1f0 }, /* int AUX */ |
2363 | { } | |
2364 | } | |
2365 | }, | |
c470150c | 2366 | [ALC262_FIXUP_LENOVO_3000] = { |
fd108215 TI |
2367 | .type = HDA_FIXUP_PINCTLS, |
2368 | .v.pins = (const struct hda_pintbl[]) { | |
2369 | { 0x19, PIN_VREF50 }, | |
b42590b8 TI |
2370 | {} |
2371 | }, | |
2372 | .chained = true, | |
2373 | .chain_id = ALC262_FIXUP_BENQ, | |
2374 | }, | |
2375 | [ALC262_FIXUP_BENQ] = { | |
1727a771 | 2376 | .type = HDA_FIXUP_VERBS, |
b42590b8 | 2377 | .v.verbs = (const struct hda_verb[]) { |
c470150c TI |
2378 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
2379 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, | |
2380 | {} | |
2381 | } | |
2382 | }, | |
b42590b8 | 2383 | [ALC262_FIXUP_BENQ_T31] = { |
1727a771 | 2384 | .type = HDA_FIXUP_VERBS, |
b42590b8 TI |
2385 | .v.verbs = (const struct hda_verb[]) { |
2386 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2387 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | |
2388 | {} | |
2389 | } | |
2390 | }, | |
6e72aa5f | 2391 | [ALC262_FIXUP_INV_DMIC] = { |
1727a771 | 2392 | .type = HDA_FIXUP_FUNC, |
9d36a7dc | 2393 | .v.func = alc_fixup_inv_dmic, |
6e72aa5f | 2394 | }, |
b5c6611f ML |
2395 | [ALC262_FIXUP_INTEL_BAYLEYBAY] = { |
2396 | .type = HDA_FIXUP_FUNC, | |
2397 | .v.func = alc_fixup_no_depop_delay, | |
2398 | }, | |
cfc9b06f TI |
2399 | }; |
2400 | ||
1d045db9 | 2401 | static const struct snd_pci_quirk alc262_fixup_tbl[] = { |
ea4e7af1 | 2402 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200), |
7513e6da | 2403 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110), |
3dcd3be3 | 2404 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ), |
ea4e7af1 TI |
2405 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), |
2406 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), | |
c470150c | 2407 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), |
b42590b8 TI |
2408 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), |
2409 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31), | |
b5c6611f | 2410 | SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY), |
cfc9b06f TI |
2411 | {} |
2412 | }; | |
df694daa | 2413 | |
1727a771 | 2414 | static const struct hda_model_fixup alc262_fixup_models[] = { |
6e72aa5f TI |
2415 | {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
2416 | {} | |
2417 | }; | |
1d045db9 | 2418 | |
1d045db9 TI |
2419 | /* |
2420 | */ | |
1d045db9 | 2421 | static int patch_alc262(struct hda_codec *codec) |
df694daa KY |
2422 | { |
2423 | struct alc_spec *spec; | |
df694daa KY |
2424 | int err; |
2425 | ||
3de95173 TI |
2426 | err = alc_alloc_spec(codec, 0x0b); |
2427 | if (err < 0) | |
2428 | return err; | |
df694daa | 2429 | |
3de95173 | 2430 | spec = codec->spec; |
08c189f2 | 2431 | spec->gen.shared_mic_vref_pin = 0x18; |
1d045db9 TI |
2432 | |
2433 | #if 0 | |
2434 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is | |
2435 | * under-run | |
2436 | */ | |
98b24883 | 2437 | alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); |
1d045db9 | 2438 | #endif |
1d045db9 TI |
2439 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
2440 | ||
1727a771 | 2441 | snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, |
6e72aa5f | 2442 | alc262_fixups); |
1727a771 | 2443 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
9c7f852e | 2444 | |
af741c15 TI |
2445 | alc_auto_parse_customize_define(codec); |
2446 | ||
7504b6cd TI |
2447 | if (has_cdefine_beep(codec)) |
2448 | spec->gen.beep_nid = 0x01; | |
2449 | ||
42399f7a TI |
2450 | /* automatic parse from the BIOS config */ |
2451 | err = alc262_parse_auto_config(codec); | |
2452 | if (err < 0) | |
2453 | goto error; | |
df694daa | 2454 | |
7504b6cd | 2455 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
1d045db9 | 2456 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
2134ea4f | 2457 | |
df694daa | 2458 | codec->patch_ops = alc_patch_ops; |
1d045db9 TI |
2459 | spec->shutup = alc_eapd_shutup; |
2460 | ||
1727a771 | 2461 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 2462 | |
1da177e4 | 2463 | return 0; |
e16fb6d1 TI |
2464 | |
2465 | error: | |
2466 | alc_free(codec); | |
2467 | return err; | |
1da177e4 LT |
2468 | } |
2469 | ||
f32610ed | 2470 | /* |
1d045db9 | 2471 | * ALC268 |
f32610ed | 2472 | */ |
1d045db9 TI |
2473 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
2474 | static const struct hda_bind_ctls alc268_bind_beep_sw = { | |
2475 | .ops = &snd_hda_bind_sw, | |
2476 | .values = { | |
2477 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
2478 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
2479 | 0 | |
2480 | }, | |
f32610ed JS |
2481 | }; |
2482 | ||
1d045db9 TI |
2483 | static const struct snd_kcontrol_new alc268_beep_mixer[] = { |
2484 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
2485 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
2486 | { } | |
f32610ed JS |
2487 | }; |
2488 | ||
1d045db9 TI |
2489 | /* set PCBEEP vol = 0, mute connections */ |
2490 | static const struct hda_verb alc268_beep_init_verbs[] = { | |
2491 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2492 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2493 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2494 | { } | |
f32610ed JS |
2495 | }; |
2496 | ||
6e72aa5f TI |
2497 | enum { |
2498 | ALC268_FIXUP_INV_DMIC, | |
cb766404 | 2499 | ALC268_FIXUP_HP_EAPD, |
24eff328 | 2500 | ALC268_FIXUP_SPDIF, |
6e72aa5f TI |
2501 | }; |
2502 | ||
1727a771 | 2503 | static const struct hda_fixup alc268_fixups[] = { |
6e72aa5f | 2504 | [ALC268_FIXUP_INV_DMIC] = { |
1727a771 | 2505 | .type = HDA_FIXUP_FUNC, |
9d36a7dc | 2506 | .v.func = alc_fixup_inv_dmic, |
6e72aa5f | 2507 | }, |
cb766404 | 2508 | [ALC268_FIXUP_HP_EAPD] = { |
1727a771 | 2509 | .type = HDA_FIXUP_VERBS, |
cb766404 TI |
2510 | .v.verbs = (const struct hda_verb[]) { |
2511 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0}, | |
2512 | {} | |
2513 | } | |
2514 | }, | |
24eff328 TI |
2515 | [ALC268_FIXUP_SPDIF] = { |
2516 | .type = HDA_FIXUP_PINS, | |
2517 | .v.pins = (const struct hda_pintbl[]) { | |
2518 | { 0x1e, 0x014b1180 }, /* enable SPDIF out */ | |
2519 | {} | |
2520 | } | |
2521 | }, | |
6e72aa5f TI |
2522 | }; |
2523 | ||
1727a771 | 2524 | static const struct hda_model_fixup alc268_fixup_models[] = { |
6e72aa5f | 2525 | {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
cb766404 TI |
2526 | {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"}, |
2527 | {} | |
2528 | }; | |
2529 | ||
2530 | static const struct snd_pci_quirk alc268_fixup_tbl[] = { | |
24eff328 | 2531 | SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF), |
fcd8f3b1 | 2532 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC), |
cb766404 TI |
2533 | /* below is codec SSID since multiple Toshiba laptops have the |
2534 | * same PCI SSID 1179:ff00 | |
2535 | */ | |
2536 | SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD), | |
6e72aa5f TI |
2537 | {} |
2538 | }; | |
2539 | ||
f32610ed JS |
2540 | /* |
2541 | * BIOS auto configuration | |
2542 | */ | |
1d045db9 | 2543 | static int alc268_parse_auto_config(struct hda_codec *codec) |
f32610ed | 2544 | { |
3e6179b8 | 2545 | static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
7504b6cd | 2546 | return alc_parse_auto_config(codec, NULL, alc268_ssids); |
f32610ed JS |
2547 | } |
2548 | ||
1d045db9 TI |
2549 | /* |
2550 | */ | |
1d045db9 | 2551 | static int patch_alc268(struct hda_codec *codec) |
f32610ed JS |
2552 | { |
2553 | struct alc_spec *spec; | |
7504b6cd | 2554 | int err; |
f32610ed | 2555 | |
1d045db9 | 2556 | /* ALC268 has no aa-loopback mixer */ |
3de95173 TI |
2557 | err = alc_alloc_spec(codec, 0); |
2558 | if (err < 0) | |
2559 | return err; | |
2560 | ||
2561 | spec = codec->spec; | |
7504b6cd | 2562 | spec->gen.beep_nid = 0x01; |
1f0f4b80 | 2563 | |
1727a771 TI |
2564 | snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); |
2565 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | |
6e72aa5f | 2566 | |
6ebb8053 TI |
2567 | /* automatic parse from the BIOS config */ |
2568 | err = alc268_parse_auto_config(codec); | |
e16fb6d1 TI |
2569 | if (err < 0) |
2570 | goto error; | |
f32610ed | 2571 | |
7504b6cd TI |
2572 | if (err > 0 && !spec->gen.no_analog && |
2573 | spec->gen.autocfg.speaker_pins[0] != 0x1d) { | |
2574 | add_mixer(spec, alc268_beep_mixer); | |
2575 | snd_hda_add_verbs(codec, alc268_beep_init_verbs); | |
1d045db9 TI |
2576 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
2577 | /* override the amp caps for beep generator */ | |
2578 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
2579 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | |
2580 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
2581 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
2582 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
2f893286 KY |
2583 | } |
2584 | ||
f32610ed | 2585 | codec->patch_ops = alc_patch_ops; |
1c716153 | 2586 | spec->shutup = alc_eapd_shutup; |
1d045db9 | 2587 | |
1727a771 | 2588 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
6e72aa5f | 2589 | |
f32610ed | 2590 | return 0; |
e16fb6d1 TI |
2591 | |
2592 | error: | |
2593 | alc_free(codec); | |
2594 | return err; | |
f32610ed JS |
2595 | } |
2596 | ||
bc9f98a9 | 2597 | /* |
1d045db9 | 2598 | * ALC269 |
bc9f98a9 | 2599 | */ |
08c189f2 TI |
2600 | |
2601 | static int playback_pcm_open(struct hda_pcm_stream *hinfo, | |
2602 | struct hda_codec *codec, | |
2603 | struct snd_pcm_substream *substream) | |
2604 | { | |
2605 | struct hda_gen_spec *spec = codec->spec; | |
2606 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | |
2607 | hinfo); | |
2608 | } | |
2609 | ||
2610 | static int playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
2611 | struct hda_codec *codec, | |
2612 | unsigned int stream_tag, | |
2613 | unsigned int format, | |
2614 | struct snd_pcm_substream *substream) | |
2615 | { | |
2616 | struct hda_gen_spec *spec = codec->spec; | |
2617 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, | |
2618 | stream_tag, format, substream); | |
2619 | } | |
2620 | ||
2621 | static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
2622 | struct hda_codec *codec, | |
2623 | struct snd_pcm_substream *substream) | |
2624 | { | |
2625 | struct hda_gen_spec *spec = codec->spec; | |
2626 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
2627 | } | |
2628 | ||
1d045db9 TI |
2629 | static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
2630 | .substreams = 1, | |
2631 | .channels_min = 2, | |
2632 | .channels_max = 8, | |
2633 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
2634 | /* NID is set in alc_build_pcms */ | |
2635 | .ops = { | |
08c189f2 TI |
2636 | .open = playback_pcm_open, |
2637 | .prepare = playback_pcm_prepare, | |
2638 | .cleanup = playback_pcm_cleanup | |
bc9f98a9 KY |
2639 | }, |
2640 | }; | |
2641 | ||
1d045db9 TI |
2642 | static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
2643 | .substreams = 1, | |
2644 | .channels_min = 2, | |
2645 | .channels_max = 2, | |
2646 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
2647 | /* NID is set in alc_build_pcms */ | |
bc9f98a9 | 2648 | }; |
291702f0 | 2649 | |
1d045db9 TI |
2650 | /* different alc269-variants */ |
2651 | enum { | |
2652 | ALC269_TYPE_ALC269VA, | |
2653 | ALC269_TYPE_ALC269VB, | |
2654 | ALC269_TYPE_ALC269VC, | |
adcc70b2 | 2655 | ALC269_TYPE_ALC269VD, |
065380f0 KY |
2656 | ALC269_TYPE_ALC280, |
2657 | ALC269_TYPE_ALC282, | |
2af02be7 | 2658 | ALC269_TYPE_ALC283, |
065380f0 | 2659 | ALC269_TYPE_ALC284, |
161ebf29 | 2660 | ALC269_TYPE_ALC285, |
7fc7d047 | 2661 | ALC269_TYPE_ALC286, |
1d04c9de | 2662 | ALC269_TYPE_ALC255, |
bc9f98a9 KY |
2663 | }; |
2664 | ||
2665 | /* | |
1d045db9 | 2666 | * BIOS auto configuration |
bc9f98a9 | 2667 | */ |
1d045db9 TI |
2668 | static int alc269_parse_auto_config(struct hda_codec *codec) |
2669 | { | |
1d045db9 | 2670 | static const hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
2671 | static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 }; |
2672 | static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 }; | |
2673 | struct alc_spec *spec = codec->spec; | |
adcc70b2 KY |
2674 | const hda_nid_t *ssids; |
2675 | ||
2676 | switch (spec->codec_variant) { | |
2677 | case ALC269_TYPE_ALC269VA: | |
2678 | case ALC269_TYPE_ALC269VC: | |
065380f0 KY |
2679 | case ALC269_TYPE_ALC280: |
2680 | case ALC269_TYPE_ALC284: | |
161ebf29 | 2681 | case ALC269_TYPE_ALC285: |
adcc70b2 KY |
2682 | ssids = alc269va_ssids; |
2683 | break; | |
2684 | case ALC269_TYPE_ALC269VB: | |
2685 | case ALC269_TYPE_ALC269VD: | |
065380f0 | 2686 | case ALC269_TYPE_ALC282: |
2af02be7 | 2687 | case ALC269_TYPE_ALC283: |
7fc7d047 | 2688 | case ALC269_TYPE_ALC286: |
1d04c9de | 2689 | case ALC269_TYPE_ALC255: |
adcc70b2 KY |
2690 | ssids = alc269_ssids; |
2691 | break; | |
2692 | default: | |
2693 | ssids = alc269_ssids; | |
2694 | break; | |
2695 | } | |
bc9f98a9 | 2696 | |
3e6179b8 | 2697 | return alc_parse_auto_config(codec, alc269_ignore, ssids); |
1d045db9 | 2698 | } |
bc9f98a9 | 2699 | |
f7ae9ba0 KY |
2700 | static int find_ext_mic_pin(struct hda_codec *codec); |
2701 | ||
2702 | static void alc286_shutup(struct hda_codec *codec) | |
2703 | { | |
2704 | int i; | |
2705 | int mic_pin = find_ext_mic_pin(codec); | |
2706 | /* don't shut up pins when unloading the driver; otherwise it breaks | |
2707 | * the default pin setup at the next load of the driver | |
2708 | */ | |
2709 | if (codec->bus->shutdown) | |
2710 | return; | |
2711 | for (i = 0; i < codec->init_pins.used; i++) { | |
2712 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); | |
2713 | /* use read here for syncing after issuing each verb */ | |
2714 | if (pin->nid != mic_pin) | |
2715 | snd_hda_codec_read(codec, pin->nid, 0, | |
2716 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
2717 | } | |
2718 | codec->pins_shutup = 1; | |
2719 | } | |
2720 | ||
1387e2d1 | 2721 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) |
1d045db9 | 2722 | { |
98b24883 | 2723 | alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); |
1d045db9 | 2724 | } |
291702f0 | 2725 | |
1d045db9 TI |
2726 | static void alc269_shutup(struct hda_codec *codec) |
2727 | { | |
adcc70b2 KY |
2728 | struct alc_spec *spec = codec->spec; |
2729 | ||
1387e2d1 KY |
2730 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
2731 | alc269vb_toggle_power_output(codec, 0); | |
2732 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && | |
2733 | (alc_get_coef0(codec) & 0x00ff) == 0x018) { | |
1d045db9 TI |
2734 | msleep(150); |
2735 | } | |
9bfb2844 | 2736 | snd_hda_shutup_pins(codec); |
1d045db9 | 2737 | } |
291702f0 | 2738 | |
54db6c39 TI |
2739 | static struct coef_fw alc282_coefs[] = { |
2740 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ | |
32fa7e49 | 2741 | UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ |
54db6c39 TI |
2742 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ |
2743 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ | |
2744 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ | |
2745 | WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */ | |
2746 | WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */ | |
2747 | WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */ | |
2748 | UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */ | |
2749 | UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */ | |
2750 | WRITE_COEF(0x6f, 0x0), /* Class D test 4 */ | |
2751 | UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */ | |
2752 | WRITE_COEF(0x34, 0xa0c0), /* ANC */ | |
2753 | UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */ | |
2754 | UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */ | |
2755 | UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */ | |
2756 | WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */ | |
2757 | WRITE_COEF(0x63, 0x2902), /* PLL */ | |
2758 | WRITE_COEF(0x68, 0xa080), /* capless control 2 */ | |
2759 | WRITE_COEF(0x69, 0x3400), /* capless control 3 */ | |
2760 | WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */ | |
2761 | WRITE_COEF(0x6b, 0x0), /* capless control 5 */ | |
2762 | UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */ | |
2763 | WRITE_COEF(0x6e, 0x110a), /* class D test 3 */ | |
2764 | UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */ | |
2765 | WRITE_COEF(0x71, 0x0014), /* class D test 6 */ | |
2766 | WRITE_COEF(0x72, 0xc2ba), /* classD OCP */ | |
2767 | UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */ | |
2768 | WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */ | |
2769 | {} | |
2770 | }; | |
2771 | ||
cb149cb3 KY |
2772 | static void alc282_restore_default_value(struct hda_codec *codec) |
2773 | { | |
54db6c39 | 2774 | alc_process_coef_fw(codec, alc282_coefs); |
cb149cb3 KY |
2775 | } |
2776 | ||
7b5c7a02 KY |
2777 | static void alc282_init(struct hda_codec *codec) |
2778 | { | |
2779 | struct alc_spec *spec = codec->spec; | |
2780 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
2781 | bool hp_pin_sense; | |
2782 | int coef78; | |
2783 | ||
cb149cb3 KY |
2784 | alc282_restore_default_value(codec); |
2785 | ||
7b5c7a02 KY |
2786 | if (!hp_pin) |
2787 | return; | |
2788 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | |
2789 | coef78 = alc_read_coef_idx(codec, 0x78); | |
2790 | ||
2791 | /* Index 0x78 Direct Drive HP AMP LPM Control 1 */ | |
2792 | /* Headphone capless set to high power mode */ | |
2793 | alc_write_coef_idx(codec, 0x78, 0x9004); | |
2794 | ||
2795 | if (hp_pin_sense) | |
2796 | msleep(2); | |
2797 | ||
2798 | snd_hda_codec_write(codec, hp_pin, 0, | |
2799 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | |
2800 | ||
2801 | if (hp_pin_sense) | |
2802 | msleep(85); | |
2803 | ||
2804 | snd_hda_codec_write(codec, hp_pin, 0, | |
2805 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
2806 | ||
2807 | if (hp_pin_sense) | |
2808 | msleep(100); | |
2809 | ||
2810 | /* Headphone capless set to normal mode */ | |
2811 | alc_write_coef_idx(codec, 0x78, coef78); | |
2812 | } | |
2813 | ||
2814 | static void alc282_shutup(struct hda_codec *codec) | |
2815 | { | |
2816 | struct alc_spec *spec = codec->spec; | |
2817 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
2818 | bool hp_pin_sense; | |
2819 | int coef78; | |
2820 | ||
2821 | if (!hp_pin) { | |
2822 | alc269_shutup(codec); | |
2823 | return; | |
2824 | } | |
2825 | ||
2826 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | |
2827 | coef78 = alc_read_coef_idx(codec, 0x78); | |
2828 | alc_write_coef_idx(codec, 0x78, 0x9004); | |
2829 | ||
2830 | if (hp_pin_sense) | |
2831 | msleep(2); | |
2832 | ||
2833 | snd_hda_codec_write(codec, hp_pin, 0, | |
2834 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | |
2835 | ||
2836 | if (hp_pin_sense) | |
2837 | msleep(85); | |
2838 | ||
2839 | snd_hda_codec_write(codec, hp_pin, 0, | |
2840 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | |
2841 | ||
2842 | if (hp_pin_sense) | |
2843 | msleep(100); | |
2844 | ||
2845 | alc_auto_setup_eapd(codec, false); | |
2846 | snd_hda_shutup_pins(codec); | |
2847 | alc_write_coef_idx(codec, 0x78, coef78); | |
2848 | } | |
2849 | ||
54db6c39 TI |
2850 | static struct coef_fw alc283_coefs[] = { |
2851 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ | |
56779864 | 2852 | UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ |
54db6c39 TI |
2853 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ |
2854 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ | |
2855 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ | |
2856 | WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */ | |
2857 | WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */ | |
2858 | WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */ | |
2859 | UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */ | |
2860 | UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */ | |
2861 | WRITE_COEF(0x3a, 0x0), /* Class D test 4 */ | |
2862 | UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */ | |
2863 | WRITE_COEF(0x22, 0xa0c0), /* ANC */ | |
2864 | UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */ | |
2865 | UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */ | |
2866 | UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */ | |
2867 | WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */ | |
2868 | WRITE_COEF(0x2e, 0x2902), /* PLL */ | |
2869 | WRITE_COEF(0x33, 0xa080), /* capless control 2 */ | |
2870 | WRITE_COEF(0x34, 0x3400), /* capless control 3 */ | |
2871 | WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */ | |
2872 | WRITE_COEF(0x36, 0x0), /* capless control 5 */ | |
2873 | UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */ | |
2874 | WRITE_COEF(0x39, 0x110a), /* class D test 3 */ | |
2875 | UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */ | |
2876 | WRITE_COEF(0x3c, 0x0014), /* class D test 6 */ | |
2877 | WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */ | |
2878 | UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */ | |
2879 | WRITE_COEF(0x49, 0x0), /* test mode */ | |
2880 | UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */ | |
2881 | UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */ | |
2882 | WRITE_COEF(0x37, 0xfc06), /* Class D amp control */ | |
56779864 | 2883 | UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */ |
54db6c39 TI |
2884 | {} |
2885 | }; | |
2886 | ||
6bd55b04 KY |
2887 | static void alc283_restore_default_value(struct hda_codec *codec) |
2888 | { | |
54db6c39 | 2889 | alc_process_coef_fw(codec, alc283_coefs); |
6bd55b04 KY |
2890 | } |
2891 | ||
2af02be7 KY |
2892 | static void alc283_init(struct hda_codec *codec) |
2893 | { | |
2894 | struct alc_spec *spec = codec->spec; | |
2895 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
2896 | bool hp_pin_sense; | |
2af02be7 | 2897 | |
8314f225 KY |
2898 | if (!spec->gen.autocfg.hp_outs) { |
2899 | if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) | |
2900 | hp_pin = spec->gen.autocfg.line_out_pins[0]; | |
2901 | } | |
2902 | ||
6bd55b04 KY |
2903 | alc283_restore_default_value(codec); |
2904 | ||
2af02be7 KY |
2905 | if (!hp_pin) |
2906 | return; | |
2907 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | |
2908 | ||
2909 | /* Index 0x43 Direct Drive HP AMP LPM Control 1 */ | |
2910 | /* Headphone capless set to high power mode */ | |
2911 | alc_write_coef_idx(codec, 0x43, 0x9004); | |
2912 | ||
2913 | snd_hda_codec_write(codec, hp_pin, 0, | |
2914 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | |
2915 | ||
2916 | if (hp_pin_sense) | |
2917 | msleep(85); | |
2918 | ||
2919 | snd_hda_codec_write(codec, hp_pin, 0, | |
2920 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
2921 | ||
2922 | if (hp_pin_sense) | |
2923 | msleep(85); | |
2924 | /* Index 0x46 Combo jack auto switch control 2 */ | |
2925 | /* 3k pull low control for Headset jack. */ | |
98b24883 | 2926 | alc_update_coef_idx(codec, 0x46, 3 << 12, 0); |
2af02be7 KY |
2927 | /* Headphone capless set to normal mode */ |
2928 | alc_write_coef_idx(codec, 0x43, 0x9614); | |
2929 | } | |
2930 | ||
2931 | static void alc283_shutup(struct hda_codec *codec) | |
2932 | { | |
2933 | struct alc_spec *spec = codec->spec; | |
2934 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
2935 | bool hp_pin_sense; | |
2af02be7 | 2936 | |
8314f225 KY |
2937 | if (!spec->gen.autocfg.hp_outs) { |
2938 | if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) | |
2939 | hp_pin = spec->gen.autocfg.line_out_pins[0]; | |
2940 | } | |
2941 | ||
2af02be7 KY |
2942 | if (!hp_pin) { |
2943 | alc269_shutup(codec); | |
2944 | return; | |
2945 | } | |
2946 | ||
2947 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | |
2948 | ||
2949 | alc_write_coef_idx(codec, 0x43, 0x9004); | |
2950 | ||
b450b17c HP |
2951 | /*depop hp during suspend*/ |
2952 | alc_write_coef_idx(codec, 0x06, 0x2100); | |
2953 | ||
2af02be7 KY |
2954 | snd_hda_codec_write(codec, hp_pin, 0, |
2955 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | |
2956 | ||
2957 | if (hp_pin_sense) | |
88011c09 | 2958 | msleep(100); |
2af02be7 KY |
2959 | |
2960 | snd_hda_codec_write(codec, hp_pin, 0, | |
2961 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | |
2962 | ||
98b24883 | 2963 | alc_update_coef_idx(codec, 0x46, 0, 3 << 12); |
2af02be7 KY |
2964 | |
2965 | if (hp_pin_sense) | |
88011c09 | 2966 | msleep(100); |
0435b3ff | 2967 | alc_auto_setup_eapd(codec, false); |
2af02be7 KY |
2968 | snd_hda_shutup_pins(codec); |
2969 | alc_write_coef_idx(codec, 0x43, 0x9614); | |
2970 | } | |
2971 | ||
ad60d502 KY |
2972 | static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, |
2973 | unsigned int val) | |
2974 | { | |
2975 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); | |
2976 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ | |
2977 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ | |
2978 | } | |
2979 | ||
2980 | static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) | |
2981 | { | |
2982 | unsigned int val; | |
2983 | ||
2984 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); | |
2985 | val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) | |
2986 | & 0xffff; | |
2987 | val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) | |
2988 | << 16; | |
2989 | return val; | |
2990 | } | |
2991 | ||
2992 | static void alc5505_dsp_halt(struct hda_codec *codec) | |
2993 | { | |
2994 | unsigned int val; | |
2995 | ||
2996 | alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ | |
2997 | alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ | |
2998 | alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ | |
2999 | alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ | |
3000 | alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ | |
3001 | alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ | |
3002 | alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ | |
3003 | val = alc5505_coef_get(codec, 0x6220); | |
3004 | alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ | |
3005 | } | |
3006 | ||
3007 | static void alc5505_dsp_back_from_halt(struct hda_codec *codec) | |
3008 | { | |
3009 | alc5505_coef_set(codec, 0x61b8, 0x04133302); | |
3010 | alc5505_coef_set(codec, 0x61b0, 0x00005b16); | |
3011 | alc5505_coef_set(codec, 0x61b4, 0x040a2b02); | |
3012 | alc5505_coef_set(codec, 0x6230, 0xf80d4011); | |
3013 | alc5505_coef_set(codec, 0x6220, 0x2002010f); | |
3014 | alc5505_coef_set(codec, 0x880c, 0x00000004); | |
3015 | } | |
3016 | ||
3017 | static void alc5505_dsp_init(struct hda_codec *codec) | |
3018 | { | |
3019 | unsigned int val; | |
3020 | ||
3021 | alc5505_dsp_halt(codec); | |
3022 | alc5505_dsp_back_from_halt(codec); | |
3023 | alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ | |
3024 | alc5505_coef_set(codec, 0x61b0, 0x5b16); | |
3025 | alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ | |
3026 | alc5505_coef_set(codec, 0x61b4, 0x04132b02); | |
3027 | alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ | |
3028 | alc5505_coef_set(codec, 0x61b8, 0x041f3302); | |
3029 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ | |
3030 | alc5505_coef_set(codec, 0x61b8, 0x041b3302); | |
3031 | alc5505_coef_set(codec, 0x61b8, 0x04173302); | |
3032 | alc5505_coef_set(codec, 0x61b8, 0x04163302); | |
3033 | alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ | |
3034 | alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ | |
3035 | alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ | |
3036 | ||
3037 | val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ | |
3038 | if (val <= 3) | |
3039 | alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ | |
3040 | else | |
3041 | alc5505_coef_set(codec, 0x6220, 0x6002018f); | |
3042 | ||
3043 | alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ | |
3044 | alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ | |
3045 | alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ | |
3046 | alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ | |
3047 | alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ | |
3048 | alc5505_coef_set(codec, 0x880c, 0x00000003); | |
3049 | alc5505_coef_set(codec, 0x880c, 0x00000010); | |
cd63a5ff TI |
3050 | |
3051 | #ifdef HALT_REALTEK_ALC5505 | |
3052 | alc5505_dsp_halt(codec); | |
3053 | #endif | |
ad60d502 KY |
3054 | } |
3055 | ||
cd63a5ff TI |
3056 | #ifdef HALT_REALTEK_ALC5505 |
3057 | #define alc5505_dsp_suspend(codec) /* NOP */ | |
3058 | #define alc5505_dsp_resume(codec) /* NOP */ | |
3059 | #else | |
3060 | #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) | |
3061 | #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) | |
3062 | #endif | |
3063 | ||
2a43952a | 3064 | #ifdef CONFIG_PM |
ad60d502 KY |
3065 | static int alc269_suspend(struct hda_codec *codec) |
3066 | { | |
3067 | struct alc_spec *spec = codec->spec; | |
3068 | ||
3069 | if (spec->has_alc5505_dsp) | |
cd63a5ff | 3070 | alc5505_dsp_suspend(codec); |
ad60d502 KY |
3071 | return alc_suspend(codec); |
3072 | } | |
3073 | ||
1d045db9 TI |
3074 | static int alc269_resume(struct hda_codec *codec) |
3075 | { | |
adcc70b2 KY |
3076 | struct alc_spec *spec = codec->spec; |
3077 | ||
1387e2d1 KY |
3078 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
3079 | alc269vb_toggle_power_output(codec, 0); | |
3080 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && | |
adcc70b2 | 3081 | (alc_get_coef0(codec) & 0x00ff) == 0x018) { |
1d045db9 TI |
3082 | msleep(150); |
3083 | } | |
8c427226 | 3084 | |
1d045db9 | 3085 | codec->patch_ops.init(codec); |
f1d4e28b | 3086 | |
1387e2d1 KY |
3087 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
3088 | alc269vb_toggle_power_output(codec, 1); | |
3089 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && | |
adcc70b2 | 3090 | (alc_get_coef0(codec) & 0x00ff) == 0x017) { |
1d045db9 TI |
3091 | msleep(200); |
3092 | } | |
f1d4e28b | 3093 | |
1d045db9 TI |
3094 | snd_hda_codec_resume_amp(codec); |
3095 | snd_hda_codec_resume_cache(codec); | |
3096 | hda_call_check_power_status(codec, 0x01); | |
f475371a HW |
3097 | |
3098 | /* on some machine, the BIOS will clear the codec gpio data when enter | |
3099 | * suspend, and won't restore the data after resume, so we restore it | |
3100 | * in the driver. | |
3101 | */ | |
3102 | if (spec->gpio_led) | |
3103 | snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA, | |
3104 | spec->gpio_led); | |
3105 | ||
ad60d502 | 3106 | if (spec->has_alc5505_dsp) |
cd63a5ff | 3107 | alc5505_dsp_resume(codec); |
c5177c86 | 3108 | |
1d045db9 TI |
3109 | return 0; |
3110 | } | |
2a43952a | 3111 | #endif /* CONFIG_PM */ |
f1d4e28b | 3112 | |
108cc108 | 3113 | static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, |
1727a771 | 3114 | const struct hda_fixup *fix, int action) |
108cc108 DH |
3115 | { |
3116 | struct alc_spec *spec = codec->spec; | |
3117 | ||
1727a771 | 3118 | if (action == HDA_FIXUP_ACT_PRE_PROBE) |
108cc108 DH |
3119 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; |
3120 | } | |
3121 | ||
1d045db9 | 3122 | static void alc269_fixup_hweq(struct hda_codec *codec, |
1727a771 | 3123 | const struct hda_fixup *fix, int action) |
1d045db9 | 3124 | { |
98b24883 TI |
3125 | if (action == HDA_FIXUP_ACT_INIT) |
3126 | alc_update_coef_idx(codec, 0x1e, 0, 0x80); | |
1d045db9 | 3127 | } |
f1d4e28b | 3128 | |
7c478f03 DH |
3129 | static void alc269_fixup_headset_mic(struct hda_codec *codec, |
3130 | const struct hda_fixup *fix, int action) | |
3131 | { | |
3132 | struct alc_spec *spec = codec->spec; | |
3133 | ||
3134 | if (action == HDA_FIXUP_ACT_PRE_PROBE) | |
3135 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | |
3136 | } | |
3137 | ||
1d045db9 | 3138 | static void alc271_fixup_dmic(struct hda_codec *codec, |
1727a771 | 3139 | const struct hda_fixup *fix, int action) |
1d045db9 TI |
3140 | { |
3141 | static const struct hda_verb verbs[] = { | |
3142 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | |
3143 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | |
3144 | {} | |
3145 | }; | |
3146 | unsigned int cfg; | |
f1d4e28b | 3147 | |
42397004 DR |
3148 | if (strcmp(codec->chip_name, "ALC271X") && |
3149 | strcmp(codec->chip_name, "ALC269VB")) | |
1d045db9 TI |
3150 | return; |
3151 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); | |
3152 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) | |
3153 | snd_hda_sequence_write(codec, verbs); | |
3154 | } | |
f1d4e28b | 3155 | |
017f2a10 | 3156 | static void alc269_fixup_pcm_44k(struct hda_codec *codec, |
1727a771 | 3157 | const struct hda_fixup *fix, int action) |
017f2a10 TI |
3158 | { |
3159 | struct alc_spec *spec = codec->spec; | |
3160 | ||
1727a771 | 3161 | if (action != HDA_FIXUP_ACT_PROBE) |
017f2a10 TI |
3162 | return; |
3163 | ||
3164 | /* Due to a hardware problem on Lenovo Ideadpad, we need to | |
3165 | * fix the sample rate of analog I/O to 44.1kHz | |
3166 | */ | |
08c189f2 TI |
3167 | spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback; |
3168 | spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture; | |
017f2a10 TI |
3169 | } |
3170 | ||
adabb3ec | 3171 | static void alc269_fixup_stereo_dmic(struct hda_codec *codec, |
1727a771 | 3172 | const struct hda_fixup *fix, int action) |
adabb3ec | 3173 | { |
adabb3ec TI |
3174 | /* The digital-mic unit sends PDM (differential signal) instead of |
3175 | * the standard PCM, thus you can't record a valid mono stream as is. | |
3176 | * Below is a workaround specific to ALC269 to control the dmic | |
3177 | * signal source as mono. | |
3178 | */ | |
98b24883 TI |
3179 | if (action == HDA_FIXUP_ACT_INIT) |
3180 | alc_update_coef_idx(codec, 0x07, 0, 0x80); | |
adabb3ec TI |
3181 | } |
3182 | ||
24519911 TI |
3183 | static void alc269_quanta_automute(struct hda_codec *codec) |
3184 | { | |
08c189f2 | 3185 | snd_hda_gen_update_outputs(codec); |
24519911 | 3186 | |
1687ccc8 TI |
3187 | alc_write_coef_idx(codec, 0x0c, 0x680); |
3188 | alc_write_coef_idx(codec, 0x0c, 0x480); | |
24519911 TI |
3189 | } |
3190 | ||
3191 | static void alc269_fixup_quanta_mute(struct hda_codec *codec, | |
1727a771 | 3192 | const struct hda_fixup *fix, int action) |
24519911 TI |
3193 | { |
3194 | struct alc_spec *spec = codec->spec; | |
1727a771 | 3195 | if (action != HDA_FIXUP_ACT_PROBE) |
24519911 | 3196 | return; |
08c189f2 | 3197 | spec->gen.automute_hook = alc269_quanta_automute; |
24519911 TI |
3198 | } |
3199 | ||
d240d1dc | 3200 | static void alc269_x101_hp_automute_hook(struct hda_codec *codec, |
1a4f69d5 | 3201 | struct hda_jack_callback *jack) |
d240d1dc DH |
3202 | { |
3203 | struct alc_spec *spec = codec->spec; | |
3204 | int vref; | |
3205 | msleep(200); | |
3206 | snd_hda_gen_hp_automute(codec, jack); | |
3207 | ||
3208 | vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; | |
3209 | msleep(100); | |
3210 | snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3211 | vref); | |
3212 | msleep(500); | |
3213 | snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3214 | vref); | |
3215 | } | |
3216 | ||
3217 | static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, | |
3218 | const struct hda_fixup *fix, int action) | |
3219 | { | |
3220 | struct alc_spec *spec = codec->spec; | |
3221 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3222 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | |
3223 | spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook; | |
3224 | } | |
3225 | } | |
3226 | ||
3227 | ||
08fb0d0e TI |
3228 | /* update mute-LED according to the speaker mute state via mic VREF pin */ |
3229 | static void alc269_fixup_mic_mute_hook(void *private_data, int enabled) | |
6d3cd5d4 DH |
3230 | { |
3231 | struct hda_codec *codec = private_data; | |
08fb0d0e TI |
3232 | struct alc_spec *spec = codec->spec; |
3233 | unsigned int pinval; | |
3234 | ||
3235 | if (spec->mute_led_polarity) | |
3236 | enabled = !enabled; | |
415d555e TI |
3237 | pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); |
3238 | pinval &= ~AC_PINCTL_VREFEN; | |
3239 | pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80; | |
08fb0d0e TI |
3240 | if (spec->mute_led_nid) |
3241 | snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); | |
6d3cd5d4 DH |
3242 | } |
3243 | ||
d5b6b65e DH |
3244 | /* Make sure the led works even in runtime suspend */ |
3245 | static unsigned int led_power_filter(struct hda_codec *codec, | |
3246 | hda_nid_t nid, | |
3247 | unsigned int power_state) | |
3248 | { | |
3249 | struct alc_spec *spec = codec->spec; | |
3250 | ||
50dd9050 HW |
3251 | if (power_state != AC_PWRST_D3 || nid == 0 || |
3252 | (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid)) | |
d5b6b65e DH |
3253 | return power_state; |
3254 | ||
3255 | /* Set pin ctl again, it might have just been set to 0 */ | |
3256 | snd_hda_set_pin_ctl(codec, nid, | |
3257 | snd_hda_codec_get_pin_target(codec, nid)); | |
3258 | ||
3259 | return AC_PWRST_D0; | |
3260 | } | |
3261 | ||
08fb0d0e TI |
3262 | static void alc269_fixup_hp_mute_led(struct hda_codec *codec, |
3263 | const struct hda_fixup *fix, int action) | |
6d3cd5d4 DH |
3264 | { |
3265 | struct alc_spec *spec = codec->spec; | |
08fb0d0e TI |
3266 | const struct dmi_device *dev = NULL; |
3267 | ||
3268 | if (action != HDA_FIXUP_ACT_PRE_PROBE) | |
3269 | return; | |
3270 | ||
3271 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { | |
3272 | int pol, pin; | |
3273 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2) | |
3274 | continue; | |
3275 | if (pin < 0x0a || pin >= 0x10) | |
3276 | break; | |
3277 | spec->mute_led_polarity = pol; | |
3278 | spec->mute_led_nid = pin - 0x0a + 0x18; | |
3279 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | |
fd25a97a | 3280 | spec->gen.vmaster_mute_enum = 1; |
d5b6b65e | 3281 | codec->power_filter = led_power_filter; |
4e76a883 TI |
3282 | codec_dbg(codec, |
3283 | "Detected mute LED for %x:%d\n", spec->mute_led_nid, | |
08fb0d0e | 3284 | spec->mute_led_polarity); |
6d3cd5d4 DH |
3285 | break; |
3286 | } | |
3287 | } | |
3288 | ||
d06ac143 DH |
3289 | static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, |
3290 | const struct hda_fixup *fix, int action) | |
3291 | { | |
3292 | struct alc_spec *spec = codec->spec; | |
3293 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3294 | spec->mute_led_polarity = 0; | |
3295 | spec->mute_led_nid = 0x18; | |
3296 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | |
3297 | spec->gen.vmaster_mute_enum = 1; | |
d5b6b65e | 3298 | codec->power_filter = led_power_filter; |
d06ac143 DH |
3299 | } |
3300 | } | |
3301 | ||
08fb0d0e TI |
3302 | static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, |
3303 | const struct hda_fixup *fix, int action) | |
420b0feb TI |
3304 | { |
3305 | struct alc_spec *spec = codec->spec; | |
9bb1f06f | 3306 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
08fb0d0e TI |
3307 | spec->mute_led_polarity = 0; |
3308 | spec->mute_led_nid = 0x19; | |
3309 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | |
fd25a97a | 3310 | spec->gen.vmaster_mute_enum = 1; |
d5b6b65e | 3311 | codec->power_filter = led_power_filter; |
420b0feb TI |
3312 | } |
3313 | } | |
3314 | ||
0f32fd19 TI |
3315 | /* update LED status via GPIO */ |
3316 | static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, | |
3317 | bool enabled) | |
9f5c6faf | 3318 | { |
9f5c6faf TI |
3319 | struct alc_spec *spec = codec->spec; |
3320 | unsigned int oldval = spec->gpio_led; | |
3321 | ||
0f32fd19 TI |
3322 | if (spec->mute_led_polarity) |
3323 | enabled = !enabled; | |
3324 | ||
9f5c6faf | 3325 | if (enabled) |
0f32fd19 | 3326 | spec->gpio_led &= ~mask; |
9f5c6faf | 3327 | else |
0f32fd19 | 3328 | spec->gpio_led |= mask; |
9f5c6faf TI |
3329 | if (spec->gpio_led != oldval) |
3330 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | |
3331 | spec->gpio_led); | |
3332 | } | |
3333 | ||
0f32fd19 TI |
3334 | /* turn on/off mute LED via GPIO per vmaster hook */ |
3335 | static void alc_fixup_gpio_mute_hook(void *private_data, int enabled) | |
9f5c6faf | 3336 | { |
0f32fd19 | 3337 | struct hda_codec *codec = private_data; |
9f5c6faf | 3338 | struct alc_spec *spec = codec->spec; |
9f5c6faf | 3339 | |
0f32fd19 TI |
3340 | alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); |
3341 | } | |
9f5c6faf | 3342 | |
0f32fd19 TI |
3343 | /* turn on/off mic-mute LED via GPIO per capture hook */ |
3344 | static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec, | |
3345 | struct snd_kcontrol *kcontrol, | |
3346 | struct snd_ctl_elem_value *ucontrol) | |
3347 | { | |
3348 | struct alc_spec *spec = codec->spec; | |
3349 | ||
3350 | if (ucontrol) | |
3351 | alc_update_gpio_led(codec, spec->gpio_mic_led_mask, | |
3352 | ucontrol->value.integer.value[0] || | |
3353 | ucontrol->value.integer.value[1]); | |
9f5c6faf TI |
3354 | } |
3355 | ||
3356 | static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, | |
3357 | const struct hda_fixup *fix, int action) | |
3358 | { | |
3359 | struct alc_spec *spec = codec->spec; | |
3360 | static const struct hda_verb gpio_init[] = { | |
3361 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, | |
3362 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, | |
3363 | {} | |
3364 | }; | |
3365 | ||
3366 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
0f32fd19 TI |
3367 | spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; |
3368 | spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook; | |
9f5c6faf | 3369 | spec->gpio_led = 0; |
0f32fd19 TI |
3370 | spec->mute_led_polarity = 0; |
3371 | spec->gpio_mute_led_mask = 0x08; | |
3372 | spec->gpio_mic_led_mask = 0x10; | |
9f5c6faf TI |
3373 | snd_hda_add_verbs(codec, gpio_init); |
3374 | } | |
3375 | } | |
3376 | ||
eaa8e5ef KY |
3377 | static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, |
3378 | const struct hda_fixup *fix, int action) | |
3379 | { | |
3380 | struct alc_spec *spec = codec->spec; | |
3381 | static const struct hda_verb gpio_init[] = { | |
3382 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 }, | |
3383 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 }, | |
3384 | {} | |
3385 | }; | |
3386 | ||
3387 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3388 | spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; | |
3389 | spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook; | |
9f5c6faf | 3390 | spec->gpio_led = 0; |
eaa8e5ef KY |
3391 | spec->mute_led_polarity = 0; |
3392 | spec->gpio_mute_led_mask = 0x02; | |
3393 | spec->gpio_mic_led_mask = 0x20; | |
9f5c6faf TI |
3394 | snd_hda_add_verbs(codec, gpio_init); |
3395 | } | |
3396 | } | |
3397 | ||
9c5dc3bf KY |
3398 | /* turn on/off mic-mute LED per capture hook */ |
3399 | static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec, | |
3400 | struct snd_kcontrol *kcontrol, | |
3401 | struct snd_ctl_elem_value *ucontrol) | |
3402 | { | |
3403 | struct alc_spec *spec = codec->spec; | |
3404 | unsigned int pinval, enable, disable; | |
3405 | ||
fc1fad93 | 3406 | pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid); |
9c5dc3bf KY |
3407 | pinval &= ~AC_PINCTL_VREFEN; |
3408 | enable = pinval | AC_PINCTL_VREF_80; | |
3409 | disable = pinval | AC_PINCTL_VREF_HIZ; | |
3410 | ||
3411 | if (!ucontrol) | |
3412 | return; | |
3413 | ||
3414 | if (ucontrol->value.integer.value[0] || | |
3415 | ucontrol->value.integer.value[1]) | |
3416 | pinval = disable; | |
3417 | else | |
3418 | pinval = enable; | |
3419 | ||
3420 | if (spec->cap_mute_led_nid) | |
3421 | snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval); | |
3422 | } | |
3423 | ||
3424 | static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, | |
3425 | const struct hda_fixup *fix, int action) | |
3426 | { | |
3427 | struct alc_spec *spec = codec->spec; | |
3428 | static const struct hda_verb gpio_init[] = { | |
3429 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 }, | |
3430 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 }, | |
3431 | {} | |
3432 | }; | |
3433 | ||
3434 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
0f32fd19 | 3435 | spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; |
9c5dc3bf KY |
3436 | spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; |
3437 | spec->gpio_led = 0; | |
0f32fd19 TI |
3438 | spec->mute_led_polarity = 0; |
3439 | spec->gpio_mute_led_mask = 0x08; | |
9c5dc3bf KY |
3440 | spec->cap_mute_led_nid = 0x18; |
3441 | snd_hda_add_verbs(codec, gpio_init); | |
50dd9050 | 3442 | codec->power_filter = led_power_filter; |
9c5dc3bf KY |
3443 | } |
3444 | } | |
3445 | ||
7a5255f1 DH |
3446 | static void alc280_fixup_hp_gpio4(struct hda_codec *codec, |
3447 | const struct hda_fixup *fix, int action) | |
3448 | { | |
3449 | /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */ | |
3450 | struct alc_spec *spec = codec->spec; | |
3451 | static const struct hda_verb gpio_init[] = { | |
3452 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, | |
3453 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, | |
3454 | {} | |
3455 | }; | |
3456 | ||
3457 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
0f32fd19 | 3458 | spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; |
7a5255f1 DH |
3459 | spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; |
3460 | spec->gpio_led = 0; | |
0f32fd19 TI |
3461 | spec->mute_led_polarity = 0; |
3462 | spec->gpio_mute_led_mask = 0x08; | |
7a5255f1 DH |
3463 | spec->cap_mute_led_nid = 0x18; |
3464 | snd_hda_add_verbs(codec, gpio_init); | |
3465 | codec->power_filter = led_power_filter; | |
3466 | } | |
3467 | } | |
3468 | ||
9c5dc3bf KY |
3469 | static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, |
3470 | const struct hda_fixup *fix, int action) | |
3471 | { | |
3472 | struct alc_spec *spec = codec->spec; | |
3473 | ||
3474 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3475 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | |
3476 | spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; | |
3477 | spec->mute_led_polarity = 0; | |
3478 | spec->mute_led_nid = 0x1a; | |
3479 | spec->cap_mute_led_nid = 0x18; | |
3480 | spec->gen.vmaster_mute_enum = 1; | |
3481 | codec->power_filter = led_power_filter; | |
3482 | } | |
3483 | } | |
3484 | ||
73bdd597 DH |
3485 | static void alc_headset_mode_unplugged(struct hda_codec *codec) |
3486 | { | |
54db6c39 TI |
3487 | static struct coef_fw coef0255[] = { |
3488 | WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */ | |
3489 | WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */ | |
3490 | UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ | |
3491 | WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */ | |
3492 | WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */ | |
3493 | {} | |
3494 | }; | |
3495 | static struct coef_fw coef0233[] = { | |
3496 | WRITE_COEF(0x1b, 0x0c0b), | |
3497 | WRITE_COEF(0x45, 0xc429), | |
3498 | UPDATE_COEF(0x35, 0x4000, 0), | |
3499 | WRITE_COEF(0x06, 0x2104), | |
3500 | WRITE_COEF(0x1a, 0x0001), | |
3501 | WRITE_COEF(0x26, 0x0004), | |
3502 | WRITE_COEF(0x32, 0x42a3), | |
3503 | {} | |
3504 | }; | |
3505 | static struct coef_fw coef0292[] = { | |
3506 | WRITE_COEF(0x76, 0x000e), | |
3507 | WRITE_COEF(0x6c, 0x2400), | |
3508 | WRITE_COEF(0x18, 0x7308), | |
3509 | WRITE_COEF(0x6b, 0xc429), | |
3510 | {} | |
3511 | }; | |
3512 | static struct coef_fw coef0293[] = { | |
3513 | UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */ | |
3514 | UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */ | |
3515 | UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */ | |
3516 | UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */ | |
3517 | WRITE_COEF(0x45, 0xc429), /* Set to TRS type */ | |
3518 | UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ | |
3519 | {} | |
3520 | }; | |
3521 | static struct coef_fw coef0668[] = { | |
3522 | WRITE_COEF(0x15, 0x0d40), | |
3523 | WRITE_COEF(0xb7, 0x802b), | |
3524 | {} | |
3525 | }; | |
3526 | ||
73bdd597 | 3527 | switch (codec->vendor_id) { |
9a22a8f5 | 3528 | case 0x10ec0255: |
54db6c39 | 3529 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 | 3530 | break; |
13fd08a3 | 3531 | case 0x10ec0233: |
73bdd597 | 3532 | case 0x10ec0283: |
54db6c39 | 3533 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3534 | break; |
3535 | case 0x10ec0292: | |
54db6c39 | 3536 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3537 | break; |
a22aa26f | 3538 | case 0x10ec0293: |
54db6c39 | 3539 | alc_process_coef_fw(codec, coef0293); |
a22aa26f | 3540 | break; |
73bdd597 | 3541 | case 0x10ec0668: |
54db6c39 | 3542 | alc_process_coef_fw(codec, coef0668); |
73bdd597 DH |
3543 | break; |
3544 | } | |
4e76a883 | 3545 | codec_dbg(codec, "Headset jack set to unplugged mode.\n"); |
73bdd597 DH |
3546 | } |
3547 | ||
3548 | ||
3549 | static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, | |
3550 | hda_nid_t mic_pin) | |
3551 | { | |
54db6c39 TI |
3552 | static struct coef_fw coef0255[] = { |
3553 | WRITE_COEFEX(0x57, 0x03, 0x8aa6), | |
3554 | WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */ | |
3555 | {} | |
3556 | }; | |
3557 | static struct coef_fw coef0233[] = { | |
3558 | UPDATE_COEF(0x35, 0, 1<<14), | |
3559 | WRITE_COEF(0x06, 0x2100), | |
3560 | WRITE_COEF(0x1a, 0x0021), | |
3561 | WRITE_COEF(0x26, 0x008c), | |
3562 | {} | |
3563 | }; | |
3564 | static struct coef_fw coef0292[] = { | |
3565 | WRITE_COEF(0x19, 0xa208), | |
3566 | WRITE_COEF(0x2e, 0xacf0), | |
3567 | {} | |
3568 | }; | |
3569 | static struct coef_fw coef0293[] = { | |
3570 | UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */ | |
3571 | UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */ | |
3572 | UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ | |
3573 | {} | |
3574 | }; | |
3575 | static struct coef_fw coef0688[] = { | |
3576 | WRITE_COEF(0xb7, 0x802b), | |
3577 | WRITE_COEF(0xb5, 0x1040), | |
3578 | UPDATE_COEF(0xc3, 0, 1<<12), | |
3579 | {} | |
3580 | }; | |
3581 | ||
73bdd597 | 3582 | switch (codec->vendor_id) { |
9a22a8f5 KY |
3583 | case 0x10ec0255: |
3584 | alc_write_coef_idx(codec, 0x45, 0xc489); | |
3585 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3586 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 KY |
3587 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3588 | break; | |
13fd08a3 | 3589 | case 0x10ec0233: |
73bdd597 DH |
3590 | case 0x10ec0283: |
3591 | alc_write_coef_idx(codec, 0x45, 0xc429); | |
3592 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3593 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3594 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3595 | break; | |
3596 | case 0x10ec0292: | |
3597 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3598 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3599 | break; |
a22aa26f KY |
3600 | case 0x10ec0293: |
3601 | /* Set to TRS mode */ | |
3602 | alc_write_coef_idx(codec, 0x45, 0xc429); | |
3603 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3604 | alc_process_coef_fw(codec, coef0293); |
a22aa26f KY |
3605 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3606 | break; | |
73bdd597 DH |
3607 | case 0x10ec0668: |
3608 | alc_write_coef_idx(codec, 0x11, 0x0001); | |
3609 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3610 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3611 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3612 | break; | |
3613 | } | |
4e76a883 | 3614 | codec_dbg(codec, "Headset jack set to mic-in mode.\n"); |
73bdd597 DH |
3615 | } |
3616 | ||
3617 | static void alc_headset_mode_default(struct hda_codec *codec) | |
3618 | { | |
54db6c39 TI |
3619 | static struct coef_fw coef0255[] = { |
3620 | WRITE_COEF(0x45, 0xc089), | |
3621 | WRITE_COEF(0x45, 0xc489), | |
3622 | WRITE_COEFEX(0x57, 0x03, 0x8ea6), | |
3623 | WRITE_COEF(0x49, 0x0049), | |
3624 | {} | |
3625 | }; | |
3626 | static struct coef_fw coef0233[] = { | |
3627 | WRITE_COEF(0x06, 0x2100), | |
3628 | WRITE_COEF(0x32, 0x4ea3), | |
3629 | {} | |
3630 | }; | |
3631 | static struct coef_fw coef0292[] = { | |
3632 | WRITE_COEF(0x76, 0x000e), | |
3633 | WRITE_COEF(0x6c, 0x2400), | |
3634 | WRITE_COEF(0x6b, 0xc429), | |
3635 | WRITE_COEF(0x18, 0x7308), | |
3636 | {} | |
3637 | }; | |
3638 | static struct coef_fw coef0293[] = { | |
3639 | UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ | |
3640 | WRITE_COEF(0x45, 0xC429), /* Set to TRS type */ | |
3641 | UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ | |
3642 | {} | |
3643 | }; | |
3644 | static struct coef_fw coef0688[] = { | |
3645 | WRITE_COEF(0x11, 0x0041), | |
3646 | WRITE_COEF(0x15, 0x0d40), | |
3647 | WRITE_COEF(0xb7, 0x802b), | |
3648 | {} | |
3649 | }; | |
3650 | ||
73bdd597 | 3651 | switch (codec->vendor_id) { |
9a22a8f5 | 3652 | case 0x10ec0255: |
54db6c39 | 3653 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 | 3654 | break; |
13fd08a3 | 3655 | case 0x10ec0233: |
73bdd597 | 3656 | case 0x10ec0283: |
54db6c39 | 3657 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3658 | break; |
3659 | case 0x10ec0292: | |
54db6c39 | 3660 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3661 | break; |
a22aa26f | 3662 | case 0x10ec0293: |
54db6c39 | 3663 | alc_process_coef_fw(codec, coef0293); |
a22aa26f | 3664 | break; |
73bdd597 | 3665 | case 0x10ec0668: |
54db6c39 | 3666 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3667 | break; |
3668 | } | |
4e76a883 | 3669 | codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); |
73bdd597 DH |
3670 | } |
3671 | ||
3672 | /* Iphone type */ | |
3673 | static void alc_headset_mode_ctia(struct hda_codec *codec) | |
3674 | { | |
54db6c39 TI |
3675 | static struct coef_fw coef0255[] = { |
3676 | WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */ | |
3677 | WRITE_COEF(0x1b, 0x0c2b), | |
3678 | WRITE_COEFEX(0x57, 0x03, 0x8ea6), | |
3679 | {} | |
3680 | }; | |
3681 | static struct coef_fw coef0233[] = { | |
3682 | WRITE_COEF(0x45, 0xd429), | |
3683 | WRITE_COEF(0x1b, 0x0c2b), | |
3684 | WRITE_COEF(0x32, 0x4ea3), | |
3685 | {} | |
3686 | }; | |
3687 | static struct coef_fw coef0292[] = { | |
3688 | WRITE_COEF(0x6b, 0xd429), | |
3689 | WRITE_COEF(0x76, 0x0008), | |
3690 | WRITE_COEF(0x18, 0x7388), | |
3691 | {} | |
3692 | }; | |
3693 | static struct coef_fw coef0293[] = { | |
3694 | WRITE_COEF(0x45, 0xd429), /* Set to ctia type */ | |
3695 | UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ | |
3696 | {} | |
3697 | }; | |
3698 | static struct coef_fw coef0688[] = { | |
3699 | WRITE_COEF(0x11, 0x0001), | |
3700 | WRITE_COEF(0x15, 0x0d60), | |
3701 | WRITE_COEF(0xc3, 0x0000), | |
3702 | {} | |
3703 | }; | |
3704 | ||
73bdd597 | 3705 | switch (codec->vendor_id) { |
9a22a8f5 | 3706 | case 0x10ec0255: |
54db6c39 | 3707 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 | 3708 | break; |
13fd08a3 | 3709 | case 0x10ec0233: |
73bdd597 | 3710 | case 0x10ec0283: |
54db6c39 | 3711 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3712 | break; |
3713 | case 0x10ec0292: | |
54db6c39 | 3714 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3715 | break; |
a22aa26f | 3716 | case 0x10ec0293: |
54db6c39 | 3717 | alc_process_coef_fw(codec, coef0293); |
a22aa26f | 3718 | break; |
73bdd597 | 3719 | case 0x10ec0668: |
54db6c39 | 3720 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3721 | break; |
3722 | } | |
4e76a883 | 3723 | codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); |
73bdd597 DH |
3724 | } |
3725 | ||
3726 | /* Nokia type */ | |
3727 | static void alc_headset_mode_omtp(struct hda_codec *codec) | |
3728 | { | |
54db6c39 TI |
3729 | static struct coef_fw coef0255[] = { |
3730 | WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */ | |
3731 | WRITE_COEF(0x1b, 0x0c2b), | |
3732 | WRITE_COEFEX(0x57, 0x03, 0x8ea6), | |
3733 | {} | |
3734 | }; | |
3735 | static struct coef_fw coef0233[] = { | |
3736 | WRITE_COEF(0x45, 0xe429), | |
3737 | WRITE_COEF(0x1b, 0x0c2b), | |
3738 | WRITE_COEF(0x32, 0x4ea3), | |
3739 | {} | |
3740 | }; | |
3741 | static struct coef_fw coef0292[] = { | |
3742 | WRITE_COEF(0x6b, 0xe429), | |
3743 | WRITE_COEF(0x76, 0x0008), | |
3744 | WRITE_COEF(0x18, 0x7388), | |
3745 | {} | |
3746 | }; | |
3747 | static struct coef_fw coef0293[] = { | |
3748 | WRITE_COEF(0x45, 0xe429), /* Set to omtp type */ | |
3749 | UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ | |
3750 | {} | |
3751 | }; | |
3752 | static struct coef_fw coef0688[] = { | |
3753 | WRITE_COEF(0x11, 0x0001), | |
3754 | WRITE_COEF(0x15, 0x0d50), | |
3755 | WRITE_COEF(0xc3, 0x0000), | |
3756 | {} | |
3757 | }; | |
3758 | ||
73bdd597 | 3759 | switch (codec->vendor_id) { |
9a22a8f5 | 3760 | case 0x10ec0255: |
54db6c39 | 3761 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 | 3762 | break; |
13fd08a3 | 3763 | case 0x10ec0233: |
73bdd597 | 3764 | case 0x10ec0283: |
54db6c39 | 3765 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3766 | break; |
3767 | case 0x10ec0292: | |
54db6c39 | 3768 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3769 | break; |
a22aa26f | 3770 | case 0x10ec0293: |
54db6c39 | 3771 | alc_process_coef_fw(codec, coef0293); |
a22aa26f | 3772 | break; |
73bdd597 | 3773 | case 0x10ec0668: |
54db6c39 | 3774 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3775 | break; |
3776 | } | |
4e76a883 | 3777 | codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); |
73bdd597 DH |
3778 | } |
3779 | ||
3780 | static void alc_determine_headset_type(struct hda_codec *codec) | |
3781 | { | |
3782 | int val; | |
3783 | bool is_ctia = false; | |
3784 | struct alc_spec *spec = codec->spec; | |
54db6c39 TI |
3785 | static struct coef_fw coef0255[] = { |
3786 | WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/ | |
3787 | WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref | |
3788 | conteol) */ | |
3789 | {} | |
3790 | }; | |
3791 | static struct coef_fw coef0293[] = { | |
3792 | UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */ | |
3793 | WRITE_COEF(0x45, 0xD429), /* Set to ctia type */ | |
3794 | {} | |
3795 | }; | |
3796 | static struct coef_fw coef0688[] = { | |
3797 | WRITE_COEF(0x11, 0x0001), | |
3798 | WRITE_COEF(0xb7, 0x802b), | |
3799 | WRITE_COEF(0x15, 0x0d60), | |
3800 | WRITE_COEF(0xc3, 0x0c00), | |
3801 | {} | |
3802 | }; | |
73bdd597 DH |
3803 | |
3804 | switch (codec->vendor_id) { | |
9a22a8f5 | 3805 | case 0x10ec0255: |
54db6c39 | 3806 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 KY |
3807 | msleep(300); |
3808 | val = alc_read_coef_idx(codec, 0x46); | |
3809 | is_ctia = (val & 0x0070) == 0x0070; | |
3810 | break; | |
13fd08a3 | 3811 | case 0x10ec0233: |
73bdd597 DH |
3812 | case 0x10ec0283: |
3813 | alc_write_coef_idx(codec, 0x45, 0xd029); | |
3814 | msleep(300); | |
3815 | val = alc_read_coef_idx(codec, 0x46); | |
3816 | is_ctia = (val & 0x0070) == 0x0070; | |
3817 | break; | |
3818 | case 0x10ec0292: | |
3819 | alc_write_coef_idx(codec, 0x6b, 0xd429); | |
3820 | msleep(300); | |
3821 | val = alc_read_coef_idx(codec, 0x6c); | |
3822 | is_ctia = (val & 0x001c) == 0x001c; | |
3823 | break; | |
a22aa26f | 3824 | case 0x10ec0293: |
54db6c39 | 3825 | alc_process_coef_fw(codec, coef0293); |
a22aa26f KY |
3826 | msleep(300); |
3827 | val = alc_read_coef_idx(codec, 0x46); | |
3828 | is_ctia = (val & 0x0070) == 0x0070; | |
3829 | break; | |
73bdd597 | 3830 | case 0x10ec0668: |
54db6c39 | 3831 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3832 | msleep(300); |
3833 | val = alc_read_coef_idx(codec, 0xbe); | |
3834 | is_ctia = (val & 0x1c02) == 0x1c02; | |
3835 | break; | |
3836 | } | |
3837 | ||
4e76a883 | 3838 | codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", |
73bdd597 DH |
3839 | is_ctia ? "yes" : "no"); |
3840 | spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP; | |
3841 | } | |
3842 | ||
3843 | static void alc_update_headset_mode(struct hda_codec *codec) | |
3844 | { | |
3845 | struct alc_spec *spec = codec->spec; | |
3846 | ||
3847 | hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; | |
3848 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
3849 | ||
3850 | int new_headset_mode; | |
3851 | ||
3852 | if (!snd_hda_jack_detect(codec, hp_pin)) | |
3853 | new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED; | |
3854 | else if (mux_pin == spec->headset_mic_pin) | |
3855 | new_headset_mode = ALC_HEADSET_MODE_HEADSET; | |
3856 | else if (mux_pin == spec->headphone_mic_pin) | |
3857 | new_headset_mode = ALC_HEADSET_MODE_MIC; | |
3858 | else | |
3859 | new_headset_mode = ALC_HEADSET_MODE_HEADPHONE; | |
3860 | ||
5959a6bc DH |
3861 | if (new_headset_mode == spec->current_headset_mode) { |
3862 | snd_hda_gen_update_outputs(codec); | |
73bdd597 | 3863 | return; |
5959a6bc | 3864 | } |
73bdd597 DH |
3865 | |
3866 | switch (new_headset_mode) { | |
3867 | case ALC_HEADSET_MODE_UNPLUGGED: | |
3868 | alc_headset_mode_unplugged(codec); | |
3869 | spec->gen.hp_jack_present = false; | |
3870 | break; | |
3871 | case ALC_HEADSET_MODE_HEADSET: | |
3872 | if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN) | |
3873 | alc_determine_headset_type(codec); | |
3874 | if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA) | |
3875 | alc_headset_mode_ctia(codec); | |
3876 | else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP) | |
3877 | alc_headset_mode_omtp(codec); | |
3878 | spec->gen.hp_jack_present = true; | |
3879 | break; | |
3880 | case ALC_HEADSET_MODE_MIC: | |
3881 | alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); | |
3882 | spec->gen.hp_jack_present = false; | |
3883 | break; | |
3884 | case ALC_HEADSET_MODE_HEADPHONE: | |
3885 | alc_headset_mode_default(codec); | |
3886 | spec->gen.hp_jack_present = true; | |
3887 | break; | |
3888 | } | |
3889 | if (new_headset_mode != ALC_HEADSET_MODE_MIC) { | |
3890 | snd_hda_set_pin_ctl_cache(codec, hp_pin, | |
3891 | AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); | |
3892 | if (spec->headphone_mic_pin) | |
3893 | snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, | |
3894 | PIN_VREFHIZ); | |
3895 | } | |
3896 | spec->current_headset_mode = new_headset_mode; | |
3897 | ||
3898 | snd_hda_gen_update_outputs(codec); | |
3899 | } | |
3900 | ||
3901 | static void alc_update_headset_mode_hook(struct hda_codec *codec, | |
7fe30711 TI |
3902 | struct snd_kcontrol *kcontrol, |
3903 | struct snd_ctl_elem_value *ucontrol) | |
73bdd597 DH |
3904 | { |
3905 | alc_update_headset_mode(codec); | |
3906 | } | |
3907 | ||
1a4f69d5 TI |
3908 | static void alc_update_headset_jack_cb(struct hda_codec *codec, |
3909 | struct hda_jack_callback *jack) | |
73bdd597 DH |
3910 | { |
3911 | struct alc_spec *spec = codec->spec; | |
5db4d34b | 3912 | spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; |
73bdd597 DH |
3913 | snd_hda_gen_hp_automute(codec, jack); |
3914 | } | |
3915 | ||
3916 | static void alc_probe_headset_mode(struct hda_codec *codec) | |
3917 | { | |
3918 | int i; | |
3919 | struct alc_spec *spec = codec->spec; | |
3920 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; | |
3921 | ||
3922 | /* Find mic pins */ | |
3923 | for (i = 0; i < cfg->num_inputs; i++) { | |
3924 | if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin) | |
3925 | spec->headset_mic_pin = cfg->inputs[i].pin; | |
3926 | if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin) | |
3927 | spec->headphone_mic_pin = cfg->inputs[i].pin; | |
3928 | } | |
3929 | ||
3930 | spec->gen.cap_sync_hook = alc_update_headset_mode_hook; | |
3931 | spec->gen.automute_hook = alc_update_headset_mode; | |
3932 | spec->gen.hp_automute_hook = alc_update_headset_jack_cb; | |
3933 | } | |
3934 | ||
3935 | static void alc_fixup_headset_mode(struct hda_codec *codec, | |
3936 | const struct hda_fixup *fix, int action) | |
3937 | { | |
3938 | struct alc_spec *spec = codec->spec; | |
3939 | ||
3940 | switch (action) { | |
3941 | case HDA_FIXUP_ACT_PRE_PROBE: | |
3942 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC; | |
3943 | break; | |
3944 | case HDA_FIXUP_ACT_PROBE: | |
3945 | alc_probe_headset_mode(codec); | |
3946 | break; | |
3947 | case HDA_FIXUP_ACT_INIT: | |
3948 | spec->current_headset_mode = 0; | |
3949 | alc_update_headset_mode(codec); | |
3950 | break; | |
3951 | } | |
3952 | } | |
3953 | ||
3954 | static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, | |
3955 | const struct hda_fixup *fix, int action) | |
3956 | { | |
3957 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3958 | struct alc_spec *spec = codec->spec; | |
3959 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | |
3960 | } | |
3961 | else | |
3962 | alc_fixup_headset_mode(codec, fix, action); | |
3963 | } | |
3964 | ||
31278997 KY |
3965 | static void alc255_set_default_jack_type(struct hda_codec *codec) |
3966 | { | |
3967 | /* Set to iphone type */ | |
54db6c39 TI |
3968 | static struct coef_fw fw[] = { |
3969 | WRITE_COEF(0x1b, 0x880b), | |
3970 | WRITE_COEF(0x45, 0xd089), | |
3971 | WRITE_COEF(0x1b, 0x080b), | |
3972 | WRITE_COEF(0x46, 0x0004), | |
3973 | WRITE_COEF(0x1b, 0x0c0b), | |
3974 | {} | |
3975 | }; | |
3976 | alc_process_coef_fw(codec, fw); | |
31278997 KY |
3977 | msleep(30); |
3978 | } | |
3979 | ||
9a22a8f5 KY |
3980 | static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, |
3981 | const struct hda_fixup *fix, int action) | |
3982 | { | |
3983 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
31278997 | 3984 | alc255_set_default_jack_type(codec); |
9a22a8f5 KY |
3985 | } |
3986 | alc_fixup_headset_mode(codec, fix, action); | |
3987 | } | |
3988 | ||
31278997 KY |
3989 | static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, |
3990 | const struct hda_fixup *fix, int action) | |
3991 | { | |
3992 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3993 | struct alc_spec *spec = codec->spec; | |
3994 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | |
3995 | alc255_set_default_jack_type(codec); | |
3996 | } | |
3997 | else | |
3998 | alc_fixup_headset_mode(codec, fix, action); | |
3999 | } | |
4000 | ||
493a52a9 HW |
4001 | static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, |
4002 | const struct hda_fixup *fix, int action) | |
4003 | { | |
4004 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
4005 | struct alc_spec *spec = codec->spec; | |
4006 | spec->gen.auto_mute_via_amp = 1; | |
4007 | } | |
4008 | } | |
4009 | ||
9b745ab8 TI |
4010 | static void alc_no_shutup(struct hda_codec *codec) |
4011 | { | |
4012 | } | |
4013 | ||
4014 | static void alc_fixup_no_shutup(struct hda_codec *codec, | |
4015 | const struct hda_fixup *fix, int action) | |
4016 | { | |
4017 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
4018 | struct alc_spec *spec = codec->spec; | |
4019 | spec->shutup = alc_no_shutup; | |
4020 | } | |
4021 | } | |
4022 | ||
5e6db669 GM |
4023 | static void alc_fixup_disable_aamix(struct hda_codec *codec, |
4024 | const struct hda_fixup *fix, int action) | |
4025 | { | |
4026 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
4027 | struct alc_spec *spec = codec->spec; | |
4028 | /* Disable AA-loopback as it causes white noise */ | |
4029 | spec->gen.mixer_nid = 0; | |
4030 | } | |
4031 | } | |
4032 | ||
033b0a7c GM |
4033 | static unsigned int alc_power_filter_xps13(struct hda_codec *codec, |
4034 | hda_nid_t nid, | |
4035 | unsigned int power_state) | |
4036 | { | |
4037 | struct alc_spec *spec = codec->spec; | |
4038 | ||
4039 | /* Avoid pop noises when headphones are plugged in */ | |
4040 | if (spec->gen.hp_jack_present) | |
de3da4f6 | 4041 | if (nid == codec->afg || nid == 0x02 || nid == 0x15) |
033b0a7c GM |
4042 | return AC_PWRST_D0; |
4043 | return power_state; | |
4044 | } | |
4045 | ||
4046 | static void alc_fixup_dell_xps13(struct hda_codec *codec, | |
4047 | const struct hda_fixup *fix, int action) | |
4048 | { | |
4049 | if (action == HDA_FIXUP_ACT_PROBE) { | |
4050 | struct alc_spec *spec = codec->spec; | |
f38663ab GM |
4051 | struct hda_input_mux *imux = &spec->gen.input_mux; |
4052 | int i; | |
4053 | ||
033b0a7c GM |
4054 | spec->shutup = alc_no_shutup; |
4055 | codec->power_filter = alc_power_filter_xps13; | |
f38663ab GM |
4056 | |
4057 | /* Make the internal mic the default input source. */ | |
4058 | for (i = 0; i < imux->num_items; i++) { | |
4059 | if (spec->gen.imux_pins[i] == 0x12) { | |
4060 | spec->gen.cur_mux[0] = i; | |
4061 | break; | |
4062 | } | |
4063 | } | |
033b0a7c GM |
4064 | } |
4065 | } | |
4066 | ||
73bdd597 DH |
4067 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, |
4068 | const struct hda_fixup *fix, int action) | |
4069 | { | |
4070 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
73bdd597 | 4071 | alc_write_coef_idx(codec, 0xc4, 0x8000); |
98b24883 | 4072 | alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); |
73bdd597 DH |
4073 | snd_hda_set_pin_ctl_cache(codec, 0x18, 0); |
4074 | } | |
4075 | alc_fixup_headset_mode(codec, fix, action); | |
4076 | } | |
4077 | ||
bde7bc60 CCC |
4078 | /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */ |
4079 | static int find_ext_mic_pin(struct hda_codec *codec) | |
4080 | { | |
4081 | struct alc_spec *spec = codec->spec; | |
4082 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; | |
4083 | hda_nid_t nid; | |
4084 | unsigned int defcfg; | |
4085 | int i; | |
4086 | ||
4087 | for (i = 0; i < cfg->num_inputs; i++) { | |
4088 | if (cfg->inputs[i].type != AUTO_PIN_MIC) | |
4089 | continue; | |
4090 | nid = cfg->inputs[i].pin; | |
4091 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | |
4092 | if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT) | |
4093 | continue; | |
4094 | return nid; | |
4095 | } | |
4096 | ||
4097 | return 0; | |
4098 | } | |
4099 | ||
08a978db | 4100 | static void alc271_hp_gate_mic_jack(struct hda_codec *codec, |
1727a771 | 4101 | const struct hda_fixup *fix, |
08a978db DR |
4102 | int action) |
4103 | { | |
4104 | struct alc_spec *spec = codec->spec; | |
4105 | ||
0db75790 | 4106 | if (action == HDA_FIXUP_ACT_PROBE) { |
bde7bc60 CCC |
4107 | int mic_pin = find_ext_mic_pin(codec); |
4108 | int hp_pin = spec->gen.autocfg.hp_pins[0]; | |
4109 | ||
4110 | if (snd_BUG_ON(!mic_pin || !hp_pin)) | |
0db75790 | 4111 | return; |
bde7bc60 | 4112 | snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); |
0db75790 | 4113 | } |
08a978db | 4114 | } |
693b613d | 4115 | |
3e0d611b DH |
4116 | static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, |
4117 | const struct hda_fixup *fix, | |
4118 | int action) | |
4119 | { | |
4120 | struct alc_spec *spec = codec->spec; | |
4121 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; | |
4122 | int i; | |
4123 | ||
4124 | /* The mic boosts on level 2 and 3 are too noisy | |
4125 | on the internal mic input. | |
4126 | Therefore limit the boost to 0 or 1. */ | |
4127 | ||
4128 | if (action != HDA_FIXUP_ACT_PROBE) | |
4129 | return; | |
4130 | ||
4131 | for (i = 0; i < cfg->num_inputs; i++) { | |
4132 | hda_nid_t nid = cfg->inputs[i].pin; | |
4133 | unsigned int defcfg; | |
4134 | if (cfg->inputs[i].type != AUTO_PIN_MIC) | |
4135 | continue; | |
4136 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | |
4137 | if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT) | |
4138 | continue; | |
4139 | ||
4140 | snd_hda_override_amp_caps(codec, nid, HDA_INPUT, | |
4141 | (0x00 << AC_AMPCAP_OFFSET_SHIFT) | | |
4142 | (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
4143 | (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
4144 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
4145 | } | |
4146 | } | |
4147 | ||
cd217a63 | 4148 | static void alc283_hp_automute_hook(struct hda_codec *codec, |
1a4f69d5 | 4149 | struct hda_jack_callback *jack) |
cd217a63 KY |
4150 | { |
4151 | struct alc_spec *spec = codec->spec; | |
4152 | int vref; | |
4153 | ||
4154 | msleep(200); | |
4155 | snd_hda_gen_hp_automute(codec, jack); | |
4156 | ||
4157 | vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; | |
4158 | ||
4159 | msleep(600); | |
4160 | snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4161 | vref); | |
4162 | } | |
4163 | ||
cd217a63 KY |
4164 | static void alc283_fixup_chromebook(struct hda_codec *codec, |
4165 | const struct hda_fixup *fix, int action) | |
4166 | { | |
4167 | struct alc_spec *spec = codec->spec; | |
cd217a63 KY |
4168 | |
4169 | switch (action) { | |
4170 | case HDA_FIXUP_ACT_PRE_PROBE: | |
0202e99c | 4171 | snd_hda_override_wcaps(codec, 0x03, 0); |
d2e92709 TI |
4172 | /* Disable AA-loopback as it causes white noise */ |
4173 | spec->gen.mixer_nid = 0; | |
38070219 | 4174 | break; |
0202e99c | 4175 | case HDA_FIXUP_ACT_INIT: |
de9481cb KY |
4176 | /* MIC2-VREF control */ |
4177 | /* Set to manual mode */ | |
98b24883 | 4178 | alc_update_coef_idx(codec, 0x06, 0x000c, 0); |
0202e99c | 4179 | /* Enable Line1 input control by verb */ |
98b24883 | 4180 | alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); |
0202e99c KY |
4181 | break; |
4182 | } | |
4183 | } | |
4184 | ||
4185 | static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, | |
4186 | const struct hda_fixup *fix, int action) | |
4187 | { | |
4188 | struct alc_spec *spec = codec->spec; | |
0202e99c KY |
4189 | |
4190 | switch (action) { | |
4191 | case HDA_FIXUP_ACT_PRE_PROBE: | |
cd217a63 | 4192 | spec->gen.hp_automute_hook = alc283_hp_automute_hook; |
38070219 KY |
4193 | break; |
4194 | case HDA_FIXUP_ACT_INIT: | |
cd217a63 KY |
4195 | /* MIC2-VREF control */ |
4196 | /* Set to manual mode */ | |
98b24883 | 4197 | alc_update_coef_idx(codec, 0x06, 0x000c, 0); |
cd217a63 KY |
4198 | break; |
4199 | } | |
4200 | } | |
4201 | ||
7bba2157 TI |
4202 | /* mute tablet speaker pin (0x14) via dock plugging in addition */ |
4203 | static void asus_tx300_automute(struct hda_codec *codec) | |
4204 | { | |
4205 | struct alc_spec *spec = codec->spec; | |
4206 | snd_hda_gen_update_outputs(codec); | |
4207 | if (snd_hda_jack_detect(codec, 0x1b)) | |
4208 | spec->gen.mute_bits |= (1ULL << 0x14); | |
4209 | } | |
4210 | ||
4211 | static void alc282_fixup_asus_tx300(struct hda_codec *codec, | |
4212 | const struct hda_fixup *fix, int action) | |
4213 | { | |
4214 | struct alc_spec *spec = codec->spec; | |
4215 | /* TX300 needs to set up GPIO2 for the speaker amp */ | |
4216 | static const struct hda_verb gpio2_verbs[] = { | |
4217 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 }, | |
4218 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 }, | |
4219 | { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 }, | |
4220 | {} | |
4221 | }; | |
4222 | static const struct hda_pintbl dock_pins[] = { | |
4223 | { 0x1b, 0x21114000 }, /* dock speaker pin */ | |
4224 | {} | |
4225 | }; | |
4226 | struct snd_kcontrol *kctl; | |
4227 | ||
4228 | switch (action) { | |
4229 | case HDA_FIXUP_ACT_PRE_PROBE: | |
4230 | snd_hda_add_verbs(codec, gpio2_verbs); | |
4231 | snd_hda_apply_pincfgs(codec, dock_pins); | |
4232 | spec->gen.auto_mute_via_amp = 1; | |
4233 | spec->gen.automute_hook = asus_tx300_automute; | |
4234 | snd_hda_jack_detect_enable_callback(codec, 0x1b, | |
7bba2157 TI |
4235 | snd_hda_gen_hp_automute); |
4236 | break; | |
4237 | case HDA_FIXUP_ACT_BUILD: | |
4238 | /* this is a bit tricky; give more sane names for the main | |
4239 | * (tablet) speaker and the dock speaker, respectively | |
4240 | */ | |
4241 | kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch"); | |
4242 | if (kctl) | |
4243 | strcpy(kctl->id.name, "Dock Speaker Playback Switch"); | |
4244 | kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch"); | |
4245 | if (kctl) | |
4246 | strcpy(kctl->id.name, "Speaker Playback Switch"); | |
4247 | break; | |
4248 | } | |
4249 | } | |
4250 | ||
338cae56 DH |
4251 | static void alc290_fixup_mono_speakers(struct hda_codec *codec, |
4252 | const struct hda_fixup *fix, int action) | |
4253 | { | |
0f4881dc DH |
4254 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
4255 | /* DAC node 0x03 is giving mono output. We therefore want to | |
4256 | make sure 0x14 (front speaker) and 0x15 (headphones) use the | |
4257 | stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */ | |
4258 | hda_nid_t conn1[2] = { 0x0c }; | |
4259 | snd_hda_override_conn_list(codec, 0x14, 1, conn1); | |
4260 | snd_hda_override_conn_list(codec, 0x15, 1, conn1); | |
4261 | } | |
338cae56 DH |
4262 | } |
4263 | ||
b317b032 TI |
4264 | /* for hda_fixup_thinkpad_acpi() */ |
4265 | #include "thinkpad_helper.c" | |
b67ae3f1 | 4266 | |
00ef9940 HW |
4267 | /* for dell wmi mic mute led */ |
4268 | #include "dell_wmi_helper.c" | |
4269 | ||
1d045db9 TI |
4270 | enum { |
4271 | ALC269_FIXUP_SONY_VAIO, | |
4272 | ALC275_FIXUP_SONY_VAIO_GPIO2, | |
4273 | ALC269_FIXUP_DELL_M101Z, | |
4274 | ALC269_FIXUP_SKU_IGNORE, | |
4275 | ALC269_FIXUP_ASUS_G73JW, | |
4276 | ALC269_FIXUP_LENOVO_EAPD, | |
4277 | ALC275_FIXUP_SONY_HWEQ, | |
e9bd7d5c | 4278 | ALC275_FIXUP_SONY_DISABLE_AAMIX, |
1d045db9 | 4279 | ALC271_FIXUP_DMIC, |
017f2a10 | 4280 | ALC269_FIXUP_PCM_44K, |
adabb3ec | 4281 | ALC269_FIXUP_STEREO_DMIC, |
7c478f03 | 4282 | ALC269_FIXUP_HEADSET_MIC, |
24519911 TI |
4283 | ALC269_FIXUP_QUANTA_MUTE, |
4284 | ALC269_FIXUP_LIFEBOOK, | |
2041d564 | 4285 | ALC269_FIXUP_LIFEBOOK_EXTMIC, |
a4297b5d TI |
4286 | ALC269_FIXUP_AMIC, |
4287 | ALC269_FIXUP_DMIC, | |
4288 | ALC269VB_FIXUP_AMIC, | |
4289 | ALC269VB_FIXUP_DMIC, | |
08fb0d0e | 4290 | ALC269_FIXUP_HP_MUTE_LED, |
d06ac143 | 4291 | ALC269_FIXUP_HP_MUTE_LED_MIC1, |
08fb0d0e | 4292 | ALC269_FIXUP_HP_MUTE_LED_MIC2, |
9f5c6faf | 4293 | ALC269_FIXUP_HP_GPIO_LED, |
9c5dc3bf KY |
4294 | ALC269_FIXUP_HP_GPIO_MIC1_LED, |
4295 | ALC269_FIXUP_HP_LINE1_MIC1_LED, | |
693b613d | 4296 | ALC269_FIXUP_INV_DMIC, |
108cc108 | 4297 | ALC269_FIXUP_LENOVO_DOCK, |
9b745ab8 | 4298 | ALC269_FIXUP_NO_SHUTUP, |
88cfcf86 | 4299 | ALC286_FIXUP_SONY_MIC_NO_PRESENCE, |
108cc108 | 4300 | ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, |
73bdd597 DH |
4301 | ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
4302 | ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, | |
338cae56 | 4303 | ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
73bdd597 DH |
4304 | ALC269_FIXUP_HEADSET_MODE, |
4305 | ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, | |
d240d1dc DH |
4306 | ALC269_FIXUP_ASUS_X101_FUNC, |
4307 | ALC269_FIXUP_ASUS_X101_VERB, | |
4308 | ALC269_FIXUP_ASUS_X101, | |
08a978db DR |
4309 | ALC271_FIXUP_AMIC_MIC2, |
4310 | ALC271_FIXUP_HP_GATE_MIC_JACK, | |
b1e8972e | 4311 | ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, |
42397004 | 4312 | ALC269_FIXUP_ACER_AC700, |
3e0d611b | 4313 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST, |
2cede303 | 4314 | ALC269VB_FIXUP_ASUS_ZENBOOK, |
23870831 | 4315 | ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, |
8e35cd4a | 4316 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED, |
02b504d9 | 4317 | ALC269VB_FIXUP_ORDISSIMO_EVE2, |
cd217a63 | 4318 | ALC283_FIXUP_CHROME_BOOK, |
0202e99c | 4319 | ALC283_FIXUP_SENSE_COMBO_JACK, |
7bba2157 | 4320 | ALC282_FIXUP_ASUS_TX300, |
1bb3e062 | 4321 | ALC283_FIXUP_INT_MIC, |
338cae56 | 4322 | ALC290_FIXUP_MONO_SPEAKERS, |
0f4881dc DH |
4323 | ALC290_FIXUP_MONO_SPEAKERS_HSJACK, |
4324 | ALC290_FIXUP_SUBWOOFER, | |
4325 | ALC290_FIXUP_SUBWOOFER_HSJACK, | |
b67ae3f1 | 4326 | ALC269_FIXUP_THINKPAD_ACPI, |
9a22a8f5 | 4327 | ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
31278997 | 4328 | ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, |
9a22a8f5 | 4329 | ALC255_FIXUP_HEADSET_MODE, |
31278997 | 4330 | ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC, |
a22aa26f | 4331 | ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
1c37c223 | 4332 | ALC292_FIXUP_TPT440_DOCK, |
9dc12862 | 4333 | ALC283_FIXUP_BXBT2807_MIC, |
00ef9940 | 4334 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, |
1a22e775 | 4335 | ALC282_FIXUP_ASPIRE_V5_PINS, |
7a5255f1 | 4336 | ALC280_FIXUP_HP_GPIO4, |
eaa8e5ef | 4337 | ALC286_FIXUP_HP_GPIO_LED, |
f1d4e28b KY |
4338 | }; |
4339 | ||
1727a771 | 4340 | static const struct hda_fixup alc269_fixups[] = { |
1d045db9 | 4341 | [ALC269_FIXUP_SONY_VAIO] = { |
fd108215 TI |
4342 | .type = HDA_FIXUP_PINCTLS, |
4343 | .v.pins = (const struct hda_pintbl[]) { | |
4344 | {0x19, PIN_VREFGRD}, | |
1d045db9 TI |
4345 | {} |
4346 | } | |
f1d4e28b | 4347 | }, |
1d045db9 | 4348 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
1727a771 | 4349 | .type = HDA_FIXUP_VERBS, |
1d045db9 TI |
4350 | .v.verbs = (const struct hda_verb[]) { |
4351 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, | |
4352 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, | |
4353 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
4354 | { } | |
4355 | }, | |
4356 | .chained = true, | |
4357 | .chain_id = ALC269_FIXUP_SONY_VAIO | |
4358 | }, | |
4359 | [ALC269_FIXUP_DELL_M101Z] = { | |
1727a771 | 4360 | .type = HDA_FIXUP_VERBS, |
1d045db9 TI |
4361 | .v.verbs = (const struct hda_verb[]) { |
4362 | /* Enables internal speaker */ | |
4363 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, | |
4364 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, | |
4365 | {} | |
4366 | } | |
4367 | }, | |
4368 | [ALC269_FIXUP_SKU_IGNORE] = { | |
1727a771 | 4369 | .type = HDA_FIXUP_FUNC, |
23d30f28 | 4370 | .v.func = alc_fixup_sku_ignore, |
1d045db9 TI |
4371 | }, |
4372 | [ALC269_FIXUP_ASUS_G73JW] = { | |
1727a771 TI |
4373 | .type = HDA_FIXUP_PINS, |
4374 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
4375 | { 0x17, 0x99130111 }, /* subwoofer */ |
4376 | { } | |
4377 | } | |
4378 | }, | |
4379 | [ALC269_FIXUP_LENOVO_EAPD] = { | |
1727a771 | 4380 | .type = HDA_FIXUP_VERBS, |
1d045db9 TI |
4381 | .v.verbs = (const struct hda_verb[]) { |
4382 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, | |
4383 | {} | |
4384 | } | |
4385 | }, | |
4386 | [ALC275_FIXUP_SONY_HWEQ] = { | |
1727a771 | 4387 | .type = HDA_FIXUP_FUNC, |
1d045db9 TI |
4388 | .v.func = alc269_fixup_hweq, |
4389 | .chained = true, | |
4390 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 | |
4391 | }, | |
e9bd7d5c TI |
4392 | [ALC275_FIXUP_SONY_DISABLE_AAMIX] = { |
4393 | .type = HDA_FIXUP_FUNC, | |
4394 | .v.func = alc_fixup_disable_aamix, | |
4395 | .chained = true, | |
4396 | .chain_id = ALC269_FIXUP_SONY_VAIO | |
4397 | }, | |
1d045db9 | 4398 | [ALC271_FIXUP_DMIC] = { |
1727a771 | 4399 | .type = HDA_FIXUP_FUNC, |
1d045db9 | 4400 | .v.func = alc271_fixup_dmic, |
f1d4e28b | 4401 | }, |
017f2a10 | 4402 | [ALC269_FIXUP_PCM_44K] = { |
1727a771 | 4403 | .type = HDA_FIXUP_FUNC, |
017f2a10 | 4404 | .v.func = alc269_fixup_pcm_44k, |
012e7eb1 DH |
4405 | .chained = true, |
4406 | .chain_id = ALC269_FIXUP_QUANTA_MUTE | |
017f2a10 | 4407 | }, |
adabb3ec | 4408 | [ALC269_FIXUP_STEREO_DMIC] = { |
1727a771 | 4409 | .type = HDA_FIXUP_FUNC, |
adabb3ec TI |
4410 | .v.func = alc269_fixup_stereo_dmic, |
4411 | }, | |
7c478f03 DH |
4412 | [ALC269_FIXUP_HEADSET_MIC] = { |
4413 | .type = HDA_FIXUP_FUNC, | |
4414 | .v.func = alc269_fixup_headset_mic, | |
4415 | }, | |
24519911 | 4416 | [ALC269_FIXUP_QUANTA_MUTE] = { |
1727a771 | 4417 | .type = HDA_FIXUP_FUNC, |
24519911 TI |
4418 | .v.func = alc269_fixup_quanta_mute, |
4419 | }, | |
4420 | [ALC269_FIXUP_LIFEBOOK] = { | |
1727a771 TI |
4421 | .type = HDA_FIXUP_PINS, |
4422 | .v.pins = (const struct hda_pintbl[]) { | |
24519911 TI |
4423 | { 0x1a, 0x2101103f }, /* dock line-out */ |
4424 | { 0x1b, 0x23a11040 }, /* dock mic-in */ | |
4425 | { } | |
4426 | }, | |
4427 | .chained = true, | |
4428 | .chain_id = ALC269_FIXUP_QUANTA_MUTE | |
4429 | }, | |
2041d564 DH |
4430 | [ALC269_FIXUP_LIFEBOOK_EXTMIC] = { |
4431 | .type = HDA_FIXUP_PINS, | |
4432 | .v.pins = (const struct hda_pintbl[]) { | |
4433 | { 0x19, 0x01a1903c }, /* headset mic, with jack detect */ | |
4434 | { } | |
4435 | }, | |
4436 | }, | |
a4297b5d | 4437 | [ALC269_FIXUP_AMIC] = { |
1727a771 TI |
4438 | .type = HDA_FIXUP_PINS, |
4439 | .v.pins = (const struct hda_pintbl[]) { | |
a4297b5d TI |
4440 | { 0x14, 0x99130110 }, /* speaker */ |
4441 | { 0x15, 0x0121401f }, /* HP out */ | |
4442 | { 0x18, 0x01a19c20 }, /* mic */ | |
4443 | { 0x19, 0x99a3092f }, /* int-mic */ | |
4444 | { } | |
4445 | }, | |
4446 | }, | |
4447 | [ALC269_FIXUP_DMIC] = { | |
1727a771 TI |
4448 | .type = HDA_FIXUP_PINS, |
4449 | .v.pins = (const struct hda_pintbl[]) { | |
a4297b5d TI |
4450 | { 0x12, 0x99a3092f }, /* int-mic */ |
4451 | { 0x14, 0x99130110 }, /* speaker */ | |
4452 | { 0x15, 0x0121401f }, /* HP out */ | |
4453 | { 0x18, 0x01a19c20 }, /* mic */ | |
4454 | { } | |
4455 | }, | |
4456 | }, | |
4457 | [ALC269VB_FIXUP_AMIC] = { | |
1727a771 TI |
4458 | .type = HDA_FIXUP_PINS, |
4459 | .v.pins = (const struct hda_pintbl[]) { | |
a4297b5d TI |
4460 | { 0x14, 0x99130110 }, /* speaker */ |
4461 | { 0x18, 0x01a19c20 }, /* mic */ | |
4462 | { 0x19, 0x99a3092f }, /* int-mic */ | |
4463 | { 0x21, 0x0121401f }, /* HP out */ | |
4464 | { } | |
4465 | }, | |
4466 | }, | |
2267ea97 | 4467 | [ALC269VB_FIXUP_DMIC] = { |
1727a771 TI |
4468 | .type = HDA_FIXUP_PINS, |
4469 | .v.pins = (const struct hda_pintbl[]) { | |
a4297b5d TI |
4470 | { 0x12, 0x99a3092f }, /* int-mic */ |
4471 | { 0x14, 0x99130110 }, /* speaker */ | |
4472 | { 0x18, 0x01a19c20 }, /* mic */ | |
4473 | { 0x21, 0x0121401f }, /* HP out */ | |
4474 | { } | |
4475 | }, | |
4476 | }, | |
08fb0d0e | 4477 | [ALC269_FIXUP_HP_MUTE_LED] = { |
1727a771 | 4478 | .type = HDA_FIXUP_FUNC, |
08fb0d0e | 4479 | .v.func = alc269_fixup_hp_mute_led, |
6d3cd5d4 | 4480 | }, |
d06ac143 DH |
4481 | [ALC269_FIXUP_HP_MUTE_LED_MIC1] = { |
4482 | .type = HDA_FIXUP_FUNC, | |
4483 | .v.func = alc269_fixup_hp_mute_led_mic1, | |
4484 | }, | |
08fb0d0e | 4485 | [ALC269_FIXUP_HP_MUTE_LED_MIC2] = { |
1727a771 | 4486 | .type = HDA_FIXUP_FUNC, |
08fb0d0e | 4487 | .v.func = alc269_fixup_hp_mute_led_mic2, |
420b0feb | 4488 | }, |
9f5c6faf TI |
4489 | [ALC269_FIXUP_HP_GPIO_LED] = { |
4490 | .type = HDA_FIXUP_FUNC, | |
4491 | .v.func = alc269_fixup_hp_gpio_led, | |
4492 | }, | |
9c5dc3bf KY |
4493 | [ALC269_FIXUP_HP_GPIO_MIC1_LED] = { |
4494 | .type = HDA_FIXUP_FUNC, | |
4495 | .v.func = alc269_fixup_hp_gpio_mic1_led, | |
4496 | }, | |
4497 | [ALC269_FIXUP_HP_LINE1_MIC1_LED] = { | |
4498 | .type = HDA_FIXUP_FUNC, | |
4499 | .v.func = alc269_fixup_hp_line1_mic1_led, | |
4500 | }, | |
693b613d | 4501 | [ALC269_FIXUP_INV_DMIC] = { |
1727a771 | 4502 | .type = HDA_FIXUP_FUNC, |
9d36a7dc | 4503 | .v.func = alc_fixup_inv_dmic, |
693b613d | 4504 | }, |
9b745ab8 TI |
4505 | [ALC269_FIXUP_NO_SHUTUP] = { |
4506 | .type = HDA_FIXUP_FUNC, | |
4507 | .v.func = alc_fixup_no_shutup, | |
4508 | }, | |
108cc108 | 4509 | [ALC269_FIXUP_LENOVO_DOCK] = { |
1727a771 TI |
4510 | .type = HDA_FIXUP_PINS, |
4511 | .v.pins = (const struct hda_pintbl[]) { | |
108cc108 DH |
4512 | { 0x19, 0x23a11040 }, /* dock mic */ |
4513 | { 0x1b, 0x2121103f }, /* dock headphone */ | |
4514 | { } | |
4515 | }, | |
4516 | .chained = true, | |
4517 | .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT | |
4518 | }, | |
4519 | [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = { | |
1727a771 | 4520 | .type = HDA_FIXUP_FUNC, |
108cc108 | 4521 | .v.func = alc269_fixup_pincfg_no_hp_to_lineout, |
52129000 DH |
4522 | .chained = true, |
4523 | .chain_id = ALC269_FIXUP_THINKPAD_ACPI, | |
108cc108 | 4524 | }, |
73bdd597 DH |
4525 | [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = { |
4526 | .type = HDA_FIXUP_PINS, | |
4527 | .v.pins = (const struct hda_pintbl[]) { | |
4528 | { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4529 | { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */ | |
4530 | { } | |
4531 | }, | |
4532 | .chained = true, | |
4533 | .chain_id = ALC269_FIXUP_HEADSET_MODE | |
4534 | }, | |
4535 | [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = { | |
4536 | .type = HDA_FIXUP_PINS, | |
4537 | .v.pins = (const struct hda_pintbl[]) { | |
4538 | { 0x16, 0x21014020 }, /* dock line out */ | |
4539 | { 0x19, 0x21a19030 }, /* dock mic */ | |
4540 | { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4541 | { } | |
4542 | }, | |
4543 | .chained = true, | |
4544 | .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC | |
4545 | }, | |
338cae56 DH |
4546 | [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = { |
4547 | .type = HDA_FIXUP_PINS, | |
4548 | .v.pins = (const struct hda_pintbl[]) { | |
4549 | { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4550 | { } | |
4551 | }, | |
4552 | .chained = true, | |
4553 | .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC | |
4554 | }, | |
73bdd597 DH |
4555 | [ALC269_FIXUP_HEADSET_MODE] = { |
4556 | .type = HDA_FIXUP_FUNC, | |
4557 | .v.func = alc_fixup_headset_mode, | |
6676f308 HW |
4558 | .chained = true, |
4559 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | |
73bdd597 DH |
4560 | }, |
4561 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | |
4562 | .type = HDA_FIXUP_FUNC, | |
4563 | .v.func = alc_fixup_headset_mode_no_hp_mic, | |
4564 | }, | |
88cfcf86 DH |
4565 | [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = { |
4566 | .type = HDA_FIXUP_PINS, | |
4567 | .v.pins = (const struct hda_pintbl[]) { | |
4568 | { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4569 | { } | |
4570 | }, | |
fbc78ad6 DH |
4571 | .chained = true, |
4572 | .chain_id = ALC269_FIXUP_HEADSET_MIC | |
88cfcf86 | 4573 | }, |
d240d1dc DH |
4574 | [ALC269_FIXUP_ASUS_X101_FUNC] = { |
4575 | .type = HDA_FIXUP_FUNC, | |
4576 | .v.func = alc269_fixup_x101_headset_mic, | |
4577 | }, | |
4578 | [ALC269_FIXUP_ASUS_X101_VERB] = { | |
4579 | .type = HDA_FIXUP_VERBS, | |
4580 | .v.verbs = (const struct hda_verb[]) { | |
4581 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4582 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | |
4583 | {0x20, AC_VERB_SET_PROC_COEF, 0x0310}, | |
4584 | { } | |
4585 | }, | |
4586 | .chained = true, | |
4587 | .chain_id = ALC269_FIXUP_ASUS_X101_FUNC | |
4588 | }, | |
4589 | [ALC269_FIXUP_ASUS_X101] = { | |
4590 | .type = HDA_FIXUP_PINS, | |
4591 | .v.pins = (const struct hda_pintbl[]) { | |
4592 | { 0x18, 0x04a1182c }, /* Headset mic */ | |
4593 | { } | |
4594 | }, | |
4595 | .chained = true, | |
4596 | .chain_id = ALC269_FIXUP_ASUS_X101_VERB | |
4597 | }, | |
08a978db | 4598 | [ALC271_FIXUP_AMIC_MIC2] = { |
1727a771 TI |
4599 | .type = HDA_FIXUP_PINS, |
4600 | .v.pins = (const struct hda_pintbl[]) { | |
08a978db DR |
4601 | { 0x14, 0x99130110 }, /* speaker */ |
4602 | { 0x19, 0x01a19c20 }, /* mic */ | |
4603 | { 0x1b, 0x99a7012f }, /* int-mic */ | |
4604 | { 0x21, 0x0121401f }, /* HP out */ | |
4605 | { } | |
4606 | }, | |
4607 | }, | |
4608 | [ALC271_FIXUP_HP_GATE_MIC_JACK] = { | |
1727a771 | 4609 | .type = HDA_FIXUP_FUNC, |
08a978db DR |
4610 | .v.func = alc271_hp_gate_mic_jack, |
4611 | .chained = true, | |
4612 | .chain_id = ALC271_FIXUP_AMIC_MIC2, | |
4613 | }, | |
b1e8972e OR |
4614 | [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = { |
4615 | .type = HDA_FIXUP_FUNC, | |
4616 | .v.func = alc269_fixup_limit_int_mic_boost, | |
4617 | .chained = true, | |
4618 | .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK, | |
4619 | }, | |
42397004 DR |
4620 | [ALC269_FIXUP_ACER_AC700] = { |
4621 | .type = HDA_FIXUP_PINS, | |
4622 | .v.pins = (const struct hda_pintbl[]) { | |
4623 | { 0x12, 0x99a3092f }, /* int-mic */ | |
4624 | { 0x14, 0x99130110 }, /* speaker */ | |
4625 | { 0x18, 0x03a11c20 }, /* mic */ | |
4626 | { 0x1e, 0x0346101e }, /* SPDIF1 */ | |
4627 | { 0x21, 0x0321101f }, /* HP out */ | |
4628 | { } | |
4629 | }, | |
4630 | .chained = true, | |
4631 | .chain_id = ALC271_FIXUP_DMIC, | |
4632 | }, | |
3e0d611b DH |
4633 | [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = { |
4634 | .type = HDA_FIXUP_FUNC, | |
4635 | .v.func = alc269_fixup_limit_int_mic_boost, | |
2793769f DH |
4636 | .chained = true, |
4637 | .chain_id = ALC269_FIXUP_THINKPAD_ACPI, | |
3e0d611b | 4638 | }, |
2cede303 OR |
4639 | [ALC269VB_FIXUP_ASUS_ZENBOOK] = { |
4640 | .type = HDA_FIXUP_FUNC, | |
4641 | .v.func = alc269_fixup_limit_int_mic_boost, | |
4642 | .chained = true, | |
4643 | .chain_id = ALC269VB_FIXUP_DMIC, | |
4644 | }, | |
23870831 TI |
4645 | [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = { |
4646 | .type = HDA_FIXUP_VERBS, | |
4647 | .v.verbs = (const struct hda_verb[]) { | |
4648 | /* class-D output amp +5dB */ | |
4649 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 }, | |
4650 | { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 }, | |
4651 | {} | |
4652 | }, | |
4653 | .chained = true, | |
4654 | .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK, | |
4655 | }, | |
8e35cd4a DH |
4656 | [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = { |
4657 | .type = HDA_FIXUP_FUNC, | |
4658 | .v.func = alc269_fixup_limit_int_mic_boost, | |
4659 | .chained = true, | |
4660 | .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
4661 | }, | |
02b504d9 AA |
4662 | [ALC269VB_FIXUP_ORDISSIMO_EVE2] = { |
4663 | .type = HDA_FIXUP_PINS, | |
4664 | .v.pins = (const struct hda_pintbl[]) { | |
4665 | { 0x12, 0x99a3092f }, /* int-mic */ | |
4666 | { 0x18, 0x03a11d20 }, /* mic */ | |
4667 | { 0x19, 0x411111f0 }, /* Unused bogus pin */ | |
4668 | { } | |
4669 | }, | |
4670 | }, | |
cd217a63 KY |
4671 | [ALC283_FIXUP_CHROME_BOOK] = { |
4672 | .type = HDA_FIXUP_FUNC, | |
4673 | .v.func = alc283_fixup_chromebook, | |
4674 | }, | |
0202e99c KY |
4675 | [ALC283_FIXUP_SENSE_COMBO_JACK] = { |
4676 | .type = HDA_FIXUP_FUNC, | |
4677 | .v.func = alc283_fixup_sense_combo_jack, | |
4678 | .chained = true, | |
4679 | .chain_id = ALC283_FIXUP_CHROME_BOOK, | |
4680 | }, | |
7bba2157 TI |
4681 | [ALC282_FIXUP_ASUS_TX300] = { |
4682 | .type = HDA_FIXUP_FUNC, | |
4683 | .v.func = alc282_fixup_asus_tx300, | |
4684 | }, | |
1bb3e062 KY |
4685 | [ALC283_FIXUP_INT_MIC] = { |
4686 | .type = HDA_FIXUP_VERBS, | |
4687 | .v.verbs = (const struct hda_verb[]) { | |
4688 | {0x20, AC_VERB_SET_COEF_INDEX, 0x1a}, | |
4689 | {0x20, AC_VERB_SET_PROC_COEF, 0x0011}, | |
4690 | { } | |
4691 | }, | |
4692 | .chained = true, | |
4693 | .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST | |
4694 | }, | |
0f4881dc DH |
4695 | [ALC290_FIXUP_SUBWOOFER_HSJACK] = { |
4696 | .type = HDA_FIXUP_PINS, | |
4697 | .v.pins = (const struct hda_pintbl[]) { | |
4698 | { 0x17, 0x90170112 }, /* subwoofer */ | |
4699 | { } | |
4700 | }, | |
4701 | .chained = true, | |
4702 | .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, | |
4703 | }, | |
4704 | [ALC290_FIXUP_SUBWOOFER] = { | |
4705 | .type = HDA_FIXUP_PINS, | |
4706 | .v.pins = (const struct hda_pintbl[]) { | |
4707 | { 0x17, 0x90170112 }, /* subwoofer */ | |
4708 | { } | |
4709 | }, | |
4710 | .chained = true, | |
4711 | .chain_id = ALC290_FIXUP_MONO_SPEAKERS, | |
4712 | }, | |
338cae56 DH |
4713 | [ALC290_FIXUP_MONO_SPEAKERS] = { |
4714 | .type = HDA_FIXUP_FUNC, | |
4715 | .v.func = alc290_fixup_mono_speakers, | |
0f4881dc DH |
4716 | }, |
4717 | [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = { | |
4718 | .type = HDA_FIXUP_FUNC, | |
4719 | .v.func = alc290_fixup_mono_speakers, | |
338cae56 DH |
4720 | .chained = true, |
4721 | .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, | |
4722 | }, | |
b67ae3f1 DH |
4723 | [ALC269_FIXUP_THINKPAD_ACPI] = { |
4724 | .type = HDA_FIXUP_FUNC, | |
b317b032 | 4725 | .v.func = hda_fixup_thinkpad_acpi, |
b67ae3f1 | 4726 | }, |
9a22a8f5 KY |
4727 | [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = { |
4728 | .type = HDA_FIXUP_PINS, | |
4729 | .v.pins = (const struct hda_pintbl[]) { | |
4730 | { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4731 | { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */ | |
4732 | { } | |
4733 | }, | |
4734 | .chained = true, | |
4735 | .chain_id = ALC255_FIXUP_HEADSET_MODE | |
4736 | }, | |
31278997 KY |
4737 | [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = { |
4738 | .type = HDA_FIXUP_PINS, | |
4739 | .v.pins = (const struct hda_pintbl[]) { | |
4740 | { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4741 | { } | |
4742 | }, | |
4743 | .chained = true, | |
4744 | .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC | |
4745 | }, | |
9a22a8f5 KY |
4746 | [ALC255_FIXUP_HEADSET_MODE] = { |
4747 | .type = HDA_FIXUP_FUNC, | |
4748 | .v.func = alc_fixup_headset_mode_alc255, | |
4a83d42a HW |
4749 | .chained = true, |
4750 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | |
9a22a8f5 | 4751 | }, |
31278997 KY |
4752 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4753 | .type = HDA_FIXUP_FUNC, | |
4754 | .v.func = alc_fixup_headset_mode_alc255_no_hp_mic, | |
4755 | }, | |
a22aa26f KY |
4756 | [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = { |
4757 | .type = HDA_FIXUP_PINS, | |
4758 | .v.pins = (const struct hda_pintbl[]) { | |
4759 | { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */ | |
4760 | { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4761 | { } | |
4762 | }, | |
4763 | .chained = true, | |
4764 | .chain_id = ALC269_FIXUP_HEADSET_MODE | |
4765 | }, | |
1c37c223 TI |
4766 | [ALC292_FIXUP_TPT440_DOCK] = { |
4767 | .type = HDA_FIXUP_PINS, | |
4768 | .v.pins = (const struct hda_pintbl[]) { | |
4769 | { 0x16, 0x21211010 }, /* dock headphone */ | |
4770 | { 0x19, 0x21a11010 }, /* dock mic */ | |
4771 | { } | |
4772 | }, | |
4773 | .chained = true, | |
4774 | .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST | |
4775 | }, | |
9dc12862 DD |
4776 | [ALC283_FIXUP_BXBT2807_MIC] = { |
4777 | .type = HDA_FIXUP_PINS, | |
4778 | .v.pins = (const struct hda_pintbl[]) { | |
4779 | { 0x19, 0x04a110f0 }, | |
4780 | { }, | |
4781 | }, | |
4782 | }, | |
00ef9940 HW |
4783 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { |
4784 | .type = HDA_FIXUP_FUNC, | |
4785 | .v.func = alc_fixup_dell_wmi, | |
00ef9940 | 4786 | }, |
1a22e775 TI |
4787 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { |
4788 | .type = HDA_FIXUP_PINS, | |
4789 | .v.pins = (const struct hda_pintbl[]) { | |
4790 | { 0x12, 0x90a60130 }, | |
4791 | { 0x14, 0x90170110 }, | |
4792 | { 0x17, 0x40000008 }, | |
4793 | { 0x18, 0x411111f0 }, | |
4794 | { 0x19, 0x411111f0 }, | |
4795 | { 0x1a, 0x411111f0 }, | |
4796 | { 0x1b, 0x411111f0 }, | |
4797 | { 0x1d, 0x40f89b2d }, | |
4798 | { 0x1e, 0x411111f0 }, | |
4799 | { 0x21, 0x0321101f }, | |
4800 | { }, | |
4801 | }, | |
4802 | }, | |
7a5255f1 DH |
4803 | [ALC280_FIXUP_HP_GPIO4] = { |
4804 | .type = HDA_FIXUP_FUNC, | |
4805 | .v.func = alc280_fixup_hp_gpio4, | |
4806 | }, | |
eaa8e5ef KY |
4807 | [ALC286_FIXUP_HP_GPIO_LED] = { |
4808 | .type = HDA_FIXUP_FUNC, | |
4809 | .v.func = alc286_fixup_hp_gpio_led, | |
4810 | }, | |
f1d4e28b KY |
4811 | }; |
4812 | ||
1d045db9 | 4813 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
a6b92b66 | 4814 | SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC), |
693b613d DH |
4815 | SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), |
4816 | SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), | |
aaedfb47 DH |
4817 | SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700), |
4818 | SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), | |
4819 | SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), | |
b1e8972e | 4820 | SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), |
1a22e775 | 4821 | SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), |
aaedfb47 | 4822 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
0f4881dc | 4823 | SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER), |
73bdd597 DH |
4824 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4825 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | |
4826 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | |
0f4881dc DH |
4827 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4828 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | |
0f4881dc | 4829 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), |
a22aa26f KY |
4830 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4831 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | |
b734304f KY |
4832 | SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4833 | SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | |
a22aa26f KY |
4834 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4835 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | |
08fb0d0e | 4836 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
9f5c6faf | 4837 | SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED), |
8e35cd4a | 4838 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), |
c60666bd | 4839 | /* ALC282 */ |
8a02b164 | 4840 | SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
8a02b164 | 4841 | SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
9c5dc3bf KY |
4842 | SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), |
4843 | SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), | |
4844 | SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), | |
4845 | SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), | |
9c5dc3bf | 4846 | SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), |
c60666bd | 4847 | SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd KY |
4848 | SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4849 | SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
8a02b164 | 4850 | SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
eaa8e5ef | 4851 | SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED), |
c60666bd | 4852 | SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd KY |
4853 | SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4854 | SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
4855 | SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
c60666bd | 4856 | SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
9c5dc3bf KY |
4857 | SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4858 | SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
c60666bd | 4859 | /* ALC290 */ |
9c5dc3bf | 4860 | SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
9c5dc3bf | 4861 | SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
9c5dc3bf | 4862 | SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
9c5dc3bf KY |
4863 | SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4864 | SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4865 | SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4866 | SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4867 | SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
9c5dc3bf KY |
4868 | SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4869 | SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
c60666bd | 4870 | SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd KY |
4871 | SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4872 | SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
4873 | SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
9c5dc3bf KY |
4874 | SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4875 | SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
9c5dc3bf | 4876 | SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
c60666bd | 4877 | SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd | 4878 | SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd | 4879 | SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd KY |
4880 | SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4881 | SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
c60666bd KY |
4882 | SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4883 | SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
c60666bd | 4884 | SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
8a02b164 KY |
4885 | SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4886 | SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
4887 | SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
4888 | SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
7bba2157 | 4889 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
3e0d611b DH |
4890 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4891 | SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | |
2cede303 | 4892 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), |
23870831 | 4893 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), |
3e0d611b | 4894 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
017f2a10 | 4895 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
693b613d | 4896 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), |
3e0d611b | 4897 | SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
adabb3ec TI |
4898 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), |
4899 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), | |
4900 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), | |
4901 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), | |
d240d1dc | 4902 | SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101), |
f88abaa0 | 4903 | SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), |
88cfcf86 | 4904 | SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), |
1d045db9 TI |
4905 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
4906 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | |
4907 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | |
e9bd7d5c | 4908 | SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX), |
24519911 | 4909 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), |
2041d564 | 4910 | SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), |
a33cc48d | 4911 | SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), |
9dc12862 | 4912 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC), |
1d045db9 TI |
4913 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
4914 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), | |
4915 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | |
4916 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), | |
4917 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), | |
707fba3f | 4918 | SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK), |
c8415a48 | 4919 | SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK), |
84f98fdf | 4920 | SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK), |
4407be6b | 4921 | SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), |
108cc108 | 4922 | SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), |
aaedfb47 | 4923 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), |
1c37c223 TI |
4924 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), |
4925 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), | |
a12137e7 | 4926 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), |
6d16941a | 4927 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), |
7c21539c | 4928 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK), |
a4a9e082 | 4929 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
fedb2245 | 4930 | SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), |
9b745ab8 | 4931 | SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), |
a4a9e082 | 4932 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
1bb3e062 | 4933 | SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), |
c497d9f9 | 4934 | SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK), |
cd5302c0 DH |
4935 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4936 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | |
012e7eb1 | 4937 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
1d045db9 | 4938 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
02b504d9 | 4939 | SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ |
a4297b5d | 4940 | |
a7f3eedc | 4941 | #if 0 |
a4297b5d TI |
4942 | /* Below is a quirk table taken from the old code. |
4943 | * Basically the device should work as is without the fixup table. | |
4944 | * If BIOS doesn't give a proper info, enable the corresponding | |
4945 | * fixup entry. | |
7d7eb9ea | 4946 | */ |
a4297b5d TI |
4947 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
4948 | ALC269_FIXUP_AMIC), | |
4949 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), | |
a4297b5d TI |
4950 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC), |
4951 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC), | |
4952 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC), | |
4953 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC), | |
4954 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC), | |
4955 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC), | |
4956 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC), | |
4957 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC), | |
4958 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC), | |
4959 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC), | |
4960 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC), | |
4961 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC), | |
4962 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC), | |
4963 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC), | |
4964 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC), | |
4965 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC), | |
4966 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC), | |
4967 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC), | |
4968 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC), | |
4969 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC), | |
4970 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC), | |
4971 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC), | |
4972 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC), | |
4973 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC), | |
4974 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC), | |
4975 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC), | |
4976 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC), | |
4977 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC), | |
4978 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC), | |
4979 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC), | |
4980 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC), | |
4981 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC), | |
4982 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC), | |
4983 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC), | |
4984 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC), | |
4985 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC), | |
4986 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC), | |
4987 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC), | |
4988 | #endif | |
4989 | {} | |
4990 | }; | |
4991 | ||
214eef76 DH |
4992 | static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = { |
4993 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), | |
4994 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), | |
4995 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | |
4996 | SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI), | |
4997 | {} | |
4998 | }; | |
4999 | ||
1727a771 | 5000 | static const struct hda_model_fixup alc269_fixup_models[] = { |
a4297b5d TI |
5001 | {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"}, |
5002 | {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"}, | |
6e72aa5f TI |
5003 | {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"}, |
5004 | {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"}, | |
5005 | {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"}, | |
7c478f03 | 5006 | {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"}, |
108cc108 | 5007 | {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"}, |
9f5c6faf | 5008 | {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, |
e32aa85a DH |
5009 | {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, |
5010 | {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, | |
be8ef16a | 5011 | {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, |
0202e99c | 5012 | {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, |
1c37c223 | 5013 | {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"}, |
1d045db9 | 5014 | {} |
6dda9f4a KY |
5015 | }; |
5016 | ||
fea185e2 DH |
5017 | #define ALC255_STANDARD_PINS \ |
5018 | {0x18, 0x411111f0}, \ | |
5019 | {0x19, 0x411111f0}, \ | |
5020 | {0x1a, 0x411111f0}, \ | |
5021 | {0x1b, 0x411111f0}, \ | |
5022 | {0x1e, 0x411111f0} | |
5023 | ||
5024 | #define ALC282_STANDARD_PINS \ | |
5025 | {0x14, 0x90170110}, \ | |
5026 | {0x18, 0x411111f0}, \ | |
5027 | {0x1a, 0x411111f0}, \ | |
5028 | {0x1b, 0x411111f0}, \ | |
5029 | {0x1e, 0x411111f0} | |
5030 | ||
5031 | #define ALC290_STANDARD_PINS \ | |
5032 | {0x12, 0x99a30130}, \ | |
5033 | {0x13, 0x40000000}, \ | |
5034 | {0x16, 0x411111f0}, \ | |
5035 | {0x17, 0x411111f0}, \ | |
5036 | {0x19, 0x411111f0}, \ | |
5037 | {0x1b, 0x411111f0}, \ | |
5038 | {0x1e, 0x411111f0} | |
5039 | ||
5040 | #define ALC292_STANDARD_PINS \ | |
5041 | {0x14, 0x90170110}, \ | |
5042 | {0x15, 0x0221401f}, \ | |
5043 | {0x1a, 0x411111f0}, \ | |
5044 | {0x1b, 0x411111f0}, \ | |
5045 | {0x1d, 0x40700001}, \ | |
5046 | {0x1e, 0x411111f0} | |
5047 | ||
e1918938 | 5048 | static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
c77900e6 | 5049 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, |
aec856d0 | 5050 | ALC255_STANDARD_PINS, |
c77900e6 HW |
5051 | {0x12, 0x40300000}, |
5052 | {0x14, 0x90170110}, | |
5053 | {0x17, 0x411111f0}, | |
c77900e6 | 5054 | {0x1d, 0x40538029}, |
c77900e6 | 5055 | {0x21, 0x02211020}), |
76c2132e | 5056 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5057 | ALC255_STANDARD_PINS, |
76c2132e DH |
5058 | {0x12, 0x90a60140}, |
5059 | {0x14, 0x90170110}, | |
5060 | {0x17, 0x40000000}, | |
76c2132e | 5061 | {0x1d, 0x40700001}, |
76c2132e DH |
5062 | {0x21, 0x02211020}), |
5063 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5064 | ALC255_STANDARD_PINS, |
76c2132e DH |
5065 | {0x12, 0x90a60160}, |
5066 | {0x14, 0x90170120}, | |
5067 | {0x17, 0x40000000}, | |
76c2132e | 5068 | {0x1d, 0x40700001}, |
76c2132e DH |
5069 | {0x21, 0x02211030}), |
5070 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
5071 | {0x12, 0x90a60160}, | |
5072 | {0x14, 0x90170120}, | |
5073 | {0x17, 0x90170140}, | |
5074 | {0x18, 0x40000000}, | |
5075 | {0x19, 0x411111f0}, | |
5076 | {0x1a, 0x411111f0}, | |
5077 | {0x1b, 0x411111f0}, | |
5078 | {0x1d, 0x41163b05}, | |
5079 | {0x1e, 0x411111f0}, | |
5080 | {0x21, 0x0321102f}), | |
5081 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5082 | ALC255_STANDARD_PINS, |
76c2132e DH |
5083 | {0x12, 0x90a60160}, |
5084 | {0x14, 0x90170130}, | |
5085 | {0x17, 0x40000000}, | |
76c2132e | 5086 | {0x1d, 0x40700001}, |
76c2132e DH |
5087 | {0x21, 0x02211040}), |
5088 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5089 | ALC255_STANDARD_PINS, |
76c2132e DH |
5090 | {0x12, 0x90a60160}, |
5091 | {0x14, 0x90170140}, | |
5092 | {0x17, 0x40000000}, | |
76c2132e | 5093 | {0x1d, 0x40700001}, |
76c2132e DH |
5094 | {0x21, 0x02211050}), |
5095 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5096 | ALC255_STANDARD_PINS, |
76c2132e DH |
5097 | {0x12, 0x90a60170}, |
5098 | {0x14, 0x90170120}, | |
5099 | {0x17, 0x40000000}, | |
76c2132e | 5100 | {0x1d, 0x40700001}, |
76c2132e DH |
5101 | {0x21, 0x02211030}), |
5102 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5103 | ALC255_STANDARD_PINS, |
76c2132e DH |
5104 | {0x12, 0x90a60170}, |
5105 | {0x14, 0x90170130}, | |
5106 | {0x17, 0x40000000}, | |
76c2132e | 5107 | {0x1d, 0x40700001}, |
76c2132e | 5108 | {0x21, 0x02211040}), |
cf51eb9d DH |
5109 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, |
5110 | {0x12, 0x90a60130}, | |
5111 | {0x13, 0x40000000}, | |
5112 | {0x14, 0x90170110}, | |
5113 | {0x15, 0x0421101f}, | |
5114 | {0x16, 0x411111f0}, | |
5115 | {0x17, 0x411111f0}, | |
5116 | {0x18, 0x411111f0}, | |
5117 | {0x19, 0x411111f0}, | |
5118 | {0x1a, 0x04a11020}, | |
5119 | {0x1b, 0x411111f0}, | |
5120 | {0x1d, 0x40748605}, | |
5121 | {0x1e, 0x411111f0}), | |
0279661b HW |
5122 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED, |
5123 | {0x12, 0x90a60140}, | |
5124 | {0x13, 0x40000000}, | |
5125 | {0x14, 0x90170110}, | |
5126 | {0x15, 0x0421101f}, | |
5127 | {0x16, 0x411111f0}, | |
5128 | {0x17, 0x411111f0}, | |
5129 | {0x18, 0x02811030}, | |
5130 | {0x19, 0x411111f0}, | |
5131 | {0x1a, 0x04a1103f}, | |
5132 | {0x1b, 0x02011020}, | |
5133 | {0x1d, 0x40700001}, | |
5134 | {0x1e, 0x411111f0}), | |
42304474 | 5135 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5136 | ALC282_STANDARD_PINS, |
42304474 | 5137 | {0x12, 0x99a30130}, |
42304474 | 5138 | {0x17, 0x40000000}, |
42304474 | 5139 | {0x19, 0x03a11020}, |
42304474 | 5140 | {0x1d, 0x40f41905}, |
42304474 | 5141 | {0x21, 0x0321101f}), |
2c609999 | 5142 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5143 | ALC282_STANDARD_PINS, |
2c609999 | 5144 | {0x12, 0x99a30130}, |
2c609999 | 5145 | {0x17, 0x40020008}, |
2c609999 | 5146 | {0x19, 0x03a11020}, |
2c609999 | 5147 | {0x1d, 0x40e00001}, |
2c609999 HW |
5148 | {0x21, 0x03211040}), |
5149 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
aec856d0 | 5150 | ALC282_STANDARD_PINS, |
2c609999 | 5151 | {0x12, 0x99a30130}, |
2c609999 | 5152 | {0x17, 0x40000000}, |
2c609999 | 5153 | {0x19, 0x03a11030}, |
2c609999 | 5154 | {0x1d, 0x40e00001}, |
2c609999 HW |
5155 | {0x21, 0x03211020}), |
5156 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
aec856d0 | 5157 | ALC282_STANDARD_PINS, |
2c609999 | 5158 | {0x12, 0x99a30130}, |
2c609999 | 5159 | {0x17, 0x40000000}, |
2c609999 | 5160 | {0x19, 0x03a11030}, |
2c609999 | 5161 | {0x1d, 0x40f00001}, |
2c609999 HW |
5162 | {0x21, 0x03211020}), |
5163 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
aec856d0 | 5164 | ALC282_STANDARD_PINS, |
2c609999 | 5165 | {0x12, 0x99a30130}, |
2c609999 | 5166 | {0x17, 0x40000000}, |
2c609999 | 5167 | {0x19, 0x04a11020}, |
2c609999 | 5168 | {0x1d, 0x40f00001}, |
2c609999 HW |
5169 | {0x21, 0x0421101f}), |
5170 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
aec856d0 | 5171 | ALC282_STANDARD_PINS, |
2c609999 | 5172 | {0x12, 0x99a30130}, |
2c609999 | 5173 | {0x17, 0x40000000}, |
2c609999 | 5174 | {0x19, 0x03a11030}, |
2c609999 | 5175 | {0x1d, 0x40f00001}, |
2c609999 | 5176 | {0x21, 0x04211020}), |
200afc09 | 5177 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED, |
aec856d0 | 5178 | ALC282_STANDARD_PINS, |
200afc09 | 5179 | {0x12, 0x90a60140}, |
200afc09 | 5180 | {0x17, 0x40000000}, |
200afc09 | 5181 | {0x19, 0x04a11030}, |
200afc09 | 5182 | {0x1d, 0x40f00001}, |
200afc09 | 5183 | {0x21, 0x04211020}), |
76c2132e | 5184 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5185 | ALC282_STANDARD_PINS, |
76c2132e | 5186 | {0x12, 0x90a60130}, |
76c2132e | 5187 | {0x17, 0x40020008}, |
76c2132e | 5188 | {0x19, 0x411111f0}, |
76c2132e | 5189 | {0x1d, 0x40e00001}, |
76c2132e DH |
5190 | {0x21, 0x0321101f}), |
5191 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | |
5192 | {0x12, 0x90a60160}, | |
5193 | {0x14, 0x90170120}, | |
5194 | {0x17, 0x40000000}, | |
5195 | {0x18, 0x411111f0}, | |
5196 | {0x19, 0x411111f0}, | |
5197 | {0x1a, 0x411111f0}, | |
5198 | {0x1b, 0x411111f0}, | |
5199 | {0x1d, 0x40700001}, | |
5200 | {0x1e, 0x411111f0}, | |
5201 | {0x21, 0x02211030}), | |
bc262179 | 5202 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5203 | ALC282_STANDARD_PINS, |
bc262179 | 5204 | {0x12, 0x90a60130}, |
bc262179 | 5205 | {0x17, 0x40020008}, |
bc262179 | 5206 | {0x19, 0x03a11020}, |
bc262179 | 5207 | {0x1d, 0x40e00001}, |
bc262179 | 5208 | {0x21, 0x0321101f}), |
e4442bcf | 5209 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5210 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5211 | {0x14, 0x411111f0}, |
5212 | {0x15, 0x04211040}, | |
e4442bcf | 5213 | {0x18, 0x90170112}, |
e4442bcf | 5214 | {0x1a, 0x04a11020}, |
aec856d0 | 5215 | {0x1d, 0x4075812d}), |
e4442bcf | 5216 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5217 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5218 | {0x14, 0x411111f0}, |
5219 | {0x15, 0x04211040}, | |
e4442bcf | 5220 | {0x18, 0x90170110}, |
e4442bcf | 5221 | {0x1a, 0x04a11020}, |
aec856d0 | 5222 | {0x1d, 0x4075812d}), |
e4442bcf | 5223 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5224 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5225 | {0x14, 0x411111f0}, |
5226 | {0x15, 0x0421101f}, | |
e4442bcf | 5227 | {0x18, 0x411111f0}, |
e4442bcf | 5228 | {0x1a, 0x04a11020}, |
aec856d0 | 5229 | {0x1d, 0x4075812d}), |
e4442bcf | 5230 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5231 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5232 | {0x14, 0x411111f0}, |
5233 | {0x15, 0x04211020}, | |
e4442bcf | 5234 | {0x18, 0x411111f0}, |
e4442bcf | 5235 | {0x1a, 0x04a11040}, |
aec856d0 | 5236 | {0x1d, 0x4076a12d}), |
e4442bcf | 5237 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5238 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5239 | {0x14, 0x90170110}, |
5240 | {0x15, 0x04211020}, | |
e4442bcf | 5241 | {0x18, 0x411111f0}, |
e4442bcf | 5242 | {0x1a, 0x04a11040}, |
aec856d0 | 5243 | {0x1d, 0x4076a12d}), |
e4442bcf | 5244 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5245 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5246 | {0x14, 0x90170110}, |
5247 | {0x15, 0x04211020}, | |
e4442bcf | 5248 | {0x18, 0x411111f0}, |
e4442bcf | 5249 | {0x1a, 0x04a11020}, |
aec856d0 | 5250 | {0x1d, 0x4076a12d}), |
e4442bcf | 5251 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5252 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5253 | {0x14, 0x90170110}, |
5254 | {0x15, 0x0421101f}, | |
e4442bcf | 5255 | {0x18, 0x411111f0}, |
e4442bcf | 5256 | {0x1a, 0x04a11020}, |
aec856d0 | 5257 | {0x1d, 0x4075812d}), |
e8818fa8 | 5258 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, |
aec856d0 | 5259 | ALC292_STANDARD_PINS, |
e8818fa8 HW |
5260 | {0x12, 0x90a60140}, |
5261 | {0x13, 0x411111f0}, | |
e8818fa8 HW |
5262 | {0x16, 0x01014020}, |
5263 | {0x18, 0x411111f0}, | |
aec856d0 | 5264 | {0x19, 0x01a19030}), |
e8818fa8 | 5265 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, |
aec856d0 | 5266 | ALC292_STANDARD_PINS, |
e8818fa8 HW |
5267 | {0x12, 0x90a60140}, |
5268 | {0x13, 0x411111f0}, | |
e8818fa8 HW |
5269 | {0x16, 0x01014020}, |
5270 | {0x18, 0x02a19031}, | |
aec856d0 | 5271 | {0x19, 0x01a1903e}), |
76c2132e | 5272 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
aec856d0 | 5273 | ALC292_STANDARD_PINS, |
76c2132e DH |
5274 | {0x12, 0x90a60140}, |
5275 | {0x13, 0x411111f0}, | |
76c2132e DH |
5276 | {0x16, 0x411111f0}, |
5277 | {0x18, 0x411111f0}, | |
aec856d0 | 5278 | {0x19, 0x411111f0}), |
76c2132e | 5279 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5280 | ALC292_STANDARD_PINS, |
76c2132e DH |
5281 | {0x12, 0x40000000}, |
5282 | {0x13, 0x90a60140}, | |
76c2132e DH |
5283 | {0x16, 0x21014020}, |
5284 | {0x18, 0x411111f0}, | |
aec856d0 | 5285 | {0x19, 0x21a19030}), |
e03fdbde | 5286 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5287 | ALC292_STANDARD_PINS, |
e03fdbde DH |
5288 | {0x12, 0x40000000}, |
5289 | {0x13, 0x90a60140}, | |
e03fdbde DH |
5290 | {0x16, 0x411111f0}, |
5291 | {0x18, 0x411111f0}, | |
aec856d0 | 5292 | {0x19, 0x411111f0}), |
e1918938 HW |
5293 | {} |
5294 | }; | |
6dda9f4a | 5295 | |
546bb678 | 5296 | static void alc269_fill_coef(struct hda_codec *codec) |
1d045db9 | 5297 | { |
526af6eb | 5298 | struct alc_spec *spec = codec->spec; |
1d045db9 | 5299 | int val; |
ebb83eeb | 5300 | |
526af6eb | 5301 | if (spec->codec_variant != ALC269_TYPE_ALC269VB) |
546bb678 | 5302 | return; |
526af6eb | 5303 | |
1bb7e43e | 5304 | if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { |
1d045db9 TI |
5305 | alc_write_coef_idx(codec, 0xf, 0x960b); |
5306 | alc_write_coef_idx(codec, 0xe, 0x8817); | |
5307 | } | |
ebb83eeb | 5308 | |
1bb7e43e | 5309 | if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { |
1d045db9 TI |
5310 | alc_write_coef_idx(codec, 0xf, 0x960b); |
5311 | alc_write_coef_idx(codec, 0xe, 0x8814); | |
5312 | } | |
ebb83eeb | 5313 | |
1bb7e43e | 5314 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { |
1d045db9 | 5315 | /* Power up output pin */ |
98b24883 | 5316 | alc_update_coef_idx(codec, 0x04, 0, 1<<11); |
1d045db9 | 5317 | } |
ebb83eeb | 5318 | |
1bb7e43e | 5319 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
1d045db9 | 5320 | val = alc_read_coef_idx(codec, 0xd); |
f3ee07d8 | 5321 | if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { |
1d045db9 TI |
5322 | /* Capless ramp up clock control */ |
5323 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); | |
5324 | } | |
5325 | val = alc_read_coef_idx(codec, 0x17); | |
f3ee07d8 | 5326 | if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { |
1d045db9 TI |
5327 | /* Class D power on reset */ |
5328 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); | |
5329 | } | |
5330 | } | |
ebb83eeb | 5331 | |
98b24883 TI |
5332 | /* HP */ |
5333 | alc_update_coef_idx(codec, 0x4, 0, 1<<11); | |
1d045db9 | 5334 | } |
a7f2371f | 5335 | |
1d045db9 TI |
5336 | /* |
5337 | */ | |
1d045db9 TI |
5338 | static int patch_alc269(struct hda_codec *codec) |
5339 | { | |
5340 | struct alc_spec *spec; | |
3de95173 | 5341 | int err; |
f1d4e28b | 5342 | |
3de95173 | 5343 | err = alc_alloc_spec(codec, 0x0b); |
e16fb6d1 | 5344 | if (err < 0) |
3de95173 TI |
5345 | return err; |
5346 | ||
5347 | spec = codec->spec; | |
08c189f2 | 5348 | spec->gen.shared_mic_vref_pin = 0x18; |
e16fb6d1 | 5349 | |
1727a771 | 5350 | snd_hda_pick_fixup(codec, alc269_fixup_models, |
9f720bb9 | 5351 | alc269_fixup_tbl, alc269_fixups); |
e1918938 | 5352 | snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups); |
214eef76 DH |
5353 | snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, |
5354 | alc269_fixups); | |
1727a771 | 5355 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
9f720bb9 HRK |
5356 | |
5357 | alc_auto_parse_customize_define(codec); | |
5358 | ||
7504b6cd TI |
5359 | if (has_cdefine_beep(codec)) |
5360 | spec->gen.beep_nid = 0x01; | |
5361 | ||
065380f0 KY |
5362 | switch (codec->vendor_id) { |
5363 | case 0x10ec0269: | |
1d045db9 | 5364 | spec->codec_variant = ALC269_TYPE_ALC269VA; |
1bb7e43e TI |
5365 | switch (alc_get_coef0(codec) & 0x00f0) { |
5366 | case 0x0010: | |
5100cd07 TI |
5367 | if (codec->bus->pci && |
5368 | codec->bus->pci->subsystem_vendor == 0x1025 && | |
e16fb6d1 | 5369 | spec->cdefine.platform_type == 1) |
20ca0c35 | 5370 | err = alc_codec_rename(codec, "ALC271X"); |
1d045db9 | 5371 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
1bb7e43e TI |
5372 | break; |
5373 | case 0x0020: | |
5100cd07 TI |
5374 | if (codec->bus->pci && |
5375 | codec->bus->pci->subsystem_vendor == 0x17aa && | |
e16fb6d1 | 5376 | codec->bus->pci->subsystem_device == 0x21f3) |
20ca0c35 | 5377 | err = alc_codec_rename(codec, "ALC3202"); |
1d045db9 | 5378 | spec->codec_variant = ALC269_TYPE_ALC269VC; |
1bb7e43e | 5379 | break; |
adcc70b2 KY |
5380 | case 0x0030: |
5381 | spec->codec_variant = ALC269_TYPE_ALC269VD; | |
5382 | break; | |
1bb7e43e | 5383 | default: |
1d045db9 | 5384 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
1bb7e43e | 5385 | } |
e16fb6d1 TI |
5386 | if (err < 0) |
5387 | goto error; | |
546bb678 | 5388 | spec->init_hook = alc269_fill_coef; |
1d045db9 | 5389 | alc269_fill_coef(codec); |
065380f0 KY |
5390 | break; |
5391 | ||
5392 | case 0x10ec0280: | |
5393 | case 0x10ec0290: | |
5394 | spec->codec_variant = ALC269_TYPE_ALC280; | |
5395 | break; | |
5396 | case 0x10ec0282: | |
065380f0 | 5397 | spec->codec_variant = ALC269_TYPE_ALC282; |
7b5c7a02 KY |
5398 | spec->shutup = alc282_shutup; |
5399 | spec->init_hook = alc282_init; | |
065380f0 | 5400 | break; |
2af02be7 KY |
5401 | case 0x10ec0233: |
5402 | case 0x10ec0283: | |
5403 | spec->codec_variant = ALC269_TYPE_ALC283; | |
5404 | spec->shutup = alc283_shutup; | |
5405 | spec->init_hook = alc283_init; | |
5406 | break; | |
065380f0 KY |
5407 | case 0x10ec0284: |
5408 | case 0x10ec0292: | |
5409 | spec->codec_variant = ALC269_TYPE_ALC284; | |
5410 | break; | |
161ebf29 KY |
5411 | case 0x10ec0285: |
5412 | case 0x10ec0293: | |
5413 | spec->codec_variant = ALC269_TYPE_ALC285; | |
5414 | break; | |
7fc7d047 | 5415 | case 0x10ec0286: |
7c665932 | 5416 | case 0x10ec0288: |
7fc7d047 | 5417 | spec->codec_variant = ALC269_TYPE_ALC286; |
f7ae9ba0 | 5418 | spec->shutup = alc286_shutup; |
7fc7d047 | 5419 | break; |
1d04c9de KY |
5420 | case 0x10ec0255: |
5421 | spec->codec_variant = ALC269_TYPE_ALC255; | |
5422 | break; | |
1d045db9 | 5423 | } |
6dda9f4a | 5424 | |
ad60d502 | 5425 | if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { |
97a26570 | 5426 | spec->has_alc5505_dsp = 1; |
ad60d502 KY |
5427 | spec->init_hook = alc5505_dsp_init; |
5428 | } | |
5429 | ||
a4297b5d TI |
5430 | /* automatic parse from the BIOS config */ |
5431 | err = alc269_parse_auto_config(codec); | |
e16fb6d1 TI |
5432 | if (err < 0) |
5433 | goto error; | |
6dda9f4a | 5434 | |
7504b6cd | 5435 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
1d045db9 | 5436 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
f1d4e28b | 5437 | |
1d045db9 | 5438 | codec->patch_ops = alc_patch_ops; |
2a43952a | 5439 | #ifdef CONFIG_PM |
ad60d502 | 5440 | codec->patch_ops.suspend = alc269_suspend; |
1d045db9 TI |
5441 | codec->patch_ops.resume = alc269_resume; |
5442 | #endif | |
c5177c86 KY |
5443 | if (!spec->shutup) |
5444 | spec->shutup = alc269_shutup; | |
ebb83eeb | 5445 | |
1727a771 | 5446 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 5447 | |
1d045db9 | 5448 | return 0; |
e16fb6d1 TI |
5449 | |
5450 | error: | |
5451 | alc_free(codec); | |
5452 | return err; | |
1d045db9 | 5453 | } |
f1d4e28b | 5454 | |
1d045db9 TI |
5455 | /* |
5456 | * ALC861 | |
5457 | */ | |
622e84cd | 5458 | |
1d045db9 | 5459 | static int alc861_parse_auto_config(struct hda_codec *codec) |
6dda9f4a | 5460 | { |
1d045db9 | 5461 | static const hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
5462 | static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 }; |
5463 | return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); | |
604401a9 TI |
5464 | } |
5465 | ||
1d045db9 TI |
5466 | /* Pin config fixes */ |
5467 | enum { | |
e652f4c8 TI |
5468 | ALC861_FIXUP_FSC_AMILO_PI1505, |
5469 | ALC861_FIXUP_AMP_VREF_0F, | |
5470 | ALC861_FIXUP_NO_JACK_DETECT, | |
5471 | ALC861_FIXUP_ASUS_A6RP, | |
6ddf0fd1 | 5472 | ALC660_FIXUP_ASUS_W7J, |
1d045db9 | 5473 | }; |
7085ec12 | 5474 | |
31150f23 TI |
5475 | /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */ |
5476 | static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, | |
1727a771 | 5477 | const struct hda_fixup *fix, int action) |
31150f23 TI |
5478 | { |
5479 | struct alc_spec *spec = codec->spec; | |
5480 | unsigned int val; | |
5481 | ||
1727a771 | 5482 | if (action != HDA_FIXUP_ACT_INIT) |
31150f23 | 5483 | return; |
d3f02d60 | 5484 | val = snd_hda_codec_get_pin_target(codec, 0x0f); |
31150f23 TI |
5485 | if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))) |
5486 | val |= AC_PINCTL_IN_EN; | |
5487 | val |= AC_PINCTL_VREF_50; | |
cdd03ced | 5488 | snd_hda_set_pin_ctl(codec, 0x0f, val); |
08c189f2 | 5489 | spec->gen.keep_vref_in_automute = 1; |
31150f23 TI |
5490 | } |
5491 | ||
e652f4c8 TI |
5492 | /* suppress the jack-detection */ |
5493 | static void alc_fixup_no_jack_detect(struct hda_codec *codec, | |
1727a771 | 5494 | const struct hda_fixup *fix, int action) |
e652f4c8 | 5495 | { |
1727a771 | 5496 | if (action == HDA_FIXUP_ACT_PRE_PROBE) |
e652f4c8 | 5497 | codec->no_jack_detect = 1; |
7d7eb9ea | 5498 | } |
e652f4c8 | 5499 | |
1727a771 | 5500 | static const struct hda_fixup alc861_fixups[] = { |
e652f4c8 | 5501 | [ALC861_FIXUP_FSC_AMILO_PI1505] = { |
1727a771 TI |
5502 | .type = HDA_FIXUP_PINS, |
5503 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
5504 | { 0x0b, 0x0221101f }, /* HP */ |
5505 | { 0x0f, 0x90170310 }, /* speaker */ | |
5506 | { } | |
5507 | } | |
5508 | }, | |
e652f4c8 | 5509 | [ALC861_FIXUP_AMP_VREF_0F] = { |
1727a771 | 5510 | .type = HDA_FIXUP_FUNC, |
31150f23 | 5511 | .v.func = alc861_fixup_asus_amp_vref_0f, |
3b25eb69 | 5512 | }, |
e652f4c8 | 5513 | [ALC861_FIXUP_NO_JACK_DETECT] = { |
1727a771 | 5514 | .type = HDA_FIXUP_FUNC, |
e652f4c8 TI |
5515 | .v.func = alc_fixup_no_jack_detect, |
5516 | }, | |
5517 | [ALC861_FIXUP_ASUS_A6RP] = { | |
1727a771 | 5518 | .type = HDA_FIXUP_FUNC, |
e652f4c8 TI |
5519 | .v.func = alc861_fixup_asus_amp_vref_0f, |
5520 | .chained = true, | |
5521 | .chain_id = ALC861_FIXUP_NO_JACK_DETECT, | |
6ddf0fd1 TI |
5522 | }, |
5523 | [ALC660_FIXUP_ASUS_W7J] = { | |
5524 | .type = HDA_FIXUP_VERBS, | |
5525 | .v.verbs = (const struct hda_verb[]) { | |
5526 | /* ASUS W7J needs a magic pin setup on unused NID 0x10 | |
5527 | * for enabling outputs | |
5528 | */ | |
5529 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5530 | { } | |
5531 | }, | |
e652f4c8 | 5532 | } |
1d045db9 | 5533 | }; |
7085ec12 | 5534 | |
1d045db9 | 5535 | static const struct snd_pci_quirk alc861_fixup_tbl[] = { |
6ddf0fd1 | 5536 | SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J), |
e7ca237b | 5537 | SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J), |
e652f4c8 TI |
5538 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP), |
5539 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F), | |
5540 | SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT), | |
5541 | SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F), | |
5542 | SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F), | |
5543 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505), | |
1d045db9 TI |
5544 | {} |
5545 | }; | |
3af9ee6b | 5546 | |
1d045db9 TI |
5547 | /* |
5548 | */ | |
1d045db9 | 5549 | static int patch_alc861(struct hda_codec *codec) |
7085ec12 | 5550 | { |
1d045db9 | 5551 | struct alc_spec *spec; |
1d045db9 | 5552 | int err; |
7085ec12 | 5553 | |
3de95173 TI |
5554 | err = alc_alloc_spec(codec, 0x15); |
5555 | if (err < 0) | |
5556 | return err; | |
1d045db9 | 5557 | |
3de95173 | 5558 | spec = codec->spec; |
7504b6cd | 5559 | spec->gen.beep_nid = 0x23; |
1d045db9 | 5560 | |
1727a771 TI |
5561 | snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
5562 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | |
3af9ee6b | 5563 | |
cb4e4824 TI |
5564 | /* automatic parse from the BIOS config */ |
5565 | err = alc861_parse_auto_config(codec); | |
e16fb6d1 TI |
5566 | if (err < 0) |
5567 | goto error; | |
3af9ee6b | 5568 | |
7504b6cd | 5569 | if (!spec->gen.no_analog) |
3e6179b8 | 5570 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
7085ec12 | 5571 | |
1d045db9 | 5572 | codec->patch_ops = alc_patch_ops; |
83012a7c | 5573 | #ifdef CONFIG_PM |
cb4e4824 | 5574 | spec->power_hook = alc_power_eapd; |
1d045db9 TI |
5575 | #endif |
5576 | ||
1727a771 | 5577 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 5578 | |
1d045db9 | 5579 | return 0; |
e16fb6d1 TI |
5580 | |
5581 | error: | |
5582 | alc_free(codec); | |
5583 | return err; | |
7085ec12 TI |
5584 | } |
5585 | ||
1d045db9 TI |
5586 | /* |
5587 | * ALC861-VD support | |
5588 | * | |
5589 | * Based on ALC882 | |
5590 | * | |
5591 | * In addition, an independent DAC | |
5592 | */ | |
1d045db9 | 5593 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
bc9f98a9 | 5594 | { |
1d045db9 | 5595 | static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
5596 | static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
5597 | return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); | |
ce764ab2 TI |
5598 | } |
5599 | ||
1d045db9 | 5600 | enum { |
8fdcb6fe TI |
5601 | ALC660VD_FIX_ASUS_GPIO1, |
5602 | ALC861VD_FIX_DALLAS, | |
1d045db9 | 5603 | }; |
ce764ab2 | 5604 | |
8fdcb6fe TI |
5605 | /* exclude VREF80 */ |
5606 | static void alc861vd_fixup_dallas(struct hda_codec *codec, | |
1727a771 | 5607 | const struct hda_fixup *fix, int action) |
8fdcb6fe | 5608 | { |
1727a771 | 5609 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
b78562b1 TI |
5610 | snd_hda_override_pin_caps(codec, 0x18, 0x00000734); |
5611 | snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); | |
8fdcb6fe TI |
5612 | } |
5613 | } | |
5614 | ||
1727a771 | 5615 | static const struct hda_fixup alc861vd_fixups[] = { |
1d045db9 | 5616 | [ALC660VD_FIX_ASUS_GPIO1] = { |
1727a771 | 5617 | .type = HDA_FIXUP_VERBS, |
1d045db9 | 5618 | .v.verbs = (const struct hda_verb[]) { |
8fdcb6fe | 5619 | /* reset GPIO1 */ |
1d045db9 TI |
5620 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
5621 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
5622 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
5623 | { } | |
5624 | } | |
5625 | }, | |
8fdcb6fe | 5626 | [ALC861VD_FIX_DALLAS] = { |
1727a771 | 5627 | .type = HDA_FIXUP_FUNC, |
8fdcb6fe TI |
5628 | .v.func = alc861vd_fixup_dallas, |
5629 | }, | |
1d045db9 | 5630 | }; |
ce764ab2 | 5631 | |
1d045db9 | 5632 | static const struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
8fdcb6fe | 5633 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS), |
1d045db9 | 5634 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
8fdcb6fe | 5635 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS), |
1d045db9 TI |
5636 | {} |
5637 | }; | |
ce764ab2 | 5638 | |
1d045db9 TI |
5639 | /* |
5640 | */ | |
1d045db9 | 5641 | static int patch_alc861vd(struct hda_codec *codec) |
ce764ab2 | 5642 | { |
1d045db9 | 5643 | struct alc_spec *spec; |
cb4e4824 | 5644 | int err; |
ce764ab2 | 5645 | |
3de95173 TI |
5646 | err = alc_alloc_spec(codec, 0x0b); |
5647 | if (err < 0) | |
5648 | return err; | |
1d045db9 | 5649 | |
3de95173 | 5650 | spec = codec->spec; |
7504b6cd | 5651 | spec->gen.beep_nid = 0x23; |
1d045db9 | 5652 | |
1727a771 TI |
5653 | snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
5654 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | |
1d045db9 | 5655 | |
cb4e4824 TI |
5656 | /* automatic parse from the BIOS config */ |
5657 | err = alc861vd_parse_auto_config(codec); | |
e16fb6d1 TI |
5658 | if (err < 0) |
5659 | goto error; | |
ce764ab2 | 5660 | |
7504b6cd | 5661 | if (!spec->gen.no_analog) |
3e6179b8 | 5662 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
1d045db9 | 5663 | |
1d045db9 TI |
5664 | codec->patch_ops = alc_patch_ops; |
5665 | ||
1d045db9 | 5666 | spec->shutup = alc_eapd_shutup; |
1d045db9 | 5667 | |
1727a771 | 5668 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 5669 | |
ce764ab2 | 5670 | return 0; |
e16fb6d1 TI |
5671 | |
5672 | error: | |
5673 | alc_free(codec); | |
5674 | return err; | |
ce764ab2 TI |
5675 | } |
5676 | ||
1d045db9 TI |
5677 | /* |
5678 | * ALC662 support | |
5679 | * | |
5680 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
5681 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
5682 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
5683 | * 6-channel independent captures. | |
5684 | * | |
5685 | * In addition, an independent DAC for the multi-playback (not used in this | |
5686 | * driver yet). | |
5687 | */ | |
1d045db9 TI |
5688 | |
5689 | /* | |
5690 | * BIOS auto configuration | |
5691 | */ | |
5692 | ||
bc9f98a9 KY |
5693 | static int alc662_parse_auto_config(struct hda_codec *codec) |
5694 | { | |
4c6d72d1 | 5695 | static const hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
5696 | static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 }; |
5697 | static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 }; | |
5698 | const hda_nid_t *ssids; | |
ee979a14 | 5699 | |
6227cdce | 5700 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
1d87caa6 RK |
5701 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 || |
5702 | codec->vendor_id == 0x10ec0671) | |
3e6179b8 | 5703 | ssids = alc663_ssids; |
6227cdce | 5704 | else |
3e6179b8 TI |
5705 | ssids = alc662_ssids; |
5706 | return alc_parse_auto_config(codec, alc662_ignore, ssids); | |
bc9f98a9 KY |
5707 | } |
5708 | ||
6be7948f | 5709 | static void alc272_fixup_mario(struct hda_codec *codec, |
1727a771 | 5710 | const struct hda_fixup *fix, int action) |
6fc398cb | 5711 | { |
9bb1f06f | 5712 | if (action != HDA_FIXUP_ACT_PRE_PROBE) |
6fc398cb | 5713 | return; |
6be7948f TB |
5714 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
5715 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | | |
5716 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
5717 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
5718 | (0 << AC_AMPCAP_MUTE_SHIFT))) | |
4e76a883 | 5719 | codec_warn(codec, "failed to override amp caps for NID 0x2\n"); |
6be7948f TB |
5720 | } |
5721 | ||
8e383953 TI |
5722 | static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = { |
5723 | { .channels = 2, | |
5724 | .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, | |
5725 | { .channels = 4, | |
5726 | .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, | |
5727 | SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */ | |
5728 | { } | |
5729 | }; | |
5730 | ||
5731 | /* override the 2.1 chmap */ | |
eb9ca3ab | 5732 | static void alc_fixup_bass_chmap(struct hda_codec *codec, |
8e383953 TI |
5733 | const struct hda_fixup *fix, int action) |
5734 | { | |
5735 | if (action == HDA_FIXUP_ACT_BUILD) { | |
5736 | struct alc_spec *spec = codec->spec; | |
5737 | spec->gen.pcm_rec[0].stream[0].chmap = asus_pcm_2_1_chmaps; | |
5738 | } | |
5739 | } | |
5740 | ||
bf68665d TI |
5741 | /* avoid D3 for keeping GPIO up */ |
5742 | static unsigned int gpio_led_power_filter(struct hda_codec *codec, | |
5743 | hda_nid_t nid, | |
5744 | unsigned int power_state) | |
5745 | { | |
5746 | struct alc_spec *spec = codec->spec; | |
5747 | if (nid == codec->afg && power_state == AC_PWRST_D3 && spec->gpio_led) | |
5748 | return AC_PWRST_D0; | |
5749 | return power_state; | |
5750 | } | |
5751 | ||
3e887f37 TI |
5752 | static void alc662_fixup_led_gpio1(struct hda_codec *codec, |
5753 | const struct hda_fixup *fix, int action) | |
5754 | { | |
5755 | struct alc_spec *spec = codec->spec; | |
5756 | static const struct hda_verb gpio_init[] = { | |
5757 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 }, | |
5758 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 }, | |
5759 | {} | |
5760 | }; | |
5761 | ||
5762 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
0f32fd19 | 5763 | spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; |
3e887f37 | 5764 | spec->gpio_led = 0; |
0f32fd19 TI |
5765 | spec->mute_led_polarity = 1; |
5766 | spec->gpio_mute_led_mask = 0x01; | |
3e887f37 | 5767 | snd_hda_add_verbs(codec, gpio_init); |
bf68665d | 5768 | codec->power_filter = gpio_led_power_filter; |
3e887f37 TI |
5769 | } |
5770 | } | |
5771 | ||
f3f9185f KY |
5772 | static struct coef_fw alc668_coefs[] = { |
5773 | WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), | |
5774 | WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), | |
5775 | WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0), | |
5776 | WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f), | |
5777 | WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001), | |
5778 | WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940), | |
5779 | WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0), | |
5780 | WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418), | |
5781 | WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468), | |
5782 | WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418), | |
5783 | WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00), | |
5784 | WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000), | |
5785 | WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0), | |
5786 | WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480), | |
5787 | WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0), | |
5788 | WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040), | |
5789 | WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697), | |
5790 | WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab), | |
5791 | WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02), | |
5792 | WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6), | |
5793 | {} | |
5794 | }; | |
5795 | ||
5796 | static void alc668_restore_default_value(struct hda_codec *codec) | |
5797 | { | |
5798 | alc_process_coef_fw(codec, alc668_coefs); | |
5799 | } | |
5800 | ||
6cb3b707 | 5801 | enum { |
2df03514 | 5802 | ALC662_FIXUP_ASPIRE, |
3e887f37 | 5803 | ALC662_FIXUP_LED_GPIO1, |
6cb3b707 | 5804 | ALC662_FIXUP_IDEAPAD, |
6be7948f | 5805 | ALC272_FIXUP_MARIO, |
d2ebd479 | 5806 | ALC662_FIXUP_CZC_P10T, |
94024cd1 | 5807 | ALC662_FIXUP_SKU_IGNORE, |
e59ea3ed | 5808 | ALC662_FIXUP_HP_RP5800, |
53c334ad TI |
5809 | ALC662_FIXUP_ASUS_MODE1, |
5810 | ALC662_FIXUP_ASUS_MODE2, | |
5811 | ALC662_FIXUP_ASUS_MODE3, | |
5812 | ALC662_FIXUP_ASUS_MODE4, | |
5813 | ALC662_FIXUP_ASUS_MODE5, | |
5814 | ALC662_FIXUP_ASUS_MODE6, | |
5815 | ALC662_FIXUP_ASUS_MODE7, | |
5816 | ALC662_FIXUP_ASUS_MODE8, | |
1565cc35 | 5817 | ALC662_FIXUP_NO_JACK_DETECT, |
edfe3bfc | 5818 | ALC662_FIXUP_ZOTAC_Z68, |
125821ae | 5819 | ALC662_FIXUP_INV_DMIC, |
73bdd597 DH |
5820 | ALC668_FIXUP_DELL_MIC_NO_PRESENCE, |
5821 | ALC668_FIXUP_HEADSET_MODE, | |
8e54b4ac | 5822 | ALC662_FIXUP_BASS_MODE4_CHMAP, |
61a75f13 | 5823 | ALC662_FIXUP_BASS_16, |
a30c9aaa | 5824 | ALC662_FIXUP_BASS_1A, |
8e54b4ac | 5825 | ALC662_FIXUP_BASS_CHMAP, |
493a52a9 | 5826 | ALC668_FIXUP_AUTO_MUTE, |
5e6db669 | 5827 | ALC668_FIXUP_DELL_DISABLE_AAMIX, |
033b0a7c | 5828 | ALC668_FIXUP_DELL_XPS13, |
6cb3b707 DH |
5829 | }; |
5830 | ||
1727a771 | 5831 | static const struct hda_fixup alc662_fixups[] = { |
2df03514 | 5832 | [ALC662_FIXUP_ASPIRE] = { |
1727a771 TI |
5833 | .type = HDA_FIXUP_PINS, |
5834 | .v.pins = (const struct hda_pintbl[]) { | |
2df03514 DC |
5835 | { 0x15, 0x99130112 }, /* subwoofer */ |
5836 | { } | |
5837 | } | |
5838 | }, | |
3e887f37 TI |
5839 | [ALC662_FIXUP_LED_GPIO1] = { |
5840 | .type = HDA_FIXUP_FUNC, | |
5841 | .v.func = alc662_fixup_led_gpio1, | |
5842 | }, | |
6cb3b707 | 5843 | [ALC662_FIXUP_IDEAPAD] = { |
1727a771 TI |
5844 | .type = HDA_FIXUP_PINS, |
5845 | .v.pins = (const struct hda_pintbl[]) { | |
6cb3b707 DH |
5846 | { 0x17, 0x99130112 }, /* subwoofer */ |
5847 | { } | |
3e887f37 TI |
5848 | }, |
5849 | .chained = true, | |
5850 | .chain_id = ALC662_FIXUP_LED_GPIO1, | |
6cb3b707 | 5851 | }, |
6be7948f | 5852 | [ALC272_FIXUP_MARIO] = { |
1727a771 | 5853 | .type = HDA_FIXUP_FUNC, |
b5bfbc67 | 5854 | .v.func = alc272_fixup_mario, |
d2ebd479 AA |
5855 | }, |
5856 | [ALC662_FIXUP_CZC_P10T] = { | |
1727a771 | 5857 | .type = HDA_FIXUP_VERBS, |
d2ebd479 AA |
5858 | .v.verbs = (const struct hda_verb[]) { |
5859 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, | |
5860 | {} | |
5861 | } | |
5862 | }, | |
94024cd1 | 5863 | [ALC662_FIXUP_SKU_IGNORE] = { |
1727a771 | 5864 | .type = HDA_FIXUP_FUNC, |
23d30f28 | 5865 | .v.func = alc_fixup_sku_ignore, |
c6b35874 | 5866 | }, |
e59ea3ed | 5867 | [ALC662_FIXUP_HP_RP5800] = { |
1727a771 TI |
5868 | .type = HDA_FIXUP_PINS, |
5869 | .v.pins = (const struct hda_pintbl[]) { | |
e59ea3ed TI |
5870 | { 0x14, 0x0221201f }, /* HP out */ |
5871 | { } | |
5872 | }, | |
5873 | .chained = true, | |
5874 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5875 | }, | |
53c334ad | 5876 | [ALC662_FIXUP_ASUS_MODE1] = { |
1727a771 TI |
5877 | .type = HDA_FIXUP_PINS, |
5878 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5879 | { 0x14, 0x99130110 }, /* speaker */ |
5880 | { 0x18, 0x01a19c20 }, /* mic */ | |
5881 | { 0x19, 0x99a3092f }, /* int-mic */ | |
5882 | { 0x21, 0x0121401f }, /* HP out */ | |
5883 | { } | |
5884 | }, | |
5885 | .chained = true, | |
5886 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5887 | }, | |
5888 | [ALC662_FIXUP_ASUS_MODE2] = { | |
1727a771 TI |
5889 | .type = HDA_FIXUP_PINS, |
5890 | .v.pins = (const struct hda_pintbl[]) { | |
2996bdba TI |
5891 | { 0x14, 0x99130110 }, /* speaker */ |
5892 | { 0x18, 0x01a19820 }, /* mic */ | |
5893 | { 0x19, 0x99a3092f }, /* int-mic */ | |
5894 | { 0x1b, 0x0121401f }, /* HP out */ | |
5895 | { } | |
5896 | }, | |
53c334ad TI |
5897 | .chained = true, |
5898 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5899 | }, | |
5900 | [ALC662_FIXUP_ASUS_MODE3] = { | |
1727a771 TI |
5901 | .type = HDA_FIXUP_PINS, |
5902 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5903 | { 0x14, 0x99130110 }, /* speaker */ |
5904 | { 0x15, 0x0121441f }, /* HP */ | |
5905 | { 0x18, 0x01a19840 }, /* mic */ | |
5906 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5907 | { 0x21, 0x01211420 }, /* HP2 */ | |
5908 | { } | |
5909 | }, | |
5910 | .chained = true, | |
5911 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5912 | }, | |
5913 | [ALC662_FIXUP_ASUS_MODE4] = { | |
1727a771 TI |
5914 | .type = HDA_FIXUP_PINS, |
5915 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5916 | { 0x14, 0x99130110 }, /* speaker */ |
5917 | { 0x16, 0x99130111 }, /* speaker */ | |
5918 | { 0x18, 0x01a19840 }, /* mic */ | |
5919 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5920 | { 0x21, 0x0121441f }, /* HP */ | |
5921 | { } | |
5922 | }, | |
5923 | .chained = true, | |
5924 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5925 | }, | |
5926 | [ALC662_FIXUP_ASUS_MODE5] = { | |
1727a771 TI |
5927 | .type = HDA_FIXUP_PINS, |
5928 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5929 | { 0x14, 0x99130110 }, /* speaker */ |
5930 | { 0x15, 0x0121441f }, /* HP */ | |
5931 | { 0x16, 0x99130111 }, /* speaker */ | |
5932 | { 0x18, 0x01a19840 }, /* mic */ | |
5933 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5934 | { } | |
5935 | }, | |
5936 | .chained = true, | |
5937 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5938 | }, | |
5939 | [ALC662_FIXUP_ASUS_MODE6] = { | |
1727a771 TI |
5940 | .type = HDA_FIXUP_PINS, |
5941 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5942 | { 0x14, 0x99130110 }, /* speaker */ |
5943 | { 0x15, 0x01211420 }, /* HP2 */ | |
5944 | { 0x18, 0x01a19840 }, /* mic */ | |
5945 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5946 | { 0x1b, 0x0121441f }, /* HP */ | |
5947 | { } | |
5948 | }, | |
5949 | .chained = true, | |
5950 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5951 | }, | |
5952 | [ALC662_FIXUP_ASUS_MODE7] = { | |
1727a771 TI |
5953 | .type = HDA_FIXUP_PINS, |
5954 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5955 | { 0x14, 0x99130110 }, /* speaker */ |
5956 | { 0x17, 0x99130111 }, /* speaker */ | |
5957 | { 0x18, 0x01a19840 }, /* mic */ | |
5958 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5959 | { 0x1b, 0x01214020 }, /* HP */ | |
5960 | { 0x21, 0x0121401f }, /* HP */ | |
5961 | { } | |
5962 | }, | |
5963 | .chained = true, | |
5964 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5965 | }, | |
5966 | [ALC662_FIXUP_ASUS_MODE8] = { | |
1727a771 TI |
5967 | .type = HDA_FIXUP_PINS, |
5968 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5969 | { 0x14, 0x99130110 }, /* speaker */ |
5970 | { 0x12, 0x99a30970 }, /* int-mic */ | |
5971 | { 0x15, 0x01214020 }, /* HP */ | |
5972 | { 0x17, 0x99130111 }, /* speaker */ | |
5973 | { 0x18, 0x01a19840 }, /* mic */ | |
5974 | { 0x21, 0x0121401f }, /* HP */ | |
5975 | { } | |
5976 | }, | |
5977 | .chained = true, | |
5978 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
2996bdba | 5979 | }, |
1565cc35 | 5980 | [ALC662_FIXUP_NO_JACK_DETECT] = { |
1727a771 | 5981 | .type = HDA_FIXUP_FUNC, |
1565cc35 TI |
5982 | .v.func = alc_fixup_no_jack_detect, |
5983 | }, | |
edfe3bfc | 5984 | [ALC662_FIXUP_ZOTAC_Z68] = { |
1727a771 TI |
5985 | .type = HDA_FIXUP_PINS, |
5986 | .v.pins = (const struct hda_pintbl[]) { | |
edfe3bfc DH |
5987 | { 0x1b, 0x02214020 }, /* Front HP */ |
5988 | { } | |
5989 | } | |
5990 | }, | |
125821ae | 5991 | [ALC662_FIXUP_INV_DMIC] = { |
1727a771 | 5992 | .type = HDA_FIXUP_FUNC, |
9d36a7dc | 5993 | .v.func = alc_fixup_inv_dmic, |
125821ae | 5994 | }, |
033b0a7c GM |
5995 | [ALC668_FIXUP_DELL_XPS13] = { |
5996 | .type = HDA_FIXUP_FUNC, | |
5997 | .v.func = alc_fixup_dell_xps13, | |
5998 | .chained = true, | |
5999 | .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX | |
6000 | }, | |
5e6db669 GM |
6001 | [ALC668_FIXUP_DELL_DISABLE_AAMIX] = { |
6002 | .type = HDA_FIXUP_FUNC, | |
6003 | .v.func = alc_fixup_disable_aamix, | |
6004 | .chained = true, | |
6005 | .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE | |
6006 | }, | |
493a52a9 HW |
6007 | [ALC668_FIXUP_AUTO_MUTE] = { |
6008 | .type = HDA_FIXUP_FUNC, | |
6009 | .v.func = alc_fixup_auto_mute_via_amp, | |
6010 | .chained = true, | |
6011 | .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE | |
6012 | }, | |
73bdd597 DH |
6013 | [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = { |
6014 | .type = HDA_FIXUP_PINS, | |
6015 | .v.pins = (const struct hda_pintbl[]) { | |
6016 | { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */ | |
6017 | { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */ | |
6018 | { } | |
6019 | }, | |
6020 | .chained = true, | |
6021 | .chain_id = ALC668_FIXUP_HEADSET_MODE | |
6022 | }, | |
6023 | [ALC668_FIXUP_HEADSET_MODE] = { | |
6024 | .type = HDA_FIXUP_FUNC, | |
6025 | .v.func = alc_fixup_headset_mode_alc668, | |
6026 | }, | |
8e54b4ac | 6027 | [ALC662_FIXUP_BASS_MODE4_CHMAP] = { |
8e383953 | 6028 | .type = HDA_FIXUP_FUNC, |
eb9ca3ab | 6029 | .v.func = alc_fixup_bass_chmap, |
8e383953 TI |
6030 | .chained = true, |
6031 | .chain_id = ALC662_FIXUP_ASUS_MODE4 | |
6032 | }, | |
61a75f13 DH |
6033 | [ALC662_FIXUP_BASS_16] = { |
6034 | .type = HDA_FIXUP_PINS, | |
6035 | .v.pins = (const struct hda_pintbl[]) { | |
6036 | {0x16, 0x80106111}, /* bass speaker */ | |
6037 | {} | |
6038 | }, | |
6039 | .chained = true, | |
6040 | .chain_id = ALC662_FIXUP_BASS_CHMAP, | |
6041 | }, | |
a30c9aaa TI |
6042 | [ALC662_FIXUP_BASS_1A] = { |
6043 | .type = HDA_FIXUP_PINS, | |
6044 | .v.pins = (const struct hda_pintbl[]) { | |
6045 | {0x1a, 0x80106111}, /* bass speaker */ | |
6046 | {} | |
6047 | }, | |
8e54b4ac DH |
6048 | .chained = true, |
6049 | .chain_id = ALC662_FIXUP_BASS_CHMAP, | |
a30c9aaa | 6050 | }, |
8e54b4ac | 6051 | [ALC662_FIXUP_BASS_CHMAP] = { |
a30c9aaa | 6052 | .type = HDA_FIXUP_FUNC, |
eb9ca3ab | 6053 | .v.func = alc_fixup_bass_chmap, |
a30c9aaa | 6054 | }, |
6cb3b707 DH |
6055 | }; |
6056 | ||
a9111321 | 6057 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
53c334ad | 6058 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), |
d3d3835c | 6059 | SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC), |
a6c47a85 | 6060 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
94024cd1 | 6061 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
125821ae | 6062 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
1801928e | 6063 | SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), |
2df03514 | 6064 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
73bdd597 DH |
6065 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
6066 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | |
c5d019c3 | 6067 | SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13), |
033b0a7c | 6068 | SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13), |
09d2014f | 6069 | SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
ad8ff99e | 6070 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
8dc9abb9 KY |
6071 | SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
6072 | SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | |
6a98e34b | 6073 | SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
e59ea3ed | 6074 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
8e54b4ac DH |
6075 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), |
6076 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), | |
61a75f13 DH |
6077 | SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), |
6078 | SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), | |
8e54b4ac | 6079 | SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), |
1565cc35 | 6080 | SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), |
53c334ad | 6081 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2), |
a0e90acc | 6082 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
d4118588 | 6083 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
6cb3b707 | 6084 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
edfe3bfc | 6085 | SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68), |
d2ebd479 | 6086 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
53c334ad TI |
6087 | |
6088 | #if 0 | |
6089 | /* Below is a quirk table taken from the old code. | |
6090 | * Basically the device should work as is without the fixup table. | |
6091 | * If BIOS doesn't give a proper info, enable the corresponding | |
6092 | * fixup entry. | |
7d7eb9ea | 6093 | */ |
53c334ad TI |
6094 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1), |
6095 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3), | |
6096 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1), | |
6097 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3), | |
6098 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | |
6099 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6100 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | |
6101 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1), | |
6102 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1), | |
6103 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6104 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7), | |
6105 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7), | |
6106 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8), | |
6107 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3), | |
6108 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1), | |
6109 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6110 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2), | |
6111 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1), | |
6112 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6113 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | |
6114 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | |
6115 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6116 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1), | |
6117 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3), | |
6118 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2), | |
6119 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6120 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5), | |
6121 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | |
6122 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6123 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1), | |
6124 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6125 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6126 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3), | |
6127 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3), | |
6128 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1), | |
6129 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1), | |
6130 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1), | |
6131 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1), | |
6132 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1), | |
6133 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6134 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2), | |
6135 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1), | |
6136 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | |
6137 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3), | |
6138 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1), | |
6139 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1), | |
6140 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1), | |
6141 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2), | |
6142 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | |
6143 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4), | |
6144 | #endif | |
6cb3b707 DH |
6145 | {} |
6146 | }; | |
6147 | ||
1727a771 | 6148 | static const struct hda_model_fixup alc662_fixup_models[] = { |
6be7948f | 6149 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
53c334ad TI |
6150 | {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"}, |
6151 | {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"}, | |
6152 | {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"}, | |
6153 | {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"}, | |
6154 | {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"}, | |
6155 | {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"}, | |
6156 | {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"}, | |
6157 | {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"}, | |
6e72aa5f | 6158 | {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
e32aa85a | 6159 | {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, |
6be7948f TB |
6160 | {} |
6161 | }; | |
6cb3b707 | 6162 | |
532895c5 | 6163 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { |
76c2132e DH |
6164 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
6165 | {0x12, 0x99a30130}, | |
6166 | {0x14, 0x90170110}, | |
6167 | {0x15, 0x0321101f}, | |
6168 | {0x16, 0x03011020}, | |
6169 | {0x18, 0x40000008}, | |
6170 | {0x19, 0x411111f0}, | |
6171 | {0x1a, 0x411111f0}, | |
6172 | {0x1b, 0x411111f0}, | |
6173 | {0x1d, 0x41000001}, | |
6174 | {0x1e, 0x411111f0}, | |
6175 | {0x1f, 0x411111f0}), | |
6176 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, | |
6177 | {0x12, 0x99a30140}, | |
6178 | {0x14, 0x90170110}, | |
6179 | {0x15, 0x0321101f}, | |
6180 | {0x16, 0x03011020}, | |
6181 | {0x18, 0x40000008}, | |
6182 | {0x19, 0x411111f0}, | |
6183 | {0x1a, 0x411111f0}, | |
6184 | {0x1b, 0x411111f0}, | |
6185 | {0x1d, 0x41000001}, | |
6186 | {0x1e, 0x411111f0}, | |
6187 | {0x1f, 0x411111f0}), | |
6188 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, | |
6189 | {0x12, 0x99a30150}, | |
6190 | {0x14, 0x90170110}, | |
6191 | {0x15, 0x0321101f}, | |
6192 | {0x16, 0x03011020}, | |
6193 | {0x18, 0x40000008}, | |
6194 | {0x19, 0x411111f0}, | |
6195 | {0x1a, 0x411111f0}, | |
6196 | {0x1b, 0x411111f0}, | |
6197 | {0x1d, 0x41000001}, | |
6198 | {0x1e, 0x411111f0}, | |
6199 | {0x1f, 0x411111f0}), | |
6200 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, | |
6201 | {0x12, 0x411111f0}, | |
6202 | {0x14, 0x90170110}, | |
6203 | {0x15, 0x0321101f}, | |
6204 | {0x16, 0x03011020}, | |
6205 | {0x18, 0x40000008}, | |
6206 | {0x19, 0x411111f0}, | |
6207 | {0x1a, 0x411111f0}, | |
6208 | {0x1b, 0x411111f0}, | |
6209 | {0x1d, 0x41000001}, | |
6210 | {0x1e, 0x411111f0}, | |
6211 | {0x1f, 0x411111f0}), | |
6212 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE, | |
6213 | {0x12, 0x90a60130}, | |
6214 | {0x14, 0x90170110}, | |
6215 | {0x15, 0x0321101f}, | |
6216 | {0x16, 0x40000000}, | |
6217 | {0x18, 0x411111f0}, | |
6218 | {0x19, 0x411111f0}, | |
6219 | {0x1a, 0x411111f0}, | |
6220 | {0x1b, 0x411111f0}, | |
6221 | {0x1d, 0x40d6832d}, | |
6222 | {0x1e, 0x411111f0}, | |
6223 | {0x1f, 0x411111f0}), | |
532895c5 HW |
6224 | {} |
6225 | }; | |
6226 | ||
1d045db9 TI |
6227 | /* |
6228 | */ | |
bc9f98a9 KY |
6229 | static int patch_alc662(struct hda_codec *codec) |
6230 | { | |
6231 | struct alc_spec *spec; | |
3de95173 | 6232 | int err; |
bc9f98a9 | 6233 | |
3de95173 TI |
6234 | err = alc_alloc_spec(codec, 0x0b); |
6235 | if (err < 0) | |
6236 | return err; | |
bc9f98a9 | 6237 | |
3de95173 | 6238 | spec = codec->spec; |
1f0f4b80 | 6239 | |
53c334ad TI |
6240 | /* handle multiple HPs as is */ |
6241 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; | |
6242 | ||
2c3bf9ab TI |
6243 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
6244 | ||
f3f9185f KY |
6245 | switch (codec->vendor_id) { |
6246 | case 0x10ec0668: | |
6247 | spec->init_hook = alc668_restore_default_value; | |
6248 | break; | |
f3f9185f | 6249 | } |
8663ff75 | 6250 | |
1727a771 | 6251 | snd_hda_pick_fixup(codec, alc662_fixup_models, |
8e5a0509 | 6252 | alc662_fixup_tbl, alc662_fixups); |
532895c5 | 6253 | snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups); |
1727a771 | 6254 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
8e5a0509 TI |
6255 | |
6256 | alc_auto_parse_customize_define(codec); | |
6257 | ||
7504b6cd TI |
6258 | if (has_cdefine_beep(codec)) |
6259 | spec->gen.beep_nid = 0x01; | |
6260 | ||
1bb7e43e | 6261 | if ((alc_get_coef0(codec) & (1 << 14)) && |
5100cd07 | 6262 | codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && |
e16fb6d1 | 6263 | spec->cdefine.platform_type == 1) { |
6134b1a2 WY |
6264 | err = alc_codec_rename(codec, "ALC272X"); |
6265 | if (err < 0) | |
e16fb6d1 | 6266 | goto error; |
20ca0c35 | 6267 | } |
274693f3 | 6268 | |
b9c5106c TI |
6269 | /* automatic parse from the BIOS config */ |
6270 | err = alc662_parse_auto_config(codec); | |
e16fb6d1 TI |
6271 | if (err < 0) |
6272 | goto error; | |
bc9f98a9 | 6273 | |
7504b6cd | 6274 | if (!spec->gen.no_analog && spec->gen.beep_nid) { |
da00c244 KY |
6275 | switch (codec->vendor_id) { |
6276 | case 0x10ec0662: | |
6277 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
6278 | break; | |
6279 | case 0x10ec0272: | |
6280 | case 0x10ec0663: | |
6281 | case 0x10ec0665: | |
9ad54547 | 6282 | case 0x10ec0668: |
da00c244 KY |
6283 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
6284 | break; | |
6285 | case 0x10ec0273: | |
6286 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); | |
6287 | break; | |
6288 | } | |
cec27c89 | 6289 | } |
2134ea4f | 6290 | |
bc9f98a9 | 6291 | codec->patch_ops = alc_patch_ops; |
1c716153 | 6292 | spec->shutup = alc_eapd_shutup; |
6cb3b707 | 6293 | |
1727a771 | 6294 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 6295 | |
bc9f98a9 | 6296 | return 0; |
801f49d3 | 6297 | |
e16fb6d1 TI |
6298 | error: |
6299 | alc_free(codec); | |
6300 | return err; | |
b478b998 KY |
6301 | } |
6302 | ||
d1eb57f4 KY |
6303 | /* |
6304 | * ALC680 support | |
6305 | */ | |
d1eb57f4 | 6306 | |
d1eb57f4 KY |
6307 | static int alc680_parse_auto_config(struct hda_codec *codec) |
6308 | { | |
3e6179b8 | 6309 | return alc_parse_auto_config(codec, NULL, NULL); |
d1eb57f4 KY |
6310 | } |
6311 | ||
d1eb57f4 | 6312 | /* |
d1eb57f4 | 6313 | */ |
d1eb57f4 KY |
6314 | static int patch_alc680(struct hda_codec *codec) |
6315 | { | |
d1eb57f4 KY |
6316 | int err; |
6317 | ||
1f0f4b80 | 6318 | /* ALC680 has no aa-loopback mixer */ |
3de95173 TI |
6319 | err = alc_alloc_spec(codec, 0); |
6320 | if (err < 0) | |
6321 | return err; | |
1f0f4b80 | 6322 | |
1ebec5f2 TI |
6323 | /* automatic parse from the BIOS config */ |
6324 | err = alc680_parse_auto_config(codec); | |
6325 | if (err < 0) { | |
6326 | alc_free(codec); | |
6327 | return err; | |
d1eb57f4 KY |
6328 | } |
6329 | ||
d1eb57f4 | 6330 | codec->patch_ops = alc_patch_ops; |
d1eb57f4 KY |
6331 | |
6332 | return 0; | |
6333 | } | |
6334 | ||
1da177e4 LT |
6335 | /* |
6336 | * patch entries | |
6337 | */ | |
a9111321 | 6338 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { |
296f0338 | 6339 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, |
ba4c4d0a | 6340 | { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 }, |
84dfd0ac | 6341 | { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 }, |
92f974df | 6342 | { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 }, |
1d04c9de | 6343 | { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 }, |
1da177e4 | 6344 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
df694daa | 6345 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
f6a92248 | 6346 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
a361d84b | 6347 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
f6a92248 | 6348 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
ebb83eeb | 6349 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
01afd41f | 6350 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
ebb83eeb | 6351 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
296f0338 | 6352 | { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, |
befae82e | 6353 | { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, |
4e01ec63 | 6354 | { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, |
7ff34ad8 | 6355 | { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, |
065380f0 | 6356 | { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 }, |
161ebf29 | 6357 | { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 }, |
7fc7d047 | 6358 | { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 }, |
7c665932 | 6359 | { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 }, |
7ff34ad8 | 6360 | { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, |
af02dde8 | 6361 | { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, |
161ebf29 | 6362 | { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 }, |
f32610ed | 6363 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
bc9f98a9 | 6364 | .patch = patch_alc861 }, |
f32610ed JS |
6365 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
6366 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
6367 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
bc9f98a9 | 6368 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
4953550a | 6369 | .patch = patch_alc882 }, |
bc9f98a9 KY |
6370 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
6371 | .patch = patch_alc662 }, | |
cc667a72 DH |
6372 | { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3", |
6373 | .patch = patch_alc662 }, | |
6dda9f4a | 6374 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
cec27c89 | 6375 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
72009433 | 6376 | { .id = 0x10ec0667, .name = "ALC667", .patch = patch_alc662 }, |
19a62823 | 6377 | { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, |
6227cdce | 6378 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
1d87caa6 | 6379 | { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 }, |
d1eb57f4 | 6380 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
b6c5fbad | 6381 | { .id = 0x10ec0867, .name = "ALC891", .patch = patch_alc882 }, |
f32610ed | 6382 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
1da177e4 | 6383 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
4953550a | 6384 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
669faba2 | 6385 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
4953550a | 6386 | .patch = patch_alc882 }, |
cb308f97 | 6387 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
4953550a | 6388 | .patch = patch_alc882 }, |
df694daa | 6389 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
e16fb6d1 | 6390 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
4442608d | 6391 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
4953550a | 6392 | .patch = patch_alc882 }, |
e16fb6d1 | 6393 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
4953550a | 6394 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
274693f3 | 6395 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
e16fb6d1 | 6396 | { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 }, |
19a62823 | 6397 | { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 }, |
1da177e4 LT |
6398 | {} /* terminator */ |
6399 | }; | |
1289e9e8 TI |
6400 | |
6401 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | |
6402 | ||
6403 | MODULE_LICENSE("GPL"); | |
6404 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | |
6405 | ||
6406 | static struct hda_codec_preset_list realtek_list = { | |
6407 | .preset = snd_hda_preset_realtek, | |
6408 | .owner = THIS_MODULE, | |
6409 | }; | |
6410 | ||
6411 | static int __init patch_realtek_init(void) | |
6412 | { | |
6413 | return snd_hda_add_codec_preset(&realtek_list); | |
6414 | } | |
6415 | ||
6416 | static void __exit patch_realtek_exit(void) | |
6417 | { | |
6418 | snd_hda_delete_codec_preset(&realtek_list); | |
6419 | } | |
6420 | ||
6421 | module_init(patch_realtek_init) | |
6422 | module_exit(patch_realtek_exit) |