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