]> git.ipfire.org Git - thirdparty/linux.git/blob - sound/pci/hda/patch_realtek.c
ALSA: firewire-motu: fix error return code in snd_motu_stream_reserve_duplex()
[thirdparty/linux.git] / sound / pci / hda / patch_realtek.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
5 * HD audio interface patch for Realtek ALC codecs
6 *
7 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
9 * Takashi Iwai <tiwai@suse.de>
10 * Jonathan Woithe <jwoithe@just42.net>
11 */
12
13 #include <linux/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_PRE_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 /*
2607 * BIOS auto configuration
2608 */
2609 /* almost identical with ALC880 parser... */
2610 static int alc882_parse_auto_config(struct hda_codec *codec)
2611 {
2612 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2613 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2614 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2615 }
2616
2617 /*
2618 */
2619 static int patch_alc882(struct hda_codec *codec)
2620 {
2621 struct alc_spec *spec;
2622 int err;
2623
2624 err = alc_alloc_spec(codec, 0x0b);
2625 if (err < 0)
2626 return err;
2627
2628 spec = codec->spec;
2629
2630 switch (codec->core.vendor_id) {
2631 case 0x10ec0882:
2632 case 0x10ec0885:
2633 case 0x10ec0900:
2634 case 0x10ec0b00:
2635 case 0x10ec1220:
2636 break;
2637 default:
2638 /* ALC883 and variants */
2639 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2640 break;
2641 }
2642
2643 alc_pre_init(codec);
2644
2645 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2646 alc882_fixups);
2647 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2648
2649 alc_auto_parse_customize_define(codec);
2650
2651 if (has_cdefine_beep(codec))
2652 spec->gen.beep_nid = 0x01;
2653
2654 /* automatic parse from the BIOS config */
2655 err = alc882_parse_auto_config(codec);
2656 if (err < 0)
2657 goto error;
2658
2659 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2660 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2661 if (err < 0)
2662 goto error;
2663 }
2664
2665 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2666
2667 return 0;
2668
2669 error:
2670 alc_free(codec);
2671 return err;
2672 }
2673
2674
2675 /*
2676 * ALC262 support
2677 */
2678 static int alc262_parse_auto_config(struct hda_codec *codec)
2679 {
2680 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2681 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2682 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2683 }
2684
2685 /*
2686 * Pin config fixes
2687 */
2688 enum {
2689 ALC262_FIXUP_FSC_H270,
2690 ALC262_FIXUP_FSC_S7110,
2691 ALC262_FIXUP_HP_Z200,
2692 ALC262_FIXUP_TYAN,
2693 ALC262_FIXUP_LENOVO_3000,
2694 ALC262_FIXUP_BENQ,
2695 ALC262_FIXUP_BENQ_T31,
2696 ALC262_FIXUP_INV_DMIC,
2697 ALC262_FIXUP_INTEL_BAYLEYBAY,
2698 };
2699
2700 static const struct hda_fixup alc262_fixups[] = {
2701 [ALC262_FIXUP_FSC_H270] = {
2702 .type = HDA_FIXUP_PINS,
2703 .v.pins = (const struct hda_pintbl[]) {
2704 { 0x14, 0x99130110 }, /* speaker */
2705 { 0x15, 0x0221142f }, /* front HP */
2706 { 0x1b, 0x0121141f }, /* rear HP */
2707 { }
2708 }
2709 },
2710 [ALC262_FIXUP_FSC_S7110] = {
2711 .type = HDA_FIXUP_PINS,
2712 .v.pins = (const struct hda_pintbl[]) {
2713 { 0x15, 0x90170110 }, /* speaker */
2714 { }
2715 },
2716 .chained = true,
2717 .chain_id = ALC262_FIXUP_BENQ,
2718 },
2719 [ALC262_FIXUP_HP_Z200] = {
2720 .type = HDA_FIXUP_PINS,
2721 .v.pins = (const struct hda_pintbl[]) {
2722 { 0x16, 0x99130120 }, /* internal speaker */
2723 { }
2724 }
2725 },
2726 [ALC262_FIXUP_TYAN] = {
2727 .type = HDA_FIXUP_PINS,
2728 .v.pins = (const struct hda_pintbl[]) {
2729 { 0x14, 0x1993e1f0 }, /* int AUX */
2730 { }
2731 }
2732 },
2733 [ALC262_FIXUP_LENOVO_3000] = {
2734 .type = HDA_FIXUP_PINCTLS,
2735 .v.pins = (const struct hda_pintbl[]) {
2736 { 0x19, PIN_VREF50 },
2737 {}
2738 },
2739 .chained = true,
2740 .chain_id = ALC262_FIXUP_BENQ,
2741 },
2742 [ALC262_FIXUP_BENQ] = {
2743 .type = HDA_FIXUP_VERBS,
2744 .v.verbs = (const struct hda_verb[]) {
2745 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2746 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2747 {}
2748 }
2749 },
2750 [ALC262_FIXUP_BENQ_T31] = {
2751 .type = HDA_FIXUP_VERBS,
2752 .v.verbs = (const struct hda_verb[]) {
2753 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2754 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2755 {}
2756 }
2757 },
2758 [ALC262_FIXUP_INV_DMIC] = {
2759 .type = HDA_FIXUP_FUNC,
2760 .v.func = alc_fixup_inv_dmic,
2761 },
2762 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2763 .type = HDA_FIXUP_FUNC,
2764 .v.func = alc_fixup_no_depop_delay,
2765 },
2766 };
2767
2768 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2769 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2770 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2771 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2772 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2773 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2774 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2775 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2776 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2777 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2778 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2779 {}
2780 };
2781
2782 static const struct hda_model_fixup alc262_fixup_models[] = {
2783 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2784 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2785 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2786 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2787 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2788 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2789 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2790 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2791 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2792 {}
2793 };
2794
2795 /*
2796 */
2797 static int patch_alc262(struct hda_codec *codec)
2798 {
2799 struct alc_spec *spec;
2800 int err;
2801
2802 err = alc_alloc_spec(codec, 0x0b);
2803 if (err < 0)
2804 return err;
2805
2806 spec = codec->spec;
2807 spec->gen.shared_mic_vref_pin = 0x18;
2808
2809 spec->shutup = alc_eapd_shutup;
2810
2811 #if 0
2812 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2813 * under-run
2814 */
2815 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2816 #endif
2817 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2818
2819 alc_pre_init(codec);
2820
2821 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2822 alc262_fixups);
2823 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2824
2825 alc_auto_parse_customize_define(codec);
2826
2827 if (has_cdefine_beep(codec))
2828 spec->gen.beep_nid = 0x01;
2829
2830 /* automatic parse from the BIOS config */
2831 err = alc262_parse_auto_config(codec);
2832 if (err < 0)
2833 goto error;
2834
2835 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2836 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2837 if (err < 0)
2838 goto error;
2839 }
2840
2841 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2842
2843 return 0;
2844
2845 error:
2846 alc_free(codec);
2847 return err;
2848 }
2849
2850 /*
2851 * ALC268
2852 */
2853 /* bind Beep switches of both NID 0x0f and 0x10 */
2854 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2855 struct snd_ctl_elem_value *ucontrol)
2856 {
2857 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2858 unsigned long pval;
2859 int err;
2860
2861 mutex_lock(&codec->control_mutex);
2862 pval = kcontrol->private_value;
2863 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2864 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2865 if (err >= 0) {
2866 kcontrol->private_value = (pval & ~0xff) | 0x10;
2867 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2868 }
2869 kcontrol->private_value = pval;
2870 mutex_unlock(&codec->control_mutex);
2871 return err;
2872 }
2873
2874 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2875 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2876 {
2877 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2878 .name = "Beep Playback Switch",
2879 .subdevice = HDA_SUBDEV_AMP_FLAG,
2880 .info = snd_hda_mixer_amp_switch_info,
2881 .get = snd_hda_mixer_amp_switch_get,
2882 .put = alc268_beep_switch_put,
2883 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2884 },
2885 };
2886
2887 /* set PCBEEP vol = 0, mute connections */
2888 static const struct hda_verb alc268_beep_init_verbs[] = {
2889 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2890 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2891 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2892 { }
2893 };
2894
2895 enum {
2896 ALC268_FIXUP_INV_DMIC,
2897 ALC268_FIXUP_HP_EAPD,
2898 ALC268_FIXUP_SPDIF,
2899 };
2900
2901 static const struct hda_fixup alc268_fixups[] = {
2902 [ALC268_FIXUP_INV_DMIC] = {
2903 .type = HDA_FIXUP_FUNC,
2904 .v.func = alc_fixup_inv_dmic,
2905 },
2906 [ALC268_FIXUP_HP_EAPD] = {
2907 .type = HDA_FIXUP_VERBS,
2908 .v.verbs = (const struct hda_verb[]) {
2909 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2910 {}
2911 }
2912 },
2913 [ALC268_FIXUP_SPDIF] = {
2914 .type = HDA_FIXUP_PINS,
2915 .v.pins = (const struct hda_pintbl[]) {
2916 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2917 {}
2918 }
2919 },
2920 };
2921
2922 static const struct hda_model_fixup alc268_fixup_models[] = {
2923 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
2924 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2925 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
2926 {}
2927 };
2928
2929 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
2930 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
2931 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
2932 /* below is codec SSID since multiple Toshiba laptops have the
2933 * same PCI SSID 1179:ff00
2934 */
2935 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
2936 {}
2937 };
2938
2939 /*
2940 * BIOS auto configuration
2941 */
2942 static int alc268_parse_auto_config(struct hda_codec *codec)
2943 {
2944 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2945 return alc_parse_auto_config(codec, NULL, alc268_ssids);
2946 }
2947
2948 /*
2949 */
2950 static int patch_alc268(struct hda_codec *codec)
2951 {
2952 struct alc_spec *spec;
2953 int i, err;
2954
2955 /* ALC268 has no aa-loopback mixer */
2956 err = alc_alloc_spec(codec, 0);
2957 if (err < 0)
2958 return err;
2959
2960 spec = codec->spec;
2961 if (has_cdefine_beep(codec))
2962 spec->gen.beep_nid = 0x01;
2963
2964 spec->shutup = alc_eapd_shutup;
2965
2966 alc_pre_init(codec);
2967
2968 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2969 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2970
2971 /* automatic parse from the BIOS config */
2972 err = alc268_parse_auto_config(codec);
2973 if (err < 0)
2974 goto error;
2975
2976 if (err > 0 && !spec->gen.no_analog &&
2977 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2978 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2979 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2980 &alc268_beep_mixer[i])) {
2981 err = -ENOMEM;
2982 goto error;
2983 }
2984 }
2985 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
2986 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2987 /* override the amp caps for beep generator */
2988 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2989 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2990 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2991 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2992 (0 << AC_AMPCAP_MUTE_SHIFT));
2993 }
2994
2995 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2996
2997 return 0;
2998
2999 error:
3000 alc_free(codec);
3001 return err;
3002 }
3003
3004 /*
3005 * ALC269
3006 */
3007
3008 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3009 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3010 };
3011
3012 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3013 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3014 };
3015
3016 /* different alc269-variants */
3017 enum {
3018 ALC269_TYPE_ALC269VA,
3019 ALC269_TYPE_ALC269VB,
3020 ALC269_TYPE_ALC269VC,
3021 ALC269_TYPE_ALC269VD,
3022 ALC269_TYPE_ALC280,
3023 ALC269_TYPE_ALC282,
3024 ALC269_TYPE_ALC283,
3025 ALC269_TYPE_ALC284,
3026 ALC269_TYPE_ALC293,
3027 ALC269_TYPE_ALC286,
3028 ALC269_TYPE_ALC298,
3029 ALC269_TYPE_ALC255,
3030 ALC269_TYPE_ALC256,
3031 ALC269_TYPE_ALC257,
3032 ALC269_TYPE_ALC215,
3033 ALC269_TYPE_ALC225,
3034 ALC269_TYPE_ALC294,
3035 ALC269_TYPE_ALC300,
3036 ALC269_TYPE_ALC623,
3037 ALC269_TYPE_ALC700,
3038 };
3039
3040 /*
3041 * BIOS auto configuration
3042 */
3043 static int alc269_parse_auto_config(struct hda_codec *codec)
3044 {
3045 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3046 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3047 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3048 struct alc_spec *spec = codec->spec;
3049 const hda_nid_t *ssids;
3050
3051 switch (spec->codec_variant) {
3052 case ALC269_TYPE_ALC269VA:
3053 case ALC269_TYPE_ALC269VC:
3054 case ALC269_TYPE_ALC280:
3055 case ALC269_TYPE_ALC284:
3056 case ALC269_TYPE_ALC293:
3057 ssids = alc269va_ssids;
3058 break;
3059 case ALC269_TYPE_ALC269VB:
3060 case ALC269_TYPE_ALC269VD:
3061 case ALC269_TYPE_ALC282:
3062 case ALC269_TYPE_ALC283:
3063 case ALC269_TYPE_ALC286:
3064 case ALC269_TYPE_ALC298:
3065 case ALC269_TYPE_ALC255:
3066 case ALC269_TYPE_ALC256:
3067 case ALC269_TYPE_ALC257:
3068 case ALC269_TYPE_ALC215:
3069 case ALC269_TYPE_ALC225:
3070 case ALC269_TYPE_ALC294:
3071 case ALC269_TYPE_ALC300:
3072 case ALC269_TYPE_ALC623:
3073 case ALC269_TYPE_ALC700:
3074 ssids = alc269_ssids;
3075 break;
3076 default:
3077 ssids = alc269_ssids;
3078 break;
3079 }
3080
3081 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3082 }
3083
3084 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3085 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3086 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3087 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3088 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3089 {}
3090 };
3091
3092 static void alc_headset_btn_callback(struct hda_codec *codec,
3093 struct hda_jack_callback *jack)
3094 {
3095 int report = 0;
3096
3097 if (jack->unsol_res & (7 << 13))
3098 report |= SND_JACK_BTN_0;
3099
3100 if (jack->unsol_res & (1 << 16 | 3 << 8))
3101 report |= SND_JACK_BTN_1;
3102
3103 /* Volume up key */
3104 if (jack->unsol_res & (7 << 23))
3105 report |= SND_JACK_BTN_2;
3106
3107 /* Volume down key */
3108 if (jack->unsol_res & (7 << 10))
3109 report |= SND_JACK_BTN_3;
3110
3111 snd_hda_jack_set_button_state(codec, jack->nid, report);
3112 }
3113
3114 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3115 {
3116 struct alc_spec *spec = codec->spec;
3117
3118 if (!spec->has_hs_key)
3119 return;
3120
3121 switch (codec->core.vendor_id) {
3122 case 0x10ec0215:
3123 case 0x10ec0225:
3124 case 0x10ec0285:
3125 case 0x10ec0287:
3126 case 0x10ec0295:
3127 case 0x10ec0289:
3128 case 0x10ec0299:
3129 alc_write_coef_idx(codec, 0x48, 0x0);
3130 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3131 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3132 break;
3133 case 0x10ec0236:
3134 case 0x10ec0256:
3135 alc_write_coef_idx(codec, 0x48, 0x0);
3136 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3137 break;
3138 }
3139 }
3140
3141 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3142 {
3143 struct alc_spec *spec = codec->spec;
3144
3145 if (!spec->has_hs_key)
3146 return;
3147
3148 switch (codec->core.vendor_id) {
3149 case 0x10ec0215:
3150 case 0x10ec0225:
3151 case 0x10ec0285:
3152 case 0x10ec0287:
3153 case 0x10ec0295:
3154 case 0x10ec0289:
3155 case 0x10ec0299:
3156 alc_write_coef_idx(codec, 0x48, 0xd011);
3157 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3158 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3159 break;
3160 case 0x10ec0236:
3161 case 0x10ec0256:
3162 alc_write_coef_idx(codec, 0x48, 0xd011);
3163 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3164 break;
3165 }
3166 }
3167
3168 static void alc_fixup_headset_jack(struct hda_codec *codec,
3169 const struct hda_fixup *fix, int action)
3170 {
3171 struct alc_spec *spec = codec->spec;
3172 hda_nid_t hp_pin;
3173
3174 switch (action) {
3175 case HDA_FIXUP_ACT_PRE_PROBE:
3176 spec->has_hs_key = 1;
3177 snd_hda_jack_detect_enable_callback(codec, 0x55,
3178 alc_headset_btn_callback);
3179 break;
3180 case HDA_FIXUP_ACT_BUILD:
3181 hp_pin = alc_get_hp_pin(spec);
3182 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3183 alc_headset_btn_keymap,
3184 hp_pin))
3185 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3186 false, SND_JACK_HEADSET,
3187 alc_headset_btn_keymap);
3188
3189 alc_enable_headset_jack_key(codec);
3190 break;
3191 }
3192 }
3193
3194 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3195 {
3196 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3197 }
3198
3199 static void alc269_shutup(struct hda_codec *codec)
3200 {
3201 struct alc_spec *spec = codec->spec;
3202
3203 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3204 alc269vb_toggle_power_output(codec, 0);
3205 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3206 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3207 msleep(150);
3208 }
3209 alc_shutup_pins(codec);
3210 }
3211
3212 static const struct coef_fw alc282_coefs[] = {
3213 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3214 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3215 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3216 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3217 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3218 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3219 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3220 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3221 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3222 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3223 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3224 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3225 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3226 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3227 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3228 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3229 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3230 WRITE_COEF(0x63, 0x2902), /* PLL */
3231 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3232 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3233 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3234 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3235 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3236 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3237 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3238 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3239 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3240 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3241 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3242 {}
3243 };
3244
3245 static void alc282_restore_default_value(struct hda_codec *codec)
3246 {
3247 alc_process_coef_fw(codec, alc282_coefs);
3248 }
3249
3250 static void alc282_init(struct hda_codec *codec)
3251 {
3252 struct alc_spec *spec = codec->spec;
3253 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3254 bool hp_pin_sense;
3255 int coef78;
3256
3257 alc282_restore_default_value(codec);
3258
3259 if (!hp_pin)
3260 return;
3261 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3262 coef78 = alc_read_coef_idx(codec, 0x78);
3263
3264 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3265 /* Headphone capless set to high power mode */
3266 alc_write_coef_idx(codec, 0x78, 0x9004);
3267
3268 if (hp_pin_sense)
3269 msleep(2);
3270
3271 snd_hda_codec_write(codec, hp_pin, 0,
3272 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3273
3274 if (hp_pin_sense)
3275 msleep(85);
3276
3277 snd_hda_codec_write(codec, hp_pin, 0,
3278 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3279
3280 if (hp_pin_sense)
3281 msleep(100);
3282
3283 /* Headphone capless set to normal mode */
3284 alc_write_coef_idx(codec, 0x78, coef78);
3285 }
3286
3287 static void alc282_shutup(struct hda_codec *codec)
3288 {
3289 struct alc_spec *spec = codec->spec;
3290 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3291 bool hp_pin_sense;
3292 int coef78;
3293
3294 if (!hp_pin) {
3295 alc269_shutup(codec);
3296 return;
3297 }
3298
3299 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3300 coef78 = alc_read_coef_idx(codec, 0x78);
3301 alc_write_coef_idx(codec, 0x78, 0x9004);
3302
3303 if (hp_pin_sense)
3304 msleep(2);
3305
3306 snd_hda_codec_write(codec, hp_pin, 0,
3307 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3308
3309 if (hp_pin_sense)
3310 msleep(85);
3311
3312 if (!spec->no_shutup_pins)
3313 snd_hda_codec_write(codec, hp_pin, 0,
3314 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3315
3316 if (hp_pin_sense)
3317 msleep(100);
3318
3319 alc_auto_setup_eapd(codec, false);
3320 alc_shutup_pins(codec);
3321 alc_write_coef_idx(codec, 0x78, coef78);
3322 }
3323
3324 static const struct coef_fw alc283_coefs[] = {
3325 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3326 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3327 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3328 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3329 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3330 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3331 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3332 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3333 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3334 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3335 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3336 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3337 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3338 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3339 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3340 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3341 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3342 WRITE_COEF(0x2e, 0x2902), /* PLL */
3343 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3344 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3345 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3346 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3347 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3348 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3349 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3350 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3351 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3352 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3353 WRITE_COEF(0x49, 0x0), /* test mode */
3354 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3355 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3356 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3357 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3358 {}
3359 };
3360
3361 static void alc283_restore_default_value(struct hda_codec *codec)
3362 {
3363 alc_process_coef_fw(codec, alc283_coefs);
3364 }
3365
3366 static void alc283_init(struct hda_codec *codec)
3367 {
3368 struct alc_spec *spec = codec->spec;
3369 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3370 bool hp_pin_sense;
3371
3372 alc283_restore_default_value(codec);
3373
3374 if (!hp_pin)
3375 return;
3376
3377 msleep(30);
3378 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3379
3380 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3381 /* Headphone capless set to high power mode */
3382 alc_write_coef_idx(codec, 0x43, 0x9004);
3383
3384 snd_hda_codec_write(codec, hp_pin, 0,
3385 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3386
3387 if (hp_pin_sense)
3388 msleep(85);
3389
3390 snd_hda_codec_write(codec, hp_pin, 0,
3391 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3392
3393 if (hp_pin_sense)
3394 msleep(85);
3395 /* Index 0x46 Combo jack auto switch control 2 */
3396 /* 3k pull low control for Headset jack. */
3397 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3398 /* Headphone capless set to normal mode */
3399 alc_write_coef_idx(codec, 0x43, 0x9614);
3400 }
3401
3402 static void alc283_shutup(struct hda_codec *codec)
3403 {
3404 struct alc_spec *spec = codec->spec;
3405 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3406 bool hp_pin_sense;
3407
3408 if (!hp_pin) {
3409 alc269_shutup(codec);
3410 return;
3411 }
3412
3413 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3414
3415 alc_write_coef_idx(codec, 0x43, 0x9004);
3416
3417 /*depop hp during suspend*/
3418 alc_write_coef_idx(codec, 0x06, 0x2100);
3419
3420 snd_hda_codec_write(codec, hp_pin, 0,
3421 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3422
3423 if (hp_pin_sense)
3424 msleep(100);
3425
3426 if (!spec->no_shutup_pins)
3427 snd_hda_codec_write(codec, hp_pin, 0,
3428 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3429
3430 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3431
3432 if (hp_pin_sense)
3433 msleep(100);
3434 alc_auto_setup_eapd(codec, false);
3435 alc_shutup_pins(codec);
3436 alc_write_coef_idx(codec, 0x43, 0x9614);
3437 }
3438
3439 static void alc256_init(struct hda_codec *codec)
3440 {
3441 struct alc_spec *spec = codec->spec;
3442 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3443 bool hp_pin_sense;
3444
3445 if (!hp_pin)
3446 hp_pin = 0x21;
3447
3448 msleep(30);
3449
3450 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3451
3452 if (hp_pin_sense)
3453 msleep(2);
3454
3455 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3456 if (spec->ultra_low_power) {
3457 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3458 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3459 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3460 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3461 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3462 msleep(30);
3463 }
3464
3465 snd_hda_codec_write(codec, hp_pin, 0,
3466 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3467
3468 if (hp_pin_sense || spec->ultra_low_power)
3469 msleep(85);
3470
3471 snd_hda_codec_write(codec, hp_pin, 0,
3472 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3473
3474 if (hp_pin_sense || spec->ultra_low_power)
3475 msleep(100);
3476
3477 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3478 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3479 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3480 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3481 /*
3482 * Expose headphone mic (or possibly Line In on some machines) instead
3483 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3484 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3485 * this register.
3486 */
3487 alc_write_coef_idx(codec, 0x36, 0x5757);
3488 }
3489
3490 static void alc256_shutup(struct hda_codec *codec)
3491 {
3492 struct alc_spec *spec = codec->spec;
3493 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3494 bool hp_pin_sense;
3495
3496 if (!hp_pin)
3497 hp_pin = 0x21;
3498
3499 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3500
3501 if (hp_pin_sense)
3502 msleep(2);
3503
3504 snd_hda_codec_write(codec, hp_pin, 0,
3505 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3506
3507 if (hp_pin_sense || spec->ultra_low_power)
3508 msleep(85);
3509
3510 /* 3k pull low control for Headset jack. */
3511 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3512 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3513 * when booting with headset plugged. So skip setting it for the codec alc257
3514 */
3515 if (codec->core.vendor_id != 0x10ec0257)
3516 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3517
3518 if (!spec->no_shutup_pins)
3519 snd_hda_codec_write(codec, hp_pin, 0,
3520 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3521
3522 if (hp_pin_sense || spec->ultra_low_power)
3523 msleep(100);
3524
3525 alc_auto_setup_eapd(codec, false);
3526 alc_shutup_pins(codec);
3527 if (spec->ultra_low_power) {
3528 msleep(50);
3529 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3530 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3531 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3532 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3533 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3534 msleep(30);
3535 }
3536 }
3537
3538 static void alc225_init(struct hda_codec *codec)
3539 {
3540 struct alc_spec *spec = codec->spec;
3541 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3542 bool hp1_pin_sense, hp2_pin_sense;
3543
3544 if (!hp_pin)
3545 hp_pin = 0x21;
3546 msleep(30);
3547
3548 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3549 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3550
3551 if (hp1_pin_sense || hp2_pin_sense)
3552 msleep(2);
3553
3554 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3555 if (spec->ultra_low_power) {
3556 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3557 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3558 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3559 msleep(30);
3560 }
3561
3562 if (hp1_pin_sense || spec->ultra_low_power)
3563 snd_hda_codec_write(codec, hp_pin, 0,
3564 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3565 if (hp2_pin_sense)
3566 snd_hda_codec_write(codec, 0x16, 0,
3567 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3568
3569 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3570 msleep(85);
3571
3572 if (hp1_pin_sense || spec->ultra_low_power)
3573 snd_hda_codec_write(codec, hp_pin, 0,
3574 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3575 if (hp2_pin_sense)
3576 snd_hda_codec_write(codec, 0x16, 0,
3577 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3578
3579 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3580 msleep(100);
3581
3582 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3583 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3584 }
3585
3586 static void alc225_shutup(struct hda_codec *codec)
3587 {
3588 struct alc_spec *spec = codec->spec;
3589 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3590 bool hp1_pin_sense, hp2_pin_sense;
3591
3592 if (!hp_pin)
3593 hp_pin = 0x21;
3594
3595 alc_disable_headset_jack_key(codec);
3596 /* 3k pull low control for Headset jack. */
3597 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3598
3599 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3600 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3601
3602 if (hp1_pin_sense || hp2_pin_sense)
3603 msleep(2);
3604
3605 if (hp1_pin_sense || spec->ultra_low_power)
3606 snd_hda_codec_write(codec, hp_pin, 0,
3607 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3608 if (hp2_pin_sense)
3609 snd_hda_codec_write(codec, 0x16, 0,
3610 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3611
3612 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3613 msleep(85);
3614
3615 if (hp1_pin_sense || spec->ultra_low_power)
3616 snd_hda_codec_write(codec, hp_pin, 0,
3617 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3618 if (hp2_pin_sense)
3619 snd_hda_codec_write(codec, 0x16, 0,
3620 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3621
3622 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3623 msleep(100);
3624
3625 alc_auto_setup_eapd(codec, false);
3626 alc_shutup_pins(codec);
3627 if (spec->ultra_low_power) {
3628 msleep(50);
3629 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3630 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3631 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3632 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3633 msleep(30);
3634 }
3635
3636 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3637 alc_enable_headset_jack_key(codec);
3638 }
3639
3640 static void alc_default_init(struct hda_codec *codec)
3641 {
3642 struct alc_spec *spec = codec->spec;
3643 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3644 bool hp_pin_sense;
3645
3646 if (!hp_pin)
3647 return;
3648
3649 msleep(30);
3650
3651 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3652
3653 if (hp_pin_sense)
3654 msleep(2);
3655
3656 snd_hda_codec_write(codec, hp_pin, 0,
3657 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3658
3659 if (hp_pin_sense)
3660 msleep(85);
3661
3662 snd_hda_codec_write(codec, hp_pin, 0,
3663 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3664
3665 if (hp_pin_sense)
3666 msleep(100);
3667 }
3668
3669 static void alc_default_shutup(struct hda_codec *codec)
3670 {
3671 struct alc_spec *spec = codec->spec;
3672 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3673 bool hp_pin_sense;
3674
3675 if (!hp_pin) {
3676 alc269_shutup(codec);
3677 return;
3678 }
3679
3680 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3681
3682 if (hp_pin_sense)
3683 msleep(2);
3684
3685 snd_hda_codec_write(codec, hp_pin, 0,
3686 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3687
3688 if (hp_pin_sense)
3689 msleep(85);
3690
3691 if (!spec->no_shutup_pins)
3692 snd_hda_codec_write(codec, hp_pin, 0,
3693 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3694
3695 if (hp_pin_sense)
3696 msleep(100);
3697
3698 alc_auto_setup_eapd(codec, false);
3699 alc_shutup_pins(codec);
3700 }
3701
3702 static void alc294_hp_init(struct hda_codec *codec)
3703 {
3704 struct alc_spec *spec = codec->spec;
3705 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3706 int i, val;
3707
3708 if (!hp_pin)
3709 return;
3710
3711 snd_hda_codec_write(codec, hp_pin, 0,
3712 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3713
3714 msleep(100);
3715
3716 if (!spec->no_shutup_pins)
3717 snd_hda_codec_write(codec, hp_pin, 0,
3718 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3719
3720 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3721 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3722
3723 /* Wait for depop procedure finish */
3724 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3725 for (i = 0; i < 20 && val & 0x0080; i++) {
3726 msleep(50);
3727 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3728 }
3729 /* Set HP depop to auto mode */
3730 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3731 msleep(50);
3732 }
3733
3734 static void alc294_init(struct hda_codec *codec)
3735 {
3736 struct alc_spec *spec = codec->spec;
3737
3738 /* required only at boot or S4 resume time */
3739 if (!spec->done_hp_init ||
3740 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3741 alc294_hp_init(codec);
3742 spec->done_hp_init = true;
3743 }
3744 alc_default_init(codec);
3745 }
3746
3747 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3748 unsigned int val)
3749 {
3750 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3751 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3752 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3753 }
3754
3755 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3756 {
3757 unsigned int val;
3758
3759 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3760 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3761 & 0xffff;
3762 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3763 << 16;
3764 return val;
3765 }
3766
3767 static void alc5505_dsp_halt(struct hda_codec *codec)
3768 {
3769 unsigned int val;
3770
3771 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3772 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3773 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3774 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3775 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3776 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3777 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3778 val = alc5505_coef_get(codec, 0x6220);
3779 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3780 }
3781
3782 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3783 {
3784 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3785 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3786 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3787 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3788 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3789 alc5505_coef_set(codec, 0x880c, 0x00000004);
3790 }
3791
3792 static void alc5505_dsp_init(struct hda_codec *codec)
3793 {
3794 unsigned int val;
3795
3796 alc5505_dsp_halt(codec);
3797 alc5505_dsp_back_from_halt(codec);
3798 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3799 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3800 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3801 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3802 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3803 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3804 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3805 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3806 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3807 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3808 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3809 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3810 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3811
3812 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3813 if (val <= 3)
3814 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3815 else
3816 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3817
3818 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3819 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3820 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3821 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3822 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3823 alc5505_coef_set(codec, 0x880c, 0x00000003);
3824 alc5505_coef_set(codec, 0x880c, 0x00000010);
3825
3826 #ifdef HALT_REALTEK_ALC5505
3827 alc5505_dsp_halt(codec);
3828 #endif
3829 }
3830
3831 #ifdef HALT_REALTEK_ALC5505
3832 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3833 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
3834 #else
3835 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3836 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3837 #endif
3838
3839 #ifdef CONFIG_PM
3840 static int alc269_suspend(struct hda_codec *codec)
3841 {
3842 struct alc_spec *spec = codec->spec;
3843
3844 if (spec->has_alc5505_dsp)
3845 alc5505_dsp_suspend(codec);
3846 return alc_suspend(codec);
3847 }
3848
3849 static int alc269_resume(struct hda_codec *codec)
3850 {
3851 struct alc_spec *spec = codec->spec;
3852
3853 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3854 alc269vb_toggle_power_output(codec, 0);
3855 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3856 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3857 msleep(150);
3858 }
3859
3860 codec->patch_ops.init(codec);
3861
3862 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3863 alc269vb_toggle_power_output(codec, 1);
3864 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3865 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
3866 msleep(200);
3867 }
3868
3869 snd_hda_regmap_sync(codec);
3870 hda_call_check_power_status(codec, 0x01);
3871
3872 /* on some machine, the BIOS will clear the codec gpio data when enter
3873 * suspend, and won't restore the data after resume, so we restore it
3874 * in the driver.
3875 */
3876 if (spec->gpio_data)
3877 alc_write_gpio_data(codec);
3878
3879 if (spec->has_alc5505_dsp)
3880 alc5505_dsp_resume(codec);
3881
3882 return 0;
3883 }
3884 #endif /* CONFIG_PM */
3885
3886 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3887 const struct hda_fixup *fix, int action)
3888 {
3889 struct alc_spec *spec = codec->spec;
3890
3891 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3892 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3893 }
3894
3895 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3896 const struct hda_fixup *fix,
3897 int action)
3898 {
3899 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3900 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3901
3902 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3903 snd_hda_codec_set_pincfg(codec, 0x19,
3904 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3905 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3906 }
3907
3908 static void alc269_fixup_hweq(struct hda_codec *codec,
3909 const struct hda_fixup *fix, int action)
3910 {
3911 if (action == HDA_FIXUP_ACT_INIT)
3912 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
3913 }
3914
3915 static void alc269_fixup_headset_mic(struct hda_codec *codec,
3916 const struct hda_fixup *fix, int action)
3917 {
3918 struct alc_spec *spec = codec->spec;
3919
3920 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3921 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3922 }
3923
3924 static void alc271_fixup_dmic(struct hda_codec *codec,
3925 const struct hda_fixup *fix, int action)
3926 {
3927 static const struct hda_verb verbs[] = {
3928 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3929 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3930 {}
3931 };
3932 unsigned int cfg;
3933
3934 if (strcmp(codec->core.chip_name, "ALC271X") &&
3935 strcmp(codec->core.chip_name, "ALC269VB"))
3936 return;
3937 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3938 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3939 snd_hda_sequence_write(codec, verbs);
3940 }
3941
3942 /* Fix the speaker amp after resume, etc */
3943 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
3944 const struct hda_fixup *fix,
3945 int action)
3946 {
3947 if (action == HDA_FIXUP_ACT_INIT)
3948 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
3949 }
3950
3951 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
3952 const struct hda_fixup *fix, int action)
3953 {
3954 struct alc_spec *spec = codec->spec;
3955
3956 if (action != HDA_FIXUP_ACT_PROBE)
3957 return;
3958
3959 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3960 * fix the sample rate of analog I/O to 44.1kHz
3961 */
3962 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3963 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
3964 }
3965
3966 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
3967 const struct hda_fixup *fix, int action)
3968 {
3969 /* The digital-mic unit sends PDM (differential signal) instead of
3970 * the standard PCM, thus you can't record a valid mono stream as is.
3971 * Below is a workaround specific to ALC269 to control the dmic
3972 * signal source as mono.
3973 */
3974 if (action == HDA_FIXUP_ACT_INIT)
3975 alc_update_coef_idx(codec, 0x07, 0, 0x80);
3976 }
3977
3978 static void alc269_quanta_automute(struct hda_codec *codec)
3979 {
3980 snd_hda_gen_update_outputs(codec);
3981
3982 alc_write_coef_idx(codec, 0x0c, 0x680);
3983 alc_write_coef_idx(codec, 0x0c, 0x480);
3984 }
3985
3986 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
3987 const struct hda_fixup *fix, int action)
3988 {
3989 struct alc_spec *spec = codec->spec;
3990 if (action != HDA_FIXUP_ACT_PROBE)
3991 return;
3992 spec->gen.automute_hook = alc269_quanta_automute;
3993 }
3994
3995 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
3996 struct hda_jack_callback *jack)
3997 {
3998 struct alc_spec *spec = codec->spec;
3999 int vref;
4000 msleep(200);
4001 snd_hda_gen_hp_automute(codec, jack);
4002
4003 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4004 msleep(100);
4005 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4006 vref);
4007 msleep(500);
4008 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4009 vref);
4010 }
4011
4012 /*
4013 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4014 */
4015 struct hda_alc298_mbxinit {
4016 unsigned char value_0x23;
4017 unsigned char value_0x25;
4018 };
4019
4020 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4021 const struct hda_alc298_mbxinit *initval,
4022 bool first)
4023 {
4024 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4025 alc_write_coef_idx(codec, 0x26, 0xb000);
4026
4027 if (first)
4028 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4029
4030 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4031 alc_write_coef_idx(codec, 0x26, 0xf000);
4032 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4033
4034 if (initval->value_0x23 != 0x1e)
4035 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4036
4037 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4038 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4039 }
4040
4041 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4042 const struct hda_fixup *fix,
4043 int action)
4044 {
4045 /* Initialization magic */
4046 static const struct hda_alc298_mbxinit dac_init[] = {
4047 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4048 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4049 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4050 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4051 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4052 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4053 {0x2f, 0x00},
4054 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4055 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4056 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4057 {}
4058 };
4059 const struct hda_alc298_mbxinit *seq;
4060
4061 if (action != HDA_FIXUP_ACT_INIT)
4062 return;
4063
4064 /* Start */
4065 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4066 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4067 alc_write_coef_idx(codec, 0x26, 0xf000);
4068 alc_write_coef_idx(codec, 0x22, 0x31);
4069 alc_write_coef_idx(codec, 0x23, 0x0b);
4070 alc_write_coef_idx(codec, 0x25, 0x00);
4071 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4072 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4073
4074 for (seq = dac_init; seq->value_0x23; seq++)
4075 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4076 }
4077
4078 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4079 const struct hda_fixup *fix, int action)
4080 {
4081 struct alc_spec *spec = codec->spec;
4082 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4083 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4084 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4085 }
4086 }
4087
4088 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4089 bool polarity, bool on)
4090 {
4091 unsigned int pinval;
4092
4093 if (!pin)
4094 return;
4095 if (polarity)
4096 on = !on;
4097 pinval = snd_hda_codec_get_pin_target(codec, pin);
4098 pinval &= ~AC_PINCTL_VREFEN;
4099 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4100 /* temporarily power up/down for setting VREF */
4101 snd_hda_power_up_pm(codec);
4102 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4103 snd_hda_power_down_pm(codec);
4104 }
4105
4106 /* update mute-LED according to the speaker mute state via mic VREF pin */
4107 static int vref_mute_led_set(struct led_classdev *led_cdev,
4108 enum led_brightness brightness)
4109 {
4110 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4111 struct alc_spec *spec = codec->spec;
4112
4113 alc_update_vref_led(codec, spec->mute_led_nid,
4114 spec->mute_led_polarity, brightness);
4115 return 0;
4116 }
4117
4118 /* Make sure the led works even in runtime suspend */
4119 static unsigned int led_power_filter(struct hda_codec *codec,
4120 hda_nid_t nid,
4121 unsigned int power_state)
4122 {
4123 struct alc_spec *spec = codec->spec;
4124
4125 if (power_state != AC_PWRST_D3 || nid == 0 ||
4126 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4127 return power_state;
4128
4129 /* Set pin ctl again, it might have just been set to 0 */
4130 snd_hda_set_pin_ctl(codec, nid,
4131 snd_hda_codec_get_pin_target(codec, nid));
4132
4133 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4134 }
4135
4136 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4137 const struct hda_fixup *fix, int action)
4138 {
4139 struct alc_spec *spec = codec->spec;
4140 const struct dmi_device *dev = NULL;
4141
4142 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4143 return;
4144
4145 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4146 int pol, pin;
4147 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4148 continue;
4149 if (pin < 0x0a || pin >= 0x10)
4150 break;
4151 spec->mute_led_polarity = pol;
4152 spec->mute_led_nid = pin - 0x0a + 0x18;
4153 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4154 codec->power_filter = led_power_filter;
4155 codec_dbg(codec,
4156 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4157 spec->mute_led_polarity);
4158 break;
4159 }
4160 }
4161
4162 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4163 const struct hda_fixup *fix,
4164 int action, hda_nid_t pin)
4165 {
4166 struct alc_spec *spec = codec->spec;
4167
4168 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4169 spec->mute_led_polarity = 0;
4170 spec->mute_led_nid = pin;
4171 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4172 codec->power_filter = led_power_filter;
4173 }
4174 }
4175
4176 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4177 const struct hda_fixup *fix, int action)
4178 {
4179 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4180 }
4181
4182 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4183 const struct hda_fixup *fix, int action)
4184 {
4185 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4186 }
4187
4188 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4189 const struct hda_fixup *fix, int action)
4190 {
4191 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4192 }
4193
4194 /* update LED status via GPIO */
4195 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4196 int polarity, bool enabled)
4197 {
4198 if (polarity)
4199 enabled = !enabled;
4200 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4201 }
4202
4203 /* turn on/off mute LED via GPIO per vmaster hook */
4204 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4205 enum led_brightness brightness)
4206 {
4207 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4208 struct alc_spec *spec = codec->spec;
4209
4210 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4211 spec->mute_led_polarity, !brightness);
4212 return 0;
4213 }
4214
4215 /* turn on/off mic-mute LED via GPIO per capture hook */
4216 static int micmute_led_set(struct led_classdev *led_cdev,
4217 enum led_brightness brightness)
4218 {
4219 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4220 struct alc_spec *spec = codec->spec;
4221
4222 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4223 spec->micmute_led_polarity, !brightness);
4224 return 0;
4225 }
4226
4227 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4228 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4229 int action,
4230 unsigned int mute_mask,
4231 unsigned int micmute_mask)
4232 {
4233 struct alc_spec *spec = codec->spec;
4234
4235 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4236
4237 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4238 return;
4239 if (mute_mask) {
4240 spec->gpio_mute_led_mask = mute_mask;
4241 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4242 }
4243 if (micmute_mask) {
4244 spec->gpio_mic_led_mask = micmute_mask;
4245 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4246 }
4247 }
4248
4249 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4250 const struct hda_fixup *fix, int action)
4251 {
4252 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4253 }
4254
4255 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4256 const struct hda_fixup *fix, int action)
4257 {
4258 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4259 }
4260
4261 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4262 const struct hda_fixup *fix, int action)
4263 {
4264 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4265 }
4266
4267 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4268 const struct hda_fixup *fix, int action)
4269 {
4270 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4271 }
4272
4273 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4274 const struct hda_fixup *fix, int action)
4275 {
4276 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4277 }
4278
4279 /* turn on/off mic-mute LED per capture hook via VREF change */
4280 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4281 enum led_brightness brightness)
4282 {
4283 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4284 struct alc_spec *spec = codec->spec;
4285
4286 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4287 spec->micmute_led_polarity, brightness);
4288 return 0;
4289 }
4290
4291 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4292 const struct hda_fixup *fix, int action)
4293 {
4294 struct alc_spec *spec = codec->spec;
4295
4296 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4297 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4298 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4299 * enable headphone amp
4300 */
4301 spec->gpio_mask |= 0x10;
4302 spec->gpio_dir |= 0x10;
4303 spec->cap_mute_led_nid = 0x18;
4304 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4305 codec->power_filter = led_power_filter;
4306 }
4307 }
4308
4309 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4310 const struct hda_fixup *fix, int action)
4311 {
4312 struct alc_spec *spec = codec->spec;
4313
4314 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4315 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4316 spec->cap_mute_led_nid = 0x18;
4317 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4318 codec->power_filter = led_power_filter;
4319 }
4320 }
4321
4322 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4323 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4324 */
4325 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4326 const struct hda_fixup *fix, int action)
4327 {
4328 struct alc_spec *spec = codec->spec;
4329
4330 switch (action) {
4331 case HDA_FIXUP_ACT_PRE_PROBE:
4332 spec->gpio_mask |= 0x01;
4333 spec->gpio_dir |= 0x01;
4334 break;
4335 case HDA_FIXUP_ACT_INIT:
4336 /* need to toggle GPIO to enable the amp */
4337 alc_update_gpio_data(codec, 0x01, true);
4338 msleep(100);
4339 alc_update_gpio_data(codec, 0x01, false);
4340 break;
4341 }
4342 }
4343
4344 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4345 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4346 struct hda_codec *codec,
4347 struct snd_pcm_substream *substream,
4348 int action)
4349 {
4350 switch (action) {
4351 case HDA_GEN_PCM_ACT_PREPARE:
4352 alc_update_gpio_data(codec, 0x04, true);
4353 break;
4354 case HDA_GEN_PCM_ACT_CLEANUP:
4355 alc_update_gpio_data(codec, 0x04, false);
4356 break;
4357 }
4358 }
4359
4360 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4361 const struct hda_fixup *fix,
4362 int action)
4363 {
4364 struct alc_spec *spec = codec->spec;
4365
4366 if (action == HDA_FIXUP_ACT_PROBE) {
4367 spec->gpio_mask |= 0x04;
4368 spec->gpio_dir |= 0x04;
4369 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4370 }
4371 }
4372
4373 static void alc_update_coef_led(struct hda_codec *codec,
4374 struct alc_coef_led *led,
4375 bool polarity, bool on)
4376 {
4377 if (polarity)
4378 on = !on;
4379 /* temporarily power up/down for setting COEF bit */
4380 alc_update_coef_idx(codec, led->idx, led->mask,
4381 on ? led->on : led->off);
4382 }
4383
4384 /* update mute-LED according to the speaker mute state via COEF bit */
4385 static int coef_mute_led_set(struct led_classdev *led_cdev,
4386 enum led_brightness brightness)
4387 {
4388 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4389 struct alc_spec *spec = codec->spec;
4390
4391 alc_update_coef_led(codec, &spec->mute_led_coef,
4392 spec->mute_led_polarity, brightness);
4393 return 0;
4394 }
4395
4396 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4397 const struct hda_fixup *fix,
4398 int action)
4399 {
4400 struct alc_spec *spec = codec->spec;
4401
4402 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4403 spec->mute_led_polarity = 0;
4404 spec->mute_led_coef.idx = 0x0b;
4405 spec->mute_led_coef.mask = 1 << 3;
4406 spec->mute_led_coef.on = 1 << 3;
4407 spec->mute_led_coef.off = 0;
4408 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4409 }
4410 }
4411
4412 static void alc236_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 = 0x34;
4421 spec->mute_led_coef.mask = 1 << 5;
4422 spec->mute_led_coef.on = 0;
4423 spec->mute_led_coef.off = 1 << 5;
4424 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4425 }
4426 }
4427
4428 /* turn on/off mic-mute LED per capture hook by coef bit */
4429 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4430 enum led_brightness brightness)
4431 {
4432 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4433 struct alc_spec *spec = codec->spec;
4434
4435 alc_update_coef_led(codec, &spec->mic_led_coef,
4436 spec->micmute_led_polarity, brightness);
4437 return 0;
4438 }
4439
4440 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4441 const struct hda_fixup *fix, int action)
4442 {
4443 struct alc_spec *spec = codec->spec;
4444
4445 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4446 spec->mic_led_coef.idx = 0x19;
4447 spec->mic_led_coef.mask = 1 << 13;
4448 spec->mic_led_coef.on = 1 << 13;
4449 spec->mic_led_coef.off = 0;
4450 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4451 }
4452 }
4453
4454 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4455 const struct hda_fixup *fix, int action)
4456 {
4457 struct alc_spec *spec = codec->spec;
4458
4459 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4460 spec->mic_led_coef.idx = 0x35;
4461 spec->mic_led_coef.mask = 3 << 2;
4462 spec->mic_led_coef.on = 2 << 2;
4463 spec->mic_led_coef.off = 1 << 2;
4464 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4465 }
4466 }
4467
4468 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4469 const struct hda_fixup *fix, int action)
4470 {
4471 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4472 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4473 }
4474
4475 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4476 const struct hda_fixup *fix, int action)
4477 {
4478 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4479 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4480 }
4481
4482 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4483 const struct hda_fixup *fix, int action)
4484 {
4485 struct alc_spec *spec = codec->spec;
4486
4487 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4488 spec->cap_mute_led_nid = 0x1a;
4489 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4490 codec->power_filter = led_power_filter;
4491 }
4492 }
4493
4494 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4495 const struct hda_fixup *fix, int action)
4496 {
4497 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4498 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4499 }
4500
4501 #if IS_REACHABLE(CONFIG_INPUT)
4502 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4503 struct hda_jack_callback *event)
4504 {
4505 struct alc_spec *spec = codec->spec;
4506
4507 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4508 send both key on and key off event for every interrupt. */
4509 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4510 input_sync(spec->kb_dev);
4511 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4512 input_sync(spec->kb_dev);
4513 }
4514
4515 static int alc_register_micmute_input_device(struct hda_codec *codec)
4516 {
4517 struct alc_spec *spec = codec->spec;
4518 int i;
4519
4520 spec->kb_dev = input_allocate_device();
4521 if (!spec->kb_dev) {
4522 codec_err(codec, "Out of memory (input_allocate_device)\n");
4523 return -ENOMEM;
4524 }
4525
4526 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4527
4528 spec->kb_dev->name = "Microphone Mute Button";
4529 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4530 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4531 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4532 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4533 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4534 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4535
4536 if (input_register_device(spec->kb_dev)) {
4537 codec_err(codec, "input_register_device failed\n");
4538 input_free_device(spec->kb_dev);
4539 spec->kb_dev = NULL;
4540 return -ENOMEM;
4541 }
4542
4543 return 0;
4544 }
4545
4546 /* GPIO1 = set according to SKU external amp
4547 * GPIO2 = mic mute hotkey
4548 * GPIO3 = mute LED
4549 * GPIO4 = mic mute LED
4550 */
4551 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4552 const struct hda_fixup *fix, int action)
4553 {
4554 struct alc_spec *spec = codec->spec;
4555
4556 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4557 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4558 spec->init_amp = ALC_INIT_DEFAULT;
4559 if (alc_register_micmute_input_device(codec) != 0)
4560 return;
4561
4562 spec->gpio_mask |= 0x06;
4563 spec->gpio_dir |= 0x02;
4564 spec->gpio_data |= 0x02;
4565 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4566 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4567 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4568 gpio2_mic_hotkey_event);
4569 return;
4570 }
4571
4572 if (!spec->kb_dev)
4573 return;
4574
4575 switch (action) {
4576 case HDA_FIXUP_ACT_FREE:
4577 input_unregister_device(spec->kb_dev);
4578 spec->kb_dev = NULL;
4579 }
4580 }
4581
4582 /* Line2 = mic mute hotkey
4583 * GPIO2 = mic mute LED
4584 */
4585 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4586 const struct hda_fixup *fix, int action)
4587 {
4588 struct alc_spec *spec = codec->spec;
4589
4590 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4591 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4592 spec->init_amp = ALC_INIT_DEFAULT;
4593 if (alc_register_micmute_input_device(codec) != 0)
4594 return;
4595
4596 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4597 gpio2_mic_hotkey_event);
4598 return;
4599 }
4600
4601 if (!spec->kb_dev)
4602 return;
4603
4604 switch (action) {
4605 case HDA_FIXUP_ACT_FREE:
4606 input_unregister_device(spec->kb_dev);
4607 spec->kb_dev = NULL;
4608 }
4609 }
4610 #else /* INPUT */
4611 #define alc280_fixup_hp_gpio2_mic_hotkey NULL
4612 #define alc233_fixup_lenovo_line2_mic_hotkey NULL
4613 #endif /* INPUT */
4614
4615 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4616 const struct hda_fixup *fix, int action)
4617 {
4618 struct alc_spec *spec = codec->spec;
4619
4620 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4621 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4622 spec->cap_mute_led_nid = 0x18;
4623 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4624 }
4625 }
4626
4627 static const struct coef_fw alc225_pre_hsmode[] = {
4628 UPDATE_COEF(0x4a, 1<<8, 0),
4629 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4630 UPDATE_COEF(0x63, 3<<14, 3<<14),
4631 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4632 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4633 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4634 UPDATE_COEF(0x4a, 3<<10, 0),
4635 {}
4636 };
4637
4638 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4639 {
4640 struct alc_spec *spec = codec->spec;
4641 static const struct coef_fw coef0255[] = {
4642 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4643 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4644 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4645 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4646 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4647 {}
4648 };
4649 static const struct coef_fw coef0256[] = {
4650 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4651 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4652 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4653 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4654 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4655 {}
4656 };
4657 static const struct coef_fw coef0233[] = {
4658 WRITE_COEF(0x1b, 0x0c0b),
4659 WRITE_COEF(0x45, 0xc429),
4660 UPDATE_COEF(0x35, 0x4000, 0),
4661 WRITE_COEF(0x06, 0x2104),
4662 WRITE_COEF(0x1a, 0x0001),
4663 WRITE_COEF(0x26, 0x0004),
4664 WRITE_COEF(0x32, 0x42a3),
4665 {}
4666 };
4667 static const struct coef_fw coef0288[] = {
4668 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4669 UPDATE_COEF(0x50, 0x2000, 0x2000),
4670 UPDATE_COEF(0x56, 0x0006, 0x0006),
4671 UPDATE_COEF(0x66, 0x0008, 0),
4672 UPDATE_COEF(0x67, 0x2000, 0),
4673 {}
4674 };
4675 static const struct coef_fw coef0298[] = {
4676 UPDATE_COEF(0x19, 0x1300, 0x0300),
4677 {}
4678 };
4679 static const struct coef_fw coef0292[] = {
4680 WRITE_COEF(0x76, 0x000e),
4681 WRITE_COEF(0x6c, 0x2400),
4682 WRITE_COEF(0x18, 0x7308),
4683 WRITE_COEF(0x6b, 0xc429),
4684 {}
4685 };
4686 static const struct coef_fw coef0293[] = {
4687 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4688 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4689 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4690 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4691 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4692 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4693 {}
4694 };
4695 static const struct coef_fw coef0668[] = {
4696 WRITE_COEF(0x15, 0x0d40),
4697 WRITE_COEF(0xb7, 0x802b),
4698 {}
4699 };
4700 static const struct coef_fw coef0225[] = {
4701 UPDATE_COEF(0x63, 3<<14, 0),
4702 {}
4703 };
4704 static const struct coef_fw coef0274[] = {
4705 UPDATE_COEF(0x4a, 0x0100, 0),
4706 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4707 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4708 UPDATE_COEF(0x4a, 0x0010, 0),
4709 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4710 WRITE_COEF(0x45, 0x5289),
4711 UPDATE_COEF(0x4a, 0x0c00, 0),
4712 {}
4713 };
4714
4715 if (spec->no_internal_mic_pin) {
4716 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4717 return;
4718 }
4719
4720 switch (codec->core.vendor_id) {
4721 case 0x10ec0255:
4722 alc_process_coef_fw(codec, coef0255);
4723 break;
4724 case 0x10ec0236:
4725 case 0x10ec0256:
4726 alc_process_coef_fw(codec, coef0256);
4727 break;
4728 case 0x10ec0234:
4729 case 0x10ec0274:
4730 case 0x10ec0294:
4731 alc_process_coef_fw(codec, coef0274);
4732 break;
4733 case 0x10ec0233:
4734 case 0x10ec0283:
4735 alc_process_coef_fw(codec, coef0233);
4736 break;
4737 case 0x10ec0286:
4738 case 0x10ec0288:
4739 alc_process_coef_fw(codec, coef0288);
4740 break;
4741 case 0x10ec0298:
4742 alc_process_coef_fw(codec, coef0298);
4743 alc_process_coef_fw(codec, coef0288);
4744 break;
4745 case 0x10ec0292:
4746 alc_process_coef_fw(codec, coef0292);
4747 break;
4748 case 0x10ec0293:
4749 alc_process_coef_fw(codec, coef0293);
4750 break;
4751 case 0x10ec0668:
4752 alc_process_coef_fw(codec, coef0668);
4753 break;
4754 case 0x10ec0215:
4755 case 0x10ec0225:
4756 case 0x10ec0285:
4757 case 0x10ec0295:
4758 case 0x10ec0289:
4759 case 0x10ec0299:
4760 alc_process_coef_fw(codec, alc225_pre_hsmode);
4761 alc_process_coef_fw(codec, coef0225);
4762 break;
4763 case 0x10ec0867:
4764 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4765 break;
4766 }
4767 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
4768 }
4769
4770
4771 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4772 hda_nid_t mic_pin)
4773 {
4774 static const struct coef_fw coef0255[] = {
4775 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4776 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4777 {}
4778 };
4779 static const struct coef_fw coef0256[] = {
4780 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4781 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4782 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4783 {}
4784 };
4785 static const struct coef_fw coef0233[] = {
4786 UPDATE_COEF(0x35, 0, 1<<14),
4787 WRITE_COEF(0x06, 0x2100),
4788 WRITE_COEF(0x1a, 0x0021),
4789 WRITE_COEF(0x26, 0x008c),
4790 {}
4791 };
4792 static const struct coef_fw coef0288[] = {
4793 UPDATE_COEF(0x4f, 0x00c0, 0),
4794 UPDATE_COEF(0x50, 0x2000, 0),
4795 UPDATE_COEF(0x56, 0x0006, 0),
4796 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4797 UPDATE_COEF(0x66, 0x0008, 0x0008),
4798 UPDATE_COEF(0x67, 0x2000, 0x2000),
4799 {}
4800 };
4801 static const struct coef_fw coef0292[] = {
4802 WRITE_COEF(0x19, 0xa208),
4803 WRITE_COEF(0x2e, 0xacf0),
4804 {}
4805 };
4806 static const struct coef_fw coef0293[] = {
4807 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4808 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4809 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4810 {}
4811 };
4812 static const struct coef_fw coef0688[] = {
4813 WRITE_COEF(0xb7, 0x802b),
4814 WRITE_COEF(0xb5, 0x1040),
4815 UPDATE_COEF(0xc3, 0, 1<<12),
4816 {}
4817 };
4818 static const struct coef_fw coef0225[] = {
4819 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4820 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4821 UPDATE_COEF(0x63, 3<<14, 0),
4822 {}
4823 };
4824 static const struct coef_fw coef0274[] = {
4825 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4826 UPDATE_COEF(0x4a, 0x0010, 0),
4827 UPDATE_COEF(0x6b, 0xf000, 0),
4828 {}
4829 };
4830
4831 switch (codec->core.vendor_id) {
4832 case 0x10ec0255:
4833 alc_write_coef_idx(codec, 0x45, 0xc489);
4834 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4835 alc_process_coef_fw(codec, coef0255);
4836 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4837 break;
4838 case 0x10ec0236:
4839 case 0x10ec0256:
4840 alc_write_coef_idx(codec, 0x45, 0xc489);
4841 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4842 alc_process_coef_fw(codec, coef0256);
4843 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4844 break;
4845 case 0x10ec0234:
4846 case 0x10ec0274:
4847 case 0x10ec0294:
4848 alc_write_coef_idx(codec, 0x45, 0x4689);
4849 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4850 alc_process_coef_fw(codec, coef0274);
4851 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4852 break;
4853 case 0x10ec0233:
4854 case 0x10ec0283:
4855 alc_write_coef_idx(codec, 0x45, 0xc429);
4856 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4857 alc_process_coef_fw(codec, coef0233);
4858 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4859 break;
4860 case 0x10ec0286:
4861 case 0x10ec0288:
4862 case 0x10ec0298:
4863 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4864 alc_process_coef_fw(codec, coef0288);
4865 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4866 break;
4867 case 0x10ec0292:
4868 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4869 alc_process_coef_fw(codec, coef0292);
4870 break;
4871 case 0x10ec0293:
4872 /* Set to TRS mode */
4873 alc_write_coef_idx(codec, 0x45, 0xc429);
4874 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4875 alc_process_coef_fw(codec, coef0293);
4876 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4877 break;
4878 case 0x10ec0867:
4879 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4880 fallthrough;
4881 case 0x10ec0221:
4882 case 0x10ec0662:
4883 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4884 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4885 break;
4886 case 0x10ec0668:
4887 alc_write_coef_idx(codec, 0x11, 0x0001);
4888 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4889 alc_process_coef_fw(codec, coef0688);
4890 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4891 break;
4892 case 0x10ec0215:
4893 case 0x10ec0225:
4894 case 0x10ec0285:
4895 case 0x10ec0295:
4896 case 0x10ec0289:
4897 case 0x10ec0299:
4898 alc_process_coef_fw(codec, alc225_pre_hsmode);
4899 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4900 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4901 alc_process_coef_fw(codec, coef0225);
4902 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4903 break;
4904 }
4905 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
4906 }
4907
4908 static void alc_headset_mode_default(struct hda_codec *codec)
4909 {
4910 static const struct coef_fw coef0225[] = {
4911 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4912 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4913 UPDATE_COEF(0x49, 3<<8, 0<<8),
4914 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4915 UPDATE_COEF(0x63, 3<<14, 0),
4916 UPDATE_COEF(0x67, 0xf000, 0x3000),
4917 {}
4918 };
4919 static const struct coef_fw coef0255[] = {
4920 WRITE_COEF(0x45, 0xc089),
4921 WRITE_COEF(0x45, 0xc489),
4922 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4923 WRITE_COEF(0x49, 0x0049),
4924 {}
4925 };
4926 static const struct coef_fw coef0256[] = {
4927 WRITE_COEF(0x45, 0xc489),
4928 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4929 WRITE_COEF(0x49, 0x0049),
4930 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4931 WRITE_COEF(0x06, 0x6100),
4932 {}
4933 };
4934 static const struct coef_fw coef0233[] = {
4935 WRITE_COEF(0x06, 0x2100),
4936 WRITE_COEF(0x32, 0x4ea3),
4937 {}
4938 };
4939 static const struct coef_fw coef0288[] = {
4940 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4941 UPDATE_COEF(0x50, 0x2000, 0x2000),
4942 UPDATE_COEF(0x56, 0x0006, 0x0006),
4943 UPDATE_COEF(0x66, 0x0008, 0),
4944 UPDATE_COEF(0x67, 0x2000, 0),
4945 {}
4946 };
4947 static const struct coef_fw coef0292[] = {
4948 WRITE_COEF(0x76, 0x000e),
4949 WRITE_COEF(0x6c, 0x2400),
4950 WRITE_COEF(0x6b, 0xc429),
4951 WRITE_COEF(0x18, 0x7308),
4952 {}
4953 };
4954 static const struct coef_fw coef0293[] = {
4955 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4956 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4957 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4958 {}
4959 };
4960 static const struct coef_fw coef0688[] = {
4961 WRITE_COEF(0x11, 0x0041),
4962 WRITE_COEF(0x15, 0x0d40),
4963 WRITE_COEF(0xb7, 0x802b),
4964 {}
4965 };
4966 static const struct coef_fw coef0274[] = {
4967 WRITE_COEF(0x45, 0x4289),
4968 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4969 UPDATE_COEF(0x6b, 0x0f00, 0),
4970 UPDATE_COEF(0x49, 0x0300, 0x0300),
4971 {}
4972 };
4973
4974 switch (codec->core.vendor_id) {
4975 case 0x10ec0215:
4976 case 0x10ec0225:
4977 case 0x10ec0285:
4978 case 0x10ec0295:
4979 case 0x10ec0289:
4980 case 0x10ec0299:
4981 alc_process_coef_fw(codec, alc225_pre_hsmode);
4982 alc_process_coef_fw(codec, coef0225);
4983 break;
4984 case 0x10ec0255:
4985 alc_process_coef_fw(codec, coef0255);
4986 break;
4987 case 0x10ec0236:
4988 case 0x10ec0256:
4989 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
4990 alc_write_coef_idx(codec, 0x45, 0xc089);
4991 msleep(50);
4992 alc_process_coef_fw(codec, coef0256);
4993 break;
4994 case 0x10ec0234:
4995 case 0x10ec0274:
4996 case 0x10ec0294:
4997 alc_process_coef_fw(codec, coef0274);
4998 break;
4999 case 0x10ec0233:
5000 case 0x10ec0283:
5001 alc_process_coef_fw(codec, coef0233);
5002 break;
5003 case 0x10ec0286:
5004 case 0x10ec0288:
5005 case 0x10ec0298:
5006 alc_process_coef_fw(codec, coef0288);
5007 break;
5008 case 0x10ec0292:
5009 alc_process_coef_fw(codec, coef0292);
5010 break;
5011 case 0x10ec0293:
5012 alc_process_coef_fw(codec, coef0293);
5013 break;
5014 case 0x10ec0668:
5015 alc_process_coef_fw(codec, coef0688);
5016 break;
5017 case 0x10ec0867:
5018 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5019 break;
5020 }
5021 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5022 }
5023
5024 /* Iphone type */
5025 static void alc_headset_mode_ctia(struct hda_codec *codec)
5026 {
5027 int val;
5028
5029 static const struct coef_fw coef0255[] = {
5030 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5031 WRITE_COEF(0x1b, 0x0c2b),
5032 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5033 {}
5034 };
5035 static const struct coef_fw coef0256[] = {
5036 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5037 WRITE_COEF(0x1b, 0x0e6b),
5038 {}
5039 };
5040 static const struct coef_fw coef0233[] = {
5041 WRITE_COEF(0x45, 0xd429),
5042 WRITE_COEF(0x1b, 0x0c2b),
5043 WRITE_COEF(0x32, 0x4ea3),
5044 {}
5045 };
5046 static const struct coef_fw coef0288[] = {
5047 UPDATE_COEF(0x50, 0x2000, 0x2000),
5048 UPDATE_COEF(0x56, 0x0006, 0x0006),
5049 UPDATE_COEF(0x66, 0x0008, 0),
5050 UPDATE_COEF(0x67, 0x2000, 0),
5051 {}
5052 };
5053 static const struct coef_fw coef0292[] = {
5054 WRITE_COEF(0x6b, 0xd429),
5055 WRITE_COEF(0x76, 0x0008),
5056 WRITE_COEF(0x18, 0x7388),
5057 {}
5058 };
5059 static const struct coef_fw coef0293[] = {
5060 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5061 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5062 {}
5063 };
5064 static const struct coef_fw coef0688[] = {
5065 WRITE_COEF(0x11, 0x0001),
5066 WRITE_COEF(0x15, 0x0d60),
5067 WRITE_COEF(0xc3, 0x0000),
5068 {}
5069 };
5070 static const struct coef_fw coef0225_1[] = {
5071 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5072 UPDATE_COEF(0x63, 3<<14, 2<<14),
5073 {}
5074 };
5075 static const struct coef_fw coef0225_2[] = {
5076 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5077 UPDATE_COEF(0x63, 3<<14, 1<<14),
5078 {}
5079 };
5080
5081 switch (codec->core.vendor_id) {
5082 case 0x10ec0255:
5083 alc_process_coef_fw(codec, coef0255);
5084 break;
5085 case 0x10ec0236:
5086 case 0x10ec0256:
5087 alc_process_coef_fw(codec, coef0256);
5088 break;
5089 case 0x10ec0234:
5090 case 0x10ec0274:
5091 case 0x10ec0294:
5092 alc_write_coef_idx(codec, 0x45, 0xd689);
5093 break;
5094 case 0x10ec0233:
5095 case 0x10ec0283:
5096 alc_process_coef_fw(codec, coef0233);
5097 break;
5098 case 0x10ec0298:
5099 val = alc_read_coef_idx(codec, 0x50);
5100 if (val & (1 << 12)) {
5101 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5102 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5103 msleep(300);
5104 } else {
5105 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5106 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5107 msleep(300);
5108 }
5109 break;
5110 case 0x10ec0286:
5111 case 0x10ec0288:
5112 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5113 msleep(300);
5114 alc_process_coef_fw(codec, coef0288);
5115 break;
5116 case 0x10ec0292:
5117 alc_process_coef_fw(codec, coef0292);
5118 break;
5119 case 0x10ec0293:
5120 alc_process_coef_fw(codec, coef0293);
5121 break;
5122 case 0x10ec0668:
5123 alc_process_coef_fw(codec, coef0688);
5124 break;
5125 case 0x10ec0215:
5126 case 0x10ec0225:
5127 case 0x10ec0285:
5128 case 0x10ec0295:
5129 case 0x10ec0289:
5130 case 0x10ec0299:
5131 val = alc_read_coef_idx(codec, 0x45);
5132 if (val & (1 << 9))
5133 alc_process_coef_fw(codec, coef0225_2);
5134 else
5135 alc_process_coef_fw(codec, coef0225_1);
5136 break;
5137 case 0x10ec0867:
5138 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5139 break;
5140 }
5141 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5142 }
5143
5144 /* Nokia type */
5145 static void alc_headset_mode_omtp(struct hda_codec *codec)
5146 {
5147 static const struct coef_fw coef0255[] = {
5148 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5149 WRITE_COEF(0x1b, 0x0c2b),
5150 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5151 {}
5152 };
5153 static const struct coef_fw coef0256[] = {
5154 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5155 WRITE_COEF(0x1b, 0x0e6b),
5156 {}
5157 };
5158 static const struct coef_fw coef0233[] = {
5159 WRITE_COEF(0x45, 0xe429),
5160 WRITE_COEF(0x1b, 0x0c2b),
5161 WRITE_COEF(0x32, 0x4ea3),
5162 {}
5163 };
5164 static const struct coef_fw coef0288[] = {
5165 UPDATE_COEF(0x50, 0x2000, 0x2000),
5166 UPDATE_COEF(0x56, 0x0006, 0x0006),
5167 UPDATE_COEF(0x66, 0x0008, 0),
5168 UPDATE_COEF(0x67, 0x2000, 0),
5169 {}
5170 };
5171 static const struct coef_fw coef0292[] = {
5172 WRITE_COEF(0x6b, 0xe429),
5173 WRITE_COEF(0x76, 0x0008),
5174 WRITE_COEF(0x18, 0x7388),
5175 {}
5176 };
5177 static const struct coef_fw coef0293[] = {
5178 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5179 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5180 {}
5181 };
5182 static const struct coef_fw coef0688[] = {
5183 WRITE_COEF(0x11, 0x0001),
5184 WRITE_COEF(0x15, 0x0d50),
5185 WRITE_COEF(0xc3, 0x0000),
5186 {}
5187 };
5188 static const struct coef_fw coef0225[] = {
5189 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5190 UPDATE_COEF(0x63, 3<<14, 2<<14),
5191 {}
5192 };
5193
5194 switch (codec->core.vendor_id) {
5195 case 0x10ec0255:
5196 alc_process_coef_fw(codec, coef0255);
5197 break;
5198 case 0x10ec0236:
5199 case 0x10ec0256:
5200 alc_process_coef_fw(codec, coef0256);
5201 break;
5202 case 0x10ec0234:
5203 case 0x10ec0274:
5204 case 0x10ec0294:
5205 alc_write_coef_idx(codec, 0x45, 0xe689);
5206 break;
5207 case 0x10ec0233:
5208 case 0x10ec0283:
5209 alc_process_coef_fw(codec, coef0233);
5210 break;
5211 case 0x10ec0298:
5212 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5213 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5214 msleep(300);
5215 break;
5216 case 0x10ec0286:
5217 case 0x10ec0288:
5218 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5219 msleep(300);
5220 alc_process_coef_fw(codec, coef0288);
5221 break;
5222 case 0x10ec0292:
5223 alc_process_coef_fw(codec, coef0292);
5224 break;
5225 case 0x10ec0293:
5226 alc_process_coef_fw(codec, coef0293);
5227 break;
5228 case 0x10ec0668:
5229 alc_process_coef_fw(codec, coef0688);
5230 break;
5231 case 0x10ec0215:
5232 case 0x10ec0225:
5233 case 0x10ec0285:
5234 case 0x10ec0295:
5235 case 0x10ec0289:
5236 case 0x10ec0299:
5237 alc_process_coef_fw(codec, coef0225);
5238 break;
5239 }
5240 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5241 }
5242
5243 static void alc_determine_headset_type(struct hda_codec *codec)
5244 {
5245 int val;
5246 bool is_ctia = false;
5247 struct alc_spec *spec = codec->spec;
5248 static const struct coef_fw coef0255[] = {
5249 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5250 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5251 conteol) */
5252 {}
5253 };
5254 static const struct coef_fw coef0288[] = {
5255 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5256 {}
5257 };
5258 static const struct coef_fw coef0298[] = {
5259 UPDATE_COEF(0x50, 0x2000, 0x2000),
5260 UPDATE_COEF(0x56, 0x0006, 0x0006),
5261 UPDATE_COEF(0x66, 0x0008, 0),
5262 UPDATE_COEF(0x67, 0x2000, 0),
5263 UPDATE_COEF(0x19, 0x1300, 0x1300),
5264 {}
5265 };
5266 static const struct coef_fw coef0293[] = {
5267 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5268 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5269 {}
5270 };
5271 static const struct coef_fw coef0688[] = {
5272 WRITE_COEF(0x11, 0x0001),
5273 WRITE_COEF(0xb7, 0x802b),
5274 WRITE_COEF(0x15, 0x0d60),
5275 WRITE_COEF(0xc3, 0x0c00),
5276 {}
5277 };
5278 static const struct coef_fw coef0274[] = {
5279 UPDATE_COEF(0x4a, 0x0010, 0),
5280 UPDATE_COEF(0x4a, 0x8000, 0),
5281 WRITE_COEF(0x45, 0xd289),
5282 UPDATE_COEF(0x49, 0x0300, 0x0300),
5283 {}
5284 };
5285
5286 if (spec->no_internal_mic_pin) {
5287 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5288 return;
5289 }
5290
5291 switch (codec->core.vendor_id) {
5292 case 0x10ec0255:
5293 alc_process_coef_fw(codec, coef0255);
5294 msleep(300);
5295 val = alc_read_coef_idx(codec, 0x46);
5296 is_ctia = (val & 0x0070) == 0x0070;
5297 break;
5298 case 0x10ec0236:
5299 case 0x10ec0256:
5300 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5301 alc_write_coef_idx(codec, 0x06, 0x6104);
5302 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5303
5304 snd_hda_codec_write(codec, 0x21, 0,
5305 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5306 msleep(80);
5307 snd_hda_codec_write(codec, 0x21, 0,
5308 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5309
5310 alc_process_coef_fw(codec, coef0255);
5311 msleep(300);
5312 val = alc_read_coef_idx(codec, 0x46);
5313 is_ctia = (val & 0x0070) == 0x0070;
5314
5315 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5316 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5317
5318 snd_hda_codec_write(codec, 0x21, 0,
5319 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5320 msleep(80);
5321 snd_hda_codec_write(codec, 0x21, 0,
5322 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5323 break;
5324 case 0x10ec0234:
5325 case 0x10ec0274:
5326 case 0x10ec0294:
5327 alc_process_coef_fw(codec, coef0274);
5328 msleep(850);
5329 val = alc_read_coef_idx(codec, 0x46);
5330 is_ctia = (val & 0x00f0) == 0x00f0;
5331 break;
5332 case 0x10ec0233:
5333 case 0x10ec0283:
5334 alc_write_coef_idx(codec, 0x45, 0xd029);
5335 msleep(300);
5336 val = alc_read_coef_idx(codec, 0x46);
5337 is_ctia = (val & 0x0070) == 0x0070;
5338 break;
5339 case 0x10ec0298:
5340 snd_hda_codec_write(codec, 0x21, 0,
5341 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5342 msleep(100);
5343 snd_hda_codec_write(codec, 0x21, 0,
5344 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5345 msleep(200);
5346
5347 val = alc_read_coef_idx(codec, 0x50);
5348 if (val & (1 << 12)) {
5349 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5350 alc_process_coef_fw(codec, coef0288);
5351 msleep(350);
5352 val = alc_read_coef_idx(codec, 0x50);
5353 is_ctia = (val & 0x0070) == 0x0070;
5354 } else {
5355 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5356 alc_process_coef_fw(codec, coef0288);
5357 msleep(350);
5358 val = alc_read_coef_idx(codec, 0x50);
5359 is_ctia = (val & 0x0070) == 0x0070;
5360 }
5361 alc_process_coef_fw(codec, coef0298);
5362 snd_hda_codec_write(codec, 0x21, 0,
5363 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5364 msleep(75);
5365 snd_hda_codec_write(codec, 0x21, 0,
5366 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5367 break;
5368 case 0x10ec0286:
5369 case 0x10ec0288:
5370 alc_process_coef_fw(codec, coef0288);
5371 msleep(350);
5372 val = alc_read_coef_idx(codec, 0x50);
5373 is_ctia = (val & 0x0070) == 0x0070;
5374 break;
5375 case 0x10ec0292:
5376 alc_write_coef_idx(codec, 0x6b, 0xd429);
5377 msleep(300);
5378 val = alc_read_coef_idx(codec, 0x6c);
5379 is_ctia = (val & 0x001c) == 0x001c;
5380 break;
5381 case 0x10ec0293:
5382 alc_process_coef_fw(codec, coef0293);
5383 msleep(300);
5384 val = alc_read_coef_idx(codec, 0x46);
5385 is_ctia = (val & 0x0070) == 0x0070;
5386 break;
5387 case 0x10ec0668:
5388 alc_process_coef_fw(codec, coef0688);
5389 msleep(300);
5390 val = alc_read_coef_idx(codec, 0xbe);
5391 is_ctia = (val & 0x1c02) == 0x1c02;
5392 break;
5393 case 0x10ec0215:
5394 case 0x10ec0225:
5395 case 0x10ec0285:
5396 case 0x10ec0295:
5397 case 0x10ec0289:
5398 case 0x10ec0299:
5399 snd_hda_codec_write(codec, 0x21, 0,
5400 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5401 msleep(80);
5402 snd_hda_codec_write(codec, 0x21, 0,
5403 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5404
5405 alc_process_coef_fw(codec, alc225_pre_hsmode);
5406 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5407 val = alc_read_coef_idx(codec, 0x45);
5408 if (val & (1 << 9)) {
5409 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5410 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5411 msleep(800);
5412 val = alc_read_coef_idx(codec, 0x46);
5413 is_ctia = (val & 0x00f0) == 0x00f0;
5414 } else {
5415 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5416 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5417 msleep(800);
5418 val = alc_read_coef_idx(codec, 0x46);
5419 is_ctia = (val & 0x00f0) == 0x00f0;
5420 }
5421 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5422 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5423 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5424
5425 snd_hda_codec_write(codec, 0x21, 0,
5426 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5427 msleep(80);
5428 snd_hda_codec_write(codec, 0x21, 0,
5429 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5430 break;
5431 case 0x10ec0867:
5432 is_ctia = true;
5433 break;
5434 }
5435
5436 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5437 is_ctia ? "yes" : "no");
5438 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5439 }
5440
5441 static void alc_update_headset_mode(struct hda_codec *codec)
5442 {
5443 struct alc_spec *spec = codec->spec;
5444
5445 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5446 hda_nid_t hp_pin = alc_get_hp_pin(spec);
5447
5448 int new_headset_mode;
5449
5450 if (!snd_hda_jack_detect(codec, hp_pin))
5451 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5452 else if (mux_pin == spec->headset_mic_pin)
5453 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5454 else if (mux_pin == spec->headphone_mic_pin)
5455 new_headset_mode = ALC_HEADSET_MODE_MIC;
5456 else
5457 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5458
5459 if (new_headset_mode == spec->current_headset_mode) {
5460 snd_hda_gen_update_outputs(codec);
5461 return;
5462 }
5463
5464 switch (new_headset_mode) {
5465 case ALC_HEADSET_MODE_UNPLUGGED:
5466 alc_headset_mode_unplugged(codec);
5467 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5468 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5469 spec->gen.hp_jack_present = false;
5470 break;
5471 case ALC_HEADSET_MODE_HEADSET:
5472 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5473 alc_determine_headset_type(codec);
5474 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5475 alc_headset_mode_ctia(codec);
5476 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5477 alc_headset_mode_omtp(codec);
5478 spec->gen.hp_jack_present = true;
5479 break;
5480 case ALC_HEADSET_MODE_MIC:
5481 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5482 spec->gen.hp_jack_present = false;
5483 break;
5484 case ALC_HEADSET_MODE_HEADPHONE:
5485 alc_headset_mode_default(codec);
5486 spec->gen.hp_jack_present = true;
5487 break;
5488 }
5489 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5490 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5491 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5492 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5493 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5494 PIN_VREFHIZ);
5495 }
5496 spec->current_headset_mode = new_headset_mode;
5497
5498 snd_hda_gen_update_outputs(codec);
5499 }
5500
5501 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5502 struct snd_kcontrol *kcontrol,
5503 struct snd_ctl_elem_value *ucontrol)
5504 {
5505 alc_update_headset_mode(codec);
5506 }
5507
5508 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5509 struct hda_jack_callback *jack)
5510 {
5511 snd_hda_gen_hp_automute(codec, jack);
5512 alc_update_headset_mode(codec);
5513 }
5514
5515 static void alc_probe_headset_mode(struct hda_codec *codec)
5516 {
5517 int i;
5518 struct alc_spec *spec = codec->spec;
5519 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5520
5521 /* Find mic pins */
5522 for (i = 0; i < cfg->num_inputs; i++) {
5523 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5524 spec->headset_mic_pin = cfg->inputs[i].pin;
5525 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5526 spec->headphone_mic_pin = cfg->inputs[i].pin;
5527 }
5528
5529 WARN_ON(spec->gen.cap_sync_hook);
5530 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5531 spec->gen.automute_hook = alc_update_headset_mode;
5532 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5533 }
5534
5535 static void alc_fixup_headset_mode(struct hda_codec *codec,
5536 const struct hda_fixup *fix, int action)
5537 {
5538 struct alc_spec *spec = codec->spec;
5539
5540 switch (action) {
5541 case HDA_FIXUP_ACT_PRE_PROBE:
5542 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5543 break;
5544 case HDA_FIXUP_ACT_PROBE:
5545 alc_probe_headset_mode(codec);
5546 break;
5547 case HDA_FIXUP_ACT_INIT:
5548 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5549 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5550 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5551 }
5552 alc_update_headset_mode(codec);
5553 break;
5554 }
5555 }
5556
5557 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5558 const struct hda_fixup *fix, int action)
5559 {
5560 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5561 struct alc_spec *spec = codec->spec;
5562 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5563 }
5564 else
5565 alc_fixup_headset_mode(codec, fix, action);
5566 }
5567
5568 static void alc255_set_default_jack_type(struct hda_codec *codec)
5569 {
5570 /* Set to iphone type */
5571 static const struct coef_fw alc255fw[] = {
5572 WRITE_COEF(0x1b, 0x880b),
5573 WRITE_COEF(0x45, 0xd089),
5574 WRITE_COEF(0x1b, 0x080b),
5575 WRITE_COEF(0x46, 0x0004),
5576 WRITE_COEF(0x1b, 0x0c0b),
5577 {}
5578 };
5579 static const struct coef_fw alc256fw[] = {
5580 WRITE_COEF(0x1b, 0x884b),
5581 WRITE_COEF(0x45, 0xd089),
5582 WRITE_COEF(0x1b, 0x084b),
5583 WRITE_COEF(0x46, 0x0004),
5584 WRITE_COEF(0x1b, 0x0c4b),
5585 {}
5586 };
5587 switch (codec->core.vendor_id) {
5588 case 0x10ec0255:
5589 alc_process_coef_fw(codec, alc255fw);
5590 break;
5591 case 0x10ec0236:
5592 case 0x10ec0256:
5593 alc_process_coef_fw(codec, alc256fw);
5594 break;
5595 }
5596 msleep(30);
5597 }
5598
5599 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5600 const struct hda_fixup *fix, int action)
5601 {
5602 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5603 alc255_set_default_jack_type(codec);
5604 }
5605 alc_fixup_headset_mode(codec, fix, action);
5606 }
5607
5608 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5609 const struct hda_fixup *fix, int action)
5610 {
5611 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5612 struct alc_spec *spec = codec->spec;
5613 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5614 alc255_set_default_jack_type(codec);
5615 }
5616 else
5617 alc_fixup_headset_mode(codec, fix, action);
5618 }
5619
5620 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5621 struct hda_jack_callback *jack)
5622 {
5623 struct alc_spec *spec = codec->spec;
5624
5625 alc_update_headset_jack_cb(codec, jack);
5626 /* Headset Mic enable or disable, only for Dell Dino */
5627 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5628 }
5629
5630 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5631 const struct hda_fixup *fix, int action)
5632 {
5633 alc_fixup_headset_mode(codec, fix, action);
5634 if (action == HDA_FIXUP_ACT_PROBE) {
5635 struct alc_spec *spec = codec->spec;
5636 /* toggled via hp_automute_hook */
5637 spec->gpio_mask |= 0x40;
5638 spec->gpio_dir |= 0x40;
5639 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5640 }
5641 }
5642
5643 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5644 const struct hda_fixup *fix, int action)
5645 {
5646 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5647 struct alc_spec *spec = codec->spec;
5648 spec->gen.auto_mute_via_amp = 1;
5649 }
5650 }
5651
5652 static void alc_fixup_no_shutup(struct hda_codec *codec,
5653 const struct hda_fixup *fix, int action)
5654 {
5655 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5656 struct alc_spec *spec = codec->spec;
5657 spec->no_shutup_pins = 1;
5658 }
5659 }
5660
5661 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5662 const struct hda_fixup *fix, int action)
5663 {
5664 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5665 struct alc_spec *spec = codec->spec;
5666 /* Disable AA-loopback as it causes white noise */
5667 spec->gen.mixer_nid = 0;
5668 }
5669 }
5670
5671 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5672 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5673 const struct hda_fixup *fix, int action)
5674 {
5675 static const struct hda_pintbl pincfgs[] = {
5676 { 0x16, 0x21211010 }, /* dock headphone */
5677 { 0x19, 0x21a11010 }, /* dock mic */
5678 { }
5679 };
5680 struct alc_spec *spec = codec->spec;
5681
5682 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5683 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
5684 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5685 codec->power_save_node = 0; /* avoid click noises */
5686 snd_hda_apply_pincfgs(codec, pincfgs);
5687 }
5688 }
5689
5690 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5691 const struct hda_fixup *fix, int action)
5692 {
5693 static const struct hda_pintbl pincfgs[] = {
5694 { 0x17, 0x21211010 }, /* dock headphone */
5695 { 0x19, 0x21a11010 }, /* dock mic */
5696 { }
5697 };
5698 struct alc_spec *spec = codec->spec;
5699
5700 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5701 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5702 snd_hda_apply_pincfgs(codec, pincfgs);
5703 } else if (action == HDA_FIXUP_ACT_INIT) {
5704 /* Enable DOCK device */
5705 snd_hda_codec_write(codec, 0x17, 0,
5706 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5707 /* Enable DOCK device */
5708 snd_hda_codec_write(codec, 0x19, 0,
5709 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5710 }
5711 }
5712
5713 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5714 const struct hda_fixup *fix, int action)
5715 {
5716 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5717 * the speaker output becomes too low by some reason on Thinkpads with
5718 * ALC298 codec
5719 */
5720 static const hda_nid_t preferred_pairs[] = {
5721 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5722 0
5723 };
5724 struct alc_spec *spec = codec->spec;
5725
5726 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5727 spec->gen.preferred_dacs = preferred_pairs;
5728 }
5729
5730 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5731 const struct hda_fixup *fix, int action)
5732 {
5733 static const hda_nid_t preferred_pairs[] = {
5734 0x17, 0x02, 0x21, 0x03, 0
5735 };
5736 struct alc_spec *spec = codec->spec;
5737
5738 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5739 spec->gen.preferred_dacs = preferred_pairs;
5740 }
5741
5742 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5743 {
5744 struct alc_spec *spec = codec->spec;
5745 int hp_pin = alc_get_hp_pin(spec);
5746
5747 /* Prevent pop noises when headphones are plugged in */
5748 snd_hda_codec_write(codec, hp_pin, 0,
5749 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5750 msleep(20);
5751 }
5752
5753 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5754 const struct hda_fixup *fix, int action)
5755 {
5756 struct alc_spec *spec = codec->spec;
5757 struct hda_input_mux *imux = &spec->gen.input_mux;
5758 int i;
5759
5760 switch (action) {
5761 case HDA_FIXUP_ACT_PRE_PROBE:
5762 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5763 * it causes a click noise at start up
5764 */
5765 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5766 spec->shutup = alc_shutup_dell_xps13;
5767 break;
5768 case HDA_FIXUP_ACT_PROBE:
5769 /* Make the internal mic the default input source. */
5770 for (i = 0; i < imux->num_items; i++) {
5771 if (spec->gen.imux_pins[i] == 0x12) {
5772 spec->gen.cur_mux[0] = i;
5773 break;
5774 }
5775 }
5776 break;
5777 }
5778 }
5779
5780 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5781 const struct hda_fixup *fix, int action)
5782 {
5783 struct alc_spec *spec = codec->spec;
5784
5785 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5786 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5787 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
5788
5789 /* Disable boost for mic-in permanently. (This code is only called
5790 from quirks that guarantee that the headphone is at NID 0x1b.) */
5791 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5792 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
5793 } else
5794 alc_fixup_headset_mode(codec, fix, action);
5795 }
5796
5797 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5798 const struct hda_fixup *fix, int action)
5799 {
5800 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5801 alc_write_coef_idx(codec, 0xc4, 0x8000);
5802 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
5803 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5804 }
5805 alc_fixup_headset_mode(codec, fix, action);
5806 }
5807
5808 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5809 static int find_ext_mic_pin(struct hda_codec *codec)
5810 {
5811 struct alc_spec *spec = codec->spec;
5812 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5813 hda_nid_t nid;
5814 unsigned int defcfg;
5815 int i;
5816
5817 for (i = 0; i < cfg->num_inputs; i++) {
5818 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5819 continue;
5820 nid = cfg->inputs[i].pin;
5821 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5822 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5823 continue;
5824 return nid;
5825 }
5826
5827 return 0;
5828 }
5829
5830 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
5831 const struct hda_fixup *fix,
5832 int action)
5833 {
5834 struct alc_spec *spec = codec->spec;
5835
5836 if (action == HDA_FIXUP_ACT_PROBE) {
5837 int mic_pin = find_ext_mic_pin(codec);
5838 int hp_pin = alc_get_hp_pin(spec);
5839
5840 if (snd_BUG_ON(!mic_pin || !hp_pin))
5841 return;
5842 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
5843 }
5844 }
5845
5846 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5847 const struct hda_fixup *fix,
5848 int action)
5849 {
5850 struct alc_spec *spec = codec->spec;
5851 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5852 int i;
5853
5854 /* The mic boosts on level 2 and 3 are too noisy
5855 on the internal mic input.
5856 Therefore limit the boost to 0 or 1. */
5857
5858 if (action != HDA_FIXUP_ACT_PROBE)
5859 return;
5860
5861 for (i = 0; i < cfg->num_inputs; i++) {
5862 hda_nid_t nid = cfg->inputs[i].pin;
5863 unsigned int defcfg;
5864 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5865 continue;
5866 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5867 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5868 continue;
5869
5870 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5871 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5872 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5873 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5874 (0 << AC_AMPCAP_MUTE_SHIFT));
5875 }
5876 }
5877
5878 static void alc283_hp_automute_hook(struct hda_codec *codec,
5879 struct hda_jack_callback *jack)
5880 {
5881 struct alc_spec *spec = codec->spec;
5882 int vref;
5883
5884 msleep(200);
5885 snd_hda_gen_hp_automute(codec, jack);
5886
5887 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5888
5889 msleep(600);
5890 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5891 vref);
5892 }
5893
5894 static void alc283_fixup_chromebook(struct hda_codec *codec,
5895 const struct hda_fixup *fix, int action)
5896 {
5897 struct alc_spec *spec = codec->spec;
5898
5899 switch (action) {
5900 case HDA_FIXUP_ACT_PRE_PROBE:
5901 snd_hda_override_wcaps(codec, 0x03, 0);
5902 /* Disable AA-loopback as it causes white noise */
5903 spec->gen.mixer_nid = 0;
5904 break;
5905 case HDA_FIXUP_ACT_INIT:
5906 /* MIC2-VREF control */
5907 /* Set to manual mode */
5908 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5909 /* Enable Line1 input control by verb */
5910 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
5911 break;
5912 }
5913 }
5914
5915 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5916 const struct hda_fixup *fix, int action)
5917 {
5918 struct alc_spec *spec = codec->spec;
5919
5920 switch (action) {
5921 case HDA_FIXUP_ACT_PRE_PROBE:
5922 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5923 break;
5924 case HDA_FIXUP_ACT_INIT:
5925 /* MIC2-VREF control */
5926 /* Set to manual mode */
5927 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
5928 break;
5929 }
5930 }
5931
5932 /* mute tablet speaker pin (0x14) via dock plugging in addition */
5933 static void asus_tx300_automute(struct hda_codec *codec)
5934 {
5935 struct alc_spec *spec = codec->spec;
5936 snd_hda_gen_update_outputs(codec);
5937 if (snd_hda_jack_detect(codec, 0x1b))
5938 spec->gen.mute_bits |= (1ULL << 0x14);
5939 }
5940
5941 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5942 const struct hda_fixup *fix, int action)
5943 {
5944 struct alc_spec *spec = codec->spec;
5945 static const struct hda_pintbl dock_pins[] = {
5946 { 0x1b, 0x21114000 }, /* dock speaker pin */
5947 {}
5948 };
5949
5950 switch (action) {
5951 case HDA_FIXUP_ACT_PRE_PROBE:
5952 spec->init_amp = ALC_INIT_DEFAULT;
5953 /* TX300 needs to set up GPIO2 for the speaker amp */
5954 alc_setup_gpio(codec, 0x04);
5955 snd_hda_apply_pincfgs(codec, dock_pins);
5956 spec->gen.auto_mute_via_amp = 1;
5957 spec->gen.automute_hook = asus_tx300_automute;
5958 snd_hda_jack_detect_enable_callback(codec, 0x1b,
5959 snd_hda_gen_hp_automute);
5960 break;
5961 case HDA_FIXUP_ACT_PROBE:
5962 spec->init_amp = ALC_INIT_DEFAULT;
5963 break;
5964 case HDA_FIXUP_ACT_BUILD:
5965 /* this is a bit tricky; give more sane names for the main
5966 * (tablet) speaker and the dock speaker, respectively
5967 */
5968 rename_ctl(codec, "Speaker Playback Switch",
5969 "Dock Speaker Playback Switch");
5970 rename_ctl(codec, "Bass Speaker Playback Switch",
5971 "Speaker Playback Switch");
5972 break;
5973 }
5974 }
5975
5976 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5977 const struct hda_fixup *fix, int action)
5978 {
5979 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5980 /* DAC node 0x03 is giving mono output. We therefore want to
5981 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5982 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5983 static const hda_nid_t conn1[] = { 0x0c };
5984 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
5985 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
5986 }
5987 }
5988
5989 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5990 const struct hda_fixup *fix, int action)
5991 {
5992 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5993 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5994 we can't adjust the speaker's volume since this node does not has
5995 Amp-out capability. we change the speaker's route to:
5996 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5997 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5998 speaker's volume now. */
5999
6000 static const hda_nid_t conn1[] = { 0x0c };
6001 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6002 }
6003 }
6004
6005 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6006 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6007 const struct hda_fixup *fix, int action)
6008 {
6009 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6010 static const hda_nid_t conn[] = { 0x02, 0x03 };
6011 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6012 }
6013 }
6014
6015 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6016 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6017 const struct hda_fixup *fix, int action)
6018 {
6019 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6020 static const hda_nid_t conn[] = { 0x02 };
6021 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6022 }
6023 }
6024
6025 /* Hook to update amp GPIO4 for automute */
6026 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6027 struct hda_jack_callback *jack)
6028 {
6029 struct alc_spec *spec = codec->spec;
6030
6031 snd_hda_gen_hp_automute(codec, jack);
6032 /* mute_led_polarity is set to 0, so we pass inverted value here */
6033 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6034 !spec->gen.hp_jack_present);
6035 }
6036
6037 /* Manage GPIOs for HP EliteBook Folio 9480m.
6038 *
6039 * GPIO4 is the headphone amplifier power control
6040 * GPIO3 is the audio output mute indicator LED
6041 */
6042
6043 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6044 const struct hda_fixup *fix,
6045 int action)
6046 {
6047 struct alc_spec *spec = codec->spec;
6048
6049 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6050 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6051 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6052 spec->gpio_mask |= 0x10;
6053 spec->gpio_dir |= 0x10;
6054 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6055 }
6056 }
6057
6058 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6059 const struct hda_fixup *fix,
6060 int action)
6061 {
6062 struct alc_spec *spec = codec->spec;
6063
6064 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6065 spec->gpio_mask |= 0x04;
6066 spec->gpio_dir |= 0x04;
6067 /* set data bit low */
6068 }
6069 }
6070
6071 /* Quirk for Thinkpad X1 7th and 8th Gen
6072 * The following fixed routing needed
6073 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6074 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6075 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6076 */
6077 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6078 const struct hda_fixup *fix, int action)
6079 {
6080 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6081 static const hda_nid_t preferred_pairs[] = {
6082 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6083 };
6084 struct alc_spec *spec = codec->spec;
6085
6086 switch (action) {
6087 case HDA_FIXUP_ACT_PRE_PROBE:
6088 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6089 spec->gen.preferred_dacs = preferred_pairs;
6090 break;
6091 case HDA_FIXUP_ACT_BUILD:
6092 /* The generic parser creates somewhat unintuitive volume ctls
6093 * with the fixed routing above, and the shared DAC2 may be
6094 * confusing for PA.
6095 * Rename those to unique names so that PA doesn't touch them
6096 * and use only Master volume.
6097 */
6098 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6099 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6100 break;
6101 }
6102 }
6103
6104 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6105 const struct hda_fixup *fix,
6106 int action)
6107 {
6108 alc_fixup_dual_codecs(codec, fix, action);
6109 switch (action) {
6110 case HDA_FIXUP_ACT_PRE_PROBE:
6111 /* override card longname to provide a unique UCM profile */
6112 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6113 break;
6114 case HDA_FIXUP_ACT_BUILD:
6115 /* rename Capture controls depending on the codec */
6116 rename_ctl(codec, "Capture Volume",
6117 codec->addr == 0 ?
6118 "Rear-Panel Capture Volume" :
6119 "Front-Panel Capture Volume");
6120 rename_ctl(codec, "Capture Switch",
6121 codec->addr == 0 ?
6122 "Rear-Panel Capture Switch" :
6123 "Front-Panel Capture Switch");
6124 break;
6125 }
6126 }
6127
6128 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6129 const struct hda_fixup *fix, int action)
6130 {
6131 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6132 return;
6133
6134 codec->power_save_node = 1;
6135 }
6136
6137 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6138 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6139 const struct hda_fixup *fix, int action)
6140 {
6141 struct alc_spec *spec = codec->spec;
6142 static const hda_nid_t preferred_pairs[] = {
6143 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6144 0
6145 };
6146
6147 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6148 return;
6149
6150 spec->gen.preferred_dacs = preferred_pairs;
6151 spec->gen.auto_mute_via_amp = 1;
6152 codec->power_save_node = 0;
6153 }
6154
6155 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6156 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6157 const struct hda_fixup *fix, int action)
6158 {
6159 static const hda_nid_t preferred_pairs[] = {
6160 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6161 };
6162 struct alc_spec *spec = codec->spec;
6163
6164 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6165 spec->gen.preferred_dacs = preferred_pairs;
6166 spec->gen.obey_preferred_dacs = 1;
6167 }
6168 }
6169
6170 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6171 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6172 const struct hda_fixup *fix, int action)
6173 {
6174 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6175 return;
6176
6177 snd_hda_override_wcaps(codec, 0x03, 0);
6178 }
6179
6180 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6181 {
6182 switch (codec->core.vendor_id) {
6183 case 0x10ec0274:
6184 case 0x10ec0294:
6185 case 0x10ec0225:
6186 case 0x10ec0295:
6187 case 0x10ec0299:
6188 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6189 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6190 break;
6191 case 0x10ec0235:
6192 case 0x10ec0236:
6193 case 0x10ec0255:
6194 case 0x10ec0256:
6195 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6196 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6197 break;
6198 }
6199 }
6200
6201 static void alc295_fixup_chromebook(struct hda_codec *codec,
6202 const struct hda_fixup *fix, int action)
6203 {
6204 struct alc_spec *spec = codec->spec;
6205
6206 switch (action) {
6207 case HDA_FIXUP_ACT_PRE_PROBE:
6208 spec->ultra_low_power = true;
6209 break;
6210 case HDA_FIXUP_ACT_INIT:
6211 alc_combo_jack_hp_jd_restart(codec);
6212 break;
6213 }
6214 }
6215
6216 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6217 const struct hda_fixup *fix, int action)
6218 {
6219 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6220 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6221 }
6222
6223
6224 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6225 struct hda_jack_callback *cb)
6226 {
6227 /* The Windows driver sets the codec up in a very different way where
6228 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6229 */
6230 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6231 alc_write_coef_idx(codec, 0x10, 0x8a20);
6232 else
6233 alc_write_coef_idx(codec, 0x10, 0x0a20);
6234 }
6235
6236 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6237 const struct hda_fixup *fix, int action)
6238 {
6239 /* Pin 0x21: headphones/headset mic */
6240 if (!is_jack_detectable(codec, 0x21))
6241 return;
6242
6243 switch (action) {
6244 case HDA_FIXUP_ACT_PRE_PROBE:
6245 snd_hda_jack_detect_enable_callback(codec, 0x21,
6246 alc294_gx502_toggle_output);
6247 break;
6248 case HDA_FIXUP_ACT_INIT:
6249 /* Make sure to start in a correct state, i.e. if
6250 * headphones have been plugged in before powering up the system
6251 */
6252 alc294_gx502_toggle_output(codec, NULL);
6253 break;
6254 }
6255 }
6256
6257 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6258 struct hda_jack_callback *cb)
6259 {
6260 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6261 * responsible from changes between speakers and headphones
6262 */
6263 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6264 alc_write_coef_idx(codec, 0x10, 0x8420);
6265 else
6266 alc_write_coef_idx(codec, 0x10, 0x0a20);
6267 }
6268
6269 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6270 const struct hda_fixup *fix, int action)
6271 {
6272 if (!is_jack_detectable(codec, 0x21))
6273 return;
6274
6275 switch (action) {
6276 case HDA_FIXUP_ACT_PRE_PROBE:
6277 snd_hda_jack_detect_enable_callback(codec, 0x21,
6278 alc294_gu502_toggle_output);
6279 break;
6280 case HDA_FIXUP_ACT_INIT:
6281 alc294_gu502_toggle_output(codec, NULL);
6282 break;
6283 }
6284 }
6285
6286 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6287 const struct hda_fixup *fix, int action)
6288 {
6289 if (action != HDA_FIXUP_ACT_INIT)
6290 return;
6291
6292 msleep(100);
6293 alc_write_coef_idx(codec, 0x65, 0x0);
6294 }
6295
6296 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6297 const struct hda_fixup *fix, int action)
6298 {
6299 switch (action) {
6300 case HDA_FIXUP_ACT_INIT:
6301 alc_combo_jack_hp_jd_restart(codec);
6302 break;
6303 }
6304 }
6305
6306 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6307 const struct hda_fixup *fix, int action)
6308 {
6309 struct alc_spec *spec = codec->spec;
6310
6311 switch (action) {
6312 case HDA_FIXUP_ACT_PRE_PROBE:
6313 /* Mic RING SLEEVE swap for combo jack */
6314 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6315 spec->no_internal_mic_pin = true;
6316 break;
6317 case HDA_FIXUP_ACT_INIT:
6318 alc_combo_jack_hp_jd_restart(codec);
6319 break;
6320 }
6321 }
6322
6323 /* for hda_fixup_thinkpad_acpi() */
6324 #include "thinkpad_helper.c"
6325
6326 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6327 const struct hda_fixup *fix, int action)
6328 {
6329 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6330 hda_fixup_thinkpad_acpi(codec, fix, action);
6331 }
6332
6333 /* for alc295_fixup_hp_top_speakers */
6334 #include "hp_x360_helper.c"
6335
6336 /* for alc285_fixup_ideapad_s740_coef() */
6337 #include "ideapad_s740_helper.c"
6338
6339 enum {
6340 ALC269_FIXUP_GPIO2,
6341 ALC269_FIXUP_SONY_VAIO,
6342 ALC275_FIXUP_SONY_VAIO_GPIO2,
6343 ALC269_FIXUP_DELL_M101Z,
6344 ALC269_FIXUP_SKU_IGNORE,
6345 ALC269_FIXUP_ASUS_G73JW,
6346 ALC269_FIXUP_LENOVO_EAPD,
6347 ALC275_FIXUP_SONY_HWEQ,
6348 ALC275_FIXUP_SONY_DISABLE_AAMIX,
6349 ALC271_FIXUP_DMIC,
6350 ALC269_FIXUP_PCM_44K,
6351 ALC269_FIXUP_STEREO_DMIC,
6352 ALC269_FIXUP_HEADSET_MIC,
6353 ALC269_FIXUP_QUANTA_MUTE,
6354 ALC269_FIXUP_LIFEBOOK,
6355 ALC269_FIXUP_LIFEBOOK_EXTMIC,
6356 ALC269_FIXUP_LIFEBOOK_HP_PIN,
6357 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
6358 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
6359 ALC269_FIXUP_AMIC,
6360 ALC269_FIXUP_DMIC,
6361 ALC269VB_FIXUP_AMIC,
6362 ALC269VB_FIXUP_DMIC,
6363 ALC269_FIXUP_HP_MUTE_LED,
6364 ALC269_FIXUP_HP_MUTE_LED_MIC1,
6365 ALC269_FIXUP_HP_MUTE_LED_MIC2,
6366 ALC269_FIXUP_HP_MUTE_LED_MIC3,
6367 ALC269_FIXUP_HP_GPIO_LED,
6368 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6369 ALC269_FIXUP_HP_LINE1_MIC1_LED,
6370 ALC269_FIXUP_INV_DMIC,
6371 ALC269_FIXUP_LENOVO_DOCK,
6372 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
6373 ALC269_FIXUP_NO_SHUTUP,
6374 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
6375 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6376 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6377 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6378 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6379 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6380 ALC269_FIXUP_HEADSET_MODE,
6381 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
6382 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
6383 ALC269_FIXUP_ASUS_X101_FUNC,
6384 ALC269_FIXUP_ASUS_X101_VERB,
6385 ALC269_FIXUP_ASUS_X101,
6386 ALC271_FIXUP_AMIC_MIC2,
6387 ALC271_FIXUP_HP_GATE_MIC_JACK,
6388 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
6389 ALC269_FIXUP_ACER_AC700,
6390 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
6391 ALC269VB_FIXUP_ASUS_ZENBOOK,
6392 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
6393 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
6394 ALC269VB_FIXUP_ORDISSIMO_EVE2,
6395 ALC283_FIXUP_CHROME_BOOK,
6396 ALC283_FIXUP_SENSE_COMBO_JACK,
6397 ALC282_FIXUP_ASUS_TX300,
6398 ALC283_FIXUP_INT_MIC,
6399 ALC290_FIXUP_MONO_SPEAKERS,
6400 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6401 ALC290_FIXUP_SUBWOOFER,
6402 ALC290_FIXUP_SUBWOOFER_HSJACK,
6403 ALC269_FIXUP_THINKPAD_ACPI,
6404 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
6405 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6406 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6407 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6408 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
6409 ALC255_FIXUP_HEADSET_MODE,
6410 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
6411 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
6412 ALC292_FIXUP_TPT440_DOCK,
6413 ALC292_FIXUP_TPT440,
6414 ALC283_FIXUP_HEADSET_MIC,
6415 ALC255_FIXUP_MIC_MUTE_LED,
6416 ALC282_FIXUP_ASPIRE_V5_PINS,
6417 ALC269VB_FIXUP_ASPIRE_E1_COEF,
6418 ALC280_FIXUP_HP_GPIO4,
6419 ALC286_FIXUP_HP_GPIO_LED,
6420 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
6421 ALC280_FIXUP_HP_DOCK_PINS,
6422 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
6423 ALC280_FIXUP_HP_9480M,
6424 ALC245_FIXUP_HP_X360_AMP,
6425 ALC288_FIXUP_DELL_HEADSET_MODE,
6426 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
6427 ALC288_FIXUP_DELL_XPS_13,
6428 ALC288_FIXUP_DISABLE_AAMIX,
6429 ALC292_FIXUP_DELL_E7X_AAMIX,
6430 ALC292_FIXUP_DELL_E7X,
6431 ALC292_FIXUP_DISABLE_AAMIX,
6432 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
6433 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
6434 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6435 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
6436 ALC275_FIXUP_DELL_XPS,
6437 ALC293_FIXUP_LENOVO_SPK_NOISE,
6438 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6439 ALC255_FIXUP_DELL_SPK_NOISE,
6440 ALC225_FIXUP_DISABLE_MIC_VREF,
6441 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6442 ALC295_FIXUP_DISABLE_DAC3,
6443 ALC285_FIXUP_SPEAKER2_TO_DAC1,
6444 ALC280_FIXUP_HP_HEADSET_MIC,
6445 ALC221_FIXUP_HP_FRONT_MIC,
6446 ALC292_FIXUP_TPT460,
6447 ALC298_FIXUP_SPK_VOLUME,
6448 ALC298_FIXUP_LENOVO_SPK_VOLUME,
6449 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
6450 ALC269_FIXUP_ATIV_BOOK_8,
6451 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
6452 ALC256_FIXUP_ASUS_HEADSET_MODE,
6453 ALC256_FIXUP_ASUS_MIC,
6454 ALC256_FIXUP_ASUS_AIO_GPIO2,
6455 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6456 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
6457 ALC233_FIXUP_LENOVO_MULTI_CODECS,
6458 ALC233_FIXUP_ACER_HEADSET_MIC,
6459 ALC294_FIXUP_LENOVO_MIC_LOCATION,
6460 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
6461 ALC225_FIXUP_S3_POP_NOISE,
6462 ALC700_FIXUP_INTEL_REFERENCE,
6463 ALC274_FIXUP_DELL_BIND_DACS,
6464 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
6465 ALC298_FIXUP_TPT470_DOCK_FIX,
6466 ALC298_FIXUP_TPT470_DOCK,
6467 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
6468 ALC255_FIXUP_DELL_HEADSET_MIC,
6469 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
6470 ALC298_FIXUP_HUAWEI_MBX_STEREO,
6471 ALC295_FIXUP_HP_X360,
6472 ALC221_FIXUP_HP_HEADSET_MIC,
6473 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
6474 ALC295_FIXUP_HP_AUTO_MUTE,
6475 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
6476 ALC294_FIXUP_ASUS_MIC,
6477 ALC294_FIXUP_ASUS_HEADSET_MIC,
6478 ALC294_FIXUP_ASUS_SPK,
6479 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
6480 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
6481 ALC255_FIXUP_ACER_HEADSET_MIC,
6482 ALC295_FIXUP_CHROME_BOOK,
6483 ALC225_FIXUP_HEADSET_JACK,
6484 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6485 ALC225_FIXUP_WYSE_AUTO_MUTE,
6486 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
6487 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
6488 ALC256_FIXUP_ASUS_HEADSET_MIC,
6489 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
6490 ALC299_FIXUP_PREDATOR_SPK,
6491 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
6492 ALC289_FIXUP_DELL_SPK2,
6493 ALC289_FIXUP_DUAL_SPK,
6494 ALC294_FIXUP_SPK2_TO_DAC1,
6495 ALC294_FIXUP_ASUS_DUAL_SPK,
6496 ALC285_FIXUP_THINKPAD_X1_GEN7,
6497 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
6498 ALC294_FIXUP_ASUS_HPE,
6499 ALC294_FIXUP_ASUS_COEF_1B,
6500 ALC294_FIXUP_ASUS_GX502_HP,
6501 ALC294_FIXUP_ASUS_GX502_PINS,
6502 ALC294_FIXUP_ASUS_GX502_VERBS,
6503 ALC294_FIXUP_ASUS_GU502_HP,
6504 ALC294_FIXUP_ASUS_GU502_PINS,
6505 ALC294_FIXUP_ASUS_GU502_VERBS,
6506 ALC285_FIXUP_HP_GPIO_LED,
6507 ALC285_FIXUP_HP_MUTE_LED,
6508 ALC236_FIXUP_HP_GPIO_LED,
6509 ALC236_FIXUP_HP_MUTE_LED,
6510 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
6511 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
6512 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
6513 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
6514 ALC269VC_FIXUP_ACER_HEADSET_MIC,
6515 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
6516 ALC289_FIXUP_ASUS_GA401,
6517 ALC289_FIXUP_ASUS_GA502,
6518 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
6519 ALC285_FIXUP_HP_GPIO_AMP_INIT,
6520 ALC269_FIXUP_CZC_B20,
6521 ALC269_FIXUP_CZC_TMI,
6522 ALC269_FIXUP_CZC_L101,
6523 ALC269_FIXUP_LEMOTE_A1802,
6524 ALC269_FIXUP_LEMOTE_A190X,
6525 ALC256_FIXUP_INTEL_NUC8_RUGGED,
6526 ALC233_FIXUP_INTEL_NUC8_DMIC,
6527 ALC233_FIXUP_INTEL_NUC8_BOOST,
6528 ALC256_FIXUP_INTEL_NUC10,
6529 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
6530 ALC274_FIXUP_HP_MIC,
6531 ALC274_FIXUP_HP_HEADSET_MIC,
6532 ALC274_FIXUP_HP_ENVY_GPIO,
6533 ALC256_FIXUP_ASUS_HPE,
6534 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
6535 ALC287_FIXUP_HP_GPIO_LED,
6536 ALC256_FIXUP_HP_HEADSET_MIC,
6537 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
6538 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
6539 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
6540 ALC256_FIXUP_ACER_HEADSET_MIC,
6541 ALC285_FIXUP_IDEAPAD_S740_COEF,
6542 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
6543 ALC295_FIXUP_ASUS_DACS,
6544 ALC295_FIXUP_HP_OMEN,
6545 ALC285_FIXUP_HP_SPECTRE_X360,
6546 };
6547
6548 static const struct hda_fixup alc269_fixups[] = {
6549 [ALC269_FIXUP_GPIO2] = {
6550 .type = HDA_FIXUP_FUNC,
6551 .v.func = alc_fixup_gpio2,
6552 },
6553 [ALC269_FIXUP_SONY_VAIO] = {
6554 .type = HDA_FIXUP_PINCTLS,
6555 .v.pins = (const struct hda_pintbl[]) {
6556 {0x19, PIN_VREFGRD},
6557 {}
6558 }
6559 },
6560 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
6561 .type = HDA_FIXUP_FUNC,
6562 .v.func = alc275_fixup_gpio4_off,
6563 .chained = true,
6564 .chain_id = ALC269_FIXUP_SONY_VAIO
6565 },
6566 [ALC269_FIXUP_DELL_M101Z] = {
6567 .type = HDA_FIXUP_VERBS,
6568 .v.verbs = (const struct hda_verb[]) {
6569 /* Enables internal speaker */
6570 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6571 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6572 {}
6573 }
6574 },
6575 [ALC269_FIXUP_SKU_IGNORE] = {
6576 .type = HDA_FIXUP_FUNC,
6577 .v.func = alc_fixup_sku_ignore,
6578 },
6579 [ALC269_FIXUP_ASUS_G73JW] = {
6580 .type = HDA_FIXUP_PINS,
6581 .v.pins = (const struct hda_pintbl[]) {
6582 { 0x17, 0x99130111 }, /* subwoofer */
6583 { }
6584 }
6585 },
6586 [ALC269_FIXUP_LENOVO_EAPD] = {
6587 .type = HDA_FIXUP_VERBS,
6588 .v.verbs = (const struct hda_verb[]) {
6589 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6590 {}
6591 }
6592 },
6593 [ALC275_FIXUP_SONY_HWEQ] = {
6594 .type = HDA_FIXUP_FUNC,
6595 .v.func = alc269_fixup_hweq,
6596 .chained = true,
6597 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6598 },
6599 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6600 .type = HDA_FIXUP_FUNC,
6601 .v.func = alc_fixup_disable_aamix,
6602 .chained = true,
6603 .chain_id = ALC269_FIXUP_SONY_VAIO
6604 },
6605 [ALC271_FIXUP_DMIC] = {
6606 .type = HDA_FIXUP_FUNC,
6607 .v.func = alc271_fixup_dmic,
6608 },
6609 [ALC269_FIXUP_PCM_44K] = {
6610 .type = HDA_FIXUP_FUNC,
6611 .v.func = alc269_fixup_pcm_44k,
6612 .chained = true,
6613 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6614 },
6615 [ALC269_FIXUP_STEREO_DMIC] = {
6616 .type = HDA_FIXUP_FUNC,
6617 .v.func = alc269_fixup_stereo_dmic,
6618 },
6619 [ALC269_FIXUP_HEADSET_MIC] = {
6620 .type = HDA_FIXUP_FUNC,
6621 .v.func = alc269_fixup_headset_mic,
6622 },
6623 [ALC269_FIXUP_QUANTA_MUTE] = {
6624 .type = HDA_FIXUP_FUNC,
6625 .v.func = alc269_fixup_quanta_mute,
6626 },
6627 [ALC269_FIXUP_LIFEBOOK] = {
6628 .type = HDA_FIXUP_PINS,
6629 .v.pins = (const struct hda_pintbl[]) {
6630 { 0x1a, 0x2101103f }, /* dock line-out */
6631 { 0x1b, 0x23a11040 }, /* dock mic-in */
6632 { }
6633 },
6634 .chained = true,
6635 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6636 },
6637 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6638 .type = HDA_FIXUP_PINS,
6639 .v.pins = (const struct hda_pintbl[]) {
6640 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6641 { }
6642 },
6643 },
6644 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6645 .type = HDA_FIXUP_PINS,
6646 .v.pins = (const struct hda_pintbl[]) {
6647 { 0x21, 0x0221102f }, /* HP out */
6648 { }
6649 },
6650 },
6651 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6652 .type = HDA_FIXUP_FUNC,
6653 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6654 },
6655 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6656 .type = HDA_FIXUP_FUNC,
6657 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6658 },
6659 [ALC269_FIXUP_AMIC] = {
6660 .type = HDA_FIXUP_PINS,
6661 .v.pins = (const struct hda_pintbl[]) {
6662 { 0x14, 0x99130110 }, /* speaker */
6663 { 0x15, 0x0121401f }, /* HP out */
6664 { 0x18, 0x01a19c20 }, /* mic */
6665 { 0x19, 0x99a3092f }, /* int-mic */
6666 { }
6667 },
6668 },
6669 [ALC269_FIXUP_DMIC] = {
6670 .type = HDA_FIXUP_PINS,
6671 .v.pins = (const struct hda_pintbl[]) {
6672 { 0x12, 0x99a3092f }, /* int-mic */
6673 { 0x14, 0x99130110 }, /* speaker */
6674 { 0x15, 0x0121401f }, /* HP out */
6675 { 0x18, 0x01a19c20 }, /* mic */
6676 { }
6677 },
6678 },
6679 [ALC269VB_FIXUP_AMIC] = {
6680 .type = HDA_FIXUP_PINS,
6681 .v.pins = (const struct hda_pintbl[]) {
6682 { 0x14, 0x99130110 }, /* speaker */
6683 { 0x18, 0x01a19c20 }, /* mic */
6684 { 0x19, 0x99a3092f }, /* int-mic */
6685 { 0x21, 0x0121401f }, /* HP out */
6686 { }
6687 },
6688 },
6689 [ALC269VB_FIXUP_DMIC] = {
6690 .type = HDA_FIXUP_PINS,
6691 .v.pins = (const struct hda_pintbl[]) {
6692 { 0x12, 0x99a3092f }, /* int-mic */
6693 { 0x14, 0x99130110 }, /* speaker */
6694 { 0x18, 0x01a19c20 }, /* mic */
6695 { 0x21, 0x0121401f }, /* HP out */
6696 { }
6697 },
6698 },
6699 [ALC269_FIXUP_HP_MUTE_LED] = {
6700 .type = HDA_FIXUP_FUNC,
6701 .v.func = alc269_fixup_hp_mute_led,
6702 },
6703 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6704 .type = HDA_FIXUP_FUNC,
6705 .v.func = alc269_fixup_hp_mute_led_mic1,
6706 },
6707 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
6708 .type = HDA_FIXUP_FUNC,
6709 .v.func = alc269_fixup_hp_mute_led_mic2,
6710 },
6711 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6712 .type = HDA_FIXUP_FUNC,
6713 .v.func = alc269_fixup_hp_mute_led_mic3,
6714 .chained = true,
6715 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
6716 },
6717 [ALC269_FIXUP_HP_GPIO_LED] = {
6718 .type = HDA_FIXUP_FUNC,
6719 .v.func = alc269_fixup_hp_gpio_led,
6720 },
6721 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6722 .type = HDA_FIXUP_FUNC,
6723 .v.func = alc269_fixup_hp_gpio_mic1_led,
6724 },
6725 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6726 .type = HDA_FIXUP_FUNC,
6727 .v.func = alc269_fixup_hp_line1_mic1_led,
6728 },
6729 [ALC269_FIXUP_INV_DMIC] = {
6730 .type = HDA_FIXUP_FUNC,
6731 .v.func = alc_fixup_inv_dmic,
6732 },
6733 [ALC269_FIXUP_NO_SHUTUP] = {
6734 .type = HDA_FIXUP_FUNC,
6735 .v.func = alc_fixup_no_shutup,
6736 },
6737 [ALC269_FIXUP_LENOVO_DOCK] = {
6738 .type = HDA_FIXUP_PINS,
6739 .v.pins = (const struct hda_pintbl[]) {
6740 { 0x19, 0x23a11040 }, /* dock mic */
6741 { 0x1b, 0x2121103f }, /* dock headphone */
6742 { }
6743 },
6744 .chained = true,
6745 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6746 },
6747 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6748 .type = HDA_FIXUP_FUNC,
6749 .v.func = alc269_fixup_limit_int_mic_boost,
6750 .chained = true,
6751 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6752 },
6753 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
6754 .type = HDA_FIXUP_FUNC,
6755 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6756 .chained = true,
6757 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6758 },
6759 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6760 .type = HDA_FIXUP_PINS,
6761 .v.pins = (const struct hda_pintbl[]) {
6762 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6763 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6764 { }
6765 },
6766 .chained = true,
6767 .chain_id = ALC269_FIXUP_HEADSET_MODE
6768 },
6769 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6770 .type = HDA_FIXUP_PINS,
6771 .v.pins = (const struct hda_pintbl[]) {
6772 { 0x16, 0x21014020 }, /* dock line out */
6773 { 0x19, 0x21a19030 }, /* dock mic */
6774 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6775 { }
6776 },
6777 .chained = true,
6778 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6779 },
6780 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6781 .type = HDA_FIXUP_PINS,
6782 .v.pins = (const struct hda_pintbl[]) {
6783 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6784 { }
6785 },
6786 .chained = true,
6787 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6788 },
6789 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6790 .type = HDA_FIXUP_PINS,
6791 .v.pins = (const struct hda_pintbl[]) {
6792 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6793 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6794 { }
6795 },
6796 .chained = true,
6797 .chain_id = ALC269_FIXUP_HEADSET_MODE
6798 },
6799 [ALC269_FIXUP_HEADSET_MODE] = {
6800 .type = HDA_FIXUP_FUNC,
6801 .v.func = alc_fixup_headset_mode,
6802 .chained = true,
6803 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6804 },
6805 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6806 .type = HDA_FIXUP_FUNC,
6807 .v.func = alc_fixup_headset_mode_no_hp_mic,
6808 },
6809 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6810 .type = HDA_FIXUP_PINS,
6811 .v.pins = (const struct hda_pintbl[]) {
6812 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6813 { }
6814 },
6815 .chained = true,
6816 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6817 },
6818 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6819 .type = HDA_FIXUP_PINS,
6820 .v.pins = (const struct hda_pintbl[]) {
6821 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6822 { }
6823 },
6824 .chained = true,
6825 .chain_id = ALC269_FIXUP_HEADSET_MIC
6826 },
6827 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
6828 .type = HDA_FIXUP_PINS,
6829 .v.pins = (const struct hda_pintbl[]) {
6830 {0x12, 0x90a60130},
6831 {0x13, 0x40000000},
6832 {0x14, 0x90170110},
6833 {0x18, 0x411111f0},
6834 {0x19, 0x04a11040},
6835 {0x1a, 0x411111f0},
6836 {0x1b, 0x90170112},
6837 {0x1d, 0x40759a05},
6838 {0x1e, 0x411111f0},
6839 {0x21, 0x04211020},
6840 { }
6841 },
6842 .chained = true,
6843 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6844 },
6845 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6846 .type = HDA_FIXUP_FUNC,
6847 .v.func = alc298_fixup_huawei_mbx_stereo,
6848 .chained = true,
6849 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6850 },
6851 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6852 .type = HDA_FIXUP_FUNC,
6853 .v.func = alc269_fixup_x101_headset_mic,
6854 },
6855 [ALC269_FIXUP_ASUS_X101_VERB] = {
6856 .type = HDA_FIXUP_VERBS,
6857 .v.verbs = (const struct hda_verb[]) {
6858 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6859 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6860 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6861 { }
6862 },
6863 .chained = true,
6864 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6865 },
6866 [ALC269_FIXUP_ASUS_X101] = {
6867 .type = HDA_FIXUP_PINS,
6868 .v.pins = (const struct hda_pintbl[]) {
6869 { 0x18, 0x04a1182c }, /* Headset mic */
6870 { }
6871 },
6872 .chained = true,
6873 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6874 },
6875 [ALC271_FIXUP_AMIC_MIC2] = {
6876 .type = HDA_FIXUP_PINS,
6877 .v.pins = (const struct hda_pintbl[]) {
6878 { 0x14, 0x99130110 }, /* speaker */
6879 { 0x19, 0x01a19c20 }, /* mic */
6880 { 0x1b, 0x99a7012f }, /* int-mic */
6881 { 0x21, 0x0121401f }, /* HP out */
6882 { }
6883 },
6884 },
6885 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
6886 .type = HDA_FIXUP_FUNC,
6887 .v.func = alc271_hp_gate_mic_jack,
6888 .chained = true,
6889 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6890 },
6891 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6892 .type = HDA_FIXUP_FUNC,
6893 .v.func = alc269_fixup_limit_int_mic_boost,
6894 .chained = true,
6895 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6896 },
6897 [ALC269_FIXUP_ACER_AC700] = {
6898 .type = HDA_FIXUP_PINS,
6899 .v.pins = (const struct hda_pintbl[]) {
6900 { 0x12, 0x99a3092f }, /* int-mic */
6901 { 0x14, 0x99130110 }, /* speaker */
6902 { 0x18, 0x03a11c20 }, /* mic */
6903 { 0x1e, 0x0346101e }, /* SPDIF1 */
6904 { 0x21, 0x0321101f }, /* HP out */
6905 { }
6906 },
6907 .chained = true,
6908 .chain_id = ALC271_FIXUP_DMIC,
6909 },
6910 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6911 .type = HDA_FIXUP_FUNC,
6912 .v.func = alc269_fixup_limit_int_mic_boost,
6913 .chained = true,
6914 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6915 },
6916 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6917 .type = HDA_FIXUP_FUNC,
6918 .v.func = alc269_fixup_limit_int_mic_boost,
6919 .chained = true,
6920 .chain_id = ALC269VB_FIXUP_DMIC,
6921 },
6922 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6923 .type = HDA_FIXUP_VERBS,
6924 .v.verbs = (const struct hda_verb[]) {
6925 /* class-D output amp +5dB */
6926 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6927 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6928 {}
6929 },
6930 .chained = true,
6931 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6932 },
6933 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6934 .type = HDA_FIXUP_FUNC,
6935 .v.func = alc269_fixup_limit_int_mic_boost,
6936 .chained = true,
6937 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6938 },
6939 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6940 .type = HDA_FIXUP_PINS,
6941 .v.pins = (const struct hda_pintbl[]) {
6942 { 0x12, 0x99a3092f }, /* int-mic */
6943 { 0x18, 0x03a11d20 }, /* mic */
6944 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6945 { }
6946 },
6947 },
6948 [ALC283_FIXUP_CHROME_BOOK] = {
6949 .type = HDA_FIXUP_FUNC,
6950 .v.func = alc283_fixup_chromebook,
6951 },
6952 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6953 .type = HDA_FIXUP_FUNC,
6954 .v.func = alc283_fixup_sense_combo_jack,
6955 .chained = true,
6956 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6957 },
6958 [ALC282_FIXUP_ASUS_TX300] = {
6959 .type = HDA_FIXUP_FUNC,
6960 .v.func = alc282_fixup_asus_tx300,
6961 },
6962 [ALC283_FIXUP_INT_MIC] = {
6963 .type = HDA_FIXUP_VERBS,
6964 .v.verbs = (const struct hda_verb[]) {
6965 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6966 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6967 { }
6968 },
6969 .chained = true,
6970 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6971 },
6972 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6973 .type = HDA_FIXUP_PINS,
6974 .v.pins = (const struct hda_pintbl[]) {
6975 { 0x17, 0x90170112 }, /* subwoofer */
6976 { }
6977 },
6978 .chained = true,
6979 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6980 },
6981 [ALC290_FIXUP_SUBWOOFER] = {
6982 .type = HDA_FIXUP_PINS,
6983 .v.pins = (const struct hda_pintbl[]) {
6984 { 0x17, 0x90170112 }, /* subwoofer */
6985 { }
6986 },
6987 .chained = true,
6988 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6989 },
6990 [ALC290_FIXUP_MONO_SPEAKERS] = {
6991 .type = HDA_FIXUP_FUNC,
6992 .v.func = alc290_fixup_mono_speakers,
6993 },
6994 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6995 .type = HDA_FIXUP_FUNC,
6996 .v.func = alc290_fixup_mono_speakers,
6997 .chained = true,
6998 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6999 },
7000 [ALC269_FIXUP_THINKPAD_ACPI] = {
7001 .type = HDA_FIXUP_FUNC,
7002 .v.func = alc_fixup_thinkpad_acpi,
7003 .chained = true,
7004 .chain_id = ALC269_FIXUP_SKU_IGNORE,
7005 },
7006 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7007 .type = HDA_FIXUP_FUNC,
7008 .v.func = alc_fixup_inv_dmic,
7009 .chained = true,
7010 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7011 },
7012 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
7013 .type = HDA_FIXUP_PINS,
7014 .v.pins = (const struct hda_pintbl[]) {
7015 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7016 { }
7017 },
7018 .chained = true,
7019 .chain_id = ALC255_FIXUP_HEADSET_MODE
7020 },
7021 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7022 .type = HDA_FIXUP_PINS,
7023 .v.pins = (const struct hda_pintbl[]) {
7024 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7025 { }
7026 },
7027 .chained = true,
7028 .chain_id = ALC255_FIXUP_HEADSET_MODE
7029 },
7030 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7031 .type = HDA_FIXUP_PINS,
7032 .v.pins = (const struct hda_pintbl[]) {
7033 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7034 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7035 { }
7036 },
7037 .chained = true,
7038 .chain_id = ALC255_FIXUP_HEADSET_MODE
7039 },
7040 [ALC255_FIXUP_DELL2_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_NO_HP_MIC
7048 },
7049 [ALC255_FIXUP_HEADSET_MODE] = {
7050 .type = HDA_FIXUP_FUNC,
7051 .v.func = alc_fixup_headset_mode_alc255,
7052 .chained = true,
7053 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7054 },
7055 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7056 .type = HDA_FIXUP_FUNC,
7057 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7058 },
7059 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7060 .type = HDA_FIXUP_PINS,
7061 .v.pins = (const struct hda_pintbl[]) {
7062 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7063 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7064 { }
7065 },
7066 .chained = true,
7067 .chain_id = ALC269_FIXUP_HEADSET_MODE
7068 },
7069 [ALC292_FIXUP_TPT440_DOCK] = {
7070 .type = HDA_FIXUP_FUNC,
7071 .v.func = alc_fixup_tpt440_dock,
7072 .chained = true,
7073 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7074 },
7075 [ALC292_FIXUP_TPT440] = {
7076 .type = HDA_FIXUP_FUNC,
7077 .v.func = alc_fixup_disable_aamix,
7078 .chained = true,
7079 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7080 },
7081 [ALC283_FIXUP_HEADSET_MIC] = {
7082 .type = HDA_FIXUP_PINS,
7083 .v.pins = (const struct hda_pintbl[]) {
7084 { 0x19, 0x04a110f0 },
7085 { },
7086 },
7087 },
7088 [ALC255_FIXUP_MIC_MUTE_LED] = {
7089 .type = HDA_FIXUP_FUNC,
7090 .v.func = alc_fixup_micmute_led,
7091 },
7092 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7093 .type = HDA_FIXUP_PINS,
7094 .v.pins = (const struct hda_pintbl[]) {
7095 { 0x12, 0x90a60130 },
7096 { 0x14, 0x90170110 },
7097 { 0x17, 0x40000008 },
7098 { 0x18, 0x411111f0 },
7099 { 0x19, 0x01a1913c },
7100 { 0x1a, 0x411111f0 },
7101 { 0x1b, 0x411111f0 },
7102 { 0x1d, 0x40f89b2d },
7103 { 0x1e, 0x411111f0 },
7104 { 0x21, 0x0321101f },
7105 { },
7106 },
7107 },
7108 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7109 .type = HDA_FIXUP_FUNC,
7110 .v.func = alc269vb_fixup_aspire_e1_coef,
7111 },
7112 [ALC280_FIXUP_HP_GPIO4] = {
7113 .type = HDA_FIXUP_FUNC,
7114 .v.func = alc280_fixup_hp_gpio4,
7115 },
7116 [ALC286_FIXUP_HP_GPIO_LED] = {
7117 .type = HDA_FIXUP_FUNC,
7118 .v.func = alc286_fixup_hp_gpio_led,
7119 },
7120 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7121 .type = HDA_FIXUP_FUNC,
7122 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7123 },
7124 [ALC280_FIXUP_HP_DOCK_PINS] = {
7125 .type = HDA_FIXUP_PINS,
7126 .v.pins = (const struct hda_pintbl[]) {
7127 { 0x1b, 0x21011020 }, /* line-out */
7128 { 0x1a, 0x01a1903c }, /* headset mic */
7129 { 0x18, 0x2181103f }, /* line-in */
7130 { },
7131 },
7132 .chained = true,
7133 .chain_id = ALC280_FIXUP_HP_GPIO4
7134 },
7135 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7136 .type = HDA_FIXUP_PINS,
7137 .v.pins = (const struct hda_pintbl[]) {
7138 { 0x1b, 0x21011020 }, /* line-out */
7139 { 0x18, 0x2181103f }, /* line-in */
7140 { },
7141 },
7142 .chained = true,
7143 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7144 },
7145 [ALC280_FIXUP_HP_9480M] = {
7146 .type = HDA_FIXUP_FUNC,
7147 .v.func = alc280_fixup_hp_9480m,
7148 },
7149 [ALC245_FIXUP_HP_X360_AMP] = {
7150 .type = HDA_FIXUP_FUNC,
7151 .v.func = alc245_fixup_hp_x360_amp,
7152 },
7153 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7154 .type = HDA_FIXUP_FUNC,
7155 .v.func = alc_fixup_headset_mode_dell_alc288,
7156 .chained = true,
7157 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7158 },
7159 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7160 .type = HDA_FIXUP_PINS,
7161 .v.pins = (const struct hda_pintbl[]) {
7162 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7163 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7164 { }
7165 },
7166 .chained = true,
7167 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7168 },
7169 [ALC288_FIXUP_DISABLE_AAMIX] = {
7170 .type = HDA_FIXUP_FUNC,
7171 .v.func = alc_fixup_disable_aamix,
7172 .chained = true,
7173 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
7174 },
7175 [ALC288_FIXUP_DELL_XPS_13] = {
7176 .type = HDA_FIXUP_FUNC,
7177 .v.func = alc_fixup_dell_xps13,
7178 .chained = true,
7179 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7180 },
7181 [ALC292_FIXUP_DISABLE_AAMIX] = {
7182 .type = HDA_FIXUP_FUNC,
7183 .v.func = alc_fixup_disable_aamix,
7184 .chained = true,
7185 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
7186 },
7187 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7188 .type = HDA_FIXUP_FUNC,
7189 .v.func = alc_fixup_disable_aamix,
7190 .chained = true,
7191 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7192 },
7193 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
7194 .type = HDA_FIXUP_FUNC,
7195 .v.func = alc_fixup_dell_xps13,
7196 .chained = true,
7197 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7198 },
7199 [ALC292_FIXUP_DELL_E7X] = {
7200 .type = HDA_FIXUP_FUNC,
7201 .v.func = alc_fixup_micmute_led,
7202 /* micmute fixup must be applied at last */
7203 .chained_before = true,
7204 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7205 },
7206 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7207 .type = HDA_FIXUP_PINS,
7208 .v.pins = (const struct hda_pintbl[]) {
7209 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7210 { }
7211 },
7212 .chained_before = true,
7213 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7214 },
7215 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7216 .type = HDA_FIXUP_PINS,
7217 .v.pins = (const struct hda_pintbl[]) {
7218 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7219 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7220 { }
7221 },
7222 .chained = true,
7223 .chain_id = ALC269_FIXUP_HEADSET_MODE
7224 },
7225 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7226 .type = HDA_FIXUP_PINS,
7227 .v.pins = (const struct hda_pintbl[]) {
7228 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7229 { }
7230 },
7231 .chained = true,
7232 .chain_id = ALC269_FIXUP_HEADSET_MODE
7233 },
7234 [ALC275_FIXUP_DELL_XPS] = {
7235 .type = HDA_FIXUP_VERBS,
7236 .v.verbs = (const struct hda_verb[]) {
7237 /* Enables internal speaker */
7238 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7239 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7240 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7241 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7242 {}
7243 }
7244 },
7245 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7246 .type = HDA_FIXUP_FUNC,
7247 .v.func = alc_fixup_disable_aamix,
7248 .chained = true,
7249 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7250 },
7251 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7252 .type = HDA_FIXUP_FUNC,
7253 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7254 },
7255 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7256 .type = HDA_FIXUP_FUNC,
7257 .v.func = alc_fixup_inv_dmic,
7258 .chained = true,
7259 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7260 },
7261 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7262 .type = HDA_FIXUP_FUNC,
7263 .v.func = alc269_fixup_limit_int_mic_boost
7264 },
7265 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7266 .type = HDA_FIXUP_FUNC,
7267 .v.func = alc_fixup_disable_aamix,
7268 .chained = true,
7269 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7270 },
7271 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7272 .type = HDA_FIXUP_FUNC,
7273 .v.func = alc_fixup_disable_mic_vref,
7274 .chained = true,
7275 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7276 },
7277 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7278 .type = HDA_FIXUP_VERBS,
7279 .v.verbs = (const struct hda_verb[]) {
7280 /* Disable pass-through path for FRONT 14h */
7281 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7282 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7283 {}
7284 },
7285 .chained = true,
7286 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
7287 },
7288 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7289 .type = HDA_FIXUP_FUNC,
7290 .v.func = alc_fixup_disable_aamix,
7291 .chained = true,
7292 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7293 },
7294 [ALC221_FIXUP_HP_FRONT_MIC] = {
7295 .type = HDA_FIXUP_PINS,
7296 .v.pins = (const struct hda_pintbl[]) {
7297 { 0x19, 0x02a19020 }, /* Front Mic */
7298 { }
7299 },
7300 },
7301 [ALC292_FIXUP_TPT460] = {
7302 .type = HDA_FIXUP_FUNC,
7303 .v.func = alc_fixup_tpt440_dock,
7304 .chained = true,
7305 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7306 },
7307 [ALC298_FIXUP_SPK_VOLUME] = {
7308 .type = HDA_FIXUP_FUNC,
7309 .v.func = alc298_fixup_speaker_volume,
7310 .chained = true,
7311 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7312 },
7313 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7314 .type = HDA_FIXUP_FUNC,
7315 .v.func = alc298_fixup_speaker_volume,
7316 },
7317 [ALC295_FIXUP_DISABLE_DAC3] = {
7318 .type = HDA_FIXUP_FUNC,
7319 .v.func = alc295_fixup_disable_dac3,
7320 },
7321 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7322 .type = HDA_FIXUP_FUNC,
7323 .v.func = alc285_fixup_speaker2_to_dac1,
7324 .chained = true,
7325 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7326 },
7327 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7328 .type = HDA_FIXUP_PINS,
7329 .v.pins = (const struct hda_pintbl[]) {
7330 { 0x1b, 0x90170151 },
7331 { }
7332 },
7333 .chained = true,
7334 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7335 },
7336 [ALC269_FIXUP_ATIV_BOOK_8] = {
7337 .type = HDA_FIXUP_FUNC,
7338 .v.func = alc_fixup_auto_mute_via_amp,
7339 .chained = true,
7340 .chain_id = ALC269_FIXUP_NO_SHUTUP
7341 },
7342 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7343 .type = HDA_FIXUP_PINS,
7344 .v.pins = (const struct hda_pintbl[]) {
7345 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7346 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7347 { }
7348 },
7349 .chained = true,
7350 .chain_id = ALC269_FIXUP_HEADSET_MODE
7351 },
7352 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7353 .type = HDA_FIXUP_FUNC,
7354 .v.func = alc_fixup_headset_mode,
7355 },
7356 [ALC256_FIXUP_ASUS_MIC] = {
7357 .type = HDA_FIXUP_PINS,
7358 .v.pins = (const struct hda_pintbl[]) {
7359 { 0x13, 0x90a60160 }, /* use as internal mic */
7360 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7361 { }
7362 },
7363 .chained = true,
7364 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7365 },
7366 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
7367 .type = HDA_FIXUP_FUNC,
7368 /* Set up GPIO2 for the speaker amp */
7369 .v.func = alc_fixup_gpio4,
7370 },
7371 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7372 .type = HDA_FIXUP_PINS,
7373 .v.pins = (const struct hda_pintbl[]) {
7374 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7375 { }
7376 },
7377 .chained = true,
7378 .chain_id = ALC269_FIXUP_HEADSET_MIC
7379 },
7380 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7381 .type = HDA_FIXUP_VERBS,
7382 .v.verbs = (const struct hda_verb[]) {
7383 /* Enables internal speaker */
7384 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7385 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7386 {}
7387 },
7388 .chained = true,
7389 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7390 },
7391 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7392 .type = HDA_FIXUP_FUNC,
7393 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7394 .chained = true,
7395 .chain_id = ALC269_FIXUP_GPIO2
7396 },
7397 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7398 .type = HDA_FIXUP_VERBS,
7399 .v.verbs = (const struct hda_verb[]) {
7400 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7401 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7402 { }
7403 },
7404 .chained = true,
7405 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7406 },
7407 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7408 .type = HDA_FIXUP_PINS,
7409 .v.pins = (const struct hda_pintbl[]) {
7410 /* Change the mic location from front to right, otherwise there are
7411 two front mics with the same name, pulseaudio can't handle them.
7412 This is just a temporary workaround, after applying this fixup,
7413 there will be one "Front Mic" and one "Mic" in this machine.
7414 */
7415 { 0x1a, 0x04a19040 },
7416 { }
7417 },
7418 },
7419 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7420 .type = HDA_FIXUP_PINS,
7421 .v.pins = (const struct hda_pintbl[]) {
7422 { 0x16, 0x0101102f }, /* Rear Headset HP */
7423 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7424 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7425 { 0x1b, 0x02011020 },
7426 { }
7427 },
7428 .chained = true,
7429 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7430 },
7431 [ALC225_FIXUP_S3_POP_NOISE] = {
7432 .type = HDA_FIXUP_FUNC,
7433 .v.func = alc225_fixup_s3_pop_noise,
7434 .chained = true,
7435 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7436 },
7437 [ALC700_FIXUP_INTEL_REFERENCE] = {
7438 .type = HDA_FIXUP_VERBS,
7439 .v.verbs = (const struct hda_verb[]) {
7440 /* Enables internal speaker */
7441 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7442 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7443 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7444 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7445 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7446 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7447 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7448 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7449 {}
7450 }
7451 },
7452 [ALC274_FIXUP_DELL_BIND_DACS] = {
7453 .type = HDA_FIXUP_FUNC,
7454 .v.func = alc274_fixup_bind_dacs,
7455 .chained = true,
7456 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7457 },
7458 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7459 .type = HDA_FIXUP_PINS,
7460 .v.pins = (const struct hda_pintbl[]) {
7461 { 0x1b, 0x0401102f },
7462 { }
7463 },
7464 .chained = true,
7465 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7466 },
7467 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
7468 .type = HDA_FIXUP_FUNC,
7469 .v.func = alc_fixup_tpt470_dock,
7470 .chained = true,
7471 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7472 },
7473 [ALC298_FIXUP_TPT470_DOCK] = {
7474 .type = HDA_FIXUP_FUNC,
7475 .v.func = alc_fixup_tpt470_dacs,
7476 .chained = true,
7477 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7478 },
7479 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7480 .type = HDA_FIXUP_PINS,
7481 .v.pins = (const struct hda_pintbl[]) {
7482 { 0x14, 0x0201101f },
7483 { }
7484 },
7485 .chained = true,
7486 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7487 },
7488 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7489 .type = HDA_FIXUP_PINS,
7490 .v.pins = (const struct hda_pintbl[]) {
7491 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7492 { }
7493 },
7494 .chained = true,
7495 .chain_id = ALC269_FIXUP_HEADSET_MIC
7496 },
7497 [ALC295_FIXUP_HP_X360] = {
7498 .type = HDA_FIXUP_FUNC,
7499 .v.func = alc295_fixup_hp_top_speakers,
7500 .chained = true,
7501 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
7502 },
7503 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7504 .type = HDA_FIXUP_PINS,
7505 .v.pins = (const struct hda_pintbl[]) {
7506 { 0x19, 0x0181313f},
7507 { }
7508 },
7509 .chained = true,
7510 .chain_id = ALC269_FIXUP_HEADSET_MIC
7511 },
7512 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7513 .type = HDA_FIXUP_FUNC,
7514 .v.func = alc285_fixup_invalidate_dacs,
7515 .chained = true,
7516 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7517 },
7518 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7519 .type = HDA_FIXUP_FUNC,
7520 .v.func = alc_fixup_auto_mute_via_amp,
7521 },
7522 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7523 .type = HDA_FIXUP_PINS,
7524 .v.pins = (const struct hda_pintbl[]) {
7525 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7526 { }
7527 },
7528 .chained = true,
7529 .chain_id = ALC269_FIXUP_HEADSET_MIC
7530 },
7531 [ALC294_FIXUP_ASUS_MIC] = {
7532 .type = HDA_FIXUP_PINS,
7533 .v.pins = (const struct hda_pintbl[]) {
7534 { 0x13, 0x90a60160 }, /* use as internal mic */
7535 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7536 { }
7537 },
7538 .chained = true,
7539 .chain_id = ALC269_FIXUP_HEADSET_MIC
7540 },
7541 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7542 .type = HDA_FIXUP_PINS,
7543 .v.pins = (const struct hda_pintbl[]) {
7544 { 0x19, 0x01a1103c }, /* use as headset mic */
7545 { }
7546 },
7547 .chained = true,
7548 .chain_id = ALC269_FIXUP_HEADSET_MIC
7549 },
7550 [ALC294_FIXUP_ASUS_SPK] = {
7551 .type = HDA_FIXUP_VERBS,
7552 .v.verbs = (const struct hda_verb[]) {
7553 /* Set EAPD high */
7554 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7555 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
7556 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7557 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7558 { }
7559 },
7560 .chained = true,
7561 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7562 },
7563 [ALC295_FIXUP_CHROME_BOOK] = {
7564 .type = HDA_FIXUP_FUNC,
7565 .v.func = alc295_fixup_chromebook,
7566 .chained = true,
7567 .chain_id = ALC225_FIXUP_HEADSET_JACK
7568 },
7569 [ALC225_FIXUP_HEADSET_JACK] = {
7570 .type = HDA_FIXUP_FUNC,
7571 .v.func = alc_fixup_headset_jack,
7572 },
7573 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7574 .type = HDA_FIXUP_PINS,
7575 .v.pins = (const struct hda_pintbl[]) {
7576 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7577 { }
7578 },
7579 .chained = true,
7580 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7581 },
7582 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7583 .type = HDA_FIXUP_VERBS,
7584 .v.verbs = (const struct hda_verb[]) {
7585 /* Disable PCBEEP-IN passthrough */
7586 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7587 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7588 { }
7589 },
7590 .chained = true,
7591 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7592 },
7593 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7594 .type = HDA_FIXUP_PINS,
7595 .v.pins = (const struct hda_pintbl[]) {
7596 { 0x19, 0x03a11130 },
7597 { 0x1a, 0x90a60140 }, /* use as internal mic */
7598 { }
7599 },
7600 .chained = true,
7601 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7602 },
7603 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7604 .type = HDA_FIXUP_PINS,
7605 .v.pins = (const struct hda_pintbl[]) {
7606 { 0x16, 0x01011020 }, /* Rear Line out */
7607 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7608 { }
7609 },
7610 .chained = true,
7611 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7612 },
7613 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7614 .type = HDA_FIXUP_FUNC,
7615 .v.func = alc_fixup_auto_mute_via_amp,
7616 .chained = true,
7617 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7618 },
7619 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7620 .type = HDA_FIXUP_FUNC,
7621 .v.func = alc_fixup_disable_mic_vref,
7622 .chained = true,
7623 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7624 },
7625 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7626 .type = HDA_FIXUP_VERBS,
7627 .v.verbs = (const struct hda_verb[]) {
7628 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7629 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7630 { }
7631 },
7632 .chained = true,
7633 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7634 },
7635 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7636 .type = HDA_FIXUP_PINS,
7637 .v.pins = (const struct hda_pintbl[]) {
7638 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7639 { }
7640 },
7641 .chained = true,
7642 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7643 },
7644 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7645 .type = HDA_FIXUP_PINS,
7646 .v.pins = (const struct hda_pintbl[]) {
7647 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7648 { }
7649 },
7650 .chained = true,
7651 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7652 },
7653 [ALC299_FIXUP_PREDATOR_SPK] = {
7654 .type = HDA_FIXUP_PINS,
7655 .v.pins = (const struct hda_pintbl[]) {
7656 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7657 { }
7658 }
7659 },
7660 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7661 .type = HDA_FIXUP_PINS,
7662 .v.pins = (const struct hda_pintbl[]) {
7663 { 0x19, 0x04a11040 },
7664 { 0x21, 0x04211020 },
7665 { }
7666 },
7667 .chained = true,
7668 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7669 },
7670 [ALC289_FIXUP_DELL_SPK2] = {
7671 .type = HDA_FIXUP_PINS,
7672 .v.pins = (const struct hda_pintbl[]) {
7673 { 0x17, 0x90170130 }, /* bass spk */
7674 { }
7675 },
7676 .chained = true,
7677 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7678 },
7679 [ALC289_FIXUP_DUAL_SPK] = {
7680 .type = HDA_FIXUP_FUNC,
7681 .v.func = alc285_fixup_speaker2_to_dac1,
7682 .chained = true,
7683 .chain_id = ALC289_FIXUP_DELL_SPK2
7684 },
7685 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7686 .type = HDA_FIXUP_FUNC,
7687 .v.func = alc285_fixup_speaker2_to_dac1,
7688 .chained = true,
7689 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7690 },
7691 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
7692 .type = HDA_FIXUP_FUNC,
7693 /* The GPIO must be pulled to initialize the AMP */
7694 .v.func = alc_fixup_gpio4,
7695 .chained = true,
7696 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
7697 },
7698 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7699 .type = HDA_FIXUP_FUNC,
7700 .v.func = alc285_fixup_thinkpad_x1_gen7,
7701 .chained = true,
7702 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7703 },
7704 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7705 .type = HDA_FIXUP_FUNC,
7706 .v.func = alc_fixup_headset_jack,
7707 .chained = true,
7708 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
7709 },
7710 [ALC294_FIXUP_ASUS_HPE] = {
7711 .type = HDA_FIXUP_VERBS,
7712 .v.verbs = (const struct hda_verb[]) {
7713 /* Set EAPD high */
7714 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7715 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7716 { }
7717 },
7718 .chained = true,
7719 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7720 },
7721 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7722 .type = HDA_FIXUP_PINS,
7723 .v.pins = (const struct hda_pintbl[]) {
7724 { 0x19, 0x03a11050 }, /* front HP mic */
7725 { 0x1a, 0x01a11830 }, /* rear external mic */
7726 { 0x21, 0x03211020 }, /* front HP out */
7727 { }
7728 },
7729 .chained = true,
7730 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7731 },
7732 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7733 .type = HDA_FIXUP_VERBS,
7734 .v.verbs = (const struct hda_verb[]) {
7735 /* set 0x15 to HP-OUT ctrl */
7736 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7737 /* unmute the 0x15 amp */
7738 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7739 { }
7740 },
7741 .chained = true,
7742 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7743 },
7744 [ALC294_FIXUP_ASUS_GX502_HP] = {
7745 .type = HDA_FIXUP_FUNC,
7746 .v.func = alc294_fixup_gx502_hp,
7747 },
7748 [ALC294_FIXUP_ASUS_GU502_PINS] = {
7749 .type = HDA_FIXUP_PINS,
7750 .v.pins = (const struct hda_pintbl[]) {
7751 { 0x19, 0x01a11050 }, /* rear HP mic */
7752 { 0x1a, 0x01a11830 }, /* rear external mic */
7753 { 0x21, 0x012110f0 }, /* rear HP out */
7754 { }
7755 },
7756 .chained = true,
7757 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
7758 },
7759 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
7760 .type = HDA_FIXUP_VERBS,
7761 .v.verbs = (const struct hda_verb[]) {
7762 /* set 0x15 to HP-OUT ctrl */
7763 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7764 /* unmute the 0x15 amp */
7765 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7766 /* set 0x1b to HP-OUT */
7767 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7768 { }
7769 },
7770 .chained = true,
7771 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
7772 },
7773 [ALC294_FIXUP_ASUS_GU502_HP] = {
7774 .type = HDA_FIXUP_FUNC,
7775 .v.func = alc294_fixup_gu502_hp,
7776 },
7777 [ALC294_FIXUP_ASUS_COEF_1B] = {
7778 .type = HDA_FIXUP_VERBS,
7779 .v.verbs = (const struct hda_verb[]) {
7780 /* Set bit 10 to correct noisy output after reboot from
7781 * Windows 10 (due to pop noise reduction?)
7782 */
7783 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7784 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7785 { }
7786 },
7787 },
7788 [ALC285_FIXUP_HP_GPIO_LED] = {
7789 .type = HDA_FIXUP_FUNC,
7790 .v.func = alc285_fixup_hp_gpio_led,
7791 },
7792 [ALC285_FIXUP_HP_MUTE_LED] = {
7793 .type = HDA_FIXUP_FUNC,
7794 .v.func = alc285_fixup_hp_mute_led,
7795 },
7796 [ALC236_FIXUP_HP_GPIO_LED] = {
7797 .type = HDA_FIXUP_FUNC,
7798 .v.func = alc236_fixup_hp_gpio_led,
7799 },
7800 [ALC236_FIXUP_HP_MUTE_LED] = {
7801 .type = HDA_FIXUP_FUNC,
7802 .v.func = alc236_fixup_hp_mute_led,
7803 },
7804 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
7805 .type = HDA_FIXUP_FUNC,
7806 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
7807 },
7808 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7809 .type = HDA_FIXUP_VERBS,
7810 .v.verbs = (const struct hda_verb[]) {
7811 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7812 { }
7813 },
7814 },
7815 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7816 .type = HDA_FIXUP_PINS,
7817 .v.pins = (const struct hda_pintbl[]) {
7818 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7819 { }
7820 },
7821 .chained = true,
7822 .chain_id = ALC269_FIXUP_HEADSET_MODE
7823 },
7824 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7825 .type = HDA_FIXUP_PINS,
7826 .v.pins = (const struct hda_pintbl[]) {
7827 { 0x14, 0x90100120 }, /* use as internal speaker */
7828 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7829 { 0x1a, 0x01011020 }, /* use as line out */
7830 { },
7831 },
7832 .chained = true,
7833 .chain_id = ALC269_FIXUP_HEADSET_MIC
7834 },
7835 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7836 .type = HDA_FIXUP_PINS,
7837 .v.pins = (const struct hda_pintbl[]) {
7838 { 0x18, 0x02a11030 }, /* use as headset mic */
7839 { }
7840 },
7841 .chained = true,
7842 .chain_id = ALC269_FIXUP_HEADSET_MIC
7843 },
7844 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7845 .type = HDA_FIXUP_PINS,
7846 .v.pins = (const struct hda_pintbl[]) {
7847 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7848 { }
7849 },
7850 .chained = true,
7851 .chain_id = ALC269_FIXUP_HEADSET_MIC
7852 },
7853 [ALC289_FIXUP_ASUS_GA401] = {
7854 .type = HDA_FIXUP_FUNC,
7855 .v.func = alc289_fixup_asus_ga401,
7856 .chained = true,
7857 .chain_id = ALC289_FIXUP_ASUS_GA502,
7858 },
7859 [ALC289_FIXUP_ASUS_GA502] = {
7860 .type = HDA_FIXUP_PINS,
7861 .v.pins = (const struct hda_pintbl[]) {
7862 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7863 { }
7864 },
7865 },
7866 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7867 .type = HDA_FIXUP_PINS,
7868 .v.pins = (const struct hda_pintbl[]) {
7869 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7870 { }
7871 },
7872 .chained = true,
7873 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7874 },
7875 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7876 .type = HDA_FIXUP_FUNC,
7877 .v.func = alc285_fixup_hp_gpio_amp_init,
7878 .chained = true,
7879 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7880 },
7881 [ALC269_FIXUP_CZC_B20] = {
7882 .type = HDA_FIXUP_PINS,
7883 .v.pins = (const struct hda_pintbl[]) {
7884 { 0x12, 0x411111f0 },
7885 { 0x14, 0x90170110 }, /* speaker */
7886 { 0x15, 0x032f1020 }, /* HP out */
7887 { 0x17, 0x411111f0 },
7888 { 0x18, 0x03ab1040 }, /* mic */
7889 { 0x19, 0xb7a7013f },
7890 { 0x1a, 0x0181305f },
7891 { 0x1b, 0x411111f0 },
7892 { 0x1d, 0x411111f0 },
7893 { 0x1e, 0x411111f0 },
7894 { }
7895 },
7896 .chain_id = ALC269_FIXUP_DMIC,
7897 },
7898 [ALC269_FIXUP_CZC_TMI] = {
7899 .type = HDA_FIXUP_PINS,
7900 .v.pins = (const struct hda_pintbl[]) {
7901 { 0x12, 0x4000c000 },
7902 { 0x14, 0x90170110 }, /* speaker */
7903 { 0x15, 0x0421401f }, /* HP out */
7904 { 0x17, 0x411111f0 },
7905 { 0x18, 0x04a19020 }, /* mic */
7906 { 0x19, 0x411111f0 },
7907 { 0x1a, 0x411111f0 },
7908 { 0x1b, 0x411111f0 },
7909 { 0x1d, 0x40448505 },
7910 { 0x1e, 0x411111f0 },
7911 { 0x20, 0x8000ffff },
7912 { }
7913 },
7914 .chain_id = ALC269_FIXUP_DMIC,
7915 },
7916 [ALC269_FIXUP_CZC_L101] = {
7917 .type = HDA_FIXUP_PINS,
7918 .v.pins = (const struct hda_pintbl[]) {
7919 { 0x12, 0x40000000 },
7920 { 0x14, 0x01014010 }, /* speaker */
7921 { 0x15, 0x411111f0 }, /* HP out */
7922 { 0x16, 0x411111f0 },
7923 { 0x18, 0x01a19020 }, /* mic */
7924 { 0x19, 0x02a19021 },
7925 { 0x1a, 0x0181302f },
7926 { 0x1b, 0x0221401f },
7927 { 0x1c, 0x411111f0 },
7928 { 0x1d, 0x4044c601 },
7929 { 0x1e, 0x411111f0 },
7930 { }
7931 },
7932 .chain_id = ALC269_FIXUP_DMIC,
7933 },
7934 [ALC269_FIXUP_LEMOTE_A1802] = {
7935 .type = HDA_FIXUP_PINS,
7936 .v.pins = (const struct hda_pintbl[]) {
7937 { 0x12, 0x40000000 },
7938 { 0x14, 0x90170110 }, /* speaker */
7939 { 0x17, 0x411111f0 },
7940 { 0x18, 0x03a19040 }, /* mic1 */
7941 { 0x19, 0x90a70130 }, /* mic2 */
7942 { 0x1a, 0x411111f0 },
7943 { 0x1b, 0x411111f0 },
7944 { 0x1d, 0x40489d2d },
7945 { 0x1e, 0x411111f0 },
7946 { 0x20, 0x0003ffff },
7947 { 0x21, 0x03214020 },
7948 { }
7949 },
7950 .chain_id = ALC269_FIXUP_DMIC,
7951 },
7952 [ALC269_FIXUP_LEMOTE_A190X] = {
7953 .type = HDA_FIXUP_PINS,
7954 .v.pins = (const struct hda_pintbl[]) {
7955 { 0x14, 0x99130110 }, /* speaker */
7956 { 0x15, 0x0121401f }, /* HP out */
7957 { 0x18, 0x01a19c20 }, /* rear mic */
7958 { 0x19, 0x99a3092f }, /* front mic */
7959 { 0x1b, 0x0201401f }, /* front lineout */
7960 { }
7961 },
7962 .chain_id = ALC269_FIXUP_DMIC,
7963 },
7964 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7965 .type = HDA_FIXUP_PINS,
7966 .v.pins = (const struct hda_pintbl[]) {
7967 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7968 { }
7969 },
7970 .chained = true,
7971 .chain_id = ALC269_FIXUP_HEADSET_MODE
7972 },
7973 [ALC256_FIXUP_INTEL_NUC10] = {
7974 .type = HDA_FIXUP_PINS,
7975 .v.pins = (const struct hda_pintbl[]) {
7976 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7977 { }
7978 },
7979 .chained = true,
7980 .chain_id = ALC269_FIXUP_HEADSET_MODE
7981 },
7982 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
7983 .type = HDA_FIXUP_VERBS,
7984 .v.verbs = (const struct hda_verb[]) {
7985 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7986 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7987 { }
7988 },
7989 .chained = true,
7990 .chain_id = ALC289_FIXUP_ASUS_GA502
7991 },
7992 [ALC274_FIXUP_HP_MIC] = {
7993 .type = HDA_FIXUP_VERBS,
7994 .v.verbs = (const struct hda_verb[]) {
7995 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7996 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7997 { }
7998 },
7999 },
8000 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8001 .type = HDA_FIXUP_FUNC,
8002 .v.func = alc274_fixup_hp_headset_mic,
8003 .chained = true,
8004 .chain_id = ALC274_FIXUP_HP_MIC
8005 },
8006 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8007 .type = HDA_FIXUP_FUNC,
8008 .v.func = alc274_fixup_hp_envy_gpio,
8009 },
8010 [ALC256_FIXUP_ASUS_HPE] = {
8011 .type = HDA_FIXUP_VERBS,
8012 .v.verbs = (const struct hda_verb[]) {
8013 /* Set EAPD high */
8014 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8015 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8016 { }
8017 },
8018 .chained = true,
8019 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8020 },
8021 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8022 .type = HDA_FIXUP_FUNC,
8023 .v.func = alc_fixup_headset_jack,
8024 .chained = true,
8025 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8026 },
8027 [ALC287_FIXUP_HP_GPIO_LED] = {
8028 .type = HDA_FIXUP_FUNC,
8029 .v.func = alc287_fixup_hp_gpio_led,
8030 },
8031 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8032 .type = HDA_FIXUP_FUNC,
8033 .v.func = alc274_fixup_hp_headset_mic,
8034 },
8035 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8036 .type = HDA_FIXUP_FUNC,
8037 .v.func = alc_fixup_no_int_mic,
8038 .chained = true,
8039 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8040 },
8041 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8042 .type = HDA_FIXUP_PINS,
8043 .v.pins = (const struct hda_pintbl[]) {
8044 { 0x1b, 0x411111f0 },
8045 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8046 { },
8047 },
8048 .chained = true,
8049 .chain_id = ALC269_FIXUP_HEADSET_MODE
8050 },
8051 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8052 .type = HDA_FIXUP_FUNC,
8053 .v.func = alc269_fixup_limit_int_mic_boost,
8054 .chained = true,
8055 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8056 },
8057 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8058 .type = HDA_FIXUP_PINS,
8059 .v.pins = (const struct hda_pintbl[]) {
8060 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8061 { 0x1a, 0x90a1092f }, /* use as internal mic */
8062 { }
8063 },
8064 .chained = true,
8065 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8066 },
8067 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8068 .type = HDA_FIXUP_FUNC,
8069 .v.func = alc285_fixup_ideapad_s740_coef,
8070 .chained = true,
8071 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8072 },
8073 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8074 .type = HDA_FIXUP_FUNC,
8075 .v.func = alc269_fixup_limit_int_mic_boost,
8076 .chained = true,
8077 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8078 },
8079 [ALC295_FIXUP_ASUS_DACS] = {
8080 .type = HDA_FIXUP_FUNC,
8081 .v.func = alc295_fixup_asus_dacs,
8082 },
8083 [ALC295_FIXUP_HP_OMEN] = {
8084 .type = HDA_FIXUP_PINS,
8085 .v.pins = (const struct hda_pintbl[]) {
8086 { 0x12, 0xb7a60130 },
8087 { 0x13, 0x40000000 },
8088 { 0x14, 0x411111f0 },
8089 { 0x16, 0x411111f0 },
8090 { 0x17, 0x90170110 },
8091 { 0x18, 0x411111f0 },
8092 { 0x19, 0x02a11030 },
8093 { 0x1a, 0x411111f0 },
8094 { 0x1b, 0x04a19030 },
8095 { 0x1d, 0x40600001 },
8096 { 0x1e, 0x411111f0 },
8097 { 0x21, 0x03211020 },
8098 {}
8099 },
8100 .chained = true,
8101 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8102 },
8103 [ALC285_FIXUP_HP_SPECTRE_X360] = {
8104 .type = HDA_FIXUP_PINS,
8105 .v.pins = (const struct hda_pintbl[]) {
8106 { 0x14, 0x90170110 }, /* enable top speaker */
8107 {}
8108 },
8109 .chained = true,
8110 .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1,
8111 },
8112 };
8113
8114 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
8115 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
8116 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8117 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
8118 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
8119 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8120 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8121 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
8122 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8123 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8124 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
8125 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8126 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
8127 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
8128 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
8129 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
8130 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
8131 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
8132 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8133 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8134 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8135 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
8136 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
8137 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
8138 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
8139 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
8140 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8141 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8142 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8143 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
8144 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8145 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
8146 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
8147 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8148 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
8149 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
8150 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
8151 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
8152 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8153 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
8154 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
8155 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8156 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8157 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8158 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8159 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8160 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
8161 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
8162 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
8163 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8164 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8165 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
8166 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8167 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
8168 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
8169 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8170 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8171 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8172 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8173 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8174 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8175 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8176 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8177 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
8178 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
8179 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
8180 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
8181 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
8182 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
8183 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
8184 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8185 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8186 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8187 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8188 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
8189 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
8190 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
8191 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8192 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8193 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
8194 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8195 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8196 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8197 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8198 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
8199 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8200 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8201 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
8202 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
8203 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
8204 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8205 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8206 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8207 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8208 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8209 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8210 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8211 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8212 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8213 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8214 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8215 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8216 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8217 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8218 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8219 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8220 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8221 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8222 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
8223 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
8224 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8225 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8226 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8227 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8228 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8229 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8230 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8231 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8232 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
8233 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8234 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8235 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8236 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
8237 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8238 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8239 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8240 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8241 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8242 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8243 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8244 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8245 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8246 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8247 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8248 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8249 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8250 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8251 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8252 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8253 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8254 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8255 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8256 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8257 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8258 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8259 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8260 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8261 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8262 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8263 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
8264 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
8265 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8266 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8267 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8268 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8269 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8270 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
8271 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8272 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
8273 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8274 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
8275 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
8276 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
8277 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
8278 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8279 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
8280 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
8281 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
8282 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8283 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8284 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8285 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8286 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
8287 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8288 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
8289 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8290 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
8291 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
8292 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8293 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8294 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8295 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8296 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
8297 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8298 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
8299 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
8300 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8301 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8302 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8303 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8304 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
8305 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8306 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8307 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
8308 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
8309 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
8310 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
8311 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
8312 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
8313 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
8314 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
8315 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
8316 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
8317 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
8318 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
8319 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
8320 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
8321 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
8322 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
8323 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
8324 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
8325 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
8326 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
8327 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8328 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
8329 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
8330 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
8331 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
8332 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
8333 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
8334 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
8335 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8336 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8337 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8338 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8339 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
8340 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8341 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8342 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8343 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
8344 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8345 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8346 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
8347 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
8348 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
8349 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
8350 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
8351 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
8352 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
8353 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
8354 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8355 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8356 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8357 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
8358 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
8359 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8360 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8361 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8362 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8363 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
8364 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8365 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8366 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8367 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
8368 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
8369 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
8370 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8371 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8372 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8373 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8374 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8375 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8376 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8377 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8378 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8379 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8380 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8381 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8382 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8383 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8384 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8385 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8386 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8387 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8388 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8389 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8390 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8391 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8392 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8393 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8394 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8395 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8396 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8397 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8398 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8399 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8400 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8401 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8402 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8403 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8404 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8405 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8406 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8407 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8408 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8409 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8410 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
8411 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8412 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8413 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8414 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8415 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8416 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8417 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8418 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8419 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8420 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8421 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8422 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8423 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8424 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8425 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8426 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8427 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8428 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8429 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
8430 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8431 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8432 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8433 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8434 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8435 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
8436 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
8437 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
8438 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
8439 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
8440 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
8441 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
8442 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
8443 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
8444 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
8445 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
8446 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
8447 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
8448 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8449 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
8450 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
8451 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
8452 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8453 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8454 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
8455 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
8456 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8457 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8458 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8459 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
8460 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8461 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8462 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8463 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8464 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
8465 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
8466 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8467 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8468 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
8469 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
8470 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8471 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8472 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8473 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8474 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
8475 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8476 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8477 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8478 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
8479 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
8480 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
8481 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
8482 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
8483 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
8484 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8485 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
8486 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
8487 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8488 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
8489 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
8490 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
8491 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
8492 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
8493 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
8494 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
8495 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
8496 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8497 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8498 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8499 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
8500 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8501 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8502 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
8503 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
8504 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8505 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8506 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
8507 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
8508 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8509 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
8510 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
8511 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
8512 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
8513 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
8514 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
8515 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
8516 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
8517
8518 #if 0
8519 /* Below is a quirk table taken from the old code.
8520 * Basically the device should work as is without the fixup table.
8521 * If BIOS doesn't give a proper info, enable the corresponding
8522 * fixup entry.
8523 */
8524 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8525 ALC269_FIXUP_AMIC),
8526 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
8527 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8528 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8529 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8530 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8531 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8532 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8533 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8534 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8535 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8536 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8537 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8538 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8539 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8540 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8541 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8542 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8543 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8544 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8545 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8546 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8547 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8548 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8549 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8550 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8551 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8552 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8553 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8554 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8555 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8556 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8557 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8558 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8559 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8560 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8561 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8562 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8563 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8564 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8565 #endif
8566 {}
8567 };
8568
8569 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8570 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8571 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8572 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8573 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
8574 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
8575 {}
8576 };
8577
8578 static const struct hda_model_fixup alc269_fixup_models[] = {
8579 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8580 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
8581 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8582 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8583 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
8584 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
8585 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8586 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
8587 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
8588 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
8589 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8590 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
8591 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8592 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
8593 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8594 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
8595 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
8596 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
8597 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
8598 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
8599 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
8600 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
8601 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
8602 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
8603 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
8604 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8605 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8606 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8607 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8608 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8609 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8610 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8611 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8612 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8613 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8614 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8615 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8616 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8617 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8618 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8619 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8620 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8621 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8622 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8623 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8624 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8625 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8626 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8627 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8628 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8629 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8630 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8631 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8632 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8633 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8634 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8635 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8636 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8637 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8638 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8639 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8640 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8641 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8642 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8643 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
8644 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
8645 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
8646 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
8647 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8648 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8649 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8650 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8651 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8652 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8653 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8654 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8655 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8656 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8657 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8658 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8659 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8660 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
8661 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8662 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8663 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
8664 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
8665 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
8666 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
8667 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8668 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8669 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8670 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8671 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8672 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8673 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8674 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8675 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8676 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8677 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8678 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8679 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8680 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8681 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8682 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8683 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
8684 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8685 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
8686 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
8687 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
8688 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
8689 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
8690 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
8691 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
8692 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
8693 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
8694 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
8695 {}
8696 };
8697 #define ALC225_STANDARD_PINS \
8698 {0x21, 0x04211020}
8699
8700 #define ALC256_STANDARD_PINS \
8701 {0x12, 0x90a60140}, \
8702 {0x14, 0x90170110}, \
8703 {0x21, 0x02211020}
8704
8705 #define ALC282_STANDARD_PINS \
8706 {0x14, 0x90170110}
8707
8708 #define ALC290_STANDARD_PINS \
8709 {0x12, 0x99a30130}
8710
8711 #define ALC292_STANDARD_PINS \
8712 {0x14, 0x90170110}, \
8713 {0x15, 0x0221401f}
8714
8715 #define ALC295_STANDARD_PINS \
8716 {0x12, 0xb7a60130}, \
8717 {0x14, 0x90170110}, \
8718 {0x21, 0x04211020}
8719
8720 #define ALC298_STANDARD_PINS \
8721 {0x12, 0x90a60130}, \
8722 {0x21, 0x03211020}
8723
8724 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
8725 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8726 {0x14, 0x01014020},
8727 {0x17, 0x90170110},
8728 {0x18, 0x02a11030},
8729 {0x19, 0x0181303F},
8730 {0x21, 0x0221102f}),
8731 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8732 {0x12, 0x90a601c0},
8733 {0x14, 0x90171120},
8734 {0x21, 0x02211030}),
8735 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8736 {0x14, 0x90170110},
8737 {0x1b, 0x90a70130},
8738 {0x21, 0x03211020}),
8739 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8740 {0x1a, 0x90a70130},
8741 {0x1b, 0x90170110},
8742 {0x21, 0x03211020}),
8743 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8744 ALC225_STANDARD_PINS,
8745 {0x12, 0xb7a60130},
8746 {0x14, 0x901701a0}),
8747 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8748 ALC225_STANDARD_PINS,
8749 {0x12, 0xb7a60130},
8750 {0x14, 0x901701b0}),
8751 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8752 ALC225_STANDARD_PINS,
8753 {0x12, 0xb7a60150},
8754 {0x14, 0x901701a0}),
8755 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8756 ALC225_STANDARD_PINS,
8757 {0x12, 0xb7a60150},
8758 {0x14, 0x901701b0}),
8759 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8760 ALC225_STANDARD_PINS,
8761 {0x12, 0xb7a60130},
8762 {0x1b, 0x90170110}),
8763 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8764 {0x1b, 0x01111010},
8765 {0x1e, 0x01451130},
8766 {0x21, 0x02211020}),
8767 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8768 {0x12, 0x90a60140},
8769 {0x14, 0x90170110},
8770 {0x19, 0x02a11030},
8771 {0x21, 0x02211020}),
8772 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8773 {0x14, 0x90170110},
8774 {0x19, 0x02a11030},
8775 {0x1a, 0x02a11040},
8776 {0x1b, 0x01014020},
8777 {0x21, 0x0221101f}),
8778 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8779 {0x14, 0x90170110},
8780 {0x19, 0x02a11030},
8781 {0x1a, 0x02a11040},
8782 {0x1b, 0x01011020},
8783 {0x21, 0x0221101f}),
8784 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8785 {0x14, 0x90170110},
8786 {0x19, 0x02a11020},
8787 {0x1a, 0x02a11030},
8788 {0x21, 0x0221101f}),
8789 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
8790 {0x21, 0x02211010}),
8791 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8792 {0x14, 0x90170110},
8793 {0x19, 0x02a11020},
8794 {0x21, 0x02211030}),
8795 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
8796 {0x14, 0x90170110},
8797 {0x21, 0x02211020}),
8798 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8799 {0x14, 0x90170130},
8800 {0x21, 0x02211040}),
8801 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8802 {0x12, 0x90a60140},
8803 {0x14, 0x90170110},
8804 {0x21, 0x02211020}),
8805 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8806 {0x12, 0x90a60160},
8807 {0x14, 0x90170120},
8808 {0x21, 0x02211030}),
8809 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8810 {0x14, 0x90170110},
8811 {0x1b, 0x02011020},
8812 {0x21, 0x0221101f}),
8813 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8814 {0x14, 0x90170110},
8815 {0x1b, 0x01011020},
8816 {0x21, 0x0221101f}),
8817 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8818 {0x14, 0x90170130},
8819 {0x1b, 0x01014020},
8820 {0x21, 0x0221103f}),
8821 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8822 {0x14, 0x90170130},
8823 {0x1b, 0x01011020},
8824 {0x21, 0x0221103f}),
8825 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8826 {0x14, 0x90170130},
8827 {0x1b, 0x02011020},
8828 {0x21, 0x0221103f}),
8829 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8830 {0x14, 0x90170150},
8831 {0x1b, 0x02011020},
8832 {0x21, 0x0221105f}),
8833 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8834 {0x14, 0x90170110},
8835 {0x1b, 0x01014020},
8836 {0x21, 0x0221101f}),
8837 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8838 {0x12, 0x90a60160},
8839 {0x14, 0x90170120},
8840 {0x17, 0x90170140},
8841 {0x21, 0x0321102f}),
8842 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8843 {0x12, 0x90a60160},
8844 {0x14, 0x90170130},
8845 {0x21, 0x02211040}),
8846 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8847 {0x12, 0x90a60160},
8848 {0x14, 0x90170140},
8849 {0x21, 0x02211050}),
8850 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8851 {0x12, 0x90a60170},
8852 {0x14, 0x90170120},
8853 {0x21, 0x02211030}),
8854 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8855 {0x12, 0x90a60170},
8856 {0x14, 0x90170130},
8857 {0x21, 0x02211040}),
8858 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8859 {0x12, 0x90a60170},
8860 {0x14, 0x90171130},
8861 {0x21, 0x02211040}),
8862 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8863 {0x12, 0x90a60170},
8864 {0x14, 0x90170140},
8865 {0x21, 0x02211050}),
8866 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8867 {0x12, 0x90a60180},
8868 {0x14, 0x90170130},
8869 {0x21, 0x02211040}),
8870 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8871 {0x12, 0x90a60180},
8872 {0x14, 0x90170120},
8873 {0x21, 0x02211030}),
8874 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8875 {0x1b, 0x01011020},
8876 {0x21, 0x02211010}),
8877 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8878 {0x14, 0x90170110},
8879 {0x1b, 0x90a70130},
8880 {0x21, 0x04211020}),
8881 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8882 {0x14, 0x90170110},
8883 {0x1b, 0x90a70130},
8884 {0x21, 0x03211020}),
8885 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8886 {0x12, 0x90a60130},
8887 {0x14, 0x90170110},
8888 {0x21, 0x03211020}),
8889 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8890 {0x12, 0x90a60130},
8891 {0x14, 0x90170110},
8892 {0x21, 0x04211020}),
8893 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
8894 {0x1a, 0x90a70130},
8895 {0x1b, 0x90170110},
8896 {0x21, 0x03211020}),
8897 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8898 {0x14, 0x90170110},
8899 {0x19, 0x02a11020},
8900 {0x21, 0x0221101f}),
8901 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8902 {0x17, 0x90170110},
8903 {0x19, 0x03a11030},
8904 {0x21, 0x03211020}),
8905 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8906 {0x12, 0x90a60130},
8907 {0x14, 0x90170110},
8908 {0x15, 0x0421101f},
8909 {0x1a, 0x04a11020}),
8910 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8911 {0x12, 0x90a60140},
8912 {0x14, 0x90170110},
8913 {0x15, 0x0421101f},
8914 {0x18, 0x02811030},
8915 {0x1a, 0x04a1103f},
8916 {0x1b, 0x02011020}),
8917 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
8918 ALC282_STANDARD_PINS,
8919 {0x12, 0x99a30130},
8920 {0x19, 0x03a11020},
8921 {0x21, 0x0321101f}),
8922 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
8923 ALC282_STANDARD_PINS,
8924 {0x12, 0x99a30130},
8925 {0x19, 0x03a11020},
8926 {0x21, 0x03211040}),
8927 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
8928 ALC282_STANDARD_PINS,
8929 {0x12, 0x99a30130},
8930 {0x19, 0x03a11030},
8931 {0x21, 0x03211020}),
8932 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
8933 ALC282_STANDARD_PINS,
8934 {0x12, 0x99a30130},
8935 {0x19, 0x04a11020},
8936 {0x21, 0x0421101f}),
8937 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
8938 ALC282_STANDARD_PINS,
8939 {0x12, 0x90a60140},
8940 {0x19, 0x04a11030},
8941 {0x21, 0x04211020}),
8942 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
8943 ALC282_STANDARD_PINS,
8944 {0x12, 0x90a609c0},
8945 {0x18, 0x03a11830},
8946 {0x19, 0x04a19831},
8947 {0x1a, 0x0481303f},
8948 {0x1b, 0x04211020},
8949 {0x21, 0x0321101f}),
8950 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
8951 ALC282_STANDARD_PINS,
8952 {0x12, 0x90a60940},
8953 {0x18, 0x03a11830},
8954 {0x19, 0x04a19831},
8955 {0x1a, 0x0481303f},
8956 {0x1b, 0x04211020},
8957 {0x21, 0x0321101f}),
8958 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8959 ALC282_STANDARD_PINS,
8960 {0x12, 0x90a60130},
8961 {0x21, 0x0321101f}),
8962 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8963 {0x12, 0x90a60160},
8964 {0x14, 0x90170120},
8965 {0x21, 0x02211030}),
8966 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8967 ALC282_STANDARD_PINS,
8968 {0x12, 0x90a60130},
8969 {0x19, 0x03a11020},
8970 {0x21, 0x0321101f}),
8971 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
8972 {0x12, 0x90a60130},
8973 {0x14, 0x90170110},
8974 {0x19, 0x04a11040},
8975 {0x21, 0x04211020}),
8976 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
8977 {0x14, 0x90170110},
8978 {0x19, 0x04a11040},
8979 {0x1d, 0x40600001},
8980 {0x21, 0x04211020}),
8981 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
8982 {0x14, 0x90170110},
8983 {0x19, 0x04a11040},
8984 {0x21, 0x04211020}),
8985 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8986 {0x14, 0x90170110},
8987 {0x17, 0x90170111},
8988 {0x19, 0x03a11030},
8989 {0x21, 0x03211020}),
8990 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
8991 {0x12, 0x90a60130},
8992 {0x17, 0x90170110},
8993 {0x21, 0x02211020}),
8994 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
8995 {0x12, 0x90a60120},
8996 {0x14, 0x90170110},
8997 {0x21, 0x0321101f}),
8998 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
8999 ALC290_STANDARD_PINS,
9000 {0x15, 0x04211040},
9001 {0x18, 0x90170112},
9002 {0x1a, 0x04a11020}),
9003 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9004 ALC290_STANDARD_PINS,
9005 {0x15, 0x04211040},
9006 {0x18, 0x90170110},
9007 {0x1a, 0x04a11020}),
9008 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9009 ALC290_STANDARD_PINS,
9010 {0x15, 0x0421101f},
9011 {0x1a, 0x04a11020}),
9012 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9013 ALC290_STANDARD_PINS,
9014 {0x15, 0x04211020},
9015 {0x1a, 0x04a11040}),
9016 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9017 ALC290_STANDARD_PINS,
9018 {0x14, 0x90170110},
9019 {0x15, 0x04211020},
9020 {0x1a, 0x04a11040}),
9021 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9022 ALC290_STANDARD_PINS,
9023 {0x14, 0x90170110},
9024 {0x15, 0x04211020},
9025 {0x1a, 0x04a11020}),
9026 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
9027 ALC290_STANDARD_PINS,
9028 {0x14, 0x90170110},
9029 {0x15, 0x0421101f},
9030 {0x1a, 0x04a11020}),
9031 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9032 ALC292_STANDARD_PINS,
9033 {0x12, 0x90a60140},
9034 {0x16, 0x01014020},
9035 {0x19, 0x01a19030}),
9036 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
9037 ALC292_STANDARD_PINS,
9038 {0x12, 0x90a60140},
9039 {0x16, 0x01014020},
9040 {0x18, 0x02a19031},
9041 {0x19, 0x01a1903e}),
9042 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
9043 ALC292_STANDARD_PINS,
9044 {0x12, 0x90a60140}),
9045 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9046 ALC292_STANDARD_PINS,
9047 {0x13, 0x90a60140},
9048 {0x16, 0x21014020},
9049 {0x19, 0x21a19030}),
9050 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
9051 ALC292_STANDARD_PINS,
9052 {0x13, 0x90a60140}),
9053 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9054 {0x17, 0x90170110},
9055 {0x21, 0x04211020}),
9056 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9057 {0x14, 0x90170110},
9058 {0x1b, 0x90a70130},
9059 {0x21, 0x04211020}),
9060 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9061 {0x12, 0x90a60130},
9062 {0x17, 0x90170110},
9063 {0x21, 0x03211020}),
9064 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9065 {0x12, 0x90a60130},
9066 {0x17, 0x90170110},
9067 {0x21, 0x04211020}),
9068 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9069 {0x12, 0x90a60130},
9070 {0x17, 0x90170110},
9071 {0x21, 0x03211020}),
9072 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9073 {0x12, 0x90a60120},
9074 {0x17, 0x90170110},
9075 {0x21, 0x04211030}),
9076 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9077 {0x12, 0x90a60130},
9078 {0x17, 0x90170110},
9079 {0x21, 0x03211020}),
9080 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9081 {0x12, 0x90a60130},
9082 {0x17, 0x90170110},
9083 {0x21, 0x03211020}),
9084 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9085 {0x14, 0x90170110},
9086 {0x21, 0x04211020}),
9087 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9088 {0x14, 0x90170110},
9089 {0x21, 0x04211030}),
9090 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9091 ALC295_STANDARD_PINS,
9092 {0x17, 0x21014020},
9093 {0x18, 0x21a19030}),
9094 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9095 ALC295_STANDARD_PINS,
9096 {0x17, 0x21014040},
9097 {0x18, 0x21a19050}),
9098 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9099 ALC295_STANDARD_PINS),
9100 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9101 ALC298_STANDARD_PINS,
9102 {0x17, 0x90170110}),
9103 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9104 ALC298_STANDARD_PINS,
9105 {0x17, 0x90170140}),
9106 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9107 ALC298_STANDARD_PINS,
9108 {0x17, 0x90170150}),
9109 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9110 {0x12, 0xb7a60140},
9111 {0x13, 0xb7a60150},
9112 {0x17, 0x90170110},
9113 {0x1a, 0x03011020},
9114 {0x21, 0x03211030}),
9115 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9116 {0x12, 0xb7a60140},
9117 {0x17, 0x90170110},
9118 {0x1a, 0x03a11030},
9119 {0x21, 0x03211020}),
9120 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9121 ALC225_STANDARD_PINS,
9122 {0x12, 0xb7a60130},
9123 {0x17, 0x90170110}),
9124 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9125 {0x14, 0x01014010},
9126 {0x17, 0x90170120},
9127 {0x18, 0x02a11030},
9128 {0x19, 0x02a1103f},
9129 {0x21, 0x0221101f}),
9130 {}
9131 };
9132
9133 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9134 * more machines, don't need to match all valid pins, just need to match
9135 * all the pins defined in the tbl. Just because of this reason, it is possible
9136 * that a single machine matches multiple tbls, so there is one limitation:
9137 * at most one tbl is allowed to define for the same vendor and same codec
9138 */
9139 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9140 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9141 {0x19, 0x40000000},
9142 {0x1b, 0x40000000}),
9143 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9144 {0x19, 0x40000000},
9145 {0x1a, 0x40000000}),
9146 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9147 {0x19, 0x40000000},
9148 {0x1a, 0x40000000}),
9149 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9150 {0x19, 0x40000000},
9151 {0x1a, 0x40000000}),
9152 {}
9153 };
9154
9155 static void alc269_fill_coef(struct hda_codec *codec)
9156 {
9157 struct alc_spec *spec = codec->spec;
9158 int val;
9159
9160 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
9161 return;
9162
9163 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
9164 alc_write_coef_idx(codec, 0xf, 0x960b);
9165 alc_write_coef_idx(codec, 0xe, 0x8817);
9166 }
9167
9168 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
9169 alc_write_coef_idx(codec, 0xf, 0x960b);
9170 alc_write_coef_idx(codec, 0xe, 0x8814);
9171 }
9172
9173 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
9174 /* Power up output pin */
9175 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
9176 }
9177
9178 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
9179 val = alc_read_coef_idx(codec, 0xd);
9180 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
9181 /* Capless ramp up clock control */
9182 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9183 }
9184 val = alc_read_coef_idx(codec, 0x17);
9185 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
9186 /* Class D power on reset */
9187 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9188 }
9189 }
9190
9191 /* HP */
9192 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
9193 }
9194
9195 /*
9196 */
9197 static int patch_alc269(struct hda_codec *codec)
9198 {
9199 struct alc_spec *spec;
9200 int err;
9201
9202 err = alc_alloc_spec(codec, 0x0b);
9203 if (err < 0)
9204 return err;
9205
9206 spec = codec->spec;
9207 spec->gen.shared_mic_vref_pin = 0x18;
9208 codec->power_save_node = 0;
9209
9210 #ifdef CONFIG_PM
9211 codec->patch_ops.suspend = alc269_suspend;
9212 codec->patch_ops.resume = alc269_resume;
9213 #endif
9214 spec->shutup = alc_default_shutup;
9215 spec->init_hook = alc_default_init;
9216
9217 switch (codec->core.vendor_id) {
9218 case 0x10ec0269:
9219 spec->codec_variant = ALC269_TYPE_ALC269VA;
9220 switch (alc_get_coef0(codec) & 0x00f0) {
9221 case 0x0010:
9222 if (codec->bus->pci &&
9223 codec->bus->pci->subsystem_vendor == 0x1025 &&
9224 spec->cdefine.platform_type == 1)
9225 err = alc_codec_rename(codec, "ALC271X");
9226 spec->codec_variant = ALC269_TYPE_ALC269VB;
9227 break;
9228 case 0x0020:
9229 if (codec->bus->pci &&
9230 codec->bus->pci->subsystem_vendor == 0x17aa &&
9231 codec->bus->pci->subsystem_device == 0x21f3)
9232 err = alc_codec_rename(codec, "ALC3202");
9233 spec->codec_variant = ALC269_TYPE_ALC269VC;
9234 break;
9235 case 0x0030:
9236 spec->codec_variant = ALC269_TYPE_ALC269VD;
9237 break;
9238 default:
9239 alc_fix_pll_init(codec, 0x20, 0x04, 15);
9240 }
9241 if (err < 0)
9242 goto error;
9243 spec->shutup = alc269_shutup;
9244 spec->init_hook = alc269_fill_coef;
9245 alc269_fill_coef(codec);
9246 break;
9247
9248 case 0x10ec0280:
9249 case 0x10ec0290:
9250 spec->codec_variant = ALC269_TYPE_ALC280;
9251 break;
9252 case 0x10ec0282:
9253 spec->codec_variant = ALC269_TYPE_ALC282;
9254 spec->shutup = alc282_shutup;
9255 spec->init_hook = alc282_init;
9256 break;
9257 case 0x10ec0233:
9258 case 0x10ec0283:
9259 spec->codec_variant = ALC269_TYPE_ALC283;
9260 spec->shutup = alc283_shutup;
9261 spec->init_hook = alc283_init;
9262 break;
9263 case 0x10ec0284:
9264 case 0x10ec0292:
9265 spec->codec_variant = ALC269_TYPE_ALC284;
9266 break;
9267 case 0x10ec0293:
9268 spec->codec_variant = ALC269_TYPE_ALC293;
9269 break;
9270 case 0x10ec0286:
9271 case 0x10ec0288:
9272 spec->codec_variant = ALC269_TYPE_ALC286;
9273 break;
9274 case 0x10ec0298:
9275 spec->codec_variant = ALC269_TYPE_ALC298;
9276 break;
9277 case 0x10ec0235:
9278 case 0x10ec0255:
9279 spec->codec_variant = ALC269_TYPE_ALC255;
9280 spec->shutup = alc256_shutup;
9281 spec->init_hook = alc256_init;
9282 break;
9283 case 0x10ec0236:
9284 case 0x10ec0256:
9285 spec->codec_variant = ALC269_TYPE_ALC256;
9286 spec->shutup = alc256_shutup;
9287 spec->init_hook = alc256_init;
9288 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
9289 break;
9290 case 0x10ec0257:
9291 spec->codec_variant = ALC269_TYPE_ALC257;
9292 spec->shutup = alc256_shutup;
9293 spec->init_hook = alc256_init;
9294 spec->gen.mixer_nid = 0;
9295 break;
9296 case 0x10ec0215:
9297 case 0x10ec0245:
9298 case 0x10ec0285:
9299 case 0x10ec0287:
9300 case 0x10ec0289:
9301 spec->codec_variant = ALC269_TYPE_ALC215;
9302 spec->shutup = alc225_shutup;
9303 spec->init_hook = alc225_init;
9304 spec->gen.mixer_nid = 0;
9305 break;
9306 case 0x10ec0225:
9307 case 0x10ec0295:
9308 case 0x10ec0299:
9309 spec->codec_variant = ALC269_TYPE_ALC225;
9310 spec->shutup = alc225_shutup;
9311 spec->init_hook = alc225_init;
9312 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
9313 break;
9314 case 0x10ec0234:
9315 case 0x10ec0274:
9316 case 0x10ec0294:
9317 spec->codec_variant = ALC269_TYPE_ALC294;
9318 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
9319 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
9320 spec->init_hook = alc294_init;
9321 break;
9322 case 0x10ec0300:
9323 spec->codec_variant = ALC269_TYPE_ALC300;
9324 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
9325 break;
9326 case 0x10ec0623:
9327 spec->codec_variant = ALC269_TYPE_ALC623;
9328 break;
9329 case 0x10ec0700:
9330 case 0x10ec0701:
9331 case 0x10ec0703:
9332 case 0x10ec0711:
9333 spec->codec_variant = ALC269_TYPE_ALC700;
9334 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
9335 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
9336 spec->init_hook = alc294_init;
9337 break;
9338
9339 }
9340
9341 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
9342 spec->has_alc5505_dsp = 1;
9343 spec->init_hook = alc5505_dsp_init;
9344 }
9345
9346 alc_pre_init(codec);
9347
9348 snd_hda_pick_fixup(codec, alc269_fixup_models,
9349 alc269_fixup_tbl, alc269_fixups);
9350 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
9351 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
9352 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9353 alc269_fixups);
9354 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9355
9356 alc_auto_parse_customize_define(codec);
9357
9358 if (has_cdefine_beep(codec))
9359 spec->gen.beep_nid = 0x01;
9360
9361 /* automatic parse from the BIOS config */
9362 err = alc269_parse_auto_config(codec);
9363 if (err < 0)
9364 goto error;
9365
9366 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9367 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9368 if (err < 0)
9369 goto error;
9370 }
9371
9372 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9373
9374 return 0;
9375
9376 error:
9377 alc_free(codec);
9378 return err;
9379 }
9380
9381 /*
9382 * ALC861
9383 */
9384
9385 static int alc861_parse_auto_config(struct hda_codec *codec)
9386 {
9387 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
9388 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9389 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
9390 }
9391
9392 /* Pin config fixes */
9393 enum {
9394 ALC861_FIXUP_FSC_AMILO_PI1505,
9395 ALC861_FIXUP_AMP_VREF_0F,
9396 ALC861_FIXUP_NO_JACK_DETECT,
9397 ALC861_FIXUP_ASUS_A6RP,
9398 ALC660_FIXUP_ASUS_W7J,
9399 };
9400
9401 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9402 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
9403 const struct hda_fixup *fix, int action)
9404 {
9405 struct alc_spec *spec = codec->spec;
9406 unsigned int val;
9407
9408 if (action != HDA_FIXUP_ACT_INIT)
9409 return;
9410 val = snd_hda_codec_get_pin_target(codec, 0x0f);
9411 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9412 val |= AC_PINCTL_IN_EN;
9413 val |= AC_PINCTL_VREF_50;
9414 snd_hda_set_pin_ctl(codec, 0x0f, val);
9415 spec->gen.keep_vref_in_automute = 1;
9416 }
9417
9418 /* suppress the jack-detection */
9419 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
9420 const struct hda_fixup *fix, int action)
9421 {
9422 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9423 codec->no_jack_detect = 1;
9424 }
9425
9426 static const struct hda_fixup alc861_fixups[] = {
9427 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
9428 .type = HDA_FIXUP_PINS,
9429 .v.pins = (const struct hda_pintbl[]) {
9430 { 0x0b, 0x0221101f }, /* HP */
9431 { 0x0f, 0x90170310 }, /* speaker */
9432 { }
9433 }
9434 },
9435 [ALC861_FIXUP_AMP_VREF_0F] = {
9436 .type = HDA_FIXUP_FUNC,
9437 .v.func = alc861_fixup_asus_amp_vref_0f,
9438 },
9439 [ALC861_FIXUP_NO_JACK_DETECT] = {
9440 .type = HDA_FIXUP_FUNC,
9441 .v.func = alc_fixup_no_jack_detect,
9442 },
9443 [ALC861_FIXUP_ASUS_A6RP] = {
9444 .type = HDA_FIXUP_FUNC,
9445 .v.func = alc861_fixup_asus_amp_vref_0f,
9446 .chained = true,
9447 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
9448 },
9449 [ALC660_FIXUP_ASUS_W7J] = {
9450 .type = HDA_FIXUP_VERBS,
9451 .v.verbs = (const struct hda_verb[]) {
9452 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9453 * for enabling outputs
9454 */
9455 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9456 { }
9457 },
9458 }
9459 };
9460
9461 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
9462 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
9463 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
9464 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9465 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9466 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
9467 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
9468 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
9469 {}
9470 };
9471
9472 /*
9473 */
9474 static int patch_alc861(struct hda_codec *codec)
9475 {
9476 struct alc_spec *spec;
9477 int err;
9478
9479 err = alc_alloc_spec(codec, 0x15);
9480 if (err < 0)
9481 return err;
9482
9483 spec = codec->spec;
9484 if (has_cdefine_beep(codec))
9485 spec->gen.beep_nid = 0x23;
9486
9487 #ifdef CONFIG_PM
9488 spec->power_hook = alc_power_eapd;
9489 #endif
9490
9491 alc_pre_init(codec);
9492
9493 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9494 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9495
9496 /* automatic parse from the BIOS config */
9497 err = alc861_parse_auto_config(codec);
9498 if (err < 0)
9499 goto error;
9500
9501 if (!spec->gen.no_analog) {
9502 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9503 if (err < 0)
9504 goto error;
9505 }
9506
9507 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9508
9509 return 0;
9510
9511 error:
9512 alc_free(codec);
9513 return err;
9514 }
9515
9516 /*
9517 * ALC861-VD support
9518 *
9519 * Based on ALC882
9520 *
9521 * In addition, an independent DAC
9522 */
9523 static int alc861vd_parse_auto_config(struct hda_codec *codec)
9524 {
9525 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
9526 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9527 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
9528 }
9529
9530 enum {
9531 ALC660VD_FIX_ASUS_GPIO1,
9532 ALC861VD_FIX_DALLAS,
9533 };
9534
9535 /* exclude VREF80 */
9536 static void alc861vd_fixup_dallas(struct hda_codec *codec,
9537 const struct hda_fixup *fix, int action)
9538 {
9539 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9540 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9541 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
9542 }
9543 }
9544
9545 /* reset GPIO1 */
9546 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9547 const struct hda_fixup *fix, int action)
9548 {
9549 struct alc_spec *spec = codec->spec;
9550
9551 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9552 spec->gpio_mask |= 0x02;
9553 alc_fixup_gpio(codec, action, 0x01);
9554 }
9555
9556 static const struct hda_fixup alc861vd_fixups[] = {
9557 [ALC660VD_FIX_ASUS_GPIO1] = {
9558 .type = HDA_FIXUP_FUNC,
9559 .v.func = alc660vd_fixup_asus_gpio1,
9560 },
9561 [ALC861VD_FIX_DALLAS] = {
9562 .type = HDA_FIXUP_FUNC,
9563 .v.func = alc861vd_fixup_dallas,
9564 },
9565 };
9566
9567 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
9568 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
9569 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
9570 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
9571 {}
9572 };
9573
9574 /*
9575 */
9576 static int patch_alc861vd(struct hda_codec *codec)
9577 {
9578 struct alc_spec *spec;
9579 int err;
9580
9581 err = alc_alloc_spec(codec, 0x0b);
9582 if (err < 0)
9583 return err;
9584
9585 spec = codec->spec;
9586 if (has_cdefine_beep(codec))
9587 spec->gen.beep_nid = 0x23;
9588
9589 spec->shutup = alc_eapd_shutup;
9590
9591 alc_pre_init(codec);
9592
9593 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9594 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9595
9596 /* automatic parse from the BIOS config */
9597 err = alc861vd_parse_auto_config(codec);
9598 if (err < 0)
9599 goto error;
9600
9601 if (!spec->gen.no_analog) {
9602 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9603 if (err < 0)
9604 goto error;
9605 }
9606
9607 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
9608
9609 return 0;
9610
9611 error:
9612 alc_free(codec);
9613 return err;
9614 }
9615
9616 /*
9617 * ALC662 support
9618 *
9619 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9620 * configuration. Each pin widget can choose any input DACs and a mixer.
9621 * Each ADC is connected from a mixer of all inputs. This makes possible
9622 * 6-channel independent captures.
9623 *
9624 * In addition, an independent DAC for the multi-playback (not used in this
9625 * driver yet).
9626 */
9627
9628 /*
9629 * BIOS auto configuration
9630 */
9631
9632 static int alc662_parse_auto_config(struct hda_codec *codec)
9633 {
9634 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
9635 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9636 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9637 const hda_nid_t *ssids;
9638
9639 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9640 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9641 codec->core.vendor_id == 0x10ec0671)
9642 ssids = alc663_ssids;
9643 else
9644 ssids = alc662_ssids;
9645 return alc_parse_auto_config(codec, alc662_ignore, ssids);
9646 }
9647
9648 static void alc272_fixup_mario(struct hda_codec *codec,
9649 const struct hda_fixup *fix, int action)
9650 {
9651 if (action != HDA_FIXUP_ACT_PRE_PROBE)
9652 return;
9653 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9654 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9655 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9656 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9657 (0 << AC_AMPCAP_MUTE_SHIFT)))
9658 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
9659 }
9660
9661 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9662 { .channels = 2,
9663 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9664 { .channels = 4,
9665 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9666 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9667 { }
9668 };
9669
9670 /* override the 2.1 chmap */
9671 static void alc_fixup_bass_chmap(struct hda_codec *codec,
9672 const struct hda_fixup *fix, int action)
9673 {
9674 if (action == HDA_FIXUP_ACT_BUILD) {
9675 struct alc_spec *spec = codec->spec;
9676 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
9677 }
9678 }
9679
9680 /* avoid D3 for keeping GPIO up */
9681 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9682 hda_nid_t nid,
9683 unsigned int power_state)
9684 {
9685 struct alc_spec *spec = codec->spec;
9686 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
9687 return AC_PWRST_D0;
9688 return power_state;
9689 }
9690
9691 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9692 const struct hda_fixup *fix, int action)
9693 {
9694 struct alc_spec *spec = codec->spec;
9695
9696 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
9697 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9698 spec->mute_led_polarity = 1;
9699 codec->power_filter = gpio_led_power_filter;
9700 }
9701 }
9702
9703 static void alc662_usi_automute_hook(struct hda_codec *codec,
9704 struct hda_jack_callback *jack)
9705 {
9706 struct alc_spec *spec = codec->spec;
9707 int vref;
9708 msleep(200);
9709 snd_hda_gen_hp_automute(codec, jack);
9710
9711 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9712 msleep(100);
9713 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9714 vref);
9715 }
9716
9717 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9718 const struct hda_fixup *fix, int action)
9719 {
9720 struct alc_spec *spec = codec->spec;
9721 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9722 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9723 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9724 }
9725 }
9726
9727 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9728 struct hda_jack_callback *cb)
9729 {
9730 /* surround speakers at 0x1b already get muted automatically when
9731 * headphones are plugged in, but we have to mute/unmute the remaining
9732 * channels manually:
9733 * 0x15 - front left/front right
9734 * 0x18 - front center/ LFE
9735 */
9736 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9737 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9738 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9739 } else {
9740 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9741 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9742 }
9743 }
9744
9745 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9746 const struct hda_fixup *fix, int action)
9747 {
9748 /* Pin 0x1b: shared headphones jack and surround speakers */
9749 if (!is_jack_detectable(codec, 0x1b))
9750 return;
9751
9752 switch (action) {
9753 case HDA_FIXUP_ACT_PRE_PROBE:
9754 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9755 alc662_aspire_ethos_mute_speakers);
9756 /* subwoofer needs an extra GPIO setting to become audible */
9757 alc_setup_gpio(codec, 0x02);
9758 break;
9759 case HDA_FIXUP_ACT_INIT:
9760 /* Make sure to start in a correct state, i.e. if
9761 * headphones have been plugged in before powering up the system
9762 */
9763 alc662_aspire_ethos_mute_speakers(codec, NULL);
9764 break;
9765 }
9766 }
9767
9768 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9769 const struct hda_fixup *fix, int action)
9770 {
9771 struct alc_spec *spec = codec->spec;
9772
9773 static const struct hda_pintbl pincfgs[] = {
9774 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9775 { 0x1b, 0x0181304f },
9776 { }
9777 };
9778
9779 switch (action) {
9780 case HDA_FIXUP_ACT_PRE_PROBE:
9781 spec->gen.mixer_nid = 0;
9782 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9783 snd_hda_apply_pincfgs(codec, pincfgs);
9784 break;
9785 case HDA_FIXUP_ACT_INIT:
9786 alc_write_coef_idx(codec, 0x19, 0xa054);
9787 break;
9788 }
9789 }
9790
9791 static const struct coef_fw alc668_coefs[] = {
9792 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9793 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9794 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9795 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9796 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9797 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9798 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9799 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9800 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9801 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9802 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9803 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9804 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9805 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9806 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9807 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9808 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9809 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9810 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9811 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9812 {}
9813 };
9814
9815 static void alc668_restore_default_value(struct hda_codec *codec)
9816 {
9817 alc_process_coef_fw(codec, alc668_coefs);
9818 }
9819
9820 enum {
9821 ALC662_FIXUP_ASPIRE,
9822 ALC662_FIXUP_LED_GPIO1,
9823 ALC662_FIXUP_IDEAPAD,
9824 ALC272_FIXUP_MARIO,
9825 ALC662_FIXUP_CZC_ET26,
9826 ALC662_FIXUP_CZC_P10T,
9827 ALC662_FIXUP_SKU_IGNORE,
9828 ALC662_FIXUP_HP_RP5800,
9829 ALC662_FIXUP_ASUS_MODE1,
9830 ALC662_FIXUP_ASUS_MODE2,
9831 ALC662_FIXUP_ASUS_MODE3,
9832 ALC662_FIXUP_ASUS_MODE4,
9833 ALC662_FIXUP_ASUS_MODE5,
9834 ALC662_FIXUP_ASUS_MODE6,
9835 ALC662_FIXUP_ASUS_MODE7,
9836 ALC662_FIXUP_ASUS_MODE8,
9837 ALC662_FIXUP_NO_JACK_DETECT,
9838 ALC662_FIXUP_ZOTAC_Z68,
9839 ALC662_FIXUP_INV_DMIC,
9840 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
9841 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
9842 ALC662_FIXUP_HEADSET_MODE,
9843 ALC668_FIXUP_HEADSET_MODE,
9844 ALC662_FIXUP_BASS_MODE4_CHMAP,
9845 ALC662_FIXUP_BASS_16,
9846 ALC662_FIXUP_BASS_1A,
9847 ALC662_FIXUP_BASS_CHMAP,
9848 ALC668_FIXUP_AUTO_MUTE,
9849 ALC668_FIXUP_DELL_DISABLE_AAMIX,
9850 ALC668_FIXUP_DELL_XPS13,
9851 ALC662_FIXUP_ASUS_Nx50,
9852 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
9853 ALC668_FIXUP_ASUS_Nx51,
9854 ALC668_FIXUP_MIC_COEF,
9855 ALC668_FIXUP_ASUS_G751,
9856 ALC891_FIXUP_HEADSET_MODE,
9857 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
9858 ALC662_FIXUP_ACER_VERITON,
9859 ALC892_FIXUP_ASROCK_MOBO,
9860 ALC662_FIXUP_USI_FUNC,
9861 ALC662_FIXUP_USI_HEADSET_MODE,
9862 ALC662_FIXUP_LENOVO_MULTI_CODECS,
9863 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
9864 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
9865 ALC671_FIXUP_HP_HEADSET_MIC2,
9866 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
9867 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
9868 };
9869
9870 static const struct hda_fixup alc662_fixups[] = {
9871 [ALC662_FIXUP_ASPIRE] = {
9872 .type = HDA_FIXUP_PINS,
9873 .v.pins = (const struct hda_pintbl[]) {
9874 { 0x15, 0x99130112 }, /* subwoofer */
9875 { }
9876 }
9877 },
9878 [ALC662_FIXUP_LED_GPIO1] = {
9879 .type = HDA_FIXUP_FUNC,
9880 .v.func = alc662_fixup_led_gpio1,
9881 },
9882 [ALC662_FIXUP_IDEAPAD] = {
9883 .type = HDA_FIXUP_PINS,
9884 .v.pins = (const struct hda_pintbl[]) {
9885 { 0x17, 0x99130112 }, /* subwoofer */
9886 { }
9887 },
9888 .chained = true,
9889 .chain_id = ALC662_FIXUP_LED_GPIO1,
9890 },
9891 [ALC272_FIXUP_MARIO] = {
9892 .type = HDA_FIXUP_FUNC,
9893 .v.func = alc272_fixup_mario,
9894 },
9895 [ALC662_FIXUP_CZC_ET26] = {
9896 .type = HDA_FIXUP_PINS,
9897 .v.pins = (const struct hda_pintbl[]) {
9898 {0x12, 0x403cc000},
9899 {0x14, 0x90170110}, /* speaker */
9900 {0x15, 0x411111f0},
9901 {0x16, 0x411111f0},
9902 {0x18, 0x01a19030}, /* mic */
9903 {0x19, 0x90a7013f}, /* int-mic */
9904 {0x1a, 0x01014020},
9905 {0x1b, 0x0121401f},
9906 {0x1c, 0x411111f0},
9907 {0x1d, 0x411111f0},
9908 {0x1e, 0x40478e35},
9909 {}
9910 },
9911 .chained = true,
9912 .chain_id = ALC662_FIXUP_SKU_IGNORE
9913 },
9914 [ALC662_FIXUP_CZC_P10T] = {
9915 .type = HDA_FIXUP_VERBS,
9916 .v.verbs = (const struct hda_verb[]) {
9917 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9918 {}
9919 }
9920 },
9921 [ALC662_FIXUP_SKU_IGNORE] = {
9922 .type = HDA_FIXUP_FUNC,
9923 .v.func = alc_fixup_sku_ignore,
9924 },
9925 [ALC662_FIXUP_HP_RP5800] = {
9926 .type = HDA_FIXUP_PINS,
9927 .v.pins = (const struct hda_pintbl[]) {
9928 { 0x14, 0x0221201f }, /* HP out */
9929 { }
9930 },
9931 .chained = true,
9932 .chain_id = ALC662_FIXUP_SKU_IGNORE
9933 },
9934 [ALC662_FIXUP_ASUS_MODE1] = {
9935 .type = HDA_FIXUP_PINS,
9936 .v.pins = (const struct hda_pintbl[]) {
9937 { 0x14, 0x99130110 }, /* speaker */
9938 { 0x18, 0x01a19c20 }, /* mic */
9939 { 0x19, 0x99a3092f }, /* int-mic */
9940 { 0x21, 0x0121401f }, /* HP out */
9941 { }
9942 },
9943 .chained = true,
9944 .chain_id = ALC662_FIXUP_SKU_IGNORE
9945 },
9946 [ALC662_FIXUP_ASUS_MODE2] = {
9947 .type = HDA_FIXUP_PINS,
9948 .v.pins = (const struct hda_pintbl[]) {
9949 { 0x14, 0x99130110 }, /* speaker */
9950 { 0x18, 0x01a19820 }, /* mic */
9951 { 0x19, 0x99a3092f }, /* int-mic */
9952 { 0x1b, 0x0121401f }, /* HP out */
9953 { }
9954 },
9955 .chained = true,
9956 .chain_id = ALC662_FIXUP_SKU_IGNORE
9957 },
9958 [ALC662_FIXUP_ASUS_MODE3] = {
9959 .type = HDA_FIXUP_PINS,
9960 .v.pins = (const struct hda_pintbl[]) {
9961 { 0x14, 0x99130110 }, /* speaker */
9962 { 0x15, 0x0121441f }, /* HP */
9963 { 0x18, 0x01a19840 }, /* mic */
9964 { 0x19, 0x99a3094f }, /* int-mic */
9965 { 0x21, 0x01211420 }, /* HP2 */
9966 { }
9967 },
9968 .chained = true,
9969 .chain_id = ALC662_FIXUP_SKU_IGNORE
9970 },
9971 [ALC662_FIXUP_ASUS_MODE4] = {
9972 .type = HDA_FIXUP_PINS,
9973 .v.pins = (const struct hda_pintbl[]) {
9974 { 0x14, 0x99130110 }, /* speaker */
9975 { 0x16, 0x99130111 }, /* speaker */
9976 { 0x18, 0x01a19840 }, /* mic */
9977 { 0x19, 0x99a3094f }, /* int-mic */
9978 { 0x21, 0x0121441f }, /* HP */
9979 { }
9980 },
9981 .chained = true,
9982 .chain_id = ALC662_FIXUP_SKU_IGNORE
9983 },
9984 [ALC662_FIXUP_ASUS_MODE5] = {
9985 .type = HDA_FIXUP_PINS,
9986 .v.pins = (const struct hda_pintbl[]) {
9987 { 0x14, 0x99130110 }, /* speaker */
9988 { 0x15, 0x0121441f }, /* HP */
9989 { 0x16, 0x99130111 }, /* speaker */
9990 { 0x18, 0x01a19840 }, /* mic */
9991 { 0x19, 0x99a3094f }, /* int-mic */
9992 { }
9993 },
9994 .chained = true,
9995 .chain_id = ALC662_FIXUP_SKU_IGNORE
9996 },
9997 [ALC662_FIXUP_ASUS_MODE6] = {
9998 .type = HDA_FIXUP_PINS,
9999 .v.pins = (const struct hda_pintbl[]) {
10000 { 0x14, 0x99130110 }, /* speaker */
10001 { 0x15, 0x01211420 }, /* HP2 */
10002 { 0x18, 0x01a19840 }, /* mic */
10003 { 0x19, 0x99a3094f }, /* int-mic */
10004 { 0x1b, 0x0121441f }, /* HP */
10005 { }
10006 },
10007 .chained = true,
10008 .chain_id = ALC662_FIXUP_SKU_IGNORE
10009 },
10010 [ALC662_FIXUP_ASUS_MODE7] = {
10011 .type = HDA_FIXUP_PINS,
10012 .v.pins = (const struct hda_pintbl[]) {
10013 { 0x14, 0x99130110 }, /* speaker */
10014 { 0x17, 0x99130111 }, /* speaker */
10015 { 0x18, 0x01a19840 }, /* mic */
10016 { 0x19, 0x99a3094f }, /* int-mic */
10017 { 0x1b, 0x01214020 }, /* HP */
10018 { 0x21, 0x0121401f }, /* HP */
10019 { }
10020 },
10021 .chained = true,
10022 .chain_id = ALC662_FIXUP_SKU_IGNORE
10023 },
10024 [ALC662_FIXUP_ASUS_MODE8] = {
10025 .type = HDA_FIXUP_PINS,
10026 .v.pins = (const struct hda_pintbl[]) {
10027 { 0x14, 0x99130110 }, /* speaker */
10028 { 0x12, 0x99a30970 }, /* int-mic */
10029 { 0x15, 0x01214020 }, /* HP */
10030 { 0x17, 0x99130111 }, /* speaker */
10031 { 0x18, 0x01a19840 }, /* mic */
10032 { 0x21, 0x0121401f }, /* HP */
10033 { }
10034 },
10035 .chained = true,
10036 .chain_id = ALC662_FIXUP_SKU_IGNORE
10037 },
10038 [ALC662_FIXUP_NO_JACK_DETECT] = {
10039 .type = HDA_FIXUP_FUNC,
10040 .v.func = alc_fixup_no_jack_detect,
10041 },
10042 [ALC662_FIXUP_ZOTAC_Z68] = {
10043 .type = HDA_FIXUP_PINS,
10044 .v.pins = (const struct hda_pintbl[]) {
10045 { 0x1b, 0x02214020 }, /* Front HP */
10046 { }
10047 }
10048 },
10049 [ALC662_FIXUP_INV_DMIC] = {
10050 .type = HDA_FIXUP_FUNC,
10051 .v.func = alc_fixup_inv_dmic,
10052 },
10053 [ALC668_FIXUP_DELL_XPS13] = {
10054 .type = HDA_FIXUP_FUNC,
10055 .v.func = alc_fixup_dell_xps13,
10056 .chained = true,
10057 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10058 },
10059 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10060 .type = HDA_FIXUP_FUNC,
10061 .v.func = alc_fixup_disable_aamix,
10062 .chained = true,
10063 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10064 },
10065 [ALC668_FIXUP_AUTO_MUTE] = {
10066 .type = HDA_FIXUP_FUNC,
10067 .v.func = alc_fixup_auto_mute_via_amp,
10068 .chained = true,
10069 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10070 },
10071 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10072 .type = HDA_FIXUP_PINS,
10073 .v.pins = (const struct hda_pintbl[]) {
10074 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10075 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10076 { }
10077 },
10078 .chained = true,
10079 .chain_id = ALC662_FIXUP_HEADSET_MODE
10080 },
10081 [ALC662_FIXUP_HEADSET_MODE] = {
10082 .type = HDA_FIXUP_FUNC,
10083 .v.func = alc_fixup_headset_mode_alc662,
10084 },
10085 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10086 .type = HDA_FIXUP_PINS,
10087 .v.pins = (const struct hda_pintbl[]) {
10088 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10089 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10090 { }
10091 },
10092 .chained = true,
10093 .chain_id = ALC668_FIXUP_HEADSET_MODE
10094 },
10095 [ALC668_FIXUP_HEADSET_MODE] = {
10096 .type = HDA_FIXUP_FUNC,
10097 .v.func = alc_fixup_headset_mode_alc668,
10098 },
10099 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
10100 .type = HDA_FIXUP_FUNC,
10101 .v.func = alc_fixup_bass_chmap,
10102 .chained = true,
10103 .chain_id = ALC662_FIXUP_ASUS_MODE4
10104 },
10105 [ALC662_FIXUP_BASS_16] = {
10106 .type = HDA_FIXUP_PINS,
10107 .v.pins = (const struct hda_pintbl[]) {
10108 {0x16, 0x80106111}, /* bass speaker */
10109 {}
10110 },
10111 .chained = true,
10112 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10113 },
10114 [ALC662_FIXUP_BASS_1A] = {
10115 .type = HDA_FIXUP_PINS,
10116 .v.pins = (const struct hda_pintbl[]) {
10117 {0x1a, 0x80106111}, /* bass speaker */
10118 {}
10119 },
10120 .chained = true,
10121 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10122 },
10123 [ALC662_FIXUP_BASS_CHMAP] = {
10124 .type = HDA_FIXUP_FUNC,
10125 .v.func = alc_fixup_bass_chmap,
10126 },
10127 [ALC662_FIXUP_ASUS_Nx50] = {
10128 .type = HDA_FIXUP_FUNC,
10129 .v.func = alc_fixup_auto_mute_via_amp,
10130 .chained = true,
10131 .chain_id = ALC662_FIXUP_BASS_1A
10132 },
10133 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10134 .type = HDA_FIXUP_FUNC,
10135 .v.func = alc_fixup_headset_mode_alc668,
10136 .chain_id = ALC662_FIXUP_BASS_CHMAP
10137 },
10138 [ALC668_FIXUP_ASUS_Nx51] = {
10139 .type = HDA_FIXUP_PINS,
10140 .v.pins = (const struct hda_pintbl[]) {
10141 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10142 { 0x1a, 0x90170151 }, /* bass speaker */
10143 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10144 {}
10145 },
10146 .chained = true,
10147 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
10148 },
10149 [ALC668_FIXUP_MIC_COEF] = {
10150 .type = HDA_FIXUP_VERBS,
10151 .v.verbs = (const struct hda_verb[]) {
10152 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10153 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10154 {}
10155 },
10156 },
10157 [ALC668_FIXUP_ASUS_G751] = {
10158 .type = HDA_FIXUP_PINS,
10159 .v.pins = (const struct hda_pintbl[]) {
10160 { 0x16, 0x0421101f }, /* HP */
10161 {}
10162 },
10163 .chained = true,
10164 .chain_id = ALC668_FIXUP_MIC_COEF
10165 },
10166 [ALC891_FIXUP_HEADSET_MODE] = {
10167 .type = HDA_FIXUP_FUNC,
10168 .v.func = alc_fixup_headset_mode,
10169 },
10170 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10171 .type = HDA_FIXUP_PINS,
10172 .v.pins = (const struct hda_pintbl[]) {
10173 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10174 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10175 { }
10176 },
10177 .chained = true,
10178 .chain_id = ALC891_FIXUP_HEADSET_MODE
10179 },
10180 [ALC662_FIXUP_ACER_VERITON] = {
10181 .type = HDA_FIXUP_PINS,
10182 .v.pins = (const struct hda_pintbl[]) {
10183 { 0x15, 0x50170120 }, /* no internal speaker */
10184 { }
10185 }
10186 },
10187 [ALC892_FIXUP_ASROCK_MOBO] = {
10188 .type = HDA_FIXUP_PINS,
10189 .v.pins = (const struct hda_pintbl[]) {
10190 { 0x15, 0x40f000f0 }, /* disabled */
10191 { 0x16, 0x40f000f0 }, /* disabled */
10192 { }
10193 }
10194 },
10195 [ALC662_FIXUP_USI_FUNC] = {
10196 .type = HDA_FIXUP_FUNC,
10197 .v.func = alc662_fixup_usi_headset_mic,
10198 },
10199 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10200 .type = HDA_FIXUP_PINS,
10201 .v.pins = (const struct hda_pintbl[]) {
10202 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10203 { 0x18, 0x01a1903d },
10204 { }
10205 },
10206 .chained = true,
10207 .chain_id = ALC662_FIXUP_USI_FUNC
10208 },
10209 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10210 .type = HDA_FIXUP_FUNC,
10211 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10212 },
10213 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10214 .type = HDA_FIXUP_FUNC,
10215 .v.func = alc662_fixup_aspire_ethos_hp,
10216 },
10217 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10218 .type = HDA_FIXUP_PINS,
10219 .v.pins = (const struct hda_pintbl[]) {
10220 { 0x15, 0x92130110 }, /* front speakers */
10221 { 0x18, 0x99130111 }, /* center/subwoofer */
10222 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10223 { }
10224 },
10225 .chained = true,
10226 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
10227 },
10228 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10229 .type = HDA_FIXUP_FUNC,
10230 .v.func = alc671_fixup_hp_headset_mic2,
10231 },
10232 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10233 .type = HDA_FIXUP_PINS,
10234 .v.pins = (const struct hda_pintbl[]) {
10235 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10236 { }
10237 },
10238 .chained = true,
10239 .chain_id = ALC662_FIXUP_USI_FUNC
10240 },
10241 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10242 .type = HDA_FIXUP_PINS,
10243 .v.pins = (const struct hda_pintbl[]) {
10244 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10245 { 0x1b, 0x0221144f },
10246 { }
10247 },
10248 .chained = true,
10249 .chain_id = ALC662_FIXUP_USI_FUNC
10250 },
10251 };
10252
10253 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
10254 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
10255 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
10256 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
10257 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
10258 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
10259 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
10260 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
10261 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
10262 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
10263 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
10264 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
10265 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10266 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10267 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
10268 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
10269 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
10270 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10271 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10272 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10273 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10274 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10275 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
10276 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
10277 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
10278 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
10279 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
10280 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
10281 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
10282 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
10283 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
10284 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10285 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
10286 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
10287 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
10288 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
10289 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
10290 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
10291 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
10292 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
10293 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
10294 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
10295 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
10296 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
10297 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
10298 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
10299 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
10300 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
10301
10302 #if 0
10303 /* Below is a quirk table taken from the old code.
10304 * Basically the device should work as is without the fixup table.
10305 * If BIOS doesn't give a proper info, enable the corresponding
10306 * fixup entry.
10307 */
10308 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10309 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10310 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10311 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10312 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10313 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10314 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10315 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10316 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10317 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10318 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10319 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10320 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10321 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10322 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10323 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10324 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10325 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10326 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10327 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10328 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10329 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10330 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10331 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10332 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10333 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10334 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10335 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10336 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10337 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10338 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10339 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10340 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10341 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10342 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10343 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10344 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10345 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10346 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10347 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10348 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10349 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10350 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10351 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10352 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10353 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10354 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10355 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10356 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10357 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10358 #endif
10359 {}
10360 };
10361
10362 static const struct hda_model_fixup alc662_fixup_models[] = {
10363 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10364 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
10365 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
10366 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
10367 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10368 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10369 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10370 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10371 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10372 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10373 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10374 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
10375 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
10376 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
10377 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
10378 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
10379 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10380 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10381 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10382 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10383 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10384 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10385 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10386 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
10387 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
10388 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10389 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10390 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10391 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10392 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
10393 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
10394 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
10395 {}
10396 };
10397
10398 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
10399 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10400 {0x17, 0x02211010},
10401 {0x18, 0x01a19030},
10402 {0x1a, 0x01813040},
10403 {0x21, 0x01014020}),
10404 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10405 {0x16, 0x01813030},
10406 {0x17, 0x02211010},
10407 {0x18, 0x01a19040},
10408 {0x21, 0x01014020}),
10409 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
10410 {0x14, 0x01014010},
10411 {0x18, 0x01a19020},
10412 {0x1a, 0x0181302f},
10413 {0x1b, 0x0221401f}),
10414 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10415 {0x12, 0x99a30130},
10416 {0x14, 0x90170110},
10417 {0x15, 0x0321101f},
10418 {0x16, 0x03011020}),
10419 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10420 {0x12, 0x99a30140},
10421 {0x14, 0x90170110},
10422 {0x15, 0x0321101f},
10423 {0x16, 0x03011020}),
10424 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10425 {0x12, 0x99a30150},
10426 {0x14, 0x90170110},
10427 {0x15, 0x0321101f},
10428 {0x16, 0x03011020}),
10429 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10430 {0x14, 0x90170110},
10431 {0x15, 0x0321101f},
10432 {0x16, 0x03011020}),
10433 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10434 {0x12, 0x90a60130},
10435 {0x14, 0x90170110},
10436 {0x15, 0x0321101f}),
10437 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10438 {0x14, 0x01014010},
10439 {0x17, 0x90170150},
10440 {0x19, 0x02a11060},
10441 {0x1b, 0x01813030},
10442 {0x21, 0x02211020}),
10443 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10444 {0x14, 0x01014010},
10445 {0x18, 0x01a19040},
10446 {0x1b, 0x01813030},
10447 {0x21, 0x02211020}),
10448 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10449 {0x14, 0x01014020},
10450 {0x17, 0x90170110},
10451 {0x18, 0x01a19050},
10452 {0x1b, 0x01813040},
10453 {0x21, 0x02211030}),
10454 {}
10455 };
10456
10457 /*
10458 */
10459 static int patch_alc662(struct hda_codec *codec)
10460 {
10461 struct alc_spec *spec;
10462 int err;
10463
10464 err = alc_alloc_spec(codec, 0x0b);
10465 if (err < 0)
10466 return err;
10467
10468 spec = codec->spec;
10469
10470 spec->shutup = alc_eapd_shutup;
10471
10472 /* handle multiple HPs as is */
10473 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10474
10475 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10476
10477 switch (codec->core.vendor_id) {
10478 case 0x10ec0668:
10479 spec->init_hook = alc668_restore_default_value;
10480 break;
10481 }
10482
10483 alc_pre_init(codec);
10484
10485 snd_hda_pick_fixup(codec, alc662_fixup_models,
10486 alc662_fixup_tbl, alc662_fixups);
10487 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
10488 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10489
10490 alc_auto_parse_customize_define(codec);
10491
10492 if (has_cdefine_beep(codec))
10493 spec->gen.beep_nid = 0x01;
10494
10495 if ((alc_get_coef0(codec) & (1 << 14)) &&
10496 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
10497 spec->cdefine.platform_type == 1) {
10498 err = alc_codec_rename(codec, "ALC272X");
10499 if (err < 0)
10500 goto error;
10501 }
10502
10503 /* automatic parse from the BIOS config */
10504 err = alc662_parse_auto_config(codec);
10505 if (err < 0)
10506 goto error;
10507
10508 if (!spec->gen.no_analog && spec->gen.beep_nid) {
10509 switch (codec->core.vendor_id) {
10510 case 0x10ec0662:
10511 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10512 break;
10513 case 0x10ec0272:
10514 case 0x10ec0663:
10515 case 0x10ec0665:
10516 case 0x10ec0668:
10517 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
10518 break;
10519 case 0x10ec0273:
10520 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
10521 break;
10522 }
10523 if (err < 0)
10524 goto error;
10525 }
10526
10527 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10528
10529 return 0;
10530
10531 error:
10532 alc_free(codec);
10533 return err;
10534 }
10535
10536 /*
10537 * ALC680 support
10538 */
10539
10540 static int alc680_parse_auto_config(struct hda_codec *codec)
10541 {
10542 return alc_parse_auto_config(codec, NULL, NULL);
10543 }
10544
10545 /*
10546 */
10547 static int patch_alc680(struct hda_codec *codec)
10548 {
10549 int err;
10550
10551 /* ALC680 has no aa-loopback mixer */
10552 err = alc_alloc_spec(codec, 0);
10553 if (err < 0)
10554 return err;
10555
10556 /* automatic parse from the BIOS config */
10557 err = alc680_parse_auto_config(codec);
10558 if (err < 0) {
10559 alc_free(codec);
10560 return err;
10561 }
10562
10563 return 0;
10564 }
10565
10566 /*
10567 * patch entries
10568 */
10569 static const struct hda_device_id snd_hda_id_realtek[] = {
10570 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
10571 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
10572 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
10573 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
10574 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10575 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
10576 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
10577 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
10578 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
10579 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
10580 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10581 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
10582 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
10583 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10584 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10585 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10586 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10587 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10588 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10589 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
10590 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
10591 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10592 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10593 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10594 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10595 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10596 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
10597 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
10598 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
10599 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
10600 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
10601 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
10602 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10603 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10604 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
10605 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
10606 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
10607 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
10608 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
10609 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
10610 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
10611 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10612 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10613 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10614 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10615 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10616 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10617 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10618 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10619 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10620 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10621 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10622 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10623 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10624 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
10625 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10626 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10627 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
10628 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
10629 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
10630 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10631 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10632 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10633 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10634 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10635 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10636 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10637 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10638 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10639 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10640 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
10641 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
10642 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10643 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
10644 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
10645 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
10646 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
10647 {} /* terminator */
10648 };
10649 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
10650
10651 MODULE_LICENSE("GPL");
10652 MODULE_DESCRIPTION("Realtek HD-audio codec");
10653
10654 static struct hda_codec_driver realtek_driver = {
10655 .id = snd_hda_id_realtek,
10656 };
10657
10658 module_hda_codec_driver(realtek_driver);