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