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