]> git.ipfire.org Git - thirdparty/linux.git/blob - sound/pci/hda/patch_realtek.c
Linux 6.7-rc2
[thirdparty/linux.git] / sound / pci / hda / patch_realtek.c
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/acpi.h>
14 #include <linux/init.h>
15 #include <linux/delay.h>
16 #include <linux/slab.h>
17 #include <linux/pci.h>
18 #include <linux/dmi.h>
19 #include <linux/module.h>
20 #include <linux/input.h>
21 #include <linux/leds.h>
22 #include <linux/ctype.h>
23 #include <sound/core.h>
24 #include <sound/jack.h>
25 #include <sound/hda_codec.h>
26 #include "hda_local.h"
27 #include "hda_auto_parser.h"
28 #include "hda_jack.h"
29 #include "hda_generic.h"
30 #include "hda_component.h"
31
32 /* keep halting ALC5505 DSP, for power saving */
33 #define HALT_REALTEK_ALC5505
34
35 /* extra amp-initialization sequence types */
36 enum {
37 ALC_INIT_UNDEFINED,
38 ALC_INIT_NONE,
39 ALC_INIT_DEFAULT,
40 };
41
42 enum {
43 ALC_HEADSET_MODE_UNKNOWN,
44 ALC_HEADSET_MODE_UNPLUGGED,
45 ALC_HEADSET_MODE_HEADSET,
46 ALC_HEADSET_MODE_MIC,
47 ALC_HEADSET_MODE_HEADPHONE,
48 };
49
50 enum {
51 ALC_HEADSET_TYPE_UNKNOWN,
52 ALC_HEADSET_TYPE_CTIA,
53 ALC_HEADSET_TYPE_OMTP,
54 };
55
56 enum {
57 ALC_KEY_MICMUTE_INDEX,
58 };
59
60 struct alc_customize_define {
61 unsigned int sku_cfg;
62 unsigned char port_connectivity;
63 unsigned char check_sum;
64 unsigned char customization;
65 unsigned char external_amp;
66 unsigned int enable_pcbeep:1;
67 unsigned int platform_type:1;
68 unsigned int swap:1;
69 unsigned int override:1;
70 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
71 };
72
73 struct alc_coef_led {
74 unsigned int idx;
75 unsigned int mask;
76 unsigned int on;
77 unsigned int off;
78 };
79
80 struct alc_spec {
81 struct hda_gen_spec gen; /* must be at head */
82
83 /* codec parameterization */
84 struct alc_customize_define cdefine;
85 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
86
87 /* GPIO bits */
88 unsigned int gpio_mask;
89 unsigned int gpio_dir;
90 unsigned int gpio_data;
91 bool gpio_write_delay; /* add a delay before writing gpio_data */
92
93 /* mute LED for HP laptops, see vref_mute_led_set() */
94 int mute_led_polarity;
95 int micmute_led_polarity;
96 hda_nid_t mute_led_nid;
97 hda_nid_t cap_mute_led_nid;
98
99 unsigned int gpio_mute_led_mask;
100 unsigned int gpio_mic_led_mask;
101 struct alc_coef_led mute_led_coef;
102 struct alc_coef_led mic_led_coef;
103 struct mutex coef_mutex;
104
105 hda_nid_t headset_mic_pin;
106 hda_nid_t headphone_mic_pin;
107 int current_headset_mode;
108 int current_headset_type;
109
110 /* hooks */
111 void (*init_hook)(struct hda_codec *codec);
112 #ifdef CONFIG_PM
113 void (*power_hook)(struct hda_codec *codec);
114 #endif
115 void (*shutup)(struct hda_codec *codec);
116
117 int init_amp;
118 int codec_variant; /* flag for other variants */
119 unsigned int has_alc5505_dsp:1;
120 unsigned int no_depop_delay:1;
121 unsigned int done_hp_init:1;
122 unsigned int no_shutup_pins:1;
123 unsigned int ultra_low_power:1;
124 unsigned int has_hs_key:1;
125 unsigned int no_internal_mic_pin:1;
126 unsigned int en_3kpull_low:1;
127
128 /* for PLL fix */
129 hda_nid_t pll_nid;
130 unsigned int pll_coef_idx, pll_coef_bit;
131 unsigned int coef0;
132 struct input_dev *kb_dev;
133 u8 alc_mute_keycode_map[1];
134
135 /* component binding */
136 struct component_match *match;
137 struct hda_component comps[HDA_MAX_COMPONENTS];
138 };
139
140 /*
141 * COEF access helper functions
142 */
143
144 static void coef_mutex_lock(struct hda_codec *codec)
145 {
146 struct alc_spec *spec = codec->spec;
147
148 snd_hda_power_up_pm(codec);
149 mutex_lock(&spec->coef_mutex);
150 }
151
152 static void coef_mutex_unlock(struct hda_codec *codec)
153 {
154 struct alc_spec *spec = codec->spec;
155
156 mutex_unlock(&spec->coef_mutex);
157 snd_hda_power_down_pm(codec);
158 }
159
160 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
161 unsigned int coef_idx)
162 {
163 unsigned int val;
164
165 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
166 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
167 return val;
168 }
169
170 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
171 unsigned int coef_idx)
172 {
173 unsigned int val;
174
175 coef_mutex_lock(codec);
176 val = __alc_read_coefex_idx(codec, nid, coef_idx);
177 coef_mutex_unlock(codec);
178 return val;
179 }
180
181 #define alc_read_coef_idx(codec, coef_idx) \
182 alc_read_coefex_idx(codec, 0x20, coef_idx)
183
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 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
188 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
189 }
190
191 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
192 unsigned int coef_idx, unsigned int coef_val)
193 {
194 coef_mutex_lock(codec);
195 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
196 coef_mutex_unlock(codec);
197 }
198
199 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
200 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
201
202 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
203 unsigned int coef_idx, unsigned int mask,
204 unsigned int bits_set)
205 {
206 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
207
208 if (val != -1)
209 __alc_write_coefex_idx(codec, nid, coef_idx,
210 (val & ~mask) | bits_set);
211 }
212
213 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
214 unsigned int coef_idx, unsigned int mask,
215 unsigned int bits_set)
216 {
217 coef_mutex_lock(codec);
218 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
219 coef_mutex_unlock(codec);
220 }
221
222 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
223 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
224
225 /* a special bypass for COEF 0; read the cached value at the second time */
226 static unsigned int alc_get_coef0(struct hda_codec *codec)
227 {
228 struct alc_spec *spec = codec->spec;
229
230 if (!spec->coef0)
231 spec->coef0 = alc_read_coef_idx(codec, 0);
232 return spec->coef0;
233 }
234
235 /* coef writes/updates batch */
236 struct coef_fw {
237 unsigned char nid;
238 unsigned char idx;
239 unsigned short mask;
240 unsigned short val;
241 };
242
243 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
244 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
245 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
246 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
247 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
248
249 static void alc_process_coef_fw(struct hda_codec *codec,
250 const struct coef_fw *fw)
251 {
252 coef_mutex_lock(codec);
253 for (; fw->nid; fw++) {
254 if (fw->mask == (unsigned short)-1)
255 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
256 else
257 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
258 fw->mask, fw->val);
259 }
260 coef_mutex_unlock(codec);
261 }
262
263 /*
264 * GPIO setup tables, used in initialization
265 */
266
267 /* Enable GPIO mask and set output */
268 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
269 {
270 struct alc_spec *spec = codec->spec;
271
272 spec->gpio_mask |= mask;
273 spec->gpio_dir |= mask;
274 spec->gpio_data |= mask;
275 }
276
277 static void alc_write_gpio_data(struct hda_codec *codec)
278 {
279 struct alc_spec *spec = codec->spec;
280
281 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
282 spec->gpio_data);
283 }
284
285 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
286 bool on)
287 {
288 struct alc_spec *spec = codec->spec;
289 unsigned int oldval = spec->gpio_data;
290
291 if (on)
292 spec->gpio_data |= mask;
293 else
294 spec->gpio_data &= ~mask;
295 if (oldval != spec->gpio_data)
296 alc_write_gpio_data(codec);
297 }
298
299 static void alc_write_gpio(struct hda_codec *codec)
300 {
301 struct alc_spec *spec = codec->spec;
302
303 if (!spec->gpio_mask)
304 return;
305
306 snd_hda_codec_write(codec, codec->core.afg, 0,
307 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
308 snd_hda_codec_write(codec, codec->core.afg, 0,
309 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
310 if (spec->gpio_write_delay)
311 msleep(1);
312 alc_write_gpio_data(codec);
313 }
314
315 static void alc_fixup_gpio(struct hda_codec *codec, int action,
316 unsigned int mask)
317 {
318 if (action == HDA_FIXUP_ACT_PRE_PROBE)
319 alc_setup_gpio(codec, mask);
320 }
321
322 static void alc_fixup_gpio1(struct hda_codec *codec,
323 const struct hda_fixup *fix, int action)
324 {
325 alc_fixup_gpio(codec, action, 0x01);
326 }
327
328 static void alc_fixup_gpio2(struct hda_codec *codec,
329 const struct hda_fixup *fix, int action)
330 {
331 alc_fixup_gpio(codec, action, 0x02);
332 }
333
334 static void alc_fixup_gpio3(struct hda_codec *codec,
335 const struct hda_fixup *fix, int action)
336 {
337 alc_fixup_gpio(codec, action, 0x03);
338 }
339
340 static void alc_fixup_gpio4(struct hda_codec *codec,
341 const struct hda_fixup *fix, int action)
342 {
343 alc_fixup_gpio(codec, action, 0x04);
344 }
345
346 static void alc_fixup_micmute_led(struct hda_codec *codec,
347 const struct hda_fixup *fix, int action)
348 {
349 if (action == HDA_FIXUP_ACT_PRE_PROBE)
350 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
351 }
352
353 /*
354 * Fix hardware PLL issue
355 * On some codecs, the analog PLL gating control must be off while
356 * the default value is 1.
357 */
358 static void alc_fix_pll(struct hda_codec *codec)
359 {
360 struct alc_spec *spec = codec->spec;
361
362 if (spec->pll_nid)
363 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
364 1 << spec->pll_coef_bit, 0);
365 }
366
367 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
368 unsigned int coef_idx, unsigned int coef_bit)
369 {
370 struct alc_spec *spec = codec->spec;
371 spec->pll_nid = nid;
372 spec->pll_coef_idx = coef_idx;
373 spec->pll_coef_bit = coef_bit;
374 alc_fix_pll(codec);
375 }
376
377 /* update the master volume per volume-knob's unsol event */
378 static void alc_update_knob_master(struct hda_codec *codec,
379 struct hda_jack_callback *jack)
380 {
381 unsigned int val;
382 struct snd_kcontrol *kctl;
383 struct snd_ctl_elem_value *uctl;
384
385 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
386 if (!kctl)
387 return;
388 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
389 if (!uctl)
390 return;
391 val = snd_hda_codec_read(codec, jack->nid, 0,
392 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
393 val &= HDA_AMP_VOLMASK;
394 uctl->value.integer.value[0] = val;
395 uctl->value.integer.value[1] = val;
396 kctl->put(kctl, uctl);
397 kfree(uctl);
398 }
399
400 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
401 {
402 /* For some reason, the res given from ALC880 is broken.
403 Here we adjust it properly. */
404 snd_hda_jack_unsol_event(codec, res >> 2);
405 }
406
407 /* Change EAPD to verb control */
408 static void alc_fill_eapd_coef(struct hda_codec *codec)
409 {
410 int coef;
411
412 coef = alc_get_coef0(codec);
413
414 switch (codec->core.vendor_id) {
415 case 0x10ec0262:
416 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
417 break;
418 case 0x10ec0267:
419 case 0x10ec0268:
420 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
421 break;
422 case 0x10ec0269:
423 if ((coef & 0x00f0) == 0x0010)
424 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
425 if ((coef & 0x00f0) == 0x0020)
426 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
427 if ((coef & 0x00f0) == 0x0030)
428 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
429 break;
430 case 0x10ec0280:
431 case 0x10ec0284:
432 case 0x10ec0290:
433 case 0x10ec0292:
434 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
435 break;
436 case 0x10ec0225:
437 case 0x10ec0295:
438 case 0x10ec0299:
439 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
440 fallthrough;
441 case 0x10ec0215:
442 case 0x10ec0230:
443 case 0x10ec0233:
444 case 0x10ec0235:
445 case 0x10ec0236:
446 case 0x10ec0245:
447 case 0x10ec0255:
448 case 0x10ec0256:
449 case 0x19e58326:
450 case 0x10ec0257:
451 case 0x10ec0282:
452 case 0x10ec0283:
453 case 0x10ec0286:
454 case 0x10ec0288:
455 case 0x10ec0285:
456 case 0x10ec0298:
457 case 0x10ec0289:
458 case 0x10ec0300:
459 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
460 break;
461 case 0x10ec0275:
462 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
463 break;
464 case 0x10ec0287:
465 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
466 alc_write_coef_idx(codec, 0x8, 0x4ab7);
467 break;
468 case 0x10ec0293:
469 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
470 break;
471 case 0x10ec0234:
472 case 0x10ec0274:
473 case 0x10ec0294:
474 case 0x10ec0700:
475 case 0x10ec0701:
476 case 0x10ec0703:
477 case 0x10ec0711:
478 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
479 break;
480 case 0x10ec0662:
481 if ((coef & 0x00f0) == 0x0030)
482 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
483 break;
484 case 0x10ec0272:
485 case 0x10ec0273:
486 case 0x10ec0663:
487 case 0x10ec0665:
488 case 0x10ec0670:
489 case 0x10ec0671:
490 case 0x10ec0672:
491 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
492 break;
493 case 0x10ec0222:
494 case 0x10ec0623:
495 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
496 break;
497 case 0x10ec0668:
498 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
499 break;
500 case 0x10ec0867:
501 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
502 break;
503 case 0x10ec0888:
504 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
505 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
506 break;
507 case 0x10ec0892:
508 case 0x10ec0897:
509 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
510 break;
511 case 0x10ec0899:
512 case 0x10ec0900:
513 case 0x10ec0b00:
514 case 0x10ec1168:
515 case 0x10ec1220:
516 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
517 break;
518 }
519 }
520
521 /* additional initialization for ALC888 variants */
522 static void alc888_coef_init(struct hda_codec *codec)
523 {
524 switch (alc_get_coef0(codec) & 0x00f0) {
525 /* alc888-VA */
526 case 0x00:
527 /* alc888-VB */
528 case 0x10:
529 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
530 break;
531 }
532 }
533
534 /* turn on/off EAPD control (only if available) */
535 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
536 {
537 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
538 return;
539 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
540 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
541 on ? 2 : 0);
542 }
543
544 /* turn on/off EAPD controls of the codec */
545 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
546 {
547 /* We currently only handle front, HP */
548 static const hda_nid_t pins[] = {
549 0x0f, 0x10, 0x14, 0x15, 0x17, 0
550 };
551 const hda_nid_t *p;
552 for (p = pins; *p; p++)
553 set_eapd(codec, *p, on);
554 }
555
556 static int find_ext_mic_pin(struct hda_codec *codec);
557
558 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
559 {
560 const struct hda_pincfg *pin;
561 int mic_pin = find_ext_mic_pin(codec);
562 int i;
563
564 /* don't shut up pins when unloading the driver; otherwise it breaks
565 * the default pin setup at the next load of the driver
566 */
567 if (codec->bus->shutdown)
568 return;
569
570 snd_array_for_each(&codec->init_pins, i, pin) {
571 /* use read here for syncing after issuing each verb */
572 if (pin->nid != mic_pin)
573 snd_hda_codec_read(codec, pin->nid, 0,
574 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
575 }
576
577 codec->pins_shutup = 1;
578 }
579
580 static void alc_shutup_pins(struct hda_codec *codec)
581 {
582 struct alc_spec *spec = codec->spec;
583
584 switch (codec->core.vendor_id) {
585 case 0x10ec0236:
586 case 0x10ec0256:
587 case 0x19e58326:
588 case 0x10ec0283:
589 case 0x10ec0286:
590 case 0x10ec0288:
591 case 0x10ec0298:
592 alc_headset_mic_no_shutup(codec);
593 break;
594 default:
595 if (!spec->no_shutup_pins)
596 snd_hda_shutup_pins(codec);
597 break;
598 }
599 }
600
601 /* generic shutup callback;
602 * just turning off EAPD and a little pause for avoiding pop-noise
603 */
604 static void alc_eapd_shutup(struct hda_codec *codec)
605 {
606 struct alc_spec *spec = codec->spec;
607
608 alc_auto_setup_eapd(codec, false);
609 if (!spec->no_depop_delay)
610 msleep(200);
611 alc_shutup_pins(codec);
612 }
613
614 /* generic EAPD initialization */
615 static void alc_auto_init_amp(struct hda_codec *codec, int type)
616 {
617 alc_auto_setup_eapd(codec, true);
618 alc_write_gpio(codec);
619 switch (type) {
620 case ALC_INIT_DEFAULT:
621 switch (codec->core.vendor_id) {
622 case 0x10ec0260:
623 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
624 break;
625 case 0x10ec0880:
626 case 0x10ec0882:
627 case 0x10ec0883:
628 case 0x10ec0885:
629 alc_update_coef_idx(codec, 7, 0, 0x2030);
630 break;
631 case 0x10ec0888:
632 alc888_coef_init(codec);
633 break;
634 }
635 break;
636 }
637 }
638
639 /* get a primary headphone pin if available */
640 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
641 {
642 if (spec->gen.autocfg.hp_pins[0])
643 return spec->gen.autocfg.hp_pins[0];
644 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
645 return spec->gen.autocfg.line_out_pins[0];
646 return 0;
647 }
648
649 /*
650 * Realtek SSID verification
651 */
652
653 /* Could be any non-zero and even value. When used as fixup, tells
654 * the driver to ignore any present sku defines.
655 */
656 #define ALC_FIXUP_SKU_IGNORE (2)
657
658 static void alc_fixup_sku_ignore(struct hda_codec *codec,
659 const struct hda_fixup *fix, int action)
660 {
661 struct alc_spec *spec = codec->spec;
662 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
663 spec->cdefine.fixup = 1;
664 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
665 }
666 }
667
668 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
669 const struct hda_fixup *fix, int action)
670 {
671 struct alc_spec *spec = codec->spec;
672
673 if (action == HDA_FIXUP_ACT_PROBE) {
674 spec->no_depop_delay = 1;
675 codec->depop_delay = 0;
676 }
677 }
678
679 static int alc_auto_parse_customize_define(struct hda_codec *codec)
680 {
681 unsigned int ass, tmp, i;
682 unsigned nid = 0;
683 struct alc_spec *spec = codec->spec;
684
685 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
686
687 if (spec->cdefine.fixup) {
688 ass = spec->cdefine.sku_cfg;
689 if (ass == ALC_FIXUP_SKU_IGNORE)
690 return -1;
691 goto do_sku;
692 }
693
694 if (!codec->bus->pci)
695 return -1;
696 ass = codec->core.subsystem_id & 0xffff;
697 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
698 goto do_sku;
699
700 nid = 0x1d;
701 if (codec->core.vendor_id == 0x10ec0260)
702 nid = 0x17;
703 ass = snd_hda_codec_get_pincfg(codec, nid);
704
705 if (!(ass & 1)) {
706 codec_info(codec, "%s: SKU not ready 0x%08x\n",
707 codec->core.chip_name, ass);
708 return -1;
709 }
710
711 /* check sum */
712 tmp = 0;
713 for (i = 1; i < 16; i++) {
714 if ((ass >> i) & 1)
715 tmp++;
716 }
717 if (((ass >> 16) & 0xf) != tmp)
718 return -1;
719
720 spec->cdefine.port_connectivity = ass >> 30;
721 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
722 spec->cdefine.check_sum = (ass >> 16) & 0xf;
723 spec->cdefine.customization = ass >> 8;
724 do_sku:
725 spec->cdefine.sku_cfg = ass;
726 spec->cdefine.external_amp = (ass & 0x38) >> 3;
727 spec->cdefine.platform_type = (ass & 0x4) >> 2;
728 spec->cdefine.swap = (ass & 0x2) >> 1;
729 spec->cdefine.override = ass & 0x1;
730
731 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
732 nid, spec->cdefine.sku_cfg);
733 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
734 spec->cdefine.port_connectivity);
735 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
736 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
737 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
738 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
739 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
740 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
741 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
742
743 return 0;
744 }
745
746 /* return the position of NID in the list, or -1 if not found */
747 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
748 {
749 int i;
750 for (i = 0; i < nums; i++)
751 if (list[i] == nid)
752 return i;
753 return -1;
754 }
755 /* return true if the given NID is found in the list */
756 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
757 {
758 return find_idx_in_nid_list(nid, list, nums) >= 0;
759 }
760
761 /* check subsystem ID and set up device-specific initialization;
762 * return 1 if initialized, 0 if invalid SSID
763 */
764 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
765 * 31 ~ 16 : Manufacture ID
766 * 15 ~ 8 : SKU ID
767 * 7 ~ 0 : Assembly ID
768 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
769 */
770 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
771 {
772 unsigned int ass, tmp, i;
773 unsigned nid;
774 struct alc_spec *spec = codec->spec;
775
776 if (spec->cdefine.fixup) {
777 ass = spec->cdefine.sku_cfg;
778 if (ass == ALC_FIXUP_SKU_IGNORE)
779 return 0;
780 goto do_sku;
781 }
782
783 ass = codec->core.subsystem_id & 0xffff;
784 if (codec->bus->pci &&
785 ass != codec->bus->pci->subsystem_device && (ass & 1))
786 goto do_sku;
787
788 /* invalid SSID, check the special NID pin defcfg instead */
789 /*
790 * 31~30 : port connectivity
791 * 29~21 : reserve
792 * 20 : PCBEEP input
793 * 19~16 : Check sum (15:1)
794 * 15~1 : Custom
795 * 0 : override
796 */
797 nid = 0x1d;
798 if (codec->core.vendor_id == 0x10ec0260)
799 nid = 0x17;
800 ass = snd_hda_codec_get_pincfg(codec, nid);
801 codec_dbg(codec,
802 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
803 ass, nid);
804 if (!(ass & 1))
805 return 0;
806 if ((ass >> 30) != 1) /* no physical connection */
807 return 0;
808
809 /* check sum */
810 tmp = 0;
811 for (i = 1; i < 16; i++) {
812 if ((ass >> i) & 1)
813 tmp++;
814 }
815 if (((ass >> 16) & 0xf) != tmp)
816 return 0;
817 do_sku:
818 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
819 ass & 0xffff, codec->core.vendor_id);
820 /*
821 * 0 : override
822 * 1 : Swap Jack
823 * 2 : 0 --> Desktop, 1 --> Laptop
824 * 3~5 : External Amplifier control
825 * 7~6 : Reserved
826 */
827 tmp = (ass & 0x38) >> 3; /* external Amp control */
828 if (spec->init_amp == ALC_INIT_UNDEFINED) {
829 switch (tmp) {
830 case 1:
831 alc_setup_gpio(codec, 0x01);
832 break;
833 case 3:
834 alc_setup_gpio(codec, 0x02);
835 break;
836 case 7:
837 alc_setup_gpio(codec, 0x04);
838 break;
839 case 5:
840 default:
841 spec->init_amp = ALC_INIT_DEFAULT;
842 break;
843 }
844 }
845
846 /* is laptop or Desktop and enable the function "Mute internal speaker
847 * when the external headphone out jack is plugged"
848 */
849 if (!(ass & 0x8000))
850 return 1;
851 /*
852 * 10~8 : Jack location
853 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
854 * 14~13: Resvered
855 * 15 : 1 --> enable the function "Mute internal speaker
856 * when the external headphone out jack is plugged"
857 */
858 if (!alc_get_hp_pin(spec)) {
859 hda_nid_t nid;
860 tmp = (ass >> 11) & 0x3; /* HP to chassis */
861 nid = ports[tmp];
862 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
863 spec->gen.autocfg.line_outs))
864 return 1;
865 spec->gen.autocfg.hp_pins[0] = nid;
866 }
867 return 1;
868 }
869
870 /* Check the validity of ALC subsystem-id
871 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
872 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
873 {
874 if (!alc_subsystem_id(codec, ports)) {
875 struct alc_spec *spec = codec->spec;
876 if (spec->init_amp == ALC_INIT_UNDEFINED) {
877 codec_dbg(codec,
878 "realtek: Enable default setup for auto mode as fallback\n");
879 spec->init_amp = ALC_INIT_DEFAULT;
880 }
881 }
882 }
883
884 /*
885 */
886
887 static void alc_fixup_inv_dmic(struct hda_codec *codec,
888 const struct hda_fixup *fix, int action)
889 {
890 struct alc_spec *spec = codec->spec;
891
892 spec->gen.inv_dmic_split = 1;
893 }
894
895
896 static int alc_build_controls(struct hda_codec *codec)
897 {
898 int err;
899
900 err = snd_hda_gen_build_controls(codec);
901 if (err < 0)
902 return err;
903
904 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
905 return 0;
906 }
907
908
909 /*
910 * Common callbacks
911 */
912
913 static void alc_pre_init(struct hda_codec *codec)
914 {
915 alc_fill_eapd_coef(codec);
916 }
917
918 #define is_s3_resume(codec) \
919 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
920 #define is_s4_resume(codec) \
921 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
922
923 static int alc_init(struct hda_codec *codec)
924 {
925 struct alc_spec *spec = codec->spec;
926
927 /* hibernation resume needs the full chip initialization */
928 if (is_s4_resume(codec))
929 alc_pre_init(codec);
930
931 if (spec->init_hook)
932 spec->init_hook(codec);
933
934 spec->gen.skip_verbs = 1; /* applied in below */
935 snd_hda_gen_init(codec);
936 alc_fix_pll(codec);
937 alc_auto_init_amp(codec, spec->init_amp);
938 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
939
940 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
941
942 return 0;
943 }
944
945 #define alc_free snd_hda_gen_free
946
947 #ifdef CONFIG_PM
948 static inline void alc_shutup(struct hda_codec *codec)
949 {
950 struct alc_spec *spec = codec->spec;
951
952 if (!snd_hda_get_bool_hint(codec, "shutup"))
953 return; /* disabled explicitly by hints */
954
955 if (spec && spec->shutup)
956 spec->shutup(codec);
957 else
958 alc_shutup_pins(codec);
959 }
960
961 static void alc_power_eapd(struct hda_codec *codec)
962 {
963 alc_auto_setup_eapd(codec, false);
964 }
965
966 static int alc_suspend(struct hda_codec *codec)
967 {
968 struct alc_spec *spec = codec->spec;
969 alc_shutup(codec);
970 if (spec && spec->power_hook)
971 spec->power_hook(codec);
972 return 0;
973 }
974
975 static int alc_resume(struct hda_codec *codec)
976 {
977 struct alc_spec *spec = codec->spec;
978
979 if (!spec->no_depop_delay)
980 msleep(150); /* to avoid pop noise */
981 codec->patch_ops.init(codec);
982 snd_hda_regmap_sync(codec);
983 hda_call_check_power_status(codec, 0x01);
984 return 0;
985 }
986 #endif
987
988 /*
989 */
990 static const struct hda_codec_ops alc_patch_ops = {
991 .build_controls = alc_build_controls,
992 .build_pcms = snd_hda_gen_build_pcms,
993 .init = alc_init,
994 .free = alc_free,
995 .unsol_event = snd_hda_jack_unsol_event,
996 #ifdef CONFIG_PM
997 .resume = alc_resume,
998 .suspend = alc_suspend,
999 .check_power_status = snd_hda_gen_check_power_status,
1000 #endif
1001 };
1002
1003
1004 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1005
1006 /*
1007 * Rename codecs appropriately from COEF value or subvendor id
1008 */
1009 struct alc_codec_rename_table {
1010 unsigned int vendor_id;
1011 unsigned short coef_mask;
1012 unsigned short coef_bits;
1013 const char *name;
1014 };
1015
1016 struct alc_codec_rename_pci_table {
1017 unsigned int codec_vendor_id;
1018 unsigned short pci_subvendor;
1019 unsigned short pci_subdevice;
1020 const char *name;
1021 };
1022
1023 static const struct alc_codec_rename_table rename_tbl[] = {
1024 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1025 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1026 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1027 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1028 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1029 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1030 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1031 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1032 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1033 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1034 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1035 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1036 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1037 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1038 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1039 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1040 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1041 { } /* terminator */
1042 };
1043
1044 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1045 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1046 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1047 { 0x10ec0283, 0x1028, 0, "ALC3223" },
1048 { 0x10ec0288, 0x1028, 0, "ALC3263" },
1049 { 0x10ec0292, 0x1028, 0, "ALC3226" },
1050 { 0x10ec0293, 0x1028, 0, "ALC3235" },
1051 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1052 { 0x10ec0668, 0x1028, 0, "ALC3661" },
1053 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1054 { 0x10ec0899, 0x1028, 0, "ALC3861" },
1055 { 0x10ec0298, 0x1028, 0, "ALC3266" },
1056 { 0x10ec0236, 0x1028, 0, "ALC3204" },
1057 { 0x10ec0256, 0x1028, 0, "ALC3246" },
1058 { 0x10ec0225, 0x1028, 0, "ALC3253" },
1059 { 0x10ec0295, 0x1028, 0, "ALC3254" },
1060 { 0x10ec0299, 0x1028, 0, "ALC3271" },
1061 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1062 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1063 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1064 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1065 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1066 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1067 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1068 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1069 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1070 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1071 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
1072 { } /* terminator */
1073 };
1074
1075 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1076 {
1077 const struct alc_codec_rename_table *p;
1078 const struct alc_codec_rename_pci_table *q;
1079
1080 for (p = rename_tbl; p->vendor_id; p++) {
1081 if (p->vendor_id != codec->core.vendor_id)
1082 continue;
1083 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1084 return alc_codec_rename(codec, p->name);
1085 }
1086
1087 if (!codec->bus->pci)
1088 return 0;
1089 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1090 if (q->codec_vendor_id != codec->core.vendor_id)
1091 continue;
1092 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1093 continue;
1094 if (!q->pci_subdevice ||
1095 q->pci_subdevice == codec->bus->pci->subsystem_device)
1096 return alc_codec_rename(codec, q->name);
1097 }
1098
1099 return 0;
1100 }
1101
1102
1103 /*
1104 * Digital-beep handlers
1105 */
1106 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1107
1108 /* additional beep mixers; private_value will be overwritten */
1109 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1110 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1111 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1112 };
1113
1114 /* set up and create beep controls */
1115 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1116 int idx, int dir)
1117 {
1118 struct snd_kcontrol_new *knew;
1119 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1120 int i;
1121
1122 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1123 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1124 &alc_beep_mixer[i]);
1125 if (!knew)
1126 return -ENOMEM;
1127 knew->private_value = beep_amp;
1128 }
1129 return 0;
1130 }
1131
1132 static const struct snd_pci_quirk beep_allow_list[] = {
1133 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1134 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1135 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1136 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1137 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1138 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1139 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1140 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1141 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1142 /* denylist -- no beep available */
1143 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1144 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1145 {}
1146 };
1147
1148 static inline int has_cdefine_beep(struct hda_codec *codec)
1149 {
1150 struct alc_spec *spec = codec->spec;
1151 const struct snd_pci_quirk *q;
1152 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1153 if (q)
1154 return q->value;
1155 return spec->cdefine.enable_pcbeep;
1156 }
1157 #else
1158 #define set_beep_amp(spec, nid, idx, dir) 0
1159 #define has_cdefine_beep(codec) 0
1160 #endif
1161
1162 /* parse the BIOS configuration and set up the alc_spec */
1163 /* return 1 if successful, 0 if the proper config is not found,
1164 * or a negative error code
1165 */
1166 static int alc_parse_auto_config(struct hda_codec *codec,
1167 const hda_nid_t *ignore_nids,
1168 const hda_nid_t *ssid_nids)
1169 {
1170 struct alc_spec *spec = codec->spec;
1171 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1172 int err;
1173
1174 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1175 spec->parse_flags);
1176 if (err < 0)
1177 return err;
1178
1179 if (ssid_nids)
1180 alc_ssid_check(codec, ssid_nids);
1181
1182 err = snd_hda_gen_parse_auto_config(codec, cfg);
1183 if (err < 0)
1184 return err;
1185
1186 return 1;
1187 }
1188
1189 /* common preparation job for alc_spec */
1190 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1191 {
1192 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1193 int err;
1194
1195 if (!spec)
1196 return -ENOMEM;
1197 codec->spec = spec;
1198 snd_hda_gen_spec_init(&spec->gen);
1199 spec->gen.mixer_nid = mixer_nid;
1200 spec->gen.own_eapd_ctl = 1;
1201 codec->single_adc_amp = 1;
1202 /* FIXME: do we need this for all Realtek codec models? */
1203 codec->spdif_status_reset = 1;
1204 codec->forced_resume = 1;
1205 codec->patch_ops = alc_patch_ops;
1206 mutex_init(&spec->coef_mutex);
1207
1208 err = alc_codec_rename_from_preset(codec);
1209 if (err < 0) {
1210 kfree(spec);
1211 return err;
1212 }
1213 return 0;
1214 }
1215
1216 static int alc880_parse_auto_config(struct hda_codec *codec)
1217 {
1218 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1219 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1220 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1221 }
1222
1223 /*
1224 * ALC880 fix-ups
1225 */
1226 enum {
1227 ALC880_FIXUP_GPIO1,
1228 ALC880_FIXUP_GPIO2,
1229 ALC880_FIXUP_MEDION_RIM,
1230 ALC880_FIXUP_LG,
1231 ALC880_FIXUP_LG_LW25,
1232 ALC880_FIXUP_W810,
1233 ALC880_FIXUP_EAPD_COEF,
1234 ALC880_FIXUP_TCL_S700,
1235 ALC880_FIXUP_VOL_KNOB,
1236 ALC880_FIXUP_FUJITSU,
1237 ALC880_FIXUP_F1734,
1238 ALC880_FIXUP_UNIWILL,
1239 ALC880_FIXUP_UNIWILL_DIG,
1240 ALC880_FIXUP_Z71V,
1241 ALC880_FIXUP_ASUS_W5A,
1242 ALC880_FIXUP_3ST_BASE,
1243 ALC880_FIXUP_3ST,
1244 ALC880_FIXUP_3ST_DIG,
1245 ALC880_FIXUP_5ST_BASE,
1246 ALC880_FIXUP_5ST,
1247 ALC880_FIXUP_5ST_DIG,
1248 ALC880_FIXUP_6ST_BASE,
1249 ALC880_FIXUP_6ST,
1250 ALC880_FIXUP_6ST_DIG,
1251 ALC880_FIXUP_6ST_AUTOMUTE,
1252 };
1253
1254 /* enable the volume-knob widget support on NID 0x21 */
1255 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1256 const struct hda_fixup *fix, int action)
1257 {
1258 if (action == HDA_FIXUP_ACT_PROBE)
1259 snd_hda_jack_detect_enable_callback(codec, 0x21,
1260 alc_update_knob_master);
1261 }
1262
1263 static const struct hda_fixup alc880_fixups[] = {
1264 [ALC880_FIXUP_GPIO1] = {
1265 .type = HDA_FIXUP_FUNC,
1266 .v.func = alc_fixup_gpio1,
1267 },
1268 [ALC880_FIXUP_GPIO2] = {
1269 .type = HDA_FIXUP_FUNC,
1270 .v.func = alc_fixup_gpio2,
1271 },
1272 [ALC880_FIXUP_MEDION_RIM] = {
1273 .type = HDA_FIXUP_VERBS,
1274 .v.verbs = (const struct hda_verb[]) {
1275 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1276 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1277 { }
1278 },
1279 .chained = true,
1280 .chain_id = ALC880_FIXUP_GPIO2,
1281 },
1282 [ALC880_FIXUP_LG] = {
1283 .type = HDA_FIXUP_PINS,
1284 .v.pins = (const struct hda_pintbl[]) {
1285 /* disable bogus unused pins */
1286 { 0x16, 0x411111f0 },
1287 { 0x18, 0x411111f0 },
1288 { 0x1a, 0x411111f0 },
1289 { }
1290 }
1291 },
1292 [ALC880_FIXUP_LG_LW25] = {
1293 .type = HDA_FIXUP_PINS,
1294 .v.pins = (const struct hda_pintbl[]) {
1295 { 0x1a, 0x0181344f }, /* line-in */
1296 { 0x1b, 0x0321403f }, /* headphone */
1297 { }
1298 }
1299 },
1300 [ALC880_FIXUP_W810] = {
1301 .type = HDA_FIXUP_PINS,
1302 .v.pins = (const struct hda_pintbl[]) {
1303 /* disable bogus unused pins */
1304 { 0x17, 0x411111f0 },
1305 { }
1306 },
1307 .chained = true,
1308 .chain_id = ALC880_FIXUP_GPIO2,
1309 },
1310 [ALC880_FIXUP_EAPD_COEF] = {
1311 .type = HDA_FIXUP_VERBS,
1312 .v.verbs = (const struct hda_verb[]) {
1313 /* change to EAPD mode */
1314 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1315 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1316 {}
1317 },
1318 },
1319 [ALC880_FIXUP_TCL_S700] = {
1320 .type = HDA_FIXUP_VERBS,
1321 .v.verbs = (const struct hda_verb[]) {
1322 /* change to EAPD mode */
1323 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1324 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1325 {}
1326 },
1327 .chained = true,
1328 .chain_id = ALC880_FIXUP_GPIO2,
1329 },
1330 [ALC880_FIXUP_VOL_KNOB] = {
1331 .type = HDA_FIXUP_FUNC,
1332 .v.func = alc880_fixup_vol_knob,
1333 },
1334 [ALC880_FIXUP_FUJITSU] = {
1335 /* override all pins as BIOS on old Amilo is broken */
1336 .type = HDA_FIXUP_PINS,
1337 .v.pins = (const struct hda_pintbl[]) {
1338 { 0x14, 0x0121401f }, /* HP */
1339 { 0x15, 0x99030120 }, /* speaker */
1340 { 0x16, 0x99030130 }, /* bass speaker */
1341 { 0x17, 0x411111f0 }, /* N/A */
1342 { 0x18, 0x411111f0 }, /* N/A */
1343 { 0x19, 0x01a19950 }, /* mic-in */
1344 { 0x1a, 0x411111f0 }, /* N/A */
1345 { 0x1b, 0x411111f0 }, /* N/A */
1346 { 0x1c, 0x411111f0 }, /* N/A */
1347 { 0x1d, 0x411111f0 }, /* N/A */
1348 { 0x1e, 0x01454140 }, /* SPDIF out */
1349 { }
1350 },
1351 .chained = true,
1352 .chain_id = ALC880_FIXUP_VOL_KNOB,
1353 },
1354 [ALC880_FIXUP_F1734] = {
1355 /* almost compatible with FUJITSU, but no bass and SPDIF */
1356 .type = HDA_FIXUP_PINS,
1357 .v.pins = (const struct hda_pintbl[]) {
1358 { 0x14, 0x0121401f }, /* HP */
1359 { 0x15, 0x99030120 }, /* speaker */
1360 { 0x16, 0x411111f0 }, /* N/A */
1361 { 0x17, 0x411111f0 }, /* N/A */
1362 { 0x18, 0x411111f0 }, /* N/A */
1363 { 0x19, 0x01a19950 }, /* mic-in */
1364 { 0x1a, 0x411111f0 }, /* N/A */
1365 { 0x1b, 0x411111f0 }, /* N/A */
1366 { 0x1c, 0x411111f0 }, /* N/A */
1367 { 0x1d, 0x411111f0 }, /* N/A */
1368 { 0x1e, 0x411111f0 }, /* N/A */
1369 { }
1370 },
1371 .chained = true,
1372 .chain_id = ALC880_FIXUP_VOL_KNOB,
1373 },
1374 [ALC880_FIXUP_UNIWILL] = {
1375 /* need to fix HP and speaker pins to be parsed correctly */
1376 .type = HDA_FIXUP_PINS,
1377 .v.pins = (const struct hda_pintbl[]) {
1378 { 0x14, 0x0121411f }, /* HP */
1379 { 0x15, 0x99030120 }, /* speaker */
1380 { 0x16, 0x99030130 }, /* bass speaker */
1381 { }
1382 },
1383 },
1384 [ALC880_FIXUP_UNIWILL_DIG] = {
1385 .type = HDA_FIXUP_PINS,
1386 .v.pins = (const struct hda_pintbl[]) {
1387 /* disable bogus unused pins */
1388 { 0x17, 0x411111f0 },
1389 { 0x19, 0x411111f0 },
1390 { 0x1b, 0x411111f0 },
1391 { 0x1f, 0x411111f0 },
1392 { }
1393 }
1394 },
1395 [ALC880_FIXUP_Z71V] = {
1396 .type = HDA_FIXUP_PINS,
1397 .v.pins = (const struct hda_pintbl[]) {
1398 /* set up the whole pins as BIOS is utterly broken */
1399 { 0x14, 0x99030120 }, /* speaker */
1400 { 0x15, 0x0121411f }, /* HP */
1401 { 0x16, 0x411111f0 }, /* N/A */
1402 { 0x17, 0x411111f0 }, /* N/A */
1403 { 0x18, 0x01a19950 }, /* mic-in */
1404 { 0x19, 0x411111f0 }, /* N/A */
1405 { 0x1a, 0x01813031 }, /* line-in */
1406 { 0x1b, 0x411111f0 }, /* N/A */
1407 { 0x1c, 0x411111f0 }, /* N/A */
1408 { 0x1d, 0x411111f0 }, /* N/A */
1409 { 0x1e, 0x0144111e }, /* SPDIF */
1410 { }
1411 }
1412 },
1413 [ALC880_FIXUP_ASUS_W5A] = {
1414 .type = HDA_FIXUP_PINS,
1415 .v.pins = (const struct hda_pintbl[]) {
1416 /* set up the whole pins as BIOS is utterly broken */
1417 { 0x14, 0x0121411f }, /* HP */
1418 { 0x15, 0x411111f0 }, /* N/A */
1419 { 0x16, 0x411111f0 }, /* N/A */
1420 { 0x17, 0x411111f0 }, /* N/A */
1421 { 0x18, 0x90a60160 }, /* mic */
1422 { 0x19, 0x411111f0 }, /* N/A */
1423 { 0x1a, 0x411111f0 }, /* N/A */
1424 { 0x1b, 0x411111f0 }, /* N/A */
1425 { 0x1c, 0x411111f0 }, /* N/A */
1426 { 0x1d, 0x411111f0 }, /* N/A */
1427 { 0x1e, 0xb743111e }, /* SPDIF out */
1428 { }
1429 },
1430 .chained = true,
1431 .chain_id = ALC880_FIXUP_GPIO1,
1432 },
1433 [ALC880_FIXUP_3ST_BASE] = {
1434 .type = HDA_FIXUP_PINS,
1435 .v.pins = (const struct hda_pintbl[]) {
1436 { 0x14, 0x01014010 }, /* line-out */
1437 { 0x15, 0x411111f0 }, /* N/A */
1438 { 0x16, 0x411111f0 }, /* N/A */
1439 { 0x17, 0x411111f0 }, /* N/A */
1440 { 0x18, 0x01a19c30 }, /* mic-in */
1441 { 0x19, 0x0121411f }, /* HP */
1442 { 0x1a, 0x01813031 }, /* line-in */
1443 { 0x1b, 0x02a19c40 }, /* front-mic */
1444 { 0x1c, 0x411111f0 }, /* N/A */
1445 { 0x1d, 0x411111f0 }, /* N/A */
1446 /* 0x1e is filled in below */
1447 { 0x1f, 0x411111f0 }, /* N/A */
1448 { }
1449 }
1450 },
1451 [ALC880_FIXUP_3ST] = {
1452 .type = HDA_FIXUP_PINS,
1453 .v.pins = (const struct hda_pintbl[]) {
1454 { 0x1e, 0x411111f0 }, /* N/A */
1455 { }
1456 },
1457 .chained = true,
1458 .chain_id = ALC880_FIXUP_3ST_BASE,
1459 },
1460 [ALC880_FIXUP_3ST_DIG] = {
1461 .type = HDA_FIXUP_PINS,
1462 .v.pins = (const struct hda_pintbl[]) {
1463 { 0x1e, 0x0144111e }, /* SPDIF */
1464 { }
1465 },
1466 .chained = true,
1467 .chain_id = ALC880_FIXUP_3ST_BASE,
1468 },
1469 [ALC880_FIXUP_5ST_BASE] = {
1470 .type = HDA_FIXUP_PINS,
1471 .v.pins = (const struct hda_pintbl[]) {
1472 { 0x14, 0x01014010 }, /* front */
1473 { 0x15, 0x411111f0 }, /* N/A */
1474 { 0x16, 0x01011411 }, /* CLFE */
1475 { 0x17, 0x01016412 }, /* surr */
1476 { 0x18, 0x01a19c30 }, /* mic-in */
1477 { 0x19, 0x0121411f }, /* HP */
1478 { 0x1a, 0x01813031 }, /* line-in */
1479 { 0x1b, 0x02a19c40 }, /* front-mic */
1480 { 0x1c, 0x411111f0 }, /* N/A */
1481 { 0x1d, 0x411111f0 }, /* N/A */
1482 /* 0x1e is filled in below */
1483 { 0x1f, 0x411111f0 }, /* N/A */
1484 { }
1485 }
1486 },
1487 [ALC880_FIXUP_5ST] = {
1488 .type = HDA_FIXUP_PINS,
1489 .v.pins = (const struct hda_pintbl[]) {
1490 { 0x1e, 0x411111f0 }, /* N/A */
1491 { }
1492 },
1493 .chained = true,
1494 .chain_id = ALC880_FIXUP_5ST_BASE,
1495 },
1496 [ALC880_FIXUP_5ST_DIG] = {
1497 .type = HDA_FIXUP_PINS,
1498 .v.pins = (const struct hda_pintbl[]) {
1499 { 0x1e, 0x0144111e }, /* SPDIF */
1500 { }
1501 },
1502 .chained = true,
1503 .chain_id = ALC880_FIXUP_5ST_BASE,
1504 },
1505 [ALC880_FIXUP_6ST_BASE] = {
1506 .type = HDA_FIXUP_PINS,
1507 .v.pins = (const struct hda_pintbl[]) {
1508 { 0x14, 0x01014010 }, /* front */
1509 { 0x15, 0x01016412 }, /* surr */
1510 { 0x16, 0x01011411 }, /* CLFE */
1511 { 0x17, 0x01012414 }, /* side */
1512 { 0x18, 0x01a19c30 }, /* mic-in */
1513 { 0x19, 0x02a19c40 }, /* front-mic */
1514 { 0x1a, 0x01813031 }, /* line-in */
1515 { 0x1b, 0x0121411f }, /* HP */
1516 { 0x1c, 0x411111f0 }, /* N/A */
1517 { 0x1d, 0x411111f0 }, /* N/A */
1518 /* 0x1e is filled in below */
1519 { 0x1f, 0x411111f0 }, /* N/A */
1520 { }
1521 }
1522 },
1523 [ALC880_FIXUP_6ST] = {
1524 .type = HDA_FIXUP_PINS,
1525 .v.pins = (const struct hda_pintbl[]) {
1526 { 0x1e, 0x411111f0 }, /* N/A */
1527 { }
1528 },
1529 .chained = true,
1530 .chain_id = ALC880_FIXUP_6ST_BASE,
1531 },
1532 [ALC880_FIXUP_6ST_DIG] = {
1533 .type = HDA_FIXUP_PINS,
1534 .v.pins = (const struct hda_pintbl[]) {
1535 { 0x1e, 0x0144111e }, /* SPDIF */
1536 { }
1537 },
1538 .chained = true,
1539 .chain_id = ALC880_FIXUP_6ST_BASE,
1540 },
1541 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1542 .type = HDA_FIXUP_PINS,
1543 .v.pins = (const struct hda_pintbl[]) {
1544 { 0x1b, 0x0121401f }, /* HP with jack detect */
1545 { }
1546 },
1547 .chained_before = true,
1548 .chain_id = ALC880_FIXUP_6ST_BASE,
1549 },
1550 };
1551
1552 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1553 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1554 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1555 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1556 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1557 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1558 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1559 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1560 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1561 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1562 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1563 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1564 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1565 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1566 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1567 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1568 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1569 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1570 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1571 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1572 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1573 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1574 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1575 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1576
1577 /* Below is the copied entries from alc880_quirks.c.
1578 * It's not quite sure whether BIOS sets the correct pin-config table
1579 * on these machines, thus they are kept to be compatible with
1580 * the old static quirks. Once when it's confirmed to work without
1581 * these overrides, it'd be better to remove.
1582 */
1583 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1584 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1585 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1586 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1587 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1588 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1589 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1590 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1591 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1592 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1593 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1594 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1595 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1596 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1597 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1598 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1599 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1600 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1601 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1602 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1603 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1604 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1605 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1606 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1607 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1608 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1609 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1610 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1611 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1612 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1613 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1615 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1616 /* default Intel */
1617 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1618 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1619 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1620 {}
1621 };
1622
1623 static const struct hda_model_fixup alc880_fixup_models[] = {
1624 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1625 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1626 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1627 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1628 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1629 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1630 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1631 {}
1632 };
1633
1634
1635 /*
1636 * OK, here we have finally the patch for ALC880
1637 */
1638 static int patch_alc880(struct hda_codec *codec)
1639 {
1640 struct alc_spec *spec;
1641 int err;
1642
1643 err = alc_alloc_spec(codec, 0x0b);
1644 if (err < 0)
1645 return err;
1646
1647 spec = codec->spec;
1648 spec->gen.need_dac_fix = 1;
1649 spec->gen.beep_nid = 0x01;
1650
1651 codec->patch_ops.unsol_event = alc880_unsol_event;
1652
1653 alc_pre_init(codec);
1654
1655 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1656 alc880_fixups);
1657 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1658
1659 /* automatic parse from the BIOS config */
1660 err = alc880_parse_auto_config(codec);
1661 if (err < 0)
1662 goto error;
1663
1664 if (!spec->gen.no_analog) {
1665 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1666 if (err < 0)
1667 goto error;
1668 }
1669
1670 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1671
1672 return 0;
1673
1674 error:
1675 alc_free(codec);
1676 return err;
1677 }
1678
1679
1680 /*
1681 * ALC260 support
1682 */
1683 static int alc260_parse_auto_config(struct hda_codec *codec)
1684 {
1685 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1686 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1687 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1688 }
1689
1690 /*
1691 * Pin config fixes
1692 */
1693 enum {
1694 ALC260_FIXUP_HP_DC5750,
1695 ALC260_FIXUP_HP_PIN_0F,
1696 ALC260_FIXUP_COEF,
1697 ALC260_FIXUP_GPIO1,
1698 ALC260_FIXUP_GPIO1_TOGGLE,
1699 ALC260_FIXUP_REPLACER,
1700 ALC260_FIXUP_HP_B1900,
1701 ALC260_FIXUP_KN1,
1702 ALC260_FIXUP_FSC_S7020,
1703 ALC260_FIXUP_FSC_S7020_JWSE,
1704 ALC260_FIXUP_VAIO_PINS,
1705 };
1706
1707 static void alc260_gpio1_automute(struct hda_codec *codec)
1708 {
1709 struct alc_spec *spec = codec->spec;
1710
1711 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1712 }
1713
1714 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1715 const struct hda_fixup *fix, int action)
1716 {
1717 struct alc_spec *spec = codec->spec;
1718 if (action == HDA_FIXUP_ACT_PROBE) {
1719 /* although the machine has only one output pin, we need to
1720 * toggle GPIO1 according to the jack state
1721 */
1722 spec->gen.automute_hook = alc260_gpio1_automute;
1723 spec->gen.detect_hp = 1;
1724 spec->gen.automute_speaker = 1;
1725 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1726 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1727 snd_hda_gen_hp_automute);
1728 alc_setup_gpio(codec, 0x01);
1729 }
1730 }
1731
1732 static void alc260_fixup_kn1(struct hda_codec *codec,
1733 const struct hda_fixup *fix, int action)
1734 {
1735 struct alc_spec *spec = codec->spec;
1736 static const struct hda_pintbl pincfgs[] = {
1737 { 0x0f, 0x02214000 }, /* HP/speaker */
1738 { 0x12, 0x90a60160 }, /* int mic */
1739 { 0x13, 0x02a19000 }, /* ext mic */
1740 { 0x18, 0x01446000 }, /* SPDIF out */
1741 /* disable bogus I/O pins */
1742 { 0x10, 0x411111f0 },
1743 { 0x11, 0x411111f0 },
1744 { 0x14, 0x411111f0 },
1745 { 0x15, 0x411111f0 },
1746 { 0x16, 0x411111f0 },
1747 { 0x17, 0x411111f0 },
1748 { 0x19, 0x411111f0 },
1749 { }
1750 };
1751
1752 switch (action) {
1753 case HDA_FIXUP_ACT_PRE_PROBE:
1754 snd_hda_apply_pincfgs(codec, pincfgs);
1755 spec->init_amp = ALC_INIT_NONE;
1756 break;
1757 }
1758 }
1759
1760 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1761 const struct hda_fixup *fix, int action)
1762 {
1763 struct alc_spec *spec = codec->spec;
1764 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1765 spec->init_amp = ALC_INIT_NONE;
1766 }
1767
1768 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1769 const struct hda_fixup *fix, int action)
1770 {
1771 struct alc_spec *spec = codec->spec;
1772 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1773 spec->gen.add_jack_modes = 1;
1774 spec->gen.hp_mic = 1;
1775 }
1776 }
1777
1778 static const struct hda_fixup alc260_fixups[] = {
1779 [ALC260_FIXUP_HP_DC5750] = {
1780 .type = HDA_FIXUP_PINS,
1781 .v.pins = (const struct hda_pintbl[]) {
1782 { 0x11, 0x90130110 }, /* speaker */
1783 { }
1784 }
1785 },
1786 [ALC260_FIXUP_HP_PIN_0F] = {
1787 .type = HDA_FIXUP_PINS,
1788 .v.pins = (const struct hda_pintbl[]) {
1789 { 0x0f, 0x01214000 }, /* HP */
1790 { }
1791 }
1792 },
1793 [ALC260_FIXUP_COEF] = {
1794 .type = HDA_FIXUP_VERBS,
1795 .v.verbs = (const struct hda_verb[]) {
1796 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1797 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1798 { }
1799 },
1800 },
1801 [ALC260_FIXUP_GPIO1] = {
1802 .type = HDA_FIXUP_FUNC,
1803 .v.func = alc_fixup_gpio1,
1804 },
1805 [ALC260_FIXUP_GPIO1_TOGGLE] = {
1806 .type = HDA_FIXUP_FUNC,
1807 .v.func = alc260_fixup_gpio1_toggle,
1808 .chained = true,
1809 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1810 },
1811 [ALC260_FIXUP_REPLACER] = {
1812 .type = HDA_FIXUP_VERBS,
1813 .v.verbs = (const struct hda_verb[]) {
1814 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1815 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1816 { }
1817 },
1818 .chained = true,
1819 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1820 },
1821 [ALC260_FIXUP_HP_B1900] = {
1822 .type = HDA_FIXUP_FUNC,
1823 .v.func = alc260_fixup_gpio1_toggle,
1824 .chained = true,
1825 .chain_id = ALC260_FIXUP_COEF,
1826 },
1827 [ALC260_FIXUP_KN1] = {
1828 .type = HDA_FIXUP_FUNC,
1829 .v.func = alc260_fixup_kn1,
1830 },
1831 [ALC260_FIXUP_FSC_S7020] = {
1832 .type = HDA_FIXUP_FUNC,
1833 .v.func = alc260_fixup_fsc_s7020,
1834 },
1835 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1836 .type = HDA_FIXUP_FUNC,
1837 .v.func = alc260_fixup_fsc_s7020_jwse,
1838 .chained = true,
1839 .chain_id = ALC260_FIXUP_FSC_S7020,
1840 },
1841 [ALC260_FIXUP_VAIO_PINS] = {
1842 .type = HDA_FIXUP_PINS,
1843 .v.pins = (const struct hda_pintbl[]) {
1844 /* Pin configs are missing completely on some VAIOs */
1845 { 0x0f, 0x01211020 },
1846 { 0x10, 0x0001003f },
1847 { 0x11, 0x411111f0 },
1848 { 0x12, 0x01a15930 },
1849 { 0x13, 0x411111f0 },
1850 { 0x14, 0x411111f0 },
1851 { 0x15, 0x411111f0 },
1852 { 0x16, 0x411111f0 },
1853 { 0x17, 0x411111f0 },
1854 { 0x18, 0x411111f0 },
1855 { 0x19, 0x411111f0 },
1856 { }
1857 }
1858 },
1859 };
1860
1861 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1862 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1863 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1864 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1865 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1866 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1867 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1868 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1869 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1870 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1871 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1872 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1873 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1874 {}
1875 };
1876
1877 static const struct hda_model_fixup alc260_fixup_models[] = {
1878 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1879 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1880 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1881 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1882 {}
1883 };
1884
1885 /*
1886 */
1887 static int patch_alc260(struct hda_codec *codec)
1888 {
1889 struct alc_spec *spec;
1890 int err;
1891
1892 err = alc_alloc_spec(codec, 0x07);
1893 if (err < 0)
1894 return err;
1895
1896 spec = codec->spec;
1897 /* as quite a few machines require HP amp for speaker outputs,
1898 * it's easier to enable it unconditionally; even if it's unneeded,
1899 * it's almost harmless.
1900 */
1901 spec->gen.prefer_hp_amp = 1;
1902 spec->gen.beep_nid = 0x01;
1903
1904 spec->shutup = alc_eapd_shutup;
1905
1906 alc_pre_init(codec);
1907
1908 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1909 alc260_fixups);
1910 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1911
1912 /* automatic parse from the BIOS config */
1913 err = alc260_parse_auto_config(codec);
1914 if (err < 0)
1915 goto error;
1916
1917 if (!spec->gen.no_analog) {
1918 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1919 if (err < 0)
1920 goto error;
1921 }
1922
1923 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1924
1925 return 0;
1926
1927 error:
1928 alc_free(codec);
1929 return err;
1930 }
1931
1932
1933 /*
1934 * ALC882/883/885/888/889 support
1935 *
1936 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1937 * configuration. Each pin widget can choose any input DACs and a mixer.
1938 * Each ADC is connected from a mixer of all inputs. This makes possible
1939 * 6-channel independent captures.
1940 *
1941 * In addition, an independent DAC for the multi-playback (not used in this
1942 * driver yet).
1943 */
1944
1945 /*
1946 * Pin config fixes
1947 */
1948 enum {
1949 ALC882_FIXUP_ABIT_AW9D_MAX,
1950 ALC882_FIXUP_LENOVO_Y530,
1951 ALC882_FIXUP_PB_M5210,
1952 ALC882_FIXUP_ACER_ASPIRE_7736,
1953 ALC882_FIXUP_ASUS_W90V,
1954 ALC889_FIXUP_CD,
1955 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1956 ALC889_FIXUP_VAIO_TT,
1957 ALC888_FIXUP_EEE1601,
1958 ALC886_FIXUP_EAPD,
1959 ALC882_FIXUP_EAPD,
1960 ALC883_FIXUP_EAPD,
1961 ALC883_FIXUP_ACER_EAPD,
1962 ALC882_FIXUP_GPIO1,
1963 ALC882_FIXUP_GPIO2,
1964 ALC882_FIXUP_GPIO3,
1965 ALC889_FIXUP_COEF,
1966 ALC882_FIXUP_ASUS_W2JC,
1967 ALC882_FIXUP_ACER_ASPIRE_4930G,
1968 ALC882_FIXUP_ACER_ASPIRE_8930G,
1969 ALC882_FIXUP_ASPIRE_8930G_VERBS,
1970 ALC885_FIXUP_MACPRO_GPIO,
1971 ALC889_FIXUP_DAC_ROUTE,
1972 ALC889_FIXUP_MBP_VREF,
1973 ALC889_FIXUP_IMAC91_VREF,
1974 ALC889_FIXUP_MBA11_VREF,
1975 ALC889_FIXUP_MBA21_VREF,
1976 ALC889_FIXUP_MP11_VREF,
1977 ALC889_FIXUP_MP41_VREF,
1978 ALC882_FIXUP_INV_DMIC,
1979 ALC882_FIXUP_NO_PRIMARY_HP,
1980 ALC887_FIXUP_ASUS_BASS,
1981 ALC887_FIXUP_BASS_CHMAP,
1982 ALC1220_FIXUP_GB_DUAL_CODECS,
1983 ALC1220_FIXUP_GB_X570,
1984 ALC1220_FIXUP_CLEVO_P950,
1985 ALC1220_FIXUP_CLEVO_PB51ED,
1986 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1987 ALC887_FIXUP_ASUS_AUDIO,
1988 ALC887_FIXUP_ASUS_HMIC,
1989 ALCS1200A_FIXUP_MIC_VREF,
1990 };
1991
1992 static void alc889_fixup_coef(struct hda_codec *codec,
1993 const struct hda_fixup *fix, int action)
1994 {
1995 if (action != HDA_FIXUP_ACT_INIT)
1996 return;
1997 alc_update_coef_idx(codec, 7, 0, 0x2030);
1998 }
1999
2000 /* set up GPIO at initialization */
2001 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2002 const struct hda_fixup *fix, int action)
2003 {
2004 struct alc_spec *spec = codec->spec;
2005
2006 spec->gpio_write_delay = true;
2007 alc_fixup_gpio3(codec, fix, action);
2008 }
2009
2010 /* Fix the connection of some pins for ALC889:
2011 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2012 * work correctly (bko#42740)
2013 */
2014 static void alc889_fixup_dac_route(struct hda_codec *codec,
2015 const struct hda_fixup *fix, int action)
2016 {
2017 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2018 /* fake the connections during parsing the tree */
2019 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2020 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2021 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2022 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2023 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2024 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2025 } else if (action == HDA_FIXUP_ACT_PROBE) {
2026 /* restore the connections */
2027 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2028 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2029 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2030 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2031 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2032 }
2033 }
2034
2035 /* Set VREF on HP pin */
2036 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2037 const struct hda_fixup *fix, int action)
2038 {
2039 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2040 struct alc_spec *spec = codec->spec;
2041 int i;
2042
2043 if (action != HDA_FIXUP_ACT_INIT)
2044 return;
2045 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2046 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2047 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2048 continue;
2049 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2050 val |= AC_PINCTL_VREF_80;
2051 snd_hda_set_pin_ctl(codec, nids[i], val);
2052 spec->gen.keep_vref_in_automute = 1;
2053 break;
2054 }
2055 }
2056
2057 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2058 const hda_nid_t *nids, int num_nids)
2059 {
2060 struct alc_spec *spec = codec->spec;
2061 int i;
2062
2063 for (i = 0; i < num_nids; i++) {
2064 unsigned int val;
2065 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2066 val |= AC_PINCTL_VREF_50;
2067 snd_hda_set_pin_ctl(codec, nids[i], val);
2068 }
2069 spec->gen.keep_vref_in_automute = 1;
2070 }
2071
2072 /* Set VREF on speaker pins on imac91 */
2073 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2074 const struct hda_fixup *fix, int action)
2075 {
2076 static const hda_nid_t nids[] = { 0x18, 0x1a };
2077
2078 if (action == HDA_FIXUP_ACT_INIT)
2079 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2080 }
2081
2082 /* Set VREF on speaker pins on mba11 */
2083 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2084 const struct hda_fixup *fix, int action)
2085 {
2086 static const hda_nid_t nids[] = { 0x18 };
2087
2088 if (action == HDA_FIXUP_ACT_INIT)
2089 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2090 }
2091
2092 /* Set VREF on speaker pins on mba21 */
2093 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2094 const struct hda_fixup *fix, int action)
2095 {
2096 static const hda_nid_t nids[] = { 0x18, 0x19 };
2097
2098 if (action == HDA_FIXUP_ACT_INIT)
2099 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2100 }
2101
2102 /* Don't take HP output as primary
2103 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2104 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2105 */
2106 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2107 const struct hda_fixup *fix, int action)
2108 {
2109 struct alc_spec *spec = codec->spec;
2110 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2111 spec->gen.no_primary_hp = 1;
2112 spec->gen.no_multi_io = 1;
2113 }
2114 }
2115
2116 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2117 const struct hda_fixup *fix, int action);
2118
2119 /* For dual-codec configuration, we need to disable some features to avoid
2120 * conflicts of kctls and PCM streams
2121 */
2122 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2123 const struct hda_fixup *fix, int action)
2124 {
2125 struct alc_spec *spec = codec->spec;
2126
2127 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2128 return;
2129 /* disable vmaster */
2130 spec->gen.suppress_vmaster = 1;
2131 /* auto-mute and auto-mic switch don't work with multiple codecs */
2132 spec->gen.suppress_auto_mute = 1;
2133 spec->gen.suppress_auto_mic = 1;
2134 /* disable aamix as well */
2135 spec->gen.mixer_nid = 0;
2136 /* add location prefix to avoid conflicts */
2137 codec->force_pin_prefix = 1;
2138 }
2139
2140 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2141 const char *newname)
2142 {
2143 struct snd_kcontrol *kctl;
2144
2145 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2146 if (kctl)
2147 snd_ctl_rename(codec->card, kctl, newname);
2148 }
2149
2150 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2151 const struct hda_fixup *fix,
2152 int action)
2153 {
2154 alc_fixup_dual_codecs(codec, fix, action);
2155 switch (action) {
2156 case HDA_FIXUP_ACT_PRE_PROBE:
2157 /* override card longname to provide a unique UCM profile */
2158 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2159 break;
2160 case HDA_FIXUP_ACT_BUILD:
2161 /* rename Capture controls depending on the codec */
2162 rename_ctl(codec, "Capture Volume",
2163 codec->addr == 0 ?
2164 "Rear-Panel Capture Volume" :
2165 "Front-Panel Capture Volume");
2166 rename_ctl(codec, "Capture Switch",
2167 codec->addr == 0 ?
2168 "Rear-Panel Capture Switch" :
2169 "Front-Panel Capture Switch");
2170 break;
2171 }
2172 }
2173
2174 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2175 const struct hda_fixup *fix,
2176 int action)
2177 {
2178 static const hda_nid_t conn1[] = { 0x0c };
2179 static const struct coef_fw gb_x570_coefs[] = {
2180 WRITE_COEF(0x07, 0x03c0),
2181 WRITE_COEF(0x1a, 0x01c1),
2182 WRITE_COEF(0x1b, 0x0202),
2183 WRITE_COEF(0x43, 0x3005),
2184 {}
2185 };
2186
2187 switch (action) {
2188 case HDA_FIXUP_ACT_PRE_PROBE:
2189 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2190 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2191 break;
2192 case HDA_FIXUP_ACT_INIT:
2193 alc_process_coef_fw(codec, gb_x570_coefs);
2194 break;
2195 }
2196 }
2197
2198 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2199 const struct hda_fixup *fix,
2200 int action)
2201 {
2202 static const hda_nid_t conn1[] = { 0x0c };
2203
2204 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2205 return;
2206
2207 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2208 /* We therefore want to make sure 0x14 (front headphone) and
2209 * 0x1b (speakers) use the stereo DAC 0x02
2210 */
2211 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2212 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2213 }
2214
2215 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2216 const struct hda_fixup *fix, int action);
2217
2218 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2219 const struct hda_fixup *fix,
2220 int action)
2221 {
2222 alc1220_fixup_clevo_p950(codec, fix, action);
2223 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2224 }
2225
2226 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2227 struct hda_jack_callback *jack)
2228 {
2229 struct alc_spec *spec = codec->spec;
2230 unsigned int vref;
2231
2232 snd_hda_gen_hp_automute(codec, jack);
2233
2234 if (spec->gen.hp_jack_present)
2235 vref = AC_PINCTL_VREF_80;
2236 else
2237 vref = AC_PINCTL_VREF_HIZ;
2238 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2239 }
2240
2241 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2242 const struct hda_fixup *fix, int action)
2243 {
2244 struct alc_spec *spec = codec->spec;
2245 if (action != HDA_FIXUP_ACT_PROBE)
2246 return;
2247 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2248 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2249 }
2250
2251 static const struct hda_fixup alc882_fixups[] = {
2252 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2253 .type = HDA_FIXUP_PINS,
2254 .v.pins = (const struct hda_pintbl[]) {
2255 { 0x15, 0x01080104 }, /* side */
2256 { 0x16, 0x01011012 }, /* rear */
2257 { 0x17, 0x01016011 }, /* clfe */
2258 { }
2259 }
2260 },
2261 [ALC882_FIXUP_LENOVO_Y530] = {
2262 .type = HDA_FIXUP_PINS,
2263 .v.pins = (const struct hda_pintbl[]) {
2264 { 0x15, 0x99130112 }, /* rear int speakers */
2265 { 0x16, 0x99130111 }, /* subwoofer */
2266 { }
2267 }
2268 },
2269 [ALC882_FIXUP_PB_M5210] = {
2270 .type = HDA_FIXUP_PINCTLS,
2271 .v.pins = (const struct hda_pintbl[]) {
2272 { 0x19, PIN_VREF50 },
2273 {}
2274 }
2275 },
2276 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
2277 .type = HDA_FIXUP_FUNC,
2278 .v.func = alc_fixup_sku_ignore,
2279 },
2280 [ALC882_FIXUP_ASUS_W90V] = {
2281 .type = HDA_FIXUP_PINS,
2282 .v.pins = (const struct hda_pintbl[]) {
2283 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2284 { }
2285 }
2286 },
2287 [ALC889_FIXUP_CD] = {
2288 .type = HDA_FIXUP_PINS,
2289 .v.pins = (const struct hda_pintbl[]) {
2290 { 0x1c, 0x993301f0 }, /* CD */
2291 { }
2292 }
2293 },
2294 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2295 .type = HDA_FIXUP_PINS,
2296 .v.pins = (const struct hda_pintbl[]) {
2297 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2298 { }
2299 },
2300 .chained = true,
2301 .chain_id = ALC889_FIXUP_CD,
2302 },
2303 [ALC889_FIXUP_VAIO_TT] = {
2304 .type = HDA_FIXUP_PINS,
2305 .v.pins = (const struct hda_pintbl[]) {
2306 { 0x17, 0x90170111 }, /* hidden surround speaker */
2307 { }
2308 }
2309 },
2310 [ALC888_FIXUP_EEE1601] = {
2311 .type = HDA_FIXUP_VERBS,
2312 .v.verbs = (const struct hda_verb[]) {
2313 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2314 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2315 { }
2316 }
2317 },
2318 [ALC886_FIXUP_EAPD] = {
2319 .type = HDA_FIXUP_VERBS,
2320 .v.verbs = (const struct hda_verb[]) {
2321 /* change to EAPD mode */
2322 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2323 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2324 { }
2325 }
2326 },
2327 [ALC882_FIXUP_EAPD] = {
2328 .type = HDA_FIXUP_VERBS,
2329 .v.verbs = (const struct hda_verb[]) {
2330 /* change to EAPD mode */
2331 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2332 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2333 { }
2334 }
2335 },
2336 [ALC883_FIXUP_EAPD] = {
2337 .type = HDA_FIXUP_VERBS,
2338 .v.verbs = (const struct hda_verb[]) {
2339 /* change to EAPD mode */
2340 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2341 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2342 { }
2343 }
2344 },
2345 [ALC883_FIXUP_ACER_EAPD] = {
2346 .type = HDA_FIXUP_VERBS,
2347 .v.verbs = (const struct hda_verb[]) {
2348 /* eanable EAPD on Acer laptops */
2349 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2350 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2351 { }
2352 }
2353 },
2354 [ALC882_FIXUP_GPIO1] = {
2355 .type = HDA_FIXUP_FUNC,
2356 .v.func = alc_fixup_gpio1,
2357 },
2358 [ALC882_FIXUP_GPIO2] = {
2359 .type = HDA_FIXUP_FUNC,
2360 .v.func = alc_fixup_gpio2,
2361 },
2362 [ALC882_FIXUP_GPIO3] = {
2363 .type = HDA_FIXUP_FUNC,
2364 .v.func = alc_fixup_gpio3,
2365 },
2366 [ALC882_FIXUP_ASUS_W2JC] = {
2367 .type = HDA_FIXUP_FUNC,
2368 .v.func = alc_fixup_gpio1,
2369 .chained = true,
2370 .chain_id = ALC882_FIXUP_EAPD,
2371 },
2372 [ALC889_FIXUP_COEF] = {
2373 .type = HDA_FIXUP_FUNC,
2374 .v.func = alc889_fixup_coef,
2375 },
2376 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2377 .type = HDA_FIXUP_PINS,
2378 .v.pins = (const struct hda_pintbl[]) {
2379 { 0x16, 0x99130111 }, /* CLFE speaker */
2380 { 0x17, 0x99130112 }, /* surround speaker */
2381 { }
2382 },
2383 .chained = true,
2384 .chain_id = ALC882_FIXUP_GPIO1,
2385 },
2386 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2387 .type = HDA_FIXUP_PINS,
2388 .v.pins = (const struct hda_pintbl[]) {
2389 { 0x16, 0x99130111 }, /* CLFE speaker */
2390 { 0x1b, 0x99130112 }, /* surround speaker */
2391 { }
2392 },
2393 .chained = true,
2394 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2395 },
2396 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2397 /* additional init verbs for Acer Aspire 8930G */
2398 .type = HDA_FIXUP_VERBS,
2399 .v.verbs = (const struct hda_verb[]) {
2400 /* Enable all DACs */
2401 /* DAC DISABLE/MUTE 1? */
2402 /* setting bits 1-5 disables DAC nids 0x02-0x06
2403 * apparently. Init=0x38 */
2404 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2405 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2406 /* DAC DISABLE/MUTE 2? */
2407 /* some bit here disables the other DACs.
2408 * Init=0x4900 */
2409 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2410 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2411 /* DMIC fix
2412 * This laptop has a stereo digital microphone.
2413 * The mics are only 1cm apart which makes the stereo
2414 * useless. However, either the mic or the ALC889
2415 * makes the signal become a difference/sum signal
2416 * instead of standard stereo, which is annoying.
2417 * So instead we flip this bit which makes the
2418 * codec replicate the sum signal to both channels,
2419 * turning it into a normal mono mic.
2420 */
2421 /* DMIC_CONTROL? Init value = 0x0001 */
2422 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2423 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2424 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2425 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2426 { }
2427 },
2428 .chained = true,
2429 .chain_id = ALC882_FIXUP_GPIO1,
2430 },
2431 [ALC885_FIXUP_MACPRO_GPIO] = {
2432 .type = HDA_FIXUP_FUNC,
2433 .v.func = alc885_fixup_macpro_gpio,
2434 },
2435 [ALC889_FIXUP_DAC_ROUTE] = {
2436 .type = HDA_FIXUP_FUNC,
2437 .v.func = alc889_fixup_dac_route,
2438 },
2439 [ALC889_FIXUP_MBP_VREF] = {
2440 .type = HDA_FIXUP_FUNC,
2441 .v.func = alc889_fixup_mbp_vref,
2442 .chained = true,
2443 .chain_id = ALC882_FIXUP_GPIO1,
2444 },
2445 [ALC889_FIXUP_IMAC91_VREF] = {
2446 .type = HDA_FIXUP_FUNC,
2447 .v.func = alc889_fixup_imac91_vref,
2448 .chained = true,
2449 .chain_id = ALC882_FIXUP_GPIO1,
2450 },
2451 [ALC889_FIXUP_MBA11_VREF] = {
2452 .type = HDA_FIXUP_FUNC,
2453 .v.func = alc889_fixup_mba11_vref,
2454 .chained = true,
2455 .chain_id = ALC889_FIXUP_MBP_VREF,
2456 },
2457 [ALC889_FIXUP_MBA21_VREF] = {
2458 .type = HDA_FIXUP_FUNC,
2459 .v.func = alc889_fixup_mba21_vref,
2460 .chained = true,
2461 .chain_id = ALC889_FIXUP_MBP_VREF,
2462 },
2463 [ALC889_FIXUP_MP11_VREF] = {
2464 .type = HDA_FIXUP_FUNC,
2465 .v.func = alc889_fixup_mba11_vref,
2466 .chained = true,
2467 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2468 },
2469 [ALC889_FIXUP_MP41_VREF] = {
2470 .type = HDA_FIXUP_FUNC,
2471 .v.func = alc889_fixup_mbp_vref,
2472 .chained = true,
2473 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2474 },
2475 [ALC882_FIXUP_INV_DMIC] = {
2476 .type = HDA_FIXUP_FUNC,
2477 .v.func = alc_fixup_inv_dmic,
2478 },
2479 [ALC882_FIXUP_NO_PRIMARY_HP] = {
2480 .type = HDA_FIXUP_FUNC,
2481 .v.func = alc882_fixup_no_primary_hp,
2482 },
2483 [ALC887_FIXUP_ASUS_BASS] = {
2484 .type = HDA_FIXUP_PINS,
2485 .v.pins = (const struct hda_pintbl[]) {
2486 {0x16, 0x99130130}, /* bass speaker */
2487 {}
2488 },
2489 .chained = true,
2490 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2491 },
2492 [ALC887_FIXUP_BASS_CHMAP] = {
2493 .type = HDA_FIXUP_FUNC,
2494 .v.func = alc_fixup_bass_chmap,
2495 },
2496 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2497 .type = HDA_FIXUP_FUNC,
2498 .v.func = alc1220_fixup_gb_dual_codecs,
2499 },
2500 [ALC1220_FIXUP_GB_X570] = {
2501 .type = HDA_FIXUP_FUNC,
2502 .v.func = alc1220_fixup_gb_x570,
2503 },
2504 [ALC1220_FIXUP_CLEVO_P950] = {
2505 .type = HDA_FIXUP_FUNC,
2506 .v.func = alc1220_fixup_clevo_p950,
2507 },
2508 [ALC1220_FIXUP_CLEVO_PB51ED] = {
2509 .type = HDA_FIXUP_FUNC,
2510 .v.func = alc1220_fixup_clevo_pb51ed,
2511 },
2512 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2513 .type = HDA_FIXUP_PINS,
2514 .v.pins = (const struct hda_pintbl[]) {
2515 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2516 {}
2517 },
2518 .chained = true,
2519 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2520 },
2521 [ALC887_FIXUP_ASUS_AUDIO] = {
2522 .type = HDA_FIXUP_PINS,
2523 .v.pins = (const struct hda_pintbl[]) {
2524 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2525 { 0x19, 0x22219420 },
2526 {}
2527 },
2528 },
2529 [ALC887_FIXUP_ASUS_HMIC] = {
2530 .type = HDA_FIXUP_FUNC,
2531 .v.func = alc887_fixup_asus_jack,
2532 .chained = true,
2533 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2534 },
2535 [ALCS1200A_FIXUP_MIC_VREF] = {
2536 .type = HDA_FIXUP_PINCTLS,
2537 .v.pins = (const struct hda_pintbl[]) {
2538 { 0x18, PIN_VREF50 }, /* rear mic */
2539 { 0x19, PIN_VREF50 }, /* front mic */
2540 {}
2541 }
2542 },
2543 };
2544
2545 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2546 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2547 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2548 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2549 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2550 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2551 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2552 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2553 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2554 ALC882_FIXUP_ACER_ASPIRE_4930G),
2555 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2556 ALC882_FIXUP_ACER_ASPIRE_4930G),
2557 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2558 ALC882_FIXUP_ACER_ASPIRE_8930G),
2559 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2560 ALC882_FIXUP_ACER_ASPIRE_8930G),
2561 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2562 ALC882_FIXUP_ACER_ASPIRE_4930G),
2563 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2564 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2565 ALC882_FIXUP_ACER_ASPIRE_4930G),
2566 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2567 ALC882_FIXUP_ACER_ASPIRE_4930G),
2568 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2569 ALC882_FIXUP_ACER_ASPIRE_4930G),
2570 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2571 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2572 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2573 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2574 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2575 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2576 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2577 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2578 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2579 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2580 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2581 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2582 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2583 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2584 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2585 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2586
2587 /* All Apple entries are in codec SSIDs */
2588 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2589 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2590 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2591 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2592 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2593 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2594 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2595 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2596 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2597 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2598 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2599 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2600 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2601 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2602 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2603 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2604 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2605 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2606 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2607 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2608 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2609 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2610
2611 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2612 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2613 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2614 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2615 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2616 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2617 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2618 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2619 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2620 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2621 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2622 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2623 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2624 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2625 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2626 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2627 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2628 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2629 SND_PCI_QUIRK(0x1558, 0x3702, "Clevo X370SN[VW]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2630 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2631 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2632 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2633 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2634 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2635 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2636 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2637 SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2638 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2639 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2640 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2641 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2642 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2643 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2645 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2646 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2647 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2648 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2649 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2650 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2651 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2652 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2653 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2654 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2655 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2656 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2657 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2658 SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2659 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2660 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2661 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2662 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2663 {}
2664 };
2665
2666 static const struct hda_model_fixup alc882_fixup_models[] = {
2667 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2668 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2669 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2670 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2671 {.id = ALC889_FIXUP_CD, .name = "cd"},
2672 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2673 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2674 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2675 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2676 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2677 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2678 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2679 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2680 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2681 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2682 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2683 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2684 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2685 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2686 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2687 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2688 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2689 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2690 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2691 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2692 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2693 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2694 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2695 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2696 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2697 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2698 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2699 {}
2700 };
2701
2702 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2703 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2704 {0x14, 0x01014010},
2705 {0x15, 0x01011012},
2706 {0x16, 0x01016011},
2707 {0x18, 0x01a19040},
2708 {0x19, 0x02a19050},
2709 {0x1a, 0x0181304f},
2710 {0x1b, 0x0221401f},
2711 {0x1e, 0x01456130}),
2712 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2713 {0x14, 0x01015010},
2714 {0x15, 0x01011012},
2715 {0x16, 0x01011011},
2716 {0x18, 0x01a11040},
2717 {0x19, 0x02a19050},
2718 {0x1a, 0x0181104f},
2719 {0x1b, 0x0221401f},
2720 {0x1e, 0x01451130}),
2721 {}
2722 };
2723
2724 /*
2725 * BIOS auto configuration
2726 */
2727 /* almost identical with ALC880 parser... */
2728 static int alc882_parse_auto_config(struct hda_codec *codec)
2729 {
2730 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2731 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2732 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2733 }
2734
2735 /*
2736 */
2737 static int patch_alc882(struct hda_codec *codec)
2738 {
2739 struct alc_spec *spec;
2740 int err;
2741
2742 err = alc_alloc_spec(codec, 0x0b);
2743 if (err < 0)
2744 return err;
2745
2746 spec = codec->spec;
2747
2748 switch (codec->core.vendor_id) {
2749 case 0x10ec0882:
2750 case 0x10ec0885:
2751 case 0x10ec0900:
2752 case 0x10ec0b00:
2753 case 0x10ec1220:
2754 break;
2755 default:
2756 /* ALC883 and variants */
2757 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2758 break;
2759 }
2760
2761 alc_pre_init(codec);
2762
2763 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2764 alc882_fixups);
2765 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2766 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2767
2768 alc_auto_parse_customize_define(codec);
2769
2770 if (has_cdefine_beep(codec))
2771 spec->gen.beep_nid = 0x01;
2772
2773 /* automatic parse from the BIOS config */
2774 err = alc882_parse_auto_config(codec);
2775 if (err < 0)
2776 goto error;
2777
2778 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2779 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2780 if (err < 0)
2781 goto error;
2782 }
2783
2784 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2785
2786 return 0;
2787
2788 error:
2789 alc_free(codec);
2790 return err;
2791 }
2792
2793
2794 /*
2795 * ALC262 support
2796 */
2797 static int alc262_parse_auto_config(struct hda_codec *codec)
2798 {
2799 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2800 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2801 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2802 }
2803
2804 /*
2805 * Pin config fixes
2806 */
2807 enum {
2808 ALC262_FIXUP_FSC_H270,
2809 ALC262_FIXUP_FSC_S7110,
2810 ALC262_FIXUP_HP_Z200,
2811 ALC262_FIXUP_TYAN,
2812 ALC262_FIXUP_LENOVO_3000,
2813 ALC262_FIXUP_BENQ,
2814 ALC262_FIXUP_BENQ_T31,
2815 ALC262_FIXUP_INV_DMIC,
2816 ALC262_FIXUP_INTEL_BAYLEYBAY,
2817 };
2818
2819 static const struct hda_fixup alc262_fixups[] = {
2820 [ALC262_FIXUP_FSC_H270] = {
2821 .type = HDA_FIXUP_PINS,
2822 .v.pins = (const struct hda_pintbl[]) {
2823 { 0x14, 0x99130110 }, /* speaker */
2824 { 0x15, 0x0221142f }, /* front HP */
2825 { 0x1b, 0x0121141f }, /* rear HP */
2826 { }
2827 }
2828 },
2829 [ALC262_FIXUP_FSC_S7110] = {
2830 .type = HDA_FIXUP_PINS,
2831 .v.pins = (const struct hda_pintbl[]) {
2832 { 0x15, 0x90170110 }, /* speaker */
2833 { }
2834 },
2835 .chained = true,
2836 .chain_id = ALC262_FIXUP_BENQ,
2837 },
2838 [ALC262_FIXUP_HP_Z200] = {
2839 .type = HDA_FIXUP_PINS,
2840 .v.pins = (const struct hda_pintbl[]) {
2841 { 0x16, 0x99130120 }, /* internal speaker */
2842 { }
2843 }
2844 },
2845 [ALC262_FIXUP_TYAN] = {
2846 .type = HDA_FIXUP_PINS,
2847 .v.pins = (const struct hda_pintbl[]) {
2848 { 0x14, 0x1993e1f0 }, /* int AUX */
2849 { }
2850 }
2851 },
2852 [ALC262_FIXUP_LENOVO_3000] = {
2853 .type = HDA_FIXUP_PINCTLS,
2854 .v.pins = (const struct hda_pintbl[]) {
2855 { 0x19, PIN_VREF50 },
2856 {}
2857 },
2858 .chained = true,
2859 .chain_id = ALC262_FIXUP_BENQ,
2860 },
2861 [ALC262_FIXUP_BENQ] = {
2862 .type = HDA_FIXUP_VERBS,
2863 .v.verbs = (const struct hda_verb[]) {
2864 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2865 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2866 {}
2867 }
2868 },
2869 [ALC262_FIXUP_BENQ_T31] = {
2870 .type = HDA_FIXUP_VERBS,
2871 .v.verbs = (const struct hda_verb[]) {
2872 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2873 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2874 {}
2875 }
2876 },
2877 [ALC262_FIXUP_INV_DMIC] = {
2878 .type = HDA_FIXUP_FUNC,
2879 .v.func = alc_fixup_inv_dmic,
2880 },
2881 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2882 .type = HDA_FIXUP_FUNC,
2883 .v.func = alc_fixup_no_depop_delay,
2884 },
2885 };
2886
2887 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2888 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2889 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2890 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2891 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2892 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2893 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2894 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2895 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2896 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2897 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2898 {}
2899 };
2900
2901 static const struct hda_model_fixup alc262_fixup_models[] = {
2902 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2903 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2904 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2905 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2906 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2907 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2908 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2909 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2910 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2911 {}
2912 };
2913
2914 /*
2915 */
2916 static int patch_alc262(struct hda_codec *codec)
2917 {
2918 struct alc_spec *spec;
2919 int err;
2920
2921 err = alc_alloc_spec(codec, 0x0b);
2922 if (err < 0)
2923 return err;
2924
2925 spec = codec->spec;
2926 spec->gen.shared_mic_vref_pin = 0x18;
2927
2928 spec->shutup = alc_eapd_shutup;
2929
2930 #if 0
2931 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2932 * under-run
2933 */
2934 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2935 #endif
2936 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2937
2938 alc_pre_init(codec);
2939
2940 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2941 alc262_fixups);
2942 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2943
2944 alc_auto_parse_customize_define(codec);
2945
2946 if (has_cdefine_beep(codec))
2947 spec->gen.beep_nid = 0x01;
2948
2949 /* automatic parse from the BIOS config */
2950 err = alc262_parse_auto_config(codec);
2951 if (err < 0)
2952 goto error;
2953
2954 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2955 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2956 if (err < 0)
2957 goto error;
2958 }
2959
2960 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2961
2962 return 0;
2963
2964 error:
2965 alc_free(codec);
2966 return err;
2967 }
2968
2969 /*
2970 * ALC268
2971 */
2972 /* bind Beep switches of both NID 0x0f and 0x10 */
2973 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2974 struct snd_ctl_elem_value *ucontrol)
2975 {
2976 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2977 unsigned long pval;
2978 int err;
2979
2980 mutex_lock(&codec->control_mutex);
2981 pval = kcontrol->private_value;
2982 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2983 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2984 if (err >= 0) {
2985 kcontrol->private_value = (pval & ~0xff) | 0x10;
2986 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2987 }
2988 kcontrol->private_value = pval;
2989 mutex_unlock(&codec->control_mutex);
2990 return err;
2991 }
2992
2993 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2994 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2995 {
2996 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2997 .name = "Beep Playback Switch",
2998 .subdevice = HDA_SUBDEV_AMP_FLAG,
2999 .info = snd_hda_mixer_amp_switch_info,
3000 .get = snd_hda_mixer_amp_switch_get,
3001 .put = alc268_beep_switch_put,
3002 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3003 },
3004 };
3005
3006 /* set PCBEEP vol = 0, mute connections */
3007 static const struct hda_verb alc268_beep_init_verbs[] = {
3008 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3009 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3010 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3011 { }
3012 };
3013
3014 enum {
3015 ALC268_FIXUP_INV_DMIC,
3016 ALC268_FIXUP_HP_EAPD,
3017 ALC268_FIXUP_SPDIF,
3018 };
3019
3020 static const struct hda_fixup alc268_fixups[] = {
3021 [ALC268_FIXUP_INV_DMIC] = {
3022 .type = HDA_FIXUP_FUNC,
3023 .v.func = alc_fixup_inv_dmic,
3024 },
3025 [ALC268_FIXUP_HP_EAPD] = {
3026 .type = HDA_FIXUP_VERBS,
3027 .v.verbs = (const struct hda_verb[]) {
3028 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3029 {}
3030 }
3031 },
3032 [ALC268_FIXUP_SPDIF] = {
3033 .type = HDA_FIXUP_PINS,
3034 .v.pins = (const struct hda_pintbl[]) {
3035 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3036 {}
3037 }
3038 },
3039 };
3040
3041 static const struct hda_model_fixup alc268_fixup_models[] = {
3042 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3043 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3044 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3045 {}
3046 };
3047
3048 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3049 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3050 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3051 /* below is codec SSID since multiple Toshiba laptops have the
3052 * same PCI SSID 1179:ff00
3053 */
3054 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3055 {}
3056 };
3057
3058 /*
3059 * BIOS auto configuration
3060 */
3061 static int alc268_parse_auto_config(struct hda_codec *codec)
3062 {
3063 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3064 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3065 }
3066
3067 /*
3068 */
3069 static int patch_alc268(struct hda_codec *codec)
3070 {
3071 struct alc_spec *spec;
3072 int i, err;
3073
3074 /* ALC268 has no aa-loopback mixer */
3075 err = alc_alloc_spec(codec, 0);
3076 if (err < 0)
3077 return err;
3078
3079 spec = codec->spec;
3080 if (has_cdefine_beep(codec))
3081 spec->gen.beep_nid = 0x01;
3082
3083 spec->shutup = alc_eapd_shutup;
3084
3085 alc_pre_init(codec);
3086
3087 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3088 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3089
3090 /* automatic parse from the BIOS config */
3091 err = alc268_parse_auto_config(codec);
3092 if (err < 0)
3093 goto error;
3094
3095 if (err > 0 && !spec->gen.no_analog &&
3096 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3097 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3098 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3099 &alc268_beep_mixer[i])) {
3100 err = -ENOMEM;
3101 goto error;
3102 }
3103 }
3104 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3105 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3106 /* override the amp caps for beep generator */
3107 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3108 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3109 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3110 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3111 (0 << AC_AMPCAP_MUTE_SHIFT));
3112 }
3113
3114 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3115
3116 return 0;
3117
3118 error:
3119 alc_free(codec);
3120 return err;
3121 }
3122
3123 /*
3124 * ALC269
3125 */
3126
3127 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3128 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3129 };
3130
3131 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3132 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3133 };
3134
3135 /* different alc269-variants */
3136 enum {
3137 ALC269_TYPE_ALC269VA,
3138 ALC269_TYPE_ALC269VB,
3139 ALC269_TYPE_ALC269VC,
3140 ALC269_TYPE_ALC269VD,
3141 ALC269_TYPE_ALC280,
3142 ALC269_TYPE_ALC282,
3143 ALC269_TYPE_ALC283,
3144 ALC269_TYPE_ALC284,
3145 ALC269_TYPE_ALC293,
3146 ALC269_TYPE_ALC286,
3147 ALC269_TYPE_ALC298,
3148 ALC269_TYPE_ALC255,
3149 ALC269_TYPE_ALC256,
3150 ALC269_TYPE_ALC257,
3151 ALC269_TYPE_ALC215,
3152 ALC269_TYPE_ALC225,
3153 ALC269_TYPE_ALC245,
3154 ALC269_TYPE_ALC287,
3155 ALC269_TYPE_ALC294,
3156 ALC269_TYPE_ALC300,
3157 ALC269_TYPE_ALC623,
3158 ALC269_TYPE_ALC700,
3159 };
3160
3161 /*
3162 * BIOS auto configuration
3163 */
3164 static int alc269_parse_auto_config(struct hda_codec *codec)
3165 {
3166 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3167 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3168 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3169 struct alc_spec *spec = codec->spec;
3170 const hda_nid_t *ssids;
3171
3172 switch (spec->codec_variant) {
3173 case ALC269_TYPE_ALC269VA:
3174 case ALC269_TYPE_ALC269VC:
3175 case ALC269_TYPE_ALC280:
3176 case ALC269_TYPE_ALC284:
3177 case ALC269_TYPE_ALC293:
3178 ssids = alc269va_ssids;
3179 break;
3180 case ALC269_TYPE_ALC269VB:
3181 case ALC269_TYPE_ALC269VD:
3182 case ALC269_TYPE_ALC282:
3183 case ALC269_TYPE_ALC283:
3184 case ALC269_TYPE_ALC286:
3185 case ALC269_TYPE_ALC298:
3186 case ALC269_TYPE_ALC255:
3187 case ALC269_TYPE_ALC256:
3188 case ALC269_TYPE_ALC257:
3189 case ALC269_TYPE_ALC215:
3190 case ALC269_TYPE_ALC225:
3191 case ALC269_TYPE_ALC245:
3192 case ALC269_TYPE_ALC287:
3193 case ALC269_TYPE_ALC294:
3194 case ALC269_TYPE_ALC300:
3195 case ALC269_TYPE_ALC623:
3196 case ALC269_TYPE_ALC700:
3197 ssids = alc269_ssids;
3198 break;
3199 default:
3200 ssids = alc269_ssids;
3201 break;
3202 }
3203
3204 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3205 }
3206
3207 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3208 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3209 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3210 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3211 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3212 {}
3213 };
3214
3215 static void alc_headset_btn_callback(struct hda_codec *codec,
3216 struct hda_jack_callback *jack)
3217 {
3218 int report = 0;
3219
3220 if (jack->unsol_res & (7 << 13))
3221 report |= SND_JACK_BTN_0;
3222
3223 if (jack->unsol_res & (1 << 16 | 3 << 8))
3224 report |= SND_JACK_BTN_1;
3225
3226 /* Volume up key */
3227 if (jack->unsol_res & (7 << 23))
3228 report |= SND_JACK_BTN_2;
3229
3230 /* Volume down key */
3231 if (jack->unsol_res & (7 << 10))
3232 report |= SND_JACK_BTN_3;
3233
3234 snd_hda_jack_set_button_state(codec, jack->nid, report);
3235 }
3236
3237 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3238 {
3239 struct alc_spec *spec = codec->spec;
3240
3241 if (!spec->has_hs_key)
3242 return;
3243
3244 switch (codec->core.vendor_id) {
3245 case 0x10ec0215:
3246 case 0x10ec0225:
3247 case 0x10ec0285:
3248 case 0x10ec0287:
3249 case 0x10ec0295:
3250 case 0x10ec0289:
3251 case 0x10ec0299:
3252 alc_write_coef_idx(codec, 0x48, 0x0);
3253 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3254 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3255 break;
3256 case 0x10ec0230:
3257 case 0x10ec0236:
3258 case 0x10ec0256:
3259 case 0x19e58326:
3260 alc_write_coef_idx(codec, 0x48, 0x0);
3261 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3262 break;
3263 }
3264 }
3265
3266 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3267 {
3268 struct alc_spec *spec = codec->spec;
3269
3270 if (!spec->has_hs_key)
3271 return;
3272
3273 switch (codec->core.vendor_id) {
3274 case 0x10ec0215:
3275 case 0x10ec0225:
3276 case 0x10ec0285:
3277 case 0x10ec0287:
3278 case 0x10ec0295:
3279 case 0x10ec0289:
3280 case 0x10ec0299:
3281 alc_write_coef_idx(codec, 0x48, 0xd011);
3282 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3283 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3284 break;
3285 case 0x10ec0230:
3286 case 0x10ec0236:
3287 case 0x10ec0256:
3288 case 0x19e58326:
3289 alc_write_coef_idx(codec, 0x48, 0xd011);
3290 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3291 break;
3292 }
3293 }
3294
3295 static void alc_fixup_headset_jack(struct hda_codec *codec,
3296 const struct hda_fixup *fix, int action)
3297 {
3298 struct alc_spec *spec = codec->spec;
3299 hda_nid_t hp_pin;
3300
3301 switch (action) {
3302 case HDA_FIXUP_ACT_PRE_PROBE:
3303 spec->has_hs_key = 1;
3304 snd_hda_jack_detect_enable_callback(codec, 0x55,
3305 alc_headset_btn_callback);
3306 break;
3307 case HDA_FIXUP_ACT_BUILD:
3308 hp_pin = alc_get_hp_pin(spec);
3309 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3310 alc_headset_btn_keymap,
3311 hp_pin))
3312 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3313 false, SND_JACK_HEADSET,
3314 alc_headset_btn_keymap);
3315
3316 alc_enable_headset_jack_key(codec);
3317 break;
3318 }
3319 }
3320
3321 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3322 {
3323 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3324 }
3325
3326 static void alc269_shutup(struct hda_codec *codec)
3327 {
3328 struct alc_spec *spec = codec->spec;
3329
3330 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3331 alc269vb_toggle_power_output(codec, 0);
3332 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3333 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3334 msleep(150);
3335 }
3336 alc_shutup_pins(codec);
3337 }
3338
3339 static const struct coef_fw alc282_coefs[] = {
3340 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3341 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3342 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3343 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3344 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3345 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3346 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3347 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3348 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3349 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3350 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3351 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3352 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3353 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3354 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3355 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3356 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3357 WRITE_COEF(0x63, 0x2902), /* PLL */
3358 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3359 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3360 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3361 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3362 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3363 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3364 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3365 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3366 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3367 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3368 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3369 {}
3370 };
3371
3372 static void alc282_restore_default_value(struct hda_codec *codec)
3373 {
3374 alc_process_coef_fw(codec, alc282_coefs);
3375 }
3376
3377 static void alc282_init(struct hda_codec *codec)
3378 {
3379 struct alc_spec *spec = codec->spec;
3380 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3381 bool hp_pin_sense;
3382 int coef78;
3383
3384 alc282_restore_default_value(codec);
3385
3386 if (!hp_pin)
3387 return;
3388 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3389 coef78 = alc_read_coef_idx(codec, 0x78);
3390
3391 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3392 /* Headphone capless set to high power mode */
3393 alc_write_coef_idx(codec, 0x78, 0x9004);
3394
3395 if (hp_pin_sense)
3396 msleep(2);
3397
3398 snd_hda_codec_write(codec, hp_pin, 0,
3399 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3400
3401 if (hp_pin_sense)
3402 msleep(85);
3403
3404 snd_hda_codec_write(codec, hp_pin, 0,
3405 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3406
3407 if (hp_pin_sense)
3408 msleep(100);
3409
3410 /* Headphone capless set to normal mode */
3411 alc_write_coef_idx(codec, 0x78, coef78);
3412 }
3413
3414 static void alc282_shutup(struct hda_codec *codec)
3415 {
3416 struct alc_spec *spec = codec->spec;
3417 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3418 bool hp_pin_sense;
3419 int coef78;
3420
3421 if (!hp_pin) {
3422 alc269_shutup(codec);
3423 return;
3424 }
3425
3426 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3427 coef78 = alc_read_coef_idx(codec, 0x78);
3428 alc_write_coef_idx(codec, 0x78, 0x9004);
3429
3430 if (hp_pin_sense)
3431 msleep(2);
3432
3433 snd_hda_codec_write(codec, hp_pin, 0,
3434 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3435
3436 if (hp_pin_sense)
3437 msleep(85);
3438
3439 if (!spec->no_shutup_pins)
3440 snd_hda_codec_write(codec, hp_pin, 0,
3441 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3442
3443 if (hp_pin_sense)
3444 msleep(100);
3445
3446 alc_auto_setup_eapd(codec, false);
3447 alc_shutup_pins(codec);
3448 alc_write_coef_idx(codec, 0x78, coef78);
3449 }
3450
3451 static const struct coef_fw alc283_coefs[] = {
3452 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3453 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3454 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3455 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3456 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3457 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3458 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3459 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3460 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3461 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3462 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3463 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3464 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3465 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3466 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3467 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3468 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3469 WRITE_COEF(0x2e, 0x2902), /* PLL */
3470 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3471 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3472 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3473 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3474 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3475 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3476 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3477 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3478 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3479 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3480 WRITE_COEF(0x49, 0x0), /* test mode */
3481 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3482 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3483 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3484 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3485 {}
3486 };
3487
3488 static void alc283_restore_default_value(struct hda_codec *codec)
3489 {
3490 alc_process_coef_fw(codec, alc283_coefs);
3491 }
3492
3493 static void alc283_init(struct hda_codec *codec)
3494 {
3495 struct alc_spec *spec = codec->spec;
3496 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3497 bool hp_pin_sense;
3498
3499 alc283_restore_default_value(codec);
3500
3501 if (!hp_pin)
3502 return;
3503
3504 msleep(30);
3505 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3506
3507 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3508 /* Headphone capless set to high power mode */
3509 alc_write_coef_idx(codec, 0x43, 0x9004);
3510
3511 snd_hda_codec_write(codec, hp_pin, 0,
3512 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3513
3514 if (hp_pin_sense)
3515 msleep(85);
3516
3517 snd_hda_codec_write(codec, hp_pin, 0,
3518 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3519
3520 if (hp_pin_sense)
3521 msleep(85);
3522 /* Index 0x46 Combo jack auto switch control 2 */
3523 /* 3k pull low control for Headset jack. */
3524 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3525 /* Headphone capless set to normal mode */
3526 alc_write_coef_idx(codec, 0x43, 0x9614);
3527 }
3528
3529 static void alc283_shutup(struct hda_codec *codec)
3530 {
3531 struct alc_spec *spec = codec->spec;
3532 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3533 bool hp_pin_sense;
3534
3535 if (!hp_pin) {
3536 alc269_shutup(codec);
3537 return;
3538 }
3539
3540 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3541
3542 alc_write_coef_idx(codec, 0x43, 0x9004);
3543
3544 /*depop hp during suspend*/
3545 alc_write_coef_idx(codec, 0x06, 0x2100);
3546
3547 snd_hda_codec_write(codec, hp_pin, 0,
3548 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3549
3550 if (hp_pin_sense)
3551 msleep(100);
3552
3553 if (!spec->no_shutup_pins)
3554 snd_hda_codec_write(codec, hp_pin, 0,
3555 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3556
3557 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3558
3559 if (hp_pin_sense)
3560 msleep(100);
3561 alc_auto_setup_eapd(codec, false);
3562 alc_shutup_pins(codec);
3563 alc_write_coef_idx(codec, 0x43, 0x9614);
3564 }
3565
3566 static void alc256_init(struct hda_codec *codec)
3567 {
3568 struct alc_spec *spec = codec->spec;
3569 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3570 bool hp_pin_sense;
3571
3572 if (spec->ultra_low_power) {
3573 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3574 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3575 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3576 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3577 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3578 msleep(30);
3579 }
3580
3581 if (!hp_pin)
3582 hp_pin = 0x21;
3583
3584 msleep(30);
3585
3586 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3587
3588 if (hp_pin_sense)
3589 msleep(2);
3590
3591 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3592
3593 snd_hda_codec_write(codec, hp_pin, 0,
3594 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3595
3596 if (hp_pin_sense || spec->ultra_low_power)
3597 msleep(85);
3598
3599 snd_hda_codec_write(codec, hp_pin, 0,
3600 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3601
3602 if (hp_pin_sense || spec->ultra_low_power)
3603 msleep(100);
3604
3605 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3606 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3607 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3608 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3609 /*
3610 * Expose headphone mic (or possibly Line In on some machines) instead
3611 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3612 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3613 * this register.
3614 */
3615 alc_write_coef_idx(codec, 0x36, 0x5757);
3616 }
3617
3618 static void alc256_shutup(struct hda_codec *codec)
3619 {
3620 struct alc_spec *spec = codec->spec;
3621 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3622 bool hp_pin_sense;
3623
3624 if (!hp_pin)
3625 hp_pin = 0x21;
3626
3627 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3628 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3629
3630 if (hp_pin_sense)
3631 msleep(2);
3632
3633 snd_hda_codec_write(codec, hp_pin, 0,
3634 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3635
3636 if (hp_pin_sense || spec->ultra_low_power)
3637 msleep(85);
3638
3639 /* 3k pull low control for Headset jack. */
3640 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3641 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3642 * when booting with headset plugged. So skip setting it for the codec alc257
3643 */
3644 if (spec->en_3kpull_low)
3645 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3646
3647 if (!spec->no_shutup_pins)
3648 snd_hda_codec_write(codec, hp_pin, 0,
3649 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3650
3651 if (hp_pin_sense || spec->ultra_low_power)
3652 msleep(100);
3653
3654 alc_auto_setup_eapd(codec, false);
3655 alc_shutup_pins(codec);
3656 if (spec->ultra_low_power) {
3657 msleep(50);
3658 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3659 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3660 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3661 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3662 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3663 msleep(30);
3664 }
3665 }
3666
3667 static void alc285_hp_init(struct hda_codec *codec)
3668 {
3669 struct alc_spec *spec = codec->spec;
3670 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3671 int i, val;
3672 int coef38, coef0d, coef36;
3673
3674 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3675 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3676 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3677 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3678 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3679 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3680
3681 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3682
3683 if (hp_pin)
3684 snd_hda_codec_write(codec, hp_pin, 0,
3685 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3686
3687 msleep(130);
3688 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3689 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3690
3691 if (hp_pin)
3692 snd_hda_codec_write(codec, hp_pin, 0,
3693 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3694 msleep(10);
3695 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3696 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3697 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3698 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3699
3700 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3701 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3702 for (i = 0; i < 20 && val & 0x8000; i++) {
3703 msleep(50);
3704 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3705 } /* Wait for depop procedure finish */
3706
3707 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3708 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3709 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3710 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3711
3712 msleep(50);
3713 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3714 }
3715
3716 static void alc225_init(struct hda_codec *codec)
3717 {
3718 struct alc_spec *spec = codec->spec;
3719 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3720 bool hp1_pin_sense, hp2_pin_sense;
3721
3722 if (spec->ultra_low_power) {
3723 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3724 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3725 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3726 msleep(30);
3727 }
3728
3729 if (spec->codec_variant != ALC269_TYPE_ALC287 &&
3730 spec->codec_variant != ALC269_TYPE_ALC245)
3731 /* required only at boot or S3 and S4 resume time */
3732 if (!spec->done_hp_init ||
3733 is_s3_resume(codec) ||
3734 is_s4_resume(codec)) {
3735 alc285_hp_init(codec);
3736 spec->done_hp_init = true;
3737 }
3738
3739 if (!hp_pin)
3740 hp_pin = 0x21;
3741 msleep(30);
3742
3743 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3744 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3745
3746 if (hp1_pin_sense || hp2_pin_sense)
3747 msleep(2);
3748
3749 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3750
3751 if (hp1_pin_sense || spec->ultra_low_power)
3752 snd_hda_codec_write(codec, hp_pin, 0,
3753 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3754 if (hp2_pin_sense)
3755 snd_hda_codec_write(codec, 0x16, 0,
3756 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3757
3758 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3759 msleep(85);
3760
3761 if (hp1_pin_sense || spec->ultra_low_power)
3762 snd_hda_codec_write(codec, hp_pin, 0,
3763 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3764 if (hp2_pin_sense)
3765 snd_hda_codec_write(codec, 0x16, 0,
3766 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3767
3768 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3769 msleep(100);
3770
3771 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3772 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3773 }
3774
3775 static void alc225_shutup(struct hda_codec *codec)
3776 {
3777 struct alc_spec *spec = codec->spec;
3778 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3779 bool hp1_pin_sense, hp2_pin_sense;
3780
3781 if (!hp_pin)
3782 hp_pin = 0x21;
3783
3784 alc_disable_headset_jack_key(codec);
3785 /* 3k pull low control for Headset jack. */
3786 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3787
3788 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3789 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3790
3791 if (hp1_pin_sense || hp2_pin_sense)
3792 msleep(2);
3793
3794 if (hp1_pin_sense || spec->ultra_low_power)
3795 snd_hda_codec_write(codec, hp_pin, 0,
3796 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3797 if (hp2_pin_sense)
3798 snd_hda_codec_write(codec, 0x16, 0,
3799 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3800
3801 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3802 msleep(85);
3803
3804 if (hp1_pin_sense || spec->ultra_low_power)
3805 snd_hda_codec_write(codec, hp_pin, 0,
3806 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3807 if (hp2_pin_sense)
3808 snd_hda_codec_write(codec, 0x16, 0,
3809 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3810
3811 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3812 msleep(100);
3813
3814 alc_auto_setup_eapd(codec, false);
3815 alc_shutup_pins(codec);
3816 if (spec->ultra_low_power) {
3817 msleep(50);
3818 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3819 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3820 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3821 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3822 msleep(30);
3823 }
3824
3825 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3826 alc_enable_headset_jack_key(codec);
3827 }
3828
3829 static void alc_default_init(struct hda_codec *codec)
3830 {
3831 struct alc_spec *spec = codec->spec;
3832 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3833 bool hp_pin_sense;
3834
3835 if (!hp_pin)
3836 return;
3837
3838 msleep(30);
3839
3840 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3841
3842 if (hp_pin_sense)
3843 msleep(2);
3844
3845 snd_hda_codec_write(codec, hp_pin, 0,
3846 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3847
3848 if (hp_pin_sense)
3849 msleep(85);
3850
3851 snd_hda_codec_write(codec, hp_pin, 0,
3852 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3853
3854 if (hp_pin_sense)
3855 msleep(100);
3856 }
3857
3858 static void alc_default_shutup(struct hda_codec *codec)
3859 {
3860 struct alc_spec *spec = codec->spec;
3861 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3862 bool hp_pin_sense;
3863
3864 if (!hp_pin) {
3865 alc269_shutup(codec);
3866 return;
3867 }
3868
3869 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3870
3871 if (hp_pin_sense)
3872 msleep(2);
3873
3874 snd_hda_codec_write(codec, hp_pin, 0,
3875 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3876
3877 if (hp_pin_sense)
3878 msleep(85);
3879
3880 if (!spec->no_shutup_pins)
3881 snd_hda_codec_write(codec, hp_pin, 0,
3882 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3883
3884 if (hp_pin_sense)
3885 msleep(100);
3886
3887 alc_auto_setup_eapd(codec, false);
3888 alc_shutup_pins(codec);
3889 }
3890
3891 static void alc294_hp_init(struct hda_codec *codec)
3892 {
3893 struct alc_spec *spec = codec->spec;
3894 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3895 int i, val;
3896
3897 if (!hp_pin)
3898 return;
3899
3900 snd_hda_codec_write(codec, hp_pin, 0,
3901 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3902
3903 msleep(100);
3904
3905 if (!spec->no_shutup_pins)
3906 snd_hda_codec_write(codec, hp_pin, 0,
3907 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3908
3909 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3910 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3911
3912 /* Wait for depop procedure finish */
3913 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3914 for (i = 0; i < 20 && val & 0x0080; i++) {
3915 msleep(50);
3916 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3917 }
3918 /* Set HP depop to auto mode */
3919 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3920 msleep(50);
3921 }
3922
3923 static void alc294_init(struct hda_codec *codec)
3924 {
3925 struct alc_spec *spec = codec->spec;
3926
3927 /* required only at boot or S4 resume time */
3928 if (!spec->done_hp_init ||
3929 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3930 alc294_hp_init(codec);
3931 spec->done_hp_init = true;
3932 }
3933 alc_default_init(codec);
3934 }
3935
3936 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3937 unsigned int val)
3938 {
3939 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3940 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3941 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3942 }
3943
3944 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3945 {
3946 unsigned int val;
3947
3948 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3949 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3950 & 0xffff;
3951 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3952 << 16;
3953 return val;
3954 }
3955
3956 static void alc5505_dsp_halt(struct hda_codec *codec)
3957 {
3958 unsigned int val;
3959
3960 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3961 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3962 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3963 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3964 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3965 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3966 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3967 val = alc5505_coef_get(codec, 0x6220);
3968 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3969 }
3970
3971 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3972 {
3973 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3974 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3975 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3976 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3977 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3978 alc5505_coef_set(codec, 0x880c, 0x00000004);
3979 }
3980
3981 static void alc5505_dsp_init(struct hda_codec *codec)
3982 {
3983 unsigned int val;
3984
3985 alc5505_dsp_halt(codec);
3986 alc5505_dsp_back_from_halt(codec);
3987 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3988 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3989 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3990 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3991 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3992 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3993 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3994 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3995 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3996 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3997 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3998 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3999 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
4000
4001 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
4002 if (val <= 3)
4003 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4004 else
4005 alc5505_coef_set(codec, 0x6220, 0x6002018f);
4006
4007 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4008 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4009 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4010 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4011 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4012 alc5505_coef_set(codec, 0x880c, 0x00000003);
4013 alc5505_coef_set(codec, 0x880c, 0x00000010);
4014
4015 #ifdef HALT_REALTEK_ALC5505
4016 alc5505_dsp_halt(codec);
4017 #endif
4018 }
4019
4020 #ifdef HALT_REALTEK_ALC5505
4021 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
4022 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
4023 #else
4024 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
4025 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
4026 #endif
4027
4028 #ifdef CONFIG_PM
4029 static int alc269_suspend(struct hda_codec *codec)
4030 {
4031 struct alc_spec *spec = codec->spec;
4032
4033 if (spec->has_alc5505_dsp)
4034 alc5505_dsp_suspend(codec);
4035
4036 return alc_suspend(codec);
4037 }
4038
4039 static int alc269_resume(struct hda_codec *codec)
4040 {
4041 struct alc_spec *spec = codec->spec;
4042
4043 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4044 alc269vb_toggle_power_output(codec, 0);
4045 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4046 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
4047 msleep(150);
4048 }
4049
4050 codec->patch_ops.init(codec);
4051
4052 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4053 alc269vb_toggle_power_output(codec, 1);
4054 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4055 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
4056 msleep(200);
4057 }
4058
4059 snd_hda_regmap_sync(codec);
4060 hda_call_check_power_status(codec, 0x01);
4061
4062 /* on some machine, the BIOS will clear the codec gpio data when enter
4063 * suspend, and won't restore the data after resume, so we restore it
4064 * in the driver.
4065 */
4066 if (spec->gpio_data)
4067 alc_write_gpio_data(codec);
4068
4069 if (spec->has_alc5505_dsp)
4070 alc5505_dsp_resume(codec);
4071
4072 return 0;
4073 }
4074 #endif /* CONFIG_PM */
4075
4076 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4077 const struct hda_fixup *fix, int action)
4078 {
4079 struct alc_spec *spec = codec->spec;
4080
4081 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4082 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4083 }
4084
4085 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4086 const struct hda_fixup *fix,
4087 int action)
4088 {
4089 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4090 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4091
4092 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4093 snd_hda_codec_set_pincfg(codec, 0x19,
4094 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4095 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4096 }
4097
4098 static void alc269_fixup_hweq(struct hda_codec *codec,
4099 const struct hda_fixup *fix, int action)
4100 {
4101 if (action == HDA_FIXUP_ACT_INIT)
4102 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4103 }
4104
4105 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4106 const struct hda_fixup *fix, int action)
4107 {
4108 struct alc_spec *spec = codec->spec;
4109
4110 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4111 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4112 }
4113
4114 static void alc271_fixup_dmic(struct hda_codec *codec,
4115 const struct hda_fixup *fix, int action)
4116 {
4117 static const struct hda_verb verbs[] = {
4118 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4119 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4120 {}
4121 };
4122 unsigned int cfg;
4123
4124 if (strcmp(codec->core.chip_name, "ALC271X") &&
4125 strcmp(codec->core.chip_name, "ALC269VB"))
4126 return;
4127 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4128 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4129 snd_hda_sequence_write(codec, verbs);
4130 }
4131
4132 /* Fix the speaker amp after resume, etc */
4133 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4134 const struct hda_fixup *fix,
4135 int action)
4136 {
4137 if (action == HDA_FIXUP_ACT_INIT)
4138 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4139 }
4140
4141 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4142 const struct hda_fixup *fix, int action)
4143 {
4144 struct alc_spec *spec = codec->spec;
4145
4146 if (action != HDA_FIXUP_ACT_PROBE)
4147 return;
4148
4149 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4150 * fix the sample rate of analog I/O to 44.1kHz
4151 */
4152 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4153 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4154 }
4155
4156 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4157 const struct hda_fixup *fix, int action)
4158 {
4159 /* The digital-mic unit sends PDM (differential signal) instead of
4160 * the standard PCM, thus you can't record a valid mono stream as is.
4161 * Below is a workaround specific to ALC269 to control the dmic
4162 * signal source as mono.
4163 */
4164 if (action == HDA_FIXUP_ACT_INIT)
4165 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4166 }
4167
4168 static void alc269_quanta_automute(struct hda_codec *codec)
4169 {
4170 snd_hda_gen_update_outputs(codec);
4171
4172 alc_write_coef_idx(codec, 0x0c, 0x680);
4173 alc_write_coef_idx(codec, 0x0c, 0x480);
4174 }
4175
4176 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4177 const struct hda_fixup *fix, int action)
4178 {
4179 struct alc_spec *spec = codec->spec;
4180 if (action != HDA_FIXUP_ACT_PROBE)
4181 return;
4182 spec->gen.automute_hook = alc269_quanta_automute;
4183 }
4184
4185 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4186 struct hda_jack_callback *jack)
4187 {
4188 struct alc_spec *spec = codec->spec;
4189 int vref;
4190 msleep(200);
4191 snd_hda_gen_hp_automute(codec, jack);
4192
4193 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4194 msleep(100);
4195 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4196 vref);
4197 msleep(500);
4198 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4199 vref);
4200 }
4201
4202 /*
4203 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4204 */
4205 struct hda_alc298_mbxinit {
4206 unsigned char value_0x23;
4207 unsigned char value_0x25;
4208 };
4209
4210 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4211 const struct hda_alc298_mbxinit *initval,
4212 bool first)
4213 {
4214 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4215 alc_write_coef_idx(codec, 0x26, 0xb000);
4216
4217 if (first)
4218 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4219
4220 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4221 alc_write_coef_idx(codec, 0x26, 0xf000);
4222 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4223
4224 if (initval->value_0x23 != 0x1e)
4225 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4226
4227 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4228 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4229 }
4230
4231 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4232 const struct hda_fixup *fix,
4233 int action)
4234 {
4235 /* Initialization magic */
4236 static const struct hda_alc298_mbxinit dac_init[] = {
4237 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4238 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4239 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4240 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4241 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4242 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4243 {0x2f, 0x00},
4244 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4245 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4246 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4247 {}
4248 };
4249 const struct hda_alc298_mbxinit *seq;
4250
4251 if (action != HDA_FIXUP_ACT_INIT)
4252 return;
4253
4254 /* Start */
4255 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4256 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4257 alc_write_coef_idx(codec, 0x26, 0xf000);
4258 alc_write_coef_idx(codec, 0x22, 0x31);
4259 alc_write_coef_idx(codec, 0x23, 0x0b);
4260 alc_write_coef_idx(codec, 0x25, 0x00);
4261 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4262 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4263
4264 for (seq = dac_init; seq->value_0x23; seq++)
4265 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4266 }
4267
4268 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4269 const struct hda_fixup *fix, int action)
4270 {
4271 struct alc_spec *spec = codec->spec;
4272 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4273 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4274 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4275 }
4276 }
4277
4278 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4279 bool polarity, bool on)
4280 {
4281 unsigned int pinval;
4282
4283 if (!pin)
4284 return;
4285 if (polarity)
4286 on = !on;
4287 pinval = snd_hda_codec_get_pin_target(codec, pin);
4288 pinval &= ~AC_PINCTL_VREFEN;
4289 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4290 /* temporarily power up/down for setting VREF */
4291 snd_hda_power_up_pm(codec);
4292 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4293 snd_hda_power_down_pm(codec);
4294 }
4295
4296 /* update mute-LED according to the speaker mute state via mic VREF pin */
4297 static int vref_mute_led_set(struct led_classdev *led_cdev,
4298 enum led_brightness brightness)
4299 {
4300 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4301 struct alc_spec *spec = codec->spec;
4302
4303 alc_update_vref_led(codec, spec->mute_led_nid,
4304 spec->mute_led_polarity, brightness);
4305 return 0;
4306 }
4307
4308 /* Make sure the led works even in runtime suspend */
4309 static unsigned int led_power_filter(struct hda_codec *codec,
4310 hda_nid_t nid,
4311 unsigned int power_state)
4312 {
4313 struct alc_spec *spec = codec->spec;
4314
4315 if (power_state != AC_PWRST_D3 || nid == 0 ||
4316 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4317 return power_state;
4318
4319 /* Set pin ctl again, it might have just been set to 0 */
4320 snd_hda_set_pin_ctl(codec, nid,
4321 snd_hda_codec_get_pin_target(codec, nid));
4322
4323 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4324 }
4325
4326 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4327 const struct hda_fixup *fix, int action)
4328 {
4329 struct alc_spec *spec = codec->spec;
4330 const struct dmi_device *dev = NULL;
4331
4332 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4333 return;
4334
4335 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4336 int pol, pin;
4337 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4338 continue;
4339 if (pin < 0x0a || pin >= 0x10)
4340 break;
4341 spec->mute_led_polarity = pol;
4342 spec->mute_led_nid = pin - 0x0a + 0x18;
4343 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4344 codec->power_filter = led_power_filter;
4345 codec_dbg(codec,
4346 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4347 spec->mute_led_polarity);
4348 break;
4349 }
4350 }
4351
4352 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4353 const struct hda_fixup *fix,
4354 int action, hda_nid_t pin)
4355 {
4356 struct alc_spec *spec = codec->spec;
4357
4358 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4359 spec->mute_led_polarity = 0;
4360 spec->mute_led_nid = pin;
4361 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4362 codec->power_filter = led_power_filter;
4363 }
4364 }
4365
4366 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4367 const struct hda_fixup *fix, int action)
4368 {
4369 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4370 }
4371
4372 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4373 const struct hda_fixup *fix, int action)
4374 {
4375 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4376 }
4377
4378 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4379 const struct hda_fixup *fix, int action)
4380 {
4381 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4382 }
4383
4384 /* update LED status via GPIO */
4385 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4386 int polarity, bool enabled)
4387 {
4388 if (polarity)
4389 enabled = !enabled;
4390 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4391 }
4392
4393 /* turn on/off mute LED via GPIO per vmaster hook */
4394 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4395 enum led_brightness brightness)
4396 {
4397 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4398 struct alc_spec *spec = codec->spec;
4399
4400 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4401 spec->mute_led_polarity, !brightness);
4402 return 0;
4403 }
4404
4405 /* turn on/off mic-mute LED via GPIO per capture hook */
4406 static int micmute_led_set(struct led_classdev *led_cdev,
4407 enum led_brightness brightness)
4408 {
4409 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4410 struct alc_spec *spec = codec->spec;
4411
4412 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4413 spec->micmute_led_polarity, !brightness);
4414 return 0;
4415 }
4416
4417 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4418 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4419 int action,
4420 unsigned int mute_mask,
4421 unsigned int micmute_mask)
4422 {
4423 struct alc_spec *spec = codec->spec;
4424
4425 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4426
4427 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4428 return;
4429 if (mute_mask) {
4430 spec->gpio_mute_led_mask = mute_mask;
4431 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4432 }
4433 if (micmute_mask) {
4434 spec->gpio_mic_led_mask = micmute_mask;
4435 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4436 }
4437 }
4438
4439 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4440 const struct hda_fixup *fix, int action)
4441 {
4442 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4443 }
4444
4445 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4446 const struct hda_fixup *fix, int action)
4447 {
4448 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4449 }
4450
4451 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4452 const struct hda_fixup *fix, int action)
4453 {
4454 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4455 }
4456
4457 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4458 const struct hda_fixup *fix, int action)
4459 {
4460 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4461 }
4462
4463 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4464 const struct hda_fixup *fix, int action)
4465 {
4466 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4467 }
4468
4469 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4470 const struct hda_fixup *fix, int action)
4471 {
4472 struct alc_spec *spec = codec->spec;
4473
4474 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4475 spec->micmute_led_polarity = 1;
4476 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4477 }
4478
4479 /* turn on/off mic-mute LED per capture hook via VREF change */
4480 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4481 enum led_brightness brightness)
4482 {
4483 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4484 struct alc_spec *spec = codec->spec;
4485
4486 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4487 spec->micmute_led_polarity, brightness);
4488 return 0;
4489 }
4490
4491 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4492 const struct hda_fixup *fix, int action)
4493 {
4494 struct alc_spec *spec = codec->spec;
4495
4496 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4497 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4498 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4499 * enable headphone amp
4500 */
4501 spec->gpio_mask |= 0x10;
4502 spec->gpio_dir |= 0x10;
4503 spec->cap_mute_led_nid = 0x18;
4504 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4505 codec->power_filter = led_power_filter;
4506 }
4507 }
4508
4509 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4510 const struct hda_fixup *fix, int action)
4511 {
4512 struct alc_spec *spec = codec->spec;
4513
4514 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4515 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4516 spec->cap_mute_led_nid = 0x18;
4517 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4518 codec->power_filter = led_power_filter;
4519 }
4520 }
4521
4522 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4523 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4524 */
4525 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4526 const struct hda_fixup *fix, int action)
4527 {
4528 struct alc_spec *spec = codec->spec;
4529
4530 switch (action) {
4531 case HDA_FIXUP_ACT_PRE_PROBE:
4532 spec->gpio_mask |= 0x01;
4533 spec->gpio_dir |= 0x01;
4534 break;
4535 case HDA_FIXUP_ACT_INIT:
4536 /* need to toggle GPIO to enable the amp */
4537 alc_update_gpio_data(codec, 0x01, true);
4538 msleep(100);
4539 alc_update_gpio_data(codec, 0x01, false);
4540 break;
4541 }
4542 }
4543
4544 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4545 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4546 struct hda_codec *codec,
4547 struct snd_pcm_substream *substream,
4548 int action)
4549 {
4550 switch (action) {
4551 case HDA_GEN_PCM_ACT_PREPARE:
4552 alc_update_gpio_data(codec, 0x04, true);
4553 break;
4554 case HDA_GEN_PCM_ACT_CLEANUP:
4555 alc_update_gpio_data(codec, 0x04, false);
4556 break;
4557 }
4558 }
4559
4560 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4561 const struct hda_fixup *fix,
4562 int action)
4563 {
4564 struct alc_spec *spec = codec->spec;
4565
4566 if (action == HDA_FIXUP_ACT_PROBE) {
4567 spec->gpio_mask |= 0x04;
4568 spec->gpio_dir |= 0x04;
4569 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4570 }
4571 }
4572
4573 static void alc_update_coef_led(struct hda_codec *codec,
4574 struct alc_coef_led *led,
4575 bool polarity, bool on)
4576 {
4577 if (polarity)
4578 on = !on;
4579 /* temporarily power up/down for setting COEF bit */
4580 alc_update_coef_idx(codec, led->idx, led->mask,
4581 on ? led->on : led->off);
4582 }
4583
4584 /* update mute-LED according to the speaker mute state via COEF bit */
4585 static int coef_mute_led_set(struct led_classdev *led_cdev,
4586 enum led_brightness brightness)
4587 {
4588 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4589 struct alc_spec *spec = codec->spec;
4590
4591 alc_update_coef_led(codec, &spec->mute_led_coef,
4592 spec->mute_led_polarity, brightness);
4593 return 0;
4594 }
4595
4596 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4597 const struct hda_fixup *fix,
4598 int action)
4599 {
4600 struct alc_spec *spec = codec->spec;
4601
4602 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4603 spec->mute_led_polarity = 0;
4604 spec->mute_led_coef.idx = 0x0b;
4605 spec->mute_led_coef.mask = 1 << 3;
4606 spec->mute_led_coef.on = 1 << 3;
4607 spec->mute_led_coef.off = 0;
4608 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4609 }
4610 }
4611
4612 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4613 const struct hda_fixup *fix,
4614 int action)
4615 {
4616 struct alc_spec *spec = codec->spec;
4617
4618 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4619 spec->mute_led_polarity = 0;
4620 spec->mute_led_coef.idx = 0x34;
4621 spec->mute_led_coef.mask = 1 << 5;
4622 spec->mute_led_coef.on = 0;
4623 spec->mute_led_coef.off = 1 << 5;
4624 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4625 }
4626 }
4627
4628 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4629 const struct hda_fixup *fix, int action)
4630 {
4631 struct alc_spec *spec = codec->spec;
4632
4633 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4634 spec->mute_led_polarity = 0;
4635 spec->mute_led_coef.idx = 0x07;
4636 spec->mute_led_coef.mask = 1;
4637 spec->mute_led_coef.on = 1;
4638 spec->mute_led_coef.off = 0;
4639 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4640 }
4641 }
4642
4643 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4644 const struct hda_fixup *fix,
4645 int action)
4646 {
4647 struct alc_spec *spec = codec->spec;
4648
4649 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4650 spec->mute_led_polarity = 0;
4651 spec->mute_led_coef.idx = 0x0b;
4652 spec->mute_led_coef.mask = 3 << 2;
4653 spec->mute_led_coef.on = 2 << 2;
4654 spec->mute_led_coef.off = 1 << 2;
4655 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4656 }
4657 }
4658
4659 /* turn on/off mic-mute LED per capture hook by coef bit */
4660 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4661 enum led_brightness brightness)
4662 {
4663 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4664 struct alc_spec *spec = codec->spec;
4665
4666 alc_update_coef_led(codec, &spec->mic_led_coef,
4667 spec->micmute_led_polarity, brightness);
4668 return 0;
4669 }
4670
4671 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4672 const struct hda_fixup *fix, int action)
4673 {
4674 struct alc_spec *spec = codec->spec;
4675
4676 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4677 spec->mic_led_coef.idx = 0x19;
4678 spec->mic_led_coef.mask = 1 << 13;
4679 spec->mic_led_coef.on = 1 << 13;
4680 spec->mic_led_coef.off = 0;
4681 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4682 }
4683 }
4684
4685 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4686 const struct hda_fixup *fix, int action)
4687 {
4688 struct alc_spec *spec = codec->spec;
4689
4690 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4691 spec->micmute_led_polarity = 1;
4692 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4693 }
4694
4695 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4696 const struct hda_fixup *fix, int action)
4697 {
4698 struct alc_spec *spec = codec->spec;
4699
4700 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4701 spec->mic_led_coef.idx = 0x35;
4702 spec->mic_led_coef.mask = 3 << 2;
4703 spec->mic_led_coef.on = 2 << 2;
4704 spec->mic_led_coef.off = 1 << 2;
4705 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4706 }
4707 }
4708
4709 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4710 const struct hda_fixup *fix, int action)
4711 {
4712 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4713 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4714 }
4715
4716 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4717 const struct hda_fixup *fix, int action)
4718 {
4719 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4720 alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4721 }
4722
4723 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4724 const struct hda_fixup *fix, int action)
4725 {
4726 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4727 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4728 }
4729
4730 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4731 const struct hda_fixup *fix, int action)
4732 {
4733 struct alc_spec *spec = codec->spec;
4734
4735 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4736 spec->cap_mute_led_nid = 0x1a;
4737 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4738 codec->power_filter = led_power_filter;
4739 }
4740 }
4741
4742 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4743 const struct hda_fixup *fix, int action)
4744 {
4745 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4746 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4747 }
4748
4749 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4750 const unsigned short coefs[2])
4751 {
4752 alc_write_coef_idx(codec, 0x23, coefs[0]);
4753 alc_write_coef_idx(codec, 0x25, coefs[1]);
4754 alc_write_coef_idx(codec, 0x26, 0xb011);
4755 }
4756
4757 struct alc298_samsung_amp_desc {
4758 unsigned char nid;
4759 unsigned short init_seq[2][2];
4760 };
4761
4762 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4763 const struct hda_fixup *fix, int action)
4764 {
4765 int i, j;
4766 static const unsigned short init_seq[][2] = {
4767 { 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4768 { 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4769 { 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4770 { 0x41, 0x07 }, { 0x400, 0x1 }
4771 };
4772 static const struct alc298_samsung_amp_desc amps[] = {
4773 { 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4774 { 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4775 };
4776
4777 if (action != HDA_FIXUP_ACT_INIT)
4778 return;
4779
4780 for (i = 0; i < ARRAY_SIZE(amps); i++) {
4781 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4782
4783 for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4784 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4785
4786 for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4787 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4788 }
4789 }
4790
4791 #if IS_REACHABLE(CONFIG_INPUT)
4792 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4793 struct hda_jack_callback *event)
4794 {
4795 struct alc_spec *spec = codec->spec;
4796
4797 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4798 send both key on and key off event for every interrupt. */
4799 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4800 input_sync(spec->kb_dev);
4801 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4802 input_sync(spec->kb_dev);
4803 }
4804
4805 static int alc_register_micmute_input_device(struct hda_codec *codec)
4806 {
4807 struct alc_spec *spec = codec->spec;
4808 int i;
4809
4810 spec->kb_dev = input_allocate_device();
4811 if (!spec->kb_dev) {
4812 codec_err(codec, "Out of memory (input_allocate_device)\n");
4813 return -ENOMEM;
4814 }
4815
4816 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4817
4818 spec->kb_dev->name = "Microphone Mute Button";
4819 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4820 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4821 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4822 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4823 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4824 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4825
4826 if (input_register_device(spec->kb_dev)) {
4827 codec_err(codec, "input_register_device failed\n");
4828 input_free_device(spec->kb_dev);
4829 spec->kb_dev = NULL;
4830 return -ENOMEM;
4831 }
4832
4833 return 0;
4834 }
4835
4836 /* GPIO1 = set according to SKU external amp
4837 * GPIO2 = mic mute hotkey
4838 * GPIO3 = mute LED
4839 * GPIO4 = mic mute LED
4840 */
4841 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4842 const struct hda_fixup *fix, int action)
4843 {
4844 struct alc_spec *spec = codec->spec;
4845
4846 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4847 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4848 spec->init_amp = ALC_INIT_DEFAULT;
4849 if (alc_register_micmute_input_device(codec) != 0)
4850 return;
4851
4852 spec->gpio_mask |= 0x06;
4853 spec->gpio_dir |= 0x02;
4854 spec->gpio_data |= 0x02;
4855 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4856 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4857 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4858 gpio2_mic_hotkey_event);
4859 return;
4860 }
4861
4862 if (!spec->kb_dev)
4863 return;
4864
4865 switch (action) {
4866 case HDA_FIXUP_ACT_FREE:
4867 input_unregister_device(spec->kb_dev);
4868 spec->kb_dev = NULL;
4869 }
4870 }
4871
4872 /* Line2 = mic mute hotkey
4873 * GPIO2 = mic mute LED
4874 */
4875 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4876 const struct hda_fixup *fix, int action)
4877 {
4878 struct alc_spec *spec = codec->spec;
4879
4880 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4881 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4882 spec->init_amp = ALC_INIT_DEFAULT;
4883 if (alc_register_micmute_input_device(codec) != 0)
4884 return;
4885
4886 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4887 gpio2_mic_hotkey_event);
4888 return;
4889 }
4890
4891 if (!spec->kb_dev)
4892 return;
4893
4894 switch (action) {
4895 case HDA_FIXUP_ACT_FREE:
4896 input_unregister_device(spec->kb_dev);
4897 spec->kb_dev = NULL;
4898 }
4899 }
4900 #else /* INPUT */
4901 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4902 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4903 #endif /* INPUT */
4904
4905 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4906 const struct hda_fixup *fix, int action)
4907 {
4908 struct alc_spec *spec = codec->spec;
4909
4910 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4911 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4912 spec->cap_mute_led_nid = 0x18;
4913 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4914 }
4915 }
4916
4917 static const struct coef_fw alc225_pre_hsmode[] = {
4918 UPDATE_COEF(0x4a, 1<<8, 0),
4919 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4920 UPDATE_COEF(0x63, 3<<14, 3<<14),
4921 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4922 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4923 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4924 UPDATE_COEF(0x4a, 3<<10, 0),
4925 {}
4926 };
4927
4928 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4929 {
4930 struct alc_spec *spec = codec->spec;
4931 static const struct coef_fw coef0255[] = {
4932 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4933 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4934 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4935 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4936 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4937 {}
4938 };
4939 static const struct coef_fw coef0256[] = {
4940 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4941 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4942 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4943 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4944 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4945 {}
4946 };
4947 static const struct coef_fw coef0233[] = {
4948 WRITE_COEF(0x1b, 0x0c0b),
4949 WRITE_COEF(0x45, 0xc429),
4950 UPDATE_COEF(0x35, 0x4000, 0),
4951 WRITE_COEF(0x06, 0x2104),
4952 WRITE_COEF(0x1a, 0x0001),
4953 WRITE_COEF(0x26, 0x0004),
4954 WRITE_COEF(0x32, 0x42a3),
4955 {}
4956 };
4957 static const struct coef_fw coef0288[] = {
4958 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4959 UPDATE_COEF(0x50, 0x2000, 0x2000),
4960 UPDATE_COEF(0x56, 0x0006, 0x0006),
4961 UPDATE_COEF(0x66, 0x0008, 0),
4962 UPDATE_COEF(0x67, 0x2000, 0),
4963 {}
4964 };
4965 static const struct coef_fw coef0298[] = {
4966 UPDATE_COEF(0x19, 0x1300, 0x0300),
4967 {}
4968 };
4969 static const struct coef_fw coef0292[] = {
4970 WRITE_COEF(0x76, 0x000e),
4971 WRITE_COEF(0x6c, 0x2400),
4972 WRITE_COEF(0x18, 0x7308),
4973 WRITE_COEF(0x6b, 0xc429),
4974 {}
4975 };
4976 static const struct coef_fw coef0293[] = {
4977 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4978 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4979 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4980 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4981 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4982 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4983 {}
4984 };
4985 static const struct coef_fw coef0668[] = {
4986 WRITE_COEF(0x15, 0x0d40),
4987 WRITE_COEF(0xb7, 0x802b),
4988 {}
4989 };
4990 static const struct coef_fw coef0225[] = {
4991 UPDATE_COEF(0x63, 3<<14, 0),
4992 {}
4993 };
4994 static const struct coef_fw coef0274[] = {
4995 UPDATE_COEF(0x4a, 0x0100, 0),
4996 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4997 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4998 UPDATE_COEF(0x4a, 0x0010, 0),
4999 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
5000 WRITE_COEF(0x45, 0x5289),
5001 UPDATE_COEF(0x4a, 0x0c00, 0),
5002 {}
5003 };
5004
5005 if (spec->no_internal_mic_pin) {
5006 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5007 return;
5008 }
5009
5010 switch (codec->core.vendor_id) {
5011 case 0x10ec0255:
5012 alc_process_coef_fw(codec, coef0255);
5013 break;
5014 case 0x10ec0230:
5015 case 0x10ec0236:
5016 case 0x10ec0256:
5017 case 0x19e58326:
5018 alc_process_coef_fw(codec, coef0256);
5019 break;
5020 case 0x10ec0234:
5021 case 0x10ec0274:
5022 case 0x10ec0294:
5023 alc_process_coef_fw(codec, coef0274);
5024 break;
5025 case 0x10ec0233:
5026 case 0x10ec0283:
5027 alc_process_coef_fw(codec, coef0233);
5028 break;
5029 case 0x10ec0286:
5030 case 0x10ec0288:
5031 alc_process_coef_fw(codec, coef0288);
5032 break;
5033 case 0x10ec0298:
5034 alc_process_coef_fw(codec, coef0298);
5035 alc_process_coef_fw(codec, coef0288);
5036 break;
5037 case 0x10ec0292:
5038 alc_process_coef_fw(codec, coef0292);
5039 break;
5040 case 0x10ec0293:
5041 alc_process_coef_fw(codec, coef0293);
5042 break;
5043 case 0x10ec0668:
5044 alc_process_coef_fw(codec, coef0668);
5045 break;
5046 case 0x10ec0215:
5047 case 0x10ec0225:
5048 case 0x10ec0285:
5049 case 0x10ec0295:
5050 case 0x10ec0289:
5051 case 0x10ec0299:
5052 alc_process_coef_fw(codec, alc225_pre_hsmode);
5053 alc_process_coef_fw(codec, coef0225);
5054 break;
5055 case 0x10ec0867:
5056 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5057 break;
5058 }
5059 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5060 }
5061
5062
5063 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5064 hda_nid_t mic_pin)
5065 {
5066 static const struct coef_fw coef0255[] = {
5067 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5068 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5069 {}
5070 };
5071 static const struct coef_fw coef0256[] = {
5072 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5073 WRITE_COEFEX(0x57, 0x03, 0x09a3),
5074 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5075 {}
5076 };
5077 static const struct coef_fw coef0233[] = {
5078 UPDATE_COEF(0x35, 0, 1<<14),
5079 WRITE_COEF(0x06, 0x2100),
5080 WRITE_COEF(0x1a, 0x0021),
5081 WRITE_COEF(0x26, 0x008c),
5082 {}
5083 };
5084 static const struct coef_fw coef0288[] = {
5085 UPDATE_COEF(0x4f, 0x00c0, 0),
5086 UPDATE_COEF(0x50, 0x2000, 0),
5087 UPDATE_COEF(0x56, 0x0006, 0),
5088 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5089 UPDATE_COEF(0x66, 0x0008, 0x0008),
5090 UPDATE_COEF(0x67, 0x2000, 0x2000),
5091 {}
5092 };
5093 static const struct coef_fw coef0292[] = {
5094 WRITE_COEF(0x19, 0xa208),
5095 WRITE_COEF(0x2e, 0xacf0),
5096 {}
5097 };
5098 static const struct coef_fw coef0293[] = {
5099 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5100 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5101 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5102 {}
5103 };
5104 static const struct coef_fw coef0688[] = {
5105 WRITE_COEF(0xb7, 0x802b),
5106 WRITE_COEF(0xb5, 0x1040),
5107 UPDATE_COEF(0xc3, 0, 1<<12),
5108 {}
5109 };
5110 static const struct coef_fw coef0225[] = {
5111 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5112 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5113 UPDATE_COEF(0x63, 3<<14, 0),
5114 {}
5115 };
5116 static const struct coef_fw coef0274[] = {
5117 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5118 UPDATE_COEF(0x4a, 0x0010, 0),
5119 UPDATE_COEF(0x6b, 0xf000, 0),
5120 {}
5121 };
5122
5123 switch (codec->core.vendor_id) {
5124 case 0x10ec0255:
5125 alc_write_coef_idx(codec, 0x45, 0xc489);
5126 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5127 alc_process_coef_fw(codec, coef0255);
5128 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5129 break;
5130 case 0x10ec0230:
5131 case 0x10ec0236:
5132 case 0x10ec0256:
5133 case 0x19e58326:
5134 alc_write_coef_idx(codec, 0x45, 0xc489);
5135 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5136 alc_process_coef_fw(codec, coef0256);
5137 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5138 break;
5139 case 0x10ec0234:
5140 case 0x10ec0274:
5141 case 0x10ec0294:
5142 alc_write_coef_idx(codec, 0x45, 0x4689);
5143 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5144 alc_process_coef_fw(codec, coef0274);
5145 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5146 break;
5147 case 0x10ec0233:
5148 case 0x10ec0283:
5149 alc_write_coef_idx(codec, 0x45, 0xc429);
5150 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5151 alc_process_coef_fw(codec, coef0233);
5152 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5153 break;
5154 case 0x10ec0286:
5155 case 0x10ec0288:
5156 case 0x10ec0298:
5157 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5158 alc_process_coef_fw(codec, coef0288);
5159 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5160 break;
5161 case 0x10ec0292:
5162 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5163 alc_process_coef_fw(codec, coef0292);
5164 break;
5165 case 0x10ec0293:
5166 /* Set to TRS mode */
5167 alc_write_coef_idx(codec, 0x45, 0xc429);
5168 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5169 alc_process_coef_fw(codec, coef0293);
5170 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5171 break;
5172 case 0x10ec0867:
5173 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5174 fallthrough;
5175 case 0x10ec0221:
5176 case 0x10ec0662:
5177 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5178 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5179 break;
5180 case 0x10ec0668:
5181 alc_write_coef_idx(codec, 0x11, 0x0001);
5182 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5183 alc_process_coef_fw(codec, coef0688);
5184 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5185 break;
5186 case 0x10ec0215:
5187 case 0x10ec0225:
5188 case 0x10ec0285:
5189 case 0x10ec0295:
5190 case 0x10ec0289:
5191 case 0x10ec0299:
5192 alc_process_coef_fw(codec, alc225_pre_hsmode);
5193 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5194 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5195 alc_process_coef_fw(codec, coef0225);
5196 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5197 break;
5198 }
5199 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5200 }
5201
5202 static void alc_headset_mode_default(struct hda_codec *codec)
5203 {
5204 static const struct coef_fw coef0225[] = {
5205 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5206 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5207 UPDATE_COEF(0x49, 3<<8, 0<<8),
5208 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5209 UPDATE_COEF(0x63, 3<<14, 0),
5210 UPDATE_COEF(0x67, 0xf000, 0x3000),
5211 {}
5212 };
5213 static const struct coef_fw coef0255[] = {
5214 WRITE_COEF(0x45, 0xc089),
5215 WRITE_COEF(0x45, 0xc489),
5216 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5217 WRITE_COEF(0x49, 0x0049),
5218 {}
5219 };
5220 static const struct coef_fw coef0256[] = {
5221 WRITE_COEF(0x45, 0xc489),
5222 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5223 WRITE_COEF(0x49, 0x0049),
5224 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5225 WRITE_COEF(0x06, 0x6100),
5226 {}
5227 };
5228 static const struct coef_fw coef0233[] = {
5229 WRITE_COEF(0x06, 0x2100),
5230 WRITE_COEF(0x32, 0x4ea3),
5231 {}
5232 };
5233 static const struct coef_fw coef0288[] = {
5234 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5235 UPDATE_COEF(0x50, 0x2000, 0x2000),
5236 UPDATE_COEF(0x56, 0x0006, 0x0006),
5237 UPDATE_COEF(0x66, 0x0008, 0),
5238 UPDATE_COEF(0x67, 0x2000, 0),
5239 {}
5240 };
5241 static const struct coef_fw coef0292[] = {
5242 WRITE_COEF(0x76, 0x000e),
5243 WRITE_COEF(0x6c, 0x2400),
5244 WRITE_COEF(0x6b, 0xc429),
5245 WRITE_COEF(0x18, 0x7308),
5246 {}
5247 };
5248 static const struct coef_fw coef0293[] = {
5249 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5250 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5251 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5252 {}
5253 };
5254 static const struct coef_fw coef0688[] = {
5255 WRITE_COEF(0x11, 0x0041),
5256 WRITE_COEF(0x15, 0x0d40),
5257 WRITE_COEF(0xb7, 0x802b),
5258 {}
5259 };
5260 static const struct coef_fw coef0274[] = {
5261 WRITE_COEF(0x45, 0x4289),
5262 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5263 UPDATE_COEF(0x6b, 0x0f00, 0),
5264 UPDATE_COEF(0x49, 0x0300, 0x0300),
5265 {}
5266 };
5267
5268 switch (codec->core.vendor_id) {
5269 case 0x10ec0215:
5270 case 0x10ec0225:
5271 case 0x10ec0285:
5272 case 0x10ec0295:
5273 case 0x10ec0289:
5274 case 0x10ec0299:
5275 alc_process_coef_fw(codec, alc225_pre_hsmode);
5276 alc_process_coef_fw(codec, coef0225);
5277 break;
5278 case 0x10ec0255:
5279 alc_process_coef_fw(codec, coef0255);
5280 break;
5281 case 0x10ec0230:
5282 case 0x10ec0236:
5283 case 0x10ec0256:
5284 case 0x19e58326:
5285 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5286 alc_write_coef_idx(codec, 0x45, 0xc089);
5287 msleep(50);
5288 alc_process_coef_fw(codec, coef0256);
5289 break;
5290 case 0x10ec0234:
5291 case 0x10ec0274:
5292 case 0x10ec0294:
5293 alc_process_coef_fw(codec, coef0274);
5294 break;
5295 case 0x10ec0233:
5296 case 0x10ec0283:
5297 alc_process_coef_fw(codec, coef0233);
5298 break;
5299 case 0x10ec0286:
5300 case 0x10ec0288:
5301 case 0x10ec0298:
5302 alc_process_coef_fw(codec, coef0288);
5303 break;
5304 case 0x10ec0292:
5305 alc_process_coef_fw(codec, coef0292);
5306 break;
5307 case 0x10ec0293:
5308 alc_process_coef_fw(codec, coef0293);
5309 break;
5310 case 0x10ec0668:
5311 alc_process_coef_fw(codec, coef0688);
5312 break;
5313 case 0x10ec0867:
5314 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5315 break;
5316 }
5317 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5318 }
5319
5320 /* Iphone type */
5321 static void alc_headset_mode_ctia(struct hda_codec *codec)
5322 {
5323 int val;
5324
5325 static const struct coef_fw coef0255[] = {
5326 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5327 WRITE_COEF(0x1b, 0x0c2b),
5328 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5329 {}
5330 };
5331 static const struct coef_fw coef0256[] = {
5332 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5333 WRITE_COEF(0x1b, 0x0e6b),
5334 {}
5335 };
5336 static const struct coef_fw coef0233[] = {
5337 WRITE_COEF(0x45, 0xd429),
5338 WRITE_COEF(0x1b, 0x0c2b),
5339 WRITE_COEF(0x32, 0x4ea3),
5340 {}
5341 };
5342 static const struct coef_fw coef0288[] = {
5343 UPDATE_COEF(0x50, 0x2000, 0x2000),
5344 UPDATE_COEF(0x56, 0x0006, 0x0006),
5345 UPDATE_COEF(0x66, 0x0008, 0),
5346 UPDATE_COEF(0x67, 0x2000, 0),
5347 {}
5348 };
5349 static const struct coef_fw coef0292[] = {
5350 WRITE_COEF(0x6b, 0xd429),
5351 WRITE_COEF(0x76, 0x0008),
5352 WRITE_COEF(0x18, 0x7388),
5353 {}
5354 };
5355 static const struct coef_fw coef0293[] = {
5356 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5357 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5358 {}
5359 };
5360 static const struct coef_fw coef0688[] = {
5361 WRITE_COEF(0x11, 0x0001),
5362 WRITE_COEF(0x15, 0x0d60),
5363 WRITE_COEF(0xc3, 0x0000),
5364 {}
5365 };
5366 static const struct coef_fw coef0225_1[] = {
5367 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5368 UPDATE_COEF(0x63, 3<<14, 2<<14),
5369 {}
5370 };
5371 static const struct coef_fw coef0225_2[] = {
5372 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5373 UPDATE_COEF(0x63, 3<<14, 1<<14),
5374 {}
5375 };
5376
5377 switch (codec->core.vendor_id) {
5378 case 0x10ec0255:
5379 alc_process_coef_fw(codec, coef0255);
5380 break;
5381 case 0x10ec0230:
5382 case 0x10ec0236:
5383 case 0x10ec0256:
5384 case 0x19e58326:
5385 alc_process_coef_fw(codec, coef0256);
5386 break;
5387 case 0x10ec0234:
5388 case 0x10ec0274:
5389 case 0x10ec0294:
5390 alc_write_coef_idx(codec, 0x45, 0xd689);
5391 break;
5392 case 0x10ec0233:
5393 case 0x10ec0283:
5394 alc_process_coef_fw(codec, coef0233);
5395 break;
5396 case 0x10ec0298:
5397 val = alc_read_coef_idx(codec, 0x50);
5398 if (val & (1 << 12)) {
5399 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5400 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5401 msleep(300);
5402 } else {
5403 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5404 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5405 msleep(300);
5406 }
5407 break;
5408 case 0x10ec0286:
5409 case 0x10ec0288:
5410 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5411 msleep(300);
5412 alc_process_coef_fw(codec, coef0288);
5413 break;
5414 case 0x10ec0292:
5415 alc_process_coef_fw(codec, coef0292);
5416 break;
5417 case 0x10ec0293:
5418 alc_process_coef_fw(codec, coef0293);
5419 break;
5420 case 0x10ec0668:
5421 alc_process_coef_fw(codec, coef0688);
5422 break;
5423 case 0x10ec0215:
5424 case 0x10ec0225:
5425 case 0x10ec0285:
5426 case 0x10ec0295:
5427 case 0x10ec0289:
5428 case 0x10ec0299:
5429 val = alc_read_coef_idx(codec, 0x45);
5430 if (val & (1 << 9))
5431 alc_process_coef_fw(codec, coef0225_2);
5432 else
5433 alc_process_coef_fw(codec, coef0225_1);
5434 break;
5435 case 0x10ec0867:
5436 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5437 break;
5438 }
5439 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5440 }
5441
5442 /* Nokia type */
5443 static void alc_headset_mode_omtp(struct hda_codec *codec)
5444 {
5445 static const struct coef_fw coef0255[] = {
5446 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5447 WRITE_COEF(0x1b, 0x0c2b),
5448 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5449 {}
5450 };
5451 static const struct coef_fw coef0256[] = {
5452 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5453 WRITE_COEF(0x1b, 0x0e6b),
5454 {}
5455 };
5456 static const struct coef_fw coef0233[] = {
5457 WRITE_COEF(0x45, 0xe429),
5458 WRITE_COEF(0x1b, 0x0c2b),
5459 WRITE_COEF(0x32, 0x4ea3),
5460 {}
5461 };
5462 static const struct coef_fw coef0288[] = {
5463 UPDATE_COEF(0x50, 0x2000, 0x2000),
5464 UPDATE_COEF(0x56, 0x0006, 0x0006),
5465 UPDATE_COEF(0x66, 0x0008, 0),
5466 UPDATE_COEF(0x67, 0x2000, 0),
5467 {}
5468 };
5469 static const struct coef_fw coef0292[] = {
5470 WRITE_COEF(0x6b, 0xe429),
5471 WRITE_COEF(0x76, 0x0008),
5472 WRITE_COEF(0x18, 0x7388),
5473 {}
5474 };
5475 static const struct coef_fw coef0293[] = {
5476 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5477 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5478 {}
5479 };
5480 static const struct coef_fw coef0688[] = {
5481 WRITE_COEF(0x11, 0x0001),
5482 WRITE_COEF(0x15, 0x0d50),
5483 WRITE_COEF(0xc3, 0x0000),
5484 {}
5485 };
5486 static const struct coef_fw coef0225[] = {
5487 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5488 UPDATE_COEF(0x63, 3<<14, 2<<14),
5489 {}
5490 };
5491
5492 switch (codec->core.vendor_id) {
5493 case 0x10ec0255:
5494 alc_process_coef_fw(codec, coef0255);
5495 break;
5496 case 0x10ec0230:
5497 case 0x10ec0236:
5498 case 0x10ec0256:
5499 case 0x19e58326:
5500 alc_process_coef_fw(codec, coef0256);
5501 break;
5502 case 0x10ec0234:
5503 case 0x10ec0274:
5504 case 0x10ec0294:
5505 alc_write_coef_idx(codec, 0x45, 0xe689);
5506 break;
5507 case 0x10ec0233:
5508 case 0x10ec0283:
5509 alc_process_coef_fw(codec, coef0233);
5510 break;
5511 case 0x10ec0298:
5512 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5513 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5514 msleep(300);
5515 break;
5516 case 0x10ec0286:
5517 case 0x10ec0288:
5518 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5519 msleep(300);
5520 alc_process_coef_fw(codec, coef0288);
5521 break;
5522 case 0x10ec0292:
5523 alc_process_coef_fw(codec, coef0292);
5524 break;
5525 case 0x10ec0293:
5526 alc_process_coef_fw(codec, coef0293);
5527 break;
5528 case 0x10ec0668:
5529 alc_process_coef_fw(codec, coef0688);
5530 break;
5531 case 0x10ec0215:
5532 case 0x10ec0225:
5533 case 0x10ec0285:
5534 case 0x10ec0295:
5535 case 0x10ec0289:
5536 case 0x10ec0299:
5537 alc_process_coef_fw(codec, coef0225);
5538 break;
5539 }
5540 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5541 }
5542
5543 static void alc_determine_headset_type(struct hda_codec *codec)
5544 {
5545 int val;
5546 bool is_ctia = false;
5547 struct alc_spec *spec = codec->spec;
5548 static const struct coef_fw coef0255[] = {
5549 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5550 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5551 conteol) */
5552 {}
5553 };
5554 static const struct coef_fw coef0288[] = {
5555 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5556 {}
5557 };
5558 static const struct coef_fw coef0298[] = {
5559 UPDATE_COEF(0x50, 0x2000, 0x2000),
5560 UPDATE_COEF(0x56, 0x0006, 0x0006),
5561 UPDATE_COEF(0x66, 0x0008, 0),
5562 UPDATE_COEF(0x67, 0x2000, 0),
5563 UPDATE_COEF(0x19, 0x1300, 0x1300),
5564 {}
5565 };
5566 static const struct coef_fw coef0293[] = {
5567 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5568 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5569 {}
5570 };
5571 static const struct coef_fw coef0688[] = {
5572 WRITE_COEF(0x11, 0x0001),
5573 WRITE_COEF(0xb7, 0x802b),
5574 WRITE_COEF(0x15, 0x0d60),
5575 WRITE_COEF(0xc3, 0x0c00),
5576 {}
5577 };
5578 static const struct coef_fw coef0274[] = {
5579 UPDATE_COEF(0x4a, 0x0010, 0),
5580 UPDATE_COEF(0x4a, 0x8000, 0),
5581 WRITE_COEF(0x45, 0xd289),
5582 UPDATE_COEF(0x49, 0x0300, 0x0300),
5583 {}
5584 };
5585
5586 if (spec->no_internal_mic_pin) {
5587 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5588 return;
5589 }
5590
5591 switch (codec->core.vendor_id) {
5592 case 0x10ec0255:
5593 alc_process_coef_fw(codec, coef0255);
5594 msleep(300);
5595 val = alc_read_coef_idx(codec, 0x46);
5596 is_ctia = (val & 0x0070) == 0x0070;
5597 break;
5598 case 0x10ec0230:
5599 case 0x10ec0236:
5600 case 0x10ec0256:
5601 case 0x19e58326:
5602 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5603 alc_write_coef_idx(codec, 0x06, 0x6104);
5604 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5605
5606 snd_hda_codec_write(codec, 0x21, 0,
5607 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5608 msleep(80);
5609 snd_hda_codec_write(codec, 0x21, 0,
5610 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5611
5612 alc_process_coef_fw(codec, coef0255);
5613 msleep(300);
5614 val = alc_read_coef_idx(codec, 0x46);
5615 is_ctia = (val & 0x0070) == 0x0070;
5616
5617 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5618 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5619
5620 snd_hda_codec_write(codec, 0x21, 0,
5621 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5622 msleep(80);
5623 snd_hda_codec_write(codec, 0x21, 0,
5624 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5625 break;
5626 case 0x10ec0234:
5627 case 0x10ec0274:
5628 case 0x10ec0294:
5629 alc_process_coef_fw(codec, coef0274);
5630 msleep(850);
5631 val = alc_read_coef_idx(codec, 0x46);
5632 is_ctia = (val & 0x00f0) == 0x00f0;
5633 break;
5634 case 0x10ec0233:
5635 case 0x10ec0283:
5636 alc_write_coef_idx(codec, 0x45, 0xd029);
5637 msleep(300);
5638 val = alc_read_coef_idx(codec, 0x46);
5639 is_ctia = (val & 0x0070) == 0x0070;
5640 break;
5641 case 0x10ec0298:
5642 snd_hda_codec_write(codec, 0x21, 0,
5643 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5644 msleep(100);
5645 snd_hda_codec_write(codec, 0x21, 0,
5646 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5647 msleep(200);
5648
5649 val = alc_read_coef_idx(codec, 0x50);
5650 if (val & (1 << 12)) {
5651 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5652 alc_process_coef_fw(codec, coef0288);
5653 msleep(350);
5654 val = alc_read_coef_idx(codec, 0x50);
5655 is_ctia = (val & 0x0070) == 0x0070;
5656 } else {
5657 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5658 alc_process_coef_fw(codec, coef0288);
5659 msleep(350);
5660 val = alc_read_coef_idx(codec, 0x50);
5661 is_ctia = (val & 0x0070) == 0x0070;
5662 }
5663 alc_process_coef_fw(codec, coef0298);
5664 snd_hda_codec_write(codec, 0x21, 0,
5665 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5666 msleep(75);
5667 snd_hda_codec_write(codec, 0x21, 0,
5668 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5669 break;
5670 case 0x10ec0286:
5671 case 0x10ec0288:
5672 alc_process_coef_fw(codec, coef0288);
5673 msleep(350);
5674 val = alc_read_coef_idx(codec, 0x50);
5675 is_ctia = (val & 0x0070) == 0x0070;
5676 break;
5677 case 0x10ec0292:
5678 alc_write_coef_idx(codec, 0x6b, 0xd429);
5679 msleep(300);
5680 val = alc_read_coef_idx(codec, 0x6c);
5681 is_ctia = (val & 0x001c) == 0x001c;
5682 break;
5683 case 0x10ec0293:
5684 alc_process_coef_fw(codec, coef0293);
5685 msleep(300);
5686 val = alc_read_coef_idx(codec, 0x46);
5687 is_ctia = (val & 0x0070) == 0x0070;
5688 break;
5689 case 0x10ec0668:
5690 alc_process_coef_fw(codec, coef0688);
5691 msleep(300);
5692 val = alc_read_coef_idx(codec, 0xbe);
5693 is_ctia = (val & 0x1c02) == 0x1c02;
5694 break;
5695 case 0x10ec0215:
5696 case 0x10ec0225:
5697 case 0x10ec0285:
5698 case 0x10ec0295:
5699 case 0x10ec0289:
5700 case 0x10ec0299:
5701 snd_hda_codec_write(codec, 0x21, 0,
5702 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5703 msleep(80);
5704 snd_hda_codec_write(codec, 0x21, 0,
5705 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5706
5707 alc_process_coef_fw(codec, alc225_pre_hsmode);
5708 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5709 val = alc_read_coef_idx(codec, 0x45);
5710 if (val & (1 << 9)) {
5711 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5712 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5713 msleep(800);
5714 val = alc_read_coef_idx(codec, 0x46);
5715 is_ctia = (val & 0x00f0) == 0x00f0;
5716 } else {
5717 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5718 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5719 msleep(800);
5720 val = alc_read_coef_idx(codec, 0x46);
5721 is_ctia = (val & 0x00f0) == 0x00f0;
5722 }
5723 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5724 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5725 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5726
5727 snd_hda_codec_write(codec, 0x21, 0,
5728 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5729 msleep(80);
5730 snd_hda_codec_write(codec, 0x21, 0,
5731 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5732 break;
5733 case 0x10ec0867:
5734 is_ctia = true;
5735 break;
5736 }
5737
5738 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5739 is_ctia ? "yes" : "no");
5740 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5741 }
5742
5743 static void alc_update_headset_mode(struct hda_codec *codec)
5744 {
5745 struct alc_spec *spec = codec->spec;
5746
5747 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5748 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5749
5750 int new_headset_mode;
5751
5752 if (!snd_hda_jack_detect(codec, hp_pin))
5753 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5754 else if (mux_pin == spec->headset_mic_pin)
5755 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5756 else if (mux_pin == spec->headphone_mic_pin)
5757 new_headset_mode = ALC_HEADSET_MODE_MIC;
5758 else
5759 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5760
5761 if (new_headset_mode == spec->current_headset_mode) {
5762 snd_hda_gen_update_outputs(codec);
5763 return;
5764 }
5765
5766 switch (new_headset_mode) {
5767 case ALC_HEADSET_MODE_UNPLUGGED:
5768 alc_headset_mode_unplugged(codec);
5769 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5770 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5771 spec->gen.hp_jack_present = false;
5772 break;
5773 case ALC_HEADSET_MODE_HEADSET:
5774 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5775 alc_determine_headset_type(codec);
5776 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5777 alc_headset_mode_ctia(codec);
5778 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5779 alc_headset_mode_omtp(codec);
5780 spec->gen.hp_jack_present = true;
5781 break;
5782 case ALC_HEADSET_MODE_MIC:
5783 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5784 spec->gen.hp_jack_present = false;
5785 break;
5786 case ALC_HEADSET_MODE_HEADPHONE:
5787 alc_headset_mode_default(codec);
5788 spec->gen.hp_jack_present = true;
5789 break;
5790 }
5791 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5792 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5793 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5794 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5795 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5796 PIN_VREFHIZ);
5797 }
5798 spec->current_headset_mode = new_headset_mode;
5799
5800 snd_hda_gen_update_outputs(codec);
5801 }
5802
5803 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5804 struct snd_kcontrol *kcontrol,
5805 struct snd_ctl_elem_value *ucontrol)
5806 {
5807 alc_update_headset_mode(codec);
5808 }
5809
5810 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5811 struct hda_jack_callback *jack)
5812 {
5813 snd_hda_gen_hp_automute(codec, jack);
5814 alc_update_headset_mode(codec);
5815 }
5816
5817 static void alc_probe_headset_mode(struct hda_codec *codec)
5818 {
5819 int i;
5820 struct alc_spec *spec = codec->spec;
5821 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5822
5823 /* Find mic pins */
5824 for (i = 0; i < cfg->num_inputs; i++) {
5825 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5826 spec->headset_mic_pin = cfg->inputs[i].pin;
5827 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5828 spec->headphone_mic_pin = cfg->inputs[i].pin;
5829 }
5830
5831 WARN_ON(spec->gen.cap_sync_hook);
5832 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5833 spec->gen.automute_hook = alc_update_headset_mode;
5834 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5835 }
5836
5837 static void alc_fixup_headset_mode(struct hda_codec *codec,
5838 const struct hda_fixup *fix, int action)
5839 {
5840 struct alc_spec *spec = codec->spec;
5841
5842 switch (action) {
5843 case HDA_FIXUP_ACT_PRE_PROBE:
5844 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5845 break;
5846 case HDA_FIXUP_ACT_PROBE:
5847 alc_probe_headset_mode(codec);
5848 break;
5849 case HDA_FIXUP_ACT_INIT:
5850 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5851 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5852 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5853 }
5854 alc_update_headset_mode(codec);
5855 break;
5856 }
5857 }
5858
5859 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5860 const struct hda_fixup *fix, int action)
5861 {
5862 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5863 struct alc_spec *spec = codec->spec;
5864 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5865 }
5866 else
5867 alc_fixup_headset_mode(codec, fix, action);
5868 }
5869
5870 static void alc255_set_default_jack_type(struct hda_codec *codec)
5871 {
5872 /* Set to iphone type */
5873 static const struct coef_fw alc255fw[] = {
5874 WRITE_COEF(0x1b, 0x880b),
5875 WRITE_COEF(0x45, 0xd089),
5876 WRITE_COEF(0x1b, 0x080b),
5877 WRITE_COEF(0x46, 0x0004),
5878 WRITE_COEF(0x1b, 0x0c0b),
5879 {}
5880 };
5881 static const struct coef_fw alc256fw[] = {
5882 WRITE_COEF(0x1b, 0x884b),
5883 WRITE_COEF(0x45, 0xd089),
5884 WRITE_COEF(0x1b, 0x084b),
5885 WRITE_COEF(0x46, 0x0004),
5886 WRITE_COEF(0x1b, 0x0c4b),
5887 {}
5888 };
5889 switch (codec->core.vendor_id) {
5890 case 0x10ec0255:
5891 alc_process_coef_fw(codec, alc255fw);
5892 break;
5893 case 0x10ec0230:
5894 case 0x10ec0236:
5895 case 0x10ec0256:
5896 case 0x19e58326:
5897 alc_process_coef_fw(codec, alc256fw);
5898 break;
5899 }
5900 msleep(30);
5901 }
5902
5903 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5904 const struct hda_fixup *fix, int action)
5905 {
5906 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5907 alc255_set_default_jack_type(codec);
5908 }
5909 alc_fixup_headset_mode(codec, fix, action);
5910 }
5911
5912 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5913 const struct hda_fixup *fix, int action)
5914 {
5915 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5916 struct alc_spec *spec = codec->spec;
5917 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5918 alc255_set_default_jack_type(codec);
5919 }
5920 else
5921 alc_fixup_headset_mode(codec, fix, action);
5922 }
5923
5924 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5925 struct hda_jack_callback *jack)
5926 {
5927 struct alc_spec *spec = codec->spec;
5928
5929 alc_update_headset_jack_cb(codec, jack);
5930 /* Headset Mic enable or disable, only for Dell Dino */
5931 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5932 }
5933
5934 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5935 const struct hda_fixup *fix, int action)
5936 {
5937 alc_fixup_headset_mode(codec, fix, action);
5938 if (action == HDA_FIXUP_ACT_PROBE) {
5939 struct alc_spec *spec = codec->spec;
5940 /* toggled via hp_automute_hook */
5941 spec->gpio_mask |= 0x40;
5942 spec->gpio_dir |= 0x40;
5943 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5944 }
5945 }
5946
5947 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5948 const struct hda_fixup *fix, int action)
5949 {
5950 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5951 struct alc_spec *spec = codec->spec;
5952 spec->gen.auto_mute_via_amp = 1;
5953 }
5954 }
5955
5956 static void alc_fixup_no_shutup(struct hda_codec *codec,
5957 const struct hda_fixup *fix, int action)
5958 {
5959 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5960 struct alc_spec *spec = codec->spec;
5961 spec->no_shutup_pins = 1;
5962 }
5963 }
5964
5965 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5966 const struct hda_fixup *fix, int action)
5967 {
5968 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5969 struct alc_spec *spec = codec->spec;
5970 /* Disable AA-loopback as it causes white noise */
5971 spec->gen.mixer_nid = 0;
5972 }
5973 }
5974
5975 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5976 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5977 const struct hda_fixup *fix, int action)
5978 {
5979 static const struct hda_pintbl pincfgs[] = {
5980 { 0x16, 0x21211010 }, /* dock headphone */
5981 { 0x19, 0x21a11010 }, /* dock mic */
5982 { }
5983 };
5984 struct alc_spec *spec = codec->spec;
5985
5986 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5987 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5988 codec->power_save_node = 0; /* avoid click noises */
5989 snd_hda_apply_pincfgs(codec, pincfgs);
5990 }
5991 }
5992
5993 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5994 const struct hda_fixup *fix, int action)
5995 {
5996 static const struct hda_pintbl pincfgs[] = {
5997 { 0x17, 0x21211010 }, /* dock headphone */
5998 { 0x19, 0x21a11010 }, /* dock mic */
5999 { }
6000 };
6001 struct alc_spec *spec = codec->spec;
6002
6003 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6004 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6005 snd_hda_apply_pincfgs(codec, pincfgs);
6006 } else if (action == HDA_FIXUP_ACT_INIT) {
6007 /* Enable DOCK device */
6008 snd_hda_codec_write(codec, 0x17, 0,
6009 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6010 /* Enable DOCK device */
6011 snd_hda_codec_write(codec, 0x19, 0,
6012 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
6013 }
6014 }
6015
6016 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
6017 const struct hda_fixup *fix, int action)
6018 {
6019 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
6020 * the speaker output becomes too low by some reason on Thinkpads with
6021 * ALC298 codec
6022 */
6023 static const hda_nid_t preferred_pairs[] = {
6024 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
6025 0
6026 };
6027 struct alc_spec *spec = codec->spec;
6028
6029 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6030 spec->gen.preferred_dacs = preferred_pairs;
6031 }
6032
6033 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6034 const struct hda_fixup *fix, int action)
6035 {
6036 static const hda_nid_t preferred_pairs[] = {
6037 0x17, 0x02, 0x21, 0x03, 0
6038 };
6039 struct alc_spec *spec = codec->spec;
6040
6041 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6042 spec->gen.preferred_dacs = preferred_pairs;
6043 }
6044
6045 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6046 {
6047 struct alc_spec *spec = codec->spec;
6048 int hp_pin = alc_get_hp_pin(spec);
6049
6050 /* Prevent pop noises when headphones are plugged in */
6051 snd_hda_codec_write(codec, hp_pin, 0,
6052 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6053 msleep(20);
6054 }
6055
6056 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6057 const struct hda_fixup *fix, int action)
6058 {
6059 struct alc_spec *spec = codec->spec;
6060 struct hda_input_mux *imux = &spec->gen.input_mux;
6061 int i;
6062
6063 switch (action) {
6064 case HDA_FIXUP_ACT_PRE_PROBE:
6065 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6066 * it causes a click noise at start up
6067 */
6068 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6069 spec->shutup = alc_shutup_dell_xps13;
6070 break;
6071 case HDA_FIXUP_ACT_PROBE:
6072 /* Make the internal mic the default input source. */
6073 for (i = 0; i < imux->num_items; i++) {
6074 if (spec->gen.imux_pins[i] == 0x12) {
6075 spec->gen.cur_mux[0] = i;
6076 break;
6077 }
6078 }
6079 break;
6080 }
6081 }
6082
6083 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6084 const struct hda_fixup *fix, int action)
6085 {
6086 struct alc_spec *spec = codec->spec;
6087
6088 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6089 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6090 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6091
6092 /* Disable boost for mic-in permanently. (This code is only called
6093 from quirks that guarantee that the headphone is at NID 0x1b.) */
6094 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6095 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6096 } else
6097 alc_fixup_headset_mode(codec, fix, action);
6098 }
6099
6100 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6101 const struct hda_fixup *fix, int action)
6102 {
6103 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6104 alc_write_coef_idx(codec, 0xc4, 0x8000);
6105 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6106 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6107 }
6108 alc_fixup_headset_mode(codec, fix, action);
6109 }
6110
6111 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
6112 static int find_ext_mic_pin(struct hda_codec *codec)
6113 {
6114 struct alc_spec *spec = codec->spec;
6115 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6116 hda_nid_t nid;
6117 unsigned int defcfg;
6118 int i;
6119
6120 for (i = 0; i < cfg->num_inputs; i++) {
6121 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6122 continue;
6123 nid = cfg->inputs[i].pin;
6124 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6125 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6126 continue;
6127 return nid;
6128 }
6129
6130 return 0;
6131 }
6132
6133 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6134 const struct hda_fixup *fix,
6135 int action)
6136 {
6137 struct alc_spec *spec = codec->spec;
6138
6139 if (action == HDA_FIXUP_ACT_PROBE) {
6140 int mic_pin = find_ext_mic_pin(codec);
6141 int hp_pin = alc_get_hp_pin(spec);
6142
6143 if (snd_BUG_ON(!mic_pin || !hp_pin))
6144 return;
6145 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6146 }
6147 }
6148
6149 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6150 const struct hda_fixup *fix,
6151 int action)
6152 {
6153 struct alc_spec *spec = codec->spec;
6154 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6155 int i;
6156
6157 /* The mic boosts on level 2 and 3 are too noisy
6158 on the internal mic input.
6159 Therefore limit the boost to 0 or 1. */
6160
6161 if (action != HDA_FIXUP_ACT_PROBE)
6162 return;
6163
6164 for (i = 0; i < cfg->num_inputs; i++) {
6165 hda_nid_t nid = cfg->inputs[i].pin;
6166 unsigned int defcfg;
6167 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6168 continue;
6169 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6170 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6171 continue;
6172
6173 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6174 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6175 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6176 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6177 (0 << AC_AMPCAP_MUTE_SHIFT));
6178 }
6179 }
6180
6181 static void alc283_hp_automute_hook(struct hda_codec *codec,
6182 struct hda_jack_callback *jack)
6183 {
6184 struct alc_spec *spec = codec->spec;
6185 int vref;
6186
6187 msleep(200);
6188 snd_hda_gen_hp_automute(codec, jack);
6189
6190 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6191
6192 msleep(600);
6193 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6194 vref);
6195 }
6196
6197 static void alc283_fixup_chromebook(struct hda_codec *codec,
6198 const struct hda_fixup *fix, int action)
6199 {
6200 struct alc_spec *spec = codec->spec;
6201
6202 switch (action) {
6203 case HDA_FIXUP_ACT_PRE_PROBE:
6204 snd_hda_override_wcaps(codec, 0x03, 0);
6205 /* Disable AA-loopback as it causes white noise */
6206 spec->gen.mixer_nid = 0;
6207 break;
6208 case HDA_FIXUP_ACT_INIT:
6209 /* MIC2-VREF control */
6210 /* Set to manual mode */
6211 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6212 /* Enable Line1 input control by verb */
6213 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6214 break;
6215 }
6216 }
6217
6218 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6219 const struct hda_fixup *fix, int action)
6220 {
6221 struct alc_spec *spec = codec->spec;
6222
6223 switch (action) {
6224 case HDA_FIXUP_ACT_PRE_PROBE:
6225 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6226 break;
6227 case HDA_FIXUP_ACT_INIT:
6228 /* MIC2-VREF control */
6229 /* Set to manual mode */
6230 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6231 break;
6232 }
6233 }
6234
6235 /* mute tablet speaker pin (0x14) via dock plugging in addition */
6236 static void asus_tx300_automute(struct hda_codec *codec)
6237 {
6238 struct alc_spec *spec = codec->spec;
6239 snd_hda_gen_update_outputs(codec);
6240 if (snd_hda_jack_detect(codec, 0x1b))
6241 spec->gen.mute_bits |= (1ULL << 0x14);
6242 }
6243
6244 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6245 const struct hda_fixup *fix, int action)
6246 {
6247 struct alc_spec *spec = codec->spec;
6248 static const struct hda_pintbl dock_pins[] = {
6249 { 0x1b, 0x21114000 }, /* dock speaker pin */
6250 {}
6251 };
6252
6253 switch (action) {
6254 case HDA_FIXUP_ACT_PRE_PROBE:
6255 spec->init_amp = ALC_INIT_DEFAULT;
6256 /* TX300 needs to set up GPIO2 for the speaker amp */
6257 alc_setup_gpio(codec, 0x04);
6258 snd_hda_apply_pincfgs(codec, dock_pins);
6259 spec->gen.auto_mute_via_amp = 1;
6260 spec->gen.automute_hook = asus_tx300_automute;
6261 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6262 snd_hda_gen_hp_automute);
6263 break;
6264 case HDA_FIXUP_ACT_PROBE:
6265 spec->init_amp = ALC_INIT_DEFAULT;
6266 break;
6267 case HDA_FIXUP_ACT_BUILD:
6268 /* this is a bit tricky; give more sane names for the main
6269 * (tablet) speaker and the dock speaker, respectively
6270 */
6271 rename_ctl(codec, "Speaker Playback Switch",
6272 "Dock Speaker Playback Switch");
6273 rename_ctl(codec, "Bass Speaker Playback Switch",
6274 "Speaker Playback Switch");
6275 break;
6276 }
6277 }
6278
6279 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6280 const struct hda_fixup *fix, int action)
6281 {
6282 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6283 /* DAC node 0x03 is giving mono output. We therefore want to
6284 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6285 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6286 static const hda_nid_t conn1[] = { 0x0c };
6287 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6288 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6289 }
6290 }
6291
6292 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6293 const struct hda_fixup *fix, int action)
6294 {
6295 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6296 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6297 we can't adjust the speaker's volume since this node does not has
6298 Amp-out capability. we change the speaker's route to:
6299 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6300 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6301 speaker's volume now. */
6302
6303 static const hda_nid_t conn1[] = { 0x0c };
6304 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6305 }
6306 }
6307
6308 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6309 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6310 const struct hda_fixup *fix, int action)
6311 {
6312 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6313 static const hda_nid_t conn[] = { 0x02, 0x03 };
6314 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6315 }
6316 }
6317
6318 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6319 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6320 const struct hda_fixup *fix, int action)
6321 {
6322 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6323 static const hda_nid_t conn[] = { 0x02 };
6324 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6325 }
6326 }
6327
6328 /* Hook to update amp GPIO4 for automute */
6329 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6330 struct hda_jack_callback *jack)
6331 {
6332 struct alc_spec *spec = codec->spec;
6333
6334 snd_hda_gen_hp_automute(codec, jack);
6335 /* mute_led_polarity is set to 0, so we pass inverted value here */
6336 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6337 !spec->gen.hp_jack_present);
6338 }
6339
6340 /* Manage GPIOs for HP EliteBook Folio 9480m.
6341 *
6342 * GPIO4 is the headphone amplifier power control
6343 * GPIO3 is the audio output mute indicator LED
6344 */
6345
6346 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6347 const struct hda_fixup *fix,
6348 int action)
6349 {
6350 struct alc_spec *spec = codec->spec;
6351
6352 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6353 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6354 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6355 spec->gpio_mask |= 0x10;
6356 spec->gpio_dir |= 0x10;
6357 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6358 }
6359 }
6360
6361 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6362 const struct hda_fixup *fix,
6363 int action)
6364 {
6365 struct alc_spec *spec = codec->spec;
6366
6367 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6368 spec->gpio_mask |= 0x04;
6369 spec->gpio_dir |= 0x04;
6370 /* set data bit low */
6371 }
6372 }
6373
6374 /* Quirk for Thinkpad X1 7th and 8th Gen
6375 * The following fixed routing needed
6376 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6377 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6378 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6379 */
6380 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6381 const struct hda_fixup *fix, int action)
6382 {
6383 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6384 static const hda_nid_t preferred_pairs[] = {
6385 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6386 };
6387 struct alc_spec *spec = codec->spec;
6388
6389 switch (action) {
6390 case HDA_FIXUP_ACT_PRE_PROBE:
6391 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6392 spec->gen.preferred_dacs = preferred_pairs;
6393 break;
6394 case HDA_FIXUP_ACT_BUILD:
6395 /* The generic parser creates somewhat unintuitive volume ctls
6396 * with the fixed routing above, and the shared DAC2 may be
6397 * confusing for PA.
6398 * Rename those to unique names so that PA doesn't touch them
6399 * and use only Master volume.
6400 */
6401 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6402 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6403 break;
6404 }
6405 }
6406
6407 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6408 const struct hda_fixup *fix,
6409 int action)
6410 {
6411 alc_fixup_dual_codecs(codec, fix, action);
6412 switch (action) {
6413 case HDA_FIXUP_ACT_PRE_PROBE:
6414 /* override card longname to provide a unique UCM profile */
6415 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6416 break;
6417 case HDA_FIXUP_ACT_BUILD:
6418 /* rename Capture controls depending on the codec */
6419 rename_ctl(codec, "Capture Volume",
6420 codec->addr == 0 ?
6421 "Rear-Panel Capture Volume" :
6422 "Front-Panel Capture Volume");
6423 rename_ctl(codec, "Capture Switch",
6424 codec->addr == 0 ?
6425 "Rear-Panel Capture Switch" :
6426 "Front-Panel Capture Switch");
6427 break;
6428 }
6429 }
6430
6431 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6432 const struct hda_fixup *fix, int action)
6433 {
6434 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6435 return;
6436
6437 codec->power_save_node = 1;
6438 }
6439
6440 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6441 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6442 const struct hda_fixup *fix, int action)
6443 {
6444 struct alc_spec *spec = codec->spec;
6445 static const hda_nid_t preferred_pairs[] = {
6446 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6447 0
6448 };
6449
6450 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6451 return;
6452
6453 spec->gen.preferred_dacs = preferred_pairs;
6454 spec->gen.auto_mute_via_amp = 1;
6455 codec->power_save_node = 0;
6456 }
6457
6458 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6459 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6460 const struct hda_fixup *fix, int action)
6461 {
6462 static const hda_nid_t preferred_pairs[] = {
6463 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6464 };
6465 struct alc_spec *spec = codec->spec;
6466
6467 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6468 spec->gen.preferred_dacs = preferred_pairs;
6469 spec->gen.obey_preferred_dacs = 1;
6470 }
6471 }
6472
6473 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6474 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6475 const struct hda_fixup *fix, int action)
6476 {
6477 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6478 return;
6479
6480 snd_hda_override_wcaps(codec, 0x03, 0);
6481 }
6482
6483 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6484 {
6485 switch (codec->core.vendor_id) {
6486 case 0x10ec0274:
6487 case 0x10ec0294:
6488 case 0x10ec0225:
6489 case 0x10ec0295:
6490 case 0x10ec0299:
6491 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6492 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6493 break;
6494 case 0x10ec0230:
6495 case 0x10ec0235:
6496 case 0x10ec0236:
6497 case 0x10ec0255:
6498 case 0x10ec0256:
6499 case 0x19e58326:
6500 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6501 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6502 break;
6503 }
6504 }
6505
6506 static void alc295_fixup_chromebook(struct hda_codec *codec,
6507 const struct hda_fixup *fix, int action)
6508 {
6509 struct alc_spec *spec = codec->spec;
6510
6511 switch (action) {
6512 case HDA_FIXUP_ACT_PRE_PROBE:
6513 spec->ultra_low_power = true;
6514 break;
6515 case HDA_FIXUP_ACT_INIT:
6516 alc_combo_jack_hp_jd_restart(codec);
6517 break;
6518 }
6519 }
6520
6521 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6522 const struct hda_fixup *fix, int action)
6523 {
6524 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6525 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6526 }
6527
6528
6529 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6530 struct hda_jack_callback *cb)
6531 {
6532 /* The Windows driver sets the codec up in a very different way where
6533 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6534 */
6535 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6536 alc_write_coef_idx(codec, 0x10, 0x8a20);
6537 else
6538 alc_write_coef_idx(codec, 0x10, 0x0a20);
6539 }
6540
6541 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6542 const struct hda_fixup *fix, int action)
6543 {
6544 /* Pin 0x21: headphones/headset mic */
6545 if (!is_jack_detectable(codec, 0x21))
6546 return;
6547
6548 switch (action) {
6549 case HDA_FIXUP_ACT_PRE_PROBE:
6550 snd_hda_jack_detect_enable_callback(codec, 0x21,
6551 alc294_gx502_toggle_output);
6552 break;
6553 case HDA_FIXUP_ACT_INIT:
6554 /* Make sure to start in a correct state, i.e. if
6555 * headphones have been plugged in before powering up the system
6556 */
6557 alc294_gx502_toggle_output(codec, NULL);
6558 break;
6559 }
6560 }
6561
6562 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6563 struct hda_jack_callback *cb)
6564 {
6565 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6566 * responsible from changes between speakers and headphones
6567 */
6568 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6569 alc_write_coef_idx(codec, 0x10, 0x8420);
6570 else
6571 alc_write_coef_idx(codec, 0x10, 0x0a20);
6572 }
6573
6574 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6575 const struct hda_fixup *fix, int action)
6576 {
6577 if (!is_jack_detectable(codec, 0x21))
6578 return;
6579
6580 switch (action) {
6581 case HDA_FIXUP_ACT_PRE_PROBE:
6582 snd_hda_jack_detect_enable_callback(codec, 0x21,
6583 alc294_gu502_toggle_output);
6584 break;
6585 case HDA_FIXUP_ACT_INIT:
6586 alc294_gu502_toggle_output(codec, NULL);
6587 break;
6588 }
6589 }
6590
6591 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6592 const struct hda_fixup *fix, int action)
6593 {
6594 if (action != HDA_FIXUP_ACT_INIT)
6595 return;
6596
6597 msleep(100);
6598 alc_write_coef_idx(codec, 0x65, 0x0);
6599 }
6600
6601 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6602 const struct hda_fixup *fix, int action)
6603 {
6604 switch (action) {
6605 case HDA_FIXUP_ACT_INIT:
6606 alc_combo_jack_hp_jd_restart(codec);
6607 break;
6608 }
6609 }
6610
6611 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6612 const struct hda_fixup *fix, int action)
6613 {
6614 struct alc_spec *spec = codec->spec;
6615
6616 switch (action) {
6617 case HDA_FIXUP_ACT_PRE_PROBE:
6618 /* Mic RING SLEEVE swap for combo jack */
6619 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6620 spec->no_internal_mic_pin = true;
6621 break;
6622 case HDA_FIXUP_ACT_INIT:
6623 alc_combo_jack_hp_jd_restart(codec);
6624 break;
6625 }
6626 }
6627
6628 /* GPIO1 = amplifier on/off
6629 * GPIO3 = mic mute LED
6630 */
6631 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6632 const struct hda_fixup *fix, int action)
6633 {
6634 static const hda_nid_t conn[] = { 0x02 };
6635
6636 struct alc_spec *spec = codec->spec;
6637 static const struct hda_pintbl pincfgs[] = {
6638 { 0x14, 0x90170110 }, /* front/high speakers */
6639 { 0x17, 0x90170130 }, /* back/bass speakers */
6640 { }
6641 };
6642
6643 //enable micmute led
6644 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6645
6646 switch (action) {
6647 case HDA_FIXUP_ACT_PRE_PROBE:
6648 spec->micmute_led_polarity = 1;
6649 /* needed for amp of back speakers */
6650 spec->gpio_mask |= 0x01;
6651 spec->gpio_dir |= 0x01;
6652 snd_hda_apply_pincfgs(codec, pincfgs);
6653 /* share DAC to have unified volume control */
6654 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6655 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6656 break;
6657 case HDA_FIXUP_ACT_INIT:
6658 /* need to toggle GPIO to enable the amp of back speakers */
6659 alc_update_gpio_data(codec, 0x01, true);
6660 msleep(100);
6661 alc_update_gpio_data(codec, 0x01, false);
6662 break;
6663 }
6664 }
6665
6666 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6667 const struct hda_fixup *fix, int action)
6668 {
6669 static const hda_nid_t conn[] = { 0x02 };
6670 static const struct hda_pintbl pincfgs[] = {
6671 { 0x14, 0x90170110 }, /* rear speaker */
6672 { }
6673 };
6674
6675 switch (action) {
6676 case HDA_FIXUP_ACT_PRE_PROBE:
6677 snd_hda_apply_pincfgs(codec, pincfgs);
6678 /* force front speaker to DAC1 */
6679 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6680 break;
6681 }
6682 }
6683
6684 /* for hda_fixup_thinkpad_acpi() */
6685 #include "thinkpad_helper.c"
6686
6687 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6688 const struct hda_fixup *fix, int action)
6689 {
6690 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6691 hda_fixup_thinkpad_acpi(codec, fix, action);
6692 }
6693
6694 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6695 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6696 const struct hda_fixup *fix,
6697 int action)
6698 {
6699 struct alc_spec *spec = codec->spec;
6700
6701 switch (action) {
6702 case HDA_FIXUP_ACT_PRE_PROBE:
6703 spec->gen.suppress_auto_mute = 1;
6704 break;
6705 }
6706 }
6707
6708 #ifdef CONFIG_ACPI
6709 static void comp_acpi_device_notify(acpi_handle handle, u32 event, void *data)
6710 {
6711 struct hda_codec *cdc = data;
6712 struct alc_spec *spec = cdc->spec;
6713 int i;
6714
6715 codec_info(cdc, "ACPI Notification %d\n", event);
6716
6717 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6718 if (spec->comps[i].dev && spec->comps[i].acpi_notify)
6719 spec->comps[i].acpi_notify(acpi_device_handle(spec->comps[i].adev), event,
6720 spec->comps[i].dev);
6721 }
6722 }
6723
6724 static int comp_bind_acpi(struct device *dev)
6725 {
6726 struct hda_codec *cdc = dev_to_hda_codec(dev);
6727 struct alc_spec *spec = cdc->spec;
6728 bool support_notifications = false;
6729 struct acpi_device *adev;
6730 int ret;
6731 int i;
6732
6733 adev = spec->comps[0].adev;
6734 if (!acpi_device_handle(adev))
6735 return 0;
6736
6737 for (i = 0; i < HDA_MAX_COMPONENTS; i++)
6738 support_notifications = support_notifications ||
6739 spec->comps[i].acpi_notifications_supported;
6740
6741 if (support_notifications) {
6742 ret = acpi_install_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY,
6743 comp_acpi_device_notify, cdc);
6744 if (ret < 0) {
6745 codec_warn(cdc, "Failed to install notify handler: %d\n", ret);
6746 return 0;
6747 }
6748
6749 codec_dbg(cdc, "Notify handler installed\n");
6750 }
6751
6752 return 0;
6753 }
6754
6755 static void comp_unbind_acpi(struct device *dev)
6756 {
6757 struct hda_codec *cdc = dev_to_hda_codec(dev);
6758 struct alc_spec *spec = cdc->spec;
6759 struct acpi_device *adev;
6760 int ret;
6761
6762 adev = spec->comps[0].adev;
6763 if (!acpi_device_handle(adev))
6764 return;
6765
6766 ret = acpi_remove_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY,
6767 comp_acpi_device_notify);
6768 if (ret < 0)
6769 codec_warn(cdc, "Failed to uninstall notify handler: %d\n", ret);
6770 }
6771 #else
6772 static int comp_bind_acpi(struct device *dev)
6773 {
6774 return 0;
6775 }
6776
6777 static void comp_unbind_acpi(struct device *dev)
6778 {
6779 }
6780 #endif
6781
6782 static int comp_bind(struct device *dev)
6783 {
6784 struct hda_codec *cdc = dev_to_hda_codec(dev);
6785 struct alc_spec *spec = cdc->spec;
6786 int ret;
6787
6788 ret = component_bind_all(dev, spec->comps);
6789 if (ret)
6790 return ret;
6791
6792 return comp_bind_acpi(dev);
6793 }
6794
6795 static void comp_unbind(struct device *dev)
6796 {
6797 struct hda_codec *cdc = dev_to_hda_codec(dev);
6798 struct alc_spec *spec = cdc->spec;
6799
6800 comp_unbind_acpi(dev);
6801 component_unbind_all(dev, spec->comps);
6802 }
6803
6804 static const struct component_master_ops comp_master_ops = {
6805 .bind = comp_bind,
6806 .unbind = comp_unbind,
6807 };
6808
6809 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6810 struct snd_pcm_substream *sub, int action)
6811 {
6812 struct alc_spec *spec = cdc->spec;
6813 int i;
6814
6815 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6816 if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
6817 spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
6818 }
6819 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6820 if (spec->comps[i].dev && spec->comps[i].playback_hook)
6821 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6822 }
6823 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6824 if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
6825 spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
6826 }
6827 }
6828
6829 struct scodec_dev_name {
6830 const char *bus;
6831 const char *hid;
6832 int index;
6833 };
6834
6835 /* match the device name in a slightly relaxed manner */
6836 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6837 {
6838 struct scodec_dev_name *p = data;
6839 const char *d = dev_name(dev);
6840 int n = strlen(p->bus);
6841 char tmp[32];
6842
6843 /* check the bus name */
6844 if (strncmp(d, p->bus, n))
6845 return 0;
6846 /* skip the bus number */
6847 if (isdigit(d[n]))
6848 n++;
6849 /* the rest must be exact matching */
6850 snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6851 return !strcmp(d + n, tmp);
6852 }
6853
6854 static int comp_match_tas2781_dev_name(struct device *dev,
6855 void *data)
6856 {
6857 struct scodec_dev_name *p = data;
6858 const char *d = dev_name(dev);
6859 int n = strlen(p->bus);
6860 char tmp[32];
6861
6862 /* check the bus name */
6863 if (strncmp(d, p->bus, n))
6864 return 0;
6865 /* skip the bus number */
6866 if (isdigit(d[n]))
6867 n++;
6868 /* the rest must be exact matching */
6869 snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
6870
6871 return !strcmp(d + n, tmp);
6872 }
6873
6874 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6875 const char *hid, int count)
6876 {
6877 struct device *dev = hda_codec_dev(cdc);
6878 struct alc_spec *spec = cdc->spec;
6879 struct scodec_dev_name *rec;
6880 int ret, i;
6881
6882 switch (action) {
6883 case HDA_FIXUP_ACT_PRE_PROBE:
6884 for (i = 0; i < count; i++) {
6885 rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6886 if (!rec)
6887 return;
6888 rec->bus = bus;
6889 rec->hid = hid;
6890 rec->index = i;
6891 spec->comps[i].codec = cdc;
6892 component_match_add(dev, &spec->match,
6893 comp_match_cs35l41_dev_name, rec);
6894 }
6895 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6896 if (ret)
6897 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6898 else
6899 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6900 break;
6901 case HDA_FIXUP_ACT_FREE:
6902 component_master_del(dev, &comp_master_ops);
6903 break;
6904 }
6905 }
6906
6907 static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
6908 const char *bus, const char *hid)
6909 {
6910 struct device *dev = hda_codec_dev(cdc);
6911 struct alc_spec *spec = cdc->spec;
6912 struct scodec_dev_name *rec;
6913 int ret;
6914
6915 switch (action) {
6916 case HDA_FIXUP_ACT_PRE_PROBE:
6917 rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6918 if (!rec)
6919 return;
6920 rec->bus = bus;
6921 rec->hid = hid;
6922 rec->index = 0;
6923 spec->comps[0].codec = cdc;
6924 component_match_add(dev, &spec->match,
6925 comp_match_tas2781_dev_name, rec);
6926 ret = component_master_add_with_match(dev, &comp_master_ops,
6927 spec->match);
6928 if (ret)
6929 codec_err(cdc,
6930 "Fail to register component aggregator %d\n",
6931 ret);
6932 else
6933 spec->gen.pcm_playback_hook =
6934 comp_generic_playback_hook;
6935 break;
6936 case HDA_FIXUP_ACT_FREE:
6937 component_master_del(dev, &comp_master_ops);
6938 break;
6939 }
6940 }
6941
6942 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6943 {
6944 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6945 }
6946
6947 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6948 {
6949 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6950 }
6951
6952 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6953 {
6954 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6955 }
6956
6957 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6958 int action)
6959 {
6960 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6961 }
6962
6963 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6964 int action)
6965 {
6966 cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6967 }
6968
6969 static void tas2781_fixup_i2c(struct hda_codec *cdc,
6970 const struct hda_fixup *fix, int action)
6971 {
6972 tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
6973 }
6974
6975 /* for alc295_fixup_hp_top_speakers */
6976 #include "hp_x360_helper.c"
6977
6978 /* for alc285_fixup_ideapad_s740_coef() */
6979 #include "ideapad_s740_helper.c"
6980
6981 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6982 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6983 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6984 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6985 {}
6986 };
6987
6988 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6989 const struct hda_fixup *fix,
6990 int action)
6991 {
6992 /*
6993 * A certain other OS sets these coeffs to different values. On at least
6994 * one TongFang barebone these settings might survive even a cold
6995 * reboot. So to restore a clean slate the values are explicitly reset
6996 * to default here. Without this, the external microphone is always in a
6997 * plugged-in state, while the internal microphone is always in an
6998 * unplugged state, breaking the ability to use the internal microphone.
6999 */
7000 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
7001 }
7002
7003 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
7004 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
7005 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
7006 WRITE_COEF(0x49, 0x0149),
7007 {}
7008 };
7009
7010 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
7011 const struct hda_fixup *fix,
7012 int action)
7013 {
7014 /*
7015 * The audio jack input and output is not detected on the ASRock NUC Box
7016 * 1100 series when cold booting without this fix. Warm rebooting from a
7017 * certain other OS makes the audio functional, as COEF settings are
7018 * preserved in this case. This fix sets these altered COEF values as
7019 * the default.
7020 */
7021 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
7022 }
7023
7024 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
7025 const struct hda_fixup *fix,
7026 int action)
7027 {
7028 /*
7029 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
7030 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
7031 * needs an additional quirk for sound working after suspend and resume.
7032 */
7033 if (codec->core.vendor_id == 0x10ec0256) {
7034 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
7035 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
7036 } else {
7037 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
7038 }
7039 }
7040
7041 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
7042 const struct hda_fixup *fix,
7043 int action)
7044 {
7045 struct alc_spec *spec = codec->spec;
7046 struct hda_input_mux *imux = &spec->gen.input_mux;
7047 int i;
7048
7049 alc269_fixup_limit_int_mic_boost(codec, fix, action);
7050
7051 switch (action) {
7052 case HDA_FIXUP_ACT_PRE_PROBE:
7053 /**
7054 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
7055 * to Hi-Z to avoid pop noises at startup and when plugging and
7056 * unplugging headphones.
7057 */
7058 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
7059 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
7060 break;
7061 case HDA_FIXUP_ACT_PROBE:
7062 /**
7063 * Make the internal mic (0x12) the default input source to
7064 * prevent pop noises on cold boot.
7065 */
7066 for (i = 0; i < imux->num_items; i++) {
7067 if (spec->gen.imux_pins[i] == 0x12) {
7068 spec->gen.cur_mux[0] = i;
7069 break;
7070 }
7071 }
7072 break;
7073 }
7074 }
7075
7076 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
7077 const struct hda_fixup *fix, int action)
7078 {
7079 /*
7080 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
7081 * unconnected.
7082 */
7083 static const struct hda_pintbl pincfgs[] = {
7084 { 0x17, 0x90170121 },
7085 { }
7086 };
7087 /*
7088 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
7089 * DAC 0x02 and 0x03 would be fine.
7090 */
7091 static const hda_nid_t conn[] = { 0x02, 0x03 };
7092 /*
7093 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
7094 * Headphones (0x21) are connected to DAC 0x03.
7095 */
7096 static const hda_nid_t preferred_pairs[] = {
7097 0x14, 0x02,
7098 0x17, 0x02,
7099 0x21, 0x03,
7100 0
7101 };
7102 struct alc_spec *spec = codec->spec;
7103
7104 switch (action) {
7105 case HDA_FIXUP_ACT_PRE_PROBE:
7106 snd_hda_apply_pincfgs(codec, pincfgs);
7107 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7108 spec->gen.preferred_dacs = preferred_pairs;
7109 break;
7110 }
7111 }
7112
7113 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
7114 const struct hda_fixup *fix, int action)
7115 {
7116 static const struct hda_pintbl pincfgs[] = {
7117 { 0x14, 0x90170151 },
7118 { 0x17, 0x90170150 },
7119 { }
7120 };
7121 static const hda_nid_t conn[] = { 0x02, 0x03 };
7122 static const hda_nid_t preferred_pairs[] = {
7123 0x14, 0x02,
7124 0x17, 0x03,
7125 0x21, 0x02,
7126 0
7127 };
7128 struct alc_spec *spec = codec->spec;
7129
7130 alc_fixup_no_shutup(codec, fix, action);
7131
7132 switch (action) {
7133 case HDA_FIXUP_ACT_PRE_PROBE:
7134 snd_hda_apply_pincfgs(codec, pincfgs);
7135 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7136 spec->gen.preferred_dacs = preferred_pairs;
7137 break;
7138 }
7139 }
7140
7141 /* Forcibly assign NID 0x03 to HP while NID 0x02 to SPK */
7142 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
7143 const struct hda_fixup *fix, int action)
7144 {
7145 struct alc_spec *spec = codec->spec;
7146 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
7147 static const hda_nid_t preferred_pairs[] = {
7148 0x17, 0x02, 0x21, 0x03, 0
7149 };
7150
7151 if (action != HDA_FIXUP_ACT_PRE_PROBE)
7152 return;
7153
7154 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
7155 spec->gen.preferred_dacs = preferred_pairs;
7156 spec->gen.auto_mute_via_amp = 1;
7157 if (spec->gen.autocfg.speaker_pins[0] != 0x14) {
7158 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7159 0x0); /* Make sure 0x14 was disable */
7160 }
7161 }
7162 /* Fix none verb table of Headset Mic pin */
7163 static void alc_fixup_headset_mic(struct hda_codec *codec,
7164 const struct hda_fixup *fix, int action)
7165 {
7166 struct alc_spec *spec = codec->spec;
7167 static const struct hda_pintbl pincfgs[] = {
7168 { 0x19, 0x03a1103c },
7169 { }
7170 };
7171
7172 switch (action) {
7173 case HDA_FIXUP_ACT_PRE_PROBE:
7174 snd_hda_apply_pincfgs(codec, pincfgs);
7175 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
7176 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7177 break;
7178 }
7179 }
7180
7181
7182 enum {
7183 ALC269_FIXUP_GPIO2,
7184 ALC269_FIXUP_SONY_VAIO,
7185 ALC275_FIXUP_SONY_VAIO_GPIO2,
7186 ALC269_FIXUP_DELL_M101Z,
7187 ALC269_FIXUP_SKU_IGNORE,
7188 ALC269_FIXUP_ASUS_G73JW,
7189 ALC269_FIXUP_ASUS_N7601ZM_PINS,
7190 ALC269_FIXUP_ASUS_N7601ZM,
7191 ALC269_FIXUP_LENOVO_EAPD,
7192 ALC275_FIXUP_SONY_HWEQ,
7193 ALC275_FIXUP_SONY_DISABLE_AAMIX,
7194 ALC271_FIXUP_DMIC,
7195 ALC269_FIXUP_PCM_44K,
7196 ALC269_FIXUP_STEREO_DMIC,
7197 ALC269_FIXUP_HEADSET_MIC,
7198 ALC269_FIXUP_QUANTA_MUTE,
7199 ALC269_FIXUP_LIFEBOOK,
7200 ALC269_FIXUP_LIFEBOOK_EXTMIC,
7201 ALC269_FIXUP_LIFEBOOK_HP_PIN,
7202 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
7203 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
7204 ALC269_FIXUP_AMIC,
7205 ALC269_FIXUP_DMIC,
7206 ALC269VB_FIXUP_AMIC,
7207 ALC269VB_FIXUP_DMIC,
7208 ALC269_FIXUP_HP_MUTE_LED,
7209 ALC269_FIXUP_HP_MUTE_LED_MIC1,
7210 ALC269_FIXUP_HP_MUTE_LED_MIC2,
7211 ALC269_FIXUP_HP_MUTE_LED_MIC3,
7212 ALC269_FIXUP_HP_GPIO_LED,
7213 ALC269_FIXUP_HP_GPIO_MIC1_LED,
7214 ALC269_FIXUP_HP_LINE1_MIC1_LED,
7215 ALC269_FIXUP_INV_DMIC,
7216 ALC269_FIXUP_LENOVO_DOCK,
7217 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
7218 ALC269_FIXUP_NO_SHUTUP,
7219 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
7220 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
7221 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7222 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
7223 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7224 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7225 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
7226 ALC269_FIXUP_HEADSET_MODE,
7227 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
7228 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7229 ALC269_FIXUP_ASUS_X101_FUNC,
7230 ALC269_FIXUP_ASUS_X101_VERB,
7231 ALC269_FIXUP_ASUS_X101,
7232 ALC271_FIXUP_AMIC_MIC2,
7233 ALC271_FIXUP_HP_GATE_MIC_JACK,
7234 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7235 ALC269_FIXUP_ACER_AC700,
7236 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7237 ALC269VB_FIXUP_ASUS_ZENBOOK,
7238 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7239 ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7240 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7241 ALC269VB_FIXUP_ORDISSIMO_EVE2,
7242 ALC283_FIXUP_CHROME_BOOK,
7243 ALC283_FIXUP_SENSE_COMBO_JACK,
7244 ALC282_FIXUP_ASUS_TX300,
7245 ALC283_FIXUP_INT_MIC,
7246 ALC290_FIXUP_MONO_SPEAKERS,
7247 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7248 ALC290_FIXUP_SUBWOOFER,
7249 ALC290_FIXUP_SUBWOOFER_HSJACK,
7250 ALC269_FIXUP_THINKPAD_ACPI,
7251 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7252 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7253 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7254 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7255 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7256 ALC255_FIXUP_HEADSET_MODE,
7257 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7258 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7259 ALC292_FIXUP_TPT440_DOCK,
7260 ALC292_FIXUP_TPT440,
7261 ALC283_FIXUP_HEADSET_MIC,
7262 ALC255_FIXUP_MIC_MUTE_LED,
7263 ALC282_FIXUP_ASPIRE_V5_PINS,
7264 ALC269VB_FIXUP_ASPIRE_E1_COEF,
7265 ALC280_FIXUP_HP_GPIO4,
7266 ALC286_FIXUP_HP_GPIO_LED,
7267 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7268 ALC280_FIXUP_HP_DOCK_PINS,
7269 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7270 ALC280_FIXUP_HP_9480M,
7271 ALC245_FIXUP_HP_X360_AMP,
7272 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7273 ALC288_FIXUP_DELL_HEADSET_MODE,
7274 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7275 ALC288_FIXUP_DELL_XPS_13,
7276 ALC288_FIXUP_DISABLE_AAMIX,
7277 ALC292_FIXUP_DELL_E7X_AAMIX,
7278 ALC292_FIXUP_DELL_E7X,
7279 ALC292_FIXUP_DISABLE_AAMIX,
7280 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7281 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7282 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7283 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7284 ALC275_FIXUP_DELL_XPS,
7285 ALC293_FIXUP_LENOVO_SPK_NOISE,
7286 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7287 ALC255_FIXUP_DELL_SPK_NOISE,
7288 ALC225_FIXUP_DISABLE_MIC_VREF,
7289 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7290 ALC295_FIXUP_DISABLE_DAC3,
7291 ALC285_FIXUP_SPEAKER2_TO_DAC1,
7292 ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
7293 ALC285_FIXUP_ASUS_HEADSET_MIC,
7294 ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
7295 ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
7296 ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
7297 ALC280_FIXUP_HP_HEADSET_MIC,
7298 ALC221_FIXUP_HP_FRONT_MIC,
7299 ALC292_FIXUP_TPT460,
7300 ALC298_FIXUP_SPK_VOLUME,
7301 ALC298_FIXUP_LENOVO_SPK_VOLUME,
7302 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7303 ALC269_FIXUP_ATIV_BOOK_8,
7304 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7305 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7306 ALC256_FIXUP_ASUS_HEADSET_MODE,
7307 ALC256_FIXUP_ASUS_MIC,
7308 ALC256_FIXUP_ASUS_AIO_GPIO2,
7309 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7310 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7311 ALC233_FIXUP_LENOVO_MULTI_CODECS,
7312 ALC233_FIXUP_ACER_HEADSET_MIC,
7313 ALC294_FIXUP_LENOVO_MIC_LOCATION,
7314 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7315 ALC225_FIXUP_S3_POP_NOISE,
7316 ALC700_FIXUP_INTEL_REFERENCE,
7317 ALC274_FIXUP_DELL_BIND_DACS,
7318 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7319 ALC298_FIXUP_TPT470_DOCK_FIX,
7320 ALC298_FIXUP_TPT470_DOCK,
7321 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7322 ALC255_FIXUP_DELL_HEADSET_MIC,
7323 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7324 ALC298_FIXUP_HUAWEI_MBX_STEREO,
7325 ALC295_FIXUP_HP_X360,
7326 ALC221_FIXUP_HP_HEADSET_MIC,
7327 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7328 ALC295_FIXUP_HP_AUTO_MUTE,
7329 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7330 ALC294_FIXUP_ASUS_MIC,
7331 ALC294_FIXUP_ASUS_HEADSET_MIC,
7332 ALC294_FIXUP_ASUS_SPK,
7333 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7334 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7335 ALC255_FIXUP_ACER_HEADSET_MIC,
7336 ALC295_FIXUP_CHROME_BOOK,
7337 ALC225_FIXUP_HEADSET_JACK,
7338 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7339 ALC225_FIXUP_WYSE_AUTO_MUTE,
7340 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7341 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7342 ALC256_FIXUP_ASUS_HEADSET_MIC,
7343 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7344 ALC299_FIXUP_PREDATOR_SPK,
7345 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7346 ALC289_FIXUP_DELL_SPK1,
7347 ALC289_FIXUP_DELL_SPK2,
7348 ALC289_FIXUP_DUAL_SPK,
7349 ALC289_FIXUP_RTK_AMP_DUAL_SPK,
7350 ALC294_FIXUP_SPK2_TO_DAC1,
7351 ALC294_FIXUP_ASUS_DUAL_SPK,
7352 ALC285_FIXUP_THINKPAD_X1_GEN7,
7353 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7354 ALC294_FIXUP_ASUS_ALLY,
7355 ALC294_FIXUP_ASUS_ALLY_PINS,
7356 ALC294_FIXUP_ASUS_ALLY_VERBS,
7357 ALC294_FIXUP_ASUS_ALLY_SPEAKER,
7358 ALC294_FIXUP_ASUS_HPE,
7359 ALC294_FIXUP_ASUS_COEF_1B,
7360 ALC294_FIXUP_ASUS_GX502_HP,
7361 ALC294_FIXUP_ASUS_GX502_PINS,
7362 ALC294_FIXUP_ASUS_GX502_VERBS,
7363 ALC294_FIXUP_ASUS_GU502_HP,
7364 ALC294_FIXUP_ASUS_GU502_PINS,
7365 ALC294_FIXUP_ASUS_GU502_VERBS,
7366 ALC294_FIXUP_ASUS_G513_PINS,
7367 ALC285_FIXUP_ASUS_G533Z_PINS,
7368 ALC285_FIXUP_HP_GPIO_LED,
7369 ALC285_FIXUP_HP_MUTE_LED,
7370 ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7371 ALC236_FIXUP_HP_MUTE_LED_COEFBIT2,
7372 ALC236_FIXUP_HP_GPIO_LED,
7373 ALC236_FIXUP_HP_MUTE_LED,
7374 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7375 ALC298_FIXUP_SAMSUNG_AMP,
7376 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7377 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7378 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7379 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7380 ALC269VC_FIXUP_ACER_HEADSET_MIC,
7381 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7382 ALC289_FIXUP_ASUS_GA401,
7383 ALC289_FIXUP_ASUS_GA502,
7384 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7385 ALC285_FIXUP_HP_GPIO_AMP_INIT,
7386 ALC269_FIXUP_CZC_B20,
7387 ALC269_FIXUP_CZC_TMI,
7388 ALC269_FIXUP_CZC_L101,
7389 ALC269_FIXUP_LEMOTE_A1802,
7390 ALC269_FIXUP_LEMOTE_A190X,
7391 ALC256_FIXUP_INTEL_NUC8_RUGGED,
7392 ALC233_FIXUP_INTEL_NUC8_DMIC,
7393 ALC233_FIXUP_INTEL_NUC8_BOOST,
7394 ALC256_FIXUP_INTEL_NUC10,
7395 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7396 ALC274_FIXUP_HP_MIC,
7397 ALC274_FIXUP_HP_HEADSET_MIC,
7398 ALC274_FIXUP_HP_ENVY_GPIO,
7399 ALC256_FIXUP_ASUS_HPE,
7400 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7401 ALC287_FIXUP_HP_GPIO_LED,
7402 ALC256_FIXUP_HP_HEADSET_MIC,
7403 ALC245_FIXUP_HP_GPIO_LED,
7404 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7405 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7406 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7407 ALC256_FIXUP_ACER_HEADSET_MIC,
7408 ALC285_FIXUP_IDEAPAD_S740_COEF,
7409 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7410 ALC295_FIXUP_ASUS_DACS,
7411 ALC295_FIXUP_HP_OMEN,
7412 ALC285_FIXUP_HP_SPECTRE_X360,
7413 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7414 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7415 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7416 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7417 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7418 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7419 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7420 ALC298_FIXUP_LENOVO_C940_DUET7,
7421 ALC287_FIXUP_13S_GEN2_SPEAKERS,
7422 ALC256_FIXUP_SET_COEF_DEFAULTS,
7423 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7424 ALC233_FIXUP_NO_AUDIO_JACK,
7425 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7426 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7427 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7428 ALC287_FIXUP_LEGION_16ACHG6,
7429 ALC287_FIXUP_CS35L41_I2C_2,
7430 ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7431 ALC245_FIXUP_CS35L41_SPI_2,
7432 ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7433 ALC245_FIXUP_CS35L41_SPI_4,
7434 ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7435 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7436 ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7437 ALC287_FIXUP_LEGION_16ITHG6,
7438 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7439 ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7440 ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7441 ALC236_FIXUP_DELL_DUAL_CODECS,
7442 ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
7443 ALC287_FIXUP_TAS2781_I2C,
7444 ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
7445 ALC245_FIXUP_HP_X360_MUTE_LEDS,
7446 ALC287_FIXUP_THINKPAD_I2S_SPK,
7447 ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
7448 ALC2XX_FIXUP_HEADSET_MIC,
7449 ALC289_FIXUP_DELL_CS35L41_SPI_2,
7450 ALC294_FIXUP_CS35L41_I2C_2,
7451 };
7452
7453 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7454 * both have the very same PCI SSID, and we need to apply different fixups
7455 * depending on the codec ID
7456 */
7457 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7458 const struct hda_fixup *fix,
7459 int action)
7460 {
7461 int id;
7462
7463 if (codec->core.vendor_id == 0x10ec0298)
7464 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7465 else
7466 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7467 __snd_hda_apply_fixup(codec, id, action, 0);
7468 }
7469
7470 static const struct hda_fixup alc269_fixups[] = {
7471 [ALC269_FIXUP_GPIO2] = {
7472 .type = HDA_FIXUP_FUNC,
7473 .v.func = alc_fixup_gpio2,
7474 },
7475 [ALC269_FIXUP_SONY_VAIO] = {
7476 .type = HDA_FIXUP_PINCTLS,
7477 .v.pins = (const struct hda_pintbl[]) {
7478 {0x19, PIN_VREFGRD},
7479 {}
7480 }
7481 },
7482 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7483 .type = HDA_FIXUP_FUNC,
7484 .v.func = alc275_fixup_gpio4_off,
7485 .chained = true,
7486 .chain_id = ALC269_FIXUP_SONY_VAIO
7487 },
7488 [ALC269_FIXUP_DELL_M101Z] = {
7489 .type = HDA_FIXUP_VERBS,
7490 .v.verbs = (const struct hda_verb[]) {
7491 /* Enables internal speaker */
7492 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7493 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7494 {}
7495 }
7496 },
7497 [ALC269_FIXUP_SKU_IGNORE] = {
7498 .type = HDA_FIXUP_FUNC,
7499 .v.func = alc_fixup_sku_ignore,
7500 },
7501 [ALC269_FIXUP_ASUS_G73JW] = {
7502 .type = HDA_FIXUP_PINS,
7503 .v.pins = (const struct hda_pintbl[]) {
7504 { 0x17, 0x99130111 }, /* subwoofer */
7505 { }
7506 }
7507 },
7508 [ALC269_FIXUP_ASUS_N7601ZM_PINS] = {
7509 .type = HDA_FIXUP_PINS,
7510 .v.pins = (const struct hda_pintbl[]) {
7511 { 0x19, 0x03A11050 },
7512 { 0x1a, 0x03A11C30 },
7513 { 0x21, 0x03211420 },
7514 { }
7515 }
7516 },
7517 [ALC269_FIXUP_ASUS_N7601ZM] = {
7518 .type = HDA_FIXUP_VERBS,
7519 .v.verbs = (const struct hda_verb[]) {
7520 {0x20, AC_VERB_SET_COEF_INDEX, 0x62},
7521 {0x20, AC_VERB_SET_PROC_COEF, 0xa007},
7522 {0x20, AC_VERB_SET_COEF_INDEX, 0x10},
7523 {0x20, AC_VERB_SET_PROC_COEF, 0x8420},
7524 {0x20, AC_VERB_SET_COEF_INDEX, 0x0f},
7525 {0x20, AC_VERB_SET_PROC_COEF, 0x7774},
7526 { }
7527 },
7528 .chained = true,
7529 .chain_id = ALC269_FIXUP_ASUS_N7601ZM_PINS,
7530 },
7531 [ALC269_FIXUP_LENOVO_EAPD] = {
7532 .type = HDA_FIXUP_VERBS,
7533 .v.verbs = (const struct hda_verb[]) {
7534 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7535 {}
7536 }
7537 },
7538 [ALC275_FIXUP_SONY_HWEQ] = {
7539 .type = HDA_FIXUP_FUNC,
7540 .v.func = alc269_fixup_hweq,
7541 .chained = true,
7542 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7543 },
7544 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7545 .type = HDA_FIXUP_FUNC,
7546 .v.func = alc_fixup_disable_aamix,
7547 .chained = true,
7548 .chain_id = ALC269_FIXUP_SONY_VAIO
7549 },
7550 [ALC271_FIXUP_DMIC] = {
7551 .type = HDA_FIXUP_FUNC,
7552 .v.func = alc271_fixup_dmic,
7553 },
7554 [ALC269_FIXUP_PCM_44K] = {
7555 .type = HDA_FIXUP_FUNC,
7556 .v.func = alc269_fixup_pcm_44k,
7557 .chained = true,
7558 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7559 },
7560 [ALC269_FIXUP_STEREO_DMIC] = {
7561 .type = HDA_FIXUP_FUNC,
7562 .v.func = alc269_fixup_stereo_dmic,
7563 },
7564 [ALC269_FIXUP_HEADSET_MIC] = {
7565 .type = HDA_FIXUP_FUNC,
7566 .v.func = alc269_fixup_headset_mic,
7567 },
7568 [ALC269_FIXUP_QUANTA_MUTE] = {
7569 .type = HDA_FIXUP_FUNC,
7570 .v.func = alc269_fixup_quanta_mute,
7571 },
7572 [ALC269_FIXUP_LIFEBOOK] = {
7573 .type = HDA_FIXUP_PINS,
7574 .v.pins = (const struct hda_pintbl[]) {
7575 { 0x1a, 0x2101103f }, /* dock line-out */
7576 { 0x1b, 0x23a11040 }, /* dock mic-in */
7577 { }
7578 },
7579 .chained = true,
7580 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7581 },
7582 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7583 .type = HDA_FIXUP_PINS,
7584 .v.pins = (const struct hda_pintbl[]) {
7585 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7586 { }
7587 },
7588 },
7589 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7590 .type = HDA_FIXUP_PINS,
7591 .v.pins = (const struct hda_pintbl[]) {
7592 { 0x21, 0x0221102f }, /* HP out */
7593 { }
7594 },
7595 },
7596 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7597 .type = HDA_FIXUP_FUNC,
7598 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7599 },
7600 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7601 .type = HDA_FIXUP_FUNC,
7602 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7603 },
7604 [ALC269_FIXUP_AMIC] = {
7605 .type = HDA_FIXUP_PINS,
7606 .v.pins = (const struct hda_pintbl[]) {
7607 { 0x14, 0x99130110 }, /* speaker */
7608 { 0x15, 0x0121401f }, /* HP out */
7609 { 0x18, 0x01a19c20 }, /* mic */
7610 { 0x19, 0x99a3092f }, /* int-mic */
7611 { }
7612 },
7613 },
7614 [ALC269_FIXUP_DMIC] = {
7615 .type = HDA_FIXUP_PINS,
7616 .v.pins = (const struct hda_pintbl[]) {
7617 { 0x12, 0x99a3092f }, /* int-mic */
7618 { 0x14, 0x99130110 }, /* speaker */
7619 { 0x15, 0x0121401f }, /* HP out */
7620 { 0x18, 0x01a19c20 }, /* mic */
7621 { }
7622 },
7623 },
7624 [ALC269VB_FIXUP_AMIC] = {
7625 .type = HDA_FIXUP_PINS,
7626 .v.pins = (const struct hda_pintbl[]) {
7627 { 0x14, 0x99130110 }, /* speaker */
7628 { 0x18, 0x01a19c20 }, /* mic */
7629 { 0x19, 0x99a3092f }, /* int-mic */
7630 { 0x21, 0x0121401f }, /* HP out */
7631 { }
7632 },
7633 },
7634 [ALC269VB_FIXUP_DMIC] = {
7635 .type = HDA_FIXUP_PINS,
7636 .v.pins = (const struct hda_pintbl[]) {
7637 { 0x12, 0x99a3092f }, /* int-mic */
7638 { 0x14, 0x99130110 }, /* speaker */
7639 { 0x18, 0x01a19c20 }, /* mic */
7640 { 0x21, 0x0121401f }, /* HP out */
7641 { }
7642 },
7643 },
7644 [ALC269_FIXUP_HP_MUTE_LED] = {
7645 .type = HDA_FIXUP_FUNC,
7646 .v.func = alc269_fixup_hp_mute_led,
7647 },
7648 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7649 .type = HDA_FIXUP_FUNC,
7650 .v.func = alc269_fixup_hp_mute_led_mic1,
7651 },
7652 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7653 .type = HDA_FIXUP_FUNC,
7654 .v.func = alc269_fixup_hp_mute_led_mic2,
7655 },
7656 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7657 .type = HDA_FIXUP_FUNC,
7658 .v.func = alc269_fixup_hp_mute_led_mic3,
7659 .chained = true,
7660 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7661 },
7662 [ALC269_FIXUP_HP_GPIO_LED] = {
7663 .type = HDA_FIXUP_FUNC,
7664 .v.func = alc269_fixup_hp_gpio_led,
7665 },
7666 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7667 .type = HDA_FIXUP_FUNC,
7668 .v.func = alc269_fixup_hp_gpio_mic1_led,
7669 },
7670 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7671 .type = HDA_FIXUP_FUNC,
7672 .v.func = alc269_fixup_hp_line1_mic1_led,
7673 },
7674 [ALC269_FIXUP_INV_DMIC] = {
7675 .type = HDA_FIXUP_FUNC,
7676 .v.func = alc_fixup_inv_dmic,
7677 },
7678 [ALC269_FIXUP_NO_SHUTUP] = {
7679 .type = HDA_FIXUP_FUNC,
7680 .v.func = alc_fixup_no_shutup,
7681 },
7682 [ALC269_FIXUP_LENOVO_DOCK] = {
7683 .type = HDA_FIXUP_PINS,
7684 .v.pins = (const struct hda_pintbl[]) {
7685 { 0x19, 0x23a11040 }, /* dock mic */
7686 { 0x1b, 0x2121103f }, /* dock headphone */
7687 { }
7688 },
7689 .chained = true,
7690 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7691 },
7692 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7693 .type = HDA_FIXUP_FUNC,
7694 .v.func = alc269_fixup_limit_int_mic_boost,
7695 .chained = true,
7696 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7697 },
7698 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7699 .type = HDA_FIXUP_FUNC,
7700 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7701 .chained = true,
7702 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7703 },
7704 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7705 .type = HDA_FIXUP_PINS,
7706 .v.pins = (const struct hda_pintbl[]) {
7707 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7708 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7709 { }
7710 },
7711 .chained = true,
7712 .chain_id = ALC269_FIXUP_HEADSET_MODE
7713 },
7714 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7715 .type = HDA_FIXUP_PINS,
7716 .v.pins = (const struct hda_pintbl[]) {
7717 { 0x16, 0x21014020 }, /* dock line out */
7718 { 0x19, 0x21a19030 }, /* dock mic */
7719 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7720 { }
7721 },
7722 .chained = true,
7723 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7724 },
7725 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7726 .type = HDA_FIXUP_PINS,
7727 .v.pins = (const struct hda_pintbl[]) {
7728 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7729 { }
7730 },
7731 .chained = true,
7732 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7733 },
7734 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7735 .type = HDA_FIXUP_PINS,
7736 .v.pins = (const struct hda_pintbl[]) {
7737 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7738 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7739 { }
7740 },
7741 .chained = true,
7742 .chain_id = ALC269_FIXUP_HEADSET_MODE
7743 },
7744 [ALC269_FIXUP_HEADSET_MODE] = {
7745 .type = HDA_FIXUP_FUNC,
7746 .v.func = alc_fixup_headset_mode,
7747 .chained = true,
7748 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7749 },
7750 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7751 .type = HDA_FIXUP_FUNC,
7752 .v.func = alc_fixup_headset_mode_no_hp_mic,
7753 },
7754 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7755 .type = HDA_FIXUP_PINS,
7756 .v.pins = (const struct hda_pintbl[]) {
7757 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7758 { }
7759 },
7760 .chained = true,
7761 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7762 },
7763 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7764 .type = HDA_FIXUP_PINS,
7765 .v.pins = (const struct hda_pintbl[]) {
7766 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7767 { }
7768 },
7769 .chained = true,
7770 .chain_id = ALC269_FIXUP_HEADSET_MIC
7771 },
7772 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7773 .type = HDA_FIXUP_PINS,
7774 .v.pins = (const struct hda_pintbl[]) {
7775 {0x12, 0x90a60130},
7776 {0x13, 0x40000000},
7777 {0x14, 0x90170110},
7778 {0x18, 0x411111f0},
7779 {0x19, 0x04a11040},
7780 {0x1a, 0x411111f0},
7781 {0x1b, 0x90170112},
7782 {0x1d, 0x40759a05},
7783 {0x1e, 0x411111f0},
7784 {0x21, 0x04211020},
7785 { }
7786 },
7787 .chained = true,
7788 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7789 },
7790 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7791 .type = HDA_FIXUP_FUNC,
7792 .v.func = alc298_fixup_huawei_mbx_stereo,
7793 .chained = true,
7794 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7795 },
7796 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7797 .type = HDA_FIXUP_FUNC,
7798 .v.func = alc269_fixup_x101_headset_mic,
7799 },
7800 [ALC269_FIXUP_ASUS_X101_VERB] = {
7801 .type = HDA_FIXUP_VERBS,
7802 .v.verbs = (const struct hda_verb[]) {
7803 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7804 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7805 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7806 { }
7807 },
7808 .chained = true,
7809 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7810 },
7811 [ALC269_FIXUP_ASUS_X101] = {
7812 .type = HDA_FIXUP_PINS,
7813 .v.pins = (const struct hda_pintbl[]) {
7814 { 0x18, 0x04a1182c }, /* Headset mic */
7815 { }
7816 },
7817 .chained = true,
7818 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7819 },
7820 [ALC271_FIXUP_AMIC_MIC2] = {
7821 .type = HDA_FIXUP_PINS,
7822 .v.pins = (const struct hda_pintbl[]) {
7823 { 0x14, 0x99130110 }, /* speaker */
7824 { 0x19, 0x01a19c20 }, /* mic */
7825 { 0x1b, 0x99a7012f }, /* int-mic */
7826 { 0x21, 0x0121401f }, /* HP out */
7827 { }
7828 },
7829 },
7830 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7831 .type = HDA_FIXUP_FUNC,
7832 .v.func = alc271_hp_gate_mic_jack,
7833 .chained = true,
7834 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7835 },
7836 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7837 .type = HDA_FIXUP_FUNC,
7838 .v.func = alc269_fixup_limit_int_mic_boost,
7839 .chained = true,
7840 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7841 },
7842 [ALC269_FIXUP_ACER_AC700] = {
7843 .type = HDA_FIXUP_PINS,
7844 .v.pins = (const struct hda_pintbl[]) {
7845 { 0x12, 0x99a3092f }, /* int-mic */
7846 { 0x14, 0x99130110 }, /* speaker */
7847 { 0x18, 0x03a11c20 }, /* mic */
7848 { 0x1e, 0x0346101e }, /* SPDIF1 */
7849 { 0x21, 0x0321101f }, /* HP out */
7850 { }
7851 },
7852 .chained = true,
7853 .chain_id = ALC271_FIXUP_DMIC,
7854 },
7855 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7856 .type = HDA_FIXUP_FUNC,
7857 .v.func = alc269_fixup_limit_int_mic_boost,
7858 .chained = true,
7859 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7860 },
7861 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7862 .type = HDA_FIXUP_FUNC,
7863 .v.func = alc269_fixup_limit_int_mic_boost,
7864 .chained = true,
7865 .chain_id = ALC269VB_FIXUP_DMIC,
7866 },
7867 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7868 .type = HDA_FIXUP_VERBS,
7869 .v.verbs = (const struct hda_verb[]) {
7870 /* class-D output amp +5dB */
7871 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7872 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7873 {}
7874 },
7875 .chained = true,
7876 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7877 },
7878 [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7879 .type = HDA_FIXUP_PINS,
7880 .v.pins = (const struct hda_pintbl[]) {
7881 { 0x18, 0x01a110f0 }, /* use as headset mic */
7882 { }
7883 },
7884 .chained = true,
7885 .chain_id = ALC269_FIXUP_HEADSET_MIC
7886 },
7887 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7888 .type = HDA_FIXUP_FUNC,
7889 .v.func = alc269_fixup_limit_int_mic_boost,
7890 .chained = true,
7891 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7892 },
7893 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7894 .type = HDA_FIXUP_PINS,
7895 .v.pins = (const struct hda_pintbl[]) {
7896 { 0x12, 0x99a3092f }, /* int-mic */
7897 { 0x18, 0x03a11d20 }, /* mic */
7898 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7899 { }
7900 },
7901 },
7902 [ALC283_FIXUP_CHROME_BOOK] = {
7903 .type = HDA_FIXUP_FUNC,
7904 .v.func = alc283_fixup_chromebook,
7905 },
7906 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7907 .type = HDA_FIXUP_FUNC,
7908 .v.func = alc283_fixup_sense_combo_jack,
7909 .chained = true,
7910 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7911 },
7912 [ALC282_FIXUP_ASUS_TX300] = {
7913 .type = HDA_FIXUP_FUNC,
7914 .v.func = alc282_fixup_asus_tx300,
7915 },
7916 [ALC283_FIXUP_INT_MIC] = {
7917 .type = HDA_FIXUP_VERBS,
7918 .v.verbs = (const struct hda_verb[]) {
7919 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7920 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7921 { }
7922 },
7923 .chained = true,
7924 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7925 },
7926 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7927 .type = HDA_FIXUP_PINS,
7928 .v.pins = (const struct hda_pintbl[]) {
7929 { 0x17, 0x90170112 }, /* subwoofer */
7930 { }
7931 },
7932 .chained = true,
7933 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7934 },
7935 [ALC290_FIXUP_SUBWOOFER] = {
7936 .type = HDA_FIXUP_PINS,
7937 .v.pins = (const struct hda_pintbl[]) {
7938 { 0x17, 0x90170112 }, /* subwoofer */
7939 { }
7940 },
7941 .chained = true,
7942 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7943 },
7944 [ALC290_FIXUP_MONO_SPEAKERS] = {
7945 .type = HDA_FIXUP_FUNC,
7946 .v.func = alc290_fixup_mono_speakers,
7947 },
7948 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7949 .type = HDA_FIXUP_FUNC,
7950 .v.func = alc290_fixup_mono_speakers,
7951 .chained = true,
7952 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7953 },
7954 [ALC269_FIXUP_THINKPAD_ACPI] = {
7955 .type = HDA_FIXUP_FUNC,
7956 .v.func = alc_fixup_thinkpad_acpi,
7957 .chained = true,
7958 .chain_id = ALC269_FIXUP_SKU_IGNORE,
7959 },
7960 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7961 .type = HDA_FIXUP_FUNC,
7962 .v.func = alc_fixup_inv_dmic,
7963 .chained = true,
7964 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7965 },
7966 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
7967 .type = HDA_FIXUP_PINS,
7968 .v.pins = (const struct hda_pintbl[]) {
7969 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7970 { }
7971 },
7972 .chained = true,
7973 .chain_id = ALC255_FIXUP_HEADSET_MODE
7974 },
7975 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7976 .type = HDA_FIXUP_PINS,
7977 .v.pins = (const struct hda_pintbl[]) {
7978 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7979 { }
7980 },
7981 .chained = true,
7982 .chain_id = ALC255_FIXUP_HEADSET_MODE
7983 },
7984 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7985 .type = HDA_FIXUP_PINS,
7986 .v.pins = (const struct hda_pintbl[]) {
7987 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7988 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7989 { }
7990 },
7991 .chained = true,
7992 .chain_id = ALC255_FIXUP_HEADSET_MODE
7993 },
7994 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7995 .type = HDA_FIXUP_PINS,
7996 .v.pins = (const struct hda_pintbl[]) {
7997 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7998 { }
7999 },
8000 .chained = true,
8001 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8002 },
8003 [ALC255_FIXUP_HEADSET_MODE] = {
8004 .type = HDA_FIXUP_FUNC,
8005 .v.func = alc_fixup_headset_mode_alc255,
8006 .chained = true,
8007 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8008 },
8009 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
8010 .type = HDA_FIXUP_FUNC,
8011 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
8012 },
8013 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8014 .type = HDA_FIXUP_PINS,
8015 .v.pins = (const struct hda_pintbl[]) {
8016 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8017 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8018 { }
8019 },
8020 .chained = true,
8021 .chain_id = ALC269_FIXUP_HEADSET_MODE
8022 },
8023 [ALC292_FIXUP_TPT440_DOCK] = {
8024 .type = HDA_FIXUP_FUNC,
8025 .v.func = alc_fixup_tpt440_dock,
8026 .chained = true,
8027 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
8028 },
8029 [ALC292_FIXUP_TPT440] = {
8030 .type = HDA_FIXUP_FUNC,
8031 .v.func = alc_fixup_disable_aamix,
8032 .chained = true,
8033 .chain_id = ALC292_FIXUP_TPT440_DOCK,
8034 },
8035 [ALC283_FIXUP_HEADSET_MIC] = {
8036 .type = HDA_FIXUP_PINS,
8037 .v.pins = (const struct hda_pintbl[]) {
8038 { 0x19, 0x04a110f0 },
8039 { },
8040 },
8041 },
8042 [ALC255_FIXUP_MIC_MUTE_LED] = {
8043 .type = HDA_FIXUP_FUNC,
8044 .v.func = alc_fixup_micmute_led,
8045 },
8046 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
8047 .type = HDA_FIXUP_PINS,
8048 .v.pins = (const struct hda_pintbl[]) {
8049 { 0x12, 0x90a60130 },
8050 { 0x14, 0x90170110 },
8051 { 0x17, 0x40000008 },
8052 { 0x18, 0x411111f0 },
8053 { 0x19, 0x01a1913c },
8054 { 0x1a, 0x411111f0 },
8055 { 0x1b, 0x411111f0 },
8056 { 0x1d, 0x40f89b2d },
8057 { 0x1e, 0x411111f0 },
8058 { 0x21, 0x0321101f },
8059 { },
8060 },
8061 },
8062 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
8063 .type = HDA_FIXUP_FUNC,
8064 .v.func = alc269vb_fixup_aspire_e1_coef,
8065 },
8066 [ALC280_FIXUP_HP_GPIO4] = {
8067 .type = HDA_FIXUP_FUNC,
8068 .v.func = alc280_fixup_hp_gpio4,
8069 },
8070 [ALC286_FIXUP_HP_GPIO_LED] = {
8071 .type = HDA_FIXUP_FUNC,
8072 .v.func = alc286_fixup_hp_gpio_led,
8073 },
8074 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
8075 .type = HDA_FIXUP_FUNC,
8076 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
8077 },
8078 [ALC280_FIXUP_HP_DOCK_PINS] = {
8079 .type = HDA_FIXUP_PINS,
8080 .v.pins = (const struct hda_pintbl[]) {
8081 { 0x1b, 0x21011020 }, /* line-out */
8082 { 0x1a, 0x01a1903c }, /* headset mic */
8083 { 0x18, 0x2181103f }, /* line-in */
8084 { },
8085 },
8086 .chained = true,
8087 .chain_id = ALC280_FIXUP_HP_GPIO4
8088 },
8089 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
8090 .type = HDA_FIXUP_PINS,
8091 .v.pins = (const struct hda_pintbl[]) {
8092 { 0x1b, 0x21011020 }, /* line-out */
8093 { 0x18, 0x2181103f }, /* line-in */
8094 { },
8095 },
8096 .chained = true,
8097 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
8098 },
8099 [ALC280_FIXUP_HP_9480M] = {
8100 .type = HDA_FIXUP_FUNC,
8101 .v.func = alc280_fixup_hp_9480m,
8102 },
8103 [ALC245_FIXUP_HP_X360_AMP] = {
8104 .type = HDA_FIXUP_FUNC,
8105 .v.func = alc245_fixup_hp_x360_amp,
8106 .chained = true,
8107 .chain_id = ALC245_FIXUP_HP_GPIO_LED
8108 },
8109 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
8110 .type = HDA_FIXUP_FUNC,
8111 .v.func = alc_fixup_headset_mode_dell_alc288,
8112 .chained = true,
8113 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
8114 },
8115 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8116 .type = HDA_FIXUP_PINS,
8117 .v.pins = (const struct hda_pintbl[]) {
8118 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8119 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8120 { }
8121 },
8122 .chained = true,
8123 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
8124 },
8125 [ALC288_FIXUP_DISABLE_AAMIX] = {
8126 .type = HDA_FIXUP_FUNC,
8127 .v.func = alc_fixup_disable_aamix,
8128 .chained = true,
8129 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
8130 },
8131 [ALC288_FIXUP_DELL_XPS_13] = {
8132 .type = HDA_FIXUP_FUNC,
8133 .v.func = alc_fixup_dell_xps13,
8134 .chained = true,
8135 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
8136 },
8137 [ALC292_FIXUP_DISABLE_AAMIX] = {
8138 .type = HDA_FIXUP_FUNC,
8139 .v.func = alc_fixup_disable_aamix,
8140 .chained = true,
8141 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
8142 },
8143 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
8144 .type = HDA_FIXUP_FUNC,
8145 .v.func = alc_fixup_disable_aamix,
8146 .chained = true,
8147 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
8148 },
8149 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
8150 .type = HDA_FIXUP_FUNC,
8151 .v.func = alc_fixup_dell_xps13,
8152 .chained = true,
8153 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
8154 },
8155 [ALC292_FIXUP_DELL_E7X] = {
8156 .type = HDA_FIXUP_FUNC,
8157 .v.func = alc_fixup_micmute_led,
8158 /* micmute fixup must be applied at last */
8159 .chained_before = true,
8160 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
8161 },
8162 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
8163 .type = HDA_FIXUP_PINS,
8164 .v.pins = (const struct hda_pintbl[]) {
8165 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
8166 { }
8167 },
8168 .chained_before = true,
8169 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8170 },
8171 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8172 .type = HDA_FIXUP_PINS,
8173 .v.pins = (const struct hda_pintbl[]) {
8174 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8175 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8176 { }
8177 },
8178 .chained = true,
8179 .chain_id = ALC269_FIXUP_HEADSET_MODE
8180 },
8181 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
8182 .type = HDA_FIXUP_PINS,
8183 .v.pins = (const struct hda_pintbl[]) {
8184 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8185 { }
8186 },
8187 .chained = true,
8188 .chain_id = ALC269_FIXUP_HEADSET_MODE
8189 },
8190 [ALC275_FIXUP_DELL_XPS] = {
8191 .type = HDA_FIXUP_VERBS,
8192 .v.verbs = (const struct hda_verb[]) {
8193 /* Enables internal speaker */
8194 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
8195 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
8196 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
8197 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
8198 {}
8199 }
8200 },
8201 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
8202 .type = HDA_FIXUP_FUNC,
8203 .v.func = alc_fixup_disable_aamix,
8204 .chained = true,
8205 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8206 },
8207 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
8208 .type = HDA_FIXUP_FUNC,
8209 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
8210 },
8211 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
8212 .type = HDA_FIXUP_FUNC,
8213 .v.func = alc_fixup_inv_dmic,
8214 .chained = true,
8215 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
8216 },
8217 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
8218 .type = HDA_FIXUP_FUNC,
8219 .v.func = alc269_fixup_limit_int_mic_boost
8220 },
8221 [ALC255_FIXUP_DELL_SPK_NOISE] = {
8222 .type = HDA_FIXUP_FUNC,
8223 .v.func = alc_fixup_disable_aamix,
8224 .chained = true,
8225 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8226 },
8227 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
8228 .type = HDA_FIXUP_FUNC,
8229 .v.func = alc_fixup_disable_mic_vref,
8230 .chained = true,
8231 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8232 },
8233 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
8234 .type = HDA_FIXUP_VERBS,
8235 .v.verbs = (const struct hda_verb[]) {
8236 /* Disable pass-through path for FRONT 14h */
8237 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8238 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8239 {}
8240 },
8241 .chained = true,
8242 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
8243 },
8244 [ALC280_FIXUP_HP_HEADSET_MIC] = {
8245 .type = HDA_FIXUP_FUNC,
8246 .v.func = alc_fixup_disable_aamix,
8247 .chained = true,
8248 .chain_id = ALC269_FIXUP_HEADSET_MIC,
8249 },
8250 [ALC221_FIXUP_HP_FRONT_MIC] = {
8251 .type = HDA_FIXUP_PINS,
8252 .v.pins = (const struct hda_pintbl[]) {
8253 { 0x19, 0x02a19020 }, /* Front Mic */
8254 { }
8255 },
8256 },
8257 [ALC292_FIXUP_TPT460] = {
8258 .type = HDA_FIXUP_FUNC,
8259 .v.func = alc_fixup_tpt440_dock,
8260 .chained = true,
8261 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
8262 },
8263 [ALC298_FIXUP_SPK_VOLUME] = {
8264 .type = HDA_FIXUP_FUNC,
8265 .v.func = alc298_fixup_speaker_volume,
8266 .chained = true,
8267 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
8268 },
8269 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
8270 .type = HDA_FIXUP_FUNC,
8271 .v.func = alc298_fixup_speaker_volume,
8272 },
8273 [ALC295_FIXUP_DISABLE_DAC3] = {
8274 .type = HDA_FIXUP_FUNC,
8275 .v.func = alc295_fixup_disable_dac3,
8276 },
8277 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8278 .type = HDA_FIXUP_FUNC,
8279 .v.func = alc285_fixup_speaker2_to_dac1,
8280 .chained = true,
8281 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8282 },
8283 [ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1] = {
8284 .type = HDA_FIXUP_FUNC,
8285 .v.func = alc285_fixup_speaker2_to_dac1,
8286 .chained = true,
8287 .chain_id = ALC245_FIXUP_CS35L41_SPI_2
8288 },
8289 [ALC285_FIXUP_ASUS_HEADSET_MIC] = {
8290 .type = HDA_FIXUP_PINS,
8291 .v.pins = (const struct hda_pintbl[]) {
8292 { 0x19, 0x03a11050 },
8293 { 0x1b, 0x03a11c30 },
8294 { }
8295 },
8296 .chained = true,
8297 .chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
8298 },
8299 [ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
8300 .type = HDA_FIXUP_PINS,
8301 .v.pins = (const struct hda_pintbl[]) {
8302 { 0x14, 0x90170120 },
8303 { }
8304 },
8305 .chained = true,
8306 .chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
8307 },
8308 [ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
8309 .type = HDA_FIXUP_FUNC,
8310 .v.func = alc285_fixup_speaker2_to_dac1,
8311 .chained = true,
8312 .chain_id = ALC287_FIXUP_CS35L41_I2C_2
8313 },
8314 [ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
8315 .type = HDA_FIXUP_PINS,
8316 .v.pins = (const struct hda_pintbl[]) {
8317 { 0x19, 0x03a11050 },
8318 { 0x1b, 0x03a11c30 },
8319 { }
8320 },
8321 .chained = true,
8322 .chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
8323 },
8324 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8325 .type = HDA_FIXUP_PINS,
8326 .v.pins = (const struct hda_pintbl[]) {
8327 { 0x1b, 0x90170151 },
8328 { }
8329 },
8330 .chained = true,
8331 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8332 },
8333 [ALC269_FIXUP_ATIV_BOOK_8] = {
8334 .type = HDA_FIXUP_FUNC,
8335 .v.func = alc_fixup_auto_mute_via_amp,
8336 .chained = true,
8337 .chain_id = ALC269_FIXUP_NO_SHUTUP
8338 },
8339 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8340 .type = HDA_FIXUP_PINS,
8341 .v.pins = (const struct hda_pintbl[]) {
8342 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8343 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8344 { }
8345 },
8346 .chained = true,
8347 .chain_id = ALC269_FIXUP_HEADSET_MODE
8348 },
8349 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8350 .type = HDA_FIXUP_PINS,
8351 .v.pins = (const struct hda_pintbl[]) {
8352 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8353 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8354 { }
8355 },
8356 .chained = true,
8357 .chain_id = ALC269_FIXUP_HEADSET_MODE
8358 },
8359 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8360 .type = HDA_FIXUP_FUNC,
8361 .v.func = alc_fixup_headset_mode,
8362 },
8363 [ALC256_FIXUP_ASUS_MIC] = {
8364 .type = HDA_FIXUP_PINS,
8365 .v.pins = (const struct hda_pintbl[]) {
8366 { 0x13, 0x90a60160 }, /* use as internal mic */
8367 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8368 { }
8369 },
8370 .chained = true,
8371 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8372 },
8373 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8374 .type = HDA_FIXUP_FUNC,
8375 /* Set up GPIO2 for the speaker amp */
8376 .v.func = alc_fixup_gpio4,
8377 },
8378 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8379 .type = HDA_FIXUP_PINS,
8380 .v.pins = (const struct hda_pintbl[]) {
8381 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8382 { }
8383 },
8384 .chained = true,
8385 .chain_id = ALC269_FIXUP_HEADSET_MIC
8386 },
8387 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8388 .type = HDA_FIXUP_VERBS,
8389 .v.verbs = (const struct hda_verb[]) {
8390 /* Enables internal speaker */
8391 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8392 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8393 {}
8394 },
8395 .chained = true,
8396 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8397 },
8398 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8399 .type = HDA_FIXUP_FUNC,
8400 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8401 .chained = true,
8402 .chain_id = ALC269_FIXUP_GPIO2
8403 },
8404 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
8405 .type = HDA_FIXUP_VERBS,
8406 .v.verbs = (const struct hda_verb[]) {
8407 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8408 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8409 { }
8410 },
8411 .chained = true,
8412 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8413 },
8414 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8415 .type = HDA_FIXUP_PINS,
8416 .v.pins = (const struct hda_pintbl[]) {
8417 /* Change the mic location from front to right, otherwise there are
8418 two front mics with the same name, pulseaudio can't handle them.
8419 This is just a temporary workaround, after applying this fixup,
8420 there will be one "Front Mic" and one "Mic" in this machine.
8421 */
8422 { 0x1a, 0x04a19040 },
8423 { }
8424 },
8425 },
8426 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8427 .type = HDA_FIXUP_PINS,
8428 .v.pins = (const struct hda_pintbl[]) {
8429 { 0x16, 0x0101102f }, /* Rear Headset HP */
8430 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8431 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8432 { 0x1b, 0x02011020 },
8433 { }
8434 },
8435 .chained = true,
8436 .chain_id = ALC225_FIXUP_S3_POP_NOISE
8437 },
8438 [ALC225_FIXUP_S3_POP_NOISE] = {
8439 .type = HDA_FIXUP_FUNC,
8440 .v.func = alc225_fixup_s3_pop_noise,
8441 .chained = true,
8442 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8443 },
8444 [ALC700_FIXUP_INTEL_REFERENCE] = {
8445 .type = HDA_FIXUP_VERBS,
8446 .v.verbs = (const struct hda_verb[]) {
8447 /* Enables internal speaker */
8448 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8449 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8450 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8451 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8452 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8453 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8454 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8455 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8456 {}
8457 }
8458 },
8459 [ALC274_FIXUP_DELL_BIND_DACS] = {
8460 .type = HDA_FIXUP_FUNC,
8461 .v.func = alc274_fixup_bind_dacs,
8462 .chained = true,
8463 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8464 },
8465 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8466 .type = HDA_FIXUP_PINS,
8467 .v.pins = (const struct hda_pintbl[]) {
8468 { 0x1b, 0x0401102f },
8469 { }
8470 },
8471 .chained = true,
8472 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
8473 },
8474 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
8475 .type = HDA_FIXUP_FUNC,
8476 .v.func = alc_fixup_tpt470_dock,
8477 .chained = true,
8478 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8479 },
8480 [ALC298_FIXUP_TPT470_DOCK] = {
8481 .type = HDA_FIXUP_FUNC,
8482 .v.func = alc_fixup_tpt470_dacs,
8483 .chained = true,
8484 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8485 },
8486 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8487 .type = HDA_FIXUP_PINS,
8488 .v.pins = (const struct hda_pintbl[]) {
8489 { 0x14, 0x0201101f },
8490 { }
8491 },
8492 .chained = true,
8493 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8494 },
8495 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
8496 .type = HDA_FIXUP_PINS,
8497 .v.pins = (const struct hda_pintbl[]) {
8498 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8499 { }
8500 },
8501 .chained = true,
8502 .chain_id = ALC269_FIXUP_HEADSET_MIC
8503 },
8504 [ALC295_FIXUP_HP_X360] = {
8505 .type = HDA_FIXUP_FUNC,
8506 .v.func = alc295_fixup_hp_top_speakers,
8507 .chained = true,
8508 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8509 },
8510 [ALC221_FIXUP_HP_HEADSET_MIC] = {
8511 .type = HDA_FIXUP_PINS,
8512 .v.pins = (const struct hda_pintbl[]) {
8513 { 0x19, 0x0181313f},
8514 { }
8515 },
8516 .chained = true,
8517 .chain_id = ALC269_FIXUP_HEADSET_MIC
8518 },
8519 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8520 .type = HDA_FIXUP_FUNC,
8521 .v.func = alc285_fixup_invalidate_dacs,
8522 .chained = true,
8523 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8524 },
8525 [ALC295_FIXUP_HP_AUTO_MUTE] = {
8526 .type = HDA_FIXUP_FUNC,
8527 .v.func = alc_fixup_auto_mute_via_amp,
8528 },
8529 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8530 .type = HDA_FIXUP_PINS,
8531 .v.pins = (const struct hda_pintbl[]) {
8532 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8533 { }
8534 },
8535 .chained = true,
8536 .chain_id = ALC269_FIXUP_HEADSET_MIC
8537 },
8538 [ALC294_FIXUP_ASUS_MIC] = {
8539 .type = HDA_FIXUP_PINS,
8540 .v.pins = (const struct hda_pintbl[]) {
8541 { 0x13, 0x90a60160 }, /* use as internal mic */
8542 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8543 { }
8544 },
8545 .chained = true,
8546 .chain_id = ALC269_FIXUP_HEADSET_MIC
8547 },
8548 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8549 .type = HDA_FIXUP_PINS,
8550 .v.pins = (const struct hda_pintbl[]) {
8551 { 0x19, 0x01a1103c }, /* use as headset mic */
8552 { }
8553 },
8554 .chained = true,
8555 .chain_id = ALC269_FIXUP_HEADSET_MIC
8556 },
8557 [ALC294_FIXUP_ASUS_SPK] = {
8558 .type = HDA_FIXUP_VERBS,
8559 .v.verbs = (const struct hda_verb[]) {
8560 /* Set EAPD high */
8561 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8562 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8563 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8564 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8565 { }
8566 },
8567 .chained = true,
8568 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8569 },
8570 [ALC295_FIXUP_CHROME_BOOK] = {
8571 .type = HDA_FIXUP_FUNC,
8572 .v.func = alc295_fixup_chromebook,
8573 .chained = true,
8574 .chain_id = ALC225_FIXUP_HEADSET_JACK
8575 },
8576 [ALC225_FIXUP_HEADSET_JACK] = {
8577 .type = HDA_FIXUP_FUNC,
8578 .v.func = alc_fixup_headset_jack,
8579 },
8580 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8581 .type = HDA_FIXUP_PINS,
8582 .v.pins = (const struct hda_pintbl[]) {
8583 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8584 { }
8585 },
8586 .chained = true,
8587 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8588 },
8589 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8590 .type = HDA_FIXUP_VERBS,
8591 .v.verbs = (const struct hda_verb[]) {
8592 /* Disable PCBEEP-IN passthrough */
8593 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8594 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8595 { }
8596 },
8597 .chained = true,
8598 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8599 },
8600 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8601 .type = HDA_FIXUP_PINS,
8602 .v.pins = (const struct hda_pintbl[]) {
8603 { 0x19, 0x03a11130 },
8604 { 0x1a, 0x90a60140 }, /* use as internal mic */
8605 { }
8606 },
8607 .chained = true,
8608 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8609 },
8610 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8611 .type = HDA_FIXUP_PINS,
8612 .v.pins = (const struct hda_pintbl[]) {
8613 { 0x16, 0x01011020 }, /* Rear Line out */
8614 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8615 { }
8616 },
8617 .chained = true,
8618 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8619 },
8620 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8621 .type = HDA_FIXUP_FUNC,
8622 .v.func = alc_fixup_auto_mute_via_amp,
8623 .chained = true,
8624 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8625 },
8626 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8627 .type = HDA_FIXUP_FUNC,
8628 .v.func = alc_fixup_disable_mic_vref,
8629 .chained = true,
8630 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8631 },
8632 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8633 .type = HDA_FIXUP_VERBS,
8634 .v.verbs = (const struct hda_verb[]) {
8635 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8636 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8637 { }
8638 },
8639 .chained = true,
8640 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8641 },
8642 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8643 .type = HDA_FIXUP_PINS,
8644 .v.pins = (const struct hda_pintbl[]) {
8645 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8646 { }
8647 },
8648 .chained = true,
8649 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8650 },
8651 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8652 .type = HDA_FIXUP_PINS,
8653 .v.pins = (const struct hda_pintbl[]) {
8654 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8655 { }
8656 },
8657 .chained = true,
8658 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8659 },
8660 [ALC299_FIXUP_PREDATOR_SPK] = {
8661 .type = HDA_FIXUP_PINS,
8662 .v.pins = (const struct hda_pintbl[]) {
8663 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8664 { }
8665 }
8666 },
8667 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8668 .type = HDA_FIXUP_PINS,
8669 .v.pins = (const struct hda_pintbl[]) {
8670 { 0x19, 0x04a11040 },
8671 { 0x21, 0x04211020 },
8672 { }
8673 },
8674 .chained = true,
8675 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8676 },
8677 [ALC289_FIXUP_DELL_SPK1] = {
8678 .type = HDA_FIXUP_PINS,
8679 .v.pins = (const struct hda_pintbl[]) {
8680 { 0x14, 0x90170140 },
8681 { }
8682 },
8683 .chained = true,
8684 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8685 },
8686 [ALC289_FIXUP_DELL_SPK2] = {
8687 .type = HDA_FIXUP_PINS,
8688 .v.pins = (const struct hda_pintbl[]) {
8689 { 0x17, 0x90170130 }, /* bass spk */
8690 { }
8691 },
8692 .chained = true,
8693 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8694 },
8695 [ALC289_FIXUP_DUAL_SPK] = {
8696 .type = HDA_FIXUP_FUNC,
8697 .v.func = alc285_fixup_speaker2_to_dac1,
8698 .chained = true,
8699 .chain_id = ALC289_FIXUP_DELL_SPK2
8700 },
8701 [ALC289_FIXUP_RTK_AMP_DUAL_SPK] = {
8702 .type = HDA_FIXUP_FUNC,
8703 .v.func = alc285_fixup_speaker2_to_dac1,
8704 .chained = true,
8705 .chain_id = ALC289_FIXUP_DELL_SPK1
8706 },
8707 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8708 .type = HDA_FIXUP_FUNC,
8709 .v.func = alc285_fixup_speaker2_to_dac1,
8710 .chained = true,
8711 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8712 },
8713 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
8714 .type = HDA_FIXUP_FUNC,
8715 /* The GPIO must be pulled to initialize the AMP */
8716 .v.func = alc_fixup_gpio4,
8717 .chained = true,
8718 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8719 },
8720 [ALC294_FIXUP_ASUS_ALLY] = {
8721 .type = HDA_FIXUP_FUNC,
8722 .v.func = cs35l41_fixup_i2c_two,
8723 .chained = true,
8724 .chain_id = ALC294_FIXUP_ASUS_ALLY_PINS
8725 },
8726 [ALC294_FIXUP_ASUS_ALLY_PINS] = {
8727 .type = HDA_FIXUP_PINS,
8728 .v.pins = (const struct hda_pintbl[]) {
8729 { 0x19, 0x03a11050 },
8730 { 0x1a, 0x03a11c30 },
8731 { 0x21, 0x03211420 },
8732 { }
8733 },
8734 .chained = true,
8735 .chain_id = ALC294_FIXUP_ASUS_ALLY_VERBS
8736 },
8737 [ALC294_FIXUP_ASUS_ALLY_VERBS] = {
8738 .type = HDA_FIXUP_VERBS,
8739 .v.verbs = (const struct hda_verb[]) {
8740 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8741 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8742 { 0x20, AC_VERB_SET_COEF_INDEX, 0x46 },
8743 { 0x20, AC_VERB_SET_PROC_COEF, 0x0004 },
8744 { 0x20, AC_VERB_SET_COEF_INDEX, 0x47 },
8745 { 0x20, AC_VERB_SET_PROC_COEF, 0xa47a },
8746 { 0x20, AC_VERB_SET_COEF_INDEX, 0x49 },
8747 { 0x20, AC_VERB_SET_PROC_COEF, 0x0049},
8748 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4a },
8749 { 0x20, AC_VERB_SET_PROC_COEF, 0x201b },
8750 { 0x20, AC_VERB_SET_COEF_INDEX, 0x6b },
8751 { 0x20, AC_VERB_SET_PROC_COEF, 0x4278},
8752 { }
8753 },
8754 .chained = true,
8755 .chain_id = ALC294_FIXUP_ASUS_ALLY_SPEAKER
8756 },
8757 [ALC294_FIXUP_ASUS_ALLY_SPEAKER] = {
8758 .type = HDA_FIXUP_FUNC,
8759 .v.func = alc285_fixup_speaker2_to_dac1,
8760 },
8761 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8762 .type = HDA_FIXUP_FUNC,
8763 .v.func = alc285_fixup_thinkpad_x1_gen7,
8764 .chained = true,
8765 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8766 },
8767 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8768 .type = HDA_FIXUP_FUNC,
8769 .v.func = alc_fixup_headset_jack,
8770 .chained = true,
8771 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8772 },
8773 [ALC294_FIXUP_ASUS_HPE] = {
8774 .type = HDA_FIXUP_VERBS,
8775 .v.verbs = (const struct hda_verb[]) {
8776 /* Set EAPD high */
8777 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8778 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8779 { }
8780 },
8781 .chained = true,
8782 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8783 },
8784 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8785 .type = HDA_FIXUP_PINS,
8786 .v.pins = (const struct hda_pintbl[]) {
8787 { 0x19, 0x03a11050 }, /* front HP mic */
8788 { 0x1a, 0x01a11830 }, /* rear external mic */
8789 { 0x21, 0x03211020 }, /* front HP out */
8790 { }
8791 },
8792 .chained = true,
8793 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8794 },
8795 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8796 .type = HDA_FIXUP_VERBS,
8797 .v.verbs = (const struct hda_verb[]) {
8798 /* set 0x15 to HP-OUT ctrl */
8799 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8800 /* unmute the 0x15 amp */
8801 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8802 { }
8803 },
8804 .chained = true,
8805 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8806 },
8807 [ALC294_FIXUP_ASUS_GX502_HP] = {
8808 .type = HDA_FIXUP_FUNC,
8809 .v.func = alc294_fixup_gx502_hp,
8810 },
8811 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8812 .type = HDA_FIXUP_PINS,
8813 .v.pins = (const struct hda_pintbl[]) {
8814 { 0x19, 0x01a11050 }, /* rear HP mic */
8815 { 0x1a, 0x01a11830 }, /* rear external mic */
8816 { 0x21, 0x012110f0 }, /* rear HP out */
8817 { }
8818 },
8819 .chained = true,
8820 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8821 },
8822 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8823 .type = HDA_FIXUP_VERBS,
8824 .v.verbs = (const struct hda_verb[]) {
8825 /* set 0x15 to HP-OUT ctrl */
8826 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8827 /* unmute the 0x15 amp */
8828 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8829 /* set 0x1b to HP-OUT */
8830 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8831 { }
8832 },
8833 .chained = true,
8834 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8835 },
8836 [ALC294_FIXUP_ASUS_GU502_HP] = {
8837 .type = HDA_FIXUP_FUNC,
8838 .v.func = alc294_fixup_gu502_hp,
8839 },
8840 [ALC294_FIXUP_ASUS_G513_PINS] = {
8841 .type = HDA_FIXUP_PINS,
8842 .v.pins = (const struct hda_pintbl[]) {
8843 { 0x19, 0x03a11050 }, /* front HP mic */
8844 { 0x1a, 0x03a11c30 }, /* rear external mic */
8845 { 0x21, 0x03211420 }, /* front HP out */
8846 { }
8847 },
8848 },
8849 [ALC285_FIXUP_ASUS_G533Z_PINS] = {
8850 .type = HDA_FIXUP_PINS,
8851 .v.pins = (const struct hda_pintbl[]) {
8852 { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8853 { 0x19, 0x03a19020 }, /* Mic Boost Volume */
8854 { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8855 { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8856 { 0x21, 0x03211420 },
8857 { }
8858 },
8859 },
8860 [ALC294_FIXUP_ASUS_COEF_1B] = {
8861 .type = HDA_FIXUP_VERBS,
8862 .v.verbs = (const struct hda_verb[]) {
8863 /* Set bit 10 to correct noisy output after reboot from
8864 * Windows 10 (due to pop noise reduction?)
8865 */
8866 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8867 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8868 { }
8869 },
8870 .chained = true,
8871 .chain_id = ALC289_FIXUP_ASUS_GA401,
8872 },
8873 [ALC285_FIXUP_HP_GPIO_LED] = {
8874 .type = HDA_FIXUP_FUNC,
8875 .v.func = alc285_fixup_hp_gpio_led,
8876 },
8877 [ALC285_FIXUP_HP_MUTE_LED] = {
8878 .type = HDA_FIXUP_FUNC,
8879 .v.func = alc285_fixup_hp_mute_led,
8880 },
8881 [ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8882 .type = HDA_FIXUP_FUNC,
8883 .v.func = alc285_fixup_hp_spectre_x360_mute_led,
8884 },
8885 [ALC236_FIXUP_HP_MUTE_LED_COEFBIT2] = {
8886 .type = HDA_FIXUP_FUNC,
8887 .v.func = alc236_fixup_hp_mute_led_coefbit2,
8888 },
8889 [ALC236_FIXUP_HP_GPIO_LED] = {
8890 .type = HDA_FIXUP_FUNC,
8891 .v.func = alc236_fixup_hp_gpio_led,
8892 },
8893 [ALC236_FIXUP_HP_MUTE_LED] = {
8894 .type = HDA_FIXUP_FUNC,
8895 .v.func = alc236_fixup_hp_mute_led,
8896 },
8897 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8898 .type = HDA_FIXUP_FUNC,
8899 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8900 },
8901 [ALC298_FIXUP_SAMSUNG_AMP] = {
8902 .type = HDA_FIXUP_FUNC,
8903 .v.func = alc298_fixup_samsung_amp,
8904 .chained = true,
8905 .chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8906 },
8907 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8908 .type = HDA_FIXUP_VERBS,
8909 .v.verbs = (const struct hda_verb[]) {
8910 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8911 { }
8912 },
8913 },
8914 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8915 .type = HDA_FIXUP_VERBS,
8916 .v.verbs = (const struct hda_verb[]) {
8917 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8918 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8919 { }
8920 },
8921 },
8922 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8923 .type = HDA_FIXUP_PINS,
8924 .v.pins = (const struct hda_pintbl[]) {
8925 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8926 { }
8927 },
8928 .chained = true,
8929 .chain_id = ALC269_FIXUP_HEADSET_MODE
8930 },
8931 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8932 .type = HDA_FIXUP_PINS,
8933 .v.pins = (const struct hda_pintbl[]) {
8934 { 0x14, 0x90100120 }, /* use as internal speaker */
8935 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8936 { 0x1a, 0x01011020 }, /* use as line out */
8937 { },
8938 },
8939 .chained = true,
8940 .chain_id = ALC269_FIXUP_HEADSET_MIC
8941 },
8942 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8943 .type = HDA_FIXUP_PINS,
8944 .v.pins = (const struct hda_pintbl[]) {
8945 { 0x18, 0x02a11030 }, /* use as headset mic */
8946 { }
8947 },
8948 .chained = true,
8949 .chain_id = ALC269_FIXUP_HEADSET_MIC
8950 },
8951 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8952 .type = HDA_FIXUP_PINS,
8953 .v.pins = (const struct hda_pintbl[]) {
8954 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8955 { }
8956 },
8957 .chained = true,
8958 .chain_id = ALC269_FIXUP_HEADSET_MIC
8959 },
8960 [ALC289_FIXUP_ASUS_GA401] = {
8961 .type = HDA_FIXUP_FUNC,
8962 .v.func = alc289_fixup_asus_ga401,
8963 .chained = true,
8964 .chain_id = ALC289_FIXUP_ASUS_GA502,
8965 },
8966 [ALC289_FIXUP_ASUS_GA502] = {
8967 .type = HDA_FIXUP_PINS,
8968 .v.pins = (const struct hda_pintbl[]) {
8969 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8970 { }
8971 },
8972 },
8973 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8974 .type = HDA_FIXUP_PINS,
8975 .v.pins = (const struct hda_pintbl[]) {
8976 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8977 { }
8978 },
8979 .chained = true,
8980 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8981 },
8982 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8983 .type = HDA_FIXUP_FUNC,
8984 .v.func = alc285_fixup_hp_gpio_amp_init,
8985 .chained = true,
8986 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8987 },
8988 [ALC269_FIXUP_CZC_B20] = {
8989 .type = HDA_FIXUP_PINS,
8990 .v.pins = (const struct hda_pintbl[]) {
8991 { 0x12, 0x411111f0 },
8992 { 0x14, 0x90170110 }, /* speaker */
8993 { 0x15, 0x032f1020 }, /* HP out */
8994 { 0x17, 0x411111f0 },
8995 { 0x18, 0x03ab1040 }, /* mic */
8996 { 0x19, 0xb7a7013f },
8997 { 0x1a, 0x0181305f },
8998 { 0x1b, 0x411111f0 },
8999 { 0x1d, 0x411111f0 },
9000 { 0x1e, 0x411111f0 },
9001 { }
9002 },
9003 .chain_id = ALC269_FIXUP_DMIC,
9004 },
9005 [ALC269_FIXUP_CZC_TMI] = {
9006 .type = HDA_FIXUP_PINS,
9007 .v.pins = (const struct hda_pintbl[]) {
9008 { 0x12, 0x4000c000 },
9009 { 0x14, 0x90170110 }, /* speaker */
9010 { 0x15, 0x0421401f }, /* HP out */
9011 { 0x17, 0x411111f0 },
9012 { 0x18, 0x04a19020 }, /* mic */
9013 { 0x19, 0x411111f0 },
9014 { 0x1a, 0x411111f0 },
9015 { 0x1b, 0x411111f0 },
9016 { 0x1d, 0x40448505 },
9017 { 0x1e, 0x411111f0 },
9018 { 0x20, 0x8000ffff },
9019 { }
9020 },
9021 .chain_id = ALC269_FIXUP_DMIC,
9022 },
9023 [ALC269_FIXUP_CZC_L101] = {
9024 .type = HDA_FIXUP_PINS,
9025 .v.pins = (const struct hda_pintbl[]) {
9026 { 0x12, 0x40000000 },
9027 { 0x14, 0x01014010 }, /* speaker */
9028 { 0x15, 0x411111f0 }, /* HP out */
9029 { 0x16, 0x411111f0 },
9030 { 0x18, 0x01a19020 }, /* mic */
9031 { 0x19, 0x02a19021 },
9032 { 0x1a, 0x0181302f },
9033 { 0x1b, 0x0221401f },
9034 { 0x1c, 0x411111f0 },
9035 { 0x1d, 0x4044c601 },
9036 { 0x1e, 0x411111f0 },
9037 { }
9038 },
9039 .chain_id = ALC269_FIXUP_DMIC,
9040 },
9041 [ALC269_FIXUP_LEMOTE_A1802] = {
9042 .type = HDA_FIXUP_PINS,
9043 .v.pins = (const struct hda_pintbl[]) {
9044 { 0x12, 0x40000000 },
9045 { 0x14, 0x90170110 }, /* speaker */
9046 { 0x17, 0x411111f0 },
9047 { 0x18, 0x03a19040 }, /* mic1 */
9048 { 0x19, 0x90a70130 }, /* mic2 */
9049 { 0x1a, 0x411111f0 },
9050 { 0x1b, 0x411111f0 },
9051 { 0x1d, 0x40489d2d },
9052 { 0x1e, 0x411111f0 },
9053 { 0x20, 0x0003ffff },
9054 { 0x21, 0x03214020 },
9055 { }
9056 },
9057 .chain_id = ALC269_FIXUP_DMIC,
9058 },
9059 [ALC269_FIXUP_LEMOTE_A190X] = {
9060 .type = HDA_FIXUP_PINS,
9061 .v.pins = (const struct hda_pintbl[]) {
9062 { 0x14, 0x99130110 }, /* speaker */
9063 { 0x15, 0x0121401f }, /* HP out */
9064 { 0x18, 0x01a19c20 }, /* rear mic */
9065 { 0x19, 0x99a3092f }, /* front mic */
9066 { 0x1b, 0x0201401f }, /* front lineout */
9067 { }
9068 },
9069 .chain_id = ALC269_FIXUP_DMIC,
9070 },
9071 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
9072 .type = HDA_FIXUP_PINS,
9073 .v.pins = (const struct hda_pintbl[]) {
9074 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9075 { }
9076 },
9077 .chained = true,
9078 .chain_id = ALC269_FIXUP_HEADSET_MODE
9079 },
9080 [ALC256_FIXUP_INTEL_NUC10] = {
9081 .type = HDA_FIXUP_PINS,
9082 .v.pins = (const struct hda_pintbl[]) {
9083 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9084 { }
9085 },
9086 .chained = true,
9087 .chain_id = ALC269_FIXUP_HEADSET_MODE
9088 },
9089 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
9090 .type = HDA_FIXUP_VERBS,
9091 .v.verbs = (const struct hda_verb[]) {
9092 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9093 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9094 { }
9095 },
9096 .chained = true,
9097 .chain_id = ALC289_FIXUP_ASUS_GA502
9098 },
9099 [ALC274_FIXUP_HP_MIC] = {
9100 .type = HDA_FIXUP_VERBS,
9101 .v.verbs = (const struct hda_verb[]) {
9102 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
9103 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
9104 { }
9105 },
9106 },
9107 [ALC274_FIXUP_HP_HEADSET_MIC] = {
9108 .type = HDA_FIXUP_FUNC,
9109 .v.func = alc274_fixup_hp_headset_mic,
9110 .chained = true,
9111 .chain_id = ALC274_FIXUP_HP_MIC
9112 },
9113 [ALC274_FIXUP_HP_ENVY_GPIO] = {
9114 .type = HDA_FIXUP_FUNC,
9115 .v.func = alc274_fixup_hp_envy_gpio,
9116 },
9117 [ALC256_FIXUP_ASUS_HPE] = {
9118 .type = HDA_FIXUP_VERBS,
9119 .v.verbs = (const struct hda_verb[]) {
9120 /* Set EAPD high */
9121 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
9122 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
9123 { }
9124 },
9125 .chained = true,
9126 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
9127 },
9128 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
9129 .type = HDA_FIXUP_FUNC,
9130 .v.func = alc_fixup_headset_jack,
9131 .chained = true,
9132 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
9133 },
9134 [ALC287_FIXUP_HP_GPIO_LED] = {
9135 .type = HDA_FIXUP_FUNC,
9136 .v.func = alc287_fixup_hp_gpio_led,
9137 },
9138 [ALC256_FIXUP_HP_HEADSET_MIC] = {
9139 .type = HDA_FIXUP_FUNC,
9140 .v.func = alc274_fixup_hp_headset_mic,
9141 },
9142 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
9143 .type = HDA_FIXUP_FUNC,
9144 .v.func = alc_fixup_no_int_mic,
9145 .chained = true,
9146 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
9147 },
9148 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
9149 .type = HDA_FIXUP_PINS,
9150 .v.pins = (const struct hda_pintbl[]) {
9151 { 0x1b, 0x411111f0 },
9152 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
9153 { },
9154 },
9155 .chained = true,
9156 .chain_id = ALC269_FIXUP_HEADSET_MODE
9157 },
9158 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
9159 .type = HDA_FIXUP_FUNC,
9160 .v.func = alc269_fixup_limit_int_mic_boost,
9161 .chained = true,
9162 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9163 },
9164 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
9165 .type = HDA_FIXUP_PINS,
9166 .v.pins = (const struct hda_pintbl[]) {
9167 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
9168 { 0x1a, 0x90a1092f }, /* use as internal mic */
9169 { }
9170 },
9171 .chained = true,
9172 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9173 },
9174 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
9175 .type = HDA_FIXUP_FUNC,
9176 .v.func = alc285_fixup_ideapad_s740_coef,
9177 .chained = true,
9178 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9179 },
9180 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9181 .type = HDA_FIXUP_FUNC,
9182 .v.func = alc269_fixup_limit_int_mic_boost,
9183 .chained = true,
9184 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9185 },
9186 [ALC295_FIXUP_ASUS_DACS] = {
9187 .type = HDA_FIXUP_FUNC,
9188 .v.func = alc295_fixup_asus_dacs,
9189 },
9190 [ALC295_FIXUP_HP_OMEN] = {
9191 .type = HDA_FIXUP_PINS,
9192 .v.pins = (const struct hda_pintbl[]) {
9193 { 0x12, 0xb7a60130 },
9194 { 0x13, 0x40000000 },
9195 { 0x14, 0x411111f0 },
9196 { 0x16, 0x411111f0 },
9197 { 0x17, 0x90170110 },
9198 { 0x18, 0x411111f0 },
9199 { 0x19, 0x02a11030 },
9200 { 0x1a, 0x411111f0 },
9201 { 0x1b, 0x04a19030 },
9202 { 0x1d, 0x40600001 },
9203 { 0x1e, 0x411111f0 },
9204 { 0x21, 0x03211020 },
9205 {}
9206 },
9207 .chained = true,
9208 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
9209 },
9210 [ALC285_FIXUP_HP_SPECTRE_X360] = {
9211 .type = HDA_FIXUP_FUNC,
9212 .v.func = alc285_fixup_hp_spectre_x360,
9213 },
9214 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
9215 .type = HDA_FIXUP_FUNC,
9216 .v.func = alc285_fixup_hp_spectre_x360_eb1
9217 },
9218 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
9219 .type = HDA_FIXUP_FUNC,
9220 .v.func = alc285_fixup_ideapad_s740_coef,
9221 .chained = true,
9222 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9223 },
9224 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
9225 .type = HDA_FIXUP_FUNC,
9226 .v.func = alc_fixup_no_shutup,
9227 .chained = true,
9228 .chain_id = ALC283_FIXUP_HEADSET_MIC,
9229 },
9230 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
9231 .type = HDA_FIXUP_PINS,
9232 .v.pins = (const struct hda_pintbl[]) {
9233 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
9234 { }
9235 },
9236 .chained = true,
9237 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
9238 },
9239 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
9240 .type = HDA_FIXUP_FUNC,
9241 .v.func = alc269_fixup_limit_int_mic_boost,
9242 .chained = true,
9243 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
9244 },
9245 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
9246 .type = HDA_FIXUP_FUNC,
9247 .v.func = alc285_fixup_ideapad_s740_coef,
9248 .chained = true,
9249 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
9250 },
9251 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
9252 .type = HDA_FIXUP_FUNC,
9253 .v.func = alc287_fixup_legion_15imhg05_speakers,
9254 .chained = true,
9255 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9256 },
9257 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
9258 .type = HDA_FIXUP_VERBS,
9259 //.v.verbs = legion_15imhg05_coefs,
9260 .v.verbs = (const struct hda_verb[]) {
9261 // set left speaker Legion 7i.
9262 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9263 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9264
9265 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9266 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9267 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9268 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9269 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9270
9271 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9272 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9273 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9274 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9275 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9276
9277 // set right speaker Legion 7i.
9278 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9279 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9280
9281 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9282 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9283 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9284 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9285 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9286
9287 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9288 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9289 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9290 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9291 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9292 {}
9293 },
9294 .chained = true,
9295 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
9296 },
9297 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
9298 .type = HDA_FIXUP_FUNC,
9299 .v.func = alc287_fixup_legion_15imhg05_speakers,
9300 .chained = true,
9301 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9302 },
9303 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
9304 .type = HDA_FIXUP_VERBS,
9305 .v.verbs = (const struct hda_verb[]) {
9306 // set left speaker Yoga 7i.
9307 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9308 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9309
9310 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9311 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9312 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9313 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9314 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9315
9316 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9317 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9318 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9319 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9320 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9321
9322 // set right speaker Yoga 7i.
9323 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9324 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9325
9326 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9327 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9328 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9329 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9330 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9331
9332 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9333 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9334 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9335 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9336 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9337 {}
9338 },
9339 .chained = true,
9340 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9341 },
9342 [ALC298_FIXUP_LENOVO_C940_DUET7] = {
9343 .type = HDA_FIXUP_FUNC,
9344 .v.func = alc298_fixup_lenovo_c940_duet7,
9345 },
9346 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
9347 .type = HDA_FIXUP_VERBS,
9348 .v.verbs = (const struct hda_verb[]) {
9349 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9350 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9351 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9352 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9353 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9354 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9355 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9356 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9357 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9358 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9359 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9360 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9361 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9362 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9363 {}
9364 },
9365 .chained = true,
9366 .chain_id = ALC269_FIXUP_HEADSET_MODE,
9367 },
9368 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
9369 .type = HDA_FIXUP_FUNC,
9370 .v.func = alc256_fixup_set_coef_defaults,
9371 },
9372 [ALC245_FIXUP_HP_GPIO_LED] = {
9373 .type = HDA_FIXUP_FUNC,
9374 .v.func = alc245_fixup_hp_gpio_led,
9375 },
9376 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9377 .type = HDA_FIXUP_PINS,
9378 .v.pins = (const struct hda_pintbl[]) {
9379 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9380 { }
9381 },
9382 .chained = true,
9383 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9384 },
9385 [ALC233_FIXUP_NO_AUDIO_JACK] = {
9386 .type = HDA_FIXUP_FUNC,
9387 .v.func = alc233_fixup_no_audio_jack,
9388 },
9389 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9390 .type = HDA_FIXUP_FUNC,
9391 .v.func = alc256_fixup_mic_no_presence_and_resume,
9392 .chained = true,
9393 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9394 },
9395 [ALC287_FIXUP_LEGION_16ACHG6] = {
9396 .type = HDA_FIXUP_FUNC,
9397 .v.func = alc287_fixup_legion_16achg6_speakers,
9398 },
9399 [ALC287_FIXUP_CS35L41_I2C_2] = {
9400 .type = HDA_FIXUP_FUNC,
9401 .v.func = cs35l41_fixup_i2c_two,
9402 },
9403 [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9404 .type = HDA_FIXUP_FUNC,
9405 .v.func = cs35l41_fixup_i2c_two,
9406 .chained = true,
9407 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9408 },
9409 [ALC245_FIXUP_CS35L41_SPI_2] = {
9410 .type = HDA_FIXUP_FUNC,
9411 .v.func = cs35l41_fixup_spi_two,
9412 },
9413 [ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9414 .type = HDA_FIXUP_FUNC,
9415 .v.func = cs35l41_fixup_spi_two,
9416 .chained = true,
9417 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9418 },
9419 [ALC245_FIXUP_CS35L41_SPI_4] = {
9420 .type = HDA_FIXUP_FUNC,
9421 .v.func = cs35l41_fixup_spi_four,
9422 },
9423 [ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9424 .type = HDA_FIXUP_FUNC,
9425 .v.func = cs35l41_fixup_spi_four,
9426 .chained = true,
9427 .chain_id = ALC285_FIXUP_HP_GPIO_LED,
9428 },
9429 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9430 .type = HDA_FIXUP_VERBS,
9431 .v.verbs = (const struct hda_verb[]) {
9432 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9433 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9434 { }
9435 },
9436 .chained = true,
9437 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
9438 },
9439 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9440 .type = HDA_FIXUP_FUNC,
9441 .v.func = alc_fixup_dell4_mic_no_presence_quiet,
9442 .chained = true,
9443 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9444 },
9445 [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9446 .type = HDA_FIXUP_PINS,
9447 .v.pins = (const struct hda_pintbl[]) {
9448 { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9449 { }
9450 },
9451 .chained = true,
9452 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9453 },
9454 [ALC287_FIXUP_LEGION_16ITHG6] = {
9455 .type = HDA_FIXUP_FUNC,
9456 .v.func = alc287_fixup_legion_16ithg6_speakers,
9457 },
9458 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9459 .type = HDA_FIXUP_VERBS,
9460 .v.verbs = (const struct hda_verb[]) {
9461 // enable left speaker
9462 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9463 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9464
9465 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9466 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9467 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9468 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9469 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9470
9471 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9472 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9473 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9474 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9475 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9476
9477 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9478 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9479 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9480 { 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9481 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9482
9483 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9484 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9485 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9486 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9487 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9488
9489 // enable right speaker
9490 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9491 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9492
9493 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9494 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9495 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9496 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9497 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9498
9499 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9500 { 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9501 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9502 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9503 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9504
9505 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9506 { 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9507 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9508 { 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9509 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9510
9511 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9512 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9513 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9514 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9515 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9516
9517 { },
9518 },
9519 },
9520 [ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9521 .type = HDA_FIXUP_FUNC,
9522 .v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9523 .chained = true,
9524 .chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9525 },
9526 [ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9527 .type = HDA_FIXUP_FUNC,
9528 .v.func = alc295_fixup_dell_inspiron_top_speakers,
9529 .chained = true,
9530 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9531 },
9532 [ALC236_FIXUP_DELL_DUAL_CODECS] = {
9533 .type = HDA_FIXUP_PINS,
9534 .v.func = alc1220_fixup_gb_dual_codecs,
9535 .chained = true,
9536 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9537 },
9538 [ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI] = {
9539 .type = HDA_FIXUP_FUNC,
9540 .v.func = cs35l41_fixup_i2c_two,
9541 .chained = true,
9542 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9543 },
9544 [ALC287_FIXUP_TAS2781_I2C] = {
9545 .type = HDA_FIXUP_FUNC,
9546 .v.func = tas2781_fixup_i2c,
9547 .chained = true,
9548 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9549 },
9550 [ALC245_FIXUP_HP_MUTE_LED_COEFBIT] = {
9551 .type = HDA_FIXUP_FUNC,
9552 .v.func = alc245_fixup_hp_mute_led_coefbit,
9553 },
9554 [ALC245_FIXUP_HP_X360_MUTE_LEDS] = {
9555 .type = HDA_FIXUP_FUNC,
9556 .v.func = alc245_fixup_hp_mute_led_coefbit,
9557 .chained = true,
9558 .chain_id = ALC245_FIXUP_HP_GPIO_LED
9559 },
9560 [ALC287_FIXUP_THINKPAD_I2S_SPK] = {
9561 .type = HDA_FIXUP_FUNC,
9562 .v.func = alc287_fixup_bind_dacs,
9563 },
9564 [ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9565 .type = HDA_FIXUP_FUNC,
9566 .v.func = alc287_fixup_bind_dacs,
9567 .chained = true,
9568 .chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9569 },
9570 [ALC2XX_FIXUP_HEADSET_MIC] = {
9571 .type = HDA_FIXUP_FUNC,
9572 .v.func = alc_fixup_headset_mic,
9573 },
9574 [ALC289_FIXUP_DELL_CS35L41_SPI_2] = {
9575 .type = HDA_FIXUP_FUNC,
9576 .v.func = cs35l41_fixup_spi_two,
9577 .chained = true,
9578 .chain_id = ALC289_FIXUP_DUAL_SPK
9579 },
9580 [ALC294_FIXUP_CS35L41_I2C_2] = {
9581 .type = HDA_FIXUP_FUNC,
9582 .v.func = cs35l41_fixup_i2c_two,
9583 },
9584 };
9585
9586 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9587 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9588 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9589 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9590 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9591 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9592 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9593 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9594 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9595 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9596 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9597 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9598 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9599 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9600 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9601 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9602 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9603 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9604 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9605 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9606 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9607 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9608 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9609 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9610 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9611 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9612 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9613 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9614 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9615 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9616 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9617 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9618 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9619 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9620 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9621 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9622 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9623 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9624 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9625 SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9626 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9627 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9628 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9629 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9630 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9631 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9632 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9633 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9634 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9635 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9636 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9637 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9638 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9639 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9640 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9641 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9642 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9643 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9644 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9645 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9646 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9647 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9648 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9649 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9650 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9651 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9652 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9653 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9654 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9655 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9656 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9657 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9658 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9659 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9660 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9661 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9662 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9663 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9664 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9665 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9666 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9667 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9668 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9669 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9670 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9671 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9672 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9673 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9674 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9675 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9676 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9677 SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9678 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9679 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9680 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9681 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9682 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9683 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9684 SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9685 SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9686 SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9687 SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9688 SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9689 SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9690 SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9691 SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9692 SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9693 SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9694 SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9695 SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9696 SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9697 SND_PCI_QUIRK(0x1028, 0x0cc0, "Dell Oasis 13", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9698 SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9699 SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9700 SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9701 SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
9702 SND_PCI_QUIRK(0x1028, 0x0cc5, "Dell Oasis 14", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
9703 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9704 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9705 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9706 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9707 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9708 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9709 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9710 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9711 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9712 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9713 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9714 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9715 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9716 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9717 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9718 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9719 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9720 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9721 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9722 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9723 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9724 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9725 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9726 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9727 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9728 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9729 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9730 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9731 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9732 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9733 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9734 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9735 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9736 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9737 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9738 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9739 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9740 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9741 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9742 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9743 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9744 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9745 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9746 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9747 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9748 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9749 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9750 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9751 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9752 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9753 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9754 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9755 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9756 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9757 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9758 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9759 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9760 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9761 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9762 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9763 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9764 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9765 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9766 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9767 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC295_FIXUP_HP_X360),
9768 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9769 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9770 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9771 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9772 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9773 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9774 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9775 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9776 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9777 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9778 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9779 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9780 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9781 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9782 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9783 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9784 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9785 SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9786 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9787 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9788 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9789 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9790 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9791 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9792 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9793 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9794 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9795 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9796 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9797 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9798 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9799 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9800 ALC285_FIXUP_HP_GPIO_AMP_INIT),
9801 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9802 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9803 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9804 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9805 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9806 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9807 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9808 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9809 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9810 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9811 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9812 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9813 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9814 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9815 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9816 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9817 SND_PCI_QUIRK(0x103c, 0x881d, "HP 250 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9818 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9819 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9820 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9821 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9822 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9823 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9824 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9825 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9826 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9827 SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9828 SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
9829 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9830 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9831 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9832 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9833 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9834 SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9835 SND_PCI_QUIRK(0x103c, 0x890e, "HP 255 G8 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9836 SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
9837 SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9838 SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9839 SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9840 SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9841 SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9842 SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9843 SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9844 SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9845 SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9846 SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9847 SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9848 SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9849 SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9850 SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9851 SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9852 SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9853 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9854 SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9855 SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9856 SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9857 SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9858 SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9859 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9860 SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9861 SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9862 SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
9863 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9864 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9865 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9866 SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9867 SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9868 SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9869 SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9870 SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9871 SND_PCI_QUIRK(0x103c, 0x8b2f, "HP 255 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
9872 SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9873 SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9874 SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9875 SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9876 SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9877 SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9878 SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9879 SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9880 SND_PCI_QUIRK(0x103c, 0x8b63, "HP Elite Dragonfly 13.5 inch G4", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9881 SND_PCI_QUIRK(0x103c, 0x8b65, "HP ProBook 455 15.6 inch G10 Notebook PC", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9882 SND_PCI_QUIRK(0x103c, 0x8b66, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9883 SND_PCI_QUIRK(0x103c, 0x8b70, "HP EliteBook 835 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9884 SND_PCI_QUIRK(0x103c, 0x8b72, "HP EliteBook 845 G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9885 SND_PCI_QUIRK(0x103c, 0x8b74, "HP EliteBook 845W G10", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9886 SND_PCI_QUIRK(0x103c, 0x8b77, "HP ElieBook 865 G10", ALC287_FIXUP_CS35L41_I2C_2),
9887 SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9888 SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9889 SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
9890 SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9891 SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
9892 SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9893 SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9894 SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9895 SND_PCI_QUIRK(0x103c, 0x8b96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9896 SND_PCI_QUIRK(0x103c, 0x8b97, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9897 SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
9898 SND_PCI_QUIRK(0x103c, 0x8c46, "HP EliteBook 830 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9899 SND_PCI_QUIRK(0x103c, 0x8c47, "HP EliteBook 840 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9900 SND_PCI_QUIRK(0x103c, 0x8c48, "HP EliteBook 860 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9901 SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9902 SND_PCI_QUIRK(0x103c, 0x8c70, "HP EliteBook 835 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9903 SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9904 SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9905 SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9906 SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9907 SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9908 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
9909 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
9910 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9911 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
9912 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
9913 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9914 SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK),
9915 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9916 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9917 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9918 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9919 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9920 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9921 SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM),
9922 SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
9923 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
9924 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
9925 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
9926 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
9927 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
9928 SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
9929 SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
9930 SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
9931 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
9932 SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
9933 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
9934 SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
9935 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
9936 SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
9937 SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
9938 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
9939 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
9940 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
9941 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
9942 SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally RC71L_RC71L", ALC294_FIXUP_ASUS_ALLY),
9943 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
9944 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
9945 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
9946 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
9947 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
9948 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
9949 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
9950 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
9951 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
9952 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
9953 SND_PCI_QUIRK(0x1043, 0x1a63, "ASUS UX3405MA", ALC245_FIXUP_CS35L41_SPI_2),
9954 SND_PCI_QUIRK(0x1043, 0x1a83, "ASUS UM5302LA", ALC294_FIXUP_CS35L41_I2C_2),
9955 SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
9956 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
9957 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
9958 SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
9959 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9960 SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
9961 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9962 SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
9963 SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
9964 SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
9965 SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
9966 SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
9967 SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
9968 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
9969 SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
9970 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
9971 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
9972 SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
9973 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
9974 SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
9975 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
9976 SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
9977 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
9978 SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
9979 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
9980 SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
9981 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
9982 SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
9983 SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
9984 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
9985 SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
9986 SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
9987 SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC245_FIXUP_CS35L41_SPI_2),
9988 SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
9989 SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
9990 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
9991 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
9992 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9993 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9994 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
9995 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
9996 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9997 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9998 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
9999 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10000 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10001 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
10002 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
10003 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10004 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
10005 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
10006 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
10007 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
10008 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
10009 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10010 SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10011 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10012 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10013 SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
10014 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
10015 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
10016 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10017 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10018 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
10019 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10020 SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
10021 SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
10022 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
10023 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10024 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
10025 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
10026 SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
10027 SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
10028 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10029 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10030 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10031 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
10032 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10033 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10034 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10035 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10036 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10037 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10038 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10039 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10040 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10041 SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10042 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10043 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10044 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10045 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10046 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10047 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10048 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10049 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10050 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10051 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10052 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10053 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10054 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10055 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10056 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10057 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10058 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10059 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10060 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10061 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10062 SND_PCI_QUIRK(0x1558, 0x51b1, "Clevo NS50AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10063 SND_PCI_QUIRK(0x1558, 0x51b3, "Clevo NS70AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10064 SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10065 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10066 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10067 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10068 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10069 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10070 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10071 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10072 SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10073 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10074 SND_PCI_QUIRK(0x1558, 0x7724, "Clevo L140AU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10075 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10076 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10077 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10078 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10079 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10080 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10081 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10082 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10083 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10084 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
10085 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10086 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10087 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10088 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10089 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10090 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
10091 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10092 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10093 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10094 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10095 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10096 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10097 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10098 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10099 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10100 SND_PCI_QUIRK(0x1558, 0xa650, "Clevo NP[567]0SN[CD]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10101 SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10102 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10103 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10104 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10105 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10106 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10107 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10108 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
10109 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10110 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
10111 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
10112 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
10113 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
10114 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
10115 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
10116 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
10117 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
10118 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
10119 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
10120 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
10121 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
10122 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
10123 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
10124 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
10125 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
10126 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
10127 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10128 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
10129 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
10130 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
10131 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10132 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10133 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
10134 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
10135 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
10136 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10137 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10138 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
10139 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10140 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10141 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10142 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10143 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10144 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
10145 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10146 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
10147 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10148 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10149 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10150 SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10151 SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10152 SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10153 SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10154 SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10155 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10156 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
10157 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10158 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10159 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10160 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10161 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
10162 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10163 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10164 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
10165 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10166 SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10167 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10168 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10169 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
10170 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
10171 SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10172 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10173 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
10174 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10175 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
10176 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
10177 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
10178 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10179 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10180 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
10181 SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
10182 SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
10183 SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
10184 SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
10185 SND_PCI_QUIRK(0x17aa, 0x3881, "YB9 dual power mode2 YC", ALC287_FIXUP_TAS2781_I2C),
10186 SND_PCI_QUIRK(0x17aa, 0x3884, "Y780 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10187 SND_PCI_QUIRK(0x17aa, 0x3886, "Y780 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10188 SND_PCI_QUIRK(0x17aa, 0x38a7, "Y780P AMD YG dual", ALC287_FIXUP_TAS2781_I2C),
10189 SND_PCI_QUIRK(0x17aa, 0x38a8, "Y780P AMD VECO dual", ALC287_FIXUP_TAS2781_I2C),
10190 SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
10191 SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
10192 SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
10193 SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
10194 SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
10195 SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
10196 SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
10197 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10198 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
10199 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
10200 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
10201 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10202 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
10203 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
10204 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10205 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
10206 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
10207 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
10208 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
10209 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
10210 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
10211 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
10212 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
10213 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10214 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10215 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10216 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
10217 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10218 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10219 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
10220 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
10221 SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
10222 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
10223 SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
10224 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
10225 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
10226 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
10227 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
10228 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
10229 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
10230 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
10231 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
10232 SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
10233 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
10234 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
10235 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
10236 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10237 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10238 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
10239 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10240 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
10241 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
10242 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10243 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
10244 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
10245 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
10246 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
10247 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
10248 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
10249 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10250 SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
10251 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
10252
10253 #if 0
10254 /* Below is a quirk table taken from the old code.
10255 * Basically the device should work as is without the fixup table.
10256 * If BIOS doesn't give a proper info, enable the corresponding
10257 * fixup entry.
10258 */
10259 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
10260 ALC269_FIXUP_AMIC),
10261 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
10262 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
10263 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
10264 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
10265 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
10266 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
10267 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
10268 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
10269 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
10270 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
10271 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
10272 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
10273 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
10274 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
10275 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
10276 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
10277 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
10278 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
10279 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
10280 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
10281 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
10282 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
10283 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
10284 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
10285 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
10286 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
10287 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
10288 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
10289 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
10290 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
10291 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
10292 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
10293 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
10294 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
10295 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
10296 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
10297 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
10298 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
10299 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
10300 #endif
10301 {}
10302 };
10303
10304 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
10305 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
10306 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
10307 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
10308 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
10309 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
10310 {}
10311 };
10312
10313 static const struct hda_model_fixup alc269_fixup_models[] = {
10314 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
10315 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
10316 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
10317 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
10318 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
10319 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
10320 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
10321 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
10322 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
10323 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
10324 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10325 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
10326 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10327 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
10328 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
10329 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
10330 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
10331 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
10332 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
10333 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
10334 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
10335 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
10336 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
10337 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10338 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
10339 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
10340 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
10341 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
10342 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
10343 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
10344 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
10345 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
10346 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
10347 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
10348 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
10349 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
10350 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
10351 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
10352 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
10353 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
10354 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
10355 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
10356 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
10357 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
10358 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
10359 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
10360 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
10361 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
10362 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
10363 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
10364 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
10365 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
10366 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
10367 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
10368 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
10369 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
10370 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
10371 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
10372 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
10373 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
10374 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
10375 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
10376 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
10377 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
10378 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
10379 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
10380 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
10381 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
10382 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
10383 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
10384 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
10385 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
10386 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
10387 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
10388 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
10389 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
10390 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
10391 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
10392 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
10393 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
10394 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
10395 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
10396 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
10397 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
10398 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
10399 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
10400 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
10401 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
10402 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
10403 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
10404 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
10405 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
10406 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
10407 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
10408 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
10409 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
10410 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
10411 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
10412 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
10413 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
10414 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
10415 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
10416 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
10417 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
10418 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
10419 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
10420 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
10421 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
10422 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
10423 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
10424 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
10425 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
10426 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
10427 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
10428 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
10429 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
10430 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
10431 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
10432 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
10433 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
10434 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
10435 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
10436 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
10437 {}
10438 };
10439 #define ALC225_STANDARD_PINS \
10440 {0x21, 0x04211020}
10441
10442 #define ALC256_STANDARD_PINS \
10443 {0x12, 0x90a60140}, \
10444 {0x14, 0x90170110}, \
10445 {0x21, 0x02211020}
10446
10447 #define ALC282_STANDARD_PINS \
10448 {0x14, 0x90170110}
10449
10450 #define ALC290_STANDARD_PINS \
10451 {0x12, 0x99a30130}
10452
10453 #define ALC292_STANDARD_PINS \
10454 {0x14, 0x90170110}, \
10455 {0x15, 0x0221401f}
10456
10457 #define ALC295_STANDARD_PINS \
10458 {0x12, 0xb7a60130}, \
10459 {0x14, 0x90170110}, \
10460 {0x21, 0x04211020}
10461
10462 #define ALC298_STANDARD_PINS \
10463 {0x12, 0x90a60130}, \
10464 {0x21, 0x03211020}
10465
10466 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
10467 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
10468 {0x14, 0x01014020},
10469 {0x17, 0x90170110},
10470 {0x18, 0x02a11030},
10471 {0x19, 0x0181303F},
10472 {0x21, 0x0221102f}),
10473 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
10474 {0x12, 0x90a601c0},
10475 {0x14, 0x90171120},
10476 {0x21, 0x02211030}),
10477 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10478 {0x14, 0x90170110},
10479 {0x1b, 0x90a70130},
10480 {0x21, 0x03211020}),
10481 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
10482 {0x1a, 0x90a70130},
10483 {0x1b, 0x90170110},
10484 {0x21, 0x03211020}),
10485 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10486 ALC225_STANDARD_PINS,
10487 {0x12, 0xb7a60130},
10488 {0x14, 0x901701a0}),
10489 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10490 ALC225_STANDARD_PINS,
10491 {0x12, 0xb7a60130},
10492 {0x14, 0x901701b0}),
10493 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10494 ALC225_STANDARD_PINS,
10495 {0x12, 0xb7a60150},
10496 {0x14, 0x901701a0}),
10497 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10498 ALC225_STANDARD_PINS,
10499 {0x12, 0xb7a60150},
10500 {0x14, 0x901701b0}),
10501 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
10502 ALC225_STANDARD_PINS,
10503 {0x12, 0xb7a60130},
10504 {0x1b, 0x90170110}),
10505 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10506 {0x1b, 0x01111010},
10507 {0x1e, 0x01451130},
10508 {0x21, 0x02211020}),
10509 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10510 {0x12, 0x90a60140},
10511 {0x14, 0x90170110},
10512 {0x19, 0x02a11030},
10513 {0x21, 0x02211020}),
10514 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10515 {0x14, 0x90170110},
10516 {0x19, 0x02a11030},
10517 {0x1a, 0x02a11040},
10518 {0x1b, 0x01014020},
10519 {0x21, 0x0221101f}),
10520 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10521 {0x14, 0x90170110},
10522 {0x19, 0x02a11030},
10523 {0x1a, 0x02a11040},
10524 {0x1b, 0x01011020},
10525 {0x21, 0x0221101f}),
10526 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10527 {0x14, 0x90170110},
10528 {0x19, 0x02a11020},
10529 {0x1a, 0x02a11030},
10530 {0x21, 0x0221101f}),
10531 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10532 {0x21, 0x02211010}),
10533 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10534 {0x14, 0x90170110},
10535 {0x19, 0x02a11020},
10536 {0x21, 0x02211030}),
10537 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10538 {0x14, 0x90170110},
10539 {0x21, 0x02211020}),
10540 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10541 {0x14, 0x90170130},
10542 {0x21, 0x02211040}),
10543 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10544 {0x12, 0x90a60140},
10545 {0x14, 0x90170110},
10546 {0x21, 0x02211020}),
10547 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10548 {0x12, 0x90a60160},
10549 {0x14, 0x90170120},
10550 {0x21, 0x02211030}),
10551 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10552 {0x14, 0x90170110},
10553 {0x1b, 0x02011020},
10554 {0x21, 0x0221101f}),
10555 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10556 {0x14, 0x90170110},
10557 {0x1b, 0x01011020},
10558 {0x21, 0x0221101f}),
10559 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10560 {0x14, 0x90170130},
10561 {0x1b, 0x01014020},
10562 {0x21, 0x0221103f}),
10563 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10564 {0x14, 0x90170130},
10565 {0x1b, 0x01011020},
10566 {0x21, 0x0221103f}),
10567 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10568 {0x14, 0x90170130},
10569 {0x1b, 0x02011020},
10570 {0x21, 0x0221103f}),
10571 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10572 {0x14, 0x90170150},
10573 {0x1b, 0x02011020},
10574 {0x21, 0x0221105f}),
10575 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10576 {0x14, 0x90170110},
10577 {0x1b, 0x01014020},
10578 {0x21, 0x0221101f}),
10579 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10580 {0x12, 0x90a60160},
10581 {0x14, 0x90170120},
10582 {0x17, 0x90170140},
10583 {0x21, 0x0321102f}),
10584 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10585 {0x12, 0x90a60160},
10586 {0x14, 0x90170130},
10587 {0x21, 0x02211040}),
10588 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10589 {0x12, 0x90a60160},
10590 {0x14, 0x90170140},
10591 {0x21, 0x02211050}),
10592 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10593 {0x12, 0x90a60170},
10594 {0x14, 0x90170120},
10595 {0x21, 0x02211030}),
10596 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10597 {0x12, 0x90a60170},
10598 {0x14, 0x90170130},
10599 {0x21, 0x02211040}),
10600 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10601 {0x12, 0x90a60170},
10602 {0x14, 0x90171130},
10603 {0x21, 0x02211040}),
10604 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10605 {0x12, 0x90a60170},
10606 {0x14, 0x90170140},
10607 {0x21, 0x02211050}),
10608 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10609 {0x12, 0x90a60180},
10610 {0x14, 0x90170130},
10611 {0x21, 0x02211040}),
10612 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10613 {0x12, 0x90a60180},
10614 {0x14, 0x90170120},
10615 {0x21, 0x02211030}),
10616 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10617 {0x1b, 0x01011020},
10618 {0x21, 0x02211010}),
10619 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10620 {0x14, 0x90170110},
10621 {0x1b, 0x90a70130},
10622 {0x21, 0x04211020}),
10623 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10624 {0x14, 0x90170110},
10625 {0x1b, 0x90a70130},
10626 {0x21, 0x03211020}),
10627 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10628 {0x12, 0x90a60130},
10629 {0x14, 0x90170110},
10630 {0x21, 0x03211020}),
10631 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10632 {0x12, 0x90a60130},
10633 {0x14, 0x90170110},
10634 {0x21, 0x04211020}),
10635 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10636 {0x1a, 0x90a70130},
10637 {0x1b, 0x90170110},
10638 {0x21, 0x03211020}),
10639 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10640 {0x14, 0x90170110},
10641 {0x19, 0x02a11020},
10642 {0x21, 0x0221101f}),
10643 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10644 {0x17, 0x90170110},
10645 {0x19, 0x03a11030},
10646 {0x21, 0x03211020}),
10647 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10648 {0x12, 0x90a60130},
10649 {0x14, 0x90170110},
10650 {0x15, 0x0421101f},
10651 {0x1a, 0x04a11020}),
10652 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10653 {0x12, 0x90a60140},
10654 {0x14, 0x90170110},
10655 {0x15, 0x0421101f},
10656 {0x18, 0x02811030},
10657 {0x1a, 0x04a1103f},
10658 {0x1b, 0x02011020}),
10659 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10660 ALC282_STANDARD_PINS,
10661 {0x12, 0x99a30130},
10662 {0x19, 0x03a11020},
10663 {0x21, 0x0321101f}),
10664 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10665 ALC282_STANDARD_PINS,
10666 {0x12, 0x99a30130},
10667 {0x19, 0x03a11020},
10668 {0x21, 0x03211040}),
10669 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10670 ALC282_STANDARD_PINS,
10671 {0x12, 0x99a30130},
10672 {0x19, 0x03a11030},
10673 {0x21, 0x03211020}),
10674 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10675 ALC282_STANDARD_PINS,
10676 {0x12, 0x99a30130},
10677 {0x19, 0x04a11020},
10678 {0x21, 0x0421101f}),
10679 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10680 ALC282_STANDARD_PINS,
10681 {0x12, 0x90a60140},
10682 {0x19, 0x04a11030},
10683 {0x21, 0x04211020}),
10684 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10685 ALC282_STANDARD_PINS,
10686 {0x12, 0x90a609c0},
10687 {0x18, 0x03a11830},
10688 {0x19, 0x04a19831},
10689 {0x1a, 0x0481303f},
10690 {0x1b, 0x04211020},
10691 {0x21, 0x0321101f}),
10692 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10693 ALC282_STANDARD_PINS,
10694 {0x12, 0x90a60940},
10695 {0x18, 0x03a11830},
10696 {0x19, 0x04a19831},
10697 {0x1a, 0x0481303f},
10698 {0x1b, 0x04211020},
10699 {0x21, 0x0321101f}),
10700 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10701 ALC282_STANDARD_PINS,
10702 {0x12, 0x90a60130},
10703 {0x21, 0x0321101f}),
10704 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10705 {0x12, 0x90a60160},
10706 {0x14, 0x90170120},
10707 {0x21, 0x02211030}),
10708 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10709 ALC282_STANDARD_PINS,
10710 {0x12, 0x90a60130},
10711 {0x19, 0x03a11020},
10712 {0x21, 0x0321101f}),
10713 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10714 {0x12, 0x90a60130},
10715 {0x14, 0x90170110},
10716 {0x19, 0x04a11040},
10717 {0x21, 0x04211020}),
10718 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10719 {0x14, 0x90170110},
10720 {0x19, 0x04a11040},
10721 {0x1d, 0x40600001},
10722 {0x21, 0x04211020}),
10723 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10724 {0x14, 0x90170110},
10725 {0x19, 0x04a11040},
10726 {0x21, 0x04211020}),
10727 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10728 {0x14, 0x90170110},
10729 {0x17, 0x90170111},
10730 {0x19, 0x03a11030},
10731 {0x21, 0x03211020}),
10732 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10733 {0x17, 0x90170110},
10734 {0x19, 0x03a11030},
10735 {0x21, 0x03211020}),
10736 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC287_FIXUP_THINKPAD_I2S_SPK,
10737 {0x17, 0x90170110}, /* 0x231f with RTK I2S AMP */
10738 {0x19, 0x04a11040},
10739 {0x21, 0x04211020}),
10740 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10741 {0x12, 0x90a60130},
10742 {0x17, 0x90170110},
10743 {0x21, 0x02211020}),
10744 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10745 {0x12, 0x90a60120},
10746 {0x14, 0x90170110},
10747 {0x21, 0x0321101f}),
10748 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10749 ALC290_STANDARD_PINS,
10750 {0x15, 0x04211040},
10751 {0x18, 0x90170112},
10752 {0x1a, 0x04a11020}),
10753 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10754 ALC290_STANDARD_PINS,
10755 {0x15, 0x04211040},
10756 {0x18, 0x90170110},
10757 {0x1a, 0x04a11020}),
10758 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10759 ALC290_STANDARD_PINS,
10760 {0x15, 0x0421101f},
10761 {0x1a, 0x04a11020}),
10762 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10763 ALC290_STANDARD_PINS,
10764 {0x15, 0x04211020},
10765 {0x1a, 0x04a11040}),
10766 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10767 ALC290_STANDARD_PINS,
10768 {0x14, 0x90170110},
10769 {0x15, 0x04211020},
10770 {0x1a, 0x04a11040}),
10771 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10772 ALC290_STANDARD_PINS,
10773 {0x14, 0x90170110},
10774 {0x15, 0x04211020},
10775 {0x1a, 0x04a11020}),
10776 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10777 ALC290_STANDARD_PINS,
10778 {0x14, 0x90170110},
10779 {0x15, 0x0421101f},
10780 {0x1a, 0x04a11020}),
10781 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10782 ALC292_STANDARD_PINS,
10783 {0x12, 0x90a60140},
10784 {0x16, 0x01014020},
10785 {0x19, 0x01a19030}),
10786 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10787 ALC292_STANDARD_PINS,
10788 {0x12, 0x90a60140},
10789 {0x16, 0x01014020},
10790 {0x18, 0x02a19031},
10791 {0x19, 0x01a1903e}),
10792 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10793 ALC292_STANDARD_PINS,
10794 {0x12, 0x90a60140}),
10795 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10796 ALC292_STANDARD_PINS,
10797 {0x13, 0x90a60140},
10798 {0x16, 0x21014020},
10799 {0x19, 0x21a19030}),
10800 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10801 ALC292_STANDARD_PINS,
10802 {0x13, 0x90a60140}),
10803 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10804 {0x17, 0x90170110},
10805 {0x21, 0x04211020}),
10806 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10807 {0x14, 0x90170110},
10808 {0x1b, 0x90a70130},
10809 {0x21, 0x04211020}),
10810 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10811 {0x12, 0x90a60130},
10812 {0x17, 0x90170110},
10813 {0x21, 0x03211020}),
10814 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10815 {0x12, 0x90a60130},
10816 {0x17, 0x90170110},
10817 {0x21, 0x04211020}),
10818 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10819 {0x12, 0x90a60130},
10820 {0x17, 0x90170110},
10821 {0x21, 0x03211020}),
10822 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10823 {0x12, 0x90a60120},
10824 {0x17, 0x90170110},
10825 {0x21, 0x04211030}),
10826 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10827 {0x12, 0x90a60130},
10828 {0x17, 0x90170110},
10829 {0x21, 0x03211020}),
10830 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10831 {0x12, 0x90a60130},
10832 {0x17, 0x90170110},
10833 {0x21, 0x03211020}),
10834 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10835 ALC298_STANDARD_PINS,
10836 {0x17, 0x90170110}),
10837 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10838 ALC298_STANDARD_PINS,
10839 {0x17, 0x90170140}),
10840 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10841 ALC298_STANDARD_PINS,
10842 {0x17, 0x90170150}),
10843 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
10844 {0x12, 0xb7a60140},
10845 {0x13, 0xb7a60150},
10846 {0x17, 0x90170110},
10847 {0x1a, 0x03011020},
10848 {0x21, 0x03211030}),
10849 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
10850 {0x12, 0xb7a60140},
10851 {0x17, 0x90170110},
10852 {0x1a, 0x03a11030},
10853 {0x21, 0x03211020}),
10854 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10855 ALC225_STANDARD_PINS,
10856 {0x12, 0xb7a60130},
10857 {0x17, 0x90170110}),
10858 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
10859 {0x14, 0x01014010},
10860 {0x17, 0x90170120},
10861 {0x18, 0x02a11030},
10862 {0x19, 0x02a1103f},
10863 {0x21, 0x0221101f}),
10864 {}
10865 };
10866
10867 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
10868 * more machines, don't need to match all valid pins, just need to match
10869 * all the pins defined in the tbl. Just because of this reason, it is possible
10870 * that a single machine matches multiple tbls, so there is one limitation:
10871 * at most one tbl is allowed to define for the same vendor and same codec
10872 */
10873 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
10874 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10875 {0x19, 0x40000000},
10876 {0x1b, 0x40000000}),
10877 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10878 {0x19, 0x40000000},
10879 {0x1b, 0x40000000}),
10880 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10881 {0x19, 0x40000000},
10882 {0x1a, 0x40000000}),
10883 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10884 {0x19, 0x40000000},
10885 {0x1a, 0x40000000}),
10886 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
10887 {0x19, 0x40000000},
10888 {0x1a, 0x40000000}),
10889 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC2XX_FIXUP_HEADSET_MIC,
10890 {0x19, 0x40000000}),
10891 {}
10892 };
10893
10894 static void alc269_fill_coef(struct hda_codec *codec)
10895 {
10896 struct alc_spec *spec = codec->spec;
10897 int val;
10898
10899 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
10900 return;
10901
10902 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
10903 alc_write_coef_idx(codec, 0xf, 0x960b);
10904 alc_write_coef_idx(codec, 0xe, 0x8817);
10905 }
10906
10907 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
10908 alc_write_coef_idx(codec, 0xf, 0x960b);
10909 alc_write_coef_idx(codec, 0xe, 0x8814);
10910 }
10911
10912 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
10913 /* Power up output pin */
10914 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
10915 }
10916
10917 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
10918 val = alc_read_coef_idx(codec, 0xd);
10919 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
10920 /* Capless ramp up clock control */
10921 alc_write_coef_idx(codec, 0xd, val | (1<<10));
10922 }
10923 val = alc_read_coef_idx(codec, 0x17);
10924 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
10925 /* Class D power on reset */
10926 alc_write_coef_idx(codec, 0x17, val | (1<<7));
10927 }
10928 }
10929
10930 /* HP */
10931 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
10932 }
10933
10934 /*
10935 */
10936 static int patch_alc269(struct hda_codec *codec)
10937 {
10938 struct alc_spec *spec;
10939 int err;
10940
10941 err = alc_alloc_spec(codec, 0x0b);
10942 if (err < 0)
10943 return err;
10944
10945 spec = codec->spec;
10946 spec->gen.shared_mic_vref_pin = 0x18;
10947 codec->power_save_node = 0;
10948 spec->en_3kpull_low = true;
10949
10950 #ifdef CONFIG_PM
10951 codec->patch_ops.suspend = alc269_suspend;
10952 codec->patch_ops.resume = alc269_resume;
10953 #endif
10954 spec->shutup = alc_default_shutup;
10955 spec->init_hook = alc_default_init;
10956
10957 switch (codec->core.vendor_id) {
10958 case 0x10ec0269:
10959 spec->codec_variant = ALC269_TYPE_ALC269VA;
10960 switch (alc_get_coef0(codec) & 0x00f0) {
10961 case 0x0010:
10962 if (codec->bus->pci &&
10963 codec->bus->pci->subsystem_vendor == 0x1025 &&
10964 spec->cdefine.platform_type == 1)
10965 err = alc_codec_rename(codec, "ALC271X");
10966 spec->codec_variant = ALC269_TYPE_ALC269VB;
10967 break;
10968 case 0x0020:
10969 if (codec->bus->pci &&
10970 codec->bus->pci->subsystem_vendor == 0x17aa &&
10971 codec->bus->pci->subsystem_device == 0x21f3)
10972 err = alc_codec_rename(codec, "ALC3202");
10973 spec->codec_variant = ALC269_TYPE_ALC269VC;
10974 break;
10975 case 0x0030:
10976 spec->codec_variant = ALC269_TYPE_ALC269VD;
10977 break;
10978 default:
10979 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10980 }
10981 if (err < 0)
10982 goto error;
10983 spec->shutup = alc269_shutup;
10984 spec->init_hook = alc269_fill_coef;
10985 alc269_fill_coef(codec);
10986 break;
10987
10988 case 0x10ec0280:
10989 case 0x10ec0290:
10990 spec->codec_variant = ALC269_TYPE_ALC280;
10991 break;
10992 case 0x10ec0282:
10993 spec->codec_variant = ALC269_TYPE_ALC282;
10994 spec->shutup = alc282_shutup;
10995 spec->init_hook = alc282_init;
10996 break;
10997 case 0x10ec0233:
10998 case 0x10ec0283:
10999 spec->codec_variant = ALC269_TYPE_ALC283;
11000 spec->shutup = alc283_shutup;
11001 spec->init_hook = alc283_init;
11002 break;
11003 case 0x10ec0284:
11004 case 0x10ec0292:
11005 spec->codec_variant = ALC269_TYPE_ALC284;
11006 break;
11007 case 0x10ec0293:
11008 spec->codec_variant = ALC269_TYPE_ALC293;
11009 break;
11010 case 0x10ec0286:
11011 case 0x10ec0288:
11012 spec->codec_variant = ALC269_TYPE_ALC286;
11013 break;
11014 case 0x10ec0298:
11015 spec->codec_variant = ALC269_TYPE_ALC298;
11016 break;
11017 case 0x10ec0235:
11018 case 0x10ec0255:
11019 spec->codec_variant = ALC269_TYPE_ALC255;
11020 spec->shutup = alc256_shutup;
11021 spec->init_hook = alc256_init;
11022 break;
11023 case 0x10ec0230:
11024 case 0x10ec0236:
11025 case 0x10ec0256:
11026 case 0x19e58326:
11027 spec->codec_variant = ALC269_TYPE_ALC256;
11028 spec->shutup = alc256_shutup;
11029 spec->init_hook = alc256_init;
11030 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
11031 if (codec->core.vendor_id == 0x10ec0236 &&
11032 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
11033 spec->en_3kpull_low = false;
11034 break;
11035 case 0x10ec0257:
11036 spec->codec_variant = ALC269_TYPE_ALC257;
11037 spec->shutup = alc256_shutup;
11038 spec->init_hook = alc256_init;
11039 spec->gen.mixer_nid = 0;
11040 spec->en_3kpull_low = false;
11041 break;
11042 case 0x10ec0215:
11043 case 0x10ec0245:
11044 case 0x10ec0285:
11045 case 0x10ec0289:
11046 if (alc_get_coef0(codec) & 0x0010)
11047 spec->codec_variant = ALC269_TYPE_ALC245;
11048 else
11049 spec->codec_variant = ALC269_TYPE_ALC215;
11050 spec->shutup = alc225_shutup;
11051 spec->init_hook = alc225_init;
11052 spec->gen.mixer_nid = 0;
11053 break;
11054 case 0x10ec0225:
11055 case 0x10ec0295:
11056 case 0x10ec0299:
11057 spec->codec_variant = ALC269_TYPE_ALC225;
11058 spec->shutup = alc225_shutup;
11059 spec->init_hook = alc225_init;
11060 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
11061 break;
11062 case 0x10ec0287:
11063 spec->codec_variant = ALC269_TYPE_ALC287;
11064 spec->shutup = alc225_shutup;
11065 spec->init_hook = alc225_init;
11066 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
11067 break;
11068 case 0x10ec0234:
11069 case 0x10ec0274:
11070 case 0x10ec0294:
11071 spec->codec_variant = ALC269_TYPE_ALC294;
11072 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
11073 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
11074 spec->init_hook = alc294_init;
11075 break;
11076 case 0x10ec0300:
11077 spec->codec_variant = ALC269_TYPE_ALC300;
11078 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
11079 break;
11080 case 0x10ec0623:
11081 spec->codec_variant = ALC269_TYPE_ALC623;
11082 break;
11083 case 0x10ec0700:
11084 case 0x10ec0701:
11085 case 0x10ec0703:
11086 case 0x10ec0711:
11087 spec->codec_variant = ALC269_TYPE_ALC700;
11088 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
11089 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
11090 spec->init_hook = alc294_init;
11091 break;
11092
11093 }
11094
11095 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
11096 spec->has_alc5505_dsp = 1;
11097 spec->init_hook = alc5505_dsp_init;
11098 }
11099
11100 alc_pre_init(codec);
11101
11102 snd_hda_pick_fixup(codec, alc269_fixup_models,
11103 alc269_fixup_tbl, alc269_fixups);
11104 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
11105 * the quirk breaks the latter (bko#214101).
11106 * Clear the wrong entry.
11107 */
11108 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
11109 codec->core.vendor_id == 0x10ec0294) {
11110 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
11111 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
11112 }
11113
11114 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
11115 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
11116 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
11117 alc269_fixups);
11118 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11119
11120 alc_auto_parse_customize_define(codec);
11121
11122 if (has_cdefine_beep(codec))
11123 spec->gen.beep_nid = 0x01;
11124
11125 /* automatic parse from the BIOS config */
11126 err = alc269_parse_auto_config(codec);
11127 if (err < 0)
11128 goto error;
11129
11130 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
11131 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
11132 if (err < 0)
11133 goto error;
11134 }
11135
11136 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11137
11138 return 0;
11139
11140 error:
11141 alc_free(codec);
11142 return err;
11143 }
11144
11145 /*
11146 * ALC861
11147 */
11148
11149 static int alc861_parse_auto_config(struct hda_codec *codec)
11150 {
11151 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
11152 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
11153 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
11154 }
11155
11156 /* Pin config fixes */
11157 enum {
11158 ALC861_FIXUP_FSC_AMILO_PI1505,
11159 ALC861_FIXUP_AMP_VREF_0F,
11160 ALC861_FIXUP_NO_JACK_DETECT,
11161 ALC861_FIXUP_ASUS_A6RP,
11162 ALC660_FIXUP_ASUS_W7J,
11163 };
11164
11165 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
11166 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
11167 const struct hda_fixup *fix, int action)
11168 {
11169 struct alc_spec *spec = codec->spec;
11170 unsigned int val;
11171
11172 if (action != HDA_FIXUP_ACT_INIT)
11173 return;
11174 val = snd_hda_codec_get_pin_target(codec, 0x0f);
11175 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
11176 val |= AC_PINCTL_IN_EN;
11177 val |= AC_PINCTL_VREF_50;
11178 snd_hda_set_pin_ctl(codec, 0x0f, val);
11179 spec->gen.keep_vref_in_automute = 1;
11180 }
11181
11182 /* suppress the jack-detection */
11183 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
11184 const struct hda_fixup *fix, int action)
11185 {
11186 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11187 codec->no_jack_detect = 1;
11188 }
11189
11190 static const struct hda_fixup alc861_fixups[] = {
11191 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
11192 .type = HDA_FIXUP_PINS,
11193 .v.pins = (const struct hda_pintbl[]) {
11194 { 0x0b, 0x0221101f }, /* HP */
11195 { 0x0f, 0x90170310 }, /* speaker */
11196 { }
11197 }
11198 },
11199 [ALC861_FIXUP_AMP_VREF_0F] = {
11200 .type = HDA_FIXUP_FUNC,
11201 .v.func = alc861_fixup_asus_amp_vref_0f,
11202 },
11203 [ALC861_FIXUP_NO_JACK_DETECT] = {
11204 .type = HDA_FIXUP_FUNC,
11205 .v.func = alc_fixup_no_jack_detect,
11206 },
11207 [ALC861_FIXUP_ASUS_A6RP] = {
11208 .type = HDA_FIXUP_FUNC,
11209 .v.func = alc861_fixup_asus_amp_vref_0f,
11210 .chained = true,
11211 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
11212 },
11213 [ALC660_FIXUP_ASUS_W7J] = {
11214 .type = HDA_FIXUP_VERBS,
11215 .v.verbs = (const struct hda_verb[]) {
11216 /* ASUS W7J needs a magic pin setup on unused NID 0x10
11217 * for enabling outputs
11218 */
11219 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11220 { }
11221 },
11222 }
11223 };
11224
11225 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
11226 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
11227 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
11228 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
11229 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
11230 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
11231 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
11232 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
11233 {}
11234 };
11235
11236 /*
11237 */
11238 static int patch_alc861(struct hda_codec *codec)
11239 {
11240 struct alc_spec *spec;
11241 int err;
11242
11243 err = alc_alloc_spec(codec, 0x15);
11244 if (err < 0)
11245 return err;
11246
11247 spec = codec->spec;
11248 if (has_cdefine_beep(codec))
11249 spec->gen.beep_nid = 0x23;
11250
11251 #ifdef CONFIG_PM
11252 spec->power_hook = alc_power_eapd;
11253 #endif
11254
11255 alc_pre_init(codec);
11256
11257 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
11258 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11259
11260 /* automatic parse from the BIOS config */
11261 err = alc861_parse_auto_config(codec);
11262 if (err < 0)
11263 goto error;
11264
11265 if (!spec->gen.no_analog) {
11266 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
11267 if (err < 0)
11268 goto error;
11269 }
11270
11271 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11272
11273 return 0;
11274
11275 error:
11276 alc_free(codec);
11277 return err;
11278 }
11279
11280 /*
11281 * ALC861-VD support
11282 *
11283 * Based on ALC882
11284 *
11285 * In addition, an independent DAC
11286 */
11287 static int alc861vd_parse_auto_config(struct hda_codec *codec)
11288 {
11289 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
11290 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11291 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
11292 }
11293
11294 enum {
11295 ALC660VD_FIX_ASUS_GPIO1,
11296 ALC861VD_FIX_DALLAS,
11297 };
11298
11299 /* exclude VREF80 */
11300 static void alc861vd_fixup_dallas(struct hda_codec *codec,
11301 const struct hda_fixup *fix, int action)
11302 {
11303 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11304 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
11305 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
11306 }
11307 }
11308
11309 /* reset GPIO1 */
11310 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
11311 const struct hda_fixup *fix, int action)
11312 {
11313 struct alc_spec *spec = codec->spec;
11314
11315 if (action == HDA_FIXUP_ACT_PRE_PROBE)
11316 spec->gpio_mask |= 0x02;
11317 alc_fixup_gpio(codec, action, 0x01);
11318 }
11319
11320 static const struct hda_fixup alc861vd_fixups[] = {
11321 [ALC660VD_FIX_ASUS_GPIO1] = {
11322 .type = HDA_FIXUP_FUNC,
11323 .v.func = alc660vd_fixup_asus_gpio1,
11324 },
11325 [ALC861VD_FIX_DALLAS] = {
11326 .type = HDA_FIXUP_FUNC,
11327 .v.func = alc861vd_fixup_dallas,
11328 },
11329 };
11330
11331 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
11332 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
11333 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
11334 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
11335 {}
11336 };
11337
11338 /*
11339 */
11340 static int patch_alc861vd(struct hda_codec *codec)
11341 {
11342 struct alc_spec *spec;
11343 int err;
11344
11345 err = alc_alloc_spec(codec, 0x0b);
11346 if (err < 0)
11347 return err;
11348
11349 spec = codec->spec;
11350 if (has_cdefine_beep(codec))
11351 spec->gen.beep_nid = 0x23;
11352
11353 spec->shutup = alc_eapd_shutup;
11354
11355 alc_pre_init(codec);
11356
11357 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
11358 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11359
11360 /* automatic parse from the BIOS config */
11361 err = alc861vd_parse_auto_config(codec);
11362 if (err < 0)
11363 goto error;
11364
11365 if (!spec->gen.no_analog) {
11366 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11367 if (err < 0)
11368 goto error;
11369 }
11370
11371 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11372
11373 return 0;
11374
11375 error:
11376 alc_free(codec);
11377 return err;
11378 }
11379
11380 /*
11381 * ALC662 support
11382 *
11383 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11384 * configuration. Each pin widget can choose any input DACs and a mixer.
11385 * Each ADC is connected from a mixer of all inputs. This makes possible
11386 * 6-channel independent captures.
11387 *
11388 * In addition, an independent DAC for the multi-playback (not used in this
11389 * driver yet).
11390 */
11391
11392 /*
11393 * BIOS auto configuration
11394 */
11395
11396 static int alc662_parse_auto_config(struct hda_codec *codec)
11397 {
11398 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
11399 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
11400 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
11401 const hda_nid_t *ssids;
11402
11403 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
11404 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
11405 codec->core.vendor_id == 0x10ec0671)
11406 ssids = alc663_ssids;
11407 else
11408 ssids = alc662_ssids;
11409 return alc_parse_auto_config(codec, alc662_ignore, ssids);
11410 }
11411
11412 static void alc272_fixup_mario(struct hda_codec *codec,
11413 const struct hda_fixup *fix, int action)
11414 {
11415 if (action != HDA_FIXUP_ACT_PRE_PROBE)
11416 return;
11417 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
11418 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
11419 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
11420 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
11421 (0 << AC_AMPCAP_MUTE_SHIFT)))
11422 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
11423 }
11424
11425 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
11426 { .channels = 2,
11427 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
11428 { .channels = 4,
11429 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
11430 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
11431 { }
11432 };
11433
11434 /* override the 2.1 chmap */
11435 static void alc_fixup_bass_chmap(struct hda_codec *codec,
11436 const struct hda_fixup *fix, int action)
11437 {
11438 if (action == HDA_FIXUP_ACT_BUILD) {
11439 struct alc_spec *spec = codec->spec;
11440 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
11441 }
11442 }
11443
11444 /* avoid D3 for keeping GPIO up */
11445 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
11446 hda_nid_t nid,
11447 unsigned int power_state)
11448 {
11449 struct alc_spec *spec = codec->spec;
11450 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
11451 return AC_PWRST_D0;
11452 return power_state;
11453 }
11454
11455 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
11456 const struct hda_fixup *fix, int action)
11457 {
11458 struct alc_spec *spec = codec->spec;
11459
11460 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
11461 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11462 spec->mute_led_polarity = 1;
11463 codec->power_filter = gpio_led_power_filter;
11464 }
11465 }
11466
11467 static void alc662_usi_automute_hook(struct hda_codec *codec,
11468 struct hda_jack_callback *jack)
11469 {
11470 struct alc_spec *spec = codec->spec;
11471 int vref;
11472 msleep(200);
11473 snd_hda_gen_hp_automute(codec, jack);
11474
11475 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
11476 msleep(100);
11477 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11478 vref);
11479 }
11480
11481 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
11482 const struct hda_fixup *fix, int action)
11483 {
11484 struct alc_spec *spec = codec->spec;
11485 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11486 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11487 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
11488 }
11489 }
11490
11491 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
11492 struct hda_jack_callback *cb)
11493 {
11494 /* surround speakers at 0x1b already get muted automatically when
11495 * headphones are plugged in, but we have to mute/unmute the remaining
11496 * channels manually:
11497 * 0x15 - front left/front right
11498 * 0x18 - front center/ LFE
11499 */
11500 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
11501 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
11502 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
11503 } else {
11504 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
11505 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
11506 }
11507 }
11508
11509 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11510 const struct hda_fixup *fix, int action)
11511 {
11512 /* Pin 0x1b: shared headphones jack and surround speakers */
11513 if (!is_jack_detectable(codec, 0x1b))
11514 return;
11515
11516 switch (action) {
11517 case HDA_FIXUP_ACT_PRE_PROBE:
11518 snd_hda_jack_detect_enable_callback(codec, 0x1b,
11519 alc662_aspire_ethos_mute_speakers);
11520 /* subwoofer needs an extra GPIO setting to become audible */
11521 alc_setup_gpio(codec, 0x02);
11522 break;
11523 case HDA_FIXUP_ACT_INIT:
11524 /* Make sure to start in a correct state, i.e. if
11525 * headphones have been plugged in before powering up the system
11526 */
11527 alc662_aspire_ethos_mute_speakers(codec, NULL);
11528 break;
11529 }
11530 }
11531
11532 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11533 const struct hda_fixup *fix, int action)
11534 {
11535 struct alc_spec *spec = codec->spec;
11536
11537 static const struct hda_pintbl pincfgs[] = {
11538 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11539 { 0x1b, 0x0181304f },
11540 { }
11541 };
11542
11543 switch (action) {
11544 case HDA_FIXUP_ACT_PRE_PROBE:
11545 spec->gen.mixer_nid = 0;
11546 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11547 snd_hda_apply_pincfgs(codec, pincfgs);
11548 break;
11549 case HDA_FIXUP_ACT_INIT:
11550 alc_write_coef_idx(codec, 0x19, 0xa054);
11551 break;
11552 }
11553 }
11554
11555 static void alc897_hp_automute_hook(struct hda_codec *codec,
11556 struct hda_jack_callback *jack)
11557 {
11558 struct alc_spec *spec = codec->spec;
11559 int vref;
11560
11561 snd_hda_gen_hp_automute(codec, jack);
11562 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11563 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11564 vref);
11565 }
11566
11567 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11568 const struct hda_fixup *fix, int action)
11569 {
11570 struct alc_spec *spec = codec->spec;
11571 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11572 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11573 }
11574 }
11575
11576 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11577 const struct hda_fixup *fix, int action)
11578 {
11579 struct alc_spec *spec = codec->spec;
11580
11581 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11582 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11583 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11584 }
11585 }
11586
11587 static const struct coef_fw alc668_coefs[] = {
11588 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
11589 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
11590 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
11591 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11592 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11593 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11594 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
11595 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
11596 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11597 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11598 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11599 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11600 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
11601 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11602 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
11603 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
11604 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11605 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11606 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11607 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11608 {}
11609 };
11610
11611 static void alc668_restore_default_value(struct hda_codec *codec)
11612 {
11613 alc_process_coef_fw(codec, alc668_coefs);
11614 }
11615
11616 enum {
11617 ALC662_FIXUP_ASPIRE,
11618 ALC662_FIXUP_LED_GPIO1,
11619 ALC662_FIXUP_IDEAPAD,
11620 ALC272_FIXUP_MARIO,
11621 ALC662_FIXUP_CZC_ET26,
11622 ALC662_FIXUP_CZC_P10T,
11623 ALC662_FIXUP_SKU_IGNORE,
11624 ALC662_FIXUP_HP_RP5800,
11625 ALC662_FIXUP_ASUS_MODE1,
11626 ALC662_FIXUP_ASUS_MODE2,
11627 ALC662_FIXUP_ASUS_MODE3,
11628 ALC662_FIXUP_ASUS_MODE4,
11629 ALC662_FIXUP_ASUS_MODE5,
11630 ALC662_FIXUP_ASUS_MODE6,
11631 ALC662_FIXUP_ASUS_MODE7,
11632 ALC662_FIXUP_ASUS_MODE8,
11633 ALC662_FIXUP_NO_JACK_DETECT,
11634 ALC662_FIXUP_ZOTAC_Z68,
11635 ALC662_FIXUP_INV_DMIC,
11636 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11637 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11638 ALC662_FIXUP_HEADSET_MODE,
11639 ALC668_FIXUP_HEADSET_MODE,
11640 ALC662_FIXUP_BASS_MODE4_CHMAP,
11641 ALC662_FIXUP_BASS_16,
11642 ALC662_FIXUP_BASS_1A,
11643 ALC662_FIXUP_BASS_CHMAP,
11644 ALC668_FIXUP_AUTO_MUTE,
11645 ALC668_FIXUP_DELL_DISABLE_AAMIX,
11646 ALC668_FIXUP_DELL_XPS13,
11647 ALC662_FIXUP_ASUS_Nx50,
11648 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11649 ALC668_FIXUP_ASUS_Nx51,
11650 ALC668_FIXUP_MIC_COEF,
11651 ALC668_FIXUP_ASUS_G751,
11652 ALC891_FIXUP_HEADSET_MODE,
11653 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11654 ALC662_FIXUP_ACER_VERITON,
11655 ALC892_FIXUP_ASROCK_MOBO,
11656 ALC662_FIXUP_USI_FUNC,
11657 ALC662_FIXUP_USI_HEADSET_MODE,
11658 ALC662_FIXUP_LENOVO_MULTI_CODECS,
11659 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11660 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11661 ALC671_FIXUP_HP_HEADSET_MIC2,
11662 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11663 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11664 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11665 ALC668_FIXUP_HEADSET_MIC,
11666 ALC668_FIXUP_MIC_DET_COEF,
11667 ALC897_FIXUP_LENOVO_HEADSET_MIC,
11668 ALC897_FIXUP_HEADSET_MIC_PIN,
11669 ALC897_FIXUP_HP_HSMIC_VERB,
11670 ALC897_FIXUP_LENOVO_HEADSET_MODE,
11671 ALC897_FIXUP_HEADSET_MIC_PIN2,
11672 ALC897_FIXUP_UNIS_H3C_X500S,
11673 };
11674
11675 static const struct hda_fixup alc662_fixups[] = {
11676 [ALC662_FIXUP_ASPIRE] = {
11677 .type = HDA_FIXUP_PINS,
11678 .v.pins = (const struct hda_pintbl[]) {
11679 { 0x15, 0x99130112 }, /* subwoofer */
11680 { }
11681 }
11682 },
11683 [ALC662_FIXUP_LED_GPIO1] = {
11684 .type = HDA_FIXUP_FUNC,
11685 .v.func = alc662_fixup_led_gpio1,
11686 },
11687 [ALC662_FIXUP_IDEAPAD] = {
11688 .type = HDA_FIXUP_PINS,
11689 .v.pins = (const struct hda_pintbl[]) {
11690 { 0x17, 0x99130112 }, /* subwoofer */
11691 { }
11692 },
11693 .chained = true,
11694 .chain_id = ALC662_FIXUP_LED_GPIO1,
11695 },
11696 [ALC272_FIXUP_MARIO] = {
11697 .type = HDA_FIXUP_FUNC,
11698 .v.func = alc272_fixup_mario,
11699 },
11700 [ALC662_FIXUP_CZC_ET26] = {
11701 .type = HDA_FIXUP_PINS,
11702 .v.pins = (const struct hda_pintbl[]) {
11703 {0x12, 0x403cc000},
11704 {0x14, 0x90170110}, /* speaker */
11705 {0x15, 0x411111f0},
11706 {0x16, 0x411111f0},
11707 {0x18, 0x01a19030}, /* mic */
11708 {0x19, 0x90a7013f}, /* int-mic */
11709 {0x1a, 0x01014020},
11710 {0x1b, 0x0121401f},
11711 {0x1c, 0x411111f0},
11712 {0x1d, 0x411111f0},
11713 {0x1e, 0x40478e35},
11714 {}
11715 },
11716 .chained = true,
11717 .chain_id = ALC662_FIXUP_SKU_IGNORE
11718 },
11719 [ALC662_FIXUP_CZC_P10T] = {
11720 .type = HDA_FIXUP_VERBS,
11721 .v.verbs = (const struct hda_verb[]) {
11722 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11723 {}
11724 }
11725 },
11726 [ALC662_FIXUP_SKU_IGNORE] = {
11727 .type = HDA_FIXUP_FUNC,
11728 .v.func = alc_fixup_sku_ignore,
11729 },
11730 [ALC662_FIXUP_HP_RP5800] = {
11731 .type = HDA_FIXUP_PINS,
11732 .v.pins = (const struct hda_pintbl[]) {
11733 { 0x14, 0x0221201f }, /* HP out */
11734 { }
11735 },
11736 .chained = true,
11737 .chain_id = ALC662_FIXUP_SKU_IGNORE
11738 },
11739 [ALC662_FIXUP_ASUS_MODE1] = {
11740 .type = HDA_FIXUP_PINS,
11741 .v.pins = (const struct hda_pintbl[]) {
11742 { 0x14, 0x99130110 }, /* speaker */
11743 { 0x18, 0x01a19c20 }, /* mic */
11744 { 0x19, 0x99a3092f }, /* int-mic */
11745 { 0x21, 0x0121401f }, /* HP out */
11746 { }
11747 },
11748 .chained = true,
11749 .chain_id = ALC662_FIXUP_SKU_IGNORE
11750 },
11751 [ALC662_FIXUP_ASUS_MODE2] = {
11752 .type = HDA_FIXUP_PINS,
11753 .v.pins = (const struct hda_pintbl[]) {
11754 { 0x14, 0x99130110 }, /* speaker */
11755 { 0x18, 0x01a19820 }, /* mic */
11756 { 0x19, 0x99a3092f }, /* int-mic */
11757 { 0x1b, 0x0121401f }, /* HP out */
11758 { }
11759 },
11760 .chained = true,
11761 .chain_id = ALC662_FIXUP_SKU_IGNORE
11762 },
11763 [ALC662_FIXUP_ASUS_MODE3] = {
11764 .type = HDA_FIXUP_PINS,
11765 .v.pins = (const struct hda_pintbl[]) {
11766 { 0x14, 0x99130110 }, /* speaker */
11767 { 0x15, 0x0121441f }, /* HP */
11768 { 0x18, 0x01a19840 }, /* mic */
11769 { 0x19, 0x99a3094f }, /* int-mic */
11770 { 0x21, 0x01211420 }, /* HP2 */
11771 { }
11772 },
11773 .chained = true,
11774 .chain_id = ALC662_FIXUP_SKU_IGNORE
11775 },
11776 [ALC662_FIXUP_ASUS_MODE4] = {
11777 .type = HDA_FIXUP_PINS,
11778 .v.pins = (const struct hda_pintbl[]) {
11779 { 0x14, 0x99130110 }, /* speaker */
11780 { 0x16, 0x99130111 }, /* speaker */
11781 { 0x18, 0x01a19840 }, /* mic */
11782 { 0x19, 0x99a3094f }, /* int-mic */
11783 { 0x21, 0x0121441f }, /* HP */
11784 { }
11785 },
11786 .chained = true,
11787 .chain_id = ALC662_FIXUP_SKU_IGNORE
11788 },
11789 [ALC662_FIXUP_ASUS_MODE5] = {
11790 .type = HDA_FIXUP_PINS,
11791 .v.pins = (const struct hda_pintbl[]) {
11792 { 0x14, 0x99130110 }, /* speaker */
11793 { 0x15, 0x0121441f }, /* HP */
11794 { 0x16, 0x99130111 }, /* speaker */
11795 { 0x18, 0x01a19840 }, /* mic */
11796 { 0x19, 0x99a3094f }, /* int-mic */
11797 { }
11798 },
11799 .chained = true,
11800 .chain_id = ALC662_FIXUP_SKU_IGNORE
11801 },
11802 [ALC662_FIXUP_ASUS_MODE6] = {
11803 .type = HDA_FIXUP_PINS,
11804 .v.pins = (const struct hda_pintbl[]) {
11805 { 0x14, 0x99130110 }, /* speaker */
11806 { 0x15, 0x01211420 }, /* HP2 */
11807 { 0x18, 0x01a19840 }, /* mic */
11808 { 0x19, 0x99a3094f }, /* int-mic */
11809 { 0x1b, 0x0121441f }, /* HP */
11810 { }
11811 },
11812 .chained = true,
11813 .chain_id = ALC662_FIXUP_SKU_IGNORE
11814 },
11815 [ALC662_FIXUP_ASUS_MODE7] = {
11816 .type = HDA_FIXUP_PINS,
11817 .v.pins = (const struct hda_pintbl[]) {
11818 { 0x14, 0x99130110 }, /* speaker */
11819 { 0x17, 0x99130111 }, /* speaker */
11820 { 0x18, 0x01a19840 }, /* mic */
11821 { 0x19, 0x99a3094f }, /* int-mic */
11822 { 0x1b, 0x01214020 }, /* HP */
11823 { 0x21, 0x0121401f }, /* HP */
11824 { }
11825 },
11826 .chained = true,
11827 .chain_id = ALC662_FIXUP_SKU_IGNORE
11828 },
11829 [ALC662_FIXUP_ASUS_MODE8] = {
11830 .type = HDA_FIXUP_PINS,
11831 .v.pins = (const struct hda_pintbl[]) {
11832 { 0x14, 0x99130110 }, /* speaker */
11833 { 0x12, 0x99a30970 }, /* int-mic */
11834 { 0x15, 0x01214020 }, /* HP */
11835 { 0x17, 0x99130111 }, /* speaker */
11836 { 0x18, 0x01a19840 }, /* mic */
11837 { 0x21, 0x0121401f }, /* HP */
11838 { }
11839 },
11840 .chained = true,
11841 .chain_id = ALC662_FIXUP_SKU_IGNORE
11842 },
11843 [ALC662_FIXUP_NO_JACK_DETECT] = {
11844 .type = HDA_FIXUP_FUNC,
11845 .v.func = alc_fixup_no_jack_detect,
11846 },
11847 [ALC662_FIXUP_ZOTAC_Z68] = {
11848 .type = HDA_FIXUP_PINS,
11849 .v.pins = (const struct hda_pintbl[]) {
11850 { 0x1b, 0x02214020 }, /* Front HP */
11851 { }
11852 }
11853 },
11854 [ALC662_FIXUP_INV_DMIC] = {
11855 .type = HDA_FIXUP_FUNC,
11856 .v.func = alc_fixup_inv_dmic,
11857 },
11858 [ALC668_FIXUP_DELL_XPS13] = {
11859 .type = HDA_FIXUP_FUNC,
11860 .v.func = alc_fixup_dell_xps13,
11861 .chained = true,
11862 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
11863 },
11864 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
11865 .type = HDA_FIXUP_FUNC,
11866 .v.func = alc_fixup_disable_aamix,
11867 .chained = true,
11868 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
11869 },
11870 [ALC668_FIXUP_AUTO_MUTE] = {
11871 .type = HDA_FIXUP_FUNC,
11872 .v.func = alc_fixup_auto_mute_via_amp,
11873 .chained = true,
11874 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
11875 },
11876 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
11877 .type = HDA_FIXUP_PINS,
11878 .v.pins = (const struct hda_pintbl[]) {
11879 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11880 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
11881 { }
11882 },
11883 .chained = true,
11884 .chain_id = ALC662_FIXUP_HEADSET_MODE
11885 },
11886 [ALC662_FIXUP_HEADSET_MODE] = {
11887 .type = HDA_FIXUP_FUNC,
11888 .v.func = alc_fixup_headset_mode_alc662,
11889 },
11890 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
11891 .type = HDA_FIXUP_PINS,
11892 .v.pins = (const struct hda_pintbl[]) {
11893 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11894 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11895 { }
11896 },
11897 .chained = true,
11898 .chain_id = ALC668_FIXUP_HEADSET_MODE
11899 },
11900 [ALC668_FIXUP_HEADSET_MODE] = {
11901 .type = HDA_FIXUP_FUNC,
11902 .v.func = alc_fixup_headset_mode_alc668,
11903 },
11904 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
11905 .type = HDA_FIXUP_FUNC,
11906 .v.func = alc_fixup_bass_chmap,
11907 .chained = true,
11908 .chain_id = ALC662_FIXUP_ASUS_MODE4
11909 },
11910 [ALC662_FIXUP_BASS_16] = {
11911 .type = HDA_FIXUP_PINS,
11912 .v.pins = (const struct hda_pintbl[]) {
11913 {0x16, 0x80106111}, /* bass speaker */
11914 {}
11915 },
11916 .chained = true,
11917 .chain_id = ALC662_FIXUP_BASS_CHMAP,
11918 },
11919 [ALC662_FIXUP_BASS_1A] = {
11920 .type = HDA_FIXUP_PINS,
11921 .v.pins = (const struct hda_pintbl[]) {
11922 {0x1a, 0x80106111}, /* bass speaker */
11923 {}
11924 },
11925 .chained = true,
11926 .chain_id = ALC662_FIXUP_BASS_CHMAP,
11927 },
11928 [ALC662_FIXUP_BASS_CHMAP] = {
11929 .type = HDA_FIXUP_FUNC,
11930 .v.func = alc_fixup_bass_chmap,
11931 },
11932 [ALC662_FIXUP_ASUS_Nx50] = {
11933 .type = HDA_FIXUP_FUNC,
11934 .v.func = alc_fixup_auto_mute_via_amp,
11935 .chained = true,
11936 .chain_id = ALC662_FIXUP_BASS_1A
11937 },
11938 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
11939 .type = HDA_FIXUP_FUNC,
11940 .v.func = alc_fixup_headset_mode_alc668,
11941 .chain_id = ALC662_FIXUP_BASS_CHMAP
11942 },
11943 [ALC668_FIXUP_ASUS_Nx51] = {
11944 .type = HDA_FIXUP_PINS,
11945 .v.pins = (const struct hda_pintbl[]) {
11946 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11947 { 0x1a, 0x90170151 }, /* bass speaker */
11948 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11949 {}
11950 },
11951 .chained = true,
11952 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11953 },
11954 [ALC668_FIXUP_MIC_COEF] = {
11955 .type = HDA_FIXUP_VERBS,
11956 .v.verbs = (const struct hda_verb[]) {
11957 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
11958 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
11959 {}
11960 },
11961 },
11962 [ALC668_FIXUP_ASUS_G751] = {
11963 .type = HDA_FIXUP_PINS,
11964 .v.pins = (const struct hda_pintbl[]) {
11965 { 0x16, 0x0421101f }, /* HP */
11966 {}
11967 },
11968 .chained = true,
11969 .chain_id = ALC668_FIXUP_MIC_COEF
11970 },
11971 [ALC891_FIXUP_HEADSET_MODE] = {
11972 .type = HDA_FIXUP_FUNC,
11973 .v.func = alc_fixup_headset_mode,
11974 },
11975 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
11976 .type = HDA_FIXUP_PINS,
11977 .v.pins = (const struct hda_pintbl[]) {
11978 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11979 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11980 { }
11981 },
11982 .chained = true,
11983 .chain_id = ALC891_FIXUP_HEADSET_MODE
11984 },
11985 [ALC662_FIXUP_ACER_VERITON] = {
11986 .type = HDA_FIXUP_PINS,
11987 .v.pins = (const struct hda_pintbl[]) {
11988 { 0x15, 0x50170120 }, /* no internal speaker */
11989 { }
11990 }
11991 },
11992 [ALC892_FIXUP_ASROCK_MOBO] = {
11993 .type = HDA_FIXUP_PINS,
11994 .v.pins = (const struct hda_pintbl[]) {
11995 { 0x15, 0x40f000f0 }, /* disabled */
11996 { 0x16, 0x40f000f0 }, /* disabled */
11997 { }
11998 }
11999 },
12000 [ALC662_FIXUP_USI_FUNC] = {
12001 .type = HDA_FIXUP_FUNC,
12002 .v.func = alc662_fixup_usi_headset_mic,
12003 },
12004 [ALC662_FIXUP_USI_HEADSET_MODE] = {
12005 .type = HDA_FIXUP_PINS,
12006 .v.pins = (const struct hda_pintbl[]) {
12007 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
12008 { 0x18, 0x01a1903d },
12009 { }
12010 },
12011 .chained = true,
12012 .chain_id = ALC662_FIXUP_USI_FUNC
12013 },
12014 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
12015 .type = HDA_FIXUP_FUNC,
12016 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
12017 },
12018 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
12019 .type = HDA_FIXUP_FUNC,
12020 .v.func = alc662_fixup_aspire_ethos_hp,
12021 },
12022 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
12023 .type = HDA_FIXUP_PINS,
12024 .v.pins = (const struct hda_pintbl[]) {
12025 { 0x15, 0x92130110 }, /* front speakers */
12026 { 0x18, 0x99130111 }, /* center/subwoofer */
12027 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
12028 { }
12029 },
12030 .chained = true,
12031 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
12032 },
12033 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
12034 .type = HDA_FIXUP_FUNC,
12035 .v.func = alc671_fixup_hp_headset_mic2,
12036 },
12037 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
12038 .type = HDA_FIXUP_PINS,
12039 .v.pins = (const struct hda_pintbl[]) {
12040 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
12041 { }
12042 },
12043 .chained = true,
12044 .chain_id = ALC662_FIXUP_USI_FUNC
12045 },
12046 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
12047 .type = HDA_FIXUP_PINS,
12048 .v.pins = (const struct hda_pintbl[]) {
12049 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12050 { 0x1b, 0x0221144f },
12051 { }
12052 },
12053 .chained = true,
12054 .chain_id = ALC662_FIXUP_USI_FUNC
12055 },
12056 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
12057 .type = HDA_FIXUP_PINS,
12058 .v.pins = (const struct hda_pintbl[]) {
12059 { 0x1b, 0x04a1112c },
12060 { }
12061 },
12062 .chained = true,
12063 .chain_id = ALC668_FIXUP_HEADSET_MIC
12064 },
12065 [ALC668_FIXUP_HEADSET_MIC] = {
12066 .type = HDA_FIXUP_FUNC,
12067 .v.func = alc269_fixup_headset_mic,
12068 .chained = true,
12069 .chain_id = ALC668_FIXUP_MIC_DET_COEF
12070 },
12071 [ALC668_FIXUP_MIC_DET_COEF] = {
12072 .type = HDA_FIXUP_VERBS,
12073 .v.verbs = (const struct hda_verb[]) {
12074 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
12075 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
12076 {}
12077 },
12078 },
12079 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
12080 .type = HDA_FIXUP_FUNC,
12081 .v.func = alc897_fixup_lenovo_headset_mic,
12082 },
12083 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
12084 .type = HDA_FIXUP_PINS,
12085 .v.pins = (const struct hda_pintbl[]) {
12086 { 0x1a, 0x03a11050 },
12087 { }
12088 },
12089 .chained = true,
12090 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
12091 },
12092 [ALC897_FIXUP_HP_HSMIC_VERB] = {
12093 .type = HDA_FIXUP_PINS,
12094 .v.pins = (const struct hda_pintbl[]) {
12095 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
12096 { }
12097 },
12098 },
12099 [ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
12100 .type = HDA_FIXUP_FUNC,
12101 .v.func = alc897_fixup_lenovo_headset_mode,
12102 },
12103 [ALC897_FIXUP_HEADSET_MIC_PIN2] = {
12104 .type = HDA_FIXUP_PINS,
12105 .v.pins = (const struct hda_pintbl[]) {
12106 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
12107 { }
12108 },
12109 .chained = true,
12110 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
12111 },
12112 [ALC897_FIXUP_UNIS_H3C_X500S] = {
12113 .type = HDA_FIXUP_VERBS,
12114 .v.verbs = (const struct hda_verb[]) {
12115 { 0x14, AC_VERB_SET_EAPD_BTLENABLE, 0 },
12116 {}
12117 },
12118 },
12119 };
12120
12121 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
12122 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
12123 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
12124 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
12125 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
12126 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
12127 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
12128 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
12129 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
12130 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
12131 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
12132 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
12133 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12134 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12135 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
12136 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
12137 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
12138 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12139 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12140 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12141 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12142 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
12143 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
12144 SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12145 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12146 SND_PCI_QUIRK(0x103c, 0x872b, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
12147 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
12148 SND_PCI_QUIRK(0x103c, 0x8768, "HP Slim Desktop S01", ALC671_FIXUP_HP_HEADSET_MIC2),
12149 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
12150 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
12151 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
12152 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
12153 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
12154 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
12155 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
12156 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12157 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
12158 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
12159 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
12160 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
12161 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
12162 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
12163 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
12164 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
12165 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
12166 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
12167 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
12168 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
12169 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
12170 SND_PCI_QUIRK(0x17aa, 0x1064, "Lenovo P3 Tower", ALC897_FIXUP_HEADSET_MIC_PIN),
12171 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
12172 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
12173 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
12174 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
12175 SND_PCI_QUIRK(0x17aa, 0x3321, "Lenovo ThinkCentre M70 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12176 SND_PCI_QUIRK(0x17aa, 0x331b, "Lenovo ThinkCentre M90 Gen4", ALC897_FIXUP_HEADSET_MIC_PIN),
12177 SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
12178 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
12179 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
12180 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
12181 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
12182 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
12183 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
12184 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
12185 SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
12186
12187 #if 0
12188 /* Below is a quirk table taken from the old code.
12189 * Basically the device should work as is without the fixup table.
12190 * If BIOS doesn't give a proper info, enable the corresponding
12191 * fixup entry.
12192 */
12193 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
12194 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
12195 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
12196 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
12197 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12198 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12199 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12200 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
12201 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
12202 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12203 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
12204 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
12205 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
12206 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
12207 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
12208 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12209 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
12210 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
12211 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12212 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12213 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12214 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12215 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
12216 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
12217 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
12218 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12219 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
12220 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
12221 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12222 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
12223 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12224 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12225 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
12226 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
12227 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
12228 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
12229 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
12230 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
12231 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
12232 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
12233 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
12234 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
12235 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12236 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
12237 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
12238 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
12239 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
12240 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
12241 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
12242 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
12243 #endif
12244 {}
12245 };
12246
12247 static const struct hda_model_fixup alc662_fixup_models[] = {
12248 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
12249 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
12250 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
12251 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
12252 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
12253 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
12254 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
12255 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
12256 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
12257 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
12258 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
12259 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
12260 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
12261 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
12262 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
12263 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
12264 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
12265 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
12266 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
12267 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
12268 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
12269 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
12270 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
12271 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
12272 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
12273 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
12274 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
12275 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
12276 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
12277 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
12278 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
12279 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
12280 {.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
12281 {}
12282 };
12283
12284 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
12285 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12286 {0x17, 0x02211010},
12287 {0x18, 0x01a19030},
12288 {0x1a, 0x01813040},
12289 {0x21, 0x01014020}),
12290 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
12291 {0x16, 0x01813030},
12292 {0x17, 0x02211010},
12293 {0x18, 0x01a19040},
12294 {0x21, 0x01014020}),
12295 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
12296 {0x14, 0x01014010},
12297 {0x18, 0x01a19020},
12298 {0x1a, 0x0181302f},
12299 {0x1b, 0x0221401f}),
12300 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12301 {0x12, 0x99a30130},
12302 {0x14, 0x90170110},
12303 {0x15, 0x0321101f},
12304 {0x16, 0x03011020}),
12305 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12306 {0x12, 0x99a30140},
12307 {0x14, 0x90170110},
12308 {0x15, 0x0321101f},
12309 {0x16, 0x03011020}),
12310 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12311 {0x12, 0x99a30150},
12312 {0x14, 0x90170110},
12313 {0x15, 0x0321101f},
12314 {0x16, 0x03011020}),
12315 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
12316 {0x14, 0x90170110},
12317 {0x15, 0x0321101f},
12318 {0x16, 0x03011020}),
12319 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
12320 {0x12, 0x90a60130},
12321 {0x14, 0x90170110},
12322 {0x15, 0x0321101f}),
12323 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12324 {0x14, 0x01014010},
12325 {0x17, 0x90170150},
12326 {0x19, 0x02a11060},
12327 {0x1b, 0x01813030},
12328 {0x21, 0x02211020}),
12329 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12330 {0x14, 0x01014010},
12331 {0x18, 0x01a19040},
12332 {0x1b, 0x01813030},
12333 {0x21, 0x02211020}),
12334 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
12335 {0x14, 0x01014020},
12336 {0x17, 0x90170110},
12337 {0x18, 0x01a19050},
12338 {0x1b, 0x01813040},
12339 {0x21, 0x02211030}),
12340 {}
12341 };
12342
12343 /*
12344 */
12345 static int patch_alc662(struct hda_codec *codec)
12346 {
12347 struct alc_spec *spec;
12348 int err;
12349
12350 err = alc_alloc_spec(codec, 0x0b);
12351 if (err < 0)
12352 return err;
12353
12354 spec = codec->spec;
12355
12356 spec->shutup = alc_eapd_shutup;
12357
12358 /* handle multiple HPs as is */
12359 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
12360
12361 alc_fix_pll_init(codec, 0x20, 0x04, 15);
12362
12363 switch (codec->core.vendor_id) {
12364 case 0x10ec0668:
12365 spec->init_hook = alc668_restore_default_value;
12366 break;
12367 }
12368
12369 alc_pre_init(codec);
12370
12371 snd_hda_pick_fixup(codec, alc662_fixup_models,
12372 alc662_fixup_tbl, alc662_fixups);
12373 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
12374 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
12375
12376 alc_auto_parse_customize_define(codec);
12377
12378 if (has_cdefine_beep(codec))
12379 spec->gen.beep_nid = 0x01;
12380
12381 if ((alc_get_coef0(codec) & (1 << 14)) &&
12382 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
12383 spec->cdefine.platform_type == 1) {
12384 err = alc_codec_rename(codec, "ALC272X");
12385 if (err < 0)
12386 goto error;
12387 }
12388
12389 /* automatic parse from the BIOS config */
12390 err = alc662_parse_auto_config(codec);
12391 if (err < 0)
12392 goto error;
12393
12394 if (!spec->gen.no_analog && spec->gen.beep_nid) {
12395 switch (codec->core.vendor_id) {
12396 case 0x10ec0662:
12397 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12398 break;
12399 case 0x10ec0272:
12400 case 0x10ec0663:
12401 case 0x10ec0665:
12402 case 0x10ec0668:
12403 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
12404 break;
12405 case 0x10ec0273:
12406 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
12407 break;
12408 }
12409 if (err < 0)
12410 goto error;
12411 }
12412
12413 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
12414
12415 return 0;
12416
12417 error:
12418 alc_free(codec);
12419 return err;
12420 }
12421
12422 /*
12423 * ALC680 support
12424 */
12425
12426 static int alc680_parse_auto_config(struct hda_codec *codec)
12427 {
12428 return alc_parse_auto_config(codec, NULL, NULL);
12429 }
12430
12431 /*
12432 */
12433 static int patch_alc680(struct hda_codec *codec)
12434 {
12435 int err;
12436
12437 /* ALC680 has no aa-loopback mixer */
12438 err = alc_alloc_spec(codec, 0);
12439 if (err < 0)
12440 return err;
12441
12442 /* automatic parse from the BIOS config */
12443 err = alc680_parse_auto_config(codec);
12444 if (err < 0) {
12445 alc_free(codec);
12446 return err;
12447 }
12448
12449 return 0;
12450 }
12451
12452 /*
12453 * patch entries
12454 */
12455 static const struct hda_device_id snd_hda_id_realtek[] = {
12456 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
12457 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
12458 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
12459 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
12460 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
12461 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
12462 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
12463 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
12464 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
12465 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
12466 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
12467 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
12468 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
12469 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
12470 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
12471 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
12472 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
12473 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
12474 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
12475 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
12476 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
12477 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
12478 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
12479 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
12480 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
12481 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
12482 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
12483 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
12484 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
12485 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
12486 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
12487 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
12488 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
12489 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
12490 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
12491 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
12492 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
12493 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
12494 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
12495 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
12496 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
12497 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
12498 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
12499 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
12500 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
12501 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
12502 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
12503 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
12504 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
12505 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
12506 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
12507 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
12508 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
12509 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
12510 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
12511 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
12512 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
12513 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
12514 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
12515 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
12516 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
12517 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
12518 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
12519 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
12520 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
12521 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
12522 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12523 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12524 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12525 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12526 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12527 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12528 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12529 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12530 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12531 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12532 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12533 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12534 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12535 {} /* terminator */
12536 };
12537 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12538
12539 MODULE_LICENSE("GPL");
12540 MODULE_DESCRIPTION("Realtek HD-audio codec");
12541
12542 static struct hda_codec_driver realtek_driver = {
12543 .id = snd_hda_id_realtek,
12544 };
12545
12546 module_hda_codec_driver(realtek_driver);