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