1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
5 * HD audio interface patch for Realtek ALC codecs
6 *
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
9 * Takashi Iwai <tiwai@suse.de>
10 * Jonathan Woithe <jwoithe@just42.net>
11 */
12
13 #include <linux/init.h>
14 #include <linux/delay.h>
15 #include <linux/slab.h>
16 #include <linux/pci.h>
17 #include <linux/dmi.h>
18 #include <linux/module.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <sound/core.h>
22 #include <sound/jack.h>
23 #include <sound/hda_codec.h>
24 #include "hda_local.h"
25 #include "hda_auto_parser.h"
26 #include "hda_jack.h"
27 #include "hda_generic.h"
28
29 /* keep halting ALC5505 DSP, for power saving */
30 #define HALT_REALTEK_ALC5505
31
32 /* extra amp-initialization sequence types */
33 enum {
34 ALC_INIT_UNDEFINED,
35 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
37 };
38
39 enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45 };
46
47 enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51 };
52
53 enum {
54 ALC_KEY_MICMUTE_INDEX,
55 };
56
57 struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
67 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
68 };
69
70 struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75 };
76
77 struct alc_spec {
78 struct hda_gen_spec gen; /* must be at head */
79
80 /* codec parameterization */
81 struct alc_customize_define cdefine;
82 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
84 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
88 bool gpio_write_delay; /* add a delay before writing gpio_data */
89
90 /* mute LED for HP laptops, see vref_mute_led_set() */
91 int mute_led_polarity;
92 int micmute_led_polarity;
93 hda_nid_t mute_led_nid;
94 hda_nid_t cap_mute_led_nid;
95
96 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
98 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
100 struct mutex coef_mutex;
101
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
107 /* hooks */
108 void (*init_hook)(struct hda_codec *codec);
109 #ifdef CONFIG_PM
110 void (*power_hook)(struct hda_codec *codec);
111 #endif
112 void (*shutup)(struct hda_codec *codec);
113 void (*reboot_notify)(struct hda_codec *codec);
114
115 int init_amp;
116 int codec_variant; /* flag for other variants */
117 unsigned int has_alc5505_dsp:1;
118 unsigned int no_depop_delay:1;
119 unsigned int done_hp_init:1;
120 unsigned int no_shutup_pins:1;
121 unsigned int ultra_low_power:1;
122 unsigned int has_hs_key:1;
123 unsigned int no_internal_mic_pin:1;
124
125 /* for PLL fix */
126 hda_nid_t pll_nid;
127 unsigned int pll_coef_idx, pll_coef_bit;
128 unsigned int coef0;
129 struct input_dev *kb_dev;
130 u8 alc_mute_keycode_map[1];
131 };
132
133 /*
134 * COEF access helper functions
135 */
136
coef_mutex_lock(struct hda_codec * codec)137 static void coef_mutex_lock(struct hda_codec *codec)
138 {
139 struct alc_spec *spec = codec->spec;
140
141 snd_hda_power_up_pm(codec);
142 mutex_lock(&spec->coef_mutex);
143 }
144
coef_mutex_unlock(struct hda_codec * codec)145 static void coef_mutex_unlock(struct hda_codec *codec)
146 {
147 struct alc_spec *spec = codec->spec;
148
149 mutex_unlock(&spec->coef_mutex);
150 snd_hda_power_down_pm(codec);
151 }
152
__alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)153 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
154 unsigned int coef_idx)
155 {
156 unsigned int val;
157
158 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
159 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
160 return val;
161 }
162
alc_read_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx)163 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
164 unsigned int coef_idx)
165 {
166 unsigned int val;
167
168 coef_mutex_lock(codec);
169 val = __alc_read_coefex_idx(codec, nid, coef_idx);
170 coef_mutex_unlock(codec);
171 return val;
172 }
173
174 #define alc_read_coef_idx(codec, coef_idx) \
175 alc_read_coefex_idx(codec, 0x20, coef_idx)
176
__alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)177 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
178 unsigned int coef_idx, unsigned int coef_val)
179 {
180 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
181 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
182 }
183
alc_write_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_val)184 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
185 unsigned int coef_idx, unsigned int coef_val)
186 {
187 coef_mutex_lock(codec);
188 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
189 coef_mutex_unlock(codec);
190 }
191
192 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
193 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
194
__alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)195 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
196 unsigned int coef_idx, unsigned int mask,
197 unsigned int bits_set)
198 {
199 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
200
201 if (val != -1)
202 __alc_write_coefex_idx(codec, nid, coef_idx,
203 (val & ~mask) | bits_set);
204 }
205
alc_update_coefex_idx(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int mask,unsigned int bits_set)206 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
207 unsigned int coef_idx, unsigned int mask,
208 unsigned int bits_set)
209 {
210 coef_mutex_lock(codec);
211 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
212 coef_mutex_unlock(codec);
213 }
214
215 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
216 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
217
218 /* a special bypass for COEF 0; read the cached value at the second time */
alc_get_coef0(struct hda_codec * codec)219 static unsigned int alc_get_coef0(struct hda_codec *codec)
220 {
221 struct alc_spec *spec = codec->spec;
222
223 if (!spec->coef0)
224 spec->coef0 = alc_read_coef_idx(codec, 0);
225 return spec->coef0;
226 }
227
228 /* coef writes/updates batch */
229 struct coef_fw {
230 unsigned char nid;
231 unsigned char idx;
232 unsigned short mask;
233 unsigned short val;
234 };
235
236 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
237 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
238 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
239 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
240 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
241
alc_process_coef_fw(struct hda_codec * codec,const struct coef_fw * fw)242 static void alc_process_coef_fw(struct hda_codec *codec,
243 const struct coef_fw *fw)
244 {
245 coef_mutex_lock(codec);
246 for (; fw->nid; fw++) {
247 if (fw->mask == (unsigned short)-1)
248 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
249 else
250 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
251 fw->mask, fw->val);
252 }
253 coef_mutex_unlock(codec);
254 }
255
256 /*
257 * GPIO setup tables, used in initialization
258 */
259
260 /* Enable GPIO mask and set output */
alc_setup_gpio(struct hda_codec * codec,unsigned int mask)261 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
262 {
263 struct alc_spec *spec = codec->spec;
264
265 spec->gpio_mask |= mask;
266 spec->gpio_dir |= mask;
267 spec->gpio_data |= mask;
268 }
269
alc_write_gpio_data(struct hda_codec * codec)270 static void alc_write_gpio_data(struct hda_codec *codec)
271 {
272 struct alc_spec *spec = codec->spec;
273
274 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
275 spec->gpio_data);
276 }
277
alc_update_gpio_data(struct hda_codec * codec,unsigned int mask,bool on)278 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
279 bool on)
280 {
281 struct alc_spec *spec = codec->spec;
282 unsigned int oldval = spec->gpio_data;
283
284 if (on)
285 spec->gpio_data |= mask;
286 else
287 spec->gpio_data &= ~mask;
288 if (oldval != spec->gpio_data)
289 alc_write_gpio_data(codec);
290 }
291
alc_write_gpio(struct hda_codec * codec)292 static void alc_write_gpio(struct hda_codec *codec)
293 {
294 struct alc_spec *spec = codec->spec;
295
296 if (!spec->gpio_mask)
297 return;
298
299 snd_hda_codec_write(codec, codec->core.afg, 0,
300 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
301 snd_hda_codec_write(codec, codec->core.afg, 0,
302 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
303 if (spec->gpio_write_delay)
304 msleep(1);
305 alc_write_gpio_data(codec);
306 }
307
alc_fixup_gpio(struct hda_codec * codec,int action,unsigned int mask)308 static void alc_fixup_gpio(struct hda_codec *codec, int action,
309 unsigned int mask)
310 {
311 if (action == HDA_FIXUP_ACT_PRE_PROBE)
312 alc_setup_gpio(codec, mask);
313 }
314
alc_fixup_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)315 static void alc_fixup_gpio1(struct hda_codec *codec,
316 const struct hda_fixup *fix, int action)
317 {
318 alc_fixup_gpio(codec, action, 0x01);
319 }
320
alc_fixup_gpio2(struct hda_codec * codec,const struct hda_fixup * fix,int action)321 static void alc_fixup_gpio2(struct hda_codec *codec,
322 const struct hda_fixup *fix, int action)
323 {
324 alc_fixup_gpio(codec, action, 0x02);
325 }
326
alc_fixup_gpio3(struct hda_codec * codec,const struct hda_fixup * fix,int action)327 static void alc_fixup_gpio3(struct hda_codec *codec,
328 const struct hda_fixup *fix, int action)
329 {
330 alc_fixup_gpio(codec, action, 0x03);
331 }
332
alc_fixup_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)333 static void alc_fixup_gpio4(struct hda_codec *codec,
334 const struct hda_fixup *fix, int action)
335 {
336 alc_fixup_gpio(codec, action, 0x04);
337 }
338
alc_fixup_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)339 static void alc_fixup_micmute_led(struct hda_codec *codec,
340 const struct hda_fixup *fix, int action)
341 {
342 if (action == HDA_FIXUP_ACT_PROBE)
343 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
344 }
345
346 /*
347 * Fix hardware PLL issue
348 * On some codecs, the analog PLL gating control must be off while
349 * the default value is 1.
350 */
alc_fix_pll(struct hda_codec * codec)351 static void alc_fix_pll(struct hda_codec *codec)
352 {
353 struct alc_spec *spec = codec->spec;
354
355 if (spec->pll_nid)
356 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
357 1 << spec->pll_coef_bit, 0);
358 }
359
alc_fix_pll_init(struct hda_codec * codec,hda_nid_t nid,unsigned int coef_idx,unsigned int coef_bit)360 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
361 unsigned int coef_idx, unsigned int coef_bit)
362 {
363 struct alc_spec *spec = codec->spec;
364 spec->pll_nid = nid;
365 spec->pll_coef_idx = coef_idx;
366 spec->pll_coef_bit = coef_bit;
367 alc_fix_pll(codec);
368 }
369
370 /* update the master volume per volume-knob's unsol event */
alc_update_knob_master(struct hda_codec * codec,struct hda_jack_callback * jack)371 static void alc_update_knob_master(struct hda_codec *codec,
372 struct hda_jack_callback *jack)
373 {
374 unsigned int val;
375 struct snd_kcontrol *kctl;
376 struct snd_ctl_elem_value *uctl;
377
378 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
379 if (!kctl)
380 return;
381 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
382 if (!uctl)
383 return;
384 val = snd_hda_codec_read(codec, jack->nid, 0,
385 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
386 val &= HDA_AMP_VOLMASK;
387 uctl->value.integer.value[0] = val;
388 uctl->value.integer.value[1] = val;
389 kctl->put(kctl, uctl);
390 kfree(uctl);
391 }
392
alc880_unsol_event(struct hda_codec * codec,unsigned int res)393 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
394 {
395 /* For some reason, the res given from ALC880 is broken.
396 Here we adjust it properly. */
397 snd_hda_jack_unsol_event(codec, res >> 2);
398 }
399
400 /* Change EAPD to verb control */
alc_fill_eapd_coef(struct hda_codec * codec)401 static void alc_fill_eapd_coef(struct hda_codec *codec)
402 {
403 int coef;
404
405 coef = alc_get_coef0(codec);
406
407 switch (codec->core.vendor_id) {
408 case 0x10ec0262:
409 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
410 break;
411 case 0x10ec0267:
412 case 0x10ec0268:
413 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
414 break;
415 case 0x10ec0269:
416 if ((coef & 0x00f0) == 0x0010)
417 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
418 if ((coef & 0x00f0) == 0x0020)
419 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
420 if ((coef & 0x00f0) == 0x0030)
421 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
422 break;
423 case 0x10ec0280:
424 case 0x10ec0284:
425 case 0x10ec0290:
426 case 0x10ec0292:
427 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
428 break;
429 case 0x10ec0225:
430 case 0x10ec0295:
431 case 0x10ec0299:
432 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
433 fallthrough;
434 case 0x10ec0215:
435 case 0x10ec0230:
436 case 0x10ec0233:
437 case 0x10ec0235:
438 case 0x10ec0236:
439 case 0x10ec0245:
440 case 0x10ec0255:
441 case 0x10ec0256:
442 case 0x19e58326:
443 case 0x10ec0257:
444 case 0x10ec0282:
445 case 0x10ec0283:
446 case 0x10ec0286:
447 case 0x10ec0288:
448 case 0x10ec0285:
449 case 0x10ec0298:
450 case 0x10ec0289:
451 case 0x10ec0300:
452 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
453 break;
454 case 0x10ec0275:
455 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
456 break;
457 case 0x10ec0287:
458 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
459 alc_write_coef_idx(codec, 0x8, 0x4ab7);
460 break;
461 case 0x10ec0293:
462 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
463 break;
464 case 0x10ec0234:
465 case 0x10ec0274:
466 case 0x10ec0294:
467 case 0x10ec0700:
468 case 0x10ec0701:
469 case 0x10ec0703:
470 case 0x10ec0711:
471 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
472 break;
473 case 0x10ec0662:
474 if ((coef & 0x00f0) == 0x0030)
475 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
476 break;
477 case 0x10ec0272:
478 case 0x10ec0273:
479 case 0x10ec0663:
480 case 0x10ec0665:
481 case 0x10ec0670:
482 case 0x10ec0671:
483 case 0x10ec0672:
484 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
485 break;
486 case 0x10ec0222:
487 case 0x10ec0623:
488 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
489 break;
490 case 0x10ec0668:
491 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
492 break;
493 case 0x10ec0867:
494 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
495 break;
496 case 0x10ec0888:
497 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
498 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
499 break;
500 case 0x10ec0892:
501 case 0x10ec0897:
502 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
503 break;
504 case 0x10ec0899:
505 case 0x10ec0900:
506 case 0x10ec0b00:
507 case 0x10ec1168:
508 case 0x10ec1220:
509 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
510 break;
511 }
512 }
513
514 /* additional initialization for ALC888 variants */
alc888_coef_init(struct hda_codec * codec)515 static void alc888_coef_init(struct hda_codec *codec)
516 {
517 switch (alc_get_coef0(codec) & 0x00f0) {
518 /* alc888-VA */
519 case 0x00:
520 /* alc888-VB */
521 case 0x10:
522 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
523 break;
524 }
525 }
526
527 /* turn on/off EAPD control (only if available) */
set_eapd(struct hda_codec * codec,hda_nid_t nid,int on)528 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
529 {
530 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
531 return;
532 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
533 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
534 on ? 2 : 0);
535 }
536
537 /* turn on/off EAPD controls of the codec */
alc_auto_setup_eapd(struct hda_codec * codec,bool on)538 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
539 {
540 /* We currently only handle front, HP */
541 static const hda_nid_t pins[] = {
542 0x0f, 0x10, 0x14, 0x15, 0x17, 0
543 };
544 const hda_nid_t *p;
545 for (p = pins; *p; p++)
546 set_eapd(codec, *p, on);
547 }
548
549 static int find_ext_mic_pin(struct hda_codec *codec);
550
alc_headset_mic_no_shutup(struct hda_codec * codec)551 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
552 {
553 const struct hda_pincfg *pin;
554 int mic_pin = find_ext_mic_pin(codec);
555 int i;
556
557 /* don't shut up pins when unloading the driver; otherwise it breaks
558 * the default pin setup at the next load of the driver
559 */
560 if (codec->bus->shutdown)
561 return;
562
563 snd_array_for_each(&codec->init_pins, i, pin) {
564 /* use read here for syncing after issuing each verb */
565 if (pin->nid != mic_pin)
566 snd_hda_codec_read(codec, pin->nid, 0,
567 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
568 }
569
570 codec->pins_shutup = 1;
571 }
572
alc_shutup_pins(struct hda_codec * codec)573 static void alc_shutup_pins(struct hda_codec *codec)
574 {
575 struct alc_spec *spec = codec->spec;
576
577 switch (codec->core.vendor_id) {
578 case 0x10ec0236:
579 case 0x10ec0256:
580 case 0x19e58326:
581 case 0x10ec0283:
582 case 0x10ec0286:
583 case 0x10ec0288:
584 case 0x10ec0298:
585 alc_headset_mic_no_shutup(codec);
586 break;
587 default:
588 if (!spec->no_shutup_pins)
589 snd_hda_shutup_pins(codec);
590 break;
591 }
592 }
593
594 /* generic shutup callback;
595 * just turning off EAPD and a little pause for avoiding pop-noise
596 */
alc_eapd_shutup(struct hda_codec * codec)597 static void alc_eapd_shutup(struct hda_codec *codec)
598 {
599 struct alc_spec *spec = codec->spec;
600
601 alc_auto_setup_eapd(codec, false);
602 if (!spec->no_depop_delay)
603 msleep(200);
604 alc_shutup_pins(codec);
605 }
606
607 /* generic EAPD initialization */
alc_auto_init_amp(struct hda_codec * codec,int type)608 static void alc_auto_init_amp(struct hda_codec *codec, int type)
609 {
610 alc_auto_setup_eapd(codec, true);
611 alc_write_gpio(codec);
612 switch (type) {
613 case ALC_INIT_DEFAULT:
614 switch (codec->core.vendor_id) {
615 case 0x10ec0260:
616 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
617 break;
618 case 0x10ec0880:
619 case 0x10ec0882:
620 case 0x10ec0883:
621 case 0x10ec0885:
622 alc_update_coef_idx(codec, 7, 0, 0x2030);
623 break;
624 case 0x10ec0888:
625 alc888_coef_init(codec);
626 break;
627 }
628 break;
629 }
630 }
631
632 /* get a primary headphone pin if available */
alc_get_hp_pin(struct alc_spec * spec)633 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
634 {
635 if (spec->gen.autocfg.hp_pins[0])
636 return spec->gen.autocfg.hp_pins[0];
637 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
638 return spec->gen.autocfg.line_out_pins[0];
639 return 0;
640 }
641
642 /*
643 * Realtek SSID verification
644 */
645
646 /* Could be any non-zero and even value. When used as fixup, tells
647 * the driver to ignore any present sku defines.
648 */
649 #define ALC_FIXUP_SKU_IGNORE (2)
650
alc_fixup_sku_ignore(struct hda_codec * codec,const struct hda_fixup * fix,int action)651 static void alc_fixup_sku_ignore(struct hda_codec *codec,
652 const struct hda_fixup *fix, int action)
653 {
654 struct alc_spec *spec = codec->spec;
655 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
656 spec->cdefine.fixup = 1;
657 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
658 }
659 }
660
alc_fixup_no_depop_delay(struct hda_codec * codec,const struct hda_fixup * fix,int action)661 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
662 const struct hda_fixup *fix, int action)
663 {
664 struct alc_spec *spec = codec->spec;
665
666 if (action == HDA_FIXUP_ACT_PROBE) {
667 spec->no_depop_delay = 1;
668 codec->depop_delay = 0;
669 }
670 }
671
alc_auto_parse_customize_define(struct hda_codec * codec)672 static int alc_auto_parse_customize_define(struct hda_codec *codec)
673 {
674 unsigned int ass, tmp, i;
675 unsigned nid = 0;
676 struct alc_spec *spec = codec->spec;
677
678 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
679
680 if (spec->cdefine.fixup) {
681 ass = spec->cdefine.sku_cfg;
682 if (ass == ALC_FIXUP_SKU_IGNORE)
683 return -1;
684 goto do_sku;
685 }
686
687 if (!codec->bus->pci)
688 return -1;
689 ass = codec->core.subsystem_id & 0xffff;
690 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
691 goto do_sku;
692
693 nid = 0x1d;
694 if (codec->core.vendor_id == 0x10ec0260)
695 nid = 0x17;
696 ass = snd_hda_codec_get_pincfg(codec, nid);
697
698 if (!(ass & 1)) {
699 codec_info(codec, "%s: SKU not ready 0x%08x\n",
700 codec->core.chip_name, ass);
701 return -1;
702 }
703
704 /* check sum */
705 tmp = 0;
706 for (i = 1; i < 16; i++) {
707 if ((ass >> i) & 1)
708 tmp++;
709 }
710 if (((ass >> 16) & 0xf) != tmp)
711 return -1;
712
713 spec->cdefine.port_connectivity = ass >> 30;
714 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
715 spec->cdefine.check_sum = (ass >> 16) & 0xf;
716 spec->cdefine.customization = ass >> 8;
717 do_sku:
718 spec->cdefine.sku_cfg = ass;
719 spec->cdefine.external_amp = (ass & 0x38) >> 3;
720 spec->cdefine.platform_type = (ass & 0x4) >> 2;
721 spec->cdefine.swap = (ass & 0x2) >> 1;
722 spec->cdefine.override = ass & 0x1;
723
724 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
725 nid, spec->cdefine.sku_cfg);
726 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
727 spec->cdefine.port_connectivity);
728 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
729 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
730 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
731 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
732 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
733 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
734 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
735
736 return 0;
737 }
738
739 /* return the position of NID in the list, or -1 if not found */
find_idx_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)740 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
741 {
742 int i;
743 for (i = 0; i < nums; i++)
744 if (list[i] == nid)
745 return i;
746 return -1;
747 }
748 /* return true if the given NID is found in the list */
found_in_nid_list(hda_nid_t nid,const hda_nid_t * list,int nums)749 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
750 {
751 return find_idx_in_nid_list(nid, list, nums) >= 0;
752 }
753
754 /* check subsystem ID and set up device-specific initialization;
755 * return 1 if initialized, 0 if invalid SSID
756 */
757 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
758 * 31 ~ 16 : Manufacture ID
759 * 15 ~ 8 : SKU ID
760 * 7 ~ 0 : Assembly ID
761 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
762 */
alc_subsystem_id(struct hda_codec * codec,const hda_nid_t * ports)763 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
764 {
765 unsigned int ass, tmp, i;
766 unsigned nid;
767 struct alc_spec *spec = codec->spec;
768
769 if (spec->cdefine.fixup) {
770 ass = spec->cdefine.sku_cfg;
771 if (ass == ALC_FIXUP_SKU_IGNORE)
772 return 0;
773 goto do_sku;
774 }
775
776 ass = codec->core.subsystem_id & 0xffff;
777 if (codec->bus->pci &&
778 ass != codec->bus->pci->subsystem_device && (ass & 1))
779 goto do_sku;
780
781 /* invalid SSID, check the special NID pin defcfg instead */
782 /*
783 * 31~30 : port connectivity
784 * 29~21 : reserve
785 * 20 : PCBEEP input
786 * 19~16 : Check sum (15:1)
787 * 15~1 : Custom
788 * 0 : override
789 */
790 nid = 0x1d;
791 if (codec->core.vendor_id == 0x10ec0260)
792 nid = 0x17;
793 ass = snd_hda_codec_get_pincfg(codec, nid);
794 codec_dbg(codec,
795 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
796 ass, nid);
797 if (!(ass & 1))
798 return 0;
799 if ((ass >> 30) != 1) /* no physical connection */
800 return 0;
801
802 /* check sum */
803 tmp = 0;
804 for (i = 1; i < 16; i++) {
805 if ((ass >> i) & 1)
806 tmp++;
807 }
808 if (((ass >> 16) & 0xf) != tmp)
809 return 0;
810 do_sku:
811 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
812 ass & 0xffff, codec->core.vendor_id);
813 /*
814 * 0 : override
815 * 1 : Swap Jack
816 * 2 : 0 --> Desktop, 1 --> Laptop
817 * 3~5 : External Amplifier control
818 * 7~6 : Reserved
819 */
820 tmp = (ass & 0x38) >> 3; /* external Amp control */
821 if (spec->init_amp == ALC_INIT_UNDEFINED) {
822 switch (tmp) {
823 case 1:
824 alc_setup_gpio(codec, 0x01);
825 break;
826 case 3:
827 alc_setup_gpio(codec, 0x02);
828 break;
829 case 7:
830 alc_setup_gpio(codec, 0x03);
831 break;
832 case 5:
833 default:
834 spec->init_amp = ALC_INIT_DEFAULT;
835 break;
836 }
837 }
838
839 /* is laptop or Desktop and enable the function "Mute internal speaker
840 * when the external headphone out jack is plugged"
841 */
842 if (!(ass & 0x8000))
843 return 1;
844 /*
845 * 10~8 : Jack location
846 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
847 * 14~13: Resvered
848 * 15 : 1 --> enable the function "Mute internal speaker
849 * when the external headphone out jack is plugged"
850 */
851 if (!alc_get_hp_pin(spec)) {
852 hda_nid_t nid;
853 tmp = (ass >> 11) & 0x3; /* HP to chassis */
854 nid = ports[tmp];
855 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
856 spec->gen.autocfg.line_outs))
857 return 1;
858 spec->gen.autocfg.hp_pins[0] = nid;
859 }
860 return 1;
861 }
862
863 /* Check the validity of ALC subsystem-id
864 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
alc_ssid_check(struct hda_codec * codec,const hda_nid_t * ports)865 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
866 {
867 if (!alc_subsystem_id(codec, ports)) {
868 struct alc_spec *spec = codec->spec;
869 if (spec->init_amp == ALC_INIT_UNDEFINED) {
870 codec_dbg(codec,
871 "realtek: Enable default setup for auto mode as fallback\n");
872 spec->init_amp = ALC_INIT_DEFAULT;
873 }
874 }
875 }
876
877 /*
878 */
879
alc_fixup_inv_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)880 static void alc_fixup_inv_dmic(struct hda_codec *codec,
881 const struct hda_fixup *fix, int action)
882 {
883 struct alc_spec *spec = codec->spec;
884
885 spec->gen.inv_dmic_split = 1;
886 }
887
888
alc_build_controls(struct hda_codec * codec)889 static int alc_build_controls(struct hda_codec *codec)
890 {
891 int err;
892
893 err = snd_hda_gen_build_controls(codec);
894 if (err < 0)
895 return err;
896
897 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
898 return 0;
899 }
900
901
902 /*
903 * Common callbacks
904 */
905
alc_pre_init(struct hda_codec * codec)906 static void alc_pre_init(struct hda_codec *codec)
907 {
908 alc_fill_eapd_coef(codec);
909 }
910
911 #define is_s3_resume(codec) \
912 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
913 #define is_s4_resume(codec) \
914 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
915
alc_init(struct hda_codec * codec)916 static int alc_init(struct hda_codec *codec)
917 {
918 struct alc_spec *spec = codec->spec;
919
920 /* hibernation resume needs the full chip initialization */
921 if (is_s4_resume(codec))
922 alc_pre_init(codec);
923
924 if (spec->init_hook)
925 spec->init_hook(codec);
926
927 spec->gen.skip_verbs = 1; /* applied in below */
928 snd_hda_gen_init(codec);
929 alc_fix_pll(codec);
930 alc_auto_init_amp(codec, spec->init_amp);
931 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
932
933 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
934
935 return 0;
936 }
937
alc_shutup(struct hda_codec * codec)938 static inline void alc_shutup(struct hda_codec *codec)
939 {
940 struct alc_spec *spec = codec->spec;
941
942 if (!snd_hda_get_bool_hint(codec, "shutup"))
943 return; /* disabled explicitly by hints */
944
945 if (spec && spec->shutup)
946 spec->shutup(codec);
947 else
948 alc_shutup_pins(codec);
949 }
950
alc_reboot_notify(struct hda_codec * codec)951 static void alc_reboot_notify(struct hda_codec *codec)
952 {
953 struct alc_spec *spec = codec->spec;
954
955 if (spec && spec->reboot_notify)
956 spec->reboot_notify(codec);
957 else
958 alc_shutup(codec);
959 }
960
961 #define alc_free snd_hda_gen_free
962
963 #ifdef CONFIG_PM
alc_power_eapd(struct hda_codec * codec)964 static void alc_power_eapd(struct hda_codec *codec)
965 {
966 alc_auto_setup_eapd(codec, false);
967 }
968
alc_suspend(struct hda_codec * codec)969 static int alc_suspend(struct hda_codec *codec)
970 {
971 struct alc_spec *spec = codec->spec;
972 alc_shutup(codec);
973 if (spec && spec->power_hook)
974 spec->power_hook(codec);
975 return 0;
976 }
977 #endif
978
979 #ifdef CONFIG_PM
alc_resume(struct hda_codec * codec)980 static int alc_resume(struct hda_codec *codec)
981 {
982 struct alc_spec *spec = codec->spec;
983
984 if (!spec->no_depop_delay)
985 msleep(150); /* to avoid pop noise */
986 codec->patch_ops.init(codec);
987 snd_hda_regmap_sync(codec);
988 hda_call_check_power_status(codec, 0x01);
989 return 0;
990 }
991 #endif
992
993 /*
994 */
995 static const struct hda_codec_ops alc_patch_ops = {
996 .build_controls = alc_build_controls,
997 .build_pcms = snd_hda_gen_build_pcms,
998 .init = alc_init,
999 .free = alc_free,
1000 .unsol_event = snd_hda_jack_unsol_event,
1001 #ifdef CONFIG_PM
1002 .resume = alc_resume,
1003 .suspend = alc_suspend,
1004 .check_power_status = snd_hda_gen_check_power_status,
1005 #endif
1006 .reboot_notify = alc_reboot_notify,
1007 };
1008
1009
1010 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1011
1012 /*
1013 * Rename codecs appropriately from COEF value or subvendor id
1014 */
1015 struct alc_codec_rename_table {
1016 unsigned int vendor_id;
1017 unsigned short coef_mask;
1018 unsigned short coef_bits;
1019 const char *name;
1020 };
1021
1022 struct alc_codec_rename_pci_table {
1023 unsigned int codec_vendor_id;
1024 unsigned short pci_subvendor;
1025 unsigned short pci_subdevice;
1026 const char *name;
1027 };
1028
1029 static const struct alc_codec_rename_table rename_tbl[] = {
1030 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1031 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1032 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1033 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1034 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1035 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1036 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1037 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1038 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1039 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1040 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1041 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1042 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1043 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1044 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1045 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1046 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1047 { } /* terminator */
1048 };
1049
1050 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1051 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1052 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1053 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1054 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1055 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1056 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1057 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1058 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1059 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1060 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1061 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1062 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1063 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1064 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1065 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1066 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1067 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1068 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1069 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1070 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1071 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1072 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1073 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1074 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1075 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1076 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1077 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1078 { } /* terminator */
1079 };
1080
alc_codec_rename_from_preset(struct hda_codec * codec)1081 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1082 {
1083 const struct alc_codec_rename_table *p;
1084 const struct alc_codec_rename_pci_table *q;
1085
1086 for (p = rename_tbl; p->vendor_id; p++) {
1087 if (p->vendor_id != codec->core.vendor_id)
1088 continue;
1089 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1090 return alc_codec_rename(codec, p->name);
1091 }
1092
1093 if (!codec->bus->pci)
1094 return 0;
1095 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1096 if (q->codec_vendor_id != codec->core.vendor_id)
1097 continue;
1098 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1099 continue;
1100 if (!q->pci_subdevice ||
1101 q->pci_subdevice == codec->bus->pci->subsystem_device)
1102 return alc_codec_rename(codec, q->name);
1103 }
1104
1105 return 0;
1106 }
1107
1108
1109 /*
1110 * Digital-beep handlers
1111 */
1112 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1113
1114 /* additional beep mixers; private_value will be overwritten */
1115 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1116 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1117 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1118 };
1119
1120 /* set up and create beep controls */
set_beep_amp(struct alc_spec * spec,hda_nid_t nid,int idx,int dir)1121 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1122 int idx, int dir)
1123 {
1124 struct snd_kcontrol_new *knew;
1125 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1126 int i;
1127
1128 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1129 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1130 &alc_beep_mixer[i]);
1131 if (!knew)
1132 return -ENOMEM;
1133 knew->private_value = beep_amp;
1134 }
1135 return 0;
1136 }
1137
1138 static const struct snd_pci_quirk beep_allow_list[] = {
1139 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1140 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1141 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1142 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1143 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1144 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1145 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1146 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1147 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1148 /* denylist -- no beep available */
1149 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1150 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1151 {}
1152 };
1153
has_cdefine_beep(struct hda_codec * codec)1154 static inline int has_cdefine_beep(struct hda_codec *codec)
1155 {
1156 struct alc_spec *spec = codec->spec;
1157 const struct snd_pci_quirk *q;
1158 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1159 if (q)
1160 return q->value;
1161 return spec->cdefine.enable_pcbeep;
1162 }
1163 #else
1164 #define set_beep_amp(spec, nid, idx, dir) 0
1165 #define has_cdefine_beep(codec) 0
1166 #endif
1167
1168 /* parse the BIOS configuration and set up the alc_spec */
1169 /* return 1 if successful, 0 if the proper config is not found,
1170 * or a negative error code
1171 */
alc_parse_auto_config(struct hda_codec * codec,const hda_nid_t * ignore_nids,const hda_nid_t * ssid_nids)1172 static int alc_parse_auto_config(struct hda_codec *codec,
1173 const hda_nid_t *ignore_nids,
1174 const hda_nid_t *ssid_nids)
1175 {
1176 struct alc_spec *spec = codec->spec;
1177 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1178 int err;
1179
1180 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1181 spec->parse_flags);
1182 if (err < 0)
1183 return err;
1184
1185 if (ssid_nids)
1186 alc_ssid_check(codec, ssid_nids);
1187
1188 err = snd_hda_gen_parse_auto_config(codec, cfg);
1189 if (err < 0)
1190 return err;
1191
1192 return 1;
1193 }
1194
1195 /* common preparation job for alc_spec */
alc_alloc_spec(struct hda_codec * codec,hda_nid_t mixer_nid)1196 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1197 {
1198 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1199 int err;
1200
1201 if (!spec)
1202 return -ENOMEM;
1203 codec->spec = spec;
1204 snd_hda_gen_spec_init(&spec->gen);
1205 spec->gen.mixer_nid = mixer_nid;
1206 spec->gen.own_eapd_ctl = 1;
1207 codec->single_adc_amp = 1;
1208 /* FIXME: do we need this for all Realtek codec models? */
1209 codec->spdif_status_reset = 1;
1210 codec->forced_resume = 1;
1211 codec->patch_ops = alc_patch_ops;
1212 mutex_init(&spec->coef_mutex);
1213
1214 err = alc_codec_rename_from_preset(codec);
1215 if (err < 0) {
1216 kfree(spec);
1217 return err;
1218 }
1219 return 0;
1220 }
1221
alc880_parse_auto_config(struct hda_codec * codec)1222 static int alc880_parse_auto_config(struct hda_codec *codec)
1223 {
1224 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1225 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1226 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1227 }
1228
1229 /*
1230 * ALC880 fix-ups
1231 */
1232 enum {
1233 ALC880_FIXUP_GPIO1,
1234 ALC880_FIXUP_GPIO2,
1235 ALC880_FIXUP_MEDION_RIM,
1236 ALC880_FIXUP_LG,
1237 ALC880_FIXUP_LG_LW25,
1238 ALC880_FIXUP_W810,
1239 ALC880_FIXUP_EAPD_COEF,
1240 ALC880_FIXUP_TCL_S700,
1241 ALC880_FIXUP_VOL_KNOB,
1242 ALC880_FIXUP_FUJITSU,
1243 ALC880_FIXUP_F1734,
1244 ALC880_FIXUP_UNIWILL,
1245 ALC880_FIXUP_UNIWILL_DIG,
1246 ALC880_FIXUP_Z71V,
1247 ALC880_FIXUP_ASUS_W5A,
1248 ALC880_FIXUP_3ST_BASE,
1249 ALC880_FIXUP_3ST,
1250 ALC880_FIXUP_3ST_DIG,
1251 ALC880_FIXUP_5ST_BASE,
1252 ALC880_FIXUP_5ST,
1253 ALC880_FIXUP_5ST_DIG,
1254 ALC880_FIXUP_6ST_BASE,
1255 ALC880_FIXUP_6ST,
1256 ALC880_FIXUP_6ST_DIG,
1257 ALC880_FIXUP_6ST_AUTOMUTE,
1258 };
1259
1260 /* enable the volume-knob widget support on NID 0x21 */
alc880_fixup_vol_knob(struct hda_codec * codec,const struct hda_fixup * fix,int action)1261 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1262 const struct hda_fixup *fix, int action)
1263 {
1264 if (action == HDA_FIXUP_ACT_PROBE)
1265 snd_hda_jack_detect_enable_callback(codec, 0x21,
1266 alc_update_knob_master);
1267 }
1268
1269 static const struct hda_fixup alc880_fixups[] = {
1270 [ALC880_FIXUP_GPIO1] = {
1271 .type = HDA_FIXUP_FUNC,
1272 .v.func = alc_fixup_gpio1,
1273 },
1274 [ALC880_FIXUP_GPIO2] = {
1275 .type = HDA_FIXUP_FUNC,
1276 .v.func = alc_fixup_gpio2,
1277 },
1278 [ALC880_FIXUP_MEDION_RIM] = {
1279 .type = HDA_FIXUP_VERBS,
1280 .v.verbs = (const struct hda_verb[]) {
1281 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1282 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1283 { }
1284 },
1285 .chained = true,
1286 .chain_id = ALC880_FIXUP_GPIO2,
1287 },
1288 [ALC880_FIXUP_LG] = {
1289 .type = HDA_FIXUP_PINS,
1290 .v.pins = (const struct hda_pintbl[]) {
1291 /* disable bogus unused pins */
1292 { 0x16, 0x411111f0 },
1293 { 0x18, 0x411111f0 },
1294 { 0x1a, 0x411111f0 },
1295 { }
1296 }
1297 },
1298 [ALC880_FIXUP_LG_LW25] = {
1299 .type = HDA_FIXUP_PINS,
1300 .v.pins = (const struct hda_pintbl[]) {
1301 { 0x1a, 0x0181344f }, /* line-in */
1302 { 0x1b, 0x0321403f }, /* headphone */
1303 { }
1304 }
1305 },
1306 [ALC880_FIXUP_W810] = {
1307 .type = HDA_FIXUP_PINS,
1308 .v.pins = (const struct hda_pintbl[]) {
1309 /* disable bogus unused pins */
1310 { 0x17, 0x411111f0 },
1311 { }
1312 },
1313 .chained = true,
1314 .chain_id = ALC880_FIXUP_GPIO2,
1315 },
1316 [ALC880_FIXUP_EAPD_COEF] = {
1317 .type = HDA_FIXUP_VERBS,
1318 .v.verbs = (const struct hda_verb[]) {
1319 /* change to EAPD mode */
1320 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1321 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1322 {}
1323 },
1324 },
1325 [ALC880_FIXUP_TCL_S700] = {
1326 .type = HDA_FIXUP_VERBS,
1327 .v.verbs = (const struct hda_verb[]) {
1328 /* change to EAPD mode */
1329 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1330 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1331 {}
1332 },
1333 .chained = true,
1334 .chain_id = ALC880_FIXUP_GPIO2,
1335 },
1336 [ALC880_FIXUP_VOL_KNOB] = {
1337 .type = HDA_FIXUP_FUNC,
1338 .v.func = alc880_fixup_vol_knob,
1339 },
1340 [ALC880_FIXUP_FUJITSU] = {
1341 /* override all pins as BIOS on old Amilo is broken */
1342 .type = HDA_FIXUP_PINS,
1343 .v.pins = (const struct hda_pintbl[]) {
1344 { 0x14, 0x0121401f }, /* HP */
1345 { 0x15, 0x99030120 }, /* speaker */
1346 { 0x16, 0x99030130 }, /* bass speaker */
1347 { 0x17, 0x411111f0 }, /* N/A */
1348 { 0x18, 0x411111f0 }, /* N/A */
1349 { 0x19, 0x01a19950 }, /* mic-in */
1350 { 0x1a, 0x411111f0 }, /* N/A */
1351 { 0x1b, 0x411111f0 }, /* N/A */
1352 { 0x1c, 0x411111f0 }, /* N/A */
1353 { 0x1d, 0x411111f0 }, /* N/A */
1354 { 0x1e, 0x01454140 }, /* SPDIF out */
1355 { }
1356 },
1357 .chained = true,
1358 .chain_id = ALC880_FIXUP_VOL_KNOB,
1359 },
1360 [ALC880_FIXUP_F1734] = {
1361 /* almost compatible with FUJITSU, but no bass and SPDIF */
1362 .type = HDA_FIXUP_PINS,
1363 .v.pins = (const struct hda_pintbl[]) {
1364 { 0x14, 0x0121401f }, /* HP */
1365 { 0x15, 0x99030120 }, /* speaker */
1366 { 0x16, 0x411111f0 }, /* N/A */
1367 { 0x17, 0x411111f0 }, /* N/A */
1368 { 0x18, 0x411111f0 }, /* N/A */
1369 { 0x19, 0x01a19950 }, /* mic-in */
1370 { 0x1a, 0x411111f0 }, /* N/A */
1371 { 0x1b, 0x411111f0 }, /* N/A */
1372 { 0x1c, 0x411111f0 }, /* N/A */
1373 { 0x1d, 0x411111f0 }, /* N/A */
1374 { 0x1e, 0x411111f0 }, /* N/A */
1375 { }
1376 },
1377 .chained = true,
1378 .chain_id = ALC880_FIXUP_VOL_KNOB,
1379 },
1380 [ALC880_FIXUP_UNIWILL] = {
1381 /* need to fix HP and speaker pins to be parsed correctly */
1382 .type = HDA_FIXUP_PINS,
1383 .v.pins = (const struct hda_pintbl[]) {
1384 { 0x14, 0x0121411f }, /* HP */
1385 { 0x15, 0x99030120 }, /* speaker */
1386 { 0x16, 0x99030130 }, /* bass speaker */
1387 { }
1388 },
1389 },
1390 [ALC880_FIXUP_UNIWILL_DIG] = {
1391 .type = HDA_FIXUP_PINS,
1392 .v.pins = (const struct hda_pintbl[]) {
1393 /* disable bogus unused pins */
1394 { 0x17, 0x411111f0 },
1395 { 0x19, 0x411111f0 },
1396 { 0x1b, 0x411111f0 },
1397 { 0x1f, 0x411111f0 },
1398 { }
1399 }
1400 },
1401 [ALC880_FIXUP_Z71V] = {
1402 .type = HDA_FIXUP_PINS,
1403 .v.pins = (const struct hda_pintbl[]) {
1404 /* set up the whole pins as BIOS is utterly broken */
1405 { 0x14, 0x99030120 }, /* speaker */
1406 { 0x15, 0x0121411f }, /* HP */
1407 { 0x16, 0x411111f0 }, /* N/A */
1408 { 0x17, 0x411111f0 }, /* N/A */
1409 { 0x18, 0x01a19950 }, /* mic-in */
1410 { 0x19, 0x411111f0 }, /* N/A */
1411 { 0x1a, 0x01813031 }, /* line-in */
1412 { 0x1b, 0x411111f0 }, /* N/A */
1413 { 0x1c, 0x411111f0 }, /* N/A */
1414 { 0x1d, 0x411111f0 }, /* N/A */
1415 { 0x1e, 0x0144111e }, /* SPDIF */
1416 { }
1417 }
1418 },
1419 [ALC880_FIXUP_ASUS_W5A] = {
1420 .type = HDA_FIXUP_PINS,
1421 .v.pins = (const struct hda_pintbl[]) {
1422 /* set up the whole pins as BIOS is utterly broken */
1423 { 0x14, 0x0121411f }, /* HP */
1424 { 0x15, 0x411111f0 }, /* N/A */
1425 { 0x16, 0x411111f0 }, /* N/A */
1426 { 0x17, 0x411111f0 }, /* N/A */
1427 { 0x18, 0x90a60160 }, /* mic */
1428 { 0x19, 0x411111f0 }, /* N/A */
1429 { 0x1a, 0x411111f0 }, /* N/A */
1430 { 0x1b, 0x411111f0 }, /* N/A */
1431 { 0x1c, 0x411111f0 }, /* N/A */
1432 { 0x1d, 0x411111f0 }, /* N/A */
1433 { 0x1e, 0xb743111e }, /* SPDIF out */
1434 { }
1435 },
1436 .chained = true,
1437 .chain_id = ALC880_FIXUP_GPIO1,
1438 },
1439 [ALC880_FIXUP_3ST_BASE] = {
1440 .type = HDA_FIXUP_PINS,
1441 .v.pins = (const struct hda_pintbl[]) {
1442 { 0x14, 0x01014010 }, /* line-out */
1443 { 0x15, 0x411111f0 }, /* N/A */
1444 { 0x16, 0x411111f0 }, /* N/A */
1445 { 0x17, 0x411111f0 }, /* N/A */
1446 { 0x18, 0x01a19c30 }, /* mic-in */
1447 { 0x19, 0x0121411f }, /* HP */
1448 { 0x1a, 0x01813031 }, /* line-in */
1449 { 0x1b, 0x02a19c40 }, /* front-mic */
1450 { 0x1c, 0x411111f0 }, /* N/A */
1451 { 0x1d, 0x411111f0 }, /* N/A */
1452 /* 0x1e is filled in below */
1453 { 0x1f, 0x411111f0 }, /* N/A */
1454 { }
1455 }
1456 },
1457 [ALC880_FIXUP_3ST] = {
1458 .type = HDA_FIXUP_PINS,
1459 .v.pins = (const struct hda_pintbl[]) {
1460 { 0x1e, 0x411111f0 }, /* N/A */
1461 { }
1462 },
1463 .chained = true,
1464 .chain_id = ALC880_FIXUP_3ST_BASE,
1465 },
1466 [ALC880_FIXUP_3ST_DIG] = {
1467 .type = HDA_FIXUP_PINS,
1468 .v.pins = (const struct hda_pintbl[]) {
1469 { 0x1e, 0x0144111e }, /* SPDIF */
1470 { }
1471 },
1472 .chained = true,
1473 .chain_id = ALC880_FIXUP_3ST_BASE,
1474 },
1475 [ALC880_FIXUP_5ST_BASE] = {
1476 .type = HDA_FIXUP_PINS,
1477 .v.pins = (const struct hda_pintbl[]) {
1478 { 0x14, 0x01014010 }, /* front */
1479 { 0x15, 0x411111f0 }, /* N/A */
1480 { 0x16, 0x01011411 }, /* CLFE */
1481 { 0x17, 0x01016412 }, /* surr */
1482 { 0x18, 0x01a19c30 }, /* mic-in */
1483 { 0x19, 0x0121411f }, /* HP */
1484 { 0x1a, 0x01813031 }, /* line-in */
1485 { 0x1b, 0x02a19c40 }, /* front-mic */
1486 { 0x1c, 0x411111f0 }, /* N/A */
1487 { 0x1d, 0x411111f0 }, /* N/A */
1488 /* 0x1e is filled in below */
1489 { 0x1f, 0x411111f0 }, /* N/A */
1490 { }
1491 }
1492 },
1493 [ALC880_FIXUP_5ST] = {
1494 .type = HDA_FIXUP_PINS,
1495 .v.pins = (const struct hda_pintbl[]) {
1496 { 0x1e, 0x411111f0 }, /* N/A */
1497 { }
1498 },
1499 .chained = true,
1500 .chain_id = ALC880_FIXUP_5ST_BASE,
1501 },
1502 [ALC880_FIXUP_5ST_DIG] = {
1503 .type = HDA_FIXUP_PINS,
1504 .v.pins = (const struct hda_pintbl[]) {
1505 { 0x1e, 0x0144111e }, /* SPDIF */
1506 { }
1507 },
1508 .chained = true,
1509 .chain_id = ALC880_FIXUP_5ST_BASE,
1510 },
1511 [ALC880_FIXUP_6ST_BASE] = {
1512 .type = HDA_FIXUP_PINS,
1513 .v.pins = (const struct hda_pintbl[]) {
1514 { 0x14, 0x01014010 }, /* front */
1515 { 0x15, 0x01016412 }, /* surr */
1516 { 0x16, 0x01011411 }, /* CLFE */
1517 { 0x17, 0x01012414 }, /* side */
1518 { 0x18, 0x01a19c30 }, /* mic-in */
1519 { 0x19, 0x02a19c40 }, /* front-mic */
1520 { 0x1a, 0x01813031 }, /* line-in */
1521 { 0x1b, 0x0121411f }, /* HP */
1522 { 0x1c, 0x411111f0 }, /* N/A */
1523 { 0x1d, 0x411111f0 }, /* N/A */
1524 /* 0x1e is filled in below */
1525 { 0x1f, 0x411111f0 }, /* N/A */
1526 { }
1527 }
1528 },
1529 [ALC880_FIXUP_6ST] = {
1530 .type = HDA_FIXUP_PINS,
1531 .v.pins = (const struct hda_pintbl[]) {
1532 { 0x1e, 0x411111f0 }, /* N/A */
1533 { }
1534 },
1535 .chained = true,
1536 .chain_id = ALC880_FIXUP_6ST_BASE,
1537 },
1538 [ALC880_FIXUP_6ST_DIG] = {
1539 .type = HDA_FIXUP_PINS,
1540 .v.pins = (const struct hda_pintbl[]) {
1541 { 0x1e, 0x0144111e }, /* SPDIF */
1542 { }
1543 },
1544 .chained = true,
1545 .chain_id = ALC880_FIXUP_6ST_BASE,
1546 },
1547 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1548 .type = HDA_FIXUP_PINS,
1549 .v.pins = (const struct hda_pintbl[]) {
1550 { 0x1b, 0x0121401f }, /* HP with jack detect */
1551 { }
1552 },
1553 .chained_before = true,
1554 .chain_id = ALC880_FIXUP_6ST_BASE,
1555 },
1556 };
1557
1558 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1559 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1560 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1561 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1562 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1563 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1564 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1565 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1566 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1567 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1568 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1569 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1570 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1571 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1572 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1573 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1574 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1575 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1576 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1577 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1578 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1579 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1580 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1581 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1582
1583 /* Below is the copied entries from alc880_quirks.c.
1584 * It's not quite sure whether BIOS sets the correct pin-config table
1585 * on these machines, thus they are kept to be compatible with
1586 * the old static quirks. Once when it's confirmed to work without
1587 * these overrides, it'd be better to remove.
1588 */
1589 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1590 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1591 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1592 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1593 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1594 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1595 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1596 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1597 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1598 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1599 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1600 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1601 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1602 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1603 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1604 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1605 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1606 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1607 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1608 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1609 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1610 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1611 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1612 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1615 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1616 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1617 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1618 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1619 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1620 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1621 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1622 /* default Intel */
1623 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1624 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1625 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1626 {}
1627 };
1628
1629 static const struct hda_model_fixup alc880_fixup_models[] = {
1630 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1631 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1632 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1633 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1634 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1635 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1636 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1637 {}
1638 };
1639
1640
1641 /*
1642 * OK, here we have finally the patch for ALC880
1643 */
patch_alc880(struct hda_codec * codec)1644 static int patch_alc880(struct hda_codec *codec)
1645 {
1646 struct alc_spec *spec;
1647 int err;
1648
1649 err = alc_alloc_spec(codec, 0x0b);
1650 if (err < 0)
1651 return err;
1652
1653 spec = codec->spec;
1654 spec->gen.need_dac_fix = 1;
1655 spec->gen.beep_nid = 0x01;
1656
1657 codec->patch_ops.unsol_event = alc880_unsol_event;
1658
1659 alc_pre_init(codec);
1660
1661 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1662 alc880_fixups);
1663 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1664
1665 /* automatic parse from the BIOS config */
1666 err = alc880_parse_auto_config(codec);
1667 if (err < 0)
1668 goto error;
1669
1670 if (!spec->gen.no_analog) {
1671 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1672 if (err < 0)
1673 goto error;
1674 }
1675
1676 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1677
1678 return 0;
1679
1680 error:
1681 alc_free(codec);
1682 return err;
1683 }
1684
1685
1686 /*
1687 * ALC260 support
1688 */
alc260_parse_auto_config(struct hda_codec * codec)1689 static int alc260_parse_auto_config(struct hda_codec *codec)
1690 {
1691 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1692 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1693 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1694 }
1695
1696 /*
1697 * Pin config fixes
1698 */
1699 enum {
1700 ALC260_FIXUP_HP_DC5750,
1701 ALC260_FIXUP_HP_PIN_0F,
1702 ALC260_FIXUP_COEF,
1703 ALC260_FIXUP_GPIO1,
1704 ALC260_FIXUP_GPIO1_TOGGLE,
1705 ALC260_FIXUP_REPLACER,
1706 ALC260_FIXUP_HP_B1900,
1707 ALC260_FIXUP_KN1,
1708 ALC260_FIXUP_FSC_S7020,
1709 ALC260_FIXUP_FSC_S7020_JWSE,
1710 ALC260_FIXUP_VAIO_PINS,
1711 };
1712
alc260_gpio1_automute(struct hda_codec * codec)1713 static void alc260_gpio1_automute(struct hda_codec *codec)
1714 {
1715 struct alc_spec *spec = codec->spec;
1716
1717 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1718 }
1719
alc260_fixup_gpio1_toggle(struct hda_codec * codec,const struct hda_fixup * fix,int action)1720 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1721 const struct hda_fixup *fix, int action)
1722 {
1723 struct alc_spec *spec = codec->spec;
1724 if (action == HDA_FIXUP_ACT_PROBE) {
1725 /* although the machine has only one output pin, we need to
1726 * toggle GPIO1 according to the jack state
1727 */
1728 spec->gen.automute_hook = alc260_gpio1_automute;
1729 spec->gen.detect_hp = 1;
1730 spec->gen.automute_speaker = 1;
1731 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1732 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1733 snd_hda_gen_hp_automute);
1734 alc_setup_gpio(codec, 0x01);
1735 }
1736 }
1737
alc260_fixup_kn1(struct hda_codec * codec,const struct hda_fixup * fix,int action)1738 static void alc260_fixup_kn1(struct hda_codec *codec,
1739 const struct hda_fixup *fix, int action)
1740 {
1741 struct alc_spec *spec = codec->spec;
1742 static const struct hda_pintbl pincfgs[] = {
1743 { 0x0f, 0x02214000 }, /* HP/speaker */
1744 { 0x12, 0x90a60160 }, /* int mic */
1745 { 0x13, 0x02a19000 }, /* ext mic */
1746 { 0x18, 0x01446000 }, /* SPDIF out */
1747 /* disable bogus I/O pins */
1748 { 0x10, 0x411111f0 },
1749 { 0x11, 0x411111f0 },
1750 { 0x14, 0x411111f0 },
1751 { 0x15, 0x411111f0 },
1752 { 0x16, 0x411111f0 },
1753 { 0x17, 0x411111f0 },
1754 { 0x19, 0x411111f0 },
1755 { }
1756 };
1757
1758 switch (action) {
1759 case HDA_FIXUP_ACT_PRE_PROBE:
1760 snd_hda_apply_pincfgs(codec, pincfgs);
1761 spec->init_amp = ALC_INIT_NONE;
1762 break;
1763 }
1764 }
1765
alc260_fixup_fsc_s7020(struct hda_codec * codec,const struct hda_fixup * fix,int action)1766 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1767 const struct hda_fixup *fix, int action)
1768 {
1769 struct alc_spec *spec = codec->spec;
1770 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1771 spec->init_amp = ALC_INIT_NONE;
1772 }
1773
alc260_fixup_fsc_s7020_jwse(struct hda_codec * codec,const struct hda_fixup * fix,int action)1774 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1775 const struct hda_fixup *fix, int action)
1776 {
1777 struct alc_spec *spec = codec->spec;
1778 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1779 spec->gen.add_jack_modes = 1;
1780 spec->gen.hp_mic = 1;
1781 }
1782 }
1783
1784 static const struct hda_fixup alc260_fixups[] = {
1785 [ALC260_FIXUP_HP_DC5750] = {
1786 .type = HDA_FIXUP_PINS,
1787 .v.pins = (const struct hda_pintbl[]) {
1788 { 0x11, 0x90130110 }, /* speaker */
1789 { }
1790 }
1791 },
1792 [ALC260_FIXUP_HP_PIN_0F] = {
1793 .type = HDA_FIXUP_PINS,
1794 .v.pins = (const struct hda_pintbl[]) {
1795 { 0x0f, 0x01214000 }, /* HP */
1796 { }
1797 }
1798 },
1799 [ALC260_FIXUP_COEF] = {
1800 .type = HDA_FIXUP_VERBS,
1801 .v.verbs = (const struct hda_verb[]) {
1802 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1803 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1804 { }
1805 },
1806 },
1807 [ALC260_FIXUP_GPIO1] = {
1808 .type = HDA_FIXUP_FUNC,
1809 .v.func = alc_fixup_gpio1,
1810 },
1811 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1812 .type = HDA_FIXUP_FUNC,
1813 .v.func = alc260_fixup_gpio1_toggle,
1814 .chained = true,
1815 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1816 },
1817 [ALC260_FIXUP_REPLACER] = {
1818 .type = HDA_FIXUP_VERBS,
1819 .v.verbs = (const struct hda_verb[]) {
1820 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1821 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1822 { }
1823 },
1824 .chained = true,
1825 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1826 },
1827 [ALC260_FIXUP_HP_B1900] = {
1828 .type = HDA_FIXUP_FUNC,
1829 .v.func = alc260_fixup_gpio1_toggle,
1830 .chained = true,
1831 .chain_id = ALC260_FIXUP_COEF,
1832 },
1833 [ALC260_FIXUP_KN1] = {
1834 .type = HDA_FIXUP_FUNC,
1835 .v.func = alc260_fixup_kn1,
1836 },
1837 [ALC260_FIXUP_FSC_S7020] = {
1838 .type = HDA_FIXUP_FUNC,
1839 .v.func = alc260_fixup_fsc_s7020,
1840 },
1841 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1842 .type = HDA_FIXUP_FUNC,
1843 .v.func = alc260_fixup_fsc_s7020_jwse,
1844 .chained = true,
1845 .chain_id = ALC260_FIXUP_FSC_S7020,
1846 },
1847 [ALC260_FIXUP_VAIO_PINS] = {
1848 .type = HDA_FIXUP_PINS,
1849 .v.pins = (const struct hda_pintbl[]) {
1850 /* Pin configs are missing completely on some VAIOs */
1851 { 0x0f, 0x01211020 },
1852 { 0x10, 0x0001003f },
1853 { 0x11, 0x411111f0 },
1854 { 0x12, 0x01a15930 },
1855 { 0x13, 0x411111f0 },
1856 { 0x14, 0x411111f0 },
1857 { 0x15, 0x411111f0 },
1858 { 0x16, 0x411111f0 },
1859 { 0x17, 0x411111f0 },
1860 { 0x18, 0x411111f0 },
1861 { 0x19, 0x411111f0 },
1862 { }
1863 }
1864 },
1865 };
1866
1867 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1868 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1869 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1870 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1871 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1872 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1873 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1874 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1875 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1876 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1877 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1878 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1879 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1880 {}
1881 };
1882
1883 static const struct hda_model_fixup alc260_fixup_models[] = {
1884 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1885 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1886 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1887 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1888 {}
1889 };
1890
1891 /*
1892 */
patch_alc260(struct hda_codec * codec)1893 static int patch_alc260(struct hda_codec *codec)
1894 {
1895 struct alc_spec *spec;
1896 int err;
1897
1898 err = alc_alloc_spec(codec, 0x07);
1899 if (err < 0)
1900 return err;
1901
1902 spec = codec->spec;
1903 /* as quite a few machines require HP amp for speaker outputs,
1904 * it's easier to enable it unconditionally; even if it's unneeded,
1905 * it's almost harmless.
1906 */
1907 spec->gen.prefer_hp_amp = 1;
1908 spec->gen.beep_nid = 0x01;
1909
1910 spec->shutup = alc_eapd_shutup;
1911
1912 alc_pre_init(codec);
1913
1914 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1915 alc260_fixups);
1916 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1917
1918 /* automatic parse from the BIOS config */
1919 err = alc260_parse_auto_config(codec);
1920 if (err < 0)
1921 goto error;
1922
1923 if (!spec->gen.no_analog) {
1924 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1925 if (err < 0)
1926 goto error;
1927 }
1928
1929 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1930
1931 return 0;
1932
1933 error:
1934 alc_free(codec);
1935 return err;
1936 }
1937
1938
1939 /*
1940 * ALC882/883/885/888/889 support
1941 *
1942 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1943 * configuration. Each pin widget can choose any input DACs and a mixer.
1944 * Each ADC is connected from a mixer of all inputs. This makes possible
1945 * 6-channel independent captures.
1946 *
1947 * In addition, an independent DAC for the multi-playback (not used in this
1948 * driver yet).
1949 */
1950
1951 /*
1952 * Pin config fixes
1953 */
1954 enum {
1955 ALC882_FIXUP_ABIT_AW9D_MAX,
1956 ALC882_FIXUP_LENOVO_Y530,
1957 ALC882_FIXUP_PB_M5210,
1958 ALC882_FIXUP_ACER_ASPIRE_7736,
1959 ALC882_FIXUP_ASUS_W90V,
1960 ALC889_FIXUP_CD,
1961 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1962 ALC889_FIXUP_VAIO_TT,
1963 ALC888_FIXUP_EEE1601,
1964 ALC886_FIXUP_EAPD,
1965 ALC882_FIXUP_EAPD,
1966 ALC883_FIXUP_EAPD,
1967 ALC883_FIXUP_ACER_EAPD,
1968 ALC882_FIXUP_GPIO1,
1969 ALC882_FIXUP_GPIO2,
1970 ALC882_FIXUP_GPIO3,
1971 ALC889_FIXUP_COEF,
1972 ALC882_FIXUP_ASUS_W2JC,
1973 ALC882_FIXUP_ACER_ASPIRE_4930G,
1974 ALC882_FIXUP_ACER_ASPIRE_8930G,
1975 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1976 ALC885_FIXUP_MACPRO_GPIO,
1977 ALC889_FIXUP_DAC_ROUTE,
1978 ALC889_FIXUP_MBP_VREF,
1979 ALC889_FIXUP_IMAC91_VREF,
1980 ALC889_FIXUP_MBA11_VREF,
1981 ALC889_FIXUP_MBA21_VREF,
1982 ALC889_FIXUP_MP11_VREF,
1983 ALC889_FIXUP_MP41_VREF,
1984 ALC882_FIXUP_INV_DMIC,
1985 ALC882_FIXUP_NO_PRIMARY_HP,
1986 ALC887_FIXUP_ASUS_BASS,
1987 ALC887_FIXUP_BASS_CHMAP,
1988 ALC1220_FIXUP_GB_DUAL_CODECS,
1989 ALC1220_FIXUP_GB_X570,
1990 ALC1220_FIXUP_CLEVO_P950,
1991 ALC1220_FIXUP_CLEVO_PB51ED,
1992 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1993 ALC887_FIXUP_ASUS_AUDIO,
1994 ALC887_FIXUP_ASUS_HMIC,
1995 ALCS1200A_FIXUP_MIC_VREF,
1996 };
1997
alc889_fixup_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)1998 static void alc889_fixup_coef(struct hda_codec *codec,
1999 const struct hda_fixup *fix, int action)
2000 {
2001 if (action != HDA_FIXUP_ACT_INIT)
2002 return;
2003 alc_update_coef_idx(codec, 7, 0, 0x2030);
2004 }
2005
2006 /* set up GPIO at initialization */
alc885_fixup_macpro_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)2007 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2008 const struct hda_fixup *fix, int action)
2009 {
2010 struct alc_spec *spec = codec->spec;
2011
2012 spec->gpio_write_delay = true;
2013 alc_fixup_gpio3(codec, fix, action);
2014 }
2015
2016 /* Fix the connection of some pins for ALC889:
2017 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2018 * work correctly (bko#42740)
2019 */
alc889_fixup_dac_route(struct hda_codec * codec,const struct hda_fixup * fix,int action)2020 static void alc889_fixup_dac_route(struct hda_codec *codec,
2021 const struct hda_fixup *fix, int action)
2022 {
2023 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2024 /* fake the connections during parsing the tree */
2025 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2026 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2027 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2028 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2029 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2030 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2031 } else if (action == HDA_FIXUP_ACT_PROBE) {
2032 /* restore the connections */
2033 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2034 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2035 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2036 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2037 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2038 }
2039 }
2040
2041 /* Set VREF on HP pin */
alc889_fixup_mbp_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2042 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2043 const struct hda_fixup *fix, int action)
2044 {
2045 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2046 struct alc_spec *spec = codec->spec;
2047 int i;
2048
2049 if (action != HDA_FIXUP_ACT_INIT)
2050 return;
2051 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2052 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2053 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2054 continue;
2055 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2056 val |= AC_PINCTL_VREF_80;
2057 snd_hda_set_pin_ctl(codec, nids[i], val);
2058 spec->gen.keep_vref_in_automute = 1;
2059 break;
2060 }
2061 }
2062
alc889_fixup_mac_pins(struct hda_codec * codec,const hda_nid_t * nids,int num_nids)2063 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2064 const hda_nid_t *nids, int num_nids)
2065 {
2066 struct alc_spec *spec = codec->spec;
2067 int i;
2068
2069 for (i = 0; i < num_nids; i++) {
2070 unsigned int val;
2071 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2072 val |= AC_PINCTL_VREF_50;
2073 snd_hda_set_pin_ctl(codec, nids[i], val);
2074 }
2075 spec->gen.keep_vref_in_automute = 1;
2076 }
2077
2078 /* Set VREF on speaker pins on imac91 */
alc889_fixup_imac91_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2079 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2080 const struct hda_fixup *fix, int action)
2081 {
2082 static const hda_nid_t nids[] = { 0x18, 0x1a };
2083
2084 if (action == HDA_FIXUP_ACT_INIT)
2085 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2086 }
2087
2088 /* Set VREF on speaker pins on mba11 */
alc889_fixup_mba11_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2089 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2090 const struct hda_fixup *fix, int action)
2091 {
2092 static const hda_nid_t nids[] = { 0x18 };
2093
2094 if (action == HDA_FIXUP_ACT_INIT)
2095 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2096 }
2097
2098 /* Set VREF on speaker pins on mba21 */
alc889_fixup_mba21_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)2099 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2100 const struct hda_fixup *fix, int action)
2101 {
2102 static const hda_nid_t nids[] = { 0x18, 0x19 };
2103
2104 if (action == HDA_FIXUP_ACT_INIT)
2105 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2106 }
2107
2108 /* Don't take HP output as primary
2109 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2110 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2111 */
alc882_fixup_no_primary_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)2112 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2113 const struct hda_fixup *fix, int action)
2114 {
2115 struct alc_spec *spec = codec->spec;
2116 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2117 spec->gen.no_primary_hp = 1;
2118 spec->gen.no_multi_io = 1;
2119 }
2120 }
2121
2122 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2123 const struct hda_fixup *fix, int action);
2124
2125 /* For dual-codec configuration, we need to disable some features to avoid
2126 * conflicts of kctls and PCM streams
2127 */
alc_fixup_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2128 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2129 const struct hda_fixup *fix, int action)
2130 {
2131 struct alc_spec *spec = codec->spec;
2132
2133 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2134 return;
2135 /* disable vmaster */
2136 spec->gen.suppress_vmaster = 1;
2137 /* auto-mute and auto-mic switch don't work with multiple codecs */
2138 spec->gen.suppress_auto_mute = 1;
2139 spec->gen.suppress_auto_mic = 1;
2140 /* disable aamix as well */
2141 spec->gen.mixer_nid = 0;
2142 /* add location prefix to avoid conflicts */
2143 codec->force_pin_prefix = 1;
2144 }
2145
rename_ctl(struct hda_codec * codec,const char * oldname,const char * newname)2146 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2147 const char *newname)
2148 {
2149 struct snd_kcontrol *kctl;
2150
2151 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2152 if (kctl)
2153 strcpy(kctl->id.name, newname);
2154 }
2155
alc1220_fixup_gb_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)2156 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2157 const struct hda_fixup *fix,
2158 int action)
2159 {
2160 alc_fixup_dual_codecs(codec, fix, action);
2161 switch (action) {
2162 case HDA_FIXUP_ACT_PRE_PROBE:
2163 /* override card longname to provide a unique UCM profile */
2164 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2165 break;
2166 case HDA_FIXUP_ACT_BUILD:
2167 /* rename Capture controls depending on the codec */
2168 rename_ctl(codec, "Capture Volume",
2169 codec->addr == 0 ?
2170 "Rear-Panel Capture Volume" :
2171 "Front-Panel Capture Volume");
2172 rename_ctl(codec, "Capture Switch",
2173 codec->addr == 0 ?
2174 "Rear-Panel Capture Switch" :
2175 "Front-Panel Capture Switch");
2176 break;
2177 }
2178 }
2179
alc1220_fixup_gb_x570(struct hda_codec * codec,const struct hda_fixup * fix,int action)2180 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2181 const struct hda_fixup *fix,
2182 int action)
2183 {
2184 static const hda_nid_t conn1[] = { 0x0c };
2185 static const struct coef_fw gb_x570_coefs[] = {
2186 WRITE_COEF(0x07, 0x03c0),
2187 WRITE_COEF(0x1a, 0x01c1),
2188 WRITE_COEF(0x1b, 0x0202),
2189 WRITE_COEF(0x43, 0x3005),
2190 {}
2191 };
2192
2193 switch (action) {
2194 case HDA_FIXUP_ACT_PRE_PROBE:
2195 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2196 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2197 break;
2198 case HDA_FIXUP_ACT_INIT:
2199 alc_process_coef_fw(codec, gb_x570_coefs);
2200 break;
2201 }
2202 }
2203
alc1220_fixup_clevo_p950(struct hda_codec * codec,const struct hda_fixup * fix,int action)2204 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2205 const struct hda_fixup *fix,
2206 int action)
2207 {
2208 static const hda_nid_t conn1[] = { 0x0c };
2209
2210 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2211 return;
2212
2213 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2214 /* We therefore want to make sure 0x14 (front headphone) and
2215 * 0x1b (speakers) use the stereo DAC 0x02
2216 */
2217 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2218 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2219 }
2220
2221 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2222 const struct hda_fixup *fix, int action);
2223
alc1220_fixup_clevo_pb51ed(struct hda_codec * codec,const struct hda_fixup * fix,int action)2224 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2225 const struct hda_fixup *fix,
2226 int action)
2227 {
2228 alc1220_fixup_clevo_p950(codec, fix, action);
2229 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2230 }
2231
alc887_asus_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)2232 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2233 struct hda_jack_callback *jack)
2234 {
2235 struct alc_spec *spec = codec->spec;
2236 unsigned int vref;
2237
2238 snd_hda_gen_hp_automute(codec, jack);
2239
2240 if (spec->gen.hp_jack_present)
2241 vref = AC_PINCTL_VREF_80;
2242 else
2243 vref = AC_PINCTL_VREF_HIZ;
2244 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2245 }
2246
alc887_fixup_asus_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)2247 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2248 const struct hda_fixup *fix, int action)
2249 {
2250 struct alc_spec *spec = codec->spec;
2251 if (action != HDA_FIXUP_ACT_PROBE)
2252 return;
2253 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2254 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2255 }
2256
2257 static const struct hda_fixup alc882_fixups[] = {
2258 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2259 .type = HDA_FIXUP_PINS,
2260 .v.pins = (const struct hda_pintbl[]) {
2261 { 0x15, 0x01080104 }, /* side */
2262 { 0x16, 0x01011012 }, /* rear */
2263 { 0x17, 0x01016011 }, /* clfe */
2264 { }
2265 }
2266 },
2267 [ALC882_FIXUP_LENOVO_Y530] = {
2268 .type = HDA_FIXUP_PINS,
2269 .v.pins = (const struct hda_pintbl[]) {
2270 { 0x15, 0x99130112 }, /* rear int speakers */
2271 { 0x16, 0x99130111 }, /* subwoofer */
2272 { }
2273 }
2274 },
2275 [ALC882_FIXUP_PB_M5210] = {
2276 .type = HDA_FIXUP_PINCTLS,
2277 .v.pins = (const struct hda_pintbl[]) {
2278 { 0x19, PIN_VREF50 },
2279 {}
2280 }
2281 },
2282 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2283 .type = HDA_FIXUP_FUNC,
2284 .v.func = alc_fixup_sku_ignore,
2285 },
2286 [ALC882_FIXUP_ASUS_W90V] = {
2287 .type = HDA_FIXUP_PINS,
2288 .v.pins = (const struct hda_pintbl[]) {
2289 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2290 { }
2291 }
2292 },
2293 [ALC889_FIXUP_CD] = {
2294 .type = HDA_FIXUP_PINS,
2295 .v.pins = (const struct hda_pintbl[]) {
2296 { 0x1c, 0x993301f0 }, /* CD */
2297 { }
2298 }
2299 },
2300 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2301 .type = HDA_FIXUP_PINS,
2302 .v.pins = (const struct hda_pintbl[]) {
2303 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2304 { }
2305 },
2306 .chained = true,
2307 .chain_id = ALC889_FIXUP_CD,
2308 },
2309 [ALC889_FIXUP_VAIO_TT] = {
2310 .type = HDA_FIXUP_PINS,
2311 .v.pins = (const struct hda_pintbl[]) {
2312 { 0x17, 0x90170111 }, /* hidden surround speaker */
2313 { }
2314 }
2315 },
2316 [ALC888_FIXUP_EEE1601] = {
2317 .type = HDA_FIXUP_VERBS,
2318 .v.verbs = (const struct hda_verb[]) {
2319 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2320 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2321 { }
2322 }
2323 },
2324 [ALC886_FIXUP_EAPD] = {
2325 .type = HDA_FIXUP_VERBS,
2326 .v.verbs = (const struct hda_verb[]) {
2327 /* change to EAPD mode */
2328 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2329 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2330 { }
2331 }
2332 },
2333 [ALC882_FIXUP_EAPD] = {
2334 .type = HDA_FIXUP_VERBS,
2335 .v.verbs = (const struct hda_verb[]) {
2336 /* change to EAPD mode */
2337 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2338 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2339 { }
2340 }
2341 },
2342 [ALC883_FIXUP_EAPD] = {
2343 .type = HDA_FIXUP_VERBS,
2344 .v.verbs = (const struct hda_verb[]) {
2345 /* change to EAPD mode */
2346 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2347 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2348 { }
2349 }
2350 },
2351 [ALC883_FIXUP_ACER_EAPD] = {
2352 .type = HDA_FIXUP_VERBS,
2353 .v.verbs = (const struct hda_verb[]) {
2354 /* eanable EAPD on Acer laptops */
2355 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2356 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2357 { }
2358 }
2359 },
2360 [ALC882_FIXUP_GPIO1] = {
2361 .type = HDA_FIXUP_FUNC,
2362 .v.func = alc_fixup_gpio1,
2363 },
2364 [ALC882_FIXUP_GPIO2] = {
2365 .type = HDA_FIXUP_FUNC,
2366 .v.func = alc_fixup_gpio2,
2367 },
2368 [ALC882_FIXUP_GPIO3] = {
2369 .type = HDA_FIXUP_FUNC,
2370 .v.func = alc_fixup_gpio3,
2371 },
2372 [ALC882_FIXUP_ASUS_W2JC] = {
2373 .type = HDA_FIXUP_FUNC,
2374 .v.func = alc_fixup_gpio1,
2375 .chained = true,
2376 .chain_id = ALC882_FIXUP_EAPD,
2377 },
2378 [ALC889_FIXUP_COEF] = {
2379 .type = HDA_FIXUP_FUNC,
2380 .v.func = alc889_fixup_coef,
2381 },
2382 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2383 .type = HDA_FIXUP_PINS,
2384 .v.pins = (const struct hda_pintbl[]) {
2385 { 0x16, 0x99130111 }, /* CLFE speaker */
2386 { 0x17, 0x99130112 }, /* surround speaker */
2387 { }
2388 },
2389 .chained = true,
2390 .chain_id = ALC882_FIXUP_GPIO1,
2391 },
2392 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2393 .type = HDA_FIXUP_PINS,
2394 .v.pins = (const struct hda_pintbl[]) {
2395 { 0x16, 0x99130111 }, /* CLFE speaker */
2396 { 0x1b, 0x99130112 }, /* surround speaker */
2397 { }
2398 },
2399 .chained = true,
2400 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2401 },
2402 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2403 /* additional init verbs for Acer Aspire 8930G */
2404 .type = HDA_FIXUP_VERBS,
2405 .v.verbs = (const struct hda_verb[]) {
2406 /* Enable all DACs */
2407 /* DAC DISABLE/MUTE 1? */
2408 /* setting bits 1-5 disables DAC nids 0x02-0x06
2409 * apparently. Init=0x38 */
2410 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2411 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2412 /* DAC DISABLE/MUTE 2? */
2413 /* some bit here disables the other DACs.
2414 * Init=0x4900 */
2415 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2416 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2417 /* DMIC fix
2418 * This laptop has a stereo digital microphone.
2419 * The mics are only 1cm apart which makes the stereo
2420 * useless. However, either the mic or the ALC889
2421 * makes the signal become a difference/sum signal
2422 * instead of standard stereo, which is annoying.
2423 * So instead we flip this bit which makes the
2424 * codec replicate the sum signal to both channels,
2425 * turning it into a normal mono mic.
2426 */
2427 /* DMIC_CONTROL? Init value = 0x0001 */
2428 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2429 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2430 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2431 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2432 { }
2433 },
2434 .chained = true,
2435 .chain_id = ALC882_FIXUP_GPIO1,
2436 },
2437 [ALC885_FIXUP_MACPRO_GPIO] = {
2438 .type = HDA_FIXUP_FUNC,
2439 .v.func = alc885_fixup_macpro_gpio,
2440 },
2441 [ALC889_FIXUP_DAC_ROUTE] = {
2442 .type = HDA_FIXUP_FUNC,
2443 .v.func = alc889_fixup_dac_route,
2444 },
2445 [ALC889_FIXUP_MBP_VREF] = {
2446 .type = HDA_FIXUP_FUNC,
2447 .v.func = alc889_fixup_mbp_vref,
2448 .chained = true,
2449 .chain_id = ALC882_FIXUP_GPIO1,
2450 },
2451 [ALC889_FIXUP_IMAC91_VREF] = {
2452 .type = HDA_FIXUP_FUNC,
2453 .v.func = alc889_fixup_imac91_vref,
2454 .chained = true,
2455 .chain_id = ALC882_FIXUP_GPIO1,
2456 },
2457 [ALC889_FIXUP_MBA11_VREF] = {
2458 .type = HDA_FIXUP_FUNC,
2459 .v.func = alc889_fixup_mba11_vref,
2460 .chained = true,
2461 .chain_id = ALC889_FIXUP_MBP_VREF,
2462 },
2463 [ALC889_FIXUP_MBA21_VREF] = {
2464 .type = HDA_FIXUP_FUNC,
2465 .v.func = alc889_fixup_mba21_vref,
2466 .chained = true,
2467 .chain_id = ALC889_FIXUP_MBP_VREF,
2468 },
2469 [ALC889_FIXUP_MP11_VREF] = {
2470 .type = HDA_FIXUP_FUNC,
2471 .v.func = alc889_fixup_mba11_vref,
2472 .chained = true,
2473 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2474 },
2475 [ALC889_FIXUP_MP41_VREF] = {
2476 .type = HDA_FIXUP_FUNC,
2477 .v.func = alc889_fixup_mbp_vref,
2478 .chained = true,
2479 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2480 },
2481 [ALC882_FIXUP_INV_DMIC] = {
2482 .type = HDA_FIXUP_FUNC,
2483 .v.func = alc_fixup_inv_dmic,
2484 },
2485 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2486 .type = HDA_FIXUP_FUNC,
2487 .v.func = alc882_fixup_no_primary_hp,
2488 },
2489 [ALC887_FIXUP_ASUS_BASS] = {
2490 .type = HDA_FIXUP_PINS,
2491 .v.pins = (const struct hda_pintbl[]) {
2492 {0x16, 0x99130130}, /* bass speaker */
2493 {}
2494 },
2495 .chained = true,
2496 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2497 },
2498 [ALC887_FIXUP_BASS_CHMAP] = {
2499 .type = HDA_FIXUP_FUNC,
2500 .v.func = alc_fixup_bass_chmap,
2501 },
2502 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2503 .type = HDA_FIXUP_FUNC,
2504 .v.func = alc1220_fixup_gb_dual_codecs,
2505 },
2506 [ALC1220_FIXUP_GB_X570] = {
2507 .type = HDA_FIXUP_FUNC,
2508 .v.func = alc1220_fixup_gb_x570,
2509 },
2510 [ALC1220_FIXUP_CLEVO_P950] = {
2511 .type = HDA_FIXUP_FUNC,
2512 .v.func = alc1220_fixup_clevo_p950,
2513 },
2514 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2515 .type = HDA_FIXUP_FUNC,
2516 .v.func = alc1220_fixup_clevo_pb51ed,
2517 },
2518 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2519 .type = HDA_FIXUP_PINS,
2520 .v.pins = (const struct hda_pintbl[]) {
2521 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2522 {}
2523 },
2524 .chained = true,
2525 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2526 },
2527 [ALC887_FIXUP_ASUS_AUDIO] = {
2528 .type = HDA_FIXUP_PINS,
2529 .v.pins = (const struct hda_pintbl[]) {
2530 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2531 { 0x19, 0x22219420 },
2532 {}
2533 },
2534 },
2535 [ALC887_FIXUP_ASUS_HMIC] = {
2536 .type = HDA_FIXUP_FUNC,
2537 .v.func = alc887_fixup_asus_jack,
2538 .chained = true,
2539 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2540 },
2541 [ALCS1200A_FIXUP_MIC_VREF] = {
2542 .type = HDA_FIXUP_PINCTLS,
2543 .v.pins = (const struct hda_pintbl[]) {
2544 { 0x18, PIN_VREF50 }, /* rear mic */
2545 { 0x19, PIN_VREF50 }, /* front mic */
2546 {}
2547 }
2548 },
2549 };
2550
2551 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2552 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2553 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2554 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2555 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2556 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2557 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2558 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2559 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2560 ALC882_FIXUP_ACER_ASPIRE_4930G),
2561 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2562 ALC882_FIXUP_ACER_ASPIRE_4930G),
2563 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2564 ALC882_FIXUP_ACER_ASPIRE_8930G),
2565 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2566 ALC882_FIXUP_ACER_ASPIRE_8930G),
2567 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2568 ALC882_FIXUP_ACER_ASPIRE_4930G),
2569 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2570 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2571 ALC882_FIXUP_ACER_ASPIRE_4930G),
2572 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2573 ALC882_FIXUP_ACER_ASPIRE_4930G),
2574 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2575 ALC882_FIXUP_ACER_ASPIRE_4930G),
2576 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2577 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2578 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2579 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2580 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2581 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2582 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2583 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2584 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2585 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2586 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2587 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2588 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2589 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2590 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2591 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2592
2593 /* All Apple entries are in codec SSIDs */
2594 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2595 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2596 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2597 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2598 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2599 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2600 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2601 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2602 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2603 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2604 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2605 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2606 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2607 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2608 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2609 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2610 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2611 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2612 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2613 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2614 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2615 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2616
2617 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2618 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2619 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2620 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2621 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2622 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2623 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2624 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2625 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2626 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2627 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2628 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2629 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2630 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2631 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2632 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2633 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2634 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2635 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2636 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2637 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2638 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2639 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2640 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2641 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2642 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2643 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2645 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2646 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2647 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2648 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2650 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2651 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2652 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2653 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2654 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2655 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2656 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2657 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2658 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2659 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2660 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2661 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2662 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2663 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2664 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2665 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2666 {}
2667 };
2668
2669 static const struct hda_model_fixup alc882_fixup_models[] = {
2670 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2671 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2672 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2673 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2674 {.id = ALC889_FIXUP_CD, .name = "cd"},
2675 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2676 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2677 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2678 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2679 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2680 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2681 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2682 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2683 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2684 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2685 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2686 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2687 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2688 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2689 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2690 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2691 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2692 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2693 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2694 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2695 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2696 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2697 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2698 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2699 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2700 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2701 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2702 {}
2703 };
2704
2705 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2706 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2707 {0x14, 0x01014010},
2708 {0x15, 0x01011012},
2709 {0x16, 0x01016011},
2710 {0x18, 0x01a19040},
2711 {0x19, 0x02a19050},
2712 {0x1a, 0x0181304f},
2713 {0x1b, 0x0221401f},
2714 {0x1e, 0x01456130}),
2715 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2716 {0x14, 0x01015010},
2717 {0x15, 0x01011012},
2718 {0x16, 0x01011011},
2719 {0x18, 0x01a11040},
2720 {0x19, 0x02a19050},
2721 {0x1a, 0x0181104f},
2722 {0x1b, 0x0221401f},
2723 {0x1e, 0x01451130}),
2724 {}
2725 };
2726
2727 /*
2728 * BIOS auto configuration
2729 */
2730 /* almost identical with ALC880 parser... */
alc882_parse_auto_config(struct hda_codec * codec)2731 static int alc882_parse_auto_config(struct hda_codec *codec)
2732 {
2733 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2734 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2735 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2736 }
2737
2738 /*
2739 */
patch_alc882(struct hda_codec * codec)2740 static int patch_alc882(struct hda_codec *codec)
2741 {
2742 struct alc_spec *spec;
2743 int err;
2744
2745 err = alc_alloc_spec(codec, 0x0b);
2746 if (err < 0)
2747 return err;
2748
2749 spec = codec->spec;
2750
2751 switch (codec->core.vendor_id) {
2752 case 0x10ec0882:
2753 case 0x10ec0885:
2754 case 0x10ec0900:
2755 case 0x10ec0b00:
2756 case 0x10ec1220:
2757 break;
2758 default:
2759 /* ALC883 and variants */
2760 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2761 break;
2762 }
2763
2764 alc_pre_init(codec);
2765
2766 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2767 alc882_fixups);
2768 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2769 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2770
2771 alc_auto_parse_customize_define(codec);
2772
2773 if (has_cdefine_beep(codec))
2774 spec->gen.beep_nid = 0x01;
2775
2776 /* automatic parse from the BIOS config */
2777 err = alc882_parse_auto_config(codec);
2778 if (err < 0)
2779 goto error;
2780
2781 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2782 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2783 if (err < 0)
2784 goto error;
2785 }
2786
2787 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2788
2789 return 0;
2790
2791 error:
2792 alc_free(codec);
2793 return err;
2794 }
2795
2796
2797 /*
2798 * ALC262 support
2799 */
alc262_parse_auto_config(struct hda_codec * codec)2800 static int alc262_parse_auto_config(struct hda_codec *codec)
2801 {
2802 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2803 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2804 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2805 }
2806
2807 /*
2808 * Pin config fixes
2809 */
2810 enum {
2811 ALC262_FIXUP_FSC_H270,
2812 ALC262_FIXUP_FSC_S7110,
2813 ALC262_FIXUP_HP_Z200,
2814 ALC262_FIXUP_TYAN,
2815 ALC262_FIXUP_LENOVO_3000,
2816 ALC262_FIXUP_BENQ,
2817 ALC262_FIXUP_BENQ_T31,
2818 ALC262_FIXUP_INV_DMIC,
2819 ALC262_FIXUP_INTEL_BAYLEYBAY,
2820 };
2821
2822 static const struct hda_fixup alc262_fixups[] = {
2823 [ALC262_FIXUP_FSC_H270] = {
2824 .type = HDA_FIXUP_PINS,
2825 .v.pins = (const struct hda_pintbl[]) {
2826 { 0x14, 0x99130110 }, /* speaker */
2827 { 0x15, 0x0221142f }, /* front HP */
2828 { 0x1b, 0x0121141f }, /* rear HP */
2829 { }
2830 }
2831 },
2832 [ALC262_FIXUP_FSC_S7110] = {
2833 .type = HDA_FIXUP_PINS,
2834 .v.pins = (const struct hda_pintbl[]) {
2835 { 0x15, 0x90170110 }, /* speaker */
2836 { }
2837 },
2838 .chained = true,
2839 .chain_id = ALC262_FIXUP_BENQ,
2840 },
2841 [ALC262_FIXUP_HP_Z200] = {
2842 .type = HDA_FIXUP_PINS,
2843 .v.pins = (const struct hda_pintbl[]) {
2844 { 0x16, 0x99130120 }, /* internal speaker */
2845 { }
2846 }
2847 },
2848 [ALC262_FIXUP_TYAN] = {
2849 .type = HDA_FIXUP_PINS,
2850 .v.pins = (const struct hda_pintbl[]) {
2851 { 0x14, 0x1993e1f0 }, /* int AUX */
2852 { }
2853 }
2854 },
2855 [ALC262_FIXUP_LENOVO_3000] = {
2856 .type = HDA_FIXUP_PINCTLS,
2857 .v.pins = (const struct hda_pintbl[]) {
2858 { 0x19, PIN_VREF50 },
2859 {}
2860 },
2861 .chained = true,
2862 .chain_id = ALC262_FIXUP_BENQ,
2863 },
2864 [ALC262_FIXUP_BENQ] = {
2865 .type = HDA_FIXUP_VERBS,
2866 .v.verbs = (const struct hda_verb[]) {
2867 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2868 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2869 {}
2870 }
2871 },
2872 [ALC262_FIXUP_BENQ_T31] = {
2873 .type = HDA_FIXUP_VERBS,
2874 .v.verbs = (const struct hda_verb[]) {
2875 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2876 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2877 {}
2878 }
2879 },
2880 [ALC262_FIXUP_INV_DMIC] = {
2881 .type = HDA_FIXUP_FUNC,
2882 .v.func = alc_fixup_inv_dmic,
2883 },
2884 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2885 .type = HDA_FIXUP_FUNC,
2886 .v.func = alc_fixup_no_depop_delay,
2887 },
2888 };
2889
2890 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2891 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2892 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2893 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2894 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2895 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2896 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2897 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2898 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2899 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2900 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2901 {}
2902 };
2903
2904 static const struct hda_model_fixup alc262_fixup_models[] = {
2905 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2906 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2907 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2908 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2909 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2910 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2911 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2912 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2913 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2914 {}
2915 };
2916
2917 /*
2918 */
patch_alc262(struct hda_codec * codec)2919 static int patch_alc262(struct hda_codec *codec)
2920 {
2921 struct alc_spec *spec;
2922 int err;
2923
2924 err = alc_alloc_spec(codec, 0x0b);
2925 if (err < 0)
2926 return err;
2927
2928 spec = codec->spec;
2929 spec->gen.shared_mic_vref_pin = 0x18;
2930
2931 spec->shutup = alc_eapd_shutup;
2932
2933 #if 0
2934 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2935 * under-run
2936 */
2937 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2938 #endif
2939 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2940
2941 alc_pre_init(codec);
2942
2943 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2944 alc262_fixups);
2945 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2946
2947 alc_auto_parse_customize_define(codec);
2948
2949 if (has_cdefine_beep(codec))
2950 spec->gen.beep_nid = 0x01;
2951
2952 /* automatic parse from the BIOS config */
2953 err = alc262_parse_auto_config(codec);
2954 if (err < 0)
2955 goto error;
2956
2957 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2958 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2959 if (err < 0)
2960 goto error;
2961 }
2962
2963 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2964
2965 return 0;
2966
2967 error:
2968 alc_free(codec);
2969 return err;
2970 }
2971
2972 /*
2973 * ALC268
2974 */
2975 /* bind Beep switches of both NID 0x0f and 0x10 */
alc268_beep_switch_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)2976 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2977 struct snd_ctl_elem_value *ucontrol)
2978 {
2979 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2980 unsigned long pval;
2981 int err;
2982
2983 mutex_lock(&codec->control_mutex);
2984 pval = kcontrol->private_value;
2985 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2986 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2987 if (err >= 0) {
2988 kcontrol->private_value = (pval & ~0xff) | 0x10;
2989 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2990 }
2991 kcontrol->private_value = pval;
2992 mutex_unlock(&codec->control_mutex);
2993 return err;
2994 }
2995
2996 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2997 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2998 {
2999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3000 .name = "Beep Playback Switch",
3001 .subdevice = HDA_SUBDEV_AMP_FLAG,
3002 .info = snd_hda_mixer_amp_switch_info,
3003 .get = snd_hda_mixer_amp_switch_get,
3004 .put = alc268_beep_switch_put,
3005 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3006 },
3007 };
3008
3009 /* set PCBEEP vol = 0, mute connections */
3010 static const struct hda_verb alc268_beep_init_verbs[] = {
3011 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3012 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3013 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3014 { }
3015 };
3016
3017 enum {
3018 ALC268_FIXUP_INV_DMIC,
3019 ALC268_FIXUP_HP_EAPD,
3020 ALC268_FIXUP_SPDIF,
3021 };
3022
3023 static const struct hda_fixup alc268_fixups[] = {
3024 [ALC268_FIXUP_INV_DMIC] = {
3025 .type = HDA_FIXUP_FUNC,
3026 .v.func = alc_fixup_inv_dmic,
3027 },
3028 [ALC268_FIXUP_HP_EAPD] = {
3029 .type = HDA_FIXUP_VERBS,
3030 .v.verbs = (const struct hda_verb[]) {
3031 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3032 {}
3033 }
3034 },
3035 [ALC268_FIXUP_SPDIF] = {
3036 .type = HDA_FIXUP_PINS,
3037 .v.pins = (const struct hda_pintbl[]) {
3038 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3039 {}
3040 }
3041 },
3042 };
3043
3044 static const struct hda_model_fixup alc268_fixup_models[] = {
3045 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3046 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3047 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3048 {}
3049 };
3050
3051 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3052 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3053 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3054 /* below is codec SSID since multiple Toshiba laptops have the
3055 * same PCI SSID 1179:ff00
3056 */
3057 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3058 {}
3059 };
3060
3061 /*
3062 * BIOS auto configuration
3063 */
alc268_parse_auto_config(struct hda_codec * codec)3064 static int alc268_parse_auto_config(struct hda_codec *codec)
3065 {
3066 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3067 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3068 }
3069
3070 /*
3071 */
patch_alc268(struct hda_codec * codec)3072 static int patch_alc268(struct hda_codec *codec)
3073 {
3074 struct alc_spec *spec;
3075 int i, err;
3076
3077 /* ALC268 has no aa-loopback mixer */
3078 err = alc_alloc_spec(codec, 0);
3079 if (err < 0)
3080 return err;
3081
3082 spec = codec->spec;
3083 if (has_cdefine_beep(codec))
3084 spec->gen.beep_nid = 0x01;
3085
3086 spec->shutup = alc_eapd_shutup;
3087
3088 alc_pre_init(codec);
3089
3090 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3091 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3092
3093 /* automatic parse from the BIOS config */
3094 err = alc268_parse_auto_config(codec);
3095 if (err < 0)
3096 goto error;
3097
3098 if (err > 0 && !spec->gen.no_analog &&
3099 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3100 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3101 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3102 &alc268_beep_mixer[i])) {
3103 err = -ENOMEM;
3104 goto error;
3105 }
3106 }
3107 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3108 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3109 /* override the amp caps for beep generator */
3110 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3111 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3112 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3113 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3114 (0 << AC_AMPCAP_MUTE_SHIFT));
3115 }
3116
3117 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3118
3119 return 0;
3120
3121 error:
3122 alc_free(codec);
3123 return err;
3124 }
3125
3126 /*
3127 * ALC269
3128 */
3129
3130 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3131 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3132 };
3133
3134 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3135 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3136 };
3137
3138 /* different alc269-variants */
3139 enum {
3140 ALC269_TYPE_ALC269VA,
3141 ALC269_TYPE_ALC269VB,
3142 ALC269_TYPE_ALC269VC,
3143 ALC269_TYPE_ALC269VD,
3144 ALC269_TYPE_ALC280,
3145 ALC269_TYPE_ALC282,
3146 ALC269_TYPE_ALC283,
3147 ALC269_TYPE_ALC284,
3148 ALC269_TYPE_ALC293,
3149 ALC269_TYPE_ALC286,
3150 ALC269_TYPE_ALC298,
3151 ALC269_TYPE_ALC255,
3152 ALC269_TYPE_ALC256,
3153 ALC269_TYPE_ALC257,
3154 ALC269_TYPE_ALC215,
3155 ALC269_TYPE_ALC225,
3156 ALC269_TYPE_ALC294,
3157 ALC269_TYPE_ALC300,
3158 ALC269_TYPE_ALC623,
3159 ALC269_TYPE_ALC700,
3160 };
3161
3162 /*
3163 * BIOS auto configuration
3164 */
alc269_parse_auto_config(struct hda_codec * codec)3165 static int alc269_parse_auto_config(struct hda_codec *codec)
3166 {
3167 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3168 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3169 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3170 struct alc_spec *spec = codec->spec;
3171 const hda_nid_t *ssids;
3172
3173 switch (spec->codec_variant) {
3174 case ALC269_TYPE_ALC269VA:
3175 case ALC269_TYPE_ALC269VC:
3176 case ALC269_TYPE_ALC280:
3177 case ALC269_TYPE_ALC284:
3178 case ALC269_TYPE_ALC293:
3179 ssids = alc269va_ssids;
3180 break;
3181 case ALC269_TYPE_ALC269VB:
3182 case ALC269_TYPE_ALC269VD:
3183 case ALC269_TYPE_ALC282:
3184 case ALC269_TYPE_ALC283:
3185 case ALC269_TYPE_ALC286:
3186 case ALC269_TYPE_ALC298:
3187 case ALC269_TYPE_ALC255:
3188 case ALC269_TYPE_ALC256:
3189 case ALC269_TYPE_ALC257:
3190 case ALC269_TYPE_ALC215:
3191 case ALC269_TYPE_ALC225:
3192 case ALC269_TYPE_ALC294:
3193 case ALC269_TYPE_ALC300:
3194 case ALC269_TYPE_ALC623:
3195 case ALC269_TYPE_ALC700:
3196 ssids = alc269_ssids;
3197 break;
3198 default:
3199 ssids = alc269_ssids;
3200 break;
3201 }
3202
3203 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3204 }
3205
3206 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3207 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3208 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3209 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3210 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3211 {}
3212 };
3213
alc_headset_btn_callback(struct hda_codec * codec,struct hda_jack_callback * jack)3214 static void alc_headset_btn_callback(struct hda_codec *codec,
3215 struct hda_jack_callback *jack)
3216 {
3217 int report = 0;
3218
3219 if (jack->unsol_res & (7 << 13))
3220 report |= SND_JACK_BTN_0;
3221
3222 if (jack->unsol_res & (1 << 16 | 3 << 8))
3223 report |= SND_JACK_BTN_1;
3224
3225 /* Volume up key */
3226 if (jack->unsol_res & (7 << 23))
3227 report |= SND_JACK_BTN_2;
3228
3229 /* Volume down key */
3230 if (jack->unsol_res & (7 << 10))
3231 report |= SND_JACK_BTN_3;
3232
3233 jack->jack->button_state = report;
3234 }
3235
alc_disable_headset_jack_key(struct hda_codec * codec)3236 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3237 {
3238 struct alc_spec *spec = codec->spec;
3239
3240 if (!spec->has_hs_key)
3241 return;
3242
3243 switch (codec->core.vendor_id) {
3244 case 0x10ec0215:
3245 case 0x10ec0225:
3246 case 0x10ec0285:
3247 case 0x10ec0287:
3248 case 0x10ec0295:
3249 case 0x10ec0289:
3250 case 0x10ec0299:
3251 alc_write_coef_idx(codec, 0x48, 0x0);
3252 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3253 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3254 break;
3255 case 0x10ec0230:
3256 case 0x10ec0236:
3257 case 0x10ec0256:
3258 case 0x19e58326:
3259 alc_write_coef_idx(codec, 0x48, 0x0);
3260 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3261 break;
3262 }
3263 }
3264
alc_enable_headset_jack_key(struct hda_codec * codec)3265 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3266 {
3267 struct alc_spec *spec = codec->spec;
3268
3269 if (!spec->has_hs_key)
3270 return;
3271
3272 switch (codec->core.vendor_id) {
3273 case 0x10ec0215:
3274 case 0x10ec0225:
3275 case 0x10ec0285:
3276 case 0x10ec0287:
3277 case 0x10ec0295:
3278 case 0x10ec0289:
3279 case 0x10ec0299:
3280 alc_write_coef_idx(codec, 0x48, 0xd011);
3281 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3282 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3283 break;
3284 case 0x10ec0230:
3285 case 0x10ec0236:
3286 case 0x10ec0256:
3287 case 0x19e58326:
3288 alc_write_coef_idx(codec, 0x48, 0xd011);
3289 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3290 break;
3291 }
3292 }
3293
alc_fixup_headset_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)3294 static void alc_fixup_headset_jack(struct hda_codec *codec,
3295 const struct hda_fixup *fix, int action)
3296 {
3297 struct alc_spec *spec = codec->spec;
3298
3299 switch (action) {
3300 case HDA_FIXUP_ACT_PRE_PROBE:
3301 spec->has_hs_key = 1;
3302 snd_hda_jack_detect_enable_callback(codec, 0x55,
3303 alc_headset_btn_callback);
3304 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3305 SND_JACK_HEADSET, alc_headset_btn_keymap);
3306 break;
3307 case HDA_FIXUP_ACT_INIT:
3308 alc_enable_headset_jack_key(codec);
3309 break;
3310 }
3311 }
3312
alc269vb_toggle_power_output(struct hda_codec * codec,int power_up)3313 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3314 {
3315 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3316 }
3317
alc269_shutup(struct hda_codec * codec)3318 static void alc269_shutup(struct hda_codec *codec)
3319 {
3320 struct alc_spec *spec = codec->spec;
3321
3322 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3323 alc269vb_toggle_power_output(codec, 0);
3324 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3325 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3326 msleep(150);
3327 }
3328 alc_shutup_pins(codec);
3329 }
3330
3331 static const struct coef_fw alc282_coefs[] = {
3332 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3333 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3334 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3335 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3336 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3337 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3338 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3339 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3340 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3341 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3342 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3343 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3344 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3345 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3346 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3347 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3348 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3349 WRITE_COEF(0x63, 0x2902), /* PLL */
3350 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3351 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3352 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3353 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3354 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3355 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3356 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3357 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3358 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3359 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3360 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3361 {}
3362 };
3363
alc282_restore_default_value(struct hda_codec * codec)3364 static void alc282_restore_default_value(struct hda_codec *codec)
3365 {
3366 alc_process_coef_fw(codec, alc282_coefs);
3367 }
3368
alc282_init(struct hda_codec * codec)3369 static void alc282_init(struct hda_codec *codec)
3370 {
3371 struct alc_spec *spec = codec->spec;
3372 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3373 bool hp_pin_sense;
3374 int coef78;
3375
3376 alc282_restore_default_value(codec);
3377
3378 if (!hp_pin)
3379 return;
3380 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3381 coef78 = alc_read_coef_idx(codec, 0x78);
3382
3383 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3384 /* Headphone capless set to high power mode */
3385 alc_write_coef_idx(codec, 0x78, 0x9004);
3386
3387 if (hp_pin_sense)
3388 msleep(2);
3389
3390 snd_hda_codec_write(codec, hp_pin, 0,
3391 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3392
3393 if (hp_pin_sense)
3394 msleep(85);
3395
3396 snd_hda_codec_write(codec, hp_pin, 0,
3397 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3398
3399 if (hp_pin_sense)
3400 msleep(100);
3401
3402 /* Headphone capless set to normal mode */
3403 alc_write_coef_idx(codec, 0x78, coef78);
3404 }
3405
alc282_shutup(struct hda_codec * codec)3406 static void alc282_shutup(struct hda_codec *codec)
3407 {
3408 struct alc_spec *spec = codec->spec;
3409 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3410 bool hp_pin_sense;
3411 int coef78;
3412
3413 if (!hp_pin) {
3414 alc269_shutup(codec);
3415 return;
3416 }
3417
3418 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3419 coef78 = alc_read_coef_idx(codec, 0x78);
3420 alc_write_coef_idx(codec, 0x78, 0x9004);
3421
3422 if (hp_pin_sense)
3423 msleep(2);
3424
3425 snd_hda_codec_write(codec, hp_pin, 0,
3426 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3427
3428 if (hp_pin_sense)
3429 msleep(85);
3430
3431 if (!spec->no_shutup_pins)
3432 snd_hda_codec_write(codec, hp_pin, 0,
3433 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3434
3435 if (hp_pin_sense)
3436 msleep(100);
3437
3438 alc_auto_setup_eapd(codec, false);
3439 alc_shutup_pins(codec);
3440 alc_write_coef_idx(codec, 0x78, coef78);
3441 }
3442
3443 static const struct coef_fw alc283_coefs[] = {
3444 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3445 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3446 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3447 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3448 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3449 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3450 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3451 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3452 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3453 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3454 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3455 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3456 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3457 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3458 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3459 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3460 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3461 WRITE_COEF(0x2e, 0x2902), /* PLL */
3462 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3463 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3464 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3465 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3466 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3467 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3468 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3469 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3470 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3471 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3472 WRITE_COEF(0x49, 0x0), /* test mode */
3473 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3474 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3475 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3476 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3477 {}
3478 };
3479
alc283_restore_default_value(struct hda_codec * codec)3480 static void alc283_restore_default_value(struct hda_codec *codec)
3481 {
3482 alc_process_coef_fw(codec, alc283_coefs);
3483 }
3484
alc283_init(struct hda_codec * codec)3485 static void alc283_init(struct hda_codec *codec)
3486 {
3487 struct alc_spec *spec = codec->spec;
3488 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3489 bool hp_pin_sense;
3490
3491 alc283_restore_default_value(codec);
3492
3493 if (!hp_pin)
3494 return;
3495
3496 msleep(30);
3497 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3498
3499 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3500 /* Headphone capless set to high power mode */
3501 alc_write_coef_idx(codec, 0x43, 0x9004);
3502
3503 snd_hda_codec_write(codec, hp_pin, 0,
3504 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3505
3506 if (hp_pin_sense)
3507 msleep(85);
3508
3509 snd_hda_codec_write(codec, hp_pin, 0,
3510 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3511
3512 if (hp_pin_sense)
3513 msleep(85);
3514 /* Index 0x46 Combo jack auto switch control 2 */
3515 /* 3k pull low control for Headset jack. */
3516 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3517 /* Headphone capless set to normal mode */
3518 alc_write_coef_idx(codec, 0x43, 0x9614);
3519 }
3520
alc283_shutup(struct hda_codec * codec)3521 static void alc283_shutup(struct hda_codec *codec)
3522 {
3523 struct alc_spec *spec = codec->spec;
3524 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3525 bool hp_pin_sense;
3526
3527 if (!hp_pin) {
3528 alc269_shutup(codec);
3529 return;
3530 }
3531
3532 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3533
3534 alc_write_coef_idx(codec, 0x43, 0x9004);
3535
3536 /*depop hp during suspend*/
3537 alc_write_coef_idx(codec, 0x06, 0x2100);
3538
3539 snd_hda_codec_write(codec, hp_pin, 0,
3540 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3541
3542 if (hp_pin_sense)
3543 msleep(100);
3544
3545 if (!spec->no_shutup_pins)
3546 snd_hda_codec_write(codec, hp_pin, 0,
3547 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3548
3549 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3550
3551 if (hp_pin_sense)
3552 msleep(100);
3553 alc_auto_setup_eapd(codec, false);
3554 alc_shutup_pins(codec);
3555 alc_write_coef_idx(codec, 0x43, 0x9614);
3556 }
3557
alc256_init(struct hda_codec * codec)3558 static void alc256_init(struct hda_codec *codec)
3559 {
3560 struct alc_spec *spec = codec->spec;
3561 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3562 bool hp_pin_sense;
3563
3564 if (!hp_pin)
3565 hp_pin = 0x21;
3566
3567 msleep(30);
3568
3569 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3570
3571 if (hp_pin_sense)
3572 msleep(2);
3573
3574 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3575 if (spec->ultra_low_power) {
3576 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3577 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3578 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3579 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3580 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3581 msleep(30);
3582 }
3583
3584 snd_hda_codec_write(codec, hp_pin, 0,
3585 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3586
3587 if (hp_pin_sense || spec->ultra_low_power)
3588 msleep(85);
3589
3590 snd_hda_codec_write(codec, hp_pin, 0,
3591 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3592
3593 if (hp_pin_sense || spec->ultra_low_power)
3594 msleep(100);
3595
3596 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3597 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3598 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3599 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3600 /*
3601 * Expose headphone mic (or possibly Line In on some machines) instead
3602 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3603 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3604 * this register.
3605 */
3606 alc_write_coef_idx(codec, 0x36, 0x5757);
3607 }
3608
alc256_shutup(struct hda_codec * codec)3609 static void alc256_shutup(struct hda_codec *codec)
3610 {
3611 struct alc_spec *spec = codec->spec;
3612 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3613 bool hp_pin_sense;
3614
3615 if (!hp_pin)
3616 hp_pin = 0x21;
3617
3618 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3619
3620 if (hp_pin_sense)
3621 msleep(2);
3622
3623 snd_hda_codec_write(codec, hp_pin, 0,
3624 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3625
3626 if (hp_pin_sense || spec->ultra_low_power)
3627 msleep(85);
3628
3629 /* 3k pull low control for Headset jack. */
3630 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3631 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3632 * when booting with headset plugged. So skip setting it for the codec alc257
3633 */
3634 if (codec->core.vendor_id != 0x10ec0236 &&
3635 codec->core.vendor_id != 0x10ec0257)
3636 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3637
3638 if (!spec->no_shutup_pins)
3639 snd_hda_codec_write(codec, hp_pin, 0,
3640 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3641
3642 if (hp_pin_sense || spec->ultra_low_power)
3643 msleep(100);
3644
3645 alc_auto_setup_eapd(codec, false);
3646 alc_shutup_pins(codec);
3647 if (spec->ultra_low_power) {
3648 msleep(50);
3649 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3650 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3651 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3652 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3653 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3654 msleep(30);
3655 }
3656 }
3657
alc225_init(struct hda_codec * codec)3658 static void alc225_init(struct hda_codec *codec)
3659 {
3660 struct alc_spec *spec = codec->spec;
3661 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3662 bool hp1_pin_sense, hp2_pin_sense;
3663
3664 if (!hp_pin)
3665 hp_pin = 0x21;
3666 msleep(30);
3667
3668 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3669 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3670
3671 if (hp1_pin_sense || hp2_pin_sense)
3672 msleep(2);
3673
3674 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3675 if (spec->ultra_low_power) {
3676 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3677 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3678 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3679 msleep(30);
3680 }
3681
3682 if (hp1_pin_sense || spec->ultra_low_power)
3683 snd_hda_codec_write(codec, hp_pin, 0,
3684 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3685 if (hp2_pin_sense)
3686 snd_hda_codec_write(codec, 0x16, 0,
3687 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3688
3689 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3690 msleep(85);
3691
3692 if (hp1_pin_sense || spec->ultra_low_power)
3693 snd_hda_codec_write(codec, hp_pin, 0,
3694 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3695 if (hp2_pin_sense)
3696 snd_hda_codec_write(codec, 0x16, 0,
3697 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3698
3699 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3700 msleep(100);
3701
3702 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3703 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3704 }
3705
alc225_shutup(struct hda_codec * codec)3706 static void alc225_shutup(struct hda_codec *codec)
3707 {
3708 struct alc_spec *spec = codec->spec;
3709 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3710 bool hp1_pin_sense, hp2_pin_sense;
3711
3712 if (!hp_pin)
3713 hp_pin = 0x21;
3714
3715 alc_disable_headset_jack_key(codec);
3716 /* 3k pull low control for Headset jack. */
3717 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3718
3719 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3720 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3721
3722 if (hp1_pin_sense || hp2_pin_sense)
3723 msleep(2);
3724
3725 if (hp1_pin_sense || spec->ultra_low_power)
3726 snd_hda_codec_write(codec, hp_pin, 0,
3727 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3728 if (hp2_pin_sense)
3729 snd_hda_codec_write(codec, 0x16, 0,
3730 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3731
3732 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3733 msleep(85);
3734
3735 if (hp1_pin_sense || spec->ultra_low_power)
3736 snd_hda_codec_write(codec, hp_pin, 0,
3737 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3738 if (hp2_pin_sense)
3739 snd_hda_codec_write(codec, 0x16, 0,
3740 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3741
3742 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3743 msleep(100);
3744
3745 alc_auto_setup_eapd(codec, false);
3746 alc_shutup_pins(codec);
3747 if (spec->ultra_low_power) {
3748 msleep(50);
3749 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3750 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3751 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3752 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3753 msleep(30);
3754 }
3755
3756 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3757 alc_enable_headset_jack_key(codec);
3758 }
3759
alc_default_init(struct hda_codec * codec)3760 static void alc_default_init(struct hda_codec *codec)
3761 {
3762 struct alc_spec *spec = codec->spec;
3763 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3764 bool hp_pin_sense;
3765
3766 if (!hp_pin)
3767 return;
3768
3769 msleep(30);
3770
3771 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3772
3773 if (hp_pin_sense)
3774 msleep(2);
3775
3776 snd_hda_codec_write(codec, hp_pin, 0,
3777 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3778
3779 if (hp_pin_sense)
3780 msleep(85);
3781
3782 snd_hda_codec_write(codec, hp_pin, 0,
3783 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3784
3785 if (hp_pin_sense)
3786 msleep(100);
3787 }
3788
alc_default_shutup(struct hda_codec * codec)3789 static void alc_default_shutup(struct hda_codec *codec)
3790 {
3791 struct alc_spec *spec = codec->spec;
3792 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3793 bool hp_pin_sense;
3794
3795 if (!hp_pin) {
3796 alc269_shutup(codec);
3797 return;
3798 }
3799
3800 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3801
3802 if (hp_pin_sense)
3803 msleep(2);
3804
3805 snd_hda_codec_write(codec, hp_pin, 0,
3806 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3807
3808 if (hp_pin_sense)
3809 msleep(85);
3810
3811 if (!spec->no_shutup_pins)
3812 snd_hda_codec_write(codec, hp_pin, 0,
3813 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3814
3815 if (hp_pin_sense)
3816 msleep(100);
3817
3818 alc_auto_setup_eapd(codec, false);
3819 alc_shutup_pins(codec);
3820 }
3821
alc294_hp_init(struct hda_codec * codec)3822 static void alc294_hp_init(struct hda_codec *codec)
3823 {
3824 struct alc_spec *spec = codec->spec;
3825 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3826 int i, val;
3827
3828 if (!hp_pin)
3829 return;
3830
3831 snd_hda_codec_write(codec, hp_pin, 0,
3832 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3833
3834 msleep(100);
3835
3836 if (!spec->no_shutup_pins)
3837 snd_hda_codec_write(codec, hp_pin, 0,
3838 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3839
3840 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3841 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3842
3843 /* Wait for depop procedure finish */
3844 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3845 for (i = 0; i < 20 && val & 0x0080; i++) {
3846 msleep(50);
3847 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3848 }
3849 /* Set HP depop to auto mode */
3850 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3851 msleep(50);
3852 }
3853
alc294_init(struct hda_codec * codec)3854 static void alc294_init(struct hda_codec *codec)
3855 {
3856 struct alc_spec *spec = codec->spec;
3857
3858 /* required only at boot or S4 resume time */
3859 if (!spec->done_hp_init ||
3860 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3861 alc294_hp_init(codec);
3862 spec->done_hp_init = true;
3863 }
3864 alc_default_init(codec);
3865 }
3866
alc5505_coef_set(struct hda_codec * codec,unsigned int index_reg,unsigned int val)3867 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3868 unsigned int val)
3869 {
3870 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3871 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3872 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3873 }
3874
alc5505_coef_get(struct hda_codec * codec,unsigned int index_reg)3875 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3876 {
3877 unsigned int val;
3878
3879 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3880 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3881 & 0xffff;
3882 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3883 << 16;
3884 return val;
3885 }
3886
alc5505_dsp_halt(struct hda_codec * codec)3887 static void alc5505_dsp_halt(struct hda_codec *codec)
3888 {
3889 unsigned int val;
3890
3891 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3892 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3893 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3894 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3895 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3896 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3897 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3898 val = alc5505_coef_get(codec, 0x6220);
3899 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3900 }
3901
alc5505_dsp_back_from_halt(struct hda_codec * codec)3902 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3903 {
3904 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3905 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3906 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3907 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3908 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3909 alc5505_coef_set(codec, 0x880c, 0x00000004);
3910 }
3911
alc5505_dsp_init(struct hda_codec * codec)3912 static void alc5505_dsp_init(struct hda_codec *codec)
3913 {
3914 unsigned int val;
3915
3916 alc5505_dsp_halt(codec);
3917 alc5505_dsp_back_from_halt(codec);
3918 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3919 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3920 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3921 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3922 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3923 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3924 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3925 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3926 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3927 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3928 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3929 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3930 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3931
3932 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3933 if (val <= 3)
3934 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3935 else
3936 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3937
3938 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3939 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3940 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3941 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3942 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3943 alc5505_coef_set(codec, 0x880c, 0x00000003);
3944 alc5505_coef_set(codec, 0x880c, 0x00000010);
3945
3946 #ifdef HALT_REALTEK_ALC5505
3947 alc5505_dsp_halt(codec);
3948 #endif
3949 }
3950
3951 #ifdef HALT_REALTEK_ALC5505
3952 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3953 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
3954 #else
3955 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3956 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3957 #endif
3958
3959 #ifdef CONFIG_PM
alc269_suspend(struct hda_codec * codec)3960 static int alc269_suspend(struct hda_codec *codec)
3961 {
3962 struct alc_spec *spec = codec->spec;
3963
3964 if (spec->has_alc5505_dsp)
3965 alc5505_dsp_suspend(codec);
3966 return alc_suspend(codec);
3967 }
3968
alc269_resume(struct hda_codec * codec)3969 static int alc269_resume(struct hda_codec *codec)
3970 {
3971 struct alc_spec *spec = codec->spec;
3972
3973 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3974 alc269vb_toggle_power_output(codec, 0);
3975 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3976 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3977 msleep(150);
3978 }
3979
3980 codec->patch_ops.init(codec);
3981
3982 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3983 alc269vb_toggle_power_output(codec, 1);
3984 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3985 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3986 msleep(200);
3987 }
3988
3989 snd_hda_regmap_sync(codec);
3990 hda_call_check_power_status(codec, 0x01);
3991
3992 /* on some machine, the BIOS will clear the codec gpio data when enter
3993 * suspend, and won't restore the data after resume, so we restore it
3994 * in the driver.
3995 */
3996 if (spec->gpio_data)
3997 alc_write_gpio_data(codec);
3998
3999 if (spec->has_alc5505_dsp)
4000 alc5505_dsp_resume(codec);
4001
4002 return 0;
4003 }
4004 #endif /* CONFIG_PM */
4005
alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec * codec,const struct hda_fixup * fix,int action)4006 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4007 const struct hda_fixup *fix, int action)
4008 {
4009 struct alc_spec *spec = codec->spec;
4010
4011 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4012 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4013 }
4014
alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4015 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4016 const struct hda_fixup *fix,
4017 int action)
4018 {
4019 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4020 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4021
4022 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4023 snd_hda_codec_set_pincfg(codec, 0x19,
4024 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4025 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4026 }
4027
alc269_fixup_hweq(struct hda_codec * codec,const struct hda_fixup * fix,int action)4028 static void alc269_fixup_hweq(struct hda_codec *codec,
4029 const struct hda_fixup *fix, int action)
4030 {
4031 if (action == HDA_FIXUP_ACT_INIT)
4032 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4033 }
4034
alc269_fixup_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4035 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4036 const struct hda_fixup *fix, int action)
4037 {
4038 struct alc_spec *spec = codec->spec;
4039
4040 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4041 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4042 }
4043
alc271_fixup_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4044 static void alc271_fixup_dmic(struct hda_codec *codec,
4045 const struct hda_fixup *fix, int action)
4046 {
4047 static const struct hda_verb verbs[] = {
4048 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4049 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4050 {}
4051 };
4052 unsigned int cfg;
4053
4054 if (strcmp(codec->core.chip_name, "ALC271X") &&
4055 strcmp(codec->core.chip_name, "ALC269VB"))
4056 return;
4057 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4058 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4059 snd_hda_sequence_write(codec, verbs);
4060 }
4061
4062 /* Fix the speaker amp after resume, etc */
alc269vb_fixup_aspire_e1_coef(struct hda_codec * codec,const struct hda_fixup * fix,int action)4063 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4064 const struct hda_fixup *fix,
4065 int action)
4066 {
4067 if (action == HDA_FIXUP_ACT_INIT)
4068 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4069 }
4070
alc269_fixup_pcm_44k(struct hda_codec * codec,const struct hda_fixup * fix,int action)4071 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4072 const struct hda_fixup *fix, int action)
4073 {
4074 struct alc_spec *spec = codec->spec;
4075
4076 if (action != HDA_FIXUP_ACT_PROBE)
4077 return;
4078
4079 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4080 * fix the sample rate of analog I/O to 44.1kHz
4081 */
4082 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4083 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4084 }
4085
alc269_fixup_stereo_dmic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4086 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4087 const struct hda_fixup *fix, int action)
4088 {
4089 /* The digital-mic unit sends PDM (differential signal) instead of
4090 * the standard PCM, thus you can't record a valid mono stream as is.
4091 * Below is a workaround specific to ALC269 to control the dmic
4092 * signal source as mono.
4093 */
4094 if (action == HDA_FIXUP_ACT_INIT)
4095 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4096 }
4097
alc269_quanta_automute(struct hda_codec * codec)4098 static void alc269_quanta_automute(struct hda_codec *codec)
4099 {
4100 snd_hda_gen_update_outputs(codec);
4101
4102 alc_write_coef_idx(codec, 0x0c, 0x680);
4103 alc_write_coef_idx(codec, 0x0c, 0x480);
4104 }
4105
alc269_fixup_quanta_mute(struct hda_codec * codec,const struct hda_fixup * fix,int action)4106 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4107 const struct hda_fixup *fix, int action)
4108 {
4109 struct alc_spec *spec = codec->spec;
4110 if (action != HDA_FIXUP_ACT_PROBE)
4111 return;
4112 spec->gen.automute_hook = alc269_quanta_automute;
4113 }
4114
alc269_x101_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)4115 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4116 struct hda_jack_callback *jack)
4117 {
4118 struct alc_spec *spec = codec->spec;
4119 int vref;
4120 msleep(200);
4121 snd_hda_gen_hp_automute(codec, jack);
4122
4123 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4124 msleep(100);
4125 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4126 vref);
4127 msleep(500);
4128 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4129 vref);
4130 }
4131
4132 /*
4133 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4134 */
4135 struct hda_alc298_mbxinit {
4136 unsigned char value_0x23;
4137 unsigned char value_0x25;
4138 };
4139
alc298_huawei_mbx_stereo_seq(struct hda_codec * codec,const struct hda_alc298_mbxinit * initval,bool first)4140 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4141 const struct hda_alc298_mbxinit *initval,
4142 bool first)
4143 {
4144 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4145 alc_write_coef_idx(codec, 0x26, 0xb000);
4146
4147 if (first)
4148 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4149
4150 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4151 alc_write_coef_idx(codec, 0x26, 0xf000);
4152 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4153
4154 if (initval->value_0x23 != 0x1e)
4155 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4156
4157 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4158 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4159 }
4160
alc298_fixup_huawei_mbx_stereo(struct hda_codec * codec,const struct hda_fixup * fix,int action)4161 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4162 const struct hda_fixup *fix,
4163 int action)
4164 {
4165 /* Initialization magic */
4166 static const struct hda_alc298_mbxinit dac_init[] = {
4167 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4168 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4169 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4170 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4171 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4172 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4173 {0x2f, 0x00},
4174 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4175 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4176 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4177 {}
4178 };
4179 const struct hda_alc298_mbxinit *seq;
4180
4181 if (action != HDA_FIXUP_ACT_INIT)
4182 return;
4183
4184 /* Start */
4185 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4186 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4187 alc_write_coef_idx(codec, 0x26, 0xf000);
4188 alc_write_coef_idx(codec, 0x22, 0x31);
4189 alc_write_coef_idx(codec, 0x23, 0x0b);
4190 alc_write_coef_idx(codec, 0x25, 0x00);
4191 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4192 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4193
4194 for (seq = dac_init; seq->value_0x23; seq++)
4195 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4196 }
4197
alc269_fixup_x101_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)4198 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4199 const struct hda_fixup *fix, int action)
4200 {
4201 struct alc_spec *spec = codec->spec;
4202 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4203 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4204 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4205 }
4206 }
4207
alc_update_vref_led(struct hda_codec * codec,hda_nid_t pin,bool polarity,bool on)4208 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4209 bool polarity, bool on)
4210 {
4211 unsigned int pinval;
4212
4213 if (!pin)
4214 return;
4215 if (polarity)
4216 on = !on;
4217 pinval = snd_hda_codec_get_pin_target(codec, pin);
4218 pinval &= ~AC_PINCTL_VREFEN;
4219 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4220 /* temporarily power up/down for setting VREF */
4221 snd_hda_power_up_pm(codec);
4222 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4223 snd_hda_power_down_pm(codec);
4224 }
4225
4226 /* update mute-LED according to the speaker mute state via mic VREF pin */
vref_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4227 static int vref_mute_led_set(struct led_classdev *led_cdev,
4228 enum led_brightness brightness)
4229 {
4230 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4231 struct alc_spec *spec = codec->spec;
4232
4233 alc_update_vref_led(codec, spec->mute_led_nid,
4234 spec->mute_led_polarity, brightness);
4235 return 0;
4236 }
4237
4238 /* Make sure the led works even in runtime suspend */
led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)4239 static unsigned int led_power_filter(struct hda_codec *codec,
4240 hda_nid_t nid,
4241 unsigned int power_state)
4242 {
4243 struct alc_spec *spec = codec->spec;
4244
4245 if (power_state != AC_PWRST_D3 || nid == 0 ||
4246 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4247 return power_state;
4248
4249 /* Set pin ctl again, it might have just been set to 0 */
4250 snd_hda_set_pin_ctl(codec, nid,
4251 snd_hda_codec_get_pin_target(codec, nid));
4252
4253 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4254 }
4255
alc269_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4256 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4257 const struct hda_fixup *fix, int action)
4258 {
4259 struct alc_spec *spec = codec->spec;
4260 const struct dmi_device *dev = NULL;
4261
4262 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4263 return;
4264
4265 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4266 int pol, pin;
4267 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4268 continue;
4269 if (pin < 0x0a || pin >= 0x10)
4270 break;
4271 spec->mute_led_polarity = pol;
4272 spec->mute_led_nid = pin - 0x0a + 0x18;
4273 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4274 codec->power_filter = led_power_filter;
4275 codec_dbg(codec,
4276 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4277 spec->mute_led_polarity);
4278 break;
4279 }
4280 }
4281
alc269_fixup_hp_mute_led_micx(struct hda_codec * codec,const struct hda_fixup * fix,int action,hda_nid_t pin)4282 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4283 const struct hda_fixup *fix,
4284 int action, hda_nid_t pin)
4285 {
4286 struct alc_spec *spec = codec->spec;
4287
4288 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4289 spec->mute_led_polarity = 0;
4290 spec->mute_led_nid = pin;
4291 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4292 codec->power_filter = led_power_filter;
4293 }
4294 }
4295
alc269_fixup_hp_mute_led_mic1(struct hda_codec * codec,const struct hda_fixup * fix,int action)4296 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4297 const struct hda_fixup *fix, int action)
4298 {
4299 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4300 }
4301
alc269_fixup_hp_mute_led_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)4302 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4303 const struct hda_fixup *fix, int action)
4304 {
4305 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4306 }
4307
alc269_fixup_hp_mute_led_mic3(struct hda_codec * codec,const struct hda_fixup * fix,int action)4308 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4309 const struct hda_fixup *fix, int action)
4310 {
4311 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4312 }
4313
4314 /* update LED status via GPIO */
alc_update_gpio_led(struct hda_codec * codec,unsigned int mask,int polarity,bool enabled)4315 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4316 int polarity, bool enabled)
4317 {
4318 if (polarity)
4319 enabled = !enabled;
4320 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4321 }
4322
4323 /* turn on/off mute LED via GPIO per vmaster hook */
gpio_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4324 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4325 enum led_brightness brightness)
4326 {
4327 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4328 struct alc_spec *spec = codec->spec;
4329
4330 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4331 spec->mute_led_polarity, !brightness);
4332 return 0;
4333 }
4334
4335 /* turn on/off mic-mute LED via GPIO per capture hook */
micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4336 static int micmute_led_set(struct led_classdev *led_cdev,
4337 enum led_brightness brightness)
4338 {
4339 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4340 struct alc_spec *spec = codec->spec;
4341
4342 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4343 spec->micmute_led_polarity, !brightness);
4344 return 0;
4345 }
4346
4347 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
alc_fixup_hp_gpio_led(struct hda_codec * codec,int action,unsigned int mute_mask,unsigned int micmute_mask)4348 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4349 int action,
4350 unsigned int mute_mask,
4351 unsigned int micmute_mask)
4352 {
4353 struct alc_spec *spec = codec->spec;
4354
4355 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4356
4357 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4358 return;
4359 if (mute_mask) {
4360 spec->gpio_mute_led_mask = mute_mask;
4361 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4362 }
4363 if (micmute_mask) {
4364 spec->gpio_mic_led_mask = micmute_mask;
4365 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4366 }
4367 }
4368
alc236_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4369 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4370 const struct hda_fixup *fix, int action)
4371 {
4372 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4373 }
4374
alc269_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4375 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4376 const struct hda_fixup *fix, int action)
4377 {
4378 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4379 }
4380
alc285_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4381 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4382 const struct hda_fixup *fix, int action)
4383 {
4384 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4385 }
4386
alc286_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4387 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4388 const struct hda_fixup *fix, int action)
4389 {
4390 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4391 }
4392
alc287_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4393 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4394 const struct hda_fixup *fix, int action)
4395 {
4396 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4397 }
4398
alc245_fixup_hp_gpio_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4399 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4400 const struct hda_fixup *fix, int action)
4401 {
4402 struct alc_spec *spec = codec->spec;
4403
4404 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4405 spec->micmute_led_polarity = 1;
4406 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4407 }
4408
4409 /* turn on/off mic-mute LED per capture hook via VREF change */
vref_micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4410 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4411 enum led_brightness brightness)
4412 {
4413 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4414 struct alc_spec *spec = codec->spec;
4415
4416 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4417 spec->micmute_led_polarity, brightness);
4418 return 0;
4419 }
4420
alc269_fixup_hp_gpio_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4421 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4422 const struct hda_fixup *fix, int action)
4423 {
4424 struct alc_spec *spec = codec->spec;
4425
4426 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4427 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4428 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4429 * enable headphone amp
4430 */
4431 spec->gpio_mask |= 0x10;
4432 spec->gpio_dir |= 0x10;
4433 spec->cap_mute_led_nid = 0x18;
4434 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4435 codec->power_filter = led_power_filter;
4436 }
4437 }
4438
alc280_fixup_hp_gpio4(struct hda_codec * codec,const struct hda_fixup * fix,int action)4439 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4440 const struct hda_fixup *fix, int action)
4441 {
4442 struct alc_spec *spec = codec->spec;
4443
4444 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4445 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4446 spec->cap_mute_led_nid = 0x18;
4447 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4448 codec->power_filter = led_power_filter;
4449 }
4450 }
4451
4452 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4453 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4454 */
alc245_fixup_hp_x360_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4455 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4456 const struct hda_fixup *fix, int action)
4457 {
4458 struct alc_spec *spec = codec->spec;
4459
4460 switch (action) {
4461 case HDA_FIXUP_ACT_PRE_PROBE:
4462 spec->gpio_mask |= 0x01;
4463 spec->gpio_dir |= 0x01;
4464 break;
4465 case HDA_FIXUP_ACT_INIT:
4466 /* need to toggle GPIO to enable the amp */
4467 alc_update_gpio_data(codec, 0x01, true);
4468 msleep(100);
4469 alc_update_gpio_data(codec, 0x01, false);
4470 break;
4471 }
4472 }
4473
4474 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
alc274_hp_envy_pcm_hook(struct hda_pcm_stream * hinfo,struct hda_codec * codec,struct snd_pcm_substream * substream,int action)4475 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4476 struct hda_codec *codec,
4477 struct snd_pcm_substream *substream,
4478 int action)
4479 {
4480 switch (action) {
4481 case HDA_GEN_PCM_ACT_PREPARE:
4482 alc_update_gpio_data(codec, 0x04, true);
4483 break;
4484 case HDA_GEN_PCM_ACT_CLEANUP:
4485 alc_update_gpio_data(codec, 0x04, false);
4486 break;
4487 }
4488 }
4489
alc274_fixup_hp_envy_gpio(struct hda_codec * codec,const struct hda_fixup * fix,int action)4490 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4491 const struct hda_fixup *fix,
4492 int action)
4493 {
4494 struct alc_spec *spec = codec->spec;
4495
4496 if (action == HDA_FIXUP_ACT_PROBE) {
4497 spec->gpio_mask |= 0x04;
4498 spec->gpio_dir |= 0x04;
4499 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4500 }
4501 }
4502
alc_update_coef_led(struct hda_codec * codec,struct alc_coef_led * led,bool polarity,bool on)4503 static void alc_update_coef_led(struct hda_codec *codec,
4504 struct alc_coef_led *led,
4505 bool polarity, bool on)
4506 {
4507 if (polarity)
4508 on = !on;
4509 /* temporarily power up/down for setting COEF bit */
4510 alc_update_coef_idx(codec, led->idx, led->mask,
4511 on ? led->on : led->off);
4512 }
4513
4514 /* update mute-LED according to the speaker mute state via COEF bit */
coef_mute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4515 static int coef_mute_led_set(struct led_classdev *led_cdev,
4516 enum led_brightness brightness)
4517 {
4518 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4519 struct alc_spec *spec = codec->spec;
4520
4521 alc_update_coef_led(codec, &spec->mute_led_coef,
4522 spec->mute_led_polarity, brightness);
4523 return 0;
4524 }
4525
alc285_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4526 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4527 const struct hda_fixup *fix,
4528 int action)
4529 {
4530 struct alc_spec *spec = codec->spec;
4531
4532 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4533 spec->mute_led_polarity = 0;
4534 spec->mute_led_coef.idx = 0x0b;
4535 spec->mute_led_coef.mask = 1 << 3;
4536 spec->mute_led_coef.on = 1 << 3;
4537 spec->mute_led_coef.off = 0;
4538 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4539 }
4540 }
4541
alc236_fixup_hp_mute_led_coefbit(struct hda_codec * codec,const struct hda_fixup * fix,int action)4542 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4543 const struct hda_fixup *fix,
4544 int action)
4545 {
4546 struct alc_spec *spec = codec->spec;
4547
4548 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4549 spec->mute_led_polarity = 0;
4550 spec->mute_led_coef.idx = 0x34;
4551 spec->mute_led_coef.mask = 1 << 5;
4552 spec->mute_led_coef.on = 0;
4553 spec->mute_led_coef.off = 1 << 5;
4554 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4555 }
4556 }
4557
4558 /* turn on/off mic-mute LED per capture hook by coef bit */
coef_micmute_led_set(struct led_classdev * led_cdev,enum led_brightness brightness)4559 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4560 enum led_brightness brightness)
4561 {
4562 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4563 struct alc_spec *spec = codec->spec;
4564
4565 alc_update_coef_led(codec, &spec->mic_led_coef,
4566 spec->micmute_led_polarity, brightness);
4567 return 0;
4568 }
4569
alc285_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4570 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4571 const struct hda_fixup *fix, int action)
4572 {
4573 struct alc_spec *spec = codec->spec;
4574
4575 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4576 spec->mic_led_coef.idx = 0x19;
4577 spec->mic_led_coef.mask = 1 << 13;
4578 spec->mic_led_coef.on = 1 << 13;
4579 spec->mic_led_coef.off = 0;
4580 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4581 }
4582 }
4583
alc236_fixup_hp_coef_micmute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4584 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4585 const struct hda_fixup *fix, int action)
4586 {
4587 struct alc_spec *spec = codec->spec;
4588
4589 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4590 spec->mic_led_coef.idx = 0x35;
4591 spec->mic_led_coef.mask = 3 << 2;
4592 spec->mic_led_coef.on = 2 << 2;
4593 spec->mic_led_coef.off = 1 << 2;
4594 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4595 }
4596 }
4597
alc285_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4598 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4599 const struct hda_fixup *fix, int action)
4600 {
4601 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4602 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4603 }
4604
alc236_fixup_hp_mute_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4605 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4606 const struct hda_fixup *fix, int action)
4607 {
4608 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4609 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4610 }
4611
alc236_fixup_hp_micmute_led_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4612 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4613 const struct hda_fixup *fix, int action)
4614 {
4615 struct alc_spec *spec = codec->spec;
4616
4617 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4618 spec->cap_mute_led_nid = 0x1a;
4619 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4620 codec->power_filter = led_power_filter;
4621 }
4622 }
4623
alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)4624 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4625 const struct hda_fixup *fix, int action)
4626 {
4627 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4628 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4629 }
4630
alc298_samsung_write_coef_pack(struct hda_codec * codec,const unsigned short coefs[2])4631 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4632 const unsigned short coefs[2])
4633 {
4634 alc_write_coef_idx(codec, 0x23, coefs[0]);
4635 alc_write_coef_idx(codec, 0x25, coefs[1]);
4636 alc_write_coef_idx(codec, 0x26, 0xb011);
4637 }
4638
4639 struct alc298_samsung_amp_desc {
4640 unsigned char nid;
4641 unsigned short init_seq[2][2];
4642 };
4643
alc298_fixup_samsung_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)4644 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4645 const struct hda_fixup *fix, int action)
4646 {
4647 int i, j;
4648 static const unsigned short init_seq[][2] = {
4649 { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4650 { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4651 { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4652 { 0x41, 0x07 }, { 0x400, 0x1 }
4653 };
4654 static const struct alc298_samsung_amp_desc amps[] = {
4655 { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4656 { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4657 };
4658
4659 if (action != HDA_FIXUP_ACT_INIT)
4660 return;
4661
4662 for (i = 0; i < ARRAY_SIZE(amps); i++) {
4663 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4664
4665 for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4666 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4667
4668 for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4669 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4670 }
4671 }
4672
4673 #if IS_REACHABLE(CONFIG_INPUT)
gpio2_mic_hotkey_event(struct hda_codec * codec,struct hda_jack_callback * event)4674 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4675 struct hda_jack_callback *event)
4676 {
4677 struct alc_spec *spec = codec->spec;
4678
4679 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4680 send both key on and key off event for every interrupt. */
4681 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4682 input_sync(spec->kb_dev);
4683 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4684 input_sync(spec->kb_dev);
4685 }
4686
alc_register_micmute_input_device(struct hda_codec * codec)4687 static int alc_register_micmute_input_device(struct hda_codec *codec)
4688 {
4689 struct alc_spec *spec = codec->spec;
4690 int i;
4691
4692 spec->kb_dev = input_allocate_device();
4693 if (!spec->kb_dev) {
4694 codec_err(codec, "Out of memory (input_allocate_device)\n");
4695 return -ENOMEM;
4696 }
4697
4698 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4699
4700 spec->kb_dev->name = "Microphone Mute Button";
4701 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4702 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4703 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4704 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4705 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4706 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4707
4708 if (input_register_device(spec->kb_dev)) {
4709 codec_err(codec, "input_register_device failed\n");
4710 input_free_device(spec->kb_dev);
4711 spec->kb_dev = NULL;
4712 return -ENOMEM;
4713 }
4714
4715 return 0;
4716 }
4717
4718 /* GPIO1 = set according to SKU external amp
4719 * GPIO2 = mic mute hotkey
4720 * GPIO3 = mute LED
4721 * GPIO4 = mic mute LED
4722 */
alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4723 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4724 const struct hda_fixup *fix, int action)
4725 {
4726 struct alc_spec *spec = codec->spec;
4727
4728 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4729 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4730 spec->init_amp = ALC_INIT_DEFAULT;
4731 if (alc_register_micmute_input_device(codec) != 0)
4732 return;
4733
4734 spec->gpio_mask |= 0x06;
4735 spec->gpio_dir |= 0x02;
4736 spec->gpio_data |= 0x02;
4737 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4738 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4739 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4740 gpio2_mic_hotkey_event);
4741 return;
4742 }
4743
4744 if (!spec->kb_dev)
4745 return;
4746
4747 switch (action) {
4748 case HDA_FIXUP_ACT_FREE:
4749 input_unregister_device(spec->kb_dev);
4750 spec->kb_dev = NULL;
4751 }
4752 }
4753
4754 /* Line2 = mic mute hotkey
4755 * GPIO2 = mic mute LED
4756 */
alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec * codec,const struct hda_fixup * fix,int action)4757 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4758 const struct hda_fixup *fix, int action)
4759 {
4760 struct alc_spec *spec = codec->spec;
4761
4762 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4763 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4764 spec->init_amp = ALC_INIT_DEFAULT;
4765 if (alc_register_micmute_input_device(codec) != 0)
4766 return;
4767
4768 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4769 gpio2_mic_hotkey_event);
4770 return;
4771 }
4772
4773 if (!spec->kb_dev)
4774 return;
4775
4776 switch (action) {
4777 case HDA_FIXUP_ACT_FREE:
4778 input_unregister_device(spec->kb_dev);
4779 spec->kb_dev = NULL;
4780 }
4781 }
4782 #else /* INPUT */
4783 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4784 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4785 #endif /* INPUT */
4786
alc269_fixup_hp_line1_mic1_led(struct hda_codec * codec,const struct hda_fixup * fix,int action)4787 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4788 const struct hda_fixup *fix, int action)
4789 {
4790 struct alc_spec *spec = codec->spec;
4791
4792 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4793 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4794 spec->cap_mute_led_nid = 0x18;
4795 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4796 }
4797 }
4798
4799 static const struct coef_fw alc225_pre_hsmode[] = {
4800 UPDATE_COEF(0x4a, 1<<8, 0),
4801 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4802 UPDATE_COEF(0x63, 3<<14, 3<<14),
4803 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4804 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4805 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4806 UPDATE_COEF(0x4a, 3<<10, 0),
4807 {}
4808 };
4809
alc_headset_mode_unplugged(struct hda_codec * codec)4810 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4811 {
4812 struct alc_spec *spec = codec->spec;
4813 static const struct coef_fw coef0255[] = {
4814 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4815 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4816 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4817 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4818 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4819 {}
4820 };
4821 static const struct coef_fw coef0256[] = {
4822 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4823 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4824 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4825 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4826 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4827 {}
4828 };
4829 static const struct coef_fw coef0233[] = {
4830 WRITE_COEF(0x1b, 0x0c0b),
4831 WRITE_COEF(0x45, 0xc429),
4832 UPDATE_COEF(0x35, 0x4000, 0),
4833 WRITE_COEF(0x06, 0x2104),
4834 WRITE_COEF(0x1a, 0x0001),
4835 WRITE_COEF(0x26, 0x0004),
4836 WRITE_COEF(0x32, 0x42a3),
4837 {}
4838 };
4839 static const struct coef_fw coef0288[] = {
4840 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4841 UPDATE_COEF(0x50, 0x2000, 0x2000),
4842 UPDATE_COEF(0x56, 0x0006, 0x0006),
4843 UPDATE_COEF(0x66, 0x0008, 0),
4844 UPDATE_COEF(0x67, 0x2000, 0),
4845 {}
4846 };
4847 static const struct coef_fw coef0298[] = {
4848 UPDATE_COEF(0x19, 0x1300, 0x0300),
4849 {}
4850 };
4851 static const struct coef_fw coef0292[] = {
4852 WRITE_COEF(0x76, 0x000e),
4853 WRITE_COEF(0x6c, 0x2400),
4854 WRITE_COEF(0x18, 0x7308),
4855 WRITE_COEF(0x6b, 0xc429),
4856 {}
4857 };
4858 static const struct coef_fw coef0293[] = {
4859 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4860 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4861 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4862 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4863 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4864 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4865 {}
4866 };
4867 static const struct coef_fw coef0668[] = {
4868 WRITE_COEF(0x15, 0x0d40),
4869 WRITE_COEF(0xb7, 0x802b),
4870 {}
4871 };
4872 static const struct coef_fw coef0225[] = {
4873 UPDATE_COEF(0x63, 3<<14, 0),
4874 {}
4875 };
4876 static const struct coef_fw coef0274[] = {
4877 UPDATE_COEF(0x4a, 0x0100, 0),
4878 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4879 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4880 UPDATE_COEF(0x4a, 0x0010, 0),
4881 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4882 WRITE_COEF(0x45, 0x5289),
4883 UPDATE_COEF(0x4a, 0x0c00, 0),
4884 {}
4885 };
4886
4887 if (spec->no_internal_mic_pin) {
4888 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4889 return;
4890 }
4891
4892 switch (codec->core.vendor_id) {
4893 case 0x10ec0255:
4894 alc_process_coef_fw(codec, coef0255);
4895 break;
4896 case 0x10ec0230:
4897 case 0x10ec0236:
4898 case 0x10ec0256:
4899 case 0x19e58326:
4900 alc_process_coef_fw(codec, coef0256);
4901 break;
4902 case 0x10ec0234:
4903 case 0x10ec0274:
4904 case 0x10ec0294:
4905 alc_process_coef_fw(codec, coef0274);
4906 break;
4907 case 0x10ec0233:
4908 case 0x10ec0283:
4909 alc_process_coef_fw(codec, coef0233);
4910 break;
4911 case 0x10ec0286:
4912 case 0x10ec0288:
4913 alc_process_coef_fw(codec, coef0288);
4914 break;
4915 case 0x10ec0298:
4916 alc_process_coef_fw(codec, coef0298);
4917 alc_process_coef_fw(codec, coef0288);
4918 break;
4919 case 0x10ec0292:
4920 alc_process_coef_fw(codec, coef0292);
4921 break;
4922 case 0x10ec0293:
4923 alc_process_coef_fw(codec, coef0293);
4924 break;
4925 case 0x10ec0668:
4926 alc_process_coef_fw(codec, coef0668);
4927 break;
4928 case 0x10ec0215:
4929 case 0x10ec0225:
4930 case 0x10ec0285:
4931 case 0x10ec0295:
4932 case 0x10ec0289:
4933 case 0x10ec0299:
4934 alc_process_coef_fw(codec, alc225_pre_hsmode);
4935 alc_process_coef_fw(codec, coef0225);
4936 break;
4937 case 0x10ec0867:
4938 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4939 break;
4940 }
4941 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4942 }
4943
4944
alc_headset_mode_mic_in(struct hda_codec * codec,hda_nid_t hp_pin,hda_nid_t mic_pin)4945 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4946 hda_nid_t mic_pin)
4947 {
4948 static const struct coef_fw coef0255[] = {
4949 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4950 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4951 {}
4952 };
4953 static const struct coef_fw coef0256[] = {
4954 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4955 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4956 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4957 {}
4958 };
4959 static const struct coef_fw coef0233[] = {
4960 UPDATE_COEF(0x35, 0, 1<<14),
4961 WRITE_COEF(0x06, 0x2100),
4962 WRITE_COEF(0x1a, 0x0021),
4963 WRITE_COEF(0x26, 0x008c),
4964 {}
4965 };
4966 static const struct coef_fw coef0288[] = {
4967 UPDATE_COEF(0x4f, 0x00c0, 0),
4968 UPDATE_COEF(0x50, 0x2000, 0),
4969 UPDATE_COEF(0x56, 0x0006, 0),
4970 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4971 UPDATE_COEF(0x66, 0x0008, 0x0008),
4972 UPDATE_COEF(0x67, 0x2000, 0x2000),
4973 {}
4974 };
4975 static const struct coef_fw coef0292[] = {
4976 WRITE_COEF(0x19, 0xa208),
4977 WRITE_COEF(0x2e, 0xacf0),
4978 {}
4979 };
4980 static const struct coef_fw coef0293[] = {
4981 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4982 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4983 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4984 {}
4985 };
4986 static const struct coef_fw coef0688[] = {
4987 WRITE_COEF(0xb7, 0x802b),
4988 WRITE_COEF(0xb5, 0x1040),
4989 UPDATE_COEF(0xc3, 0, 1<<12),
4990 {}
4991 };
4992 static const struct coef_fw coef0225[] = {
4993 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4994 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4995 UPDATE_COEF(0x63, 3<<14, 0),
4996 {}
4997 };
4998 static const struct coef_fw coef0274[] = {
4999 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5000 UPDATE_COEF(0x4a, 0x0010, 0),
5001 UPDATE_COEF(0x6b, 0xf000, 0),
5002 {}
5003 };
5004
5005 switch (codec->core.vendor_id) {
5006 case 0x10ec0255:
5007 alc_write_coef_idx(codec, 0x45, 0xc489);
5008 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5009 alc_process_coef_fw(codec, coef0255);
5010 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5011 break;
5012 case 0x10ec0230:
5013 case 0x10ec0236:
5014 case 0x10ec0256:
5015 case 0x19e58326:
5016 alc_write_coef_idx(codec, 0x45, 0xc489);
5017 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5018 alc_process_coef_fw(codec, coef0256);
5019 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5020 break;
5021 case 0x10ec0234:
5022 case 0x10ec0274:
5023 case 0x10ec0294:
5024 alc_write_coef_idx(codec, 0x45, 0x4689);
5025 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5026 alc_process_coef_fw(codec, coef0274);
5027 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5028 break;
5029 case 0x10ec0233:
5030 case 0x10ec0283:
5031 alc_write_coef_idx(codec, 0x45, 0xc429);
5032 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5033 alc_process_coef_fw(codec, coef0233);
5034 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5035 break;
5036 case 0x10ec0286:
5037 case 0x10ec0288:
5038 case 0x10ec0298:
5039 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5040 alc_process_coef_fw(codec, coef0288);
5041 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5042 break;
5043 case 0x10ec0292:
5044 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5045 alc_process_coef_fw(codec, coef0292);
5046 break;
5047 case 0x10ec0293:
5048 /* Set to TRS mode */
5049 alc_write_coef_idx(codec, 0x45, 0xc429);
5050 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5051 alc_process_coef_fw(codec, coef0293);
5052 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5053 break;
5054 case 0x10ec0867:
5055 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5056 fallthrough;
5057 case 0x10ec0221:
5058 case 0x10ec0662:
5059 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5060 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5061 break;
5062 case 0x10ec0668:
5063 alc_write_coef_idx(codec, 0x11, 0x0001);
5064 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5065 alc_process_coef_fw(codec, coef0688);
5066 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5067 break;
5068 case 0x10ec0215:
5069 case 0x10ec0225:
5070 case 0x10ec0285:
5071 case 0x10ec0295:
5072 case 0x10ec0289:
5073 case 0x10ec0299:
5074 alc_process_coef_fw(codec, alc225_pre_hsmode);
5075 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5076 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5077 alc_process_coef_fw(codec, coef0225);
5078 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5079 break;
5080 }
5081 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5082 }
5083
alc_headset_mode_default(struct hda_codec * codec)5084 static void alc_headset_mode_default(struct hda_codec *codec)
5085 {
5086 static const struct coef_fw coef0225[] = {
5087 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5088 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5089 UPDATE_COEF(0x49, 3<<8, 0<<8),
5090 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5091 UPDATE_COEF(0x63, 3<<14, 0),
5092 UPDATE_COEF(0x67, 0xf000, 0x3000),
5093 {}
5094 };
5095 static const struct coef_fw coef0255[] = {
5096 WRITE_COEF(0x45, 0xc089),
5097 WRITE_COEF(0x45, 0xc489),
5098 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5099 WRITE_COEF(0x49, 0x0049),
5100 {}
5101 };
5102 static const struct coef_fw coef0256[] = {
5103 WRITE_COEF(0x45, 0xc489),
5104 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5105 WRITE_COEF(0x49, 0x0049),
5106 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5107 WRITE_COEF(0x06, 0x6100),
5108 {}
5109 };
5110 static const struct coef_fw coef0233[] = {
5111 WRITE_COEF(0x06, 0x2100),
5112 WRITE_COEF(0x32, 0x4ea3),
5113 {}
5114 };
5115 static const struct coef_fw coef0288[] = {
5116 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5117 UPDATE_COEF(0x50, 0x2000, 0x2000),
5118 UPDATE_COEF(0x56, 0x0006, 0x0006),
5119 UPDATE_COEF(0x66, 0x0008, 0),
5120 UPDATE_COEF(0x67, 0x2000, 0),
5121 {}
5122 };
5123 static const struct coef_fw coef0292[] = {
5124 WRITE_COEF(0x76, 0x000e),
5125 WRITE_COEF(0x6c, 0x2400),
5126 WRITE_COEF(0x6b, 0xc429),
5127 WRITE_COEF(0x18, 0x7308),
5128 {}
5129 };
5130 static const struct coef_fw coef0293[] = {
5131 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5132 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5133 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5134 {}
5135 };
5136 static const struct coef_fw coef0688[] = {
5137 WRITE_COEF(0x11, 0x0041),
5138 WRITE_COEF(0x15, 0x0d40),
5139 WRITE_COEF(0xb7, 0x802b),
5140 {}
5141 };
5142 static const struct coef_fw coef0274[] = {
5143 WRITE_COEF(0x45, 0x4289),
5144 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5145 UPDATE_COEF(0x6b, 0x0f00, 0),
5146 UPDATE_COEF(0x49, 0x0300, 0x0300),
5147 {}
5148 };
5149
5150 switch (codec->core.vendor_id) {
5151 case 0x10ec0215:
5152 case 0x10ec0225:
5153 case 0x10ec0285:
5154 case 0x10ec0295:
5155 case 0x10ec0289:
5156 case 0x10ec0299:
5157 alc_process_coef_fw(codec, alc225_pre_hsmode);
5158 alc_process_coef_fw(codec, coef0225);
5159 break;
5160 case 0x10ec0255:
5161 alc_process_coef_fw(codec, coef0255);
5162 break;
5163 case 0x10ec0230:
5164 case 0x10ec0236:
5165 case 0x10ec0256:
5166 case 0x19e58326:
5167 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5168 alc_write_coef_idx(codec, 0x45, 0xc089);
5169 msleep(50);
5170 alc_process_coef_fw(codec, coef0256);
5171 break;
5172 case 0x10ec0234:
5173 case 0x10ec0274:
5174 case 0x10ec0294:
5175 alc_process_coef_fw(codec, coef0274);
5176 break;
5177 case 0x10ec0233:
5178 case 0x10ec0283:
5179 alc_process_coef_fw(codec, coef0233);
5180 break;
5181 case 0x10ec0286:
5182 case 0x10ec0288:
5183 case 0x10ec0298:
5184 alc_process_coef_fw(codec, coef0288);
5185 break;
5186 case 0x10ec0292:
5187 alc_process_coef_fw(codec, coef0292);
5188 break;
5189 case 0x10ec0293:
5190 alc_process_coef_fw(codec, coef0293);
5191 break;
5192 case 0x10ec0668:
5193 alc_process_coef_fw(codec, coef0688);
5194 break;
5195 case 0x10ec0867:
5196 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5197 break;
5198 }
5199 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5200 }
5201
5202 /* Iphone type */
alc_headset_mode_ctia(struct hda_codec * codec)5203 static void alc_headset_mode_ctia(struct hda_codec *codec)
5204 {
5205 int val;
5206
5207 static const struct coef_fw coef0255[] = {
5208 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5209 WRITE_COEF(0x1b, 0x0c2b),
5210 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5211 {}
5212 };
5213 static const struct coef_fw coef0256[] = {
5214 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5215 WRITE_COEF(0x1b, 0x0e6b),
5216 {}
5217 };
5218 static const struct coef_fw coef0233[] = {
5219 WRITE_COEF(0x45, 0xd429),
5220 WRITE_COEF(0x1b, 0x0c2b),
5221 WRITE_COEF(0x32, 0x4ea3),
5222 {}
5223 };
5224 static const struct coef_fw coef0288[] = {
5225 UPDATE_COEF(0x50, 0x2000, 0x2000),
5226 UPDATE_COEF(0x56, 0x0006, 0x0006),
5227 UPDATE_COEF(0x66, 0x0008, 0),
5228 UPDATE_COEF(0x67, 0x2000, 0),
5229 {}
5230 };
5231 static const struct coef_fw coef0292[] = {
5232 WRITE_COEF(0x6b, 0xd429),
5233 WRITE_COEF(0x76, 0x0008),
5234 WRITE_COEF(0x18, 0x7388),
5235 {}
5236 };
5237 static const struct coef_fw coef0293[] = {
5238 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5239 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5240 {}
5241 };
5242 static const struct coef_fw coef0688[] = {
5243 WRITE_COEF(0x11, 0x0001),
5244 WRITE_COEF(0x15, 0x0d60),
5245 WRITE_COEF(0xc3, 0x0000),
5246 {}
5247 };
5248 static const struct coef_fw coef0225_1[] = {
5249 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5250 UPDATE_COEF(0x63, 3<<14, 2<<14),
5251 {}
5252 };
5253 static const struct coef_fw coef0225_2[] = {
5254 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5255 UPDATE_COEF(0x63, 3<<14, 1<<14),
5256 {}
5257 };
5258
5259 switch (codec->core.vendor_id) {
5260 case 0x10ec0255:
5261 alc_process_coef_fw(codec, coef0255);
5262 break;
5263 case 0x10ec0230:
5264 case 0x10ec0236:
5265 case 0x10ec0256:
5266 case 0x19e58326:
5267 alc_process_coef_fw(codec, coef0256);
5268 break;
5269 case 0x10ec0234:
5270 case 0x10ec0274:
5271 case 0x10ec0294:
5272 alc_write_coef_idx(codec, 0x45, 0xd689);
5273 break;
5274 case 0x10ec0233:
5275 case 0x10ec0283:
5276 alc_process_coef_fw(codec, coef0233);
5277 break;
5278 case 0x10ec0298:
5279 val = alc_read_coef_idx(codec, 0x50);
5280 if (val & (1 << 12)) {
5281 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5282 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5283 msleep(300);
5284 } else {
5285 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5286 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5287 msleep(300);
5288 }
5289 break;
5290 case 0x10ec0286:
5291 case 0x10ec0288:
5292 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5293 msleep(300);
5294 alc_process_coef_fw(codec, coef0288);
5295 break;
5296 case 0x10ec0292:
5297 alc_process_coef_fw(codec, coef0292);
5298 break;
5299 case 0x10ec0293:
5300 alc_process_coef_fw(codec, coef0293);
5301 break;
5302 case 0x10ec0668:
5303 alc_process_coef_fw(codec, coef0688);
5304 break;
5305 case 0x10ec0215:
5306 case 0x10ec0225:
5307 case 0x10ec0285:
5308 case 0x10ec0295:
5309 case 0x10ec0289:
5310 case 0x10ec0299:
5311 val = alc_read_coef_idx(codec, 0x45);
5312 if (val & (1 << 9))
5313 alc_process_coef_fw(codec, coef0225_2);
5314 else
5315 alc_process_coef_fw(codec, coef0225_1);
5316 break;
5317 case 0x10ec0867:
5318 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5319 break;
5320 }
5321 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5322 }
5323
5324 /* Nokia type */
alc_headset_mode_omtp(struct hda_codec * codec)5325 static void alc_headset_mode_omtp(struct hda_codec *codec)
5326 {
5327 static const struct coef_fw coef0255[] = {
5328 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5329 WRITE_COEF(0x1b, 0x0c2b),
5330 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5331 {}
5332 };
5333 static const struct coef_fw coef0256[] = {
5334 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5335 WRITE_COEF(0x1b, 0x0e6b),
5336 {}
5337 };
5338 static const struct coef_fw coef0233[] = {
5339 WRITE_COEF(0x45, 0xe429),
5340 WRITE_COEF(0x1b, 0x0c2b),
5341 WRITE_COEF(0x32, 0x4ea3),
5342 {}
5343 };
5344 static const struct coef_fw coef0288[] = {
5345 UPDATE_COEF(0x50, 0x2000, 0x2000),
5346 UPDATE_COEF(0x56, 0x0006, 0x0006),
5347 UPDATE_COEF(0x66, 0x0008, 0),
5348 UPDATE_COEF(0x67, 0x2000, 0),
5349 {}
5350 };
5351 static const struct coef_fw coef0292[] = {
5352 WRITE_COEF(0x6b, 0xe429),
5353 WRITE_COEF(0x76, 0x0008),
5354 WRITE_COEF(0x18, 0x7388),
5355 {}
5356 };
5357 static const struct coef_fw coef0293[] = {
5358 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5359 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5360 {}
5361 };
5362 static const struct coef_fw coef0688[] = {
5363 WRITE_COEF(0x11, 0x0001),
5364 WRITE_COEF(0x15, 0x0d50),
5365 WRITE_COEF(0xc3, 0x0000),
5366 {}
5367 };
5368 static const struct coef_fw coef0225[] = {
5369 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5370 UPDATE_COEF(0x63, 3<<14, 2<<14),
5371 {}
5372 };
5373
5374 switch (codec->core.vendor_id) {
5375 case 0x10ec0255:
5376 alc_process_coef_fw(codec, coef0255);
5377 break;
5378 case 0x10ec0230:
5379 case 0x10ec0236:
5380 case 0x10ec0256:
5381 case 0x19e58326:
5382 alc_process_coef_fw(codec, coef0256);
5383 break;
5384 case 0x10ec0234:
5385 case 0x10ec0274:
5386 case 0x10ec0294:
5387 alc_write_coef_idx(codec, 0x45, 0xe689);
5388 break;
5389 case 0x10ec0233:
5390 case 0x10ec0283:
5391 alc_process_coef_fw(codec, coef0233);
5392 break;
5393 case 0x10ec0298:
5394 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5395 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5396 msleep(300);
5397 break;
5398 case 0x10ec0286:
5399 case 0x10ec0288:
5400 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5401 msleep(300);
5402 alc_process_coef_fw(codec, coef0288);
5403 break;
5404 case 0x10ec0292:
5405 alc_process_coef_fw(codec, coef0292);
5406 break;
5407 case 0x10ec0293:
5408 alc_process_coef_fw(codec, coef0293);
5409 break;
5410 case 0x10ec0668:
5411 alc_process_coef_fw(codec, coef0688);
5412 break;
5413 case 0x10ec0215:
5414 case 0x10ec0225:
5415 case 0x10ec0285:
5416 case 0x10ec0295:
5417 case 0x10ec0289:
5418 case 0x10ec0299:
5419 alc_process_coef_fw(codec, coef0225);
5420 break;
5421 }
5422 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5423 }
5424
alc_determine_headset_type(struct hda_codec * codec)5425 static void alc_determine_headset_type(struct hda_codec *codec)
5426 {
5427 int val;
5428 bool is_ctia = false;
5429 struct alc_spec *spec = codec->spec;
5430 static const struct coef_fw coef0255[] = {
5431 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5432 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5433 conteol) */
5434 {}
5435 };
5436 static const struct coef_fw coef0288[] = {
5437 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5438 {}
5439 };
5440 static const struct coef_fw coef0298[] = {
5441 UPDATE_COEF(0x50, 0x2000, 0x2000),
5442 UPDATE_COEF(0x56, 0x0006, 0x0006),
5443 UPDATE_COEF(0x66, 0x0008, 0),
5444 UPDATE_COEF(0x67, 0x2000, 0),
5445 UPDATE_COEF(0x19, 0x1300, 0x1300),
5446 {}
5447 };
5448 static const struct coef_fw coef0293[] = {
5449 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5450 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5451 {}
5452 };
5453 static const struct coef_fw coef0688[] = {
5454 WRITE_COEF(0x11, 0x0001),
5455 WRITE_COEF(0xb7, 0x802b),
5456 WRITE_COEF(0x15, 0x0d60),
5457 WRITE_COEF(0xc3, 0x0c00),
5458 {}
5459 };
5460 static const struct coef_fw coef0274[] = {
5461 UPDATE_COEF(0x4a, 0x0010, 0),
5462 UPDATE_COEF(0x4a, 0x8000, 0),
5463 WRITE_COEF(0x45, 0xd289),
5464 UPDATE_COEF(0x49, 0x0300, 0x0300),
5465 {}
5466 };
5467
5468 if (spec->no_internal_mic_pin) {
5469 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5470 return;
5471 }
5472
5473 switch (codec->core.vendor_id) {
5474 case 0x10ec0255:
5475 alc_process_coef_fw(codec, coef0255);
5476 msleep(300);
5477 val = alc_read_coef_idx(codec, 0x46);
5478 is_ctia = (val & 0x0070) == 0x0070;
5479 break;
5480 case 0x10ec0230:
5481 case 0x10ec0236:
5482 case 0x10ec0256:
5483 case 0x19e58326:
5484 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5485 alc_write_coef_idx(codec, 0x06, 0x6104);
5486 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5487
5488 snd_hda_codec_write(codec, 0x21, 0,
5489 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5490 msleep(80);
5491 snd_hda_codec_write(codec, 0x21, 0,
5492 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5493
5494 alc_process_coef_fw(codec, coef0255);
5495 msleep(300);
5496 val = alc_read_coef_idx(codec, 0x46);
5497 is_ctia = (val & 0x0070) == 0x0070;
5498
5499 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5500 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5501
5502 snd_hda_codec_write(codec, 0x21, 0,
5503 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5504 msleep(80);
5505 snd_hda_codec_write(codec, 0x21, 0,
5506 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5507 break;
5508 case 0x10ec0234:
5509 case 0x10ec0274:
5510 case 0x10ec0294:
5511 alc_process_coef_fw(codec, coef0274);
5512 msleep(850);
5513 val = alc_read_coef_idx(codec, 0x46);
5514 is_ctia = (val & 0x00f0) == 0x00f0;
5515 break;
5516 case 0x10ec0233:
5517 case 0x10ec0283:
5518 alc_write_coef_idx(codec, 0x45, 0xd029);
5519 msleep(300);
5520 val = alc_read_coef_idx(codec, 0x46);
5521 is_ctia = (val & 0x0070) == 0x0070;
5522 break;
5523 case 0x10ec0298:
5524 snd_hda_codec_write(codec, 0x21, 0,
5525 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5526 msleep(100);
5527 snd_hda_codec_write(codec, 0x21, 0,
5528 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5529 msleep(200);
5530
5531 val = alc_read_coef_idx(codec, 0x50);
5532 if (val & (1 << 12)) {
5533 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5534 alc_process_coef_fw(codec, coef0288);
5535 msleep(350);
5536 val = alc_read_coef_idx(codec, 0x50);
5537 is_ctia = (val & 0x0070) == 0x0070;
5538 } else {
5539 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5540 alc_process_coef_fw(codec, coef0288);
5541 msleep(350);
5542 val = alc_read_coef_idx(codec, 0x50);
5543 is_ctia = (val & 0x0070) == 0x0070;
5544 }
5545 alc_process_coef_fw(codec, coef0298);
5546 snd_hda_codec_write(codec, 0x21, 0,
5547 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5548 msleep(75);
5549 snd_hda_codec_write(codec, 0x21, 0,
5550 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5551 break;
5552 case 0x10ec0286:
5553 case 0x10ec0288:
5554 alc_process_coef_fw(codec, coef0288);
5555 msleep(350);
5556 val = alc_read_coef_idx(codec, 0x50);
5557 is_ctia = (val & 0x0070) == 0x0070;
5558 break;
5559 case 0x10ec0292:
5560 alc_write_coef_idx(codec, 0x6b, 0xd429);
5561 msleep(300);
5562 val = alc_read_coef_idx(codec, 0x6c);
5563 is_ctia = (val & 0x001c) == 0x001c;
5564 break;
5565 case 0x10ec0293:
5566 alc_process_coef_fw(codec, coef0293);
5567 msleep(300);
5568 val = alc_read_coef_idx(codec, 0x46);
5569 is_ctia = (val & 0x0070) == 0x0070;
5570 break;
5571 case 0x10ec0668:
5572 alc_process_coef_fw(codec, coef0688);
5573 msleep(300);
5574 val = alc_read_coef_idx(codec, 0xbe);
5575 is_ctia = (val & 0x1c02) == 0x1c02;
5576 break;
5577 case 0x10ec0215:
5578 case 0x10ec0225:
5579 case 0x10ec0285:
5580 case 0x10ec0295:
5581 case 0x10ec0289:
5582 case 0x10ec0299:
5583 snd_hda_codec_write(codec, 0x21, 0,
5584 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5585 msleep(80);
5586 snd_hda_codec_write(codec, 0x21, 0,
5587 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5588
5589 alc_process_coef_fw(codec, alc225_pre_hsmode);
5590 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5591 val = alc_read_coef_idx(codec, 0x45);
5592 if (val & (1 << 9)) {
5593 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5594 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5595 msleep(800);
5596 val = alc_read_coef_idx(codec, 0x46);
5597 is_ctia = (val & 0x00f0) == 0x00f0;
5598 } else {
5599 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5600 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5601 msleep(800);
5602 val = alc_read_coef_idx(codec, 0x46);
5603 is_ctia = (val & 0x00f0) == 0x00f0;
5604 }
5605 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5606 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5607 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5608
5609 snd_hda_codec_write(codec, 0x21, 0,
5610 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5611 msleep(80);
5612 snd_hda_codec_write(codec, 0x21, 0,
5613 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5614 break;
5615 case 0x10ec0867:
5616 is_ctia = true;
5617 break;
5618 }
5619
5620 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5621 is_ctia ? "yes" : "no");
5622 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5623 }
5624
alc_update_headset_mode(struct hda_codec * codec)5625 static void alc_update_headset_mode(struct hda_codec *codec)
5626 {
5627 struct alc_spec *spec = codec->spec;
5628
5629 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5630 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5631
5632 int new_headset_mode;
5633
5634 if (!snd_hda_jack_detect(codec, hp_pin))
5635 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5636 else if (mux_pin == spec->headset_mic_pin)
5637 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5638 else if (mux_pin == spec->headphone_mic_pin)
5639 new_headset_mode = ALC_HEADSET_MODE_MIC;
5640 else
5641 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5642
5643 if (new_headset_mode == spec->current_headset_mode) {
5644 snd_hda_gen_update_outputs(codec);
5645 return;
5646 }
5647
5648 switch (new_headset_mode) {
5649 case ALC_HEADSET_MODE_UNPLUGGED:
5650 alc_headset_mode_unplugged(codec);
5651 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5652 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5653 spec->gen.hp_jack_present = false;
5654 break;
5655 case ALC_HEADSET_MODE_HEADSET:
5656 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5657 alc_determine_headset_type(codec);
5658 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5659 alc_headset_mode_ctia(codec);
5660 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5661 alc_headset_mode_omtp(codec);
5662 spec->gen.hp_jack_present = true;
5663 break;
5664 case ALC_HEADSET_MODE_MIC:
5665 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5666 spec->gen.hp_jack_present = false;
5667 break;
5668 case ALC_HEADSET_MODE_HEADPHONE:
5669 alc_headset_mode_default(codec);
5670 spec->gen.hp_jack_present = true;
5671 break;
5672 }
5673 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5674 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5675 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5676 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5677 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5678 PIN_VREFHIZ);
5679 }
5680 spec->current_headset_mode = new_headset_mode;
5681
5682 snd_hda_gen_update_outputs(codec);
5683 }
5684
alc_update_headset_mode_hook(struct hda_codec * codec,struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)5685 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5686 struct snd_kcontrol *kcontrol,
5687 struct snd_ctl_elem_value *ucontrol)
5688 {
5689 alc_update_headset_mode(codec);
5690 }
5691
alc_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5692 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5693 struct hda_jack_callback *jack)
5694 {
5695 snd_hda_gen_hp_automute(codec, jack);
5696 alc_update_headset_mode(codec);
5697 }
5698
alc_probe_headset_mode(struct hda_codec * codec)5699 static void alc_probe_headset_mode(struct hda_codec *codec)
5700 {
5701 int i;
5702 struct alc_spec *spec = codec->spec;
5703 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5704
5705 /* Find mic pins */
5706 for (i = 0; i < cfg->num_inputs; i++) {
5707 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5708 spec->headset_mic_pin = cfg->inputs[i].pin;
5709 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5710 spec->headphone_mic_pin = cfg->inputs[i].pin;
5711 }
5712
5713 WARN_ON(spec->gen.cap_sync_hook);
5714 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5715 spec->gen.automute_hook = alc_update_headset_mode;
5716 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5717 }
5718
alc_fixup_headset_mode(struct hda_codec * codec,const struct hda_fixup * fix,int action)5719 static void alc_fixup_headset_mode(struct hda_codec *codec,
5720 const struct hda_fixup *fix, int action)
5721 {
5722 struct alc_spec *spec = codec->spec;
5723
5724 switch (action) {
5725 case HDA_FIXUP_ACT_PRE_PROBE:
5726 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5727 break;
5728 case HDA_FIXUP_ACT_PROBE:
5729 alc_probe_headset_mode(codec);
5730 break;
5731 case HDA_FIXUP_ACT_INIT:
5732 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5733 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5734 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5735 }
5736 alc_update_headset_mode(codec);
5737 break;
5738 }
5739 }
5740
alc_fixup_headset_mode_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5741 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5742 const struct hda_fixup *fix, int action)
5743 {
5744 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5745 struct alc_spec *spec = codec->spec;
5746 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5747 }
5748 else
5749 alc_fixup_headset_mode(codec, fix, action);
5750 }
5751
alc255_set_default_jack_type(struct hda_codec * codec)5752 static void alc255_set_default_jack_type(struct hda_codec *codec)
5753 {
5754 /* Set to iphone type */
5755 static const struct coef_fw alc255fw[] = {
5756 WRITE_COEF(0x1b, 0x880b),
5757 WRITE_COEF(0x45, 0xd089),
5758 WRITE_COEF(0x1b, 0x080b),
5759 WRITE_COEF(0x46, 0x0004),
5760 WRITE_COEF(0x1b, 0x0c0b),
5761 {}
5762 };
5763 static const struct coef_fw alc256fw[] = {
5764 WRITE_COEF(0x1b, 0x884b),
5765 WRITE_COEF(0x45, 0xd089),
5766 WRITE_COEF(0x1b, 0x084b),
5767 WRITE_COEF(0x46, 0x0004),
5768 WRITE_COEF(0x1b, 0x0c4b),
5769 {}
5770 };
5771 switch (codec->core.vendor_id) {
5772 case 0x10ec0255:
5773 alc_process_coef_fw(codec, alc255fw);
5774 break;
5775 case 0x10ec0230:
5776 case 0x10ec0236:
5777 case 0x10ec0256:
5778 case 0x19e58326:
5779 alc_process_coef_fw(codec, alc256fw);
5780 break;
5781 }
5782 msleep(30);
5783 }
5784
alc_fixup_headset_mode_alc255(struct hda_codec * codec,const struct hda_fixup * fix,int action)5785 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5786 const struct hda_fixup *fix, int action)
5787 {
5788 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5789 alc255_set_default_jack_type(codec);
5790 }
5791 alc_fixup_headset_mode(codec, fix, action);
5792 }
5793
alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)5794 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5795 const struct hda_fixup *fix, int action)
5796 {
5797 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5798 struct alc_spec *spec = codec->spec;
5799 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5800 alc255_set_default_jack_type(codec);
5801 }
5802 else
5803 alc_fixup_headset_mode(codec, fix, action);
5804 }
5805
alc288_update_headset_jack_cb(struct hda_codec * codec,struct hda_jack_callback * jack)5806 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5807 struct hda_jack_callback *jack)
5808 {
5809 struct alc_spec *spec = codec->spec;
5810
5811 alc_update_headset_jack_cb(codec, jack);
5812 /* Headset Mic enable or disable, only for Dell Dino */
5813 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5814 }
5815
alc_fixup_headset_mode_dell_alc288(struct hda_codec * codec,const struct hda_fixup * fix,int action)5816 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5817 const struct hda_fixup *fix, int action)
5818 {
5819 alc_fixup_headset_mode(codec, fix, action);
5820 if (action == HDA_FIXUP_ACT_PROBE) {
5821 struct alc_spec *spec = codec->spec;
5822 /* toggled via hp_automute_hook */
5823 spec->gpio_mask |= 0x40;
5824 spec->gpio_dir |= 0x40;
5825 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5826 }
5827 }
5828
alc_fixup_auto_mute_via_amp(struct hda_codec * codec,const struct hda_fixup * fix,int action)5829 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5830 const struct hda_fixup *fix, int action)
5831 {
5832 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5833 struct alc_spec *spec = codec->spec;
5834 spec->gen.auto_mute_via_amp = 1;
5835 }
5836 }
5837
alc_fixup_no_shutup(struct hda_codec * codec,const struct hda_fixup * fix,int action)5838 static void alc_fixup_no_shutup(struct hda_codec *codec,
5839 const struct hda_fixup *fix, int action)
5840 {
5841 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5842 struct alc_spec *spec = codec->spec;
5843 spec->no_shutup_pins = 1;
5844 }
5845 }
5846
alc_fixup_disable_aamix(struct hda_codec * codec,const struct hda_fixup * fix,int action)5847 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5848 const struct hda_fixup *fix, int action)
5849 {
5850 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5851 struct alc_spec *spec = codec->spec;
5852 /* Disable AA-loopback as it causes white noise */
5853 spec->gen.mixer_nid = 0;
5854 }
5855 }
5856
5857 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
alc_fixup_tpt440_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)5858 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5859 const struct hda_fixup *fix, int action)
5860 {
5861 static const struct hda_pintbl pincfgs[] = {
5862 { 0x16, 0x21211010 }, /* dock headphone */
5863 { 0x19, 0x21a11010 }, /* dock mic */
5864 { }
5865 };
5866 struct alc_spec *spec = codec->spec;
5867
5868 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5869 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
5870 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5871 codec->power_save_node = 0; /* avoid click noises */
5872 snd_hda_apply_pincfgs(codec, pincfgs);
5873 }
5874 }
5875
alc_fixup_tpt470_dock(struct hda_codec * codec,const struct hda_fixup * fix,int action)5876 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5877 const struct hda_fixup *fix, int action)
5878 {
5879 static const struct hda_pintbl pincfgs[] = {
5880 { 0x17, 0x21211010 }, /* dock headphone */
5881 { 0x19, 0x21a11010 }, /* dock mic */
5882 { }
5883 };
5884 struct alc_spec *spec = codec->spec;
5885
5886 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5887 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5888 snd_hda_apply_pincfgs(codec, pincfgs);
5889 } else if (action == HDA_FIXUP_ACT_INIT) {
5890 /* Enable DOCK device */
5891 snd_hda_codec_write(codec, 0x17, 0,
5892 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5893 /* Enable DOCK device */
5894 snd_hda_codec_write(codec, 0x19, 0,
5895 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5896 }
5897 }
5898
alc_fixup_tpt470_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)5899 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5900 const struct hda_fixup *fix, int action)
5901 {
5902 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5903 * the speaker output becomes too low by some reason on Thinkpads with
5904 * ALC298 codec
5905 */
5906 static const hda_nid_t preferred_pairs[] = {
5907 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5908 0
5909 };
5910 struct alc_spec *spec = codec->spec;
5911
5912 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5913 spec->gen.preferred_dacs = preferred_pairs;
5914 }
5915
alc295_fixup_asus_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)5916 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5917 const struct hda_fixup *fix, int action)
5918 {
5919 static const hda_nid_t preferred_pairs[] = {
5920 0x17, 0x02, 0x21, 0x03, 0
5921 };
5922 struct alc_spec *spec = codec->spec;
5923
5924 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5925 spec->gen.preferred_dacs = preferred_pairs;
5926 }
5927
alc_shutup_dell_xps13(struct hda_codec * codec)5928 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5929 {
5930 struct alc_spec *spec = codec->spec;
5931 int hp_pin = alc_get_hp_pin(spec);
5932
5933 /* Prevent pop noises when headphones are plugged in */
5934 snd_hda_codec_write(codec, hp_pin, 0,
5935 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5936 msleep(20);
5937 }
5938
alc_fixup_dell_xps13(struct hda_codec * codec,const struct hda_fixup * fix,int action)5939 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5940 const struct hda_fixup *fix, int action)
5941 {
5942 struct alc_spec *spec = codec->spec;
5943 struct hda_input_mux *imux = &spec->gen.input_mux;
5944 int i;
5945
5946 switch (action) {
5947 case HDA_FIXUP_ACT_PRE_PROBE:
5948 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5949 * it causes a click noise at start up
5950 */
5951 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5952 spec->shutup = alc_shutup_dell_xps13;
5953 break;
5954 case HDA_FIXUP_ACT_PROBE:
5955 /* Make the internal mic the default input source. */
5956 for (i = 0; i < imux->num_items; i++) {
5957 if (spec->gen.imux_pins[i] == 0x12) {
5958 spec->gen.cur_mux[0] = i;
5959 break;
5960 }
5961 }
5962 break;
5963 }
5964 }
5965
alc_fixup_headset_mode_alc662(struct hda_codec * codec,const struct hda_fixup * fix,int action)5966 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5967 const struct hda_fixup *fix, int action)
5968 {
5969 struct alc_spec *spec = codec->spec;
5970
5971 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5972 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5973 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
5974
5975 /* Disable boost for mic-in permanently. (This code is only called
5976 from quirks that guarantee that the headphone is at NID 0x1b.) */
5977 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5978 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
5979 } else
5980 alc_fixup_headset_mode(codec, fix, action);
5981 }
5982
alc_fixup_headset_mode_alc668(struct hda_codec * codec,const struct hda_fixup * fix,int action)5983 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5984 const struct hda_fixup *fix, int action)
5985 {
5986 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5987 alc_write_coef_idx(codec, 0xc4, 0x8000);
5988 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
5989 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5990 }
5991 alc_fixup_headset_mode(codec, fix, action);
5992 }
5993
5994 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
find_ext_mic_pin(struct hda_codec * codec)5995 static int find_ext_mic_pin(struct hda_codec *codec)
5996 {
5997 struct alc_spec *spec = codec->spec;
5998 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5999 hda_nid_t nid;
6000 unsigned int defcfg;
6001 int i;
6002
6003 for (i = 0; i < cfg->num_inputs; i++) {
6004 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6005 continue;
6006 nid = cfg->inputs[i].pin;
6007 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6008 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6009 continue;
6010 return nid;
6011 }
6012
6013 return 0;
6014 }
6015
alc271_hp_gate_mic_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6016 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6017 const struct hda_fixup *fix,
6018 int action)
6019 {
6020 struct alc_spec *spec = codec->spec;
6021
6022 if (action == HDA_FIXUP_ACT_PROBE) {
6023 int mic_pin = find_ext_mic_pin(codec);
6024 int hp_pin = alc_get_hp_pin(spec);
6025
6026 if (snd_BUG_ON(!mic_pin || !hp_pin))
6027 return;
6028 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6029 }
6030 }
6031
alc269_fixup_limit_int_mic_boost(struct hda_codec * codec,const struct hda_fixup * fix,int action)6032 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6033 const struct hda_fixup *fix,
6034 int action)
6035 {
6036 struct alc_spec *spec = codec->spec;
6037 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6038 int i;
6039
6040 /* The mic boosts on level 2 and 3 are too noisy
6041 on the internal mic input.
6042 Therefore limit the boost to 0 or 1. */
6043
6044 if (action != HDA_FIXUP_ACT_PROBE)
6045 return;
6046
6047 for (i = 0; i < cfg->num_inputs; i++) {
6048 hda_nid_t nid = cfg->inputs[i].pin;
6049 unsigned int defcfg;
6050 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6051 continue;
6052 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6053 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6054 continue;
6055
6056 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6057 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6058 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6059 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6060 (0 << AC_AMPCAP_MUTE_SHIFT));
6061 }
6062 }
6063
alc283_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6064 static void alc283_hp_automute_hook(struct hda_codec *codec,
6065 struct hda_jack_callback *jack)
6066 {
6067 struct alc_spec *spec = codec->spec;
6068 int vref;
6069
6070 msleep(200);
6071 snd_hda_gen_hp_automute(codec, jack);
6072
6073 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6074
6075 msleep(600);
6076 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6077 vref);
6078 }
6079
alc283_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6080 static void alc283_fixup_chromebook(struct hda_codec *codec,
6081 const struct hda_fixup *fix, int action)
6082 {
6083 struct alc_spec *spec = codec->spec;
6084
6085 switch (action) {
6086 case HDA_FIXUP_ACT_PRE_PROBE:
6087 snd_hda_override_wcaps(codec, 0x03, 0);
6088 /* Disable AA-loopback as it causes white noise */
6089 spec->gen.mixer_nid = 0;
6090 break;
6091 case HDA_FIXUP_ACT_INIT:
6092 /* MIC2-VREF control */
6093 /* Set to manual mode */
6094 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6095 /* Enable Line1 input control by verb */
6096 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6097 break;
6098 }
6099 }
6100
alc283_fixup_sense_combo_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6101 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6102 const struct hda_fixup *fix, int action)
6103 {
6104 struct alc_spec *spec = codec->spec;
6105
6106 switch (action) {
6107 case HDA_FIXUP_ACT_PRE_PROBE:
6108 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6109 break;
6110 case HDA_FIXUP_ACT_INIT:
6111 /* MIC2-VREF control */
6112 /* Set to manual mode */
6113 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6114 break;
6115 }
6116 }
6117
6118 /* mute tablet speaker pin (0x14) via dock plugging in addition */
asus_tx300_automute(struct hda_codec * codec)6119 static void asus_tx300_automute(struct hda_codec *codec)
6120 {
6121 struct alc_spec *spec = codec->spec;
6122 snd_hda_gen_update_outputs(codec);
6123 if (snd_hda_jack_detect(codec, 0x1b))
6124 spec->gen.mute_bits |= (1ULL << 0x14);
6125 }
6126
alc282_fixup_asus_tx300(struct hda_codec * codec,const struct hda_fixup * fix,int action)6127 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6128 const struct hda_fixup *fix, int action)
6129 {
6130 struct alc_spec *spec = codec->spec;
6131 static const struct hda_pintbl dock_pins[] = {
6132 { 0x1b, 0x21114000 }, /* dock speaker pin */
6133 {}
6134 };
6135
6136 switch (action) {
6137 case HDA_FIXUP_ACT_PRE_PROBE:
6138 spec->init_amp = ALC_INIT_DEFAULT;
6139 /* TX300 needs to set up GPIO2 for the speaker amp */
6140 alc_setup_gpio(codec, 0x04);
6141 snd_hda_apply_pincfgs(codec, dock_pins);
6142 spec->gen.auto_mute_via_amp = 1;
6143 spec->gen.automute_hook = asus_tx300_automute;
6144 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6145 snd_hda_gen_hp_automute);
6146 break;
6147 case HDA_FIXUP_ACT_PROBE:
6148 spec->init_amp = ALC_INIT_DEFAULT;
6149 break;
6150 case HDA_FIXUP_ACT_BUILD:
6151 /* this is a bit tricky; give more sane names for the main
6152 * (tablet) speaker and the dock speaker, respectively
6153 */
6154 rename_ctl(codec, "Speaker Playback Switch",
6155 "Dock Speaker Playback Switch");
6156 rename_ctl(codec, "Bass Speaker Playback Switch",
6157 "Speaker Playback Switch");
6158 break;
6159 }
6160 }
6161
alc290_fixup_mono_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6162 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6163 const struct hda_fixup *fix, int action)
6164 {
6165 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6166 /* DAC node 0x03 is giving mono output. We therefore want to
6167 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6168 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6169 static const hda_nid_t conn1[] = { 0x0c };
6170 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6171 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6172 }
6173 }
6174
alc298_fixup_speaker_volume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6175 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6176 const struct hda_fixup *fix, int action)
6177 {
6178 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6179 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6180 we can't adjust the speaker's volume since this node does not has
6181 Amp-out capability. we change the speaker's route to:
6182 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6183 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6184 speaker's volume now. */
6185
6186 static const hda_nid_t conn1[] = { 0x0c };
6187 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6188 }
6189 }
6190
6191 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
alc295_fixup_disable_dac3(struct hda_codec * codec,const struct hda_fixup * fix,int action)6192 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6193 const struct hda_fixup *fix, int action)
6194 {
6195 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6196 static const hda_nid_t conn[] = { 0x02, 0x03 };
6197 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6198 }
6199 }
6200
6201 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
alc285_fixup_speaker2_to_dac1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6202 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6203 const struct hda_fixup *fix, int action)
6204 {
6205 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6206 static const hda_nid_t conn[] = { 0x02 };
6207 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6208 }
6209 }
6210
6211 /* Hook to update amp GPIO4 for automute */
alc280_hp_gpio4_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)6212 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6213 struct hda_jack_callback *jack)
6214 {
6215 struct alc_spec *spec = codec->spec;
6216
6217 snd_hda_gen_hp_automute(codec, jack);
6218 /* mute_led_polarity is set to 0, so we pass inverted value here */
6219 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6220 !spec->gen.hp_jack_present);
6221 }
6222
6223 /* Manage GPIOs for HP EliteBook Folio 9480m.
6224 *
6225 * GPIO4 is the headphone amplifier power control
6226 * GPIO3 is the audio output mute indicator LED
6227 */
6228
alc280_fixup_hp_9480m(struct hda_codec * codec,const struct hda_fixup * fix,int action)6229 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6230 const struct hda_fixup *fix,
6231 int action)
6232 {
6233 struct alc_spec *spec = codec->spec;
6234
6235 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6236 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6237 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6238 spec->gpio_mask |= 0x10;
6239 spec->gpio_dir |= 0x10;
6240 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6241 }
6242 }
6243
alc275_fixup_gpio4_off(struct hda_codec * codec,const struct hda_fixup * fix,int action)6244 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6245 const struct hda_fixup *fix,
6246 int action)
6247 {
6248 struct alc_spec *spec = codec->spec;
6249
6250 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6251 spec->gpio_mask |= 0x04;
6252 spec->gpio_dir |= 0x04;
6253 /* set data bit low */
6254 }
6255 }
6256
6257 /* Quirk for Thinkpad X1 7th and 8th Gen
6258 * The following fixed routing needed
6259 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6260 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6261 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6262 */
alc285_fixup_thinkpad_x1_gen7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6263 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6264 const struct hda_fixup *fix, int action)
6265 {
6266 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6267 static const hda_nid_t preferred_pairs[] = {
6268 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6269 };
6270 struct alc_spec *spec = codec->spec;
6271
6272 switch (action) {
6273 case HDA_FIXUP_ACT_PRE_PROBE:
6274 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6275 spec->gen.preferred_dacs = preferred_pairs;
6276 break;
6277 case HDA_FIXUP_ACT_BUILD:
6278 /* The generic parser creates somewhat unintuitive volume ctls
6279 * with the fixed routing above, and the shared DAC2 may be
6280 * confusing for PA.
6281 * Rename those to unique names so that PA doesn't touch them
6282 * and use only Master volume.
6283 */
6284 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6285 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6286 break;
6287 }
6288 }
6289
alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6290 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6291 const struct hda_fixup *fix,
6292 int action)
6293 {
6294 alc_fixup_dual_codecs(codec, fix, action);
6295 switch (action) {
6296 case HDA_FIXUP_ACT_PRE_PROBE:
6297 /* override card longname to provide a unique UCM profile */
6298 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6299 break;
6300 case HDA_FIXUP_ACT_BUILD:
6301 /* rename Capture controls depending on the codec */
6302 rename_ctl(codec, "Capture Volume",
6303 codec->addr == 0 ?
6304 "Rear-Panel Capture Volume" :
6305 "Front-Panel Capture Volume");
6306 rename_ctl(codec, "Capture Switch",
6307 codec->addr == 0 ?
6308 "Rear-Panel Capture Switch" :
6309 "Front-Panel Capture Switch");
6310 break;
6311 }
6312 }
6313
alc225_fixup_s3_pop_noise(struct hda_codec * codec,const struct hda_fixup * fix,int action)6314 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6315 const struct hda_fixup *fix, int action)
6316 {
6317 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6318 return;
6319
6320 codec->power_save_node = 1;
6321 }
6322
6323 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
alc274_fixup_bind_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6324 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6325 const struct hda_fixup *fix, int action)
6326 {
6327 struct alc_spec *spec = codec->spec;
6328 static const hda_nid_t preferred_pairs[] = {
6329 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6330 0
6331 };
6332
6333 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6334 return;
6335
6336 spec->gen.preferred_dacs = preferred_pairs;
6337 spec->gen.auto_mute_via_amp = 1;
6338 codec->power_save_node = 0;
6339 }
6340
6341 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
alc289_fixup_asus_ga401(struct hda_codec * codec,const struct hda_fixup * fix,int action)6342 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6343 const struct hda_fixup *fix, int action)
6344 {
6345 static const hda_nid_t preferred_pairs[] = {
6346 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6347 };
6348 struct alc_spec *spec = codec->spec;
6349
6350 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6351 spec->gen.preferred_dacs = preferred_pairs;
6352 spec->gen.obey_preferred_dacs = 1;
6353 }
6354 }
6355
6356 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
alc285_fixup_invalidate_dacs(struct hda_codec * codec,const struct hda_fixup * fix,int action)6357 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6358 const struct hda_fixup *fix, int action)
6359 {
6360 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6361 return;
6362
6363 snd_hda_override_wcaps(codec, 0x03, 0);
6364 }
6365
alc_combo_jack_hp_jd_restart(struct hda_codec * codec)6366 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6367 {
6368 switch (codec->core.vendor_id) {
6369 case 0x10ec0274:
6370 case 0x10ec0294:
6371 case 0x10ec0225:
6372 case 0x10ec0295:
6373 case 0x10ec0299:
6374 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6375 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6376 break;
6377 case 0x10ec0230:
6378 case 0x10ec0235:
6379 case 0x10ec0236:
6380 case 0x10ec0255:
6381 case 0x10ec0256:
6382 case 0x19e58326:
6383 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6384 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6385 break;
6386 }
6387 }
6388
alc295_fixup_chromebook(struct hda_codec * codec,const struct hda_fixup * fix,int action)6389 static void alc295_fixup_chromebook(struct hda_codec *codec,
6390 const struct hda_fixup *fix, int action)
6391 {
6392 struct alc_spec *spec = codec->spec;
6393
6394 switch (action) {
6395 case HDA_FIXUP_ACT_PRE_PROBE:
6396 spec->ultra_low_power = true;
6397 break;
6398 case HDA_FIXUP_ACT_INIT:
6399 alc_combo_jack_hp_jd_restart(codec);
6400 break;
6401 }
6402 }
6403
alc_fixup_disable_mic_vref(struct hda_codec * codec,const struct hda_fixup * fix,int action)6404 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6405 const struct hda_fixup *fix, int action)
6406 {
6407 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6408 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6409 }
6410
6411
alc294_gx502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6412 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6413 struct hda_jack_callback *cb)
6414 {
6415 /* The Windows driver sets the codec up in a very different way where
6416 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6417 */
6418 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6419 alc_write_coef_idx(codec, 0x10, 0x8a20);
6420 else
6421 alc_write_coef_idx(codec, 0x10, 0x0a20);
6422 }
6423
alc294_fixup_gx502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6424 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6425 const struct hda_fixup *fix, int action)
6426 {
6427 /* Pin 0x21: headphones/headset mic */
6428 if (!is_jack_detectable(codec, 0x21))
6429 return;
6430
6431 switch (action) {
6432 case HDA_FIXUP_ACT_PRE_PROBE:
6433 snd_hda_jack_detect_enable_callback(codec, 0x21,
6434 alc294_gx502_toggle_output);
6435 break;
6436 case HDA_FIXUP_ACT_INIT:
6437 /* Make sure to start in a correct state, i.e. if
6438 * headphones have been plugged in before powering up the system
6439 */
6440 alc294_gx502_toggle_output(codec, NULL);
6441 break;
6442 }
6443 }
6444
alc294_gu502_toggle_output(struct hda_codec * codec,struct hda_jack_callback * cb)6445 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6446 struct hda_jack_callback *cb)
6447 {
6448 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6449 * responsible from changes between speakers and headphones
6450 */
6451 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6452 alc_write_coef_idx(codec, 0x10, 0x8420);
6453 else
6454 alc_write_coef_idx(codec, 0x10, 0x0a20);
6455 }
6456
alc294_fixup_gu502_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)6457 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6458 const struct hda_fixup *fix, int action)
6459 {
6460 if (!is_jack_detectable(codec, 0x21))
6461 return;
6462
6463 switch (action) {
6464 case HDA_FIXUP_ACT_PRE_PROBE:
6465 snd_hda_jack_detect_enable_callback(codec, 0x21,
6466 alc294_gu502_toggle_output);
6467 break;
6468 case HDA_FIXUP_ACT_INIT:
6469 alc294_gu502_toggle_output(codec, NULL);
6470 break;
6471 }
6472 }
6473
alc285_fixup_hp_gpio_amp_init(struct hda_codec * codec,const struct hda_fixup * fix,int action)6474 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6475 const struct hda_fixup *fix, int action)
6476 {
6477 if (action != HDA_FIXUP_ACT_INIT)
6478 return;
6479
6480 msleep(100);
6481 alc_write_coef_idx(codec, 0x65, 0x0);
6482 }
6483
alc274_fixup_hp_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6484 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6485 const struct hda_fixup *fix, int action)
6486 {
6487 switch (action) {
6488 case HDA_FIXUP_ACT_INIT:
6489 alc_combo_jack_hp_jd_restart(codec);
6490 break;
6491 }
6492 }
6493
alc_fixup_no_int_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)6494 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6495 const struct hda_fixup *fix, int action)
6496 {
6497 struct alc_spec *spec = codec->spec;
6498
6499 switch (action) {
6500 case HDA_FIXUP_ACT_PRE_PROBE:
6501 /* Mic RING SLEEVE swap for combo jack */
6502 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6503 spec->no_internal_mic_pin = true;
6504 break;
6505 case HDA_FIXUP_ACT_INIT:
6506 alc_combo_jack_hp_jd_restart(codec);
6507 break;
6508 }
6509 }
6510
6511 /* GPIO1 = amplifier on/off
6512 * GPIO3 = mic mute LED
6513 */
alc285_fixup_hp_spectre_x360_eb1(struct hda_codec * codec,const struct hda_fixup * fix,int action)6514 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6515 const struct hda_fixup *fix, int action)
6516 {
6517 static const hda_nid_t conn[] = { 0x02 };
6518
6519 struct alc_spec *spec = codec->spec;
6520 static const struct hda_pintbl pincfgs[] = {
6521 { 0x14, 0x90170110 }, /* front/high speakers */
6522 { 0x17, 0x90170130 }, /* back/bass speakers */
6523 { }
6524 };
6525
6526 //enable micmute led
6527 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6528
6529 switch (action) {
6530 case HDA_FIXUP_ACT_PRE_PROBE:
6531 spec->micmute_led_polarity = 1;
6532 /* needed for amp of back speakers */
6533 spec->gpio_mask |= 0x01;
6534 spec->gpio_dir |= 0x01;
6535 snd_hda_apply_pincfgs(codec, pincfgs);
6536 /* share DAC to have unified volume control */
6537 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6538 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6539 break;
6540 case HDA_FIXUP_ACT_INIT:
6541 /* need to toggle GPIO to enable the amp of back speakers */
6542 alc_update_gpio_data(codec, 0x01, true);
6543 msleep(100);
6544 alc_update_gpio_data(codec, 0x01, false);
6545 break;
6546 }
6547 }
6548
alc285_fixup_hp_spectre_x360(struct hda_codec * codec,const struct hda_fixup * fix,int action)6549 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6550 const struct hda_fixup *fix, int action)
6551 {
6552 static const hda_nid_t conn[] = { 0x02 };
6553 static const struct hda_pintbl pincfgs[] = {
6554 { 0x14, 0x90170110 }, /* rear speaker */
6555 { }
6556 };
6557
6558 switch (action) {
6559 case HDA_FIXUP_ACT_PRE_PROBE:
6560 snd_hda_apply_pincfgs(codec, pincfgs);
6561 /* force front speaker to DAC1 */
6562 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6563 break;
6564 }
6565 }
6566
6567 /* for hda_fixup_thinkpad_acpi() */
6568 #include "thinkpad_helper.c"
6569
alc_fixup_thinkpad_acpi(struct hda_codec * codec,const struct hda_fixup * fix,int action)6570 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6571 const struct hda_fixup *fix, int action)
6572 {
6573 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6574 hda_fixup_thinkpad_acpi(codec, fix, action);
6575 }
6576
6577 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
alc287_fixup_legion_15imhg05_speakers(struct hda_codec * codec,const struct hda_fixup * fix,int action)6578 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6579 const struct hda_fixup *fix,
6580 int action)
6581 {
6582 struct alc_spec *spec = codec->spec;
6583
6584 switch (action) {
6585 case HDA_FIXUP_ACT_PRE_PROBE:
6586 spec->gen.suppress_auto_mute = 1;
6587 break;
6588 }
6589 }
6590
6591 /* for alc295_fixup_hp_top_speakers */
6592 #include "hp_x360_helper.c"
6593
6594 /* for alc285_fixup_ideapad_s740_coef() */
6595 #include "ideapad_s740_helper.c"
6596
6597 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6598 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6599 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6600 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6601 {}
6602 };
6603
alc256_fixup_set_coef_defaults(struct hda_codec * codec,const struct hda_fixup * fix,int action)6604 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6605 const struct hda_fixup *fix,
6606 int action)
6607 {
6608 /*
6609 * A certain other OS sets these coeffs to different values. On at least
6610 * one TongFang barebone these settings might survive even a cold
6611 * reboot. So to restore a clean slate the values are explicitly reset
6612 * to default here. Without this, the external microphone is always in a
6613 * plugged-in state, while the internal microphone is always in an
6614 * unplugged state, breaking the ability to use the internal microphone.
6615 */
6616 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
6617 }
6618
6619 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6620 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6621 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6622 WRITE_COEF(0x49, 0x0149),
6623 {}
6624 };
6625
alc233_fixup_no_audio_jack(struct hda_codec * codec,const struct hda_fixup * fix,int action)6626 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6627 const struct hda_fixup *fix,
6628 int action)
6629 {
6630 /*
6631 * The audio jack input and output is not detected on the ASRock NUC Box
6632 * 1100 series when cold booting without this fix. Warm rebooting from a
6633 * certain other OS makes the audio functional, as COEF settings are
6634 * preserved in this case. This fix sets these altered COEF values as
6635 * the default.
6636 */
6637 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6638 }
6639
alc256_fixup_mic_no_presence_and_resume(struct hda_codec * codec,const struct hda_fixup * fix,int action)6640 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6641 const struct hda_fixup *fix,
6642 int action)
6643 {
6644 /*
6645 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6646 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6647 * needs an additional quirk for sound working after suspend and resume.
6648 */
6649 if (codec->core.vendor_id == 0x10ec0256) {
6650 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6651 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6652 } else {
6653 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6654 }
6655 }
6656
6657 enum {
6658 ALC269_FIXUP_GPIO2,
6659 ALC269_FIXUP_SONY_VAIO,
6660 ALC275_FIXUP_SONY_VAIO_GPIO2,
6661 ALC269_FIXUP_DELL_M101Z,
6662 ALC269_FIXUP_SKU_IGNORE,
6663 ALC269_FIXUP_ASUS_G73JW,
6664 ALC269_FIXUP_LENOVO_EAPD,
6665 ALC275_FIXUP_SONY_HWEQ,
6666 ALC275_FIXUP_SONY_DISABLE_AAMIX,
6667 ALC271_FIXUP_DMIC,
6668 ALC269_FIXUP_PCM_44K,
6669 ALC269_FIXUP_STEREO_DMIC,
6670 ALC269_FIXUP_HEADSET_MIC,
6671 ALC269_FIXUP_QUANTA_MUTE,
6672 ALC269_FIXUP_LIFEBOOK,
6673 ALC269_FIXUP_LIFEBOOK_EXTMIC,
6674 ALC269_FIXUP_LIFEBOOK_HP_PIN,
6675 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
6676 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
6677 ALC269_FIXUP_AMIC,
6678 ALC269_FIXUP_DMIC,
6679 ALC269VB_FIXUP_AMIC,
6680 ALC269VB_FIXUP_DMIC,
6681 ALC269_FIXUP_HP_MUTE_LED,
6682 ALC269_FIXUP_HP_MUTE_LED_MIC1,
6683 ALC269_FIXUP_HP_MUTE_LED_MIC2,
6684 ALC269_FIXUP_HP_MUTE_LED_MIC3,
6685 ALC269_FIXUP_HP_GPIO_LED,
6686 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6687 ALC269_FIXUP_HP_LINE1_MIC1_LED,
6688 ALC269_FIXUP_INV_DMIC,
6689 ALC269_FIXUP_LENOVO_DOCK,
6690 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
6691 ALC269_FIXUP_NO_SHUTUP,
6692 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
6693 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6694 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6695 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6696 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6697 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6698 ALC269_FIXUP_HEADSET_MODE,
6699 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
6700 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
6701 ALC269_FIXUP_ASUS_X101_FUNC,
6702 ALC269_FIXUP_ASUS_X101_VERB,
6703 ALC269_FIXUP_ASUS_X101,
6704 ALC271_FIXUP_AMIC_MIC2,
6705 ALC271_FIXUP_HP_GATE_MIC_JACK,
6706 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
6707 ALC269_FIXUP_ACER_AC700,
6708 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
6709 ALC269VB_FIXUP_ASUS_ZENBOOK,
6710 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
6711 ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
6712 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
6713 ALC269VB_FIXUP_ORDISSIMO_EVE2,
6714 ALC283_FIXUP_CHROME_BOOK,
6715 ALC283_FIXUP_SENSE_COMBO_JACK,
6716 ALC282_FIXUP_ASUS_TX300,
6717 ALC283_FIXUP_INT_MIC,
6718 ALC290_FIXUP_MONO_SPEAKERS,
6719 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6720 ALC290_FIXUP_SUBWOOFER,
6721 ALC290_FIXUP_SUBWOOFER_HSJACK,
6722 ALC269_FIXUP_THINKPAD_ACPI,
6723 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
6724 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6725 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6726 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6727 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6728 ALC255_FIXUP_HEADSET_MODE,
6729 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
6730 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6731 ALC292_FIXUP_TPT440_DOCK,
6732 ALC292_FIXUP_TPT440,
6733 ALC283_FIXUP_HEADSET_MIC,
6734 ALC255_FIXUP_MIC_MUTE_LED,
6735 ALC282_FIXUP_ASPIRE_V5_PINS,
6736 ALC269VB_FIXUP_ASPIRE_E1_COEF,
6737 ALC280_FIXUP_HP_GPIO4,
6738 ALC286_FIXUP_HP_GPIO_LED,
6739 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
6740 ALC280_FIXUP_HP_DOCK_PINS,
6741 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
6742 ALC280_FIXUP_HP_9480M,
6743 ALC245_FIXUP_HP_X360_AMP,
6744 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
6745 ALC288_FIXUP_DELL_HEADSET_MODE,
6746 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
6747 ALC288_FIXUP_DELL_XPS_13,
6748 ALC288_FIXUP_DISABLE_AAMIX,
6749 ALC292_FIXUP_DELL_E7X_AAMIX,
6750 ALC292_FIXUP_DELL_E7X,
6751 ALC292_FIXUP_DISABLE_AAMIX,
6752 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
6753 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
6754 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6755 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6756 ALC275_FIXUP_DELL_XPS,
6757 ALC293_FIXUP_LENOVO_SPK_NOISE,
6758 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6759 ALC255_FIXUP_DELL_SPK_NOISE,
6760 ALC225_FIXUP_DISABLE_MIC_VREF,
6761 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6762 ALC295_FIXUP_DISABLE_DAC3,
6763 ALC285_FIXUP_SPEAKER2_TO_DAC1,
6764 ALC280_FIXUP_HP_HEADSET_MIC,
6765 ALC221_FIXUP_HP_FRONT_MIC,
6766 ALC292_FIXUP_TPT460,
6767 ALC298_FIXUP_SPK_VOLUME,
6768 ALC298_FIXUP_LENOVO_SPK_VOLUME,
6769 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
6770 ALC269_FIXUP_ATIV_BOOK_8,
6771 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
6772 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
6773 ALC256_FIXUP_ASUS_HEADSET_MODE,
6774 ALC256_FIXUP_ASUS_MIC,
6775 ALC256_FIXUP_ASUS_AIO_GPIO2,
6776 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6777 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
6778 ALC233_FIXUP_LENOVO_MULTI_CODECS,
6779 ALC233_FIXUP_ACER_HEADSET_MIC,
6780 ALC294_FIXUP_LENOVO_MIC_LOCATION,
6781 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
6782 ALC225_FIXUP_S3_POP_NOISE,
6783 ALC700_FIXUP_INTEL_REFERENCE,
6784 ALC274_FIXUP_DELL_BIND_DACS,
6785 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
6786 ALC298_FIXUP_TPT470_DOCK_FIX,
6787 ALC298_FIXUP_TPT470_DOCK,
6788 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
6789 ALC255_FIXUP_DELL_HEADSET_MIC,
6790 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
6791 ALC298_FIXUP_HUAWEI_MBX_STEREO,
6792 ALC295_FIXUP_HP_X360,
6793 ALC221_FIXUP_HP_HEADSET_MIC,
6794 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
6795 ALC295_FIXUP_HP_AUTO_MUTE,
6796 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
6797 ALC294_FIXUP_ASUS_MIC,
6798 ALC294_FIXUP_ASUS_HEADSET_MIC,
6799 ALC294_FIXUP_ASUS_SPK,
6800 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6801 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
6802 ALC255_FIXUP_ACER_HEADSET_MIC,
6803 ALC295_FIXUP_CHROME_BOOK,
6804 ALC225_FIXUP_HEADSET_JACK,
6805 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6806 ALC225_FIXUP_WYSE_AUTO_MUTE,
6807 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
6808 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
6809 ALC256_FIXUP_ASUS_HEADSET_MIC,
6810 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
6811 ALC299_FIXUP_PREDATOR_SPK,
6812 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
6813 ALC289_FIXUP_DELL_SPK2,
6814 ALC289_FIXUP_DUAL_SPK,
6815 ALC294_FIXUP_SPK2_TO_DAC1,
6816 ALC294_FIXUP_ASUS_DUAL_SPK,
6817 ALC285_FIXUP_THINKPAD_X1_GEN7,
6818 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
6819 ALC294_FIXUP_ASUS_HPE,
6820 ALC294_FIXUP_ASUS_COEF_1B,
6821 ALC294_FIXUP_ASUS_GX502_HP,
6822 ALC294_FIXUP_ASUS_GX502_PINS,
6823 ALC294_FIXUP_ASUS_GX502_VERBS,
6824 ALC294_FIXUP_ASUS_GU502_HP,
6825 ALC294_FIXUP_ASUS_GU502_PINS,
6826 ALC294_FIXUP_ASUS_GU502_VERBS,
6827 ALC294_FIXUP_ASUS_G513_PINS,
6828 ALC285_FIXUP_ASUS_G533Z_PINS,
6829 ALC285_FIXUP_HP_GPIO_LED,
6830 ALC285_FIXUP_HP_MUTE_LED,
6831 ALC236_FIXUP_HP_GPIO_LED,
6832 ALC236_FIXUP_HP_MUTE_LED,
6833 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
6834 ALC298_FIXUP_SAMSUNG_AMP,
6835 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6836 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6837 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
6838 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6839 ALC269VC_FIXUP_ACER_HEADSET_MIC,
6840 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
6841 ALC289_FIXUP_ASUS_GA401,
6842 ALC289_FIXUP_ASUS_GA502,
6843 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
6844 ALC285_FIXUP_HP_GPIO_AMP_INIT,
6845 ALC269_FIXUP_CZC_B20,
6846 ALC269_FIXUP_CZC_TMI,
6847 ALC269_FIXUP_CZC_L101,
6848 ALC269_FIXUP_LEMOTE_A1802,
6849 ALC269_FIXUP_LEMOTE_A190X,
6850 ALC256_FIXUP_INTEL_NUC8_RUGGED,
6851 ALC233_FIXUP_INTEL_NUC8_DMIC,
6852 ALC233_FIXUP_INTEL_NUC8_BOOST,
6853 ALC256_FIXUP_INTEL_NUC10,
6854 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
6855 ALC274_FIXUP_HP_MIC,
6856 ALC274_FIXUP_HP_HEADSET_MIC,
6857 ALC274_FIXUP_HP_ENVY_GPIO,
6858 ALC256_FIXUP_ASUS_HPE,
6859 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
6860 ALC287_FIXUP_HP_GPIO_LED,
6861 ALC256_FIXUP_HP_HEADSET_MIC,
6862 ALC245_FIXUP_HP_GPIO_LED,
6863 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
6864 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
6865 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
6866 ALC256_FIXUP_ACER_HEADSET_MIC,
6867 ALC285_FIXUP_IDEAPAD_S740_COEF,
6868 ALC295_FIXUP_ASUS_DACS,
6869 ALC295_FIXUP_HP_OMEN,
6870 ALC285_FIXUP_HP_SPECTRE_X360,
6871 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
6872 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
6873 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
6874 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
6875 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6876 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6877 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
6878 ALC298_FIXUP_LENOVO_C940_DUET7,
6879 ALC287_FIXUP_13S_GEN2_SPEAKERS,
6880 ALC256_FIXUP_SET_COEF_DEFAULTS,
6881 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6882 ALC233_FIXUP_NO_AUDIO_JACK,
6883 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
6884 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6885 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
6886 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
6887 };
6888
6889 /* A special fixup for Lenovo C940 and Yoga Duet 7;
6890 * both have the very same PCI SSID, and we need to apply different fixups
6891 * depending on the codec ID
6892 */
alc298_fixup_lenovo_c940_duet7(struct hda_codec * codec,const struct hda_fixup * fix,int action)6893 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
6894 const struct hda_fixup *fix,
6895 int action)
6896 {
6897 int id;
6898
6899 if (codec->core.vendor_id == 0x10ec0298)
6900 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
6901 else
6902 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
6903 __snd_hda_apply_fixup(codec, id, action, 0);
6904 }
6905
6906 static const struct hda_fixup alc269_fixups[] = {
6907 [ALC269_FIXUP_GPIO2] = {
6908 .type = HDA_FIXUP_FUNC,
6909 .v.func = alc_fixup_gpio2,
6910 },
6911 [ALC269_FIXUP_SONY_VAIO] = {
6912 .type = HDA_FIXUP_PINCTLS,
6913 .v.pins = (const struct hda_pintbl[]) {
6914 {0x19, PIN_VREFGRD},
6915 {}
6916 }
6917 },
6918 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
6919 .type = HDA_FIXUP_FUNC,
6920 .v.func = alc275_fixup_gpio4_off,
6921 .chained = true,
6922 .chain_id = ALC269_FIXUP_SONY_VAIO
6923 },
6924 [ALC269_FIXUP_DELL_M101Z] = {
6925 .type = HDA_FIXUP_VERBS,
6926 .v.verbs = (const struct hda_verb[]) {
6927 /* Enables internal speaker */
6928 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6929 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6930 {}
6931 }
6932 },
6933 [ALC269_FIXUP_SKU_IGNORE] = {
6934 .type = HDA_FIXUP_FUNC,
6935 .v.func = alc_fixup_sku_ignore,
6936 },
6937 [ALC269_FIXUP_ASUS_G73JW] = {
6938 .type = HDA_FIXUP_PINS,
6939 .v.pins = (const struct hda_pintbl[]) {
6940 { 0x17, 0x99130111 }, /* subwoofer */
6941 { }
6942 }
6943 },
6944 [ALC269_FIXUP_LENOVO_EAPD] = {
6945 .type = HDA_FIXUP_VERBS,
6946 .v.verbs = (const struct hda_verb[]) {
6947 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6948 {}
6949 }
6950 },
6951 [ALC275_FIXUP_SONY_HWEQ] = {
6952 .type = HDA_FIXUP_FUNC,
6953 .v.func = alc269_fixup_hweq,
6954 .chained = true,
6955 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6956 },
6957 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6958 .type = HDA_FIXUP_FUNC,
6959 .v.func = alc_fixup_disable_aamix,
6960 .chained = true,
6961 .chain_id = ALC269_FIXUP_SONY_VAIO
6962 },
6963 [ALC271_FIXUP_DMIC] = {
6964 .type = HDA_FIXUP_FUNC,
6965 .v.func = alc271_fixup_dmic,
6966 },
6967 [ALC269_FIXUP_PCM_44K] = {
6968 .type = HDA_FIXUP_FUNC,
6969 .v.func = alc269_fixup_pcm_44k,
6970 .chained = true,
6971 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6972 },
6973 [ALC269_FIXUP_STEREO_DMIC] = {
6974 .type = HDA_FIXUP_FUNC,
6975 .v.func = alc269_fixup_stereo_dmic,
6976 },
6977 [ALC269_FIXUP_HEADSET_MIC] = {
6978 .type = HDA_FIXUP_FUNC,
6979 .v.func = alc269_fixup_headset_mic,
6980 },
6981 [ALC269_FIXUP_QUANTA_MUTE] = {
6982 .type = HDA_FIXUP_FUNC,
6983 .v.func = alc269_fixup_quanta_mute,
6984 },
6985 [ALC269_FIXUP_LIFEBOOK] = {
6986 .type = HDA_FIXUP_PINS,
6987 .v.pins = (const struct hda_pintbl[]) {
6988 { 0x1a, 0x2101103f }, /* dock line-out */
6989 { 0x1b, 0x23a11040 }, /* dock mic-in */
6990 { }
6991 },
6992 .chained = true,
6993 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6994 },
6995 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6996 .type = HDA_FIXUP_PINS,
6997 .v.pins = (const struct hda_pintbl[]) {
6998 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6999 { }
7000 },
7001 },
7002 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7003 .type = HDA_FIXUP_PINS,
7004 .v.pins = (const struct hda_pintbl[]) {
7005 { 0x21, 0x0221102f }, /* HP out */
7006 { }
7007 },
7008 },
7009 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7010 .type = HDA_FIXUP_FUNC,
7011 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7012 },
7013 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7014 .type = HDA_FIXUP_FUNC,
7015 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7016 },
7017 [ALC269_FIXUP_AMIC] = {
7018 .type = HDA_FIXUP_PINS,
7019 .v.pins = (const struct hda_pintbl[]) {
7020 { 0x14, 0x99130110 }, /* speaker */
7021 { 0x15, 0x0121401f }, /* HP out */
7022 { 0x18, 0x01a19c20 }, /* mic */
7023 { 0x19, 0x99a3092f }, /* int-mic */
7024 { }
7025 },
7026 },
7027 [ALC269_FIXUP_DMIC] = {
7028 .type = HDA_FIXUP_PINS,
7029 .v.pins = (const struct hda_pintbl[]) {
7030 { 0x12, 0x99a3092f }, /* int-mic */
7031 { 0x14, 0x99130110 }, /* speaker */
7032 { 0x15, 0x0121401f }, /* HP out */
7033 { 0x18, 0x01a19c20 }, /* mic */
7034 { }
7035 },
7036 },
7037 [ALC269VB_FIXUP_AMIC] = {
7038 .type = HDA_FIXUP_PINS,
7039 .v.pins = (const struct hda_pintbl[]) {
7040 { 0x14, 0x99130110 }, /* speaker */
7041 { 0x18, 0x01a19c20 }, /* mic */
7042 { 0x19, 0x99a3092f }, /* int-mic */
7043 { 0x21, 0x0121401f }, /* HP out */
7044 { }
7045 },
7046 },
7047 [ALC269VB_FIXUP_DMIC] = {
7048 .type = HDA_FIXUP_PINS,
7049 .v.pins = (const struct hda_pintbl[]) {
7050 { 0x12, 0x99a3092f }, /* int-mic */
7051 { 0x14, 0x99130110 }, /* speaker */
7052 { 0x18, 0x01a19c20 }, /* mic */
7053 { 0x21, 0x0121401f }, /* HP out */
7054 { }
7055 },
7056 },
7057 [ALC269_FIXUP_HP_MUTE_LED] = {
7058 .type = HDA_FIXUP_FUNC,
7059 .v.func = alc269_fixup_hp_mute_led,
7060 },
7061 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7062 .type = HDA_FIXUP_FUNC,
7063 .v.func = alc269_fixup_hp_mute_led_mic1,
7064 },
7065 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7066 .type = HDA_FIXUP_FUNC,
7067 .v.func = alc269_fixup_hp_mute_led_mic2,
7068 },
7069 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7070 .type = HDA_FIXUP_FUNC,
7071 .v.func = alc269_fixup_hp_mute_led_mic3,
7072 .chained = true,
7073 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7074 },
7075 [ALC269_FIXUP_HP_GPIO_LED] = {
7076 .type = HDA_FIXUP_FUNC,
7077 .v.func = alc269_fixup_hp_gpio_led,
7078 },
7079 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7080 .type = HDA_FIXUP_FUNC,
7081 .v.func = alc269_fixup_hp_gpio_mic1_led,
7082 },
7083 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7084 .type = HDA_FIXUP_FUNC,
7085 .v.func = alc269_fixup_hp_line1_mic1_led,
7086 },
7087 [ALC269_FIXUP_INV_DMIC] = {
7088 .type = HDA_FIXUP_FUNC,
7089 .v.func = alc_fixup_inv_dmic,
7090 },
7091 [ALC269_FIXUP_NO_SHUTUP] = {
7092 .type = HDA_FIXUP_FUNC,
7093 .v.func = alc_fixup_no_shutup,
7094 },
7095 [ALC269_FIXUP_LENOVO_DOCK] = {
7096 .type = HDA_FIXUP_PINS,
7097 .v.pins = (const struct hda_pintbl[]) {
7098 { 0x19, 0x23a11040 }, /* dock mic */
7099 { 0x1b, 0x2121103f }, /* dock headphone */
7100 { }
7101 },
7102 .chained = true,
7103 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7104 },
7105 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7106 .type = HDA_FIXUP_FUNC,
7107 .v.func = alc269_fixup_limit_int_mic_boost,
7108 .chained = true,
7109 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7110 },
7111 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7112 .type = HDA_FIXUP_FUNC,
7113 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7114 .chained = true,
7115 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7116 },
7117 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7118 .type = HDA_FIXUP_PINS,
7119 .v.pins = (const struct hda_pintbl[]) {
7120 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7121 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7122 { }
7123 },
7124 .chained = true,
7125 .chain_id = ALC269_FIXUP_HEADSET_MODE
7126 },
7127 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7128 .type = HDA_FIXUP_PINS,
7129 .v.pins = (const struct hda_pintbl[]) {
7130 { 0x16, 0x21014020 }, /* dock line out */
7131 { 0x19, 0x21a19030 }, /* dock mic */
7132 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7133 { }
7134 },
7135 .chained = true,
7136 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7137 },
7138 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7139 .type = HDA_FIXUP_PINS,
7140 .v.pins = (const struct hda_pintbl[]) {
7141 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7142 { }
7143 },
7144 .chained = true,
7145 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7146 },
7147 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7148 .type = HDA_FIXUP_PINS,
7149 .v.pins = (const struct hda_pintbl[]) {
7150 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7151 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7152 { }
7153 },
7154 .chained = true,
7155 .chain_id = ALC269_FIXUP_HEADSET_MODE
7156 },
7157 [ALC269_FIXUP_HEADSET_MODE] = {
7158 .type = HDA_FIXUP_FUNC,
7159 .v.func = alc_fixup_headset_mode,
7160 .chained = true,
7161 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7162 },
7163 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7164 .type = HDA_FIXUP_FUNC,
7165 .v.func = alc_fixup_headset_mode_no_hp_mic,
7166 },
7167 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7168 .type = HDA_FIXUP_PINS,
7169 .v.pins = (const struct hda_pintbl[]) {
7170 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7171 { }
7172 },
7173 .chained = true,
7174 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7175 },
7176 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7177 .type = HDA_FIXUP_PINS,
7178 .v.pins = (const struct hda_pintbl[]) {
7179 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7180 { }
7181 },
7182 .chained = true,
7183 .chain_id = ALC269_FIXUP_HEADSET_MIC
7184 },
7185 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7186 .type = HDA_FIXUP_PINS,
7187 .v.pins = (const struct hda_pintbl[]) {
7188 {0x12, 0x90a60130},
7189 {0x13, 0x40000000},
7190 {0x14, 0x90170110},
7191 {0x18, 0x411111f0},
7192 {0x19, 0x04a11040},
7193 {0x1a, 0x411111f0},
7194 {0x1b, 0x90170112},
7195 {0x1d, 0x40759a05},
7196 {0x1e, 0x411111f0},
7197 {0x21, 0x04211020},
7198 { }
7199 },
7200 .chained = true,
7201 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7202 },
7203 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7204 .type = HDA_FIXUP_FUNC,
7205 .v.func = alc298_fixup_huawei_mbx_stereo,
7206 .chained = true,
7207 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7208 },
7209 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7210 .type = HDA_FIXUP_FUNC,
7211 .v.func = alc269_fixup_x101_headset_mic,
7212 },
7213 [ALC269_FIXUP_ASUS_X101_VERB] = {
7214 .type = HDA_FIXUP_VERBS,
7215 .v.verbs = (const struct hda_verb[]) {
7216 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7217 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7218 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7219 { }
7220 },
7221 .chained = true,
7222 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7223 },
7224 [ALC269_FIXUP_ASUS_X101] = {
7225 .type = HDA_FIXUP_PINS,
7226 .v.pins = (const struct hda_pintbl[]) {
7227 { 0x18, 0x04a1182c }, /* Headset mic */
7228 { }
7229 },
7230 .chained = true,
7231 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7232 },
7233 [ALC271_FIXUP_AMIC_MIC2] = {
7234 .type = HDA_FIXUP_PINS,
7235 .v.pins = (const struct hda_pintbl[]) {
7236 { 0x14, 0x99130110 }, /* speaker */
7237 { 0x19, 0x01a19c20 }, /* mic */
7238 { 0x1b, 0x99a7012f }, /* int-mic */
7239 { 0x21, 0x0121401f }, /* HP out */
7240 { }
7241 },
7242 },
7243 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7244 .type = HDA_FIXUP_FUNC,
7245 .v.func = alc271_hp_gate_mic_jack,
7246 .chained = true,
7247 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7248 },
7249 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7250 .type = HDA_FIXUP_FUNC,
7251 .v.func = alc269_fixup_limit_int_mic_boost,
7252 .chained = true,
7253 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7254 },
7255 [ALC269_FIXUP_ACER_AC700] = {
7256 .type = HDA_FIXUP_PINS,
7257 .v.pins = (const struct hda_pintbl[]) {
7258 { 0x12, 0x99a3092f }, /* int-mic */
7259 { 0x14, 0x99130110 }, /* speaker */
7260 { 0x18, 0x03a11c20 }, /* mic */
7261 { 0x1e, 0x0346101e }, /* SPDIF1 */
7262 { 0x21, 0x0321101f }, /* HP out */
7263 { }
7264 },
7265 .chained = true,
7266 .chain_id = ALC271_FIXUP_DMIC,
7267 },
7268 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7269 .type = HDA_FIXUP_FUNC,
7270 .v.func = alc269_fixup_limit_int_mic_boost,
7271 .chained = true,
7272 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7273 },
7274 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7275 .type = HDA_FIXUP_FUNC,
7276 .v.func = alc269_fixup_limit_int_mic_boost,
7277 .chained = true,
7278 .chain_id = ALC269VB_FIXUP_DMIC,
7279 },
7280 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7281 .type = HDA_FIXUP_VERBS,
7282 .v.verbs = (const struct hda_verb[]) {
7283 /* class-D output amp +5dB */
7284 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7285 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7286 {}
7287 },
7288 .chained = true,
7289 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7290 },
7291 [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7292 .type = HDA_FIXUP_PINS,
7293 .v.pins = (const struct hda_pintbl[]) {
7294 { 0x18, 0x01a110f0 }, /* use as headset mic */
7295 { }
7296 },
7297 .chained = true,
7298 .chain_id = ALC269_FIXUP_HEADSET_MIC
7299 },
7300 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7301 .type = HDA_FIXUP_FUNC,
7302 .v.func = alc269_fixup_limit_int_mic_boost,
7303 .chained = true,
7304 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7305 },
7306 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7307 .type = HDA_FIXUP_PINS,
7308 .v.pins = (const struct hda_pintbl[]) {
7309 { 0x12, 0x99a3092f }, /* int-mic */
7310 { 0x18, 0x03a11d20 }, /* mic */
7311 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7312 { }
7313 },
7314 },
7315 [ALC283_FIXUP_CHROME_BOOK] = {
7316 .type = HDA_FIXUP_FUNC,
7317 .v.func = alc283_fixup_chromebook,
7318 },
7319 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7320 .type = HDA_FIXUP_FUNC,
7321 .v.func = alc283_fixup_sense_combo_jack,
7322 .chained = true,
7323 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7324 },
7325 [ALC282_FIXUP_ASUS_TX300] = {
7326 .type = HDA_FIXUP_FUNC,
7327 .v.func = alc282_fixup_asus_tx300,
7328 },
7329 [ALC283_FIXUP_INT_MIC] = {
7330 .type = HDA_FIXUP_VERBS,
7331 .v.verbs = (const struct hda_verb[]) {
7332 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7333 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7334 { }
7335 },
7336 .chained = true,
7337 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7338 },
7339 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7340 .type = HDA_FIXUP_PINS,
7341 .v.pins = (const struct hda_pintbl[]) {
7342 { 0x17, 0x90170112 }, /* subwoofer */
7343 { }
7344 },
7345 .chained = true,
7346 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7347 },
7348 [ALC290_FIXUP_SUBWOOFER] = {
7349 .type = HDA_FIXUP_PINS,
7350 .v.pins = (const struct hda_pintbl[]) {
7351 { 0x17, 0x90170112 }, /* subwoofer */
7352 { }
7353 },
7354 .chained = true,
7355 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7356 },
7357 [ALC290_FIXUP_MONO_SPEAKERS] = {
7358 .type = HDA_FIXUP_FUNC,
7359 .v.func = alc290_fixup_mono_speakers,
7360 },
7361 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7362 .type = HDA_FIXUP_FUNC,
7363 .v.func = alc290_fixup_mono_speakers,
7364 .chained = true,
7365 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7366 },
7367 [ALC269_FIXUP_THINKPAD_ACPI] = {
7368 .type = HDA_FIXUP_FUNC,
7369 .v.func = alc_fixup_thinkpad_acpi,
7370 .chained = true,
7371 .chain_id = ALC269_FIXUP_SKU_IGNORE,
7372 },
7373 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7374 .type = HDA_FIXUP_FUNC,
7375 .v.func = alc_fixup_inv_dmic,
7376 .chained = true,
7377 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7378 },
7379 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
7380 .type = HDA_FIXUP_PINS,
7381 .v.pins = (const struct hda_pintbl[]) {
7382 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7383 { }
7384 },
7385 .chained = true,
7386 .chain_id = ALC255_FIXUP_HEADSET_MODE
7387 },
7388 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7389 .type = HDA_FIXUP_PINS,
7390 .v.pins = (const struct hda_pintbl[]) {
7391 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7392 { }
7393 },
7394 .chained = true,
7395 .chain_id = ALC255_FIXUP_HEADSET_MODE
7396 },
7397 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7398 .type = HDA_FIXUP_PINS,
7399 .v.pins = (const struct hda_pintbl[]) {
7400 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7401 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7402 { }
7403 },
7404 .chained = true,
7405 .chain_id = ALC255_FIXUP_HEADSET_MODE
7406 },
7407 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7408 .type = HDA_FIXUP_PINS,
7409 .v.pins = (const struct hda_pintbl[]) {
7410 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7411 { }
7412 },
7413 .chained = true,
7414 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7415 },
7416 [ALC255_FIXUP_HEADSET_MODE] = {
7417 .type = HDA_FIXUP_FUNC,
7418 .v.func = alc_fixup_headset_mode_alc255,
7419 .chained = true,
7420 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7421 },
7422 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7423 .type = HDA_FIXUP_FUNC,
7424 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7425 },
7426 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7427 .type = HDA_FIXUP_PINS,
7428 .v.pins = (const struct hda_pintbl[]) {
7429 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7430 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7431 { }
7432 },
7433 .chained = true,
7434 .chain_id = ALC269_FIXUP_HEADSET_MODE
7435 },
7436 [ALC292_FIXUP_TPT440_DOCK] = {
7437 .type = HDA_FIXUP_FUNC,
7438 .v.func = alc_fixup_tpt440_dock,
7439 .chained = true,
7440 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7441 },
7442 [ALC292_FIXUP_TPT440] = {
7443 .type = HDA_FIXUP_FUNC,
7444 .v.func = alc_fixup_disable_aamix,
7445 .chained = true,
7446 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7447 },
7448 [ALC283_FIXUP_HEADSET_MIC] = {
7449 .type = HDA_FIXUP_PINS,
7450 .v.pins = (const struct hda_pintbl[]) {
7451 { 0x19, 0x04a110f0 },
7452 { },
7453 },
7454 },
7455 [ALC255_FIXUP_MIC_MUTE_LED] = {
7456 .type = HDA_FIXUP_FUNC,
7457 .v.func = alc_fixup_micmute_led,
7458 },
7459 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7460 .type = HDA_FIXUP_PINS,
7461 .v.pins = (const struct hda_pintbl[]) {
7462 { 0x12, 0x90a60130 },
7463 { 0x14, 0x90170110 },
7464 { 0x17, 0x40000008 },
7465 { 0x18, 0x411111f0 },
7466 { 0x19, 0x01a1913c },
7467 { 0x1a, 0x411111f0 },
7468 { 0x1b, 0x411111f0 },
7469 { 0x1d, 0x40f89b2d },
7470 { 0x1e, 0x411111f0 },
7471 { 0x21, 0x0321101f },
7472 { },
7473 },
7474 },
7475 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7476 .type = HDA_FIXUP_FUNC,
7477 .v.func = alc269vb_fixup_aspire_e1_coef,
7478 },
7479 [ALC280_FIXUP_HP_GPIO4] = {
7480 .type = HDA_FIXUP_FUNC,
7481 .v.func = alc280_fixup_hp_gpio4,
7482 },
7483 [ALC286_FIXUP_HP_GPIO_LED] = {
7484 .type = HDA_FIXUP_FUNC,
7485 .v.func = alc286_fixup_hp_gpio_led,
7486 },
7487 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7488 .type = HDA_FIXUP_FUNC,
7489 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7490 },
7491 [ALC280_FIXUP_HP_DOCK_PINS] = {
7492 .type = HDA_FIXUP_PINS,
7493 .v.pins = (const struct hda_pintbl[]) {
7494 { 0x1b, 0x21011020 }, /* line-out */
7495 { 0x1a, 0x01a1903c }, /* headset mic */
7496 { 0x18, 0x2181103f }, /* line-in */
7497 { },
7498 },
7499 .chained = true,
7500 .chain_id = ALC280_FIXUP_HP_GPIO4
7501 },
7502 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7503 .type = HDA_FIXUP_PINS,
7504 .v.pins = (const struct hda_pintbl[]) {
7505 { 0x1b, 0x21011020 }, /* line-out */
7506 { 0x18, 0x2181103f }, /* line-in */
7507 { },
7508 },
7509 .chained = true,
7510 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7511 },
7512 [ALC280_FIXUP_HP_9480M] = {
7513 .type = HDA_FIXUP_FUNC,
7514 .v.func = alc280_fixup_hp_9480m,
7515 },
7516 [ALC245_FIXUP_HP_X360_AMP] = {
7517 .type = HDA_FIXUP_FUNC,
7518 .v.func = alc245_fixup_hp_x360_amp,
7519 .chained = true,
7520 .chain_id = ALC245_FIXUP_HP_GPIO_LED
7521 },
7522 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7523 .type = HDA_FIXUP_FUNC,
7524 .v.func = alc_fixup_headset_mode_dell_alc288,
7525 .chained = true,
7526 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7527 },
7528 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7529 .type = HDA_FIXUP_PINS,
7530 .v.pins = (const struct hda_pintbl[]) {
7531 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7532 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7533 { }
7534 },
7535 .chained = true,
7536 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7537 },
7538 [ALC288_FIXUP_DISABLE_AAMIX] = {
7539 .type = HDA_FIXUP_FUNC,
7540 .v.func = alc_fixup_disable_aamix,
7541 .chained = true,
7542 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
7543 },
7544 [ALC288_FIXUP_DELL_XPS_13] = {
7545 .type = HDA_FIXUP_FUNC,
7546 .v.func = alc_fixup_dell_xps13,
7547 .chained = true,
7548 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7549 },
7550 [ALC292_FIXUP_DISABLE_AAMIX] = {
7551 .type = HDA_FIXUP_FUNC,
7552 .v.func = alc_fixup_disable_aamix,
7553 .chained = true,
7554 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
7555 },
7556 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7557 .type = HDA_FIXUP_FUNC,
7558 .v.func = alc_fixup_disable_aamix,
7559 .chained = true,
7560 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7561 },
7562 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
7563 .type = HDA_FIXUP_FUNC,
7564 .v.func = alc_fixup_dell_xps13,
7565 .chained = true,
7566 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7567 },
7568 [ALC292_FIXUP_DELL_E7X] = {
7569 .type = HDA_FIXUP_FUNC,
7570 .v.func = alc_fixup_micmute_led,
7571 /* micmute fixup must be applied at last */
7572 .chained_before = true,
7573 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7574 },
7575 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7576 .type = HDA_FIXUP_PINS,
7577 .v.pins = (const struct hda_pintbl[]) {
7578 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7579 { }
7580 },
7581 .chained_before = true,
7582 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7583 },
7584 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7585 .type = HDA_FIXUP_PINS,
7586 .v.pins = (const struct hda_pintbl[]) {
7587 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7588 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7589 { }
7590 },
7591 .chained = true,
7592 .chain_id = ALC269_FIXUP_HEADSET_MODE
7593 },
7594 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7595 .type = HDA_FIXUP_PINS,
7596 .v.pins = (const struct hda_pintbl[]) {
7597 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7598 { }
7599 },
7600 .chained = true,
7601 .chain_id = ALC269_FIXUP_HEADSET_MODE
7602 },
7603 [ALC275_FIXUP_DELL_XPS] = {
7604 .type = HDA_FIXUP_VERBS,
7605 .v.verbs = (const struct hda_verb[]) {
7606 /* Enables internal speaker */
7607 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7608 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7609 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7610 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7611 {}
7612 }
7613 },
7614 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7615 .type = HDA_FIXUP_FUNC,
7616 .v.func = alc_fixup_disable_aamix,
7617 .chained = true,
7618 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7619 },
7620 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7621 .type = HDA_FIXUP_FUNC,
7622 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7623 },
7624 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7625 .type = HDA_FIXUP_FUNC,
7626 .v.func = alc_fixup_inv_dmic,
7627 .chained = true,
7628 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7629 },
7630 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7631 .type = HDA_FIXUP_FUNC,
7632 .v.func = alc269_fixup_limit_int_mic_boost
7633 },
7634 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7635 .type = HDA_FIXUP_FUNC,
7636 .v.func = alc_fixup_disable_aamix,
7637 .chained = true,
7638 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7639 },
7640 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7641 .type = HDA_FIXUP_FUNC,
7642 .v.func = alc_fixup_disable_mic_vref,
7643 .chained = true,
7644 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7645 },
7646 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7647 .type = HDA_FIXUP_VERBS,
7648 .v.verbs = (const struct hda_verb[]) {
7649 /* Disable pass-through path for FRONT 14h */
7650 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7651 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7652 {}
7653 },
7654 .chained = true,
7655 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
7656 },
7657 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7658 .type = HDA_FIXUP_FUNC,
7659 .v.func = alc_fixup_disable_aamix,
7660 .chained = true,
7661 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7662 },
7663 [ALC221_FIXUP_HP_FRONT_MIC] = {
7664 .type = HDA_FIXUP_PINS,
7665 .v.pins = (const struct hda_pintbl[]) {
7666 { 0x19, 0x02a19020 }, /* Front Mic */
7667 { }
7668 },
7669 },
7670 [ALC292_FIXUP_TPT460] = {
7671 .type = HDA_FIXUP_FUNC,
7672 .v.func = alc_fixup_tpt440_dock,
7673 .chained = true,
7674 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7675 },
7676 [ALC298_FIXUP_SPK_VOLUME] = {
7677 .type = HDA_FIXUP_FUNC,
7678 .v.func = alc298_fixup_speaker_volume,
7679 .chained = true,
7680 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7681 },
7682 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7683 .type = HDA_FIXUP_FUNC,
7684 .v.func = alc298_fixup_speaker_volume,
7685 },
7686 [ALC295_FIXUP_DISABLE_DAC3] = {
7687 .type = HDA_FIXUP_FUNC,
7688 .v.func = alc295_fixup_disable_dac3,
7689 },
7690 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7691 .type = HDA_FIXUP_FUNC,
7692 .v.func = alc285_fixup_speaker2_to_dac1,
7693 .chained = true,
7694 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7695 },
7696 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7697 .type = HDA_FIXUP_PINS,
7698 .v.pins = (const struct hda_pintbl[]) {
7699 { 0x1b, 0x90170151 },
7700 { }
7701 },
7702 .chained = true,
7703 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7704 },
7705 [ALC269_FIXUP_ATIV_BOOK_8] = {
7706 .type = HDA_FIXUP_FUNC,
7707 .v.func = alc_fixup_auto_mute_via_amp,
7708 .chained = true,
7709 .chain_id = ALC269_FIXUP_NO_SHUTUP
7710 },
7711 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
7712 .type = HDA_FIXUP_PINS,
7713 .v.pins = (const struct hda_pintbl[]) {
7714 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7715 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
7716 { }
7717 },
7718 .chained = true,
7719 .chain_id = ALC269_FIXUP_HEADSET_MODE
7720 },
7721 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7722 .type = HDA_FIXUP_PINS,
7723 .v.pins = (const struct hda_pintbl[]) {
7724 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7725 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7726 { }
7727 },
7728 .chained = true,
7729 .chain_id = ALC269_FIXUP_HEADSET_MODE
7730 },
7731 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7732 .type = HDA_FIXUP_FUNC,
7733 .v.func = alc_fixup_headset_mode,
7734 },
7735 [ALC256_FIXUP_ASUS_MIC] = {
7736 .type = HDA_FIXUP_PINS,
7737 .v.pins = (const struct hda_pintbl[]) {
7738 { 0x13, 0x90a60160 }, /* use as internal mic */
7739 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7740 { }
7741 },
7742 .chained = true,
7743 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7744 },
7745 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
7746 .type = HDA_FIXUP_FUNC,
7747 /* Set up GPIO2 for the speaker amp */
7748 .v.func = alc_fixup_gpio4,
7749 },
7750 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7751 .type = HDA_FIXUP_PINS,
7752 .v.pins = (const struct hda_pintbl[]) {
7753 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7754 { }
7755 },
7756 .chained = true,
7757 .chain_id = ALC269_FIXUP_HEADSET_MIC
7758 },
7759 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7760 .type = HDA_FIXUP_VERBS,
7761 .v.verbs = (const struct hda_verb[]) {
7762 /* Enables internal speaker */
7763 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7764 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7765 {}
7766 },
7767 .chained = true,
7768 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7769 },
7770 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7771 .type = HDA_FIXUP_FUNC,
7772 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7773 .chained = true,
7774 .chain_id = ALC269_FIXUP_GPIO2
7775 },
7776 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7777 .type = HDA_FIXUP_VERBS,
7778 .v.verbs = (const struct hda_verb[]) {
7779 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7780 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7781 { }
7782 },
7783 .chained = true,
7784 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7785 },
7786 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7787 .type = HDA_FIXUP_PINS,
7788 .v.pins = (const struct hda_pintbl[]) {
7789 /* Change the mic location from front to right, otherwise there are
7790 two front mics with the same name, pulseaudio can't handle them.
7791 This is just a temporary workaround, after applying this fixup,
7792 there will be one "Front Mic" and one "Mic" in this machine.
7793 */
7794 { 0x1a, 0x04a19040 },
7795 { }
7796 },
7797 },
7798 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7799 .type = HDA_FIXUP_PINS,
7800 .v.pins = (const struct hda_pintbl[]) {
7801 { 0x16, 0x0101102f }, /* Rear Headset HP */
7802 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7803 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7804 { 0x1b, 0x02011020 },
7805 { }
7806 },
7807 .chained = true,
7808 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7809 },
7810 [ALC225_FIXUP_S3_POP_NOISE] = {
7811 .type = HDA_FIXUP_FUNC,
7812 .v.func = alc225_fixup_s3_pop_noise,
7813 .chained = true,
7814 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7815 },
7816 [ALC700_FIXUP_INTEL_REFERENCE] = {
7817 .type = HDA_FIXUP_VERBS,
7818 .v.verbs = (const struct hda_verb[]) {
7819 /* Enables internal speaker */
7820 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7821 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7822 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7823 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7824 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7825 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7826 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7827 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7828 {}
7829 }
7830 },
7831 [ALC274_FIXUP_DELL_BIND_DACS] = {
7832 .type = HDA_FIXUP_FUNC,
7833 .v.func = alc274_fixup_bind_dacs,
7834 .chained = true,
7835 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7836 },
7837 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7838 .type = HDA_FIXUP_PINS,
7839 .v.pins = (const struct hda_pintbl[]) {
7840 { 0x1b, 0x0401102f },
7841 { }
7842 },
7843 .chained = true,
7844 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7845 },
7846 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
7847 .type = HDA_FIXUP_FUNC,
7848 .v.func = alc_fixup_tpt470_dock,
7849 .chained = true,
7850 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7851 },
7852 [ALC298_FIXUP_TPT470_DOCK] = {
7853 .type = HDA_FIXUP_FUNC,
7854 .v.func = alc_fixup_tpt470_dacs,
7855 .chained = true,
7856 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7857 },
7858 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7859 .type = HDA_FIXUP_PINS,
7860 .v.pins = (const struct hda_pintbl[]) {
7861 { 0x14, 0x0201101f },
7862 { }
7863 },
7864 .chained = true,
7865 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7866 },
7867 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7868 .type = HDA_FIXUP_PINS,
7869 .v.pins = (const struct hda_pintbl[]) {
7870 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7871 { }
7872 },
7873 .chained = true,
7874 .chain_id = ALC269_FIXUP_HEADSET_MIC
7875 },
7876 [ALC295_FIXUP_HP_X360] = {
7877 .type = HDA_FIXUP_FUNC,
7878 .v.func = alc295_fixup_hp_top_speakers,
7879 .chained = true,
7880 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
7881 },
7882 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7883 .type = HDA_FIXUP_PINS,
7884 .v.pins = (const struct hda_pintbl[]) {
7885 { 0x19, 0x0181313f},
7886 { }
7887 },
7888 .chained = true,
7889 .chain_id = ALC269_FIXUP_HEADSET_MIC
7890 },
7891 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7892 .type = HDA_FIXUP_FUNC,
7893 .v.func = alc285_fixup_invalidate_dacs,
7894 .chained = true,
7895 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7896 },
7897 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7898 .type = HDA_FIXUP_FUNC,
7899 .v.func = alc_fixup_auto_mute_via_amp,
7900 },
7901 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7902 .type = HDA_FIXUP_PINS,
7903 .v.pins = (const struct hda_pintbl[]) {
7904 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7905 { }
7906 },
7907 .chained = true,
7908 .chain_id = ALC269_FIXUP_HEADSET_MIC
7909 },
7910 [ALC294_FIXUP_ASUS_MIC] = {
7911 .type = HDA_FIXUP_PINS,
7912 .v.pins = (const struct hda_pintbl[]) {
7913 { 0x13, 0x90a60160 }, /* use as internal mic */
7914 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7915 { }
7916 },
7917 .chained = true,
7918 .chain_id = ALC269_FIXUP_HEADSET_MIC
7919 },
7920 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7921 .type = HDA_FIXUP_PINS,
7922 .v.pins = (const struct hda_pintbl[]) {
7923 { 0x19, 0x01a1103c }, /* use as headset mic */
7924 { }
7925 },
7926 .chained = true,
7927 .chain_id = ALC269_FIXUP_HEADSET_MIC
7928 },
7929 [ALC294_FIXUP_ASUS_SPK] = {
7930 .type = HDA_FIXUP_VERBS,
7931 .v.verbs = (const struct hda_verb[]) {
7932 /* Set EAPD high */
7933 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7934 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
7935 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7936 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7937 { }
7938 },
7939 .chained = true,
7940 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7941 },
7942 [ALC295_FIXUP_CHROME_BOOK] = {
7943 .type = HDA_FIXUP_FUNC,
7944 .v.func = alc295_fixup_chromebook,
7945 .chained = true,
7946 .chain_id = ALC225_FIXUP_HEADSET_JACK
7947 },
7948 [ALC225_FIXUP_HEADSET_JACK] = {
7949 .type = HDA_FIXUP_FUNC,
7950 .v.func = alc_fixup_headset_jack,
7951 },
7952 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7953 .type = HDA_FIXUP_PINS,
7954 .v.pins = (const struct hda_pintbl[]) {
7955 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7956 { }
7957 },
7958 .chained = true,
7959 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7960 },
7961 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7962 .type = HDA_FIXUP_VERBS,
7963 .v.verbs = (const struct hda_verb[]) {
7964 /* Disable PCBEEP-IN passthrough */
7965 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7966 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7967 { }
7968 },
7969 .chained = true,
7970 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7971 },
7972 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7973 .type = HDA_FIXUP_PINS,
7974 .v.pins = (const struct hda_pintbl[]) {
7975 { 0x19, 0x03a11130 },
7976 { 0x1a, 0x90a60140 }, /* use as internal mic */
7977 { }
7978 },
7979 .chained = true,
7980 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7981 },
7982 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7983 .type = HDA_FIXUP_PINS,
7984 .v.pins = (const struct hda_pintbl[]) {
7985 { 0x16, 0x01011020 }, /* Rear Line out */
7986 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7987 { }
7988 },
7989 .chained = true,
7990 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7991 },
7992 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7993 .type = HDA_FIXUP_FUNC,
7994 .v.func = alc_fixup_auto_mute_via_amp,
7995 .chained = true,
7996 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7997 },
7998 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7999 .type = HDA_FIXUP_FUNC,
8000 .v.func = alc_fixup_disable_mic_vref,
8001 .chained = true,
8002 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8003 },
8004 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8005 .type = HDA_FIXUP_VERBS,
8006 .v.verbs = (const struct hda_verb[]) {
8007 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8008 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8009 { }
8010 },
8011 .chained = true,
8012 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8013 },
8014 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8015 .type = HDA_FIXUP_PINS,
8016 .v.pins = (const struct hda_pintbl[]) {
8017 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8018 { }
8019 },
8020 .chained = true,
8021 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8022 },
8023 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8024 .type = HDA_FIXUP_PINS,
8025 .v.pins = (const struct hda_pintbl[]) {
8026 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8027 { }
8028 },
8029 .chained = true,
8030 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8031 },
8032 [ALC299_FIXUP_PREDATOR_SPK] = {
8033 .type = HDA_FIXUP_PINS,
8034 .v.pins = (const struct hda_pintbl[]) {
8035 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8036 { }
8037 }
8038 },
8039 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8040 .type = HDA_FIXUP_PINS,
8041 .v.pins = (const struct hda_pintbl[]) {
8042 { 0x19, 0x04a11040 },
8043 { 0x21, 0x04211020 },
8044 { }
8045 },
8046 .chained = true,
8047 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8048 },
8049 [ALC289_FIXUP_DELL_SPK2] = {
8050 .type = HDA_FIXUP_PINS,
8051 .v.pins = (const struct hda_pintbl[]) {
8052 { 0x17, 0x90170130 }, /* bass spk */
8053 { }
8054 },
8055 .chained = true,
8056 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8057 },
8058 [ALC289_FIXUP_DUAL_SPK] = {
8059 .type = HDA_FIXUP_FUNC,
8060 .v.func = alc285_fixup_speaker2_to_dac1,
8061 .chained = true,
8062 .chain_id = ALC289_FIXUP_DELL_SPK2
8063 },
8064 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8065 .type = HDA_FIXUP_FUNC,
8066 .v.func = alc285_fixup_speaker2_to_dac1,
8067 .chained = true,
8068 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8069 },
8070 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
8071 .type = HDA_FIXUP_FUNC,
8072 /* The GPIO must be pulled to initialize the AMP */
8073 .v.func = alc_fixup_gpio4,
8074 .chained = true,
8075 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8076 },
8077 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8078 .type = HDA_FIXUP_FUNC,
8079 .v.func = alc285_fixup_thinkpad_x1_gen7,
8080 .chained = true,
8081 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8082 },
8083 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8084 .type = HDA_FIXUP_FUNC,
8085 .v.func = alc_fixup_headset_jack,
8086 .chained = true,
8087 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8088 },
8089 [ALC294_FIXUP_ASUS_HPE] = {
8090 .type = HDA_FIXUP_VERBS,
8091 .v.verbs = (const struct hda_verb[]) {
8092 /* Set EAPD high */
8093 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8094 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8095 { }
8096 },
8097 .chained = true,
8098 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8099 },
8100 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8101 .type = HDA_FIXUP_PINS,
8102 .v.pins = (const struct hda_pintbl[]) {
8103 { 0x19, 0x03a11050 }, /* front HP mic */
8104 { 0x1a, 0x01a11830 }, /* rear external mic */
8105 { 0x21, 0x03211020 }, /* front HP out */
8106 { }
8107 },
8108 .chained = true,
8109 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8110 },
8111 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8112 .type = HDA_FIXUP_VERBS,
8113 .v.verbs = (const struct hda_verb[]) {
8114 /* set 0x15 to HP-OUT ctrl */
8115 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8116 /* unmute the 0x15 amp */
8117 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8118 { }
8119 },
8120 .chained = true,
8121 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8122 },
8123 [ALC294_FIXUP_ASUS_GX502_HP] = {
8124 .type = HDA_FIXUP_FUNC,
8125 .v.func = alc294_fixup_gx502_hp,
8126 },
8127 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8128 .type = HDA_FIXUP_PINS,
8129 .v.pins = (const struct hda_pintbl[]) {
8130 { 0x19, 0x01a11050 }, /* rear HP mic */
8131 { 0x1a, 0x01a11830 }, /* rear external mic */
8132 { 0x21, 0x012110f0 }, /* rear HP out */
8133 { }
8134 },
8135 .chained = true,
8136 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8137 },
8138 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8139 .type = HDA_FIXUP_VERBS,
8140 .v.verbs = (const struct hda_verb[]) {
8141 /* set 0x15 to HP-OUT ctrl */
8142 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8143 /* unmute the 0x15 amp */
8144 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8145 /* set 0x1b to HP-OUT */
8146 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8147 { }
8148 },
8149 .chained = true,
8150 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8151 },
8152 [ALC294_FIXUP_ASUS_GU502_HP] = {
8153 .type = HDA_FIXUP_FUNC,
8154 .v.func = alc294_fixup_gu502_hp,
8155 },
8156 [ALC294_FIXUP_ASUS_G513_PINS] = {
8157 .type = HDA_FIXUP_PINS,
8158 .v.pins = (const struct hda_pintbl[]) {
8159 { 0x19, 0x03a11050 }, /* front HP mic */
8160 { 0x1a, 0x03a11c30 }, /* rear external mic */
8161 { 0x21, 0x03211420 }, /* front HP out */
8162 { }
8163 },
8164 },
8165 [ALC285_FIXUP_ASUS_G533Z_PINS] = {
8166 .type = HDA_FIXUP_PINS,
8167 .v.pins = (const struct hda_pintbl[]) {
8168 { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8169 { 0x19, 0x03a19020 }, /* Mic Boost Volume */
8170 { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8171 { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8172 { 0x21, 0x03211420 },
8173 { }
8174 },
8175 },
8176 [ALC294_FIXUP_ASUS_COEF_1B] = {
8177 .type = HDA_FIXUP_VERBS,
8178 .v.verbs = (const struct hda_verb[]) {
8179 /* Set bit 10 to correct noisy output after reboot from
8180 * Windows 10 (due to pop noise reduction?)
8181 */
8182 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8183 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8184 { }
8185 },
8186 .chained = true,
8187 .chain_id = ALC289_FIXUP_ASUS_GA401,
8188 },
8189 [ALC285_FIXUP_HP_GPIO_LED] = {
8190 .type = HDA_FIXUP_FUNC,
8191 .v.func = alc285_fixup_hp_gpio_led,
8192 },
8193 [ALC285_FIXUP_HP_MUTE_LED] = {
8194 .type = HDA_FIXUP_FUNC,
8195 .v.func = alc285_fixup_hp_mute_led,
8196 },
8197 [ALC236_FIXUP_HP_GPIO_LED] = {
8198 .type = HDA_FIXUP_FUNC,
8199 .v.func = alc236_fixup_hp_gpio_led,
8200 },
8201 [ALC236_FIXUP_HP_MUTE_LED] = {
8202 .type = HDA_FIXUP_FUNC,
8203 .v.func = alc236_fixup_hp_mute_led,
8204 },
8205 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8206 .type = HDA_FIXUP_FUNC,
8207 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8208 },
8209 [ALC298_FIXUP_SAMSUNG_AMP] = {
8210 .type = HDA_FIXUP_FUNC,
8211 .v.func = alc298_fixup_samsung_amp,
8212 .chained = true,
8213 .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8214 },
8215 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8216 .type = HDA_FIXUP_VERBS,
8217 .v.verbs = (const struct hda_verb[]) {
8218 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8219 { }
8220 },
8221 },
8222 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8223 .type = HDA_FIXUP_VERBS,
8224 .v.verbs = (const struct hda_verb[]) {
8225 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8226 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8227 { }
8228 },
8229 },
8230 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8231 .type = HDA_FIXUP_PINS,
8232 .v.pins = (const struct hda_pintbl[]) {
8233 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8234 { }
8235 },
8236 .chained = true,
8237 .chain_id = ALC269_FIXUP_HEADSET_MODE
8238 },
8239 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8240 .type = HDA_FIXUP_PINS,
8241 .v.pins = (const struct hda_pintbl[]) {
8242 { 0x14, 0x90100120 }, /* use as internal speaker */
8243 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8244 { 0x1a, 0x01011020 }, /* use as line out */
8245 { },
8246 },
8247 .chained = true,
8248 .chain_id = ALC269_FIXUP_HEADSET_MIC
8249 },
8250 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8251 .type = HDA_FIXUP_PINS,
8252 .v.pins = (const struct hda_pintbl[]) {
8253 { 0x18, 0x02a11030 }, /* use as headset mic */
8254 { }
8255 },
8256 .chained = true,
8257 .chain_id = ALC269_FIXUP_HEADSET_MIC
8258 },
8259 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8260 .type = HDA_FIXUP_PINS,
8261 .v.pins = (const struct hda_pintbl[]) {
8262 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8263 { }
8264 },
8265 .chained = true,
8266 .chain_id = ALC269_FIXUP_HEADSET_MIC
8267 },
8268 [ALC289_FIXUP_ASUS_GA401] = {
8269 .type = HDA_FIXUP_FUNC,
8270 .v.func = alc289_fixup_asus_ga401,
8271 .chained = true,
8272 .chain_id = ALC289_FIXUP_ASUS_GA502,
8273 },
8274 [ALC289_FIXUP_ASUS_GA502] = {
8275 .type = HDA_FIXUP_PINS,
8276 .v.pins = (const struct hda_pintbl[]) {
8277 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8278 { }
8279 },
8280 },
8281 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8282 .type = HDA_FIXUP_PINS,
8283 .v.pins = (const struct hda_pintbl[]) {
8284 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8285 { }
8286 },
8287 .chained = true,
8288 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8289 },
8290 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8291 .type = HDA_FIXUP_FUNC,
8292 .v.func = alc285_fixup_hp_gpio_amp_init,
8293 .chained = true,
8294 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8295 },
8296 [ALC269_FIXUP_CZC_B20] = {
8297 .type = HDA_FIXUP_PINS,
8298 .v.pins = (const struct hda_pintbl[]) {
8299 { 0x12, 0x411111f0 },
8300 { 0x14, 0x90170110 }, /* speaker */
8301 { 0x15, 0x032f1020 }, /* HP out */
8302 { 0x17, 0x411111f0 },
8303 { 0x18, 0x03ab1040 }, /* mic */
8304 { 0x19, 0xb7a7013f },
8305 { 0x1a, 0x0181305f },
8306 { 0x1b, 0x411111f0 },
8307 { 0x1d, 0x411111f0 },
8308 { 0x1e, 0x411111f0 },
8309 { }
8310 },
8311 .chain_id = ALC269_FIXUP_DMIC,
8312 },
8313 [ALC269_FIXUP_CZC_TMI] = {
8314 .type = HDA_FIXUP_PINS,
8315 .v.pins = (const struct hda_pintbl[]) {
8316 { 0x12, 0x4000c000 },
8317 { 0x14, 0x90170110 }, /* speaker */
8318 { 0x15, 0x0421401f }, /* HP out */
8319 { 0x17, 0x411111f0 },
8320 { 0x18, 0x04a19020 }, /* mic */
8321 { 0x19, 0x411111f0 },
8322 { 0x1a, 0x411111f0 },
8323 { 0x1b, 0x411111f0 },
8324 { 0x1d, 0x40448505 },
8325 { 0x1e, 0x411111f0 },
8326 { 0x20, 0x8000ffff },
8327 { }
8328 },
8329 .chain_id = ALC269_FIXUP_DMIC,
8330 },
8331 [ALC269_FIXUP_CZC_L101] = {
8332 .type = HDA_FIXUP_PINS,
8333 .v.pins = (const struct hda_pintbl[]) {
8334 { 0x12, 0x40000000 },
8335 { 0x14, 0x01014010 }, /* speaker */
8336 { 0x15, 0x411111f0 }, /* HP out */
8337 { 0x16, 0x411111f0 },
8338 { 0x18, 0x01a19020 }, /* mic */
8339 { 0x19, 0x02a19021 },
8340 { 0x1a, 0x0181302f },
8341 { 0x1b, 0x0221401f },
8342 { 0x1c, 0x411111f0 },
8343 { 0x1d, 0x4044c601 },
8344 { 0x1e, 0x411111f0 },
8345 { }
8346 },
8347 .chain_id = ALC269_FIXUP_DMIC,
8348 },
8349 [ALC269_FIXUP_LEMOTE_A1802] = {
8350 .type = HDA_FIXUP_PINS,
8351 .v.pins = (const struct hda_pintbl[]) {
8352 { 0x12, 0x40000000 },
8353 { 0x14, 0x90170110 }, /* speaker */
8354 { 0x17, 0x411111f0 },
8355 { 0x18, 0x03a19040 }, /* mic1 */
8356 { 0x19, 0x90a70130 }, /* mic2 */
8357 { 0x1a, 0x411111f0 },
8358 { 0x1b, 0x411111f0 },
8359 { 0x1d, 0x40489d2d },
8360 { 0x1e, 0x411111f0 },
8361 { 0x20, 0x0003ffff },
8362 { 0x21, 0x03214020 },
8363 { }
8364 },
8365 .chain_id = ALC269_FIXUP_DMIC,
8366 },
8367 [ALC269_FIXUP_LEMOTE_A190X] = {
8368 .type = HDA_FIXUP_PINS,
8369 .v.pins = (const struct hda_pintbl[]) {
8370 { 0x14, 0x99130110 }, /* speaker */
8371 { 0x15, 0x0121401f }, /* HP out */
8372 { 0x18, 0x01a19c20 }, /* rear mic */
8373 { 0x19, 0x99a3092f }, /* front mic */
8374 { 0x1b, 0x0201401f }, /* front lineout */
8375 { }
8376 },
8377 .chain_id = ALC269_FIXUP_DMIC,
8378 },
8379 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8380 .type = HDA_FIXUP_PINS,
8381 .v.pins = (const struct hda_pintbl[]) {
8382 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8383 { }
8384 },
8385 .chained = true,
8386 .chain_id = ALC269_FIXUP_HEADSET_MODE
8387 },
8388 [ALC256_FIXUP_INTEL_NUC10] = {
8389 .type = HDA_FIXUP_PINS,
8390 .v.pins = (const struct hda_pintbl[]) {
8391 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8392 { }
8393 },
8394 .chained = true,
8395 .chain_id = ALC269_FIXUP_HEADSET_MODE
8396 },
8397 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8398 .type = HDA_FIXUP_VERBS,
8399 .v.verbs = (const struct hda_verb[]) {
8400 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8401 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8402 { }
8403 },
8404 .chained = true,
8405 .chain_id = ALC289_FIXUP_ASUS_GA502
8406 },
8407 [ALC274_FIXUP_HP_MIC] = {
8408 .type = HDA_FIXUP_VERBS,
8409 .v.verbs = (const struct hda_verb[]) {
8410 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8411 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8412 { }
8413 },
8414 },
8415 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8416 .type = HDA_FIXUP_FUNC,
8417 .v.func = alc274_fixup_hp_headset_mic,
8418 .chained = true,
8419 .chain_id = ALC274_FIXUP_HP_MIC
8420 },
8421 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8422 .type = HDA_FIXUP_FUNC,
8423 .v.func = alc274_fixup_hp_envy_gpio,
8424 },
8425 [ALC256_FIXUP_ASUS_HPE] = {
8426 .type = HDA_FIXUP_VERBS,
8427 .v.verbs = (const struct hda_verb[]) {
8428 /* Set EAPD high */
8429 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8430 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8431 { }
8432 },
8433 .chained = true,
8434 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8435 },
8436 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8437 .type = HDA_FIXUP_FUNC,
8438 .v.func = alc_fixup_headset_jack,
8439 .chained = true,
8440 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8441 },
8442 [ALC287_FIXUP_HP_GPIO_LED] = {
8443 .type = HDA_FIXUP_FUNC,
8444 .v.func = alc287_fixup_hp_gpio_led,
8445 },
8446 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8447 .type = HDA_FIXUP_FUNC,
8448 .v.func = alc274_fixup_hp_headset_mic,
8449 },
8450 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8451 .type = HDA_FIXUP_FUNC,
8452 .v.func = alc_fixup_no_int_mic,
8453 .chained = true,
8454 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8455 },
8456 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8457 .type = HDA_FIXUP_PINS,
8458 .v.pins = (const struct hda_pintbl[]) {
8459 { 0x1b, 0x411111f0 },
8460 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8461 { },
8462 },
8463 .chained = true,
8464 .chain_id = ALC269_FIXUP_HEADSET_MODE
8465 },
8466 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8467 .type = HDA_FIXUP_FUNC,
8468 .v.func = alc269_fixup_limit_int_mic_boost,
8469 .chained = true,
8470 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8471 },
8472 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8473 .type = HDA_FIXUP_PINS,
8474 .v.pins = (const struct hda_pintbl[]) {
8475 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8476 { 0x1a, 0x90a1092f }, /* use as internal mic */
8477 { }
8478 },
8479 .chained = true,
8480 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8481 },
8482 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8483 .type = HDA_FIXUP_FUNC,
8484 .v.func = alc285_fixup_ideapad_s740_coef,
8485 .chained = true,
8486 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8487 },
8488 [ALC295_FIXUP_ASUS_DACS] = {
8489 .type = HDA_FIXUP_FUNC,
8490 .v.func = alc295_fixup_asus_dacs,
8491 },
8492 [ALC295_FIXUP_HP_OMEN] = {
8493 .type = HDA_FIXUP_PINS,
8494 .v.pins = (const struct hda_pintbl[]) {
8495 { 0x12, 0xb7a60130 },
8496 { 0x13, 0x40000000 },
8497 { 0x14, 0x411111f0 },
8498 { 0x16, 0x411111f0 },
8499 { 0x17, 0x90170110 },
8500 { 0x18, 0x411111f0 },
8501 { 0x19, 0x02a11030 },
8502 { 0x1a, 0x411111f0 },
8503 { 0x1b, 0x04a19030 },
8504 { 0x1d, 0x40600001 },
8505 { 0x1e, 0x411111f0 },
8506 { 0x21, 0x03211020 },
8507 {}
8508 },
8509 .chained = true,
8510 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8511 },
8512 [ALC285_FIXUP_HP_SPECTRE_X360] = {
8513 .type = HDA_FIXUP_FUNC,
8514 .v.func = alc285_fixup_hp_spectre_x360,
8515 },
8516 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8517 .type = HDA_FIXUP_FUNC,
8518 .v.func = alc285_fixup_hp_spectre_x360_eb1
8519 },
8520 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8521 .type = HDA_FIXUP_FUNC,
8522 .v.func = alc285_fixup_ideapad_s740_coef,
8523 .chained = true,
8524 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8525 },
8526 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8527 .type = HDA_FIXUP_FUNC,
8528 .v.func = alc_fixup_no_shutup,
8529 .chained = true,
8530 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8531 },
8532 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8533 .type = HDA_FIXUP_PINS,
8534 .v.pins = (const struct hda_pintbl[]) {
8535 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8536 { }
8537 },
8538 .chained = true,
8539 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8540 },
8541 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8542 .type = HDA_FIXUP_FUNC,
8543 .v.func = alc269_fixup_limit_int_mic_boost,
8544 .chained = true,
8545 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8546 },
8547 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8548 .type = HDA_FIXUP_FUNC,
8549 .v.func = alc285_fixup_ideapad_s740_coef,
8550 .chained = true,
8551 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8552 },
8553 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8554 .type = HDA_FIXUP_FUNC,
8555 .v.func = alc287_fixup_legion_15imhg05_speakers,
8556 .chained = true,
8557 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8558 },
8559 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8560 .type = HDA_FIXUP_VERBS,
8561 //.v.verbs = legion_15imhg05_coefs,
8562 .v.verbs = (const struct hda_verb[]) {
8563 // set left speaker Legion 7i.
8564 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8565 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8566
8567 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8568 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8569 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8570 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8571 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8572
8573 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8574 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8575 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8576 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8577 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8578
8579 // set right speaker Legion 7i.
8580 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8581 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8582
8583 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8584 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8585 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8586 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8587 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8588
8589 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8590 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8591 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8592 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8593 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8594 {}
8595 },
8596 .chained = true,
8597 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8598 },
8599 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8600 .type = HDA_FIXUP_FUNC,
8601 .v.func = alc287_fixup_legion_15imhg05_speakers,
8602 .chained = true,
8603 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8604 },
8605 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8606 .type = HDA_FIXUP_VERBS,
8607 .v.verbs = (const struct hda_verb[]) {
8608 // set left speaker Yoga 7i.
8609 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8610 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8611
8612 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8613 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8614 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8615 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8616 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8617
8618 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8619 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8620 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8621 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8622 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8623
8624 // set right speaker Yoga 7i.
8625 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8626 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8627
8628 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8629 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8630 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8631 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8632 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8633
8634 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8635 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8636 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8637 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8638 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8639 {}
8640 },
8641 .chained = true,
8642 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8643 },
8644 [ALC298_FIXUP_LENOVO_C940_DUET7] = {
8645 .type = HDA_FIXUP_FUNC,
8646 .v.func = alc298_fixup_lenovo_c940_duet7,
8647 },
8648 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8649 .type = HDA_FIXUP_VERBS,
8650 .v.verbs = (const struct hda_verb[]) {
8651 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8652 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8653 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8654 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8655 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8656 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8657 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8658 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8659 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8660 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8661 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8662 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8663 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8664 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8665 {}
8666 },
8667 .chained = true,
8668 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8669 },
8670 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
8671 .type = HDA_FIXUP_FUNC,
8672 .v.func = alc256_fixup_set_coef_defaults,
8673 },
8674 [ALC245_FIXUP_HP_GPIO_LED] = {
8675 .type = HDA_FIXUP_FUNC,
8676 .v.func = alc245_fixup_hp_gpio_led,
8677 },
8678 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8679 .type = HDA_FIXUP_PINS,
8680 .v.pins = (const struct hda_pintbl[]) {
8681 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8682 { }
8683 },
8684 .chained = true,
8685 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8686 },
8687 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8688 .type = HDA_FIXUP_FUNC,
8689 .v.func = alc233_fixup_no_audio_jack,
8690 },
8691 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8692 .type = HDA_FIXUP_FUNC,
8693 .v.func = alc256_fixup_mic_no_presence_and_resume,
8694 .chained = true,
8695 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8696 },
8697 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
8698 .type = HDA_FIXUP_VERBS,
8699 .v.verbs = (const struct hda_verb[]) {
8700 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
8701 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
8702 { }
8703 },
8704 .chained = true,
8705 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8706 },
8707 };
8708
8709 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
8710 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
8711 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8712 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
8713 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
8714 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8715 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8716 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
8717 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8718 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8719 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
8720 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8721 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
8722 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
8723 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
8724 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
8725 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
8726 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
8727 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8728 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8729 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8730 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
8731 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8732 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
8733 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
8734 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
8735 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8736 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8737 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8738 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
8739 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8740 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8741 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8742 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
8743 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
8744 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8745 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8746 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8747 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
8748 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
8749 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
8750 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
8751 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
8752 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8753 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8754 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
8755 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
8756 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8757 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8758 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8759 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8760 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8761 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
8762 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
8763 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
8764 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8765 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8766 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
8767 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8768 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8769 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8770 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8771 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8772 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8773 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8774 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8775 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8776 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8777 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8778 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
8779 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
8780 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
8781 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
8782 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8783 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
8784 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
8785 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8786 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8787 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8788 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8789 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
8790 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
8791 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
8792 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8793 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8794 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8795 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8796 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8797 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8798 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8799 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
8800 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
8801 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
8802 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8803 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8804 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
8805 SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
8806 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8807 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8808 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
8809 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8810 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
8811 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8812 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8813 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8814 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8815 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8816 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8817 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8818 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8819 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8820 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8821 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8822 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8823 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8824 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8825 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8826 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8827 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8828 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8829 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
8830 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
8831 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8832 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8833 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8834 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8835 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8836 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8837 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8838 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8839 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
8840 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8841 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8842 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8843 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8844 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8845 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8846 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8847 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8848 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8849 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8850 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8851 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8852 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8853 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8854 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8855 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8856 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8857 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8858 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8859 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8860 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8861 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8862 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8863 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8864 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8865 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
8866 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8867 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8868 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8869 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8870 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8871 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
8872 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
8873 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8874 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8875 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8876 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8877 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8878 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8879 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
8880 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8881 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
8882 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8883 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8884 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8885 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
8886 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8887 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8888 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8889 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8890 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
8891 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
8892 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
8893 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
8894 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
8895 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8896 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
8897 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
8898 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8899 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8900 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8901 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8902 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8903 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
8904 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
8905 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
8906 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
8907 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8908 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8909 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8910 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8911 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8912 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
8913 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8914 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8915 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8916 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8917 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8918 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8919 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8920 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8921 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8922 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8923 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8924 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8925 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8926 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8927 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8928 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
8929 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
8930 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
8931 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
8932 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8933 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
8934 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8935 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
8936 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8937 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8938 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8939 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8940 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8941 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
8942 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8943 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8944 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
8945 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
8946 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
8947 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
8948 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
8949 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
8950 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
8951 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
8952 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8953 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
8954 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
8955 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8956 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
8957 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
8958 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
8959 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
8960 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8961 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
8962 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
8963 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
8964 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
8965 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
8966 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
8967 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8968 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8969 SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
8970 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
8971 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
8972 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
8973 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
8974 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
8975 SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
8976 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
8977 SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
8978 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
8979 SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
8980 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
8981 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8982 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8983 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8984 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8985 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
8986 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8987 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8988 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8989 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
8990 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8991 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8992 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
8993 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
8994 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
8995 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
8996 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
8997 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
8998 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
8999 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
9000 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9001 SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9002 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9003 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9004 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
9005 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
9006 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9007 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
9008 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
9009 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9010 SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
9011 SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
9012 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
9013 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
9014 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
9015 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
9016 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9017 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
9018 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
9019 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
9020 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9021 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9022 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9023 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9024 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9025 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9026 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9027 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9028 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9029 SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9030 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9031 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9032 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9033 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9034 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9035 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9036 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9037 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9038 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9039 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9040 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9041 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9042 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9043 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9044 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9045 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9046 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9047 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9048 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9049 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9050 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9051 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9052 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9053 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9054 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9055 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9056 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9057 SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9058 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9059 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9060 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9061 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9062 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9063 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9064 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9065 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9066 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
9067 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
9068 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
9069 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9070 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9071 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9072 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9073 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9074 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
9075 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9076 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9077 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9078 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9079 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9080 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9081 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9082 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9083 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9084 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9085 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9086 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9087 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9088 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9089 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9090 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
9091 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9092 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9093 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9094 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9095 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9096 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
9097 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
9098 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
9099 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
9100 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
9101 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
9102 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9103 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
9104 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
9105 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
9106 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
9107 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
9108 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
9109 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9110 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
9111 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
9112 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
9113 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9114 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9115 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
9116 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
9117 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9118 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9119 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9120 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
9121 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9122 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9123 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9124 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9125 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
9126 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
9127 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9128 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9129 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
9130 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
9131 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9132 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9133 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9134 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9135 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9136 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9137 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9138 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9139 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9140 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9141 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9142 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
9143 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
9144 SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9145 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9146 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
9147 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9148 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9149 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
9150 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9151 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9152 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9153 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9154 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
9155 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9156 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
9157 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9158 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
9159 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
9160 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9161 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
9162 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
9163 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
9164 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
9165 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
9166 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9167 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
9168 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
9169 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9170 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9171 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9172 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9173 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9174 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9175 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9176 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
9177 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
9178 SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
9179 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
9180 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9181 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9182 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9183 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
9184 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
9185 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9186 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
9187 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
9188 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
9189 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
9190 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9191 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9192 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9193 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9194 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9195 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
9196 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9197 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
9198 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
9199 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
9200 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9201 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
9202 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
9203 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
9204
9205 #if 0
9206 /* Below is a quirk table taken from the old code.
9207 * Basically the device should work as is without the fixup table.
9208 * If BIOS doesn't give a proper info, enable the corresponding
9209 * fixup entry.
9210 */
9211 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9212 ALC269_FIXUP_AMIC),
9213 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
9214 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9215 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9216 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9217 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9218 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9219 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9220 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9221 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9222 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9223 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9224 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9225 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9226 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9227 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9228 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9229 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9230 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9231 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9232 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9233 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9234 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9235 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9236 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9237 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9238 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9239 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9240 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9241 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9242 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9243 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9244 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9245 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9246 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9247 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9248 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9249 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9250 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9251 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9252 #endif
9253 {}
9254 };
9255
9256 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9257 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9258 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9259 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9260 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
9261 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
9262 {}
9263 };
9264
9265 static const struct hda_model_fixup alc269_fixup_models[] = {
9266 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9267 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
9268 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9269 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9270 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
9271 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
9272 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9273 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
9274 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9275 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9276 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9277 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
9278 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9279 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
9280 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9281 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
9282 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
9283 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
9284 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9285 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
9286 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
9287 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
9288 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
9289 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
9290 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
9291 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9292 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9293 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9294 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9295 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9296 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9297 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9298 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9299 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9300 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9301 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9302 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9303 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9304 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9305 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9306 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9307 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9308 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9309 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9310 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9311 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9312 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9313 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9314 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9315 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9316 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9317 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9318 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9319 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9320 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9321 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9322 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9323 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9324 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9325 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9326 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9327 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9328 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9329 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9330 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
9331 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
9332 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
9333 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
9334 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9335 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9336 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9337 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9338 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9339 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9340 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9341 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9342 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9343 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9344 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9345 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9346 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9347 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
9348 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9349 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9350 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
9351 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
9352 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
9353 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
9354 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9355 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9356 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9357 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9358 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9359 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9360 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9361 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9362 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9363 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9364 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9365 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9366 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9367 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9368 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9369 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9370 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
9371 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9372 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
9373 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
9374 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
9375 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
9376 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
9377 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
9378 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
9379 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
9380 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
9381 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
9382 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
9383 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9384 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
9385 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
9386 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
9387 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
9388 {}
9389 };
9390 #define ALC225_STANDARD_PINS \
9391 {0x21, 0x04211020}
9392
9393 #define ALC256_STANDARD_PINS \
9394 {0x12, 0x90a60140}, \
9395 {0x14, 0x90170110}, \
9396 {0x21, 0x02211020}
9397
9398 #define ALC282_STANDARD_PINS \
9399 {0x14, 0x90170110}
9400
9401 #define ALC290_STANDARD_PINS \
9402 {0x12, 0x99a30130}
9403
9404 #define ALC292_STANDARD_PINS \
9405 {0x14, 0x90170110}, \
9406 {0x15, 0x0221401f}
9407
9408 #define ALC295_STANDARD_PINS \
9409 {0x12, 0xb7a60130}, \
9410 {0x14, 0x90170110}, \
9411 {0x21, 0x04211020}
9412
9413 #define ALC298_STANDARD_PINS \
9414 {0x12, 0x90a60130}, \
9415 {0x21, 0x03211020}
9416
9417 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
9418 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9419 {0x14, 0x01014020},
9420 {0x17, 0x90170110},
9421 {0x18, 0x02a11030},
9422 {0x19, 0x0181303F},
9423 {0x21, 0x0221102f}),
9424 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9425 {0x12, 0x90a601c0},
9426 {0x14, 0x90171120},
9427 {0x21, 0x02211030}),
9428 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9429 {0x14, 0x90170110},
9430 {0x1b, 0x90a70130},
9431 {0x21, 0x03211020}),
9432 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9433 {0x1a, 0x90a70130},
9434 {0x1b, 0x90170110},
9435 {0x21, 0x03211020}),
9436 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9437 ALC225_STANDARD_PINS,
9438 {0x12, 0xb7a60130},
9439 {0x14, 0x901701a0}),
9440 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9441 ALC225_STANDARD_PINS,
9442 {0x12, 0xb7a60130},
9443 {0x14, 0x901701b0}),
9444 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9445 ALC225_STANDARD_PINS,
9446 {0x12, 0xb7a60150},
9447 {0x14, 0x901701a0}),
9448 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9449 ALC225_STANDARD_PINS,
9450 {0x12, 0xb7a60150},
9451 {0x14, 0x901701b0}),
9452 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9453 ALC225_STANDARD_PINS,
9454 {0x12, 0xb7a60130},
9455 {0x1b, 0x90170110}),
9456 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9457 {0x1b, 0x01111010},
9458 {0x1e, 0x01451130},
9459 {0x21, 0x02211020}),
9460 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9461 {0x12, 0x90a60140},
9462 {0x14, 0x90170110},
9463 {0x19, 0x02a11030},
9464 {0x21, 0x02211020}),
9465 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9466 {0x14, 0x90170110},
9467 {0x19, 0x02a11030},
9468 {0x1a, 0x02a11040},
9469 {0x1b, 0x01014020},
9470 {0x21, 0x0221101f}),
9471 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9472 {0x14, 0x90170110},
9473 {0x19, 0x02a11030},
9474 {0x1a, 0x02a11040},
9475 {0x1b, 0x01011020},
9476 {0x21, 0x0221101f}),
9477 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9478 {0x14, 0x90170110},
9479 {0x19, 0x02a11020},
9480 {0x1a, 0x02a11030},
9481 {0x21, 0x0221101f}),
9482 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9483 {0x21, 0x02211010}),
9484 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9485 {0x14, 0x90170110},
9486 {0x19, 0x02a11020},
9487 {0x21, 0x02211030}),
9488 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
9489 {0x14, 0x90170110},
9490 {0x21, 0x02211020}),
9491 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9492 {0x14, 0x90170130},
9493 {0x21, 0x02211040}),
9494 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9495 {0x12, 0x90a60140},
9496 {0x14, 0x90170110},
9497 {0x21, 0x02211020}),
9498 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9499 {0x12, 0x90a60160},
9500 {0x14, 0x90170120},
9501 {0x21, 0x02211030}),
9502 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9503 {0x14, 0x90170110},
9504 {0x1b, 0x02011020},
9505 {0x21, 0x0221101f}),
9506 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9507 {0x14, 0x90170110},
9508 {0x1b, 0x01011020},
9509 {0x21, 0x0221101f}),
9510 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9511 {0x14, 0x90170130},
9512 {0x1b, 0x01014020},
9513 {0x21, 0x0221103f}),
9514 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9515 {0x14, 0x90170130},
9516 {0x1b, 0x01011020},
9517 {0x21, 0x0221103f}),
9518 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9519 {0x14, 0x90170130},
9520 {0x1b, 0x02011020},
9521 {0x21, 0x0221103f}),
9522 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9523 {0x14, 0x90170150},
9524 {0x1b, 0x02011020},
9525 {0x21, 0x0221105f}),
9526 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9527 {0x14, 0x90170110},
9528 {0x1b, 0x01014020},
9529 {0x21, 0x0221101f}),
9530 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9531 {0x12, 0x90a60160},
9532 {0x14, 0x90170120},
9533 {0x17, 0x90170140},
9534 {0x21, 0x0321102f}),
9535 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9536 {0x12, 0x90a60160},
9537 {0x14, 0x90170130},
9538 {0x21, 0x02211040}),
9539 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9540 {0x12, 0x90a60160},
9541 {0x14, 0x90170140},
9542 {0x21, 0x02211050}),
9543 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9544 {0x12, 0x90a60170},
9545 {0x14, 0x90170120},
9546 {0x21, 0x02211030}),
9547 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9548 {0x12, 0x90a60170},
9549 {0x14, 0x90170130},
9550 {0x21, 0x02211040}),
9551 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9552 {0x12, 0x90a60170},
9553 {0x14, 0x90171130},
9554 {0x21, 0x02211040}),
9555 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9556 {0x12, 0x90a60170},
9557 {0x14, 0x90170140},
9558 {0x21, 0x02211050}),
9559 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9560 {0x12, 0x90a60180},
9561 {0x14, 0x90170130},
9562 {0x21, 0x02211040}),
9563 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9564 {0x12, 0x90a60180},
9565 {0x14, 0x90170120},
9566 {0x21, 0x02211030}),
9567 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9568 {0x1b, 0x01011020},
9569 {0x21, 0x02211010}),
9570 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9571 {0x14, 0x90170110},
9572 {0x1b, 0x90a70130},
9573 {0x21, 0x04211020}),
9574 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9575 {0x14, 0x90170110},
9576 {0x1b, 0x90a70130},
9577 {0x21, 0x03211020}),
9578 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9579 {0x12, 0x90a60130},
9580 {0x14, 0x90170110},
9581 {0x21, 0x03211020}),
9582 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9583 {0x12, 0x90a60130},
9584 {0x14, 0x90170110},
9585 {0x21, 0x04211020}),
9586 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
9587 {0x1a, 0x90a70130},
9588 {0x1b, 0x90170110},
9589 {0x21, 0x03211020}),
9590 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9591 {0x14, 0x90170110},
9592 {0x19, 0x02a11020},
9593 {0x21, 0x0221101f}),
9594 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9595 {0x17, 0x90170110},
9596 {0x19, 0x03a11030},
9597 {0x21, 0x03211020}),
9598 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9599 {0x12, 0x90a60130},
9600 {0x14, 0x90170110},
9601 {0x15, 0x0421101f},
9602 {0x1a, 0x04a11020}),
9603 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9604 {0x12, 0x90a60140},
9605 {0x14, 0x90170110},
9606 {0x15, 0x0421101f},
9607 {0x18, 0x02811030},
9608 {0x1a, 0x04a1103f},
9609 {0x1b, 0x02011020}),
9610 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9611 ALC282_STANDARD_PINS,
9612 {0x12, 0x99a30130},
9613 {0x19, 0x03a11020},
9614 {0x21, 0x0321101f}),
9615 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9616 ALC282_STANDARD_PINS,
9617 {0x12, 0x99a30130},
9618 {0x19, 0x03a11020},
9619 {0x21, 0x03211040}),
9620 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9621 ALC282_STANDARD_PINS,
9622 {0x12, 0x99a30130},
9623 {0x19, 0x03a11030},
9624 {0x21, 0x03211020}),
9625 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9626 ALC282_STANDARD_PINS,
9627 {0x12, 0x99a30130},
9628 {0x19, 0x04a11020},
9629 {0x21, 0x0421101f}),
9630 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
9631 ALC282_STANDARD_PINS,
9632 {0x12, 0x90a60140},
9633 {0x19, 0x04a11030},
9634 {0x21, 0x04211020}),
9635 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9636 ALC282_STANDARD_PINS,
9637 {0x12, 0x90a609c0},
9638 {0x18, 0x03a11830},
9639 {0x19, 0x04a19831},
9640 {0x1a, 0x0481303f},
9641 {0x1b, 0x04211020},
9642 {0x21, 0x0321101f}),
9643 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9644 ALC282_STANDARD_PINS,
9645 {0x12, 0x90a60940},
9646 {0x18, 0x03a11830},
9647 {0x19, 0x04a19831},
9648 {0x1a, 0x0481303f},
9649 {0x1b, 0x04211020},
9650 {0x21, 0x0321101f}),
9651 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9652 ALC282_STANDARD_PINS,
9653 {0x12, 0x90a60130},
9654 {0x21, 0x0321101f}),
9655 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9656 {0x12, 0x90a60160},
9657 {0x14, 0x90170120},
9658 {0x21, 0x02211030}),
9659 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9660 ALC282_STANDARD_PINS,
9661 {0x12, 0x90a60130},
9662 {0x19, 0x03a11020},
9663 {0x21, 0x0321101f}),
9664 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9665 {0x12, 0x90a60130},
9666 {0x14, 0x90170110},
9667 {0x19, 0x04a11040},
9668 {0x21, 0x04211020}),
9669 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9670 {0x14, 0x90170110},
9671 {0x19, 0x04a11040},
9672 {0x1d, 0x40600001},
9673 {0x21, 0x04211020}),
9674 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
9675 {0x14, 0x90170110},
9676 {0x19, 0x04a11040},
9677 {0x21, 0x04211020}),
9678 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9679 {0x14, 0x90170110},
9680 {0x17, 0x90170111},
9681 {0x19, 0x03a11030},
9682 {0x21, 0x03211020}),
9683 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9684 {0x12, 0x90a60130},
9685 {0x17, 0x90170110},
9686 {0x21, 0x02211020}),
9687 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
9688 {0x12, 0x90a60120},
9689 {0x14, 0x90170110},
9690 {0x21, 0x0321101f}),
9691 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9692 ALC290_STANDARD_PINS,
9693 {0x15, 0x04211040},
9694 {0x18, 0x90170112},
9695 {0x1a, 0x04a11020}),
9696 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9697 ALC290_STANDARD_PINS,
9698 {0x15, 0x04211040},
9699 {0x18, 0x90170110},
9700 {0x1a, 0x04a11020}),
9701 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9702 ALC290_STANDARD_PINS,
9703 {0x15, 0x0421101f},
9704 {0x1a, 0x04a11020}),
9705 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9706 ALC290_STANDARD_PINS,
9707 {0x15, 0x04211020},
9708 {0x1a, 0x04a11040}),
9709 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9710 ALC290_STANDARD_PINS,
9711 {0x14, 0x90170110},
9712 {0x15, 0x04211020},
9713 {0x1a, 0x04a11040}),
9714 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9715 ALC290_STANDARD_PINS,
9716 {0x14, 0x90170110},
9717 {0x15, 0x04211020},
9718 {0x1a, 0x04a11020}),
9719 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9720 ALC290_STANDARD_PINS,
9721 {0x14, 0x90170110},
9722 {0x15, 0x0421101f},
9723 {0x1a, 0x04a11020}),
9724 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9725 ALC292_STANDARD_PINS,
9726 {0x12, 0x90a60140},
9727 {0x16, 0x01014020},
9728 {0x19, 0x01a19030}),
9729 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9730 ALC292_STANDARD_PINS,
9731 {0x12, 0x90a60140},
9732 {0x16, 0x01014020},
9733 {0x18, 0x02a19031},
9734 {0x19, 0x01a1903e}),
9735 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
9736 ALC292_STANDARD_PINS,
9737 {0x12, 0x90a60140}),
9738 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9739 ALC292_STANDARD_PINS,
9740 {0x13, 0x90a60140},
9741 {0x16, 0x21014020},
9742 {0x19, 0x21a19030}),
9743 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9744 ALC292_STANDARD_PINS,
9745 {0x13, 0x90a60140}),
9746 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9747 {0x17, 0x90170110},
9748 {0x21, 0x04211020}),
9749 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9750 {0x14, 0x90170110},
9751 {0x1b, 0x90a70130},
9752 {0x21, 0x04211020}),
9753 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9754 {0x12, 0x90a60130},
9755 {0x17, 0x90170110},
9756 {0x21, 0x03211020}),
9757 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9758 {0x12, 0x90a60130},
9759 {0x17, 0x90170110},
9760 {0x21, 0x04211020}),
9761 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9762 {0x12, 0x90a60130},
9763 {0x17, 0x90170110},
9764 {0x21, 0x03211020}),
9765 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9766 {0x12, 0x90a60120},
9767 {0x17, 0x90170110},
9768 {0x21, 0x04211030}),
9769 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9770 {0x12, 0x90a60130},
9771 {0x17, 0x90170110},
9772 {0x21, 0x03211020}),
9773 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9774 {0x12, 0x90a60130},
9775 {0x17, 0x90170110},
9776 {0x21, 0x03211020}),
9777 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9778 {0x14, 0x90170110},
9779 {0x21, 0x04211020}),
9780 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9781 {0x14, 0x90170110},
9782 {0x21, 0x04211030}),
9783 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9784 ALC295_STANDARD_PINS,
9785 {0x17, 0x21014020},
9786 {0x18, 0x21a19030}),
9787 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9788 ALC295_STANDARD_PINS,
9789 {0x17, 0x21014040},
9790 {0x18, 0x21a19050}),
9791 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9792 ALC295_STANDARD_PINS),
9793 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9794 ALC298_STANDARD_PINS,
9795 {0x17, 0x90170110}),
9796 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9797 ALC298_STANDARD_PINS,
9798 {0x17, 0x90170140}),
9799 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9800 ALC298_STANDARD_PINS,
9801 {0x17, 0x90170150}),
9802 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9803 {0x12, 0xb7a60140},
9804 {0x13, 0xb7a60150},
9805 {0x17, 0x90170110},
9806 {0x1a, 0x03011020},
9807 {0x21, 0x03211030}),
9808 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9809 {0x12, 0xb7a60140},
9810 {0x17, 0x90170110},
9811 {0x1a, 0x03a11030},
9812 {0x21, 0x03211020}),
9813 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9814 ALC225_STANDARD_PINS,
9815 {0x12, 0xb7a60130},
9816 {0x17, 0x90170110}),
9817 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9818 {0x14, 0x01014010},
9819 {0x17, 0x90170120},
9820 {0x18, 0x02a11030},
9821 {0x19, 0x02a1103f},
9822 {0x21, 0x0221101f}),
9823 {}
9824 };
9825
9826 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9827 * more machines, don't need to match all valid pins, just need to match
9828 * all the pins defined in the tbl. Just because of this reason, it is possible
9829 * that a single machine matches multiple tbls, so there is one limitation:
9830 * at most one tbl is allowed to define for the same vendor and same codec
9831 */
9832 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9833 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9834 {0x19, 0x40000000},
9835 {0x1b, 0x40000000}),
9836 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9837 {0x19, 0x40000000},
9838 {0x1a, 0x40000000}),
9839 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9840 {0x19, 0x40000000},
9841 {0x1a, 0x40000000}),
9842 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9843 {0x19, 0x40000000},
9844 {0x1a, 0x40000000}),
9845 {}
9846 };
9847
alc269_fill_coef(struct hda_codec * codec)9848 static void alc269_fill_coef(struct hda_codec *codec)
9849 {
9850 struct alc_spec *spec = codec->spec;
9851 int val;
9852
9853 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
9854 return;
9855
9856 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
9857 alc_write_coef_idx(codec, 0xf, 0x960b);
9858 alc_write_coef_idx(codec, 0xe, 0x8817);
9859 }
9860
9861 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
9862 alc_write_coef_idx(codec, 0xf, 0x960b);
9863 alc_write_coef_idx(codec, 0xe, 0x8814);
9864 }
9865
9866 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
9867 /* Power up output pin */
9868 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
9869 }
9870
9871 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
9872 val = alc_read_coef_idx(codec, 0xd);
9873 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
9874 /* Capless ramp up clock control */
9875 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9876 }
9877 val = alc_read_coef_idx(codec, 0x17);
9878 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
9879 /* Class D power on reset */
9880 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9881 }
9882 }
9883
9884 /* HP */
9885 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
9886 }
9887
9888 /*
9889 */
patch_alc269(struct hda_codec * codec)9890 static int patch_alc269(struct hda_codec *codec)
9891 {
9892 struct alc_spec *spec;
9893 int err;
9894
9895 err = alc_alloc_spec(codec, 0x0b);
9896 if (err < 0)
9897 return err;
9898
9899 spec = codec->spec;
9900 spec->gen.shared_mic_vref_pin = 0x18;
9901 codec->power_save_node = 0;
9902
9903 #ifdef CONFIG_PM
9904 codec->patch_ops.suspend = alc269_suspend;
9905 codec->patch_ops.resume = alc269_resume;
9906 #endif
9907 spec->shutup = alc_default_shutup;
9908 spec->init_hook = alc_default_init;
9909
9910 switch (codec->core.vendor_id) {
9911 case 0x10ec0269:
9912 spec->codec_variant = ALC269_TYPE_ALC269VA;
9913 switch (alc_get_coef0(codec) & 0x00f0) {
9914 case 0x0010:
9915 if (codec->bus->pci &&
9916 codec->bus->pci->subsystem_vendor == 0x1025 &&
9917 spec->cdefine.platform_type == 1)
9918 err = alc_codec_rename(codec, "ALC271X");
9919 spec->codec_variant = ALC269_TYPE_ALC269VB;
9920 break;
9921 case 0x0020:
9922 if (codec->bus->pci &&
9923 codec->bus->pci->subsystem_vendor == 0x17aa &&
9924 codec->bus->pci->subsystem_device == 0x21f3)
9925 err = alc_codec_rename(codec, "ALC3202");
9926 spec->codec_variant = ALC269_TYPE_ALC269VC;
9927 break;
9928 case 0x0030:
9929 spec->codec_variant = ALC269_TYPE_ALC269VD;
9930 break;
9931 default:
9932 alc_fix_pll_init(codec, 0x20, 0x04, 15);
9933 }
9934 if (err < 0)
9935 goto error;
9936 spec->shutup = alc269_shutup;
9937 spec->init_hook = alc269_fill_coef;
9938 alc269_fill_coef(codec);
9939 break;
9940
9941 case 0x10ec0280:
9942 case 0x10ec0290:
9943 spec->codec_variant = ALC269_TYPE_ALC280;
9944 break;
9945 case 0x10ec0282:
9946 spec->codec_variant = ALC269_TYPE_ALC282;
9947 spec->shutup = alc282_shutup;
9948 spec->init_hook = alc282_init;
9949 break;
9950 case 0x10ec0233:
9951 case 0x10ec0283:
9952 spec->codec_variant = ALC269_TYPE_ALC283;
9953 spec->shutup = alc283_shutup;
9954 spec->init_hook = alc283_init;
9955 break;
9956 case 0x10ec0284:
9957 case 0x10ec0292:
9958 spec->codec_variant = ALC269_TYPE_ALC284;
9959 break;
9960 case 0x10ec0293:
9961 spec->codec_variant = ALC269_TYPE_ALC293;
9962 break;
9963 case 0x10ec0286:
9964 case 0x10ec0288:
9965 spec->codec_variant = ALC269_TYPE_ALC286;
9966 break;
9967 case 0x10ec0298:
9968 spec->codec_variant = ALC269_TYPE_ALC298;
9969 break;
9970 case 0x10ec0235:
9971 case 0x10ec0255:
9972 spec->codec_variant = ALC269_TYPE_ALC255;
9973 spec->shutup = alc256_shutup;
9974 spec->init_hook = alc256_init;
9975 break;
9976 case 0x10ec0230:
9977 case 0x10ec0236:
9978 case 0x10ec0256:
9979 case 0x19e58326:
9980 spec->codec_variant = ALC269_TYPE_ALC256;
9981 spec->shutup = alc256_shutup;
9982 spec->init_hook = alc256_init;
9983 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
9984 break;
9985 case 0x10ec0257:
9986 spec->codec_variant = ALC269_TYPE_ALC257;
9987 spec->shutup = alc256_shutup;
9988 spec->init_hook = alc256_init;
9989 spec->gen.mixer_nid = 0;
9990 break;
9991 case 0x10ec0215:
9992 case 0x10ec0245:
9993 case 0x10ec0285:
9994 case 0x10ec0287:
9995 case 0x10ec0289:
9996 spec->codec_variant = ALC269_TYPE_ALC215;
9997 spec->shutup = alc225_shutup;
9998 spec->init_hook = alc225_init;
9999 spec->gen.mixer_nid = 0;
10000 break;
10001 case 0x10ec0225:
10002 case 0x10ec0295:
10003 case 0x10ec0299:
10004 spec->codec_variant = ALC269_TYPE_ALC225;
10005 spec->shutup = alc225_shutup;
10006 spec->init_hook = alc225_init;
10007 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
10008 break;
10009 case 0x10ec0234:
10010 case 0x10ec0274:
10011 case 0x10ec0294:
10012 spec->codec_variant = ALC269_TYPE_ALC294;
10013 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
10014 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
10015 spec->init_hook = alc294_init;
10016 break;
10017 case 0x10ec0300:
10018 spec->codec_variant = ALC269_TYPE_ALC300;
10019 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
10020 break;
10021 case 0x10ec0623:
10022 spec->codec_variant = ALC269_TYPE_ALC623;
10023 break;
10024 case 0x10ec0700:
10025 case 0x10ec0701:
10026 case 0x10ec0703:
10027 case 0x10ec0711:
10028 spec->codec_variant = ALC269_TYPE_ALC700;
10029 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
10030 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
10031 spec->init_hook = alc294_init;
10032 break;
10033
10034 }
10035
10036 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
10037 spec->has_alc5505_dsp = 1;
10038 spec->init_hook = alc5505_dsp_init;
10039 }
10040
10041 alc_pre_init(codec);
10042
10043 snd_hda_pick_fixup(codec, alc269_fixup_models,
10044 alc269_fixup_tbl, alc269_fixups);
10045 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10046 * the quirk breaks the latter (bko#214101).
10047 * Clear the wrong entry.
10048 */
10049 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10050 codec->core.vendor_id == 0x10ec0294) {
10051 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10052 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10053 }
10054
10055 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
10056 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
10057 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
10058 alc269_fixups);
10059 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10060
10061 alc_auto_parse_customize_define(codec);
10062
10063 if (has_cdefine_beep(codec))
10064 spec->gen.beep_nid = 0x01;
10065
10066 /* automatic parse from the BIOS config */
10067 err = alc269_parse_auto_config(codec);
10068 if (err < 0)
10069 goto error;
10070
10071 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10072 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10073 if (err < 0)
10074 goto error;
10075 }
10076
10077 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10078
10079 return 0;
10080
10081 error:
10082 alc_free(codec);
10083 return err;
10084 }
10085
10086 /*
10087 * ALC861
10088 */
10089
alc861_parse_auto_config(struct hda_codec * codec)10090 static int alc861_parse_auto_config(struct hda_codec *codec)
10091 {
10092 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
10093 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10094 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
10095 }
10096
10097 /* Pin config fixes */
10098 enum {
10099 ALC861_FIXUP_FSC_AMILO_PI1505,
10100 ALC861_FIXUP_AMP_VREF_0F,
10101 ALC861_FIXUP_NO_JACK_DETECT,
10102 ALC861_FIXUP_ASUS_A6RP,
10103 ALC660_FIXUP_ASUS_W7J,
10104 };
10105
10106 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
alc861_fixup_asus_amp_vref_0f(struct hda_codec * codec,const struct hda_fixup * fix,int action)10107 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
10108 const struct hda_fixup *fix, int action)
10109 {
10110 struct alc_spec *spec = codec->spec;
10111 unsigned int val;
10112
10113 if (action != HDA_FIXUP_ACT_INIT)
10114 return;
10115 val = snd_hda_codec_get_pin_target(codec, 0x0f);
10116 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10117 val |= AC_PINCTL_IN_EN;
10118 val |= AC_PINCTL_VREF_50;
10119 snd_hda_set_pin_ctl(codec, 0x0f, val);
10120 spec->gen.keep_vref_in_automute = 1;
10121 }
10122
10123 /* suppress the jack-detection */
alc_fixup_no_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)10124 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
10125 const struct hda_fixup *fix, int action)
10126 {
10127 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10128 codec->no_jack_detect = 1;
10129 }
10130
10131 static const struct hda_fixup alc861_fixups[] = {
10132 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
10133 .type = HDA_FIXUP_PINS,
10134 .v.pins = (const struct hda_pintbl[]) {
10135 { 0x0b, 0x0221101f }, /* HP */
10136 { 0x0f, 0x90170310 }, /* speaker */
10137 { }
10138 }
10139 },
10140 [ALC861_FIXUP_AMP_VREF_0F] = {
10141 .type = HDA_FIXUP_FUNC,
10142 .v.func = alc861_fixup_asus_amp_vref_0f,
10143 },
10144 [ALC861_FIXUP_NO_JACK_DETECT] = {
10145 .type = HDA_FIXUP_FUNC,
10146 .v.func = alc_fixup_no_jack_detect,
10147 },
10148 [ALC861_FIXUP_ASUS_A6RP] = {
10149 .type = HDA_FIXUP_FUNC,
10150 .v.func = alc861_fixup_asus_amp_vref_0f,
10151 .chained = true,
10152 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
10153 },
10154 [ALC660_FIXUP_ASUS_W7J] = {
10155 .type = HDA_FIXUP_VERBS,
10156 .v.verbs = (const struct hda_verb[]) {
10157 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10158 * for enabling outputs
10159 */
10160 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10161 { }
10162 },
10163 }
10164 };
10165
10166 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
10167 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
10168 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
10169 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10170 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10171 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
10172 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
10173 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
10174 {}
10175 };
10176
10177 /*
10178 */
patch_alc861(struct hda_codec * codec)10179 static int patch_alc861(struct hda_codec *codec)
10180 {
10181 struct alc_spec *spec;
10182 int err;
10183
10184 err = alc_alloc_spec(codec, 0x15);
10185 if (err < 0)
10186 return err;
10187
10188 spec = codec->spec;
10189 if (has_cdefine_beep(codec))
10190 spec->gen.beep_nid = 0x23;
10191
10192 #ifdef CONFIG_PM
10193 spec->power_hook = alc_power_eapd;
10194 #endif
10195
10196 alc_pre_init(codec);
10197
10198 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10199 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10200
10201 /* automatic parse from the BIOS config */
10202 err = alc861_parse_auto_config(codec);
10203 if (err < 0)
10204 goto error;
10205
10206 if (!spec->gen.no_analog) {
10207 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10208 if (err < 0)
10209 goto error;
10210 }
10211
10212 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10213
10214 return 0;
10215
10216 error:
10217 alc_free(codec);
10218 return err;
10219 }
10220
10221 /*
10222 * ALC861-VD support
10223 *
10224 * Based on ALC882
10225 *
10226 * In addition, an independent DAC
10227 */
alc861vd_parse_auto_config(struct hda_codec * codec)10228 static int alc861vd_parse_auto_config(struct hda_codec *codec)
10229 {
10230 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
10231 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10232 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
10233 }
10234
10235 enum {
10236 ALC660VD_FIX_ASUS_GPIO1,
10237 ALC861VD_FIX_DALLAS,
10238 };
10239
10240 /* exclude VREF80 */
alc861vd_fixup_dallas(struct hda_codec * codec,const struct hda_fixup * fix,int action)10241 static void alc861vd_fixup_dallas(struct hda_codec *codec,
10242 const struct hda_fixup *fix, int action)
10243 {
10244 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10245 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10246 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
10247 }
10248 }
10249
10250 /* reset GPIO1 */
alc660vd_fixup_asus_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)10251 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10252 const struct hda_fixup *fix, int action)
10253 {
10254 struct alc_spec *spec = codec->spec;
10255
10256 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10257 spec->gpio_mask |= 0x02;
10258 alc_fixup_gpio(codec, action, 0x01);
10259 }
10260
10261 static const struct hda_fixup alc861vd_fixups[] = {
10262 [ALC660VD_FIX_ASUS_GPIO1] = {
10263 .type = HDA_FIXUP_FUNC,
10264 .v.func = alc660vd_fixup_asus_gpio1,
10265 },
10266 [ALC861VD_FIX_DALLAS] = {
10267 .type = HDA_FIXUP_FUNC,
10268 .v.func = alc861vd_fixup_dallas,
10269 },
10270 };
10271
10272 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
10273 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
10274 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
10275 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
10276 {}
10277 };
10278
10279 /*
10280 */
patch_alc861vd(struct hda_codec * codec)10281 static int patch_alc861vd(struct hda_codec *codec)
10282 {
10283 struct alc_spec *spec;
10284 int err;
10285
10286 err = alc_alloc_spec(codec, 0x0b);
10287 if (err < 0)
10288 return err;
10289
10290 spec = codec->spec;
10291 if (has_cdefine_beep(codec))
10292 spec->gen.beep_nid = 0x23;
10293
10294 spec->shutup = alc_eapd_shutup;
10295
10296 alc_pre_init(codec);
10297
10298 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10299 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10300
10301 /* automatic parse from the BIOS config */
10302 err = alc861vd_parse_auto_config(codec);
10303 if (err < 0)
10304 goto error;
10305
10306 if (!spec->gen.no_analog) {
10307 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10308 if (err < 0)
10309 goto error;
10310 }
10311
10312 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10313
10314 return 0;
10315
10316 error:
10317 alc_free(codec);
10318 return err;
10319 }
10320
10321 /*
10322 * ALC662 support
10323 *
10324 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10325 * configuration. Each pin widget can choose any input DACs and a mixer.
10326 * Each ADC is connected from a mixer of all inputs. This makes possible
10327 * 6-channel independent captures.
10328 *
10329 * In addition, an independent DAC for the multi-playback (not used in this
10330 * driver yet).
10331 */
10332
10333 /*
10334 * BIOS auto configuration
10335 */
10336
alc662_parse_auto_config(struct hda_codec * codec)10337 static int alc662_parse_auto_config(struct hda_codec *codec)
10338 {
10339 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
10340 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10341 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10342 const hda_nid_t *ssids;
10343
10344 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10345 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10346 codec->core.vendor_id == 0x10ec0671)
10347 ssids = alc663_ssids;
10348 else
10349 ssids = alc662_ssids;
10350 return alc_parse_auto_config(codec, alc662_ignore, ssids);
10351 }
10352
alc272_fixup_mario(struct hda_codec * codec,const struct hda_fixup * fix,int action)10353 static void alc272_fixup_mario(struct hda_codec *codec,
10354 const struct hda_fixup *fix, int action)
10355 {
10356 if (action != HDA_FIXUP_ACT_PRE_PROBE)
10357 return;
10358 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10359 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10360 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10361 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10362 (0 << AC_AMPCAP_MUTE_SHIFT)))
10363 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
10364 }
10365
10366 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10367 { .channels = 2,
10368 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10369 { .channels = 4,
10370 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10371 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10372 { }
10373 };
10374
10375 /* override the 2.1 chmap */
alc_fixup_bass_chmap(struct hda_codec * codec,const struct hda_fixup * fix,int action)10376 static void alc_fixup_bass_chmap(struct hda_codec *codec,
10377 const struct hda_fixup *fix, int action)
10378 {
10379 if (action == HDA_FIXUP_ACT_BUILD) {
10380 struct alc_spec *spec = codec->spec;
10381 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
10382 }
10383 }
10384
10385 /* avoid D3 for keeping GPIO up */
gpio_led_power_filter(struct hda_codec * codec,hda_nid_t nid,unsigned int power_state)10386 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10387 hda_nid_t nid,
10388 unsigned int power_state)
10389 {
10390 struct alc_spec *spec = codec->spec;
10391 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
10392 return AC_PWRST_D0;
10393 return power_state;
10394 }
10395
alc662_fixup_led_gpio1(struct hda_codec * codec,const struct hda_fixup * fix,int action)10396 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10397 const struct hda_fixup *fix, int action)
10398 {
10399 struct alc_spec *spec = codec->spec;
10400
10401 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
10402 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10403 spec->mute_led_polarity = 1;
10404 codec->power_filter = gpio_led_power_filter;
10405 }
10406 }
10407
alc662_usi_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)10408 static void alc662_usi_automute_hook(struct hda_codec *codec,
10409 struct hda_jack_callback *jack)
10410 {
10411 struct alc_spec *spec = codec->spec;
10412 int vref;
10413 msleep(200);
10414 snd_hda_gen_hp_automute(codec, jack);
10415
10416 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10417 msleep(100);
10418 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10419 vref);
10420 }
10421
alc662_fixup_usi_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)10422 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10423 const struct hda_fixup *fix, int action)
10424 {
10425 struct alc_spec *spec = codec->spec;
10426 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10427 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10428 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10429 }
10430 }
10431
alc662_aspire_ethos_mute_speakers(struct hda_codec * codec,struct hda_jack_callback * cb)10432 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10433 struct hda_jack_callback *cb)
10434 {
10435 /* surround speakers at 0x1b already get muted automatically when
10436 * headphones are plugged in, but we have to mute/unmute the remaining
10437 * channels manually:
10438 * 0x15 - front left/front right
10439 * 0x18 - front center/ LFE
10440 */
10441 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10442 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10443 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10444 } else {
10445 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10446 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10447 }
10448 }
10449
alc662_fixup_aspire_ethos_hp(struct hda_codec * codec,const struct hda_fixup * fix,int action)10450 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10451 const struct hda_fixup *fix, int action)
10452 {
10453 /* Pin 0x1b: shared headphones jack and surround speakers */
10454 if (!is_jack_detectable(codec, 0x1b))
10455 return;
10456
10457 switch (action) {
10458 case HDA_FIXUP_ACT_PRE_PROBE:
10459 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10460 alc662_aspire_ethos_mute_speakers);
10461 /* subwoofer needs an extra GPIO setting to become audible */
10462 alc_setup_gpio(codec, 0x02);
10463 break;
10464 case HDA_FIXUP_ACT_INIT:
10465 /* Make sure to start in a correct state, i.e. if
10466 * headphones have been plugged in before powering up the system
10467 */
10468 alc662_aspire_ethos_mute_speakers(codec, NULL);
10469 break;
10470 }
10471 }
10472
alc671_fixup_hp_headset_mic2(struct hda_codec * codec,const struct hda_fixup * fix,int action)10473 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10474 const struct hda_fixup *fix, int action)
10475 {
10476 struct alc_spec *spec = codec->spec;
10477
10478 static const struct hda_pintbl pincfgs[] = {
10479 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10480 { 0x1b, 0x0181304f },
10481 { }
10482 };
10483
10484 switch (action) {
10485 case HDA_FIXUP_ACT_PRE_PROBE:
10486 spec->gen.mixer_nid = 0;
10487 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10488 snd_hda_apply_pincfgs(codec, pincfgs);
10489 break;
10490 case HDA_FIXUP_ACT_INIT:
10491 alc_write_coef_idx(codec, 0x19, 0xa054);
10492 break;
10493 }
10494 }
10495
alc897_hp_automute_hook(struct hda_codec * codec,struct hda_jack_callback * jack)10496 static void alc897_hp_automute_hook(struct hda_codec *codec,
10497 struct hda_jack_callback *jack)
10498 {
10499 struct alc_spec *spec = codec->spec;
10500 int vref;
10501
10502 snd_hda_gen_hp_automute(codec, jack);
10503 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10504 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10505 vref);
10506 }
10507
alc897_fixup_lenovo_headset_mic(struct hda_codec * codec,const struct hda_fixup * fix,int action)10508 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10509 const struct hda_fixup *fix, int action)
10510 {
10511 struct alc_spec *spec = codec->spec;
10512 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10513 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10514 }
10515 }
10516
10517 static const struct coef_fw alc668_coefs[] = {
10518 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10519 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10520 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10521 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10522 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10523 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10524 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10525 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10526 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10527 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10528 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10529 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10530 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10531 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10532 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10533 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10534 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10535 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10536 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10537 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10538 {}
10539 };
10540
alc668_restore_default_value(struct hda_codec * codec)10541 static void alc668_restore_default_value(struct hda_codec *codec)
10542 {
10543 alc_process_coef_fw(codec, alc668_coefs);
10544 }
10545
10546 enum {
10547 ALC662_FIXUP_ASPIRE,
10548 ALC662_FIXUP_LED_GPIO1,
10549 ALC662_FIXUP_IDEAPAD,
10550 ALC272_FIXUP_MARIO,
10551 ALC662_FIXUP_CZC_ET26,
10552 ALC662_FIXUP_CZC_P10T,
10553 ALC662_FIXUP_SKU_IGNORE,
10554 ALC662_FIXUP_HP_RP5800,
10555 ALC662_FIXUP_ASUS_MODE1,
10556 ALC662_FIXUP_ASUS_MODE2,
10557 ALC662_FIXUP_ASUS_MODE3,
10558 ALC662_FIXUP_ASUS_MODE4,
10559 ALC662_FIXUP_ASUS_MODE5,
10560 ALC662_FIXUP_ASUS_MODE6,
10561 ALC662_FIXUP_ASUS_MODE7,
10562 ALC662_FIXUP_ASUS_MODE8,
10563 ALC662_FIXUP_NO_JACK_DETECT,
10564 ALC662_FIXUP_ZOTAC_Z68,
10565 ALC662_FIXUP_INV_DMIC,
10566 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10567 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
10568 ALC662_FIXUP_HEADSET_MODE,
10569 ALC668_FIXUP_HEADSET_MODE,
10570 ALC662_FIXUP_BASS_MODE4_CHMAP,
10571 ALC662_FIXUP_BASS_16,
10572 ALC662_FIXUP_BASS_1A,
10573 ALC662_FIXUP_BASS_CHMAP,
10574 ALC668_FIXUP_AUTO_MUTE,
10575 ALC668_FIXUP_DELL_DISABLE_AAMIX,
10576 ALC668_FIXUP_DELL_XPS13,
10577 ALC662_FIXUP_ASUS_Nx50,
10578 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10579 ALC668_FIXUP_ASUS_Nx51,
10580 ALC668_FIXUP_MIC_COEF,
10581 ALC668_FIXUP_ASUS_G751,
10582 ALC891_FIXUP_HEADSET_MODE,
10583 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10584 ALC662_FIXUP_ACER_VERITON,
10585 ALC892_FIXUP_ASROCK_MOBO,
10586 ALC662_FIXUP_USI_FUNC,
10587 ALC662_FIXUP_USI_HEADSET_MODE,
10588 ALC662_FIXUP_LENOVO_MULTI_CODECS,
10589 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
10590 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
10591 ALC671_FIXUP_HP_HEADSET_MIC2,
10592 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
10593 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
10594 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10595 ALC668_FIXUP_HEADSET_MIC,
10596 ALC668_FIXUP_MIC_DET_COEF,
10597 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10598 ALC897_FIXUP_HEADSET_MIC_PIN,
10599 ALC897_FIXUP_HP_HSMIC_VERB,
10600 };
10601
10602 static const struct hda_fixup alc662_fixups[] = {
10603 [ALC662_FIXUP_ASPIRE] = {
10604 .type = HDA_FIXUP_PINS,
10605 .v.pins = (const struct hda_pintbl[]) {
10606 { 0x15, 0x99130112 }, /* subwoofer */
10607 { }
10608 }
10609 },
10610 [ALC662_FIXUP_LED_GPIO1] = {
10611 .type = HDA_FIXUP_FUNC,
10612 .v.func = alc662_fixup_led_gpio1,
10613 },
10614 [ALC662_FIXUP_IDEAPAD] = {
10615 .type = HDA_FIXUP_PINS,
10616 .v.pins = (const struct hda_pintbl[]) {
10617 { 0x17, 0x99130112 }, /* subwoofer */
10618 { }
10619 },
10620 .chained = true,
10621 .chain_id = ALC662_FIXUP_LED_GPIO1,
10622 },
10623 [ALC272_FIXUP_MARIO] = {
10624 .type = HDA_FIXUP_FUNC,
10625 .v.func = alc272_fixup_mario,
10626 },
10627 [ALC662_FIXUP_CZC_ET26] = {
10628 .type = HDA_FIXUP_PINS,
10629 .v.pins = (const struct hda_pintbl[]) {
10630 {0x12, 0x403cc000},
10631 {0x14, 0x90170110}, /* speaker */
10632 {0x15, 0x411111f0},
10633 {0x16, 0x411111f0},
10634 {0x18, 0x01a19030}, /* mic */
10635 {0x19, 0x90a7013f}, /* int-mic */
10636 {0x1a, 0x01014020},
10637 {0x1b, 0x0121401f},
10638 {0x1c, 0x411111f0},
10639 {0x1d, 0x411111f0},
10640 {0x1e, 0x40478e35},
10641 {}
10642 },
10643 .chained = true,
10644 .chain_id = ALC662_FIXUP_SKU_IGNORE
10645 },
10646 [ALC662_FIXUP_CZC_P10T] = {
10647 .type = HDA_FIXUP_VERBS,
10648 .v.verbs = (const struct hda_verb[]) {
10649 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10650 {}
10651 }
10652 },
10653 [ALC662_FIXUP_SKU_IGNORE] = {
10654 .type = HDA_FIXUP_FUNC,
10655 .v.func = alc_fixup_sku_ignore,
10656 },
10657 [ALC662_FIXUP_HP_RP5800] = {
10658 .type = HDA_FIXUP_PINS,
10659 .v.pins = (const struct hda_pintbl[]) {
10660 { 0x14, 0x0221201f }, /* HP out */
10661 { }
10662 },
10663 .chained = true,
10664 .chain_id = ALC662_FIXUP_SKU_IGNORE
10665 },
10666 [ALC662_FIXUP_ASUS_MODE1] = {
10667 .type = HDA_FIXUP_PINS,
10668 .v.pins = (const struct hda_pintbl[]) {
10669 { 0x14, 0x99130110 }, /* speaker */
10670 { 0x18, 0x01a19c20 }, /* mic */
10671 { 0x19, 0x99a3092f }, /* int-mic */
10672 { 0x21, 0x0121401f }, /* HP out */
10673 { }
10674 },
10675 .chained = true,
10676 .chain_id = ALC662_FIXUP_SKU_IGNORE
10677 },
10678 [ALC662_FIXUP_ASUS_MODE2] = {
10679 .type = HDA_FIXUP_PINS,
10680 .v.pins = (const struct hda_pintbl[]) {
10681 { 0x14, 0x99130110 }, /* speaker */
10682 { 0x18, 0x01a19820 }, /* mic */
10683 { 0x19, 0x99a3092f }, /* int-mic */
10684 { 0x1b, 0x0121401f }, /* HP out */
10685 { }
10686 },
10687 .chained = true,
10688 .chain_id = ALC662_FIXUP_SKU_IGNORE
10689 },
10690 [ALC662_FIXUP_ASUS_MODE3] = {
10691 .type = HDA_FIXUP_PINS,
10692 .v.pins = (const struct hda_pintbl[]) {
10693 { 0x14, 0x99130110 }, /* speaker */
10694 { 0x15, 0x0121441f }, /* HP */
10695 { 0x18, 0x01a19840 }, /* mic */
10696 { 0x19, 0x99a3094f }, /* int-mic */
10697 { 0x21, 0x01211420 }, /* HP2 */
10698 { }
10699 },
10700 .chained = true,
10701 .chain_id = ALC662_FIXUP_SKU_IGNORE
10702 },
10703 [ALC662_FIXUP_ASUS_MODE4] = {
10704 .type = HDA_FIXUP_PINS,
10705 .v.pins = (const struct hda_pintbl[]) {
10706 { 0x14, 0x99130110 }, /* speaker */
10707 { 0x16, 0x99130111 }, /* speaker */
10708 { 0x18, 0x01a19840 }, /* mic */
10709 { 0x19, 0x99a3094f }, /* int-mic */
10710 { 0x21, 0x0121441f }, /* HP */
10711 { }
10712 },
10713 .chained = true,
10714 .chain_id = ALC662_FIXUP_SKU_IGNORE
10715 },
10716 [ALC662_FIXUP_ASUS_MODE5] = {
10717 .type = HDA_FIXUP_PINS,
10718 .v.pins = (const struct hda_pintbl[]) {
10719 { 0x14, 0x99130110 }, /* speaker */
10720 { 0x15, 0x0121441f }, /* HP */
10721 { 0x16, 0x99130111 }, /* speaker */
10722 { 0x18, 0x01a19840 }, /* mic */
10723 { 0x19, 0x99a3094f }, /* int-mic */
10724 { }
10725 },
10726 .chained = true,
10727 .chain_id = ALC662_FIXUP_SKU_IGNORE
10728 },
10729 [ALC662_FIXUP_ASUS_MODE6] = {
10730 .type = HDA_FIXUP_PINS,
10731 .v.pins = (const struct hda_pintbl[]) {
10732 { 0x14, 0x99130110 }, /* speaker */
10733 { 0x15, 0x01211420 }, /* HP2 */
10734 { 0x18, 0x01a19840 }, /* mic */
10735 { 0x19, 0x99a3094f }, /* int-mic */
10736 { 0x1b, 0x0121441f }, /* HP */
10737 { }
10738 },
10739 .chained = true,
10740 .chain_id = ALC662_FIXUP_SKU_IGNORE
10741 },
10742 [ALC662_FIXUP_ASUS_MODE7] = {
10743 .type = HDA_FIXUP_PINS,
10744 .v.pins = (const struct hda_pintbl[]) {
10745 { 0x14, 0x99130110 }, /* speaker */
10746 { 0x17, 0x99130111 }, /* speaker */
10747 { 0x18, 0x01a19840 }, /* mic */
10748 { 0x19, 0x99a3094f }, /* int-mic */
10749 { 0x1b, 0x01214020 }, /* HP */
10750 { 0x21, 0x0121401f }, /* HP */
10751 { }
10752 },
10753 .chained = true,
10754 .chain_id = ALC662_FIXUP_SKU_IGNORE
10755 },
10756 [ALC662_FIXUP_ASUS_MODE8] = {
10757 .type = HDA_FIXUP_PINS,
10758 .v.pins = (const struct hda_pintbl[]) {
10759 { 0x14, 0x99130110 }, /* speaker */
10760 { 0x12, 0x99a30970 }, /* int-mic */
10761 { 0x15, 0x01214020 }, /* HP */
10762 { 0x17, 0x99130111 }, /* speaker */
10763 { 0x18, 0x01a19840 }, /* mic */
10764 { 0x21, 0x0121401f }, /* HP */
10765 { }
10766 },
10767 .chained = true,
10768 .chain_id = ALC662_FIXUP_SKU_IGNORE
10769 },
10770 [ALC662_FIXUP_NO_JACK_DETECT] = {
10771 .type = HDA_FIXUP_FUNC,
10772 .v.func = alc_fixup_no_jack_detect,
10773 },
10774 [ALC662_FIXUP_ZOTAC_Z68] = {
10775 .type = HDA_FIXUP_PINS,
10776 .v.pins = (const struct hda_pintbl[]) {
10777 { 0x1b, 0x02214020 }, /* Front HP */
10778 { }
10779 }
10780 },
10781 [ALC662_FIXUP_INV_DMIC] = {
10782 .type = HDA_FIXUP_FUNC,
10783 .v.func = alc_fixup_inv_dmic,
10784 },
10785 [ALC668_FIXUP_DELL_XPS13] = {
10786 .type = HDA_FIXUP_FUNC,
10787 .v.func = alc_fixup_dell_xps13,
10788 .chained = true,
10789 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10790 },
10791 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10792 .type = HDA_FIXUP_FUNC,
10793 .v.func = alc_fixup_disable_aamix,
10794 .chained = true,
10795 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10796 },
10797 [ALC668_FIXUP_AUTO_MUTE] = {
10798 .type = HDA_FIXUP_FUNC,
10799 .v.func = alc_fixup_auto_mute_via_amp,
10800 .chained = true,
10801 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10802 },
10803 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10804 .type = HDA_FIXUP_PINS,
10805 .v.pins = (const struct hda_pintbl[]) {
10806 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10807 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10808 { }
10809 },
10810 .chained = true,
10811 .chain_id = ALC662_FIXUP_HEADSET_MODE
10812 },
10813 [ALC662_FIXUP_HEADSET_MODE] = {
10814 .type = HDA_FIXUP_FUNC,
10815 .v.func = alc_fixup_headset_mode_alc662,
10816 },
10817 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10818 .type = HDA_FIXUP_PINS,
10819 .v.pins = (const struct hda_pintbl[]) {
10820 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10821 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10822 { }
10823 },
10824 .chained = true,
10825 .chain_id = ALC668_FIXUP_HEADSET_MODE
10826 },
10827 [ALC668_FIXUP_HEADSET_MODE] = {
10828 .type = HDA_FIXUP_FUNC,
10829 .v.func = alc_fixup_headset_mode_alc668,
10830 },
10831 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
10832 .type = HDA_FIXUP_FUNC,
10833 .v.func = alc_fixup_bass_chmap,
10834 .chained = true,
10835 .chain_id = ALC662_FIXUP_ASUS_MODE4
10836 },
10837 [ALC662_FIXUP_BASS_16] = {
10838 .type = HDA_FIXUP_PINS,
10839 .v.pins = (const struct hda_pintbl[]) {
10840 {0x16, 0x80106111}, /* bass speaker */
10841 {}
10842 },
10843 .chained = true,
10844 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10845 },
10846 [ALC662_FIXUP_BASS_1A] = {
10847 .type = HDA_FIXUP_PINS,
10848 .v.pins = (const struct hda_pintbl[]) {
10849 {0x1a, 0x80106111}, /* bass speaker */
10850 {}
10851 },
10852 .chained = true,
10853 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10854 },
10855 [ALC662_FIXUP_BASS_CHMAP] = {
10856 .type = HDA_FIXUP_FUNC,
10857 .v.func = alc_fixup_bass_chmap,
10858 },
10859 [ALC662_FIXUP_ASUS_Nx50] = {
10860 .type = HDA_FIXUP_FUNC,
10861 .v.func = alc_fixup_auto_mute_via_amp,
10862 .chained = true,
10863 .chain_id = ALC662_FIXUP_BASS_1A
10864 },
10865 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10866 .type = HDA_FIXUP_FUNC,
10867 .v.func = alc_fixup_headset_mode_alc668,
10868 .chain_id = ALC662_FIXUP_BASS_CHMAP
10869 },
10870 [ALC668_FIXUP_ASUS_Nx51] = {
10871 .type = HDA_FIXUP_PINS,
10872 .v.pins = (const struct hda_pintbl[]) {
10873 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10874 { 0x1a, 0x90170151 }, /* bass speaker */
10875 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10876 {}
10877 },
10878 .chained = true,
10879 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10880 },
10881 [ALC668_FIXUP_MIC_COEF] = {
10882 .type = HDA_FIXUP_VERBS,
10883 .v.verbs = (const struct hda_verb[]) {
10884 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10885 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10886 {}
10887 },
10888 },
10889 [ALC668_FIXUP_ASUS_G751] = {
10890 .type = HDA_FIXUP_PINS,
10891 .v.pins = (const struct hda_pintbl[]) {
10892 { 0x16, 0x0421101f }, /* HP */
10893 {}
10894 },
10895 .chained = true,
10896 .chain_id = ALC668_FIXUP_MIC_COEF
10897 },
10898 [ALC891_FIXUP_HEADSET_MODE] = {
10899 .type = HDA_FIXUP_FUNC,
10900 .v.func = alc_fixup_headset_mode,
10901 },
10902 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10903 .type = HDA_FIXUP_PINS,
10904 .v.pins = (const struct hda_pintbl[]) {
10905 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10906 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10907 { }
10908 },
10909 .chained = true,
10910 .chain_id = ALC891_FIXUP_HEADSET_MODE
10911 },
10912 [ALC662_FIXUP_ACER_VERITON] = {
10913 .type = HDA_FIXUP_PINS,
10914 .v.pins = (const struct hda_pintbl[]) {
10915 { 0x15, 0x50170120 }, /* no internal speaker */
10916 { }
10917 }
10918 },
10919 [ALC892_FIXUP_ASROCK_MOBO] = {
10920 .type = HDA_FIXUP_PINS,
10921 .v.pins = (const struct hda_pintbl[]) {
10922 { 0x15, 0x40f000f0 }, /* disabled */
10923 { 0x16, 0x40f000f0 }, /* disabled */
10924 { }
10925 }
10926 },
10927 [ALC662_FIXUP_USI_FUNC] = {
10928 .type = HDA_FIXUP_FUNC,
10929 .v.func = alc662_fixup_usi_headset_mic,
10930 },
10931 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10932 .type = HDA_FIXUP_PINS,
10933 .v.pins = (const struct hda_pintbl[]) {
10934 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10935 { 0x18, 0x01a1903d },
10936 { }
10937 },
10938 .chained = true,
10939 .chain_id = ALC662_FIXUP_USI_FUNC
10940 },
10941 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10942 .type = HDA_FIXUP_FUNC,
10943 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10944 },
10945 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10946 .type = HDA_FIXUP_FUNC,
10947 .v.func = alc662_fixup_aspire_ethos_hp,
10948 },
10949 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10950 .type = HDA_FIXUP_PINS,
10951 .v.pins = (const struct hda_pintbl[]) {
10952 { 0x15, 0x92130110 }, /* front speakers */
10953 { 0x18, 0x99130111 }, /* center/subwoofer */
10954 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10955 { }
10956 },
10957 .chained = true,
10958 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
10959 },
10960 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10961 .type = HDA_FIXUP_FUNC,
10962 .v.func = alc671_fixup_hp_headset_mic2,
10963 },
10964 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10965 .type = HDA_FIXUP_PINS,
10966 .v.pins = (const struct hda_pintbl[]) {
10967 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10968 { }
10969 },
10970 .chained = true,
10971 .chain_id = ALC662_FIXUP_USI_FUNC
10972 },
10973 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10974 .type = HDA_FIXUP_PINS,
10975 .v.pins = (const struct hda_pintbl[]) {
10976 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10977 { 0x1b, 0x0221144f },
10978 { }
10979 },
10980 .chained = true,
10981 .chain_id = ALC662_FIXUP_USI_FUNC
10982 },
10983 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10984 .type = HDA_FIXUP_PINS,
10985 .v.pins = (const struct hda_pintbl[]) {
10986 { 0x1b, 0x04a1112c },
10987 { }
10988 },
10989 .chained = true,
10990 .chain_id = ALC668_FIXUP_HEADSET_MIC
10991 },
10992 [ALC668_FIXUP_HEADSET_MIC] = {
10993 .type = HDA_FIXUP_FUNC,
10994 .v.func = alc269_fixup_headset_mic,
10995 .chained = true,
10996 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10997 },
10998 [ALC668_FIXUP_MIC_DET_COEF] = {
10999 .type = HDA_FIXUP_VERBS,
11000 .v.verbs = (const struct hda_verb[]) {
11001 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
11002 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
11003 {}
11004 },
11005 },
11006 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
11007 .type = HDA_FIXUP_FUNC,
11008 .v.func = alc897_fixup_lenovo_headset_mic,
11009 },
11010 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
11011 .type = HDA_FIXUP_PINS,
11012 .v.pins = (const struct hda_pintbl[]) {
11013 { 0x1a, 0x03a11050 },
11014 { }
11015 },
11016 .chained = true,
11017 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
11018 },
11019 [ALC897_FIXUP_HP_HSMIC_VERB] = {
11020 .type = HDA_FIXUP_PINS,
11021 .v.pins = (const struct hda_pintbl[]) {
11022 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
11023 { }
11024 },
11025 },
11026 };
11027
11028 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
11029 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
11030 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
11031 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
11032 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
11033 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
11034 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
11035 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
11036 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
11037 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
11038 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
11039 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
11040 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11041 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11042 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
11043 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
11044 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
11045 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11046 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11047 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11048 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11049 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11050 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
11051 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
11052 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
11053 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
11054 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
11055 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
11056 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
11057 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11058 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
11059 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
11060 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
11061 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
11062 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11063 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
11064 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
11065 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
11066 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
11067 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
11068 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
11069 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
11070 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
11071 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
11072 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
11073 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
11074 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11075 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11076 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11077 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
11078 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
11079 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
11080 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
11081 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
11082 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
11083 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
11084 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
11085
11086 #if 0
11087 /* Below is a quirk table taken from the old code.
11088 * Basically the device should work as is without the fixup table.
11089 * If BIOS doesn't give a proper info, enable the corresponding
11090 * fixup entry.
11091 */
11092 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11093 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11094 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11095 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11096 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11097 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11098 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11099 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11100 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11101 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11102 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11103 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11104 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11105 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11106 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11107 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11108 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11109 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11110 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11111 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11112 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11113 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11114 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11115 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11116 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11117 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11118 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11119 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11120 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11121 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11122 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11123 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11124 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11125 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11126 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11127 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11128 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11129 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11130 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11131 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11132 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11133 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11134 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11135 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11136 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11137 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11138 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11139 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11140 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11141 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11142 #endif
11143 {}
11144 };
11145
11146 static const struct hda_model_fixup alc662_fixup_models[] = {
11147 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11148 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
11149 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
11150 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
11151 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11152 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11153 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11154 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11155 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11156 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11157 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11158 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
11159 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
11160 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
11161 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
11162 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11163 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11164 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11165 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11166 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11167 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11168 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11169 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11170 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
11171 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
11172 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11173 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11174 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11175 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11176 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
11177 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11178 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
11179 {}
11180 };
11181
11182 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
11183 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11184 {0x17, 0x02211010},
11185 {0x18, 0x01a19030},
11186 {0x1a, 0x01813040},
11187 {0x21, 0x01014020}),
11188 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11189 {0x16, 0x01813030},
11190 {0x17, 0x02211010},
11191 {0x18, 0x01a19040},
11192 {0x21, 0x01014020}),
11193 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11194 {0x14, 0x01014010},
11195 {0x18, 0x01a19020},
11196 {0x1a, 0x0181302f},
11197 {0x1b, 0x0221401f}),
11198 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11199 {0x12, 0x99a30130},
11200 {0x14, 0x90170110},
11201 {0x15, 0x0321101f},
11202 {0x16, 0x03011020}),
11203 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11204 {0x12, 0x99a30140},
11205 {0x14, 0x90170110},
11206 {0x15, 0x0321101f},
11207 {0x16, 0x03011020}),
11208 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11209 {0x12, 0x99a30150},
11210 {0x14, 0x90170110},
11211 {0x15, 0x0321101f},
11212 {0x16, 0x03011020}),
11213 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11214 {0x14, 0x90170110},
11215 {0x15, 0x0321101f},
11216 {0x16, 0x03011020}),
11217 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11218 {0x12, 0x90a60130},
11219 {0x14, 0x90170110},
11220 {0x15, 0x0321101f}),
11221 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11222 {0x14, 0x01014010},
11223 {0x17, 0x90170150},
11224 {0x19, 0x02a11060},
11225 {0x1b, 0x01813030},
11226 {0x21, 0x02211020}),
11227 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11228 {0x14, 0x01014010},
11229 {0x18, 0x01a19040},
11230 {0x1b, 0x01813030},
11231 {0x21, 0x02211020}),
11232 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11233 {0x14, 0x01014020},
11234 {0x17, 0x90170110},
11235 {0x18, 0x01a19050},
11236 {0x1b, 0x01813040},
11237 {0x21, 0x02211030}),
11238 {}
11239 };
11240
11241 /*
11242 */
patch_alc662(struct hda_codec * codec)11243 static int patch_alc662(struct hda_codec *codec)
11244 {
11245 struct alc_spec *spec;
11246 int err;
11247
11248 err = alc_alloc_spec(codec, 0x0b);
11249 if (err < 0)
11250 return err;
11251
11252 spec = codec->spec;
11253
11254 spec->shutup = alc_eapd_shutup;
11255
11256 /* handle multiple HPs as is */
11257 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11258
11259 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11260
11261 switch (codec->core.vendor_id) {
11262 case 0x10ec0668:
11263 spec->init_hook = alc668_restore_default_value;
11264 break;
11265 }
11266
11267 alc_pre_init(codec);
11268
11269 snd_hda_pick_fixup(codec, alc662_fixup_models,
11270 alc662_fixup_tbl, alc662_fixups);
11271 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
11272 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11273
11274 alc_auto_parse_customize_define(codec);
11275
11276 if (has_cdefine_beep(codec))
11277 spec->gen.beep_nid = 0x01;
11278
11279 if ((alc_get_coef0(codec) & (1 << 14)) &&
11280 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
11281 spec->cdefine.platform_type == 1) {
11282 err = alc_codec_rename(codec, "ALC272X");
11283 if (err < 0)
11284 goto error;
11285 }
11286
11287 /* automatic parse from the BIOS config */
11288 err = alc662_parse_auto_config(codec);
11289 if (err < 0)
11290 goto error;
11291
11292 if (!spec->gen.no_analog && spec->gen.beep_nid) {
11293 switch (codec->core.vendor_id) {
11294 case 0x10ec0662:
11295 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11296 break;
11297 case 0x10ec0272:
11298 case 0x10ec0663:
11299 case 0x10ec0665:
11300 case 0x10ec0668:
11301 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
11302 break;
11303 case 0x10ec0273:
11304 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
11305 break;
11306 }
11307 if (err < 0)
11308 goto error;
11309 }
11310
11311 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11312
11313 return 0;
11314
11315 error:
11316 alc_free(codec);
11317 return err;
11318 }
11319
11320 /*
11321 * ALC680 support
11322 */
11323
alc680_parse_auto_config(struct hda_codec * codec)11324 static int alc680_parse_auto_config(struct hda_codec *codec)
11325 {
11326 return alc_parse_auto_config(codec, NULL, NULL);
11327 }
11328
11329 /*
11330 */
patch_alc680(struct hda_codec * codec)11331 static int patch_alc680(struct hda_codec *codec)
11332 {
11333 int err;
11334
11335 /* ALC680 has no aa-loopback mixer */
11336 err = alc_alloc_spec(codec, 0);
11337 if (err < 0)
11338 return err;
11339
11340 /* automatic parse from the BIOS config */
11341 err = alc680_parse_auto_config(codec);
11342 if (err < 0) {
11343 alc_free(codec);
11344 return err;
11345 }
11346
11347 return 0;
11348 }
11349
11350 /*
11351 * patch entries
11352 */
11353 static const struct hda_device_id snd_hda_id_realtek[] = {
11354 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
11355 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
11356 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
11357 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
11358 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
11359 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11360 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
11361 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
11362 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
11363 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
11364 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
11365 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11366 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
11367 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
11368 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11369 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11370 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11371 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11372 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11373 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11374 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
11375 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
11376 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11377 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11378 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11379 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11380 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11381 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
11382 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
11383 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
11384 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
11385 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
11386 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
11387 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11388 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11389 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
11390 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
11391 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
11392 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
11393 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
11394 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
11395 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
11396 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11397 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11398 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11399 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11400 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11401 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11402 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11403 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11404 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11405 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11406 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11407 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11408 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11409 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
11410 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11411 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11412 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
11413 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
11414 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
11415 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11416 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11417 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11418 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11419 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11420 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11421 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11422 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11423 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11424 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11425 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
11426 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
11427 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11428 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
11429 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
11430 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
11431 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
11432 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
11433 {} /* terminator */
11434 };
11435 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
11436
11437 MODULE_LICENSE("GPL");
11438 MODULE_DESCRIPTION("Realtek HD-audio codec");
11439
11440 static struct hda_codec_driver realtek_driver = {
11441 .id = snd_hda_id_realtek,
11442 };
11443
11444 module_hda_codec_driver(realtek_driver);
11445