xref: /openbmc/linux/sound/pci/hda/patch_realtek.c (revision f0417e72)
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 <linux/ctype.h>
22 #include <sound/core.h>
23 #include <sound/jack.h>
24 #include <sound/hda_codec.h>
25 #include "hda_local.h"
26 #include "hda_auto_parser.h"
27 #include "hda_jack.h"
28 #include "hda_generic.h"
29 #include "hda_component.h"
30 
31 /* keep halting ALC5505 DSP, for power saving */
32 #define HALT_REALTEK_ALC5505
33 
34 /* extra amp-initialization sequence types */
35 enum {
36 	ALC_INIT_UNDEFINED,
37 	ALC_INIT_NONE,
38 	ALC_INIT_DEFAULT,
39 };
40 
41 enum {
42 	ALC_HEADSET_MODE_UNKNOWN,
43 	ALC_HEADSET_MODE_UNPLUGGED,
44 	ALC_HEADSET_MODE_HEADSET,
45 	ALC_HEADSET_MODE_MIC,
46 	ALC_HEADSET_MODE_HEADPHONE,
47 };
48 
49 enum {
50 	ALC_HEADSET_TYPE_UNKNOWN,
51 	ALC_HEADSET_TYPE_CTIA,
52 	ALC_HEADSET_TYPE_OMTP,
53 };
54 
55 enum {
56 	ALC_KEY_MICMUTE_INDEX,
57 };
58 
59 struct alc_customize_define {
60 	unsigned int  sku_cfg;
61 	unsigned char port_connectivity;
62 	unsigned char check_sum;
63 	unsigned char customization;
64 	unsigned char external_amp;
65 	unsigned int  enable_pcbeep:1;
66 	unsigned int  platform_type:1;
67 	unsigned int  swap:1;
68 	unsigned int  override:1;
69 	unsigned int  fixup:1; /* Means that this sku is set by driver, not read from hw */
70 };
71 
72 struct alc_coef_led {
73 	unsigned int idx;
74 	unsigned int mask;
75 	unsigned int on;
76 	unsigned int off;
77 };
78 
79 struct alc_spec {
80 	struct hda_gen_spec gen; /* must be at head */
81 
82 	/* codec parameterization */
83 	struct alc_customize_define cdefine;
84 	unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
85 
86 	/* GPIO bits */
87 	unsigned int gpio_mask;
88 	unsigned int gpio_dir;
89 	unsigned int gpio_data;
90 	bool gpio_write_delay;	/* add a delay before writing gpio_data */
91 
92 	/* mute LED for HP laptops, see vref_mute_led_set() */
93 	int mute_led_polarity;
94 	int micmute_led_polarity;
95 	hda_nid_t mute_led_nid;
96 	hda_nid_t cap_mute_led_nid;
97 
98 	unsigned int gpio_mute_led_mask;
99 	unsigned int gpio_mic_led_mask;
100 	struct alc_coef_led mute_led_coef;
101 	struct alc_coef_led mic_led_coef;
102 	struct mutex coef_mutex;
103 
104 	hda_nid_t headset_mic_pin;
105 	hda_nid_t headphone_mic_pin;
106 	int current_headset_mode;
107 	int current_headset_type;
108 
109 	/* hooks */
110 	void (*init_hook)(struct hda_codec *codec);
111 #ifdef CONFIG_PM
112 	void (*power_hook)(struct hda_codec *codec);
113 #endif
114 	void (*shutup)(struct hda_codec *codec);
115 
116 	int init_amp;
117 	int codec_variant;	/* flag for other variants */
118 	unsigned int has_alc5505_dsp:1;
119 	unsigned int no_depop_delay:1;
120 	unsigned int done_hp_init:1;
121 	unsigned int no_shutup_pins:1;
122 	unsigned int ultra_low_power:1;
123 	unsigned int has_hs_key:1;
124 	unsigned int no_internal_mic_pin:1;
125 
126 	/* for PLL fix */
127 	hda_nid_t pll_nid;
128 	unsigned int pll_coef_idx, pll_coef_bit;
129 	unsigned int coef0;
130 	struct input_dev *kb_dev;
131 	u8 alc_mute_keycode_map[1];
132 
133 	/* component binding */
134 	struct component_match *match;
135 	struct hda_component comps[HDA_MAX_COMPONENTS];
136 };
137 
138 /*
139  * COEF access helper functions
140  */
141 
142 static void coef_mutex_lock(struct hda_codec *codec)
143 {
144 	struct alc_spec *spec = codec->spec;
145 
146 	snd_hda_power_up_pm(codec);
147 	mutex_lock(&spec->coef_mutex);
148 }
149 
150 static void coef_mutex_unlock(struct hda_codec *codec)
151 {
152 	struct alc_spec *spec = codec->spec;
153 
154 	mutex_unlock(&spec->coef_mutex);
155 	snd_hda_power_down_pm(codec);
156 }
157 
158 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
159 				 unsigned int coef_idx)
160 {
161 	unsigned int val;
162 
163 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
164 	val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
165 	return val;
166 }
167 
168 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
169 			       unsigned int coef_idx)
170 {
171 	unsigned int val;
172 
173 	coef_mutex_lock(codec);
174 	val = __alc_read_coefex_idx(codec, nid, coef_idx);
175 	coef_mutex_unlock(codec);
176 	return val;
177 }
178 
179 #define alc_read_coef_idx(codec, coef_idx) \
180 	alc_read_coefex_idx(codec, 0x20, coef_idx)
181 
182 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
183 				   unsigned int coef_idx, unsigned int coef_val)
184 {
185 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
186 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
187 }
188 
189 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
190 				 unsigned int coef_idx, unsigned int coef_val)
191 {
192 	coef_mutex_lock(codec);
193 	__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
194 	coef_mutex_unlock(codec);
195 }
196 
197 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
198 	alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
199 
200 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
201 				    unsigned int coef_idx, unsigned int mask,
202 				    unsigned int bits_set)
203 {
204 	unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
205 
206 	if (val != -1)
207 		__alc_write_coefex_idx(codec, nid, coef_idx,
208 				       (val & ~mask) | bits_set);
209 }
210 
211 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
212 				  unsigned int coef_idx, unsigned int mask,
213 				  unsigned int bits_set)
214 {
215 	coef_mutex_lock(codec);
216 	__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
217 	coef_mutex_unlock(codec);
218 }
219 
220 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set)	\
221 	alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
222 
223 /* a special bypass for COEF 0; read the cached value at the second time */
224 static unsigned int alc_get_coef0(struct hda_codec *codec)
225 {
226 	struct alc_spec *spec = codec->spec;
227 
228 	if (!spec->coef0)
229 		spec->coef0 = alc_read_coef_idx(codec, 0);
230 	return spec->coef0;
231 }
232 
233 /* coef writes/updates batch */
234 struct coef_fw {
235 	unsigned char nid;
236 	unsigned char idx;
237 	unsigned short mask;
238 	unsigned short val;
239 };
240 
241 #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
242 	{ .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
243 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
244 #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
245 #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
246 
247 static void alc_process_coef_fw(struct hda_codec *codec,
248 				const struct coef_fw *fw)
249 {
250 	coef_mutex_lock(codec);
251 	for (; fw->nid; fw++) {
252 		if (fw->mask == (unsigned short)-1)
253 			__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
254 		else
255 			__alc_update_coefex_idx(codec, fw->nid, fw->idx,
256 						fw->mask, fw->val);
257 	}
258 	coef_mutex_unlock(codec);
259 }
260 
261 /*
262  * GPIO setup tables, used in initialization
263  */
264 
265 /* Enable GPIO mask and set output */
266 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
267 {
268 	struct alc_spec *spec = codec->spec;
269 
270 	spec->gpio_mask |= mask;
271 	spec->gpio_dir |= mask;
272 	spec->gpio_data |= mask;
273 }
274 
275 static void alc_write_gpio_data(struct hda_codec *codec)
276 {
277 	struct alc_spec *spec = codec->spec;
278 
279 	snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
280 			    spec->gpio_data);
281 }
282 
283 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
284 				 bool on)
285 {
286 	struct alc_spec *spec = codec->spec;
287 	unsigned int oldval = spec->gpio_data;
288 
289 	if (on)
290 		spec->gpio_data |= mask;
291 	else
292 		spec->gpio_data &= ~mask;
293 	if (oldval != spec->gpio_data)
294 		alc_write_gpio_data(codec);
295 }
296 
297 static void alc_write_gpio(struct hda_codec *codec)
298 {
299 	struct alc_spec *spec = codec->spec;
300 
301 	if (!spec->gpio_mask)
302 		return;
303 
304 	snd_hda_codec_write(codec, codec->core.afg, 0,
305 			    AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
306 	snd_hda_codec_write(codec, codec->core.afg, 0,
307 			    AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
308 	if (spec->gpio_write_delay)
309 		msleep(1);
310 	alc_write_gpio_data(codec);
311 }
312 
313 static void alc_fixup_gpio(struct hda_codec *codec, int action,
314 			   unsigned int mask)
315 {
316 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
317 		alc_setup_gpio(codec, mask);
318 }
319 
320 static void alc_fixup_gpio1(struct hda_codec *codec,
321 			    const struct hda_fixup *fix, int action)
322 {
323 	alc_fixup_gpio(codec, action, 0x01);
324 }
325 
326 static void alc_fixup_gpio2(struct hda_codec *codec,
327 			    const struct hda_fixup *fix, int action)
328 {
329 	alc_fixup_gpio(codec, action, 0x02);
330 }
331 
332 static void alc_fixup_gpio3(struct hda_codec *codec,
333 			    const struct hda_fixup *fix, int action)
334 {
335 	alc_fixup_gpio(codec, action, 0x03);
336 }
337 
338 static void alc_fixup_gpio4(struct hda_codec *codec,
339 			    const struct hda_fixup *fix, int action)
340 {
341 	alc_fixup_gpio(codec, action, 0x04);
342 }
343 
344 static void alc_fixup_micmute_led(struct hda_codec *codec,
345 				  const struct hda_fixup *fix, int action)
346 {
347 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
348 		snd_hda_gen_add_micmute_led_cdev(codec, NULL);
349 }
350 
351 /*
352  * Fix hardware PLL issue
353  * On some codecs, the analog PLL gating control must be off while
354  * the default value is 1.
355  */
356 static void alc_fix_pll(struct hda_codec *codec)
357 {
358 	struct alc_spec *spec = codec->spec;
359 
360 	if (spec->pll_nid)
361 		alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
362 				      1 << spec->pll_coef_bit, 0);
363 }
364 
365 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
366 			     unsigned int coef_idx, unsigned int coef_bit)
367 {
368 	struct alc_spec *spec = codec->spec;
369 	spec->pll_nid = nid;
370 	spec->pll_coef_idx = coef_idx;
371 	spec->pll_coef_bit = coef_bit;
372 	alc_fix_pll(codec);
373 }
374 
375 /* update the master volume per volume-knob's unsol event */
376 static void alc_update_knob_master(struct hda_codec *codec,
377 				   struct hda_jack_callback *jack)
378 {
379 	unsigned int val;
380 	struct snd_kcontrol *kctl;
381 	struct snd_ctl_elem_value *uctl;
382 
383 	kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
384 	if (!kctl)
385 		return;
386 	uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
387 	if (!uctl)
388 		return;
389 	val = snd_hda_codec_read(codec, jack->nid, 0,
390 				 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
391 	val &= HDA_AMP_VOLMASK;
392 	uctl->value.integer.value[0] = val;
393 	uctl->value.integer.value[1] = val;
394 	kctl->put(kctl, uctl);
395 	kfree(uctl);
396 }
397 
398 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
399 {
400 	/* For some reason, the res given from ALC880 is broken.
401 	   Here we adjust it properly. */
402 	snd_hda_jack_unsol_event(codec, res >> 2);
403 }
404 
405 /* Change EAPD to verb control */
406 static void alc_fill_eapd_coef(struct hda_codec *codec)
407 {
408 	int coef;
409 
410 	coef = alc_get_coef0(codec);
411 
412 	switch (codec->core.vendor_id) {
413 	case 0x10ec0262:
414 		alc_update_coef_idx(codec, 0x7, 0, 1<<5);
415 		break;
416 	case 0x10ec0267:
417 	case 0x10ec0268:
418 		alc_update_coef_idx(codec, 0x7, 0, 1<<13);
419 		break;
420 	case 0x10ec0269:
421 		if ((coef & 0x00f0) == 0x0010)
422 			alc_update_coef_idx(codec, 0xd, 0, 1<<14);
423 		if ((coef & 0x00f0) == 0x0020)
424 			alc_update_coef_idx(codec, 0x4, 1<<15, 0);
425 		if ((coef & 0x00f0) == 0x0030)
426 			alc_update_coef_idx(codec, 0x10, 1<<9, 0);
427 		break;
428 	case 0x10ec0280:
429 	case 0x10ec0284:
430 	case 0x10ec0290:
431 	case 0x10ec0292:
432 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
433 		break;
434 	case 0x10ec0225:
435 	case 0x10ec0295:
436 	case 0x10ec0299:
437 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
438 		fallthrough;
439 	case 0x10ec0215:
440 	case 0x10ec0230:
441 	case 0x10ec0233:
442 	case 0x10ec0235:
443 	case 0x10ec0236:
444 	case 0x10ec0245:
445 	case 0x10ec0255:
446 	case 0x10ec0256:
447 	case 0x19e58326:
448 	case 0x10ec0257:
449 	case 0x10ec0282:
450 	case 0x10ec0283:
451 	case 0x10ec0286:
452 	case 0x10ec0288:
453 	case 0x10ec0285:
454 	case 0x10ec0298:
455 	case 0x10ec0289:
456 	case 0x10ec0300:
457 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
458 		break;
459 	case 0x10ec0275:
460 		alc_update_coef_idx(codec, 0xe, 0, 1<<0);
461 		break;
462 	case 0x10ec0287:
463 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
464 		alc_write_coef_idx(codec, 0x8, 0x4ab7);
465 		break;
466 	case 0x10ec0293:
467 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
468 		break;
469 	case 0x10ec0234:
470 	case 0x10ec0274:
471 	case 0x10ec0294:
472 	case 0x10ec0700:
473 	case 0x10ec0701:
474 	case 0x10ec0703:
475 	case 0x10ec0711:
476 		alc_update_coef_idx(codec, 0x10, 1<<15, 0);
477 		break;
478 	case 0x10ec0662:
479 		if ((coef & 0x00f0) == 0x0030)
480 			alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
481 		break;
482 	case 0x10ec0272:
483 	case 0x10ec0273:
484 	case 0x10ec0663:
485 	case 0x10ec0665:
486 	case 0x10ec0670:
487 	case 0x10ec0671:
488 	case 0x10ec0672:
489 		alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
490 		break;
491 	case 0x10ec0222:
492 	case 0x10ec0623:
493 		alc_update_coef_idx(codec, 0x19, 1<<13, 0);
494 		break;
495 	case 0x10ec0668:
496 		alc_update_coef_idx(codec, 0x7, 3<<13, 0);
497 		break;
498 	case 0x10ec0867:
499 		alc_update_coef_idx(codec, 0x4, 1<<10, 0);
500 		break;
501 	case 0x10ec0888:
502 		if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
503 			alc_update_coef_idx(codec, 0x7, 1<<5, 0);
504 		break;
505 	case 0x10ec0892:
506 	case 0x10ec0897:
507 		alc_update_coef_idx(codec, 0x7, 1<<5, 0);
508 		break;
509 	case 0x10ec0899:
510 	case 0x10ec0900:
511 	case 0x10ec0b00:
512 	case 0x10ec1168:
513 	case 0x10ec1220:
514 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
515 		break;
516 	}
517 }
518 
519 /* additional initialization for ALC888 variants */
520 static void alc888_coef_init(struct hda_codec *codec)
521 {
522 	switch (alc_get_coef0(codec) & 0x00f0) {
523 	/* alc888-VA */
524 	case 0x00:
525 	/* alc888-VB */
526 	case 0x10:
527 		alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
528 		break;
529 	}
530 }
531 
532 /* turn on/off EAPD control (only if available) */
533 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
534 {
535 	if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
536 		return;
537 	if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
538 		snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
539 				    on ? 2 : 0);
540 }
541 
542 /* turn on/off EAPD controls of the codec */
543 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
544 {
545 	/* We currently only handle front, HP */
546 	static const hda_nid_t pins[] = {
547 		0x0f, 0x10, 0x14, 0x15, 0x17, 0
548 	};
549 	const hda_nid_t *p;
550 	for (p = pins; *p; p++)
551 		set_eapd(codec, *p, on);
552 }
553 
554 static int find_ext_mic_pin(struct hda_codec *codec);
555 
556 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
557 {
558 	const struct hda_pincfg *pin;
559 	int mic_pin = find_ext_mic_pin(codec);
560 	int i;
561 
562 	/* don't shut up pins when unloading the driver; otherwise it breaks
563 	 * the default pin setup at the next load of the driver
564 	 */
565 	if (codec->bus->shutdown)
566 		return;
567 
568 	snd_array_for_each(&codec->init_pins, i, pin) {
569 		/* use read here for syncing after issuing each verb */
570 		if (pin->nid != mic_pin)
571 			snd_hda_codec_read(codec, pin->nid, 0,
572 					AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
573 	}
574 
575 	codec->pins_shutup = 1;
576 }
577 
578 static void alc_shutup_pins(struct hda_codec *codec)
579 {
580 	struct alc_spec *spec = codec->spec;
581 
582 	switch (codec->core.vendor_id) {
583 	case 0x10ec0236:
584 	case 0x10ec0256:
585 	case 0x19e58326:
586 	case 0x10ec0283:
587 	case 0x10ec0286:
588 	case 0x10ec0288:
589 	case 0x10ec0298:
590 		alc_headset_mic_no_shutup(codec);
591 		break;
592 	default:
593 		if (!spec->no_shutup_pins)
594 			snd_hda_shutup_pins(codec);
595 		break;
596 	}
597 }
598 
599 /* generic shutup callback;
600  * just turning off EAPD and a little pause for avoiding pop-noise
601  */
602 static void alc_eapd_shutup(struct hda_codec *codec)
603 {
604 	struct alc_spec *spec = codec->spec;
605 
606 	alc_auto_setup_eapd(codec, false);
607 	if (!spec->no_depop_delay)
608 		msleep(200);
609 	alc_shutup_pins(codec);
610 }
611 
612 /* generic EAPD initialization */
613 static void alc_auto_init_amp(struct hda_codec *codec, int type)
614 {
615 	alc_auto_setup_eapd(codec, true);
616 	alc_write_gpio(codec);
617 	switch (type) {
618 	case ALC_INIT_DEFAULT:
619 		switch (codec->core.vendor_id) {
620 		case 0x10ec0260:
621 			alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
622 			break;
623 		case 0x10ec0880:
624 		case 0x10ec0882:
625 		case 0x10ec0883:
626 		case 0x10ec0885:
627 			alc_update_coef_idx(codec, 7, 0, 0x2030);
628 			break;
629 		case 0x10ec0888:
630 			alc888_coef_init(codec);
631 			break;
632 		}
633 		break;
634 	}
635 }
636 
637 /* get a primary headphone pin if available */
638 static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
639 {
640 	if (spec->gen.autocfg.hp_pins[0])
641 		return spec->gen.autocfg.hp_pins[0];
642 	if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
643 		return spec->gen.autocfg.line_out_pins[0];
644 	return 0;
645 }
646 
647 /*
648  * Realtek SSID verification
649  */
650 
651 /* Could be any non-zero and even value. When used as fixup, tells
652  * the driver to ignore any present sku defines.
653  */
654 #define ALC_FIXUP_SKU_IGNORE (2)
655 
656 static void alc_fixup_sku_ignore(struct hda_codec *codec,
657 				 const struct hda_fixup *fix, int action)
658 {
659 	struct alc_spec *spec = codec->spec;
660 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
661 		spec->cdefine.fixup = 1;
662 		spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
663 	}
664 }
665 
666 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
667 				    const struct hda_fixup *fix, int action)
668 {
669 	struct alc_spec *spec = codec->spec;
670 
671 	if (action == HDA_FIXUP_ACT_PROBE) {
672 		spec->no_depop_delay = 1;
673 		codec->depop_delay = 0;
674 	}
675 }
676 
677 static int alc_auto_parse_customize_define(struct hda_codec *codec)
678 {
679 	unsigned int ass, tmp, i;
680 	unsigned nid = 0;
681 	struct alc_spec *spec = codec->spec;
682 
683 	spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
684 
685 	if (spec->cdefine.fixup) {
686 		ass = spec->cdefine.sku_cfg;
687 		if (ass == ALC_FIXUP_SKU_IGNORE)
688 			return -1;
689 		goto do_sku;
690 	}
691 
692 	if (!codec->bus->pci)
693 		return -1;
694 	ass = codec->core.subsystem_id & 0xffff;
695 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
696 		goto do_sku;
697 
698 	nid = 0x1d;
699 	if (codec->core.vendor_id == 0x10ec0260)
700 		nid = 0x17;
701 	ass = snd_hda_codec_get_pincfg(codec, nid);
702 
703 	if (!(ass & 1)) {
704 		codec_info(codec, "%s: SKU not ready 0x%08x\n",
705 			   codec->core.chip_name, ass);
706 		return -1;
707 	}
708 
709 	/* check sum */
710 	tmp = 0;
711 	for (i = 1; i < 16; i++) {
712 		if ((ass >> i) & 1)
713 			tmp++;
714 	}
715 	if (((ass >> 16) & 0xf) != tmp)
716 		return -1;
717 
718 	spec->cdefine.port_connectivity = ass >> 30;
719 	spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
720 	spec->cdefine.check_sum = (ass >> 16) & 0xf;
721 	spec->cdefine.customization = ass >> 8;
722 do_sku:
723 	spec->cdefine.sku_cfg = ass;
724 	spec->cdefine.external_amp = (ass & 0x38) >> 3;
725 	spec->cdefine.platform_type = (ass & 0x4) >> 2;
726 	spec->cdefine.swap = (ass & 0x2) >> 1;
727 	spec->cdefine.override = ass & 0x1;
728 
729 	codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
730 		   nid, spec->cdefine.sku_cfg);
731 	codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
732 		   spec->cdefine.port_connectivity);
733 	codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
734 	codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
735 	codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
736 	codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
737 	codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
738 	codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
739 	codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
740 
741 	return 0;
742 }
743 
744 /* return the position of NID in the list, or -1 if not found */
745 static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
746 {
747 	int i;
748 	for (i = 0; i < nums; i++)
749 		if (list[i] == nid)
750 			return i;
751 	return -1;
752 }
753 /* return true if the given NID is found in the list */
754 static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
755 {
756 	return find_idx_in_nid_list(nid, list, nums) >= 0;
757 }
758 
759 /* check subsystem ID and set up device-specific initialization;
760  * return 1 if initialized, 0 if invalid SSID
761  */
762 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
763  *	31 ~ 16 :	Manufacture ID
764  *	15 ~ 8	:	SKU ID
765  *	7  ~ 0	:	Assembly ID
766  *	port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
767  */
768 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
769 {
770 	unsigned int ass, tmp, i;
771 	unsigned nid;
772 	struct alc_spec *spec = codec->spec;
773 
774 	if (spec->cdefine.fixup) {
775 		ass = spec->cdefine.sku_cfg;
776 		if (ass == ALC_FIXUP_SKU_IGNORE)
777 			return 0;
778 		goto do_sku;
779 	}
780 
781 	ass = codec->core.subsystem_id & 0xffff;
782 	if (codec->bus->pci &&
783 	    ass != codec->bus->pci->subsystem_device && (ass & 1))
784 		goto do_sku;
785 
786 	/* invalid SSID, check the special NID pin defcfg instead */
787 	/*
788 	 * 31~30	: port connectivity
789 	 * 29~21	: reserve
790 	 * 20		: PCBEEP input
791 	 * 19~16	: Check sum (15:1)
792 	 * 15~1		: Custom
793 	 * 0		: override
794 	*/
795 	nid = 0x1d;
796 	if (codec->core.vendor_id == 0x10ec0260)
797 		nid = 0x17;
798 	ass = snd_hda_codec_get_pincfg(codec, nid);
799 	codec_dbg(codec,
800 		  "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
801 		   ass, nid);
802 	if (!(ass & 1))
803 		return 0;
804 	if ((ass >> 30) != 1)	/* no physical connection */
805 		return 0;
806 
807 	/* check sum */
808 	tmp = 0;
809 	for (i = 1; i < 16; i++) {
810 		if ((ass >> i) & 1)
811 			tmp++;
812 	}
813 	if (((ass >> 16) & 0xf) != tmp)
814 		return 0;
815 do_sku:
816 	codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
817 		   ass & 0xffff, codec->core.vendor_id);
818 	/*
819 	 * 0 : override
820 	 * 1 :	Swap Jack
821 	 * 2 : 0 --> Desktop, 1 --> Laptop
822 	 * 3~5 : External Amplifier control
823 	 * 7~6 : Reserved
824 	*/
825 	tmp = (ass & 0x38) >> 3;	/* external Amp control */
826 	if (spec->init_amp == ALC_INIT_UNDEFINED) {
827 		switch (tmp) {
828 		case 1:
829 			alc_setup_gpio(codec, 0x01);
830 			break;
831 		case 3:
832 			alc_setup_gpio(codec, 0x02);
833 			break;
834 		case 7:
835 			alc_setup_gpio(codec, 0x04);
836 			break;
837 		case 5:
838 		default:
839 			spec->init_amp = ALC_INIT_DEFAULT;
840 			break;
841 		}
842 	}
843 
844 	/* is laptop or Desktop and enable the function "Mute internal speaker
845 	 * when the external headphone out jack is plugged"
846 	 */
847 	if (!(ass & 0x8000))
848 		return 1;
849 	/*
850 	 * 10~8 : Jack location
851 	 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
852 	 * 14~13: Resvered
853 	 * 15   : 1 --> enable the function "Mute internal speaker
854 	 *	        when the external headphone out jack is plugged"
855 	 */
856 	if (!alc_get_hp_pin(spec)) {
857 		hda_nid_t nid;
858 		tmp = (ass >> 11) & 0x3;	/* HP to chassis */
859 		nid = ports[tmp];
860 		if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
861 				      spec->gen.autocfg.line_outs))
862 			return 1;
863 		spec->gen.autocfg.hp_pins[0] = nid;
864 	}
865 	return 1;
866 }
867 
868 /* Check the validity of ALC subsystem-id
869  * ports contains an array of 4 pin NIDs for port-A, E, D and I */
870 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
871 {
872 	if (!alc_subsystem_id(codec, ports)) {
873 		struct alc_spec *spec = codec->spec;
874 		if (spec->init_amp == ALC_INIT_UNDEFINED) {
875 			codec_dbg(codec,
876 				  "realtek: Enable default setup for auto mode as fallback\n");
877 			spec->init_amp = ALC_INIT_DEFAULT;
878 		}
879 	}
880 }
881 
882 /*
883  */
884 
885 static void alc_fixup_inv_dmic(struct hda_codec *codec,
886 			       const struct hda_fixup *fix, int action)
887 {
888 	struct alc_spec *spec = codec->spec;
889 
890 	spec->gen.inv_dmic_split = 1;
891 }
892 
893 
894 static int alc_build_controls(struct hda_codec *codec)
895 {
896 	int err;
897 
898 	err = snd_hda_gen_build_controls(codec);
899 	if (err < 0)
900 		return err;
901 
902 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
903 	return 0;
904 }
905 
906 
907 /*
908  * Common callbacks
909  */
910 
911 static void alc_pre_init(struct hda_codec *codec)
912 {
913 	alc_fill_eapd_coef(codec);
914 }
915 
916 #define is_s3_resume(codec) \
917 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
918 #define is_s4_resume(codec) \
919 	((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
920 
921 static int alc_init(struct hda_codec *codec)
922 {
923 	struct alc_spec *spec = codec->spec;
924 
925 	/* hibernation resume needs the full chip initialization */
926 	if (is_s4_resume(codec))
927 		alc_pre_init(codec);
928 
929 	if (spec->init_hook)
930 		spec->init_hook(codec);
931 
932 	spec->gen.skip_verbs = 1; /* applied in below */
933 	snd_hda_gen_init(codec);
934 	alc_fix_pll(codec);
935 	alc_auto_init_amp(codec, spec->init_amp);
936 	snd_hda_apply_verbs(codec); /* apply verbs here after own init */
937 
938 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
939 
940 	return 0;
941 }
942 
943 #define alc_free	snd_hda_gen_free
944 
945 #ifdef CONFIG_PM
946 static inline void alc_shutup(struct hda_codec *codec)
947 {
948 	struct alc_spec *spec = codec->spec;
949 
950 	if (!snd_hda_get_bool_hint(codec, "shutup"))
951 		return; /* disabled explicitly by hints */
952 
953 	if (spec && spec->shutup)
954 		spec->shutup(codec);
955 	else
956 		alc_shutup_pins(codec);
957 }
958 
959 static void alc_power_eapd(struct hda_codec *codec)
960 {
961 	alc_auto_setup_eapd(codec, false);
962 }
963 
964 static int alc_suspend(struct hda_codec *codec)
965 {
966 	struct alc_spec *spec = codec->spec;
967 	alc_shutup(codec);
968 	if (spec && spec->power_hook)
969 		spec->power_hook(codec);
970 	return 0;
971 }
972 
973 static int alc_resume(struct hda_codec *codec)
974 {
975 	struct alc_spec *spec = codec->spec;
976 
977 	if (!spec->no_depop_delay)
978 		msleep(150); /* to avoid pop noise */
979 	codec->patch_ops.init(codec);
980 	snd_hda_regmap_sync(codec);
981 	hda_call_check_power_status(codec, 0x01);
982 	return 0;
983 }
984 #endif
985 
986 /*
987  */
988 static const struct hda_codec_ops alc_patch_ops = {
989 	.build_controls = alc_build_controls,
990 	.build_pcms = snd_hda_gen_build_pcms,
991 	.init = alc_init,
992 	.free = alc_free,
993 	.unsol_event = snd_hda_jack_unsol_event,
994 #ifdef CONFIG_PM
995 	.resume = alc_resume,
996 	.suspend = alc_suspend,
997 	.check_power_status = snd_hda_gen_check_power_status,
998 #endif
999 };
1000 
1001 
1002 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1003 
1004 /*
1005  * Rename codecs appropriately from COEF value or subvendor id
1006  */
1007 struct alc_codec_rename_table {
1008 	unsigned int vendor_id;
1009 	unsigned short coef_mask;
1010 	unsigned short coef_bits;
1011 	const char *name;
1012 };
1013 
1014 struct alc_codec_rename_pci_table {
1015 	unsigned int codec_vendor_id;
1016 	unsigned short pci_subvendor;
1017 	unsigned short pci_subdevice;
1018 	const char *name;
1019 };
1020 
1021 static const struct alc_codec_rename_table rename_tbl[] = {
1022 	{ 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
1023 	{ 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1024 	{ 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1025 	{ 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1026 	{ 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1027 	{ 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1028 	{ 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1029 	{ 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
1030 	{ 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
1031 	{ 0x10ec0662, 0xffff, 0x4020, "ALC656" },
1032 	{ 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1033 	{ 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1034 	{ 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1035 	{ 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1036 	{ 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1037 	{ 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1038 	{ 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1039 	{ } /* terminator */
1040 };
1041 
1042 static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
1043 	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
1044 	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
1045 	{ 0x10ec0283, 0x1028, 0, "ALC3223" },
1046 	{ 0x10ec0288, 0x1028, 0, "ALC3263" },
1047 	{ 0x10ec0292, 0x1028, 0, "ALC3226" },
1048 	{ 0x10ec0293, 0x1028, 0, "ALC3235" },
1049 	{ 0x10ec0255, 0x1028, 0, "ALC3234" },
1050 	{ 0x10ec0668, 0x1028, 0, "ALC3661" },
1051 	{ 0x10ec0275, 0x1028, 0, "ALC3260" },
1052 	{ 0x10ec0899, 0x1028, 0, "ALC3861" },
1053 	{ 0x10ec0298, 0x1028, 0, "ALC3266" },
1054 	{ 0x10ec0236, 0x1028, 0, "ALC3204" },
1055 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
1056 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
1057 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
1058 	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
1059 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
1060 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
1061 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
1062 	{ 0x10ec0233, 0x1043, 0, "ALC3236" },
1063 	{ 0x10ec0280, 0x103c, 0, "ALC3228" },
1064 	{ 0x10ec0282, 0x103c, 0, "ALC3227" },
1065 	{ 0x10ec0286, 0x103c, 0, "ALC3242" },
1066 	{ 0x10ec0290, 0x103c, 0, "ALC3241" },
1067 	{ 0x10ec0668, 0x103c, 0, "ALC3662" },
1068 	{ 0x10ec0283, 0x17aa, 0, "ALC3239" },
1069 	{ 0x10ec0292, 0x17aa, 0, "ALC3232" },
1070 	{ } /* terminator */
1071 };
1072 
1073 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1074 {
1075 	const struct alc_codec_rename_table *p;
1076 	const struct alc_codec_rename_pci_table *q;
1077 
1078 	for (p = rename_tbl; p->vendor_id; p++) {
1079 		if (p->vendor_id != codec->core.vendor_id)
1080 			continue;
1081 		if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1082 			return alc_codec_rename(codec, p->name);
1083 	}
1084 
1085 	if (!codec->bus->pci)
1086 		return 0;
1087 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
1088 		if (q->codec_vendor_id != codec->core.vendor_id)
1089 			continue;
1090 		if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1091 			continue;
1092 		if (!q->pci_subdevice ||
1093 		    q->pci_subdevice == codec->bus->pci->subsystem_device)
1094 			return alc_codec_rename(codec, q->name);
1095 	}
1096 
1097 	return 0;
1098 }
1099 
1100 
1101 /*
1102  * Digital-beep handlers
1103  */
1104 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1105 
1106 /* additional beep mixers; private_value will be overwritten */
1107 static const struct snd_kcontrol_new alc_beep_mixer[] = {
1108 	HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1109 	HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1110 };
1111 
1112 /* set up and create beep controls */
1113 static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1114 			int idx, int dir)
1115 {
1116 	struct snd_kcontrol_new *knew;
1117 	unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1118 	int i;
1119 
1120 	for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1121 		knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1122 					    &alc_beep_mixer[i]);
1123 		if (!knew)
1124 			return -ENOMEM;
1125 		knew->private_value = beep_amp;
1126 	}
1127 	return 0;
1128 }
1129 
1130 static const struct snd_pci_quirk beep_allow_list[] = {
1131 	SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1132 	SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1133 	SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1134 	SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1135 	SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1136 	SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1137 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1138 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1139 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1140 	/* denylist -- no beep available */
1141 	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1142 	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
1143 	{}
1144 };
1145 
1146 static inline int has_cdefine_beep(struct hda_codec *codec)
1147 {
1148 	struct alc_spec *spec = codec->spec;
1149 	const struct snd_pci_quirk *q;
1150 	q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1151 	if (q)
1152 		return q->value;
1153 	return spec->cdefine.enable_pcbeep;
1154 }
1155 #else
1156 #define set_beep_amp(spec, nid, idx, dir)	0
1157 #define has_cdefine_beep(codec)		0
1158 #endif
1159 
1160 /* parse the BIOS configuration and set up the alc_spec */
1161 /* return 1 if successful, 0 if the proper config is not found,
1162  * or a negative error code
1163  */
1164 static int alc_parse_auto_config(struct hda_codec *codec,
1165 				 const hda_nid_t *ignore_nids,
1166 				 const hda_nid_t *ssid_nids)
1167 {
1168 	struct alc_spec *spec = codec->spec;
1169 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
1170 	int err;
1171 
1172 	err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1173 				       spec->parse_flags);
1174 	if (err < 0)
1175 		return err;
1176 
1177 	if (ssid_nids)
1178 		alc_ssid_check(codec, ssid_nids);
1179 
1180 	err = snd_hda_gen_parse_auto_config(codec, cfg);
1181 	if (err < 0)
1182 		return err;
1183 
1184 	return 1;
1185 }
1186 
1187 /* common preparation job for alc_spec */
1188 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1189 {
1190 	struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1191 	int err;
1192 
1193 	if (!spec)
1194 		return -ENOMEM;
1195 	codec->spec = spec;
1196 	snd_hda_gen_spec_init(&spec->gen);
1197 	spec->gen.mixer_nid = mixer_nid;
1198 	spec->gen.own_eapd_ctl = 1;
1199 	codec->single_adc_amp = 1;
1200 	/* FIXME: do we need this for all Realtek codec models? */
1201 	codec->spdif_status_reset = 1;
1202 	codec->forced_resume = 1;
1203 	codec->patch_ops = alc_patch_ops;
1204 	mutex_init(&spec->coef_mutex);
1205 
1206 	err = alc_codec_rename_from_preset(codec);
1207 	if (err < 0) {
1208 		kfree(spec);
1209 		return err;
1210 	}
1211 	return 0;
1212 }
1213 
1214 static int alc880_parse_auto_config(struct hda_codec *codec)
1215 {
1216 	static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
1217 	static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
1218 	return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1219 }
1220 
1221 /*
1222  * ALC880 fix-ups
1223  */
1224 enum {
1225 	ALC880_FIXUP_GPIO1,
1226 	ALC880_FIXUP_GPIO2,
1227 	ALC880_FIXUP_MEDION_RIM,
1228 	ALC880_FIXUP_LG,
1229 	ALC880_FIXUP_LG_LW25,
1230 	ALC880_FIXUP_W810,
1231 	ALC880_FIXUP_EAPD_COEF,
1232 	ALC880_FIXUP_TCL_S700,
1233 	ALC880_FIXUP_VOL_KNOB,
1234 	ALC880_FIXUP_FUJITSU,
1235 	ALC880_FIXUP_F1734,
1236 	ALC880_FIXUP_UNIWILL,
1237 	ALC880_FIXUP_UNIWILL_DIG,
1238 	ALC880_FIXUP_Z71V,
1239 	ALC880_FIXUP_ASUS_W5A,
1240 	ALC880_FIXUP_3ST_BASE,
1241 	ALC880_FIXUP_3ST,
1242 	ALC880_FIXUP_3ST_DIG,
1243 	ALC880_FIXUP_5ST_BASE,
1244 	ALC880_FIXUP_5ST,
1245 	ALC880_FIXUP_5ST_DIG,
1246 	ALC880_FIXUP_6ST_BASE,
1247 	ALC880_FIXUP_6ST,
1248 	ALC880_FIXUP_6ST_DIG,
1249 	ALC880_FIXUP_6ST_AUTOMUTE,
1250 };
1251 
1252 /* enable the volume-knob widget support on NID 0x21 */
1253 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1254 				  const struct hda_fixup *fix, int action)
1255 {
1256 	if (action == HDA_FIXUP_ACT_PROBE)
1257 		snd_hda_jack_detect_enable_callback(codec, 0x21,
1258 						    alc_update_knob_master);
1259 }
1260 
1261 static const struct hda_fixup alc880_fixups[] = {
1262 	[ALC880_FIXUP_GPIO1] = {
1263 		.type = HDA_FIXUP_FUNC,
1264 		.v.func = alc_fixup_gpio1,
1265 	},
1266 	[ALC880_FIXUP_GPIO2] = {
1267 		.type = HDA_FIXUP_FUNC,
1268 		.v.func = alc_fixup_gpio2,
1269 	},
1270 	[ALC880_FIXUP_MEDION_RIM] = {
1271 		.type = HDA_FIXUP_VERBS,
1272 		.v.verbs = (const struct hda_verb[]) {
1273 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1274 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1275 			{ }
1276 		},
1277 		.chained = true,
1278 		.chain_id = ALC880_FIXUP_GPIO2,
1279 	},
1280 	[ALC880_FIXUP_LG] = {
1281 		.type = HDA_FIXUP_PINS,
1282 		.v.pins = (const struct hda_pintbl[]) {
1283 			/* disable bogus unused pins */
1284 			{ 0x16, 0x411111f0 },
1285 			{ 0x18, 0x411111f0 },
1286 			{ 0x1a, 0x411111f0 },
1287 			{ }
1288 		}
1289 	},
1290 	[ALC880_FIXUP_LG_LW25] = {
1291 		.type = HDA_FIXUP_PINS,
1292 		.v.pins = (const struct hda_pintbl[]) {
1293 			{ 0x1a, 0x0181344f }, /* line-in */
1294 			{ 0x1b, 0x0321403f }, /* headphone */
1295 			{ }
1296 		}
1297 	},
1298 	[ALC880_FIXUP_W810] = {
1299 		.type = HDA_FIXUP_PINS,
1300 		.v.pins = (const struct hda_pintbl[]) {
1301 			/* disable bogus unused pins */
1302 			{ 0x17, 0x411111f0 },
1303 			{ }
1304 		},
1305 		.chained = true,
1306 		.chain_id = ALC880_FIXUP_GPIO2,
1307 	},
1308 	[ALC880_FIXUP_EAPD_COEF] = {
1309 		.type = HDA_FIXUP_VERBS,
1310 		.v.verbs = (const struct hda_verb[]) {
1311 			/* change to EAPD mode */
1312 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1313 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3060 },
1314 			{}
1315 		},
1316 	},
1317 	[ALC880_FIXUP_TCL_S700] = {
1318 		.type = HDA_FIXUP_VERBS,
1319 		.v.verbs = (const struct hda_verb[]) {
1320 			/* change to EAPD mode */
1321 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1322 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x3070 },
1323 			{}
1324 		},
1325 		.chained = true,
1326 		.chain_id = ALC880_FIXUP_GPIO2,
1327 	},
1328 	[ALC880_FIXUP_VOL_KNOB] = {
1329 		.type = HDA_FIXUP_FUNC,
1330 		.v.func = alc880_fixup_vol_knob,
1331 	},
1332 	[ALC880_FIXUP_FUJITSU] = {
1333 		/* override all pins as BIOS on old Amilo is broken */
1334 		.type = HDA_FIXUP_PINS,
1335 		.v.pins = (const struct hda_pintbl[]) {
1336 			{ 0x14, 0x0121401f }, /* HP */
1337 			{ 0x15, 0x99030120 }, /* speaker */
1338 			{ 0x16, 0x99030130 }, /* bass speaker */
1339 			{ 0x17, 0x411111f0 }, /* N/A */
1340 			{ 0x18, 0x411111f0 }, /* N/A */
1341 			{ 0x19, 0x01a19950 }, /* mic-in */
1342 			{ 0x1a, 0x411111f0 }, /* N/A */
1343 			{ 0x1b, 0x411111f0 }, /* N/A */
1344 			{ 0x1c, 0x411111f0 }, /* N/A */
1345 			{ 0x1d, 0x411111f0 }, /* N/A */
1346 			{ 0x1e, 0x01454140 }, /* SPDIF out */
1347 			{ }
1348 		},
1349 		.chained = true,
1350 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1351 	},
1352 	[ALC880_FIXUP_F1734] = {
1353 		/* almost compatible with FUJITSU, but no bass and SPDIF */
1354 		.type = HDA_FIXUP_PINS,
1355 		.v.pins = (const struct hda_pintbl[]) {
1356 			{ 0x14, 0x0121401f }, /* HP */
1357 			{ 0x15, 0x99030120 }, /* speaker */
1358 			{ 0x16, 0x411111f0 }, /* N/A */
1359 			{ 0x17, 0x411111f0 }, /* N/A */
1360 			{ 0x18, 0x411111f0 }, /* N/A */
1361 			{ 0x19, 0x01a19950 }, /* mic-in */
1362 			{ 0x1a, 0x411111f0 }, /* N/A */
1363 			{ 0x1b, 0x411111f0 }, /* N/A */
1364 			{ 0x1c, 0x411111f0 }, /* N/A */
1365 			{ 0x1d, 0x411111f0 }, /* N/A */
1366 			{ 0x1e, 0x411111f0 }, /* N/A */
1367 			{ }
1368 		},
1369 		.chained = true,
1370 		.chain_id = ALC880_FIXUP_VOL_KNOB,
1371 	},
1372 	[ALC880_FIXUP_UNIWILL] = {
1373 		/* need to fix HP and speaker pins to be parsed correctly */
1374 		.type = HDA_FIXUP_PINS,
1375 		.v.pins = (const struct hda_pintbl[]) {
1376 			{ 0x14, 0x0121411f }, /* HP */
1377 			{ 0x15, 0x99030120 }, /* speaker */
1378 			{ 0x16, 0x99030130 }, /* bass speaker */
1379 			{ }
1380 		},
1381 	},
1382 	[ALC880_FIXUP_UNIWILL_DIG] = {
1383 		.type = HDA_FIXUP_PINS,
1384 		.v.pins = (const struct hda_pintbl[]) {
1385 			/* disable bogus unused pins */
1386 			{ 0x17, 0x411111f0 },
1387 			{ 0x19, 0x411111f0 },
1388 			{ 0x1b, 0x411111f0 },
1389 			{ 0x1f, 0x411111f0 },
1390 			{ }
1391 		}
1392 	},
1393 	[ALC880_FIXUP_Z71V] = {
1394 		.type = HDA_FIXUP_PINS,
1395 		.v.pins = (const struct hda_pintbl[]) {
1396 			/* set up the whole pins as BIOS is utterly broken */
1397 			{ 0x14, 0x99030120 }, /* speaker */
1398 			{ 0x15, 0x0121411f }, /* HP */
1399 			{ 0x16, 0x411111f0 }, /* N/A */
1400 			{ 0x17, 0x411111f0 }, /* N/A */
1401 			{ 0x18, 0x01a19950 }, /* mic-in */
1402 			{ 0x19, 0x411111f0 }, /* N/A */
1403 			{ 0x1a, 0x01813031 }, /* line-in */
1404 			{ 0x1b, 0x411111f0 }, /* N/A */
1405 			{ 0x1c, 0x411111f0 }, /* N/A */
1406 			{ 0x1d, 0x411111f0 }, /* N/A */
1407 			{ 0x1e, 0x0144111e }, /* SPDIF */
1408 			{ }
1409 		}
1410 	},
1411 	[ALC880_FIXUP_ASUS_W5A] = {
1412 		.type = HDA_FIXUP_PINS,
1413 		.v.pins = (const struct hda_pintbl[]) {
1414 			/* set up the whole pins as BIOS is utterly broken */
1415 			{ 0x14, 0x0121411f }, /* HP */
1416 			{ 0x15, 0x411111f0 }, /* N/A */
1417 			{ 0x16, 0x411111f0 }, /* N/A */
1418 			{ 0x17, 0x411111f0 }, /* N/A */
1419 			{ 0x18, 0x90a60160 }, /* mic */
1420 			{ 0x19, 0x411111f0 }, /* N/A */
1421 			{ 0x1a, 0x411111f0 }, /* N/A */
1422 			{ 0x1b, 0x411111f0 }, /* N/A */
1423 			{ 0x1c, 0x411111f0 }, /* N/A */
1424 			{ 0x1d, 0x411111f0 }, /* N/A */
1425 			{ 0x1e, 0xb743111e }, /* SPDIF out */
1426 			{ }
1427 		},
1428 		.chained = true,
1429 		.chain_id = ALC880_FIXUP_GPIO1,
1430 	},
1431 	[ALC880_FIXUP_3ST_BASE] = {
1432 		.type = HDA_FIXUP_PINS,
1433 		.v.pins = (const struct hda_pintbl[]) {
1434 			{ 0x14, 0x01014010 }, /* line-out */
1435 			{ 0x15, 0x411111f0 }, /* N/A */
1436 			{ 0x16, 0x411111f0 }, /* N/A */
1437 			{ 0x17, 0x411111f0 }, /* N/A */
1438 			{ 0x18, 0x01a19c30 }, /* mic-in */
1439 			{ 0x19, 0x0121411f }, /* HP */
1440 			{ 0x1a, 0x01813031 }, /* line-in */
1441 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1442 			{ 0x1c, 0x411111f0 }, /* N/A */
1443 			{ 0x1d, 0x411111f0 }, /* N/A */
1444 			/* 0x1e is filled in below */
1445 			{ 0x1f, 0x411111f0 }, /* N/A */
1446 			{ }
1447 		}
1448 	},
1449 	[ALC880_FIXUP_3ST] = {
1450 		.type = HDA_FIXUP_PINS,
1451 		.v.pins = (const struct hda_pintbl[]) {
1452 			{ 0x1e, 0x411111f0 }, /* N/A */
1453 			{ }
1454 		},
1455 		.chained = true,
1456 		.chain_id = ALC880_FIXUP_3ST_BASE,
1457 	},
1458 	[ALC880_FIXUP_3ST_DIG] = {
1459 		.type = HDA_FIXUP_PINS,
1460 		.v.pins = (const struct hda_pintbl[]) {
1461 			{ 0x1e, 0x0144111e }, /* SPDIF */
1462 			{ }
1463 		},
1464 		.chained = true,
1465 		.chain_id = ALC880_FIXUP_3ST_BASE,
1466 	},
1467 	[ALC880_FIXUP_5ST_BASE] = {
1468 		.type = HDA_FIXUP_PINS,
1469 		.v.pins = (const struct hda_pintbl[]) {
1470 			{ 0x14, 0x01014010 }, /* front */
1471 			{ 0x15, 0x411111f0 }, /* N/A */
1472 			{ 0x16, 0x01011411 }, /* CLFE */
1473 			{ 0x17, 0x01016412 }, /* surr */
1474 			{ 0x18, 0x01a19c30 }, /* mic-in */
1475 			{ 0x19, 0x0121411f }, /* HP */
1476 			{ 0x1a, 0x01813031 }, /* line-in */
1477 			{ 0x1b, 0x02a19c40 }, /* front-mic */
1478 			{ 0x1c, 0x411111f0 }, /* N/A */
1479 			{ 0x1d, 0x411111f0 }, /* N/A */
1480 			/* 0x1e is filled in below */
1481 			{ 0x1f, 0x411111f0 }, /* N/A */
1482 			{ }
1483 		}
1484 	},
1485 	[ALC880_FIXUP_5ST] = {
1486 		.type = HDA_FIXUP_PINS,
1487 		.v.pins = (const struct hda_pintbl[]) {
1488 			{ 0x1e, 0x411111f0 }, /* N/A */
1489 			{ }
1490 		},
1491 		.chained = true,
1492 		.chain_id = ALC880_FIXUP_5ST_BASE,
1493 	},
1494 	[ALC880_FIXUP_5ST_DIG] = {
1495 		.type = HDA_FIXUP_PINS,
1496 		.v.pins = (const struct hda_pintbl[]) {
1497 			{ 0x1e, 0x0144111e }, /* SPDIF */
1498 			{ }
1499 		},
1500 		.chained = true,
1501 		.chain_id = ALC880_FIXUP_5ST_BASE,
1502 	},
1503 	[ALC880_FIXUP_6ST_BASE] = {
1504 		.type = HDA_FIXUP_PINS,
1505 		.v.pins = (const struct hda_pintbl[]) {
1506 			{ 0x14, 0x01014010 }, /* front */
1507 			{ 0x15, 0x01016412 }, /* surr */
1508 			{ 0x16, 0x01011411 }, /* CLFE */
1509 			{ 0x17, 0x01012414 }, /* side */
1510 			{ 0x18, 0x01a19c30 }, /* mic-in */
1511 			{ 0x19, 0x02a19c40 }, /* front-mic */
1512 			{ 0x1a, 0x01813031 }, /* line-in */
1513 			{ 0x1b, 0x0121411f }, /* HP */
1514 			{ 0x1c, 0x411111f0 }, /* N/A */
1515 			{ 0x1d, 0x411111f0 }, /* N/A */
1516 			/* 0x1e is filled in below */
1517 			{ 0x1f, 0x411111f0 }, /* N/A */
1518 			{ }
1519 		}
1520 	},
1521 	[ALC880_FIXUP_6ST] = {
1522 		.type = HDA_FIXUP_PINS,
1523 		.v.pins = (const struct hda_pintbl[]) {
1524 			{ 0x1e, 0x411111f0 }, /* N/A */
1525 			{ }
1526 		},
1527 		.chained = true,
1528 		.chain_id = ALC880_FIXUP_6ST_BASE,
1529 	},
1530 	[ALC880_FIXUP_6ST_DIG] = {
1531 		.type = HDA_FIXUP_PINS,
1532 		.v.pins = (const struct hda_pintbl[]) {
1533 			{ 0x1e, 0x0144111e }, /* SPDIF */
1534 			{ }
1535 		},
1536 		.chained = true,
1537 		.chain_id = ALC880_FIXUP_6ST_BASE,
1538 	},
1539 	[ALC880_FIXUP_6ST_AUTOMUTE] = {
1540 		.type = HDA_FIXUP_PINS,
1541 		.v.pins = (const struct hda_pintbl[]) {
1542 			{ 0x1b, 0x0121401f }, /* HP with jack detect */
1543 			{ }
1544 		},
1545 		.chained_before = true,
1546 		.chain_id = ALC880_FIXUP_6ST_BASE,
1547 	},
1548 };
1549 
1550 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
1551 	SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
1552 	SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
1553 	SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
1554 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
1555 	SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
1556 	SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
1557 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
1558 	SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
1559 	SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
1560 	SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
1561 	SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
1562 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
1563 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
1564 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
1565 	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
1566 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
1567 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
1568 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
1569 	SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1570 	SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1571 	SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1572 	SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
1573 	SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
1574 
1575 	/* Below is the copied entries from alc880_quirks.c.
1576 	 * It's not quite sure whether BIOS sets the correct pin-config table
1577 	 * on these machines, thus they are kept to be compatible with
1578 	 * the old static quirks.  Once when it's confirmed to work without
1579 	 * these overrides, it'd be better to remove.
1580 	 */
1581 	SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1582 	SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1583 	SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1584 	SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1585 	SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1586 	SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1587 	SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1588 	SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1589 	SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1590 	SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1591 	SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1592 	SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1593 	SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1594 	SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1595 	SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1596 	SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1597 	SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1598 	SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1599 	SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1600 	SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1601 	SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1602 	SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1603 	SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1604 	SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1605 	SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1606 	SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1607 	SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1608 	SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1609 	SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1610 	SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1611 	SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1612 	SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1613 	SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1614 	/* default Intel */
1615 	SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1616 	SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1617 	SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1618 	{}
1619 };
1620 
1621 static const struct hda_model_fixup alc880_fixup_models[] = {
1622 	{.id = ALC880_FIXUP_3ST, .name = "3stack"},
1623 	{.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1624 	{.id = ALC880_FIXUP_5ST, .name = "5stack"},
1625 	{.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1626 	{.id = ALC880_FIXUP_6ST, .name = "6stack"},
1627 	{.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1628 	{.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1629 	{}
1630 };
1631 
1632 
1633 /*
1634  * OK, here we have finally the patch for ALC880
1635  */
1636 static int patch_alc880(struct hda_codec *codec)
1637 {
1638 	struct alc_spec *spec;
1639 	int err;
1640 
1641 	err = alc_alloc_spec(codec, 0x0b);
1642 	if (err < 0)
1643 		return err;
1644 
1645 	spec = codec->spec;
1646 	spec->gen.need_dac_fix = 1;
1647 	spec->gen.beep_nid = 0x01;
1648 
1649 	codec->patch_ops.unsol_event = alc880_unsol_event;
1650 
1651 	alc_pre_init(codec);
1652 
1653 	snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1654 		       alc880_fixups);
1655 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1656 
1657 	/* automatic parse from the BIOS config */
1658 	err = alc880_parse_auto_config(codec);
1659 	if (err < 0)
1660 		goto error;
1661 
1662 	if (!spec->gen.no_analog) {
1663 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1664 		if (err < 0)
1665 			goto error;
1666 	}
1667 
1668 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1669 
1670 	return 0;
1671 
1672  error:
1673 	alc_free(codec);
1674 	return err;
1675 }
1676 
1677 
1678 /*
1679  * ALC260 support
1680  */
1681 static int alc260_parse_auto_config(struct hda_codec *codec)
1682 {
1683 	static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
1684 	static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1685 	return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1686 }
1687 
1688 /*
1689  * Pin config fixes
1690  */
1691 enum {
1692 	ALC260_FIXUP_HP_DC5750,
1693 	ALC260_FIXUP_HP_PIN_0F,
1694 	ALC260_FIXUP_COEF,
1695 	ALC260_FIXUP_GPIO1,
1696 	ALC260_FIXUP_GPIO1_TOGGLE,
1697 	ALC260_FIXUP_REPLACER,
1698 	ALC260_FIXUP_HP_B1900,
1699 	ALC260_FIXUP_KN1,
1700 	ALC260_FIXUP_FSC_S7020,
1701 	ALC260_FIXUP_FSC_S7020_JWSE,
1702 	ALC260_FIXUP_VAIO_PINS,
1703 };
1704 
1705 static void alc260_gpio1_automute(struct hda_codec *codec)
1706 {
1707 	struct alc_spec *spec = codec->spec;
1708 
1709 	alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1710 }
1711 
1712 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1713 				      const struct hda_fixup *fix, int action)
1714 {
1715 	struct alc_spec *spec = codec->spec;
1716 	if (action == HDA_FIXUP_ACT_PROBE) {
1717 		/* although the machine has only one output pin, we need to
1718 		 * toggle GPIO1 according to the jack state
1719 		 */
1720 		spec->gen.automute_hook = alc260_gpio1_automute;
1721 		spec->gen.detect_hp = 1;
1722 		spec->gen.automute_speaker = 1;
1723 		spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
1724 		snd_hda_jack_detect_enable_callback(codec, 0x0f,
1725 						    snd_hda_gen_hp_automute);
1726 		alc_setup_gpio(codec, 0x01);
1727 	}
1728 }
1729 
1730 static void alc260_fixup_kn1(struct hda_codec *codec,
1731 			     const struct hda_fixup *fix, int action)
1732 {
1733 	struct alc_spec *spec = codec->spec;
1734 	static const struct hda_pintbl pincfgs[] = {
1735 		{ 0x0f, 0x02214000 }, /* HP/speaker */
1736 		{ 0x12, 0x90a60160 }, /* int mic */
1737 		{ 0x13, 0x02a19000 }, /* ext mic */
1738 		{ 0x18, 0x01446000 }, /* SPDIF out */
1739 		/* disable bogus I/O pins */
1740 		{ 0x10, 0x411111f0 },
1741 		{ 0x11, 0x411111f0 },
1742 		{ 0x14, 0x411111f0 },
1743 		{ 0x15, 0x411111f0 },
1744 		{ 0x16, 0x411111f0 },
1745 		{ 0x17, 0x411111f0 },
1746 		{ 0x19, 0x411111f0 },
1747 		{ }
1748 	};
1749 
1750 	switch (action) {
1751 	case HDA_FIXUP_ACT_PRE_PROBE:
1752 		snd_hda_apply_pincfgs(codec, pincfgs);
1753 		spec->init_amp = ALC_INIT_NONE;
1754 		break;
1755 	}
1756 }
1757 
1758 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1759 				   const struct hda_fixup *fix, int action)
1760 {
1761 	struct alc_spec *spec = codec->spec;
1762 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
1763 		spec->init_amp = ALC_INIT_NONE;
1764 }
1765 
1766 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1767 				   const struct hda_fixup *fix, int action)
1768 {
1769 	struct alc_spec *spec = codec->spec;
1770 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1771 		spec->gen.add_jack_modes = 1;
1772 		spec->gen.hp_mic = 1;
1773 	}
1774 }
1775 
1776 static const struct hda_fixup alc260_fixups[] = {
1777 	[ALC260_FIXUP_HP_DC5750] = {
1778 		.type = HDA_FIXUP_PINS,
1779 		.v.pins = (const struct hda_pintbl[]) {
1780 			{ 0x11, 0x90130110 }, /* speaker */
1781 			{ }
1782 		}
1783 	},
1784 	[ALC260_FIXUP_HP_PIN_0F] = {
1785 		.type = HDA_FIXUP_PINS,
1786 		.v.pins = (const struct hda_pintbl[]) {
1787 			{ 0x0f, 0x01214000 }, /* HP */
1788 			{ }
1789 		}
1790 	},
1791 	[ALC260_FIXUP_COEF] = {
1792 		.type = HDA_FIXUP_VERBS,
1793 		.v.verbs = (const struct hda_verb[]) {
1794 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1795 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3040 },
1796 			{ }
1797 		},
1798 	},
1799 	[ALC260_FIXUP_GPIO1] = {
1800 		.type = HDA_FIXUP_FUNC,
1801 		.v.func = alc_fixup_gpio1,
1802 	},
1803 	[ALC260_FIXUP_GPIO1_TOGGLE] = {
1804 		.type = HDA_FIXUP_FUNC,
1805 		.v.func = alc260_fixup_gpio1_toggle,
1806 		.chained = true,
1807 		.chain_id = ALC260_FIXUP_HP_PIN_0F,
1808 	},
1809 	[ALC260_FIXUP_REPLACER] = {
1810 		.type = HDA_FIXUP_VERBS,
1811 		.v.verbs = (const struct hda_verb[]) {
1812 			{ 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1813 			{ 0x1a, AC_VERB_SET_PROC_COEF,  0x3050 },
1814 			{ }
1815 		},
1816 		.chained = true,
1817 		.chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1818 	},
1819 	[ALC260_FIXUP_HP_B1900] = {
1820 		.type = HDA_FIXUP_FUNC,
1821 		.v.func = alc260_fixup_gpio1_toggle,
1822 		.chained = true,
1823 		.chain_id = ALC260_FIXUP_COEF,
1824 	},
1825 	[ALC260_FIXUP_KN1] = {
1826 		.type = HDA_FIXUP_FUNC,
1827 		.v.func = alc260_fixup_kn1,
1828 	},
1829 	[ALC260_FIXUP_FSC_S7020] = {
1830 		.type = HDA_FIXUP_FUNC,
1831 		.v.func = alc260_fixup_fsc_s7020,
1832 	},
1833 	[ALC260_FIXUP_FSC_S7020_JWSE] = {
1834 		.type = HDA_FIXUP_FUNC,
1835 		.v.func = alc260_fixup_fsc_s7020_jwse,
1836 		.chained = true,
1837 		.chain_id = ALC260_FIXUP_FSC_S7020,
1838 	},
1839 	[ALC260_FIXUP_VAIO_PINS] = {
1840 		.type = HDA_FIXUP_PINS,
1841 		.v.pins = (const struct hda_pintbl[]) {
1842 			/* Pin configs are missing completely on some VAIOs */
1843 			{ 0x0f, 0x01211020 },
1844 			{ 0x10, 0x0001003f },
1845 			{ 0x11, 0x411111f0 },
1846 			{ 0x12, 0x01a15930 },
1847 			{ 0x13, 0x411111f0 },
1848 			{ 0x14, 0x411111f0 },
1849 			{ 0x15, 0x411111f0 },
1850 			{ 0x16, 0x411111f0 },
1851 			{ 0x17, 0x411111f0 },
1852 			{ 0x18, 0x411111f0 },
1853 			{ 0x19, 0x411111f0 },
1854 			{ }
1855 		}
1856 	},
1857 };
1858 
1859 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
1860 	SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
1861 	SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
1862 	SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
1863 	SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
1864 	SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
1865 	SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
1866 	SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
1867 	SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
1868 	SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
1869 	SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
1870 	SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
1871 	SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
1872 	{}
1873 };
1874 
1875 static const struct hda_model_fixup alc260_fixup_models[] = {
1876 	{.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1877 	{.id = ALC260_FIXUP_COEF, .name = "coef"},
1878 	{.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1879 	{.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1880 	{}
1881 };
1882 
1883 /*
1884  */
1885 static int patch_alc260(struct hda_codec *codec)
1886 {
1887 	struct alc_spec *spec;
1888 	int err;
1889 
1890 	err = alc_alloc_spec(codec, 0x07);
1891 	if (err < 0)
1892 		return err;
1893 
1894 	spec = codec->spec;
1895 	/* as quite a few machines require HP amp for speaker outputs,
1896 	 * it's easier to enable it unconditionally; even if it's unneeded,
1897 	 * it's almost harmless.
1898 	 */
1899 	spec->gen.prefer_hp_amp = 1;
1900 	spec->gen.beep_nid = 0x01;
1901 
1902 	spec->shutup = alc_eapd_shutup;
1903 
1904 	alc_pre_init(codec);
1905 
1906 	snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1907 			   alc260_fixups);
1908 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1909 
1910 	/* automatic parse from the BIOS config */
1911 	err = alc260_parse_auto_config(codec);
1912 	if (err < 0)
1913 		goto error;
1914 
1915 	if (!spec->gen.no_analog) {
1916 		err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1917 		if (err < 0)
1918 			goto error;
1919 	}
1920 
1921 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1922 
1923 	return 0;
1924 
1925  error:
1926 	alc_free(codec);
1927 	return err;
1928 }
1929 
1930 
1931 /*
1932  * ALC882/883/885/888/889 support
1933  *
1934  * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1935  * configuration.  Each pin widget can choose any input DACs and a mixer.
1936  * Each ADC is connected from a mixer of all inputs.  This makes possible
1937  * 6-channel independent captures.
1938  *
1939  * In addition, an independent DAC for the multi-playback (not used in this
1940  * driver yet).
1941  */
1942 
1943 /*
1944  * Pin config fixes
1945  */
1946 enum {
1947 	ALC882_FIXUP_ABIT_AW9D_MAX,
1948 	ALC882_FIXUP_LENOVO_Y530,
1949 	ALC882_FIXUP_PB_M5210,
1950 	ALC882_FIXUP_ACER_ASPIRE_7736,
1951 	ALC882_FIXUP_ASUS_W90V,
1952 	ALC889_FIXUP_CD,
1953 	ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
1954 	ALC889_FIXUP_VAIO_TT,
1955 	ALC888_FIXUP_EEE1601,
1956 	ALC886_FIXUP_EAPD,
1957 	ALC882_FIXUP_EAPD,
1958 	ALC883_FIXUP_EAPD,
1959 	ALC883_FIXUP_ACER_EAPD,
1960 	ALC882_FIXUP_GPIO1,
1961 	ALC882_FIXUP_GPIO2,
1962 	ALC882_FIXUP_GPIO3,
1963 	ALC889_FIXUP_COEF,
1964 	ALC882_FIXUP_ASUS_W2JC,
1965 	ALC882_FIXUP_ACER_ASPIRE_4930G,
1966 	ALC882_FIXUP_ACER_ASPIRE_8930G,
1967 	ALC882_FIXUP_ASPIRE_8930G_VERBS,
1968 	ALC885_FIXUP_MACPRO_GPIO,
1969 	ALC889_FIXUP_DAC_ROUTE,
1970 	ALC889_FIXUP_MBP_VREF,
1971 	ALC889_FIXUP_IMAC91_VREF,
1972 	ALC889_FIXUP_MBA11_VREF,
1973 	ALC889_FIXUP_MBA21_VREF,
1974 	ALC889_FIXUP_MP11_VREF,
1975 	ALC889_FIXUP_MP41_VREF,
1976 	ALC882_FIXUP_INV_DMIC,
1977 	ALC882_FIXUP_NO_PRIMARY_HP,
1978 	ALC887_FIXUP_ASUS_BASS,
1979 	ALC887_FIXUP_BASS_CHMAP,
1980 	ALC1220_FIXUP_GB_DUAL_CODECS,
1981 	ALC1220_FIXUP_GB_X570,
1982 	ALC1220_FIXUP_CLEVO_P950,
1983 	ALC1220_FIXUP_CLEVO_PB51ED,
1984 	ALC1220_FIXUP_CLEVO_PB51ED_PINS,
1985 	ALC887_FIXUP_ASUS_AUDIO,
1986 	ALC887_FIXUP_ASUS_HMIC,
1987 	ALCS1200A_FIXUP_MIC_VREF,
1988 };
1989 
1990 static void alc889_fixup_coef(struct hda_codec *codec,
1991 			      const struct hda_fixup *fix, int action)
1992 {
1993 	if (action != HDA_FIXUP_ACT_INIT)
1994 		return;
1995 	alc_update_coef_idx(codec, 7, 0, 0x2030);
1996 }
1997 
1998 /* set up GPIO at initialization */
1999 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2000 				     const struct hda_fixup *fix, int action)
2001 {
2002 	struct alc_spec *spec = codec->spec;
2003 
2004 	spec->gpio_write_delay = true;
2005 	alc_fixup_gpio3(codec, fix, action);
2006 }
2007 
2008 /* Fix the connection of some pins for ALC889:
2009  * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
2010  * work correctly (bko#42740)
2011  */
2012 static void alc889_fixup_dac_route(struct hda_codec *codec,
2013 				   const struct hda_fixup *fix, int action)
2014 {
2015 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2016 		/* fake the connections during parsing the tree */
2017 		static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2018 		static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2019 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2020 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2021 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2022 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2023 	} else if (action == HDA_FIXUP_ACT_PROBE) {
2024 		/* restore the connections */
2025 		static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2026 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2027 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2028 		snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2029 		snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2030 	}
2031 }
2032 
2033 /* Set VREF on HP pin */
2034 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2035 				  const struct hda_fixup *fix, int action)
2036 {
2037 	static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
2038 	struct alc_spec *spec = codec->spec;
2039 	int i;
2040 
2041 	if (action != HDA_FIXUP_ACT_INIT)
2042 		return;
2043 	for (i = 0; i < ARRAY_SIZE(nids); i++) {
2044 		unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2045 		if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2046 			continue;
2047 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2048 		val |= AC_PINCTL_VREF_80;
2049 		snd_hda_set_pin_ctl(codec, nids[i], val);
2050 		spec->gen.keep_vref_in_automute = 1;
2051 		break;
2052 	}
2053 }
2054 
2055 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2056 				  const hda_nid_t *nids, int num_nids)
2057 {
2058 	struct alc_spec *spec = codec->spec;
2059 	int i;
2060 
2061 	for (i = 0; i < num_nids; i++) {
2062 		unsigned int val;
2063 		val = snd_hda_codec_get_pin_target(codec, nids[i]);
2064 		val |= AC_PINCTL_VREF_50;
2065 		snd_hda_set_pin_ctl(codec, nids[i], val);
2066 	}
2067 	spec->gen.keep_vref_in_automute = 1;
2068 }
2069 
2070 /* Set VREF on speaker pins on imac91 */
2071 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2072 				     const struct hda_fixup *fix, int action)
2073 {
2074 	static const hda_nid_t nids[] = { 0x18, 0x1a };
2075 
2076 	if (action == HDA_FIXUP_ACT_INIT)
2077 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2078 }
2079 
2080 /* Set VREF on speaker pins on mba11 */
2081 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2082 				    const struct hda_fixup *fix, int action)
2083 {
2084 	static const hda_nid_t nids[] = { 0x18 };
2085 
2086 	if (action == HDA_FIXUP_ACT_INIT)
2087 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2088 }
2089 
2090 /* Set VREF on speaker pins on mba21 */
2091 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2092 				    const struct hda_fixup *fix, int action)
2093 {
2094 	static const hda_nid_t nids[] = { 0x18, 0x19 };
2095 
2096 	if (action == HDA_FIXUP_ACT_INIT)
2097 		alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2098 }
2099 
2100 /* Don't take HP output as primary
2101  * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2102  * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2103  */
2104 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2105 				       const struct hda_fixup *fix, int action)
2106 {
2107 	struct alc_spec *spec = codec->spec;
2108 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2109 		spec->gen.no_primary_hp = 1;
2110 		spec->gen.no_multi_io = 1;
2111 	}
2112 }
2113 
2114 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2115 				 const struct hda_fixup *fix, int action);
2116 
2117 /* For dual-codec configuration, we need to disable some features to avoid
2118  * conflicts of kctls and PCM streams
2119  */
2120 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2121 				  const struct hda_fixup *fix, int action)
2122 {
2123 	struct alc_spec *spec = codec->spec;
2124 
2125 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2126 		return;
2127 	/* disable vmaster */
2128 	spec->gen.suppress_vmaster = 1;
2129 	/* auto-mute and auto-mic switch don't work with multiple codecs */
2130 	spec->gen.suppress_auto_mute = 1;
2131 	spec->gen.suppress_auto_mic = 1;
2132 	/* disable aamix as well */
2133 	spec->gen.mixer_nid = 0;
2134 	/* add location prefix to avoid conflicts */
2135 	codec->force_pin_prefix = 1;
2136 }
2137 
2138 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2139 		       const char *newname)
2140 {
2141 	struct snd_kcontrol *kctl;
2142 
2143 	kctl = snd_hda_find_mixer_ctl(codec, oldname);
2144 	if (kctl)
2145 		snd_ctl_rename(codec->card, kctl, newname);
2146 }
2147 
2148 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2149 					 const struct hda_fixup *fix,
2150 					 int action)
2151 {
2152 	alc_fixup_dual_codecs(codec, fix, action);
2153 	switch (action) {
2154 	case HDA_FIXUP_ACT_PRE_PROBE:
2155 		/* override card longname to provide a unique UCM profile */
2156 		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2157 		break;
2158 	case HDA_FIXUP_ACT_BUILD:
2159 		/* rename Capture controls depending on the codec */
2160 		rename_ctl(codec, "Capture Volume",
2161 			   codec->addr == 0 ?
2162 			   "Rear-Panel Capture Volume" :
2163 			   "Front-Panel Capture Volume");
2164 		rename_ctl(codec, "Capture Switch",
2165 			   codec->addr == 0 ?
2166 			   "Rear-Panel Capture Switch" :
2167 			   "Front-Panel Capture Switch");
2168 		break;
2169 	}
2170 }
2171 
2172 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2173 				     const struct hda_fixup *fix,
2174 				     int action)
2175 {
2176 	static const hda_nid_t conn1[] = { 0x0c };
2177 	static const struct coef_fw gb_x570_coefs[] = {
2178 		WRITE_COEF(0x07, 0x03c0),
2179 		WRITE_COEF(0x1a, 0x01c1),
2180 		WRITE_COEF(0x1b, 0x0202),
2181 		WRITE_COEF(0x43, 0x3005),
2182 		{}
2183 	};
2184 
2185 	switch (action) {
2186 	case HDA_FIXUP_ACT_PRE_PROBE:
2187 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2188 		snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2189 		break;
2190 	case HDA_FIXUP_ACT_INIT:
2191 		alc_process_coef_fw(codec, gb_x570_coefs);
2192 		break;
2193 	}
2194 }
2195 
2196 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2197 				     const struct hda_fixup *fix,
2198 				     int action)
2199 {
2200 	static const hda_nid_t conn1[] = { 0x0c };
2201 
2202 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
2203 		return;
2204 
2205 	alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2206 	/* We therefore want to make sure 0x14 (front headphone) and
2207 	 * 0x1b (speakers) use the stereo DAC 0x02
2208 	 */
2209 	snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2210 	snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2211 }
2212 
2213 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2214 				const struct hda_fixup *fix, int action);
2215 
2216 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2217 				     const struct hda_fixup *fix,
2218 				     int action)
2219 {
2220 	alc1220_fixup_clevo_p950(codec, fix, action);
2221 	alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2222 }
2223 
2224 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2225 					 struct hda_jack_callback *jack)
2226 {
2227 	struct alc_spec *spec = codec->spec;
2228 	unsigned int vref;
2229 
2230 	snd_hda_gen_hp_automute(codec, jack);
2231 
2232 	if (spec->gen.hp_jack_present)
2233 		vref = AC_PINCTL_VREF_80;
2234 	else
2235 		vref = AC_PINCTL_VREF_HIZ;
2236 	snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2237 }
2238 
2239 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2240 				     const struct hda_fixup *fix, int action)
2241 {
2242 	struct alc_spec *spec = codec->spec;
2243 	if (action != HDA_FIXUP_ACT_PROBE)
2244 		return;
2245 	snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2246 	spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2247 }
2248 
2249 static const struct hda_fixup alc882_fixups[] = {
2250 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
2251 		.type = HDA_FIXUP_PINS,
2252 		.v.pins = (const struct hda_pintbl[]) {
2253 			{ 0x15, 0x01080104 }, /* side */
2254 			{ 0x16, 0x01011012 }, /* rear */
2255 			{ 0x17, 0x01016011 }, /* clfe */
2256 			{ }
2257 		}
2258 	},
2259 	[ALC882_FIXUP_LENOVO_Y530] = {
2260 		.type = HDA_FIXUP_PINS,
2261 		.v.pins = (const struct hda_pintbl[]) {
2262 			{ 0x15, 0x99130112 }, /* rear int speakers */
2263 			{ 0x16, 0x99130111 }, /* subwoofer */
2264 			{ }
2265 		}
2266 	},
2267 	[ALC882_FIXUP_PB_M5210] = {
2268 		.type = HDA_FIXUP_PINCTLS,
2269 		.v.pins = (const struct hda_pintbl[]) {
2270 			{ 0x19, PIN_VREF50 },
2271 			{}
2272 		}
2273 	},
2274 	[ALC882_FIXUP_ACER_ASPIRE_7736] = {
2275 		.type = HDA_FIXUP_FUNC,
2276 		.v.func = alc_fixup_sku_ignore,
2277 	},
2278 	[ALC882_FIXUP_ASUS_W90V] = {
2279 		.type = HDA_FIXUP_PINS,
2280 		.v.pins = (const struct hda_pintbl[]) {
2281 			{ 0x16, 0x99130110 }, /* fix sequence for CLFE */
2282 			{ }
2283 		}
2284 	},
2285 	[ALC889_FIXUP_CD] = {
2286 		.type = HDA_FIXUP_PINS,
2287 		.v.pins = (const struct hda_pintbl[]) {
2288 			{ 0x1c, 0x993301f0 }, /* CD */
2289 			{ }
2290 		}
2291 	},
2292 	[ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2293 		.type = HDA_FIXUP_PINS,
2294 		.v.pins = (const struct hda_pintbl[]) {
2295 			{ 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2296 			{ }
2297 		},
2298 		.chained = true,
2299 		.chain_id = ALC889_FIXUP_CD,
2300 	},
2301 	[ALC889_FIXUP_VAIO_TT] = {
2302 		.type = HDA_FIXUP_PINS,
2303 		.v.pins = (const struct hda_pintbl[]) {
2304 			{ 0x17, 0x90170111 }, /* hidden surround speaker */
2305 			{ }
2306 		}
2307 	},
2308 	[ALC888_FIXUP_EEE1601] = {
2309 		.type = HDA_FIXUP_VERBS,
2310 		.v.verbs = (const struct hda_verb[]) {
2311 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2312 			{ 0x20, AC_VERB_SET_PROC_COEF,  0x0838 },
2313 			{ }
2314 		}
2315 	},
2316 	[ALC886_FIXUP_EAPD] = {
2317 		.type = HDA_FIXUP_VERBS,
2318 		.v.verbs = (const struct hda_verb[]) {
2319 			/* change to EAPD mode */
2320 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2321 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2322 			{ }
2323 		}
2324 	},
2325 	[ALC882_FIXUP_EAPD] = {
2326 		.type = HDA_FIXUP_VERBS,
2327 		.v.verbs = (const struct hda_verb[]) {
2328 			/* change to EAPD mode */
2329 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2330 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2331 			{ }
2332 		}
2333 	},
2334 	[ALC883_FIXUP_EAPD] = {
2335 		.type = HDA_FIXUP_VERBS,
2336 		.v.verbs = (const struct hda_verb[]) {
2337 			/* change to EAPD mode */
2338 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2339 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2340 			{ }
2341 		}
2342 	},
2343 	[ALC883_FIXUP_ACER_EAPD] = {
2344 		.type = HDA_FIXUP_VERBS,
2345 		.v.verbs = (const struct hda_verb[]) {
2346 			/* eanable EAPD on Acer laptops */
2347 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2348 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2349 			{ }
2350 		}
2351 	},
2352 	[ALC882_FIXUP_GPIO1] = {
2353 		.type = HDA_FIXUP_FUNC,
2354 		.v.func = alc_fixup_gpio1,
2355 	},
2356 	[ALC882_FIXUP_GPIO2] = {
2357 		.type = HDA_FIXUP_FUNC,
2358 		.v.func = alc_fixup_gpio2,
2359 	},
2360 	[ALC882_FIXUP_GPIO3] = {
2361 		.type = HDA_FIXUP_FUNC,
2362 		.v.func = alc_fixup_gpio3,
2363 	},
2364 	[ALC882_FIXUP_ASUS_W2JC] = {
2365 		.type = HDA_FIXUP_FUNC,
2366 		.v.func = alc_fixup_gpio1,
2367 		.chained = true,
2368 		.chain_id = ALC882_FIXUP_EAPD,
2369 	},
2370 	[ALC889_FIXUP_COEF] = {
2371 		.type = HDA_FIXUP_FUNC,
2372 		.v.func = alc889_fixup_coef,
2373 	},
2374 	[ALC882_FIXUP_ACER_ASPIRE_4930G] = {
2375 		.type = HDA_FIXUP_PINS,
2376 		.v.pins = (const struct hda_pintbl[]) {
2377 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2378 			{ 0x17, 0x99130112 }, /* surround speaker */
2379 			{ }
2380 		},
2381 		.chained = true,
2382 		.chain_id = ALC882_FIXUP_GPIO1,
2383 	},
2384 	[ALC882_FIXUP_ACER_ASPIRE_8930G] = {
2385 		.type = HDA_FIXUP_PINS,
2386 		.v.pins = (const struct hda_pintbl[]) {
2387 			{ 0x16, 0x99130111 }, /* CLFE speaker */
2388 			{ 0x1b, 0x99130112 }, /* surround speaker */
2389 			{ }
2390 		},
2391 		.chained = true,
2392 		.chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2393 	},
2394 	[ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2395 		/* additional init verbs for Acer Aspire 8930G */
2396 		.type = HDA_FIXUP_VERBS,
2397 		.v.verbs = (const struct hda_verb[]) {
2398 			/* Enable all DACs */
2399 			/* DAC DISABLE/MUTE 1? */
2400 			/*  setting bits 1-5 disables DAC nids 0x02-0x06
2401 			 *  apparently. Init=0x38 */
2402 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2403 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2404 			/* DAC DISABLE/MUTE 2? */
2405 			/*  some bit here disables the other DACs.
2406 			 *  Init=0x4900 */
2407 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2408 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2409 			/* DMIC fix
2410 			 * This laptop has a stereo digital microphone.
2411 			 * The mics are only 1cm apart which makes the stereo
2412 			 * useless. However, either the mic or the ALC889
2413 			 * makes the signal become a difference/sum signal
2414 			 * instead of standard stereo, which is annoying.
2415 			 * So instead we flip this bit which makes the
2416 			 * codec replicate the sum signal to both channels,
2417 			 * turning it into a normal mono mic.
2418 			 */
2419 			/* DMIC_CONTROL? Init value = 0x0001 */
2420 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2421 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2422 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2423 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2424 			{ }
2425 		},
2426 		.chained = true,
2427 		.chain_id = ALC882_FIXUP_GPIO1,
2428 	},
2429 	[ALC885_FIXUP_MACPRO_GPIO] = {
2430 		.type = HDA_FIXUP_FUNC,
2431 		.v.func = alc885_fixup_macpro_gpio,
2432 	},
2433 	[ALC889_FIXUP_DAC_ROUTE] = {
2434 		.type = HDA_FIXUP_FUNC,
2435 		.v.func = alc889_fixup_dac_route,
2436 	},
2437 	[ALC889_FIXUP_MBP_VREF] = {
2438 		.type = HDA_FIXUP_FUNC,
2439 		.v.func = alc889_fixup_mbp_vref,
2440 		.chained = true,
2441 		.chain_id = ALC882_FIXUP_GPIO1,
2442 	},
2443 	[ALC889_FIXUP_IMAC91_VREF] = {
2444 		.type = HDA_FIXUP_FUNC,
2445 		.v.func = alc889_fixup_imac91_vref,
2446 		.chained = true,
2447 		.chain_id = ALC882_FIXUP_GPIO1,
2448 	},
2449 	[ALC889_FIXUP_MBA11_VREF] = {
2450 		.type = HDA_FIXUP_FUNC,
2451 		.v.func = alc889_fixup_mba11_vref,
2452 		.chained = true,
2453 		.chain_id = ALC889_FIXUP_MBP_VREF,
2454 	},
2455 	[ALC889_FIXUP_MBA21_VREF] = {
2456 		.type = HDA_FIXUP_FUNC,
2457 		.v.func = alc889_fixup_mba21_vref,
2458 		.chained = true,
2459 		.chain_id = ALC889_FIXUP_MBP_VREF,
2460 	},
2461 	[ALC889_FIXUP_MP11_VREF] = {
2462 		.type = HDA_FIXUP_FUNC,
2463 		.v.func = alc889_fixup_mba11_vref,
2464 		.chained = true,
2465 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2466 	},
2467 	[ALC889_FIXUP_MP41_VREF] = {
2468 		.type = HDA_FIXUP_FUNC,
2469 		.v.func = alc889_fixup_mbp_vref,
2470 		.chained = true,
2471 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
2472 	},
2473 	[ALC882_FIXUP_INV_DMIC] = {
2474 		.type = HDA_FIXUP_FUNC,
2475 		.v.func = alc_fixup_inv_dmic,
2476 	},
2477 	[ALC882_FIXUP_NO_PRIMARY_HP] = {
2478 		.type = HDA_FIXUP_FUNC,
2479 		.v.func = alc882_fixup_no_primary_hp,
2480 	},
2481 	[ALC887_FIXUP_ASUS_BASS] = {
2482 		.type = HDA_FIXUP_PINS,
2483 		.v.pins = (const struct hda_pintbl[]) {
2484 			{0x16, 0x99130130}, /* bass speaker */
2485 			{}
2486 		},
2487 		.chained = true,
2488 		.chain_id = ALC887_FIXUP_BASS_CHMAP,
2489 	},
2490 	[ALC887_FIXUP_BASS_CHMAP] = {
2491 		.type = HDA_FIXUP_FUNC,
2492 		.v.func = alc_fixup_bass_chmap,
2493 	},
2494 	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
2495 		.type = HDA_FIXUP_FUNC,
2496 		.v.func = alc1220_fixup_gb_dual_codecs,
2497 	},
2498 	[ALC1220_FIXUP_GB_X570] = {
2499 		.type = HDA_FIXUP_FUNC,
2500 		.v.func = alc1220_fixup_gb_x570,
2501 	},
2502 	[ALC1220_FIXUP_CLEVO_P950] = {
2503 		.type = HDA_FIXUP_FUNC,
2504 		.v.func = alc1220_fixup_clevo_p950,
2505 	},
2506 	[ALC1220_FIXUP_CLEVO_PB51ED] = {
2507 		.type = HDA_FIXUP_FUNC,
2508 		.v.func = alc1220_fixup_clevo_pb51ed,
2509 	},
2510 	[ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
2511 		.type = HDA_FIXUP_PINS,
2512 		.v.pins = (const struct hda_pintbl[]) {
2513 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2514 			{}
2515 		},
2516 		.chained = true,
2517 		.chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
2518 	},
2519 	[ALC887_FIXUP_ASUS_AUDIO] = {
2520 		.type = HDA_FIXUP_PINS,
2521 		.v.pins = (const struct hda_pintbl[]) {
2522 			{ 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2523 			{ 0x19, 0x22219420 },
2524 			{}
2525 		},
2526 	},
2527 	[ALC887_FIXUP_ASUS_HMIC] = {
2528 		.type = HDA_FIXUP_FUNC,
2529 		.v.func = alc887_fixup_asus_jack,
2530 		.chained = true,
2531 		.chain_id = ALC887_FIXUP_ASUS_AUDIO,
2532 	},
2533 	[ALCS1200A_FIXUP_MIC_VREF] = {
2534 		.type = HDA_FIXUP_PINCTLS,
2535 		.v.pins = (const struct hda_pintbl[]) {
2536 			{ 0x18, PIN_VREF50 }, /* rear mic */
2537 			{ 0x19, PIN_VREF50 }, /* front mic */
2538 			{}
2539 		}
2540 	},
2541 };
2542 
2543 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2544 	SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2545 	SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2546 	SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2547 	SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2548 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2549 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2550 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
2551 	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2552 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2553 	SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2554 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2555 	SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2556 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2557 	SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2558 		      ALC882_FIXUP_ACER_ASPIRE_8930G),
2559 	SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2560 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2561 	SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2562 	SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2563 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2564 	SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2565 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2566 	SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2567 		      ALC882_FIXUP_ACER_ASPIRE_4930G),
2568 	SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
2569 	SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
2570 	SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
2571 	SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
2572 	SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
2573 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
2574 	SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
2575 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
2576 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
2577 	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2578 	SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2579 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2580 	SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2581 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2582 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2583 	SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2584 
2585 	/* All Apple entries are in codec SSIDs */
2586 	SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2587 	SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2588 	SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2589 	SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
2590 	SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2591 	SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
2592 	SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2593 	SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
2594 	SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2595 	SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2596 	SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2597 	SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2598 	SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2599 	SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
2600 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2601 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2602 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2603 	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2604 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2605 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2606 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2607 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
2608 
2609 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
2610 	SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2611 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2612 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2613 	SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2614 	SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2615 	SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2616 	SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2617 	SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2618 	SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2619 	SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2620 	SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2621 	SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2622 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2623 	SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
2624 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2625 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2626 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2627 	SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2628 	SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2629 	SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2630 	SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2631 	SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2632 	SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2633 	SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2634 	SND_PCI_QUIRK(0x1558, 0x66a2, "Clevo PE60RNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2635 	SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2636 	SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2637 	SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2638 	SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2639 	SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2640 	SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2641 	SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2642 	SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2643 	SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2644 	SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2645 	SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2646 	SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2647 	SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2648 	SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2649 	SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2650 	SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2651 	SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2652 	SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2653 	SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2654 	SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2655 	SND_PCI_QUIRK(0x1558, 0xd502, "Clevo PD50SNE", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2656 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2657 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2658 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
2659 	SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
2660 	{}
2661 };
2662 
2663 static const struct hda_model_fixup alc882_fixup_models[] = {
2664 	{.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2665 	{.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2666 	{.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2667 	{.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2668 	{.id = ALC889_FIXUP_CD, .name = "cd"},
2669 	{.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2670 	{.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2671 	{.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2672 	{.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2673 	{.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2674 	{.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2675 	{.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2676 	{.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2677 	{.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2678 	{.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2679 	{.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2680 	{.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2681 	{.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2682 	{.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2683 	{.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2684 	{.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2685 	{.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2686 	{.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2687 	{.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2688 	{.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2689 	{.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2690 	{.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2691 	{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2692 	{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2693 	{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2694 	{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2695 	{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2696 	{}
2697 };
2698 
2699 static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2700 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2701 		{0x14, 0x01014010},
2702 		{0x15, 0x01011012},
2703 		{0x16, 0x01016011},
2704 		{0x18, 0x01a19040},
2705 		{0x19, 0x02a19050},
2706 		{0x1a, 0x0181304f},
2707 		{0x1b, 0x0221401f},
2708 		{0x1e, 0x01456130}),
2709 	SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2710 		{0x14, 0x01015010},
2711 		{0x15, 0x01011012},
2712 		{0x16, 0x01011011},
2713 		{0x18, 0x01a11040},
2714 		{0x19, 0x02a19050},
2715 		{0x1a, 0x0181104f},
2716 		{0x1b, 0x0221401f},
2717 		{0x1e, 0x01451130}),
2718 	{}
2719 };
2720 
2721 /*
2722  * BIOS auto configuration
2723  */
2724 /* almost identical with ALC880 parser... */
2725 static int alc882_parse_auto_config(struct hda_codec *codec)
2726 {
2727 	static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
2728 	static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2729 	return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2730 }
2731 
2732 /*
2733  */
2734 static int patch_alc882(struct hda_codec *codec)
2735 {
2736 	struct alc_spec *spec;
2737 	int err;
2738 
2739 	err = alc_alloc_spec(codec, 0x0b);
2740 	if (err < 0)
2741 		return err;
2742 
2743 	spec = codec->spec;
2744 
2745 	switch (codec->core.vendor_id) {
2746 	case 0x10ec0882:
2747 	case 0x10ec0885:
2748 	case 0x10ec0900:
2749 	case 0x10ec0b00:
2750 	case 0x10ec1220:
2751 		break;
2752 	default:
2753 		/* ALC883 and variants */
2754 		alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2755 		break;
2756 	}
2757 
2758 	alc_pre_init(codec);
2759 
2760 	snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2761 		       alc882_fixups);
2762 	snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2763 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2764 
2765 	alc_auto_parse_customize_define(codec);
2766 
2767 	if (has_cdefine_beep(codec))
2768 		spec->gen.beep_nid = 0x01;
2769 
2770 	/* automatic parse from the BIOS config */
2771 	err = alc882_parse_auto_config(codec);
2772 	if (err < 0)
2773 		goto error;
2774 
2775 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2776 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2777 		if (err < 0)
2778 			goto error;
2779 	}
2780 
2781 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2782 
2783 	return 0;
2784 
2785  error:
2786 	alc_free(codec);
2787 	return err;
2788 }
2789 
2790 
2791 /*
2792  * ALC262 support
2793  */
2794 static int alc262_parse_auto_config(struct hda_codec *codec)
2795 {
2796 	static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
2797 	static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2798 	return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2799 }
2800 
2801 /*
2802  * Pin config fixes
2803  */
2804 enum {
2805 	ALC262_FIXUP_FSC_H270,
2806 	ALC262_FIXUP_FSC_S7110,
2807 	ALC262_FIXUP_HP_Z200,
2808 	ALC262_FIXUP_TYAN,
2809 	ALC262_FIXUP_LENOVO_3000,
2810 	ALC262_FIXUP_BENQ,
2811 	ALC262_FIXUP_BENQ_T31,
2812 	ALC262_FIXUP_INV_DMIC,
2813 	ALC262_FIXUP_INTEL_BAYLEYBAY,
2814 };
2815 
2816 static const struct hda_fixup alc262_fixups[] = {
2817 	[ALC262_FIXUP_FSC_H270] = {
2818 		.type = HDA_FIXUP_PINS,
2819 		.v.pins = (const struct hda_pintbl[]) {
2820 			{ 0x14, 0x99130110 }, /* speaker */
2821 			{ 0x15, 0x0221142f }, /* front HP */
2822 			{ 0x1b, 0x0121141f }, /* rear HP */
2823 			{ }
2824 		}
2825 	},
2826 	[ALC262_FIXUP_FSC_S7110] = {
2827 		.type = HDA_FIXUP_PINS,
2828 		.v.pins = (const struct hda_pintbl[]) {
2829 			{ 0x15, 0x90170110 }, /* speaker */
2830 			{ }
2831 		},
2832 		.chained = true,
2833 		.chain_id = ALC262_FIXUP_BENQ,
2834 	},
2835 	[ALC262_FIXUP_HP_Z200] = {
2836 		.type = HDA_FIXUP_PINS,
2837 		.v.pins = (const struct hda_pintbl[]) {
2838 			{ 0x16, 0x99130120 }, /* internal speaker */
2839 			{ }
2840 		}
2841 	},
2842 	[ALC262_FIXUP_TYAN] = {
2843 		.type = HDA_FIXUP_PINS,
2844 		.v.pins = (const struct hda_pintbl[]) {
2845 			{ 0x14, 0x1993e1f0 }, /* int AUX */
2846 			{ }
2847 		}
2848 	},
2849 	[ALC262_FIXUP_LENOVO_3000] = {
2850 		.type = HDA_FIXUP_PINCTLS,
2851 		.v.pins = (const struct hda_pintbl[]) {
2852 			{ 0x19, PIN_VREF50 },
2853 			{}
2854 		},
2855 		.chained = true,
2856 		.chain_id = ALC262_FIXUP_BENQ,
2857 	},
2858 	[ALC262_FIXUP_BENQ] = {
2859 		.type = HDA_FIXUP_VERBS,
2860 		.v.verbs = (const struct hda_verb[]) {
2861 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2862 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2863 			{}
2864 		}
2865 	},
2866 	[ALC262_FIXUP_BENQ_T31] = {
2867 		.type = HDA_FIXUP_VERBS,
2868 		.v.verbs = (const struct hda_verb[]) {
2869 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2870 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2871 			{}
2872 		}
2873 	},
2874 	[ALC262_FIXUP_INV_DMIC] = {
2875 		.type = HDA_FIXUP_FUNC,
2876 		.v.func = alc_fixup_inv_dmic,
2877 	},
2878 	[ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2879 		.type = HDA_FIXUP_FUNC,
2880 		.v.func = alc_fixup_no_depop_delay,
2881 	},
2882 };
2883 
2884 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
2885 	SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
2886 	SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
2887 	SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
2888 	SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2889 	SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
2890 	SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
2891 	SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
2892 	SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2893 	SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2894 	SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
2895 	{}
2896 };
2897 
2898 static const struct hda_model_fixup alc262_fixup_models[] = {
2899 	{.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2900 	{.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2901 	{.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2902 	{.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2903 	{.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2904 	{.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2905 	{.id = ALC262_FIXUP_BENQ, .name = "benq"},
2906 	{.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2907 	{.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
2908 	{}
2909 };
2910 
2911 /*
2912  */
2913 static int patch_alc262(struct hda_codec *codec)
2914 {
2915 	struct alc_spec *spec;
2916 	int err;
2917 
2918 	err = alc_alloc_spec(codec, 0x0b);
2919 	if (err < 0)
2920 		return err;
2921 
2922 	spec = codec->spec;
2923 	spec->gen.shared_mic_vref_pin = 0x18;
2924 
2925 	spec->shutup = alc_eapd_shutup;
2926 
2927 #if 0
2928 	/* pshou 07/11/05  set a zero PCM sample to DAC when FIFO is
2929 	 * under-run
2930 	 */
2931 	alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2932 #endif
2933 	alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2934 
2935 	alc_pre_init(codec);
2936 
2937 	snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2938 		       alc262_fixups);
2939 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2940 
2941 	alc_auto_parse_customize_define(codec);
2942 
2943 	if (has_cdefine_beep(codec))
2944 		spec->gen.beep_nid = 0x01;
2945 
2946 	/* automatic parse from the BIOS config */
2947 	err = alc262_parse_auto_config(codec);
2948 	if (err < 0)
2949 		goto error;
2950 
2951 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
2952 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2953 		if (err < 0)
2954 			goto error;
2955 	}
2956 
2957 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2958 
2959 	return 0;
2960 
2961  error:
2962 	alc_free(codec);
2963 	return err;
2964 }
2965 
2966 /*
2967  *  ALC268
2968  */
2969 /* bind Beep switches of both NID 0x0f and 0x10 */
2970 static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2971 				  struct snd_ctl_elem_value *ucontrol)
2972 {
2973 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2974 	unsigned long pval;
2975 	int err;
2976 
2977 	mutex_lock(&codec->control_mutex);
2978 	pval = kcontrol->private_value;
2979 	kcontrol->private_value = (pval & ~0xff) | 0x0f;
2980 	err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2981 	if (err >= 0) {
2982 		kcontrol->private_value = (pval & ~0xff) | 0x10;
2983 		err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2984 	}
2985 	kcontrol->private_value = pval;
2986 	mutex_unlock(&codec->control_mutex);
2987 	return err;
2988 }
2989 
2990 static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2991 	HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2992 	{
2993 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2994 		.name = "Beep Playback Switch",
2995 		.subdevice = HDA_SUBDEV_AMP_FLAG,
2996 		.info = snd_hda_mixer_amp_switch_info,
2997 		.get = snd_hda_mixer_amp_switch_get,
2998 		.put = alc268_beep_switch_put,
2999 		.private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3000 	},
3001 };
3002 
3003 /* set PCBEEP vol = 0, mute connections */
3004 static const struct hda_verb alc268_beep_init_verbs[] = {
3005 	{0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3006 	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3007 	{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3008 	{ }
3009 };
3010 
3011 enum {
3012 	ALC268_FIXUP_INV_DMIC,
3013 	ALC268_FIXUP_HP_EAPD,
3014 	ALC268_FIXUP_SPDIF,
3015 };
3016 
3017 static const struct hda_fixup alc268_fixups[] = {
3018 	[ALC268_FIXUP_INV_DMIC] = {
3019 		.type = HDA_FIXUP_FUNC,
3020 		.v.func = alc_fixup_inv_dmic,
3021 	},
3022 	[ALC268_FIXUP_HP_EAPD] = {
3023 		.type = HDA_FIXUP_VERBS,
3024 		.v.verbs = (const struct hda_verb[]) {
3025 			{0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3026 			{}
3027 		}
3028 	},
3029 	[ALC268_FIXUP_SPDIF] = {
3030 		.type = HDA_FIXUP_PINS,
3031 		.v.pins = (const struct hda_pintbl[]) {
3032 			{ 0x1e, 0x014b1180 }, /* enable SPDIF out */
3033 			{}
3034 		}
3035 	},
3036 };
3037 
3038 static const struct hda_model_fixup alc268_fixup_models[] = {
3039 	{.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3040 	{.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3041 	{.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
3042 	{}
3043 };
3044 
3045 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
3046 	SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
3047 	SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
3048 	/* below is codec SSID since multiple Toshiba laptops have the
3049 	 * same PCI SSID 1179:ff00
3050 	 */
3051 	SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
3052 	{}
3053 };
3054 
3055 /*
3056  * BIOS auto configuration
3057  */
3058 static int alc268_parse_auto_config(struct hda_codec *codec)
3059 {
3060 	static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3061 	return alc_parse_auto_config(codec, NULL, alc268_ssids);
3062 }
3063 
3064 /*
3065  */
3066 static int patch_alc268(struct hda_codec *codec)
3067 {
3068 	struct alc_spec *spec;
3069 	int i, err;
3070 
3071 	/* ALC268 has no aa-loopback mixer */
3072 	err = alc_alloc_spec(codec, 0);
3073 	if (err < 0)
3074 		return err;
3075 
3076 	spec = codec->spec;
3077 	if (has_cdefine_beep(codec))
3078 		spec->gen.beep_nid = 0x01;
3079 
3080 	spec->shutup = alc_eapd_shutup;
3081 
3082 	alc_pre_init(codec);
3083 
3084 	snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3085 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3086 
3087 	/* automatic parse from the BIOS config */
3088 	err = alc268_parse_auto_config(codec);
3089 	if (err < 0)
3090 		goto error;
3091 
3092 	if (err > 0 && !spec->gen.no_analog &&
3093 	    spec->gen.autocfg.speaker_pins[0] != 0x1d) {
3094 		for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3095 			if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3096 						  &alc268_beep_mixer[i])) {
3097 				err = -ENOMEM;
3098 				goto error;
3099 			}
3100 		}
3101 		snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3102 		if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3103 			/* override the amp caps for beep generator */
3104 			snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3105 					  (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3106 					  (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3107 					  (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3108 					  (0 << AC_AMPCAP_MUTE_SHIFT));
3109 	}
3110 
3111 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3112 
3113 	return 0;
3114 
3115  error:
3116 	alc_free(codec);
3117 	return err;
3118 }
3119 
3120 /*
3121  * ALC269
3122  */
3123 
3124 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
3125 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3126 };
3127 
3128 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
3129 	.rates = SNDRV_PCM_RATE_44100, /* fixed rate */
3130 };
3131 
3132 /* different alc269-variants */
3133 enum {
3134 	ALC269_TYPE_ALC269VA,
3135 	ALC269_TYPE_ALC269VB,
3136 	ALC269_TYPE_ALC269VC,
3137 	ALC269_TYPE_ALC269VD,
3138 	ALC269_TYPE_ALC280,
3139 	ALC269_TYPE_ALC282,
3140 	ALC269_TYPE_ALC283,
3141 	ALC269_TYPE_ALC284,
3142 	ALC269_TYPE_ALC293,
3143 	ALC269_TYPE_ALC286,
3144 	ALC269_TYPE_ALC298,
3145 	ALC269_TYPE_ALC255,
3146 	ALC269_TYPE_ALC256,
3147 	ALC269_TYPE_ALC257,
3148 	ALC269_TYPE_ALC215,
3149 	ALC269_TYPE_ALC225,
3150 	ALC269_TYPE_ALC245,
3151 	ALC269_TYPE_ALC287,
3152 	ALC269_TYPE_ALC294,
3153 	ALC269_TYPE_ALC300,
3154 	ALC269_TYPE_ALC623,
3155 	ALC269_TYPE_ALC700,
3156 };
3157 
3158 /*
3159  * BIOS auto configuration
3160  */
3161 static int alc269_parse_auto_config(struct hda_codec *codec)
3162 {
3163 	static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
3164 	static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3165 	static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3166 	struct alc_spec *spec = codec->spec;
3167 	const hda_nid_t *ssids;
3168 
3169 	switch (spec->codec_variant) {
3170 	case ALC269_TYPE_ALC269VA:
3171 	case ALC269_TYPE_ALC269VC:
3172 	case ALC269_TYPE_ALC280:
3173 	case ALC269_TYPE_ALC284:
3174 	case ALC269_TYPE_ALC293:
3175 		ssids = alc269va_ssids;
3176 		break;
3177 	case ALC269_TYPE_ALC269VB:
3178 	case ALC269_TYPE_ALC269VD:
3179 	case ALC269_TYPE_ALC282:
3180 	case ALC269_TYPE_ALC283:
3181 	case ALC269_TYPE_ALC286:
3182 	case ALC269_TYPE_ALC298:
3183 	case ALC269_TYPE_ALC255:
3184 	case ALC269_TYPE_ALC256:
3185 	case ALC269_TYPE_ALC257:
3186 	case ALC269_TYPE_ALC215:
3187 	case ALC269_TYPE_ALC225:
3188 	case ALC269_TYPE_ALC245:
3189 	case ALC269_TYPE_ALC287:
3190 	case ALC269_TYPE_ALC294:
3191 	case ALC269_TYPE_ALC300:
3192 	case ALC269_TYPE_ALC623:
3193 	case ALC269_TYPE_ALC700:
3194 		ssids = alc269_ssids;
3195 		break;
3196 	default:
3197 		ssids = alc269_ssids;
3198 		break;
3199 	}
3200 
3201 	return alc_parse_auto_config(codec, alc269_ignore, ssids);
3202 }
3203 
3204 static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3205 	{ SND_JACK_BTN_0, KEY_PLAYPAUSE },
3206 	{ SND_JACK_BTN_1, KEY_VOICECOMMAND },
3207 	{ SND_JACK_BTN_2, KEY_VOLUMEUP },
3208 	{ SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3209 	{}
3210 };
3211 
3212 static void alc_headset_btn_callback(struct hda_codec *codec,
3213 				     struct hda_jack_callback *jack)
3214 {
3215 	int report = 0;
3216 
3217 	if (jack->unsol_res & (7 << 13))
3218 		report |= SND_JACK_BTN_0;
3219 
3220 	if (jack->unsol_res  & (1 << 16 | 3 << 8))
3221 		report |= SND_JACK_BTN_1;
3222 
3223 	/* Volume up key */
3224 	if (jack->unsol_res & (7 << 23))
3225 		report |= SND_JACK_BTN_2;
3226 
3227 	/* Volume down key */
3228 	if (jack->unsol_res & (7 << 10))
3229 		report |= SND_JACK_BTN_3;
3230 
3231 	snd_hda_jack_set_button_state(codec, jack->nid, report);
3232 }
3233 
3234 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3235 {
3236 	struct alc_spec *spec = codec->spec;
3237 
3238 	if (!spec->has_hs_key)
3239 		return;
3240 
3241 	switch (codec->core.vendor_id) {
3242 	case 0x10ec0215:
3243 	case 0x10ec0225:
3244 	case 0x10ec0285:
3245 	case 0x10ec0287:
3246 	case 0x10ec0295:
3247 	case 0x10ec0289:
3248 	case 0x10ec0299:
3249 		alc_write_coef_idx(codec, 0x48, 0x0);
3250 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3251 		alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3252 		break;
3253 	case 0x10ec0230:
3254 	case 0x10ec0236:
3255 	case 0x10ec0256:
3256 	case 0x19e58326:
3257 		alc_write_coef_idx(codec, 0x48, 0x0);
3258 		alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3259 		break;
3260 	}
3261 }
3262 
3263 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3264 {
3265 	struct alc_spec *spec = codec->spec;
3266 
3267 	if (!spec->has_hs_key)
3268 		return;
3269 
3270 	switch (codec->core.vendor_id) {
3271 	case 0x10ec0215:
3272 	case 0x10ec0225:
3273 	case 0x10ec0285:
3274 	case 0x10ec0287:
3275 	case 0x10ec0295:
3276 	case 0x10ec0289:
3277 	case 0x10ec0299:
3278 		alc_write_coef_idx(codec, 0x48, 0xd011);
3279 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3280 		alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3281 		break;
3282 	case 0x10ec0230:
3283 	case 0x10ec0236:
3284 	case 0x10ec0256:
3285 	case 0x19e58326:
3286 		alc_write_coef_idx(codec, 0x48, 0xd011);
3287 		alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3288 		break;
3289 	}
3290 }
3291 
3292 static void alc_fixup_headset_jack(struct hda_codec *codec,
3293 				    const struct hda_fixup *fix, int action)
3294 {
3295 	struct alc_spec *spec = codec->spec;
3296 	hda_nid_t hp_pin;
3297 
3298 	switch (action) {
3299 	case HDA_FIXUP_ACT_PRE_PROBE:
3300 		spec->has_hs_key = 1;
3301 		snd_hda_jack_detect_enable_callback(codec, 0x55,
3302 						    alc_headset_btn_callback);
3303 		break;
3304 	case HDA_FIXUP_ACT_BUILD:
3305 		hp_pin = alc_get_hp_pin(spec);
3306 		if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3307 							alc_headset_btn_keymap,
3308 							hp_pin))
3309 			snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3310 					      false, SND_JACK_HEADSET,
3311 					      alc_headset_btn_keymap);
3312 
3313 		alc_enable_headset_jack_key(codec);
3314 		break;
3315 	}
3316 }
3317 
3318 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3319 {
3320 	alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3321 }
3322 
3323 static void alc269_shutup(struct hda_codec *codec)
3324 {
3325 	struct alc_spec *spec = codec->spec;
3326 
3327 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3328 		alc269vb_toggle_power_output(codec, 0);
3329 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3330 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
3331 		msleep(150);
3332 	}
3333 	alc_shutup_pins(codec);
3334 }
3335 
3336 static const struct coef_fw alc282_coefs[] = {
3337 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3338 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3339 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3340 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3341 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3342 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3343 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3344 	WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3345 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3346 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3347 	WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3348 	UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3349 	WRITE_COEF(0x34, 0xa0c0), /* ANC */
3350 	UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3351 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3352 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3353 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3354 	WRITE_COEF(0x63, 0x2902), /* PLL */
3355 	WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3356 	WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3357 	WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3358 	WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3359 	UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3360 	WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3361 	UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3362 	WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3363 	WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3364 	UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3365 	WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3366 	{}
3367 };
3368 
3369 static void alc282_restore_default_value(struct hda_codec *codec)
3370 {
3371 	alc_process_coef_fw(codec, alc282_coefs);
3372 }
3373 
3374 static void alc282_init(struct hda_codec *codec)
3375 {
3376 	struct alc_spec *spec = codec->spec;
3377 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3378 	bool hp_pin_sense;
3379 	int coef78;
3380 
3381 	alc282_restore_default_value(codec);
3382 
3383 	if (!hp_pin)
3384 		return;
3385 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3386 	coef78 = alc_read_coef_idx(codec, 0x78);
3387 
3388 	/* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3389 	/* Headphone capless set to high power mode */
3390 	alc_write_coef_idx(codec, 0x78, 0x9004);
3391 
3392 	if (hp_pin_sense)
3393 		msleep(2);
3394 
3395 	snd_hda_codec_write(codec, hp_pin, 0,
3396 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3397 
3398 	if (hp_pin_sense)
3399 		msleep(85);
3400 
3401 	snd_hda_codec_write(codec, hp_pin, 0,
3402 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3403 
3404 	if (hp_pin_sense)
3405 		msleep(100);
3406 
3407 	/* Headphone capless set to normal mode */
3408 	alc_write_coef_idx(codec, 0x78, coef78);
3409 }
3410 
3411 static void alc282_shutup(struct hda_codec *codec)
3412 {
3413 	struct alc_spec *spec = codec->spec;
3414 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3415 	bool hp_pin_sense;
3416 	int coef78;
3417 
3418 	if (!hp_pin) {
3419 		alc269_shutup(codec);
3420 		return;
3421 	}
3422 
3423 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3424 	coef78 = alc_read_coef_idx(codec, 0x78);
3425 	alc_write_coef_idx(codec, 0x78, 0x9004);
3426 
3427 	if (hp_pin_sense)
3428 		msleep(2);
3429 
3430 	snd_hda_codec_write(codec, hp_pin, 0,
3431 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3432 
3433 	if (hp_pin_sense)
3434 		msleep(85);
3435 
3436 	if (!spec->no_shutup_pins)
3437 		snd_hda_codec_write(codec, hp_pin, 0,
3438 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3439 
3440 	if (hp_pin_sense)
3441 		msleep(100);
3442 
3443 	alc_auto_setup_eapd(codec, false);
3444 	alc_shutup_pins(codec);
3445 	alc_write_coef_idx(codec, 0x78, coef78);
3446 }
3447 
3448 static const struct coef_fw alc283_coefs[] = {
3449 	WRITE_COEF(0x03, 0x0002), /* Power Down Control */
3450 	UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
3451 	WRITE_COEF(0x07, 0x0200), /* DMIC control */
3452 	UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3453 	UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3454 	WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3455 	WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3456 	WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3457 	UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3458 	UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3459 	WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3460 	UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3461 	WRITE_COEF(0x22, 0xa0c0), /* ANC */
3462 	UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3463 	UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3464 	UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3465 	WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3466 	WRITE_COEF(0x2e, 0x2902), /* PLL */
3467 	WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3468 	WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3469 	WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3470 	WRITE_COEF(0x36, 0x0), /* capless control 5 */
3471 	UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3472 	WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3473 	UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3474 	WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3475 	WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3476 	UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3477 	WRITE_COEF(0x49, 0x0), /* test mode */
3478 	UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3479 	UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3480 	WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
3481 	UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
3482 	{}
3483 };
3484 
3485 static void alc283_restore_default_value(struct hda_codec *codec)
3486 {
3487 	alc_process_coef_fw(codec, alc283_coefs);
3488 }
3489 
3490 static void alc283_init(struct hda_codec *codec)
3491 {
3492 	struct alc_spec *spec = codec->spec;
3493 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3494 	bool hp_pin_sense;
3495 
3496 	alc283_restore_default_value(codec);
3497 
3498 	if (!hp_pin)
3499 		return;
3500 
3501 	msleep(30);
3502 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3503 
3504 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3505 	/* Headphone capless set to high power mode */
3506 	alc_write_coef_idx(codec, 0x43, 0x9004);
3507 
3508 	snd_hda_codec_write(codec, hp_pin, 0,
3509 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3510 
3511 	if (hp_pin_sense)
3512 		msleep(85);
3513 
3514 	snd_hda_codec_write(codec, hp_pin, 0,
3515 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3516 
3517 	if (hp_pin_sense)
3518 		msleep(85);
3519 	/* Index 0x46 Combo jack auto switch control 2 */
3520 	/* 3k pull low control for Headset jack. */
3521 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3522 	/* Headphone capless set to normal mode */
3523 	alc_write_coef_idx(codec, 0x43, 0x9614);
3524 }
3525 
3526 static void alc283_shutup(struct hda_codec *codec)
3527 {
3528 	struct alc_spec *spec = codec->spec;
3529 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3530 	bool hp_pin_sense;
3531 
3532 	if (!hp_pin) {
3533 		alc269_shutup(codec);
3534 		return;
3535 	}
3536 
3537 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3538 
3539 	alc_write_coef_idx(codec, 0x43, 0x9004);
3540 
3541 	/*depop hp during suspend*/
3542 	alc_write_coef_idx(codec, 0x06, 0x2100);
3543 
3544 	snd_hda_codec_write(codec, hp_pin, 0,
3545 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3546 
3547 	if (hp_pin_sense)
3548 		msleep(100);
3549 
3550 	if (!spec->no_shutup_pins)
3551 		snd_hda_codec_write(codec, hp_pin, 0,
3552 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3553 
3554 	alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3555 
3556 	if (hp_pin_sense)
3557 		msleep(100);
3558 	alc_auto_setup_eapd(codec, false);
3559 	alc_shutup_pins(codec);
3560 	alc_write_coef_idx(codec, 0x43, 0x9614);
3561 }
3562 
3563 static void alc256_init(struct hda_codec *codec)
3564 {
3565 	struct alc_spec *spec = codec->spec;
3566 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3567 	bool hp_pin_sense;
3568 
3569 	if (spec->ultra_low_power) {
3570 		alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3571 		alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3572 		alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3573 		alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3574 		alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3575 		msleep(30);
3576 	}
3577 
3578 	if (!hp_pin)
3579 		hp_pin = 0x21;
3580 
3581 	msleep(30);
3582 
3583 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3584 
3585 	if (hp_pin_sense)
3586 		msleep(2);
3587 
3588 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3589 
3590 	snd_hda_codec_write(codec, hp_pin, 0,
3591 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3592 
3593 	if (hp_pin_sense || spec->ultra_low_power)
3594 		msleep(85);
3595 
3596 	snd_hda_codec_write(codec, hp_pin, 0,
3597 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3598 
3599 	if (hp_pin_sense || spec->ultra_low_power)
3600 		msleep(100);
3601 
3602 	alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3603 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3604 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3605 	alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3606 	/*
3607 	 * Expose headphone mic (or possibly Line In on some machines) instead
3608 	 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3609 	 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3610 	 * this register.
3611 	 */
3612 	alc_write_coef_idx(codec, 0x36, 0x5757);
3613 }
3614 
3615 static void alc256_shutup(struct hda_codec *codec)
3616 {
3617 	struct alc_spec *spec = codec->spec;
3618 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3619 	bool hp_pin_sense;
3620 
3621 	if (!hp_pin)
3622 		hp_pin = 0x21;
3623 
3624 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3625 
3626 	if (hp_pin_sense)
3627 		msleep(2);
3628 
3629 	snd_hda_codec_write(codec, hp_pin, 0,
3630 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3631 
3632 	if (hp_pin_sense || spec->ultra_low_power)
3633 		msleep(85);
3634 
3635 	/* 3k pull low control for Headset jack. */
3636 	/* NOTE: call this before clearing the pin, otherwise codec stalls */
3637 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3638 	 * when booting with headset plugged. So skip setting it for the codec alc257
3639 	 */
3640 	if (codec->core.vendor_id != 0x10ec0236 &&
3641 	    codec->core.vendor_id != 0x10ec0257)
3642 		alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3643 
3644 	if (!spec->no_shutup_pins)
3645 		snd_hda_codec_write(codec, hp_pin, 0,
3646 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3647 
3648 	if (hp_pin_sense || spec->ultra_low_power)
3649 		msleep(100);
3650 
3651 	alc_auto_setup_eapd(codec, false);
3652 	alc_shutup_pins(codec);
3653 	if (spec->ultra_low_power) {
3654 		msleep(50);
3655 		alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3656 		alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3657 		alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3658 		alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3659 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3660 		msleep(30);
3661 	}
3662 }
3663 
3664 static void alc285_hp_init(struct hda_codec *codec)
3665 {
3666 	struct alc_spec *spec = codec->spec;
3667 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3668 	int i, val;
3669 	int coef38, coef0d, coef36;
3670 
3671 	alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3672 	coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3673 	coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3674 	coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3675 	alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3676 	alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3677 
3678 	alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3679 
3680 	if (hp_pin)
3681 		snd_hda_codec_write(codec, hp_pin, 0,
3682 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3683 
3684 	msleep(130);
3685 	alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3686 	alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3687 
3688 	if (hp_pin)
3689 		snd_hda_codec_write(codec, hp_pin, 0,
3690 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3691 	msleep(10);
3692 	alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3693 	alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3694 	alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3695 	alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3696 
3697 	alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3698 	val = alc_read_coefex_idx(codec, 0x58, 0x00);
3699 	for (i = 0; i < 20 && val & 0x8000; i++) {
3700 		msleep(50);
3701 		val = alc_read_coefex_idx(codec, 0x58, 0x00);
3702 	} /* Wait for depop procedure finish  */
3703 
3704 	alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3705 	alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3706 	alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3707 	alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3708 
3709 	msleep(50);
3710 	alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3711 }
3712 
3713 static void alc225_init(struct hda_codec *codec)
3714 {
3715 	struct alc_spec *spec = codec->spec;
3716 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3717 	bool hp1_pin_sense, hp2_pin_sense;
3718 
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 (spec->codec_variant != ALC269_TYPE_ALC287 &&
3727 		spec->codec_variant != ALC269_TYPE_ALC245)
3728 		/* required only at boot or S3 and S4 resume time */
3729 		if (!spec->done_hp_init ||
3730 			is_s3_resume(codec) ||
3731 			is_s4_resume(codec)) {
3732 			alc285_hp_init(codec);
3733 			spec->done_hp_init = true;
3734 		}
3735 
3736 	if (!hp_pin)
3737 		hp_pin = 0x21;
3738 	msleep(30);
3739 
3740 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3741 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3742 
3743 	if (hp1_pin_sense || hp2_pin_sense)
3744 		msleep(2);
3745 
3746 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3747 
3748 	if (hp1_pin_sense || spec->ultra_low_power)
3749 		snd_hda_codec_write(codec, hp_pin, 0,
3750 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3751 	if (hp2_pin_sense)
3752 		snd_hda_codec_write(codec, 0x16, 0,
3753 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3754 
3755 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3756 		msleep(85);
3757 
3758 	if (hp1_pin_sense || spec->ultra_low_power)
3759 		snd_hda_codec_write(codec, hp_pin, 0,
3760 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3761 	if (hp2_pin_sense)
3762 		snd_hda_codec_write(codec, 0x16, 0,
3763 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3764 
3765 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3766 		msleep(100);
3767 
3768 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3769 	alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3770 }
3771 
3772 static void alc225_shutup(struct hda_codec *codec)
3773 {
3774 	struct alc_spec *spec = codec->spec;
3775 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3776 	bool hp1_pin_sense, hp2_pin_sense;
3777 
3778 	if (!hp_pin)
3779 		hp_pin = 0x21;
3780 
3781 	alc_disable_headset_jack_key(codec);
3782 	/* 3k pull low control for Headset jack. */
3783 	alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3784 
3785 	hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3786 	hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3787 
3788 	if (hp1_pin_sense || hp2_pin_sense)
3789 		msleep(2);
3790 
3791 	if (hp1_pin_sense || spec->ultra_low_power)
3792 		snd_hda_codec_write(codec, hp_pin, 0,
3793 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3794 	if (hp2_pin_sense)
3795 		snd_hda_codec_write(codec, 0x16, 0,
3796 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3797 
3798 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3799 		msleep(85);
3800 
3801 	if (hp1_pin_sense || spec->ultra_low_power)
3802 		snd_hda_codec_write(codec, hp_pin, 0,
3803 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3804 	if (hp2_pin_sense)
3805 		snd_hda_codec_write(codec, 0x16, 0,
3806 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3807 
3808 	if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
3809 		msleep(100);
3810 
3811 	alc_auto_setup_eapd(codec, false);
3812 	alc_shutup_pins(codec);
3813 	if (spec->ultra_low_power) {
3814 		msleep(50);
3815 		alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3816 		alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3817 		alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3818 		alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3819 		msleep(30);
3820 	}
3821 
3822 	alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3823 	alc_enable_headset_jack_key(codec);
3824 }
3825 
3826 static void alc_default_init(struct hda_codec *codec)
3827 {
3828 	struct alc_spec *spec = codec->spec;
3829 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3830 	bool hp_pin_sense;
3831 
3832 	if (!hp_pin)
3833 		return;
3834 
3835 	msleep(30);
3836 
3837 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3838 
3839 	if (hp_pin_sense)
3840 		msleep(2);
3841 
3842 	snd_hda_codec_write(codec, hp_pin, 0,
3843 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3844 
3845 	if (hp_pin_sense)
3846 		msleep(85);
3847 
3848 	snd_hda_codec_write(codec, hp_pin, 0,
3849 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3850 
3851 	if (hp_pin_sense)
3852 		msleep(100);
3853 }
3854 
3855 static void alc_default_shutup(struct hda_codec *codec)
3856 {
3857 	struct alc_spec *spec = codec->spec;
3858 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3859 	bool hp_pin_sense;
3860 
3861 	if (!hp_pin) {
3862 		alc269_shutup(codec);
3863 		return;
3864 	}
3865 
3866 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3867 
3868 	if (hp_pin_sense)
3869 		msleep(2);
3870 
3871 	snd_hda_codec_write(codec, hp_pin, 0,
3872 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3873 
3874 	if (hp_pin_sense)
3875 		msleep(85);
3876 
3877 	if (!spec->no_shutup_pins)
3878 		snd_hda_codec_write(codec, hp_pin, 0,
3879 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3880 
3881 	if (hp_pin_sense)
3882 		msleep(100);
3883 
3884 	alc_auto_setup_eapd(codec, false);
3885 	alc_shutup_pins(codec);
3886 }
3887 
3888 static void alc294_hp_init(struct hda_codec *codec)
3889 {
3890 	struct alc_spec *spec = codec->spec;
3891 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
3892 	int i, val;
3893 
3894 	if (!hp_pin)
3895 		return;
3896 
3897 	snd_hda_codec_write(codec, hp_pin, 0,
3898 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3899 
3900 	msleep(100);
3901 
3902 	if (!spec->no_shutup_pins)
3903 		snd_hda_codec_write(codec, hp_pin, 0,
3904 				    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3905 
3906 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3907 	alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3908 
3909 	/* Wait for depop procedure finish  */
3910 	val = alc_read_coefex_idx(codec, 0x58, 0x01);
3911 	for (i = 0; i < 20 && val & 0x0080; i++) {
3912 		msleep(50);
3913 		val = alc_read_coefex_idx(codec, 0x58, 0x01);
3914 	}
3915 	/* Set HP depop to auto mode */
3916 	alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3917 	msleep(50);
3918 }
3919 
3920 static void alc294_init(struct hda_codec *codec)
3921 {
3922 	struct alc_spec *spec = codec->spec;
3923 
3924 	/* required only at boot or S4 resume time */
3925 	if (!spec->done_hp_init ||
3926 	    codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3927 		alc294_hp_init(codec);
3928 		spec->done_hp_init = true;
3929 	}
3930 	alc_default_init(codec);
3931 }
3932 
3933 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3934 			     unsigned int val)
3935 {
3936 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3937 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3938 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3939 }
3940 
3941 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3942 {
3943 	unsigned int val;
3944 
3945 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3946 	val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3947 		& 0xffff;
3948 	val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3949 		<< 16;
3950 	return val;
3951 }
3952 
3953 static void alc5505_dsp_halt(struct hda_codec *codec)
3954 {
3955 	unsigned int val;
3956 
3957 	alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3958 	alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3959 	alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3960 	alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3961 	alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3962 	alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3963 	alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3964 	val = alc5505_coef_get(codec, 0x6220);
3965 	alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3966 }
3967 
3968 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3969 {
3970 	alc5505_coef_set(codec, 0x61b8, 0x04133302);
3971 	alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3972 	alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3973 	alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3974 	alc5505_coef_set(codec, 0x6220, 0x2002010f);
3975 	alc5505_coef_set(codec, 0x880c, 0x00000004);
3976 }
3977 
3978 static void alc5505_dsp_init(struct hda_codec *codec)
3979 {
3980 	unsigned int val;
3981 
3982 	alc5505_dsp_halt(codec);
3983 	alc5505_dsp_back_from_halt(codec);
3984 	alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3985 	alc5505_coef_set(codec, 0x61b0, 0x5b16);
3986 	alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3987 	alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3988 	alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3989 	alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3990 	snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3991 	alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3992 	alc5505_coef_set(codec, 0x61b8, 0x04173302);
3993 	alc5505_coef_set(codec, 0x61b8, 0x04163302);
3994 	alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3995 	alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3996 	alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3997 
3998 	val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3999 	if (val <= 3)
4000 		alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
4001 	else
4002 		alc5505_coef_set(codec, 0x6220, 0x6002018f);
4003 
4004 	alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
4005 	alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
4006 	alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
4007 	alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
4008 	alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
4009 	alc5505_coef_set(codec, 0x880c, 0x00000003);
4010 	alc5505_coef_set(codec, 0x880c, 0x00000010);
4011 
4012 #ifdef HALT_REALTEK_ALC5505
4013 	alc5505_dsp_halt(codec);
4014 #endif
4015 }
4016 
4017 #ifdef HALT_REALTEK_ALC5505
4018 #define alc5505_dsp_suspend(codec)	do { } while (0) /* NOP */
4019 #define alc5505_dsp_resume(codec)	do { } while (0) /* NOP */
4020 #else
4021 #define alc5505_dsp_suspend(codec)	alc5505_dsp_halt(codec)
4022 #define alc5505_dsp_resume(codec)	alc5505_dsp_back_from_halt(codec)
4023 #endif
4024 
4025 #ifdef CONFIG_PM
4026 static int alc269_suspend(struct hda_codec *codec)
4027 {
4028 	struct alc_spec *spec = codec->spec;
4029 
4030 	if (spec->has_alc5505_dsp)
4031 		alc5505_dsp_suspend(codec);
4032 
4033 	return alc_suspend(codec);
4034 }
4035 
4036 static int alc269_resume(struct hda_codec *codec)
4037 {
4038 	struct alc_spec *spec = codec->spec;
4039 
4040 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4041 		alc269vb_toggle_power_output(codec, 0);
4042 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4043 			(alc_get_coef0(codec) & 0x00ff) == 0x018) {
4044 		msleep(150);
4045 	}
4046 
4047 	codec->patch_ops.init(codec);
4048 
4049 	if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4050 		alc269vb_toggle_power_output(codec, 1);
4051 	if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
4052 			(alc_get_coef0(codec) & 0x00ff) == 0x017) {
4053 		msleep(200);
4054 	}
4055 
4056 	snd_hda_regmap_sync(codec);
4057 	hda_call_check_power_status(codec, 0x01);
4058 
4059 	/* on some machine, the BIOS will clear the codec gpio data when enter
4060 	 * suspend, and won't restore the data after resume, so we restore it
4061 	 * in the driver.
4062 	 */
4063 	if (spec->gpio_data)
4064 		alc_write_gpio_data(codec);
4065 
4066 	if (spec->has_alc5505_dsp)
4067 		alc5505_dsp_resume(codec);
4068 
4069 	return 0;
4070 }
4071 #endif /* CONFIG_PM */
4072 
4073 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4074 						 const struct hda_fixup *fix, int action)
4075 {
4076 	struct alc_spec *spec = codec->spec;
4077 
4078 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4079 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4080 }
4081 
4082 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4083 						 const struct hda_fixup *fix,
4084 						 int action)
4085 {
4086 	unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4087 	unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4088 
4089 	if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4090 		snd_hda_codec_set_pincfg(codec, 0x19,
4091 			(cfg_headphone & ~AC_DEFCFG_DEVICE) |
4092 			(AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4093 }
4094 
4095 static void alc269_fixup_hweq(struct hda_codec *codec,
4096 			       const struct hda_fixup *fix, int action)
4097 {
4098 	if (action == HDA_FIXUP_ACT_INIT)
4099 		alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4100 }
4101 
4102 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4103 				       const struct hda_fixup *fix, int action)
4104 {
4105 	struct alc_spec *spec = codec->spec;
4106 
4107 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4108 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4109 }
4110 
4111 static void alc271_fixup_dmic(struct hda_codec *codec,
4112 			      const struct hda_fixup *fix, int action)
4113 {
4114 	static const struct hda_verb verbs[] = {
4115 		{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4116 		{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4117 		{}
4118 	};
4119 	unsigned int cfg;
4120 
4121 	if (strcmp(codec->core.chip_name, "ALC271X") &&
4122 	    strcmp(codec->core.chip_name, "ALC269VB"))
4123 		return;
4124 	cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4125 	if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4126 		snd_hda_sequence_write(codec, verbs);
4127 }
4128 
4129 /* Fix the speaker amp after resume, etc */
4130 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4131 					  const struct hda_fixup *fix,
4132 					  int action)
4133 {
4134 	if (action == HDA_FIXUP_ACT_INIT)
4135 		alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4136 }
4137 
4138 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4139 				 const struct hda_fixup *fix, int action)
4140 {
4141 	struct alc_spec *spec = codec->spec;
4142 
4143 	if (action != HDA_FIXUP_ACT_PROBE)
4144 		return;
4145 
4146 	/* Due to a hardware problem on Lenovo Ideadpad, we need to
4147 	 * fix the sample rate of analog I/O to 44.1kHz
4148 	 */
4149 	spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4150 	spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
4151 }
4152 
4153 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4154 				     const struct hda_fixup *fix, int action)
4155 {
4156 	/* The digital-mic unit sends PDM (differential signal) instead of
4157 	 * the standard PCM, thus you can't record a valid mono stream as is.
4158 	 * Below is a workaround specific to ALC269 to control the dmic
4159 	 * signal source as mono.
4160 	 */
4161 	if (action == HDA_FIXUP_ACT_INIT)
4162 		alc_update_coef_idx(codec, 0x07, 0, 0x80);
4163 }
4164 
4165 static void alc269_quanta_automute(struct hda_codec *codec)
4166 {
4167 	snd_hda_gen_update_outputs(codec);
4168 
4169 	alc_write_coef_idx(codec, 0x0c, 0x680);
4170 	alc_write_coef_idx(codec, 0x0c, 0x480);
4171 }
4172 
4173 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4174 				     const struct hda_fixup *fix, int action)
4175 {
4176 	struct alc_spec *spec = codec->spec;
4177 	if (action != HDA_FIXUP_ACT_PROBE)
4178 		return;
4179 	spec->gen.automute_hook = alc269_quanta_automute;
4180 }
4181 
4182 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4183 					 struct hda_jack_callback *jack)
4184 {
4185 	struct alc_spec *spec = codec->spec;
4186 	int vref;
4187 	msleep(200);
4188 	snd_hda_gen_hp_automute(codec, jack);
4189 
4190 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4191 	msleep(100);
4192 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4193 			    vref);
4194 	msleep(500);
4195 	snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4196 			    vref);
4197 }
4198 
4199 /*
4200  * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4201  */
4202 struct hda_alc298_mbxinit {
4203 	unsigned char value_0x23;
4204 	unsigned char value_0x25;
4205 };
4206 
4207 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4208 					 const struct hda_alc298_mbxinit *initval,
4209 					 bool first)
4210 {
4211 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4212 	alc_write_coef_idx(codec, 0x26, 0xb000);
4213 
4214 	if (first)
4215 		snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4216 
4217 	snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4218 	alc_write_coef_idx(codec, 0x26, 0xf000);
4219 	alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4220 
4221 	if (initval->value_0x23 != 0x1e)
4222 		alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4223 
4224 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4225 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4226 }
4227 
4228 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4229 					   const struct hda_fixup *fix,
4230 					   int action)
4231 {
4232 	/* Initialization magic */
4233 	static const struct hda_alc298_mbxinit dac_init[] = {
4234 		{0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4235 		{0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4236 		{0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4237 		{0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4238 		{0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4239 		{0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4240 		{0x2f, 0x00},
4241 		{0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4242 		{0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4243 		{0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4244 		{}
4245 	};
4246 	const struct hda_alc298_mbxinit *seq;
4247 
4248 	if (action != HDA_FIXUP_ACT_INIT)
4249 		return;
4250 
4251 	/* Start */
4252 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4253 	snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4254 	alc_write_coef_idx(codec, 0x26, 0xf000);
4255 	alc_write_coef_idx(codec, 0x22, 0x31);
4256 	alc_write_coef_idx(codec, 0x23, 0x0b);
4257 	alc_write_coef_idx(codec, 0x25, 0x00);
4258 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4259 	snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4260 
4261 	for (seq = dac_init; seq->value_0x23; seq++)
4262 		alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4263 }
4264 
4265 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4266 				     const struct hda_fixup *fix, int action)
4267 {
4268 	struct alc_spec *spec = codec->spec;
4269 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4270 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4271 		spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4272 	}
4273 }
4274 
4275 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4276 				bool polarity, bool on)
4277 {
4278 	unsigned int pinval;
4279 
4280 	if (!pin)
4281 		return;
4282 	if (polarity)
4283 		on = !on;
4284 	pinval = snd_hda_codec_get_pin_target(codec, pin);
4285 	pinval &= ~AC_PINCTL_VREFEN;
4286 	pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4287 	/* temporarily power up/down for setting VREF */
4288 	snd_hda_power_up_pm(codec);
4289 	snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4290 	snd_hda_power_down_pm(codec);
4291 }
4292 
4293 /* update mute-LED according to the speaker mute state via mic VREF pin */
4294 static int vref_mute_led_set(struct led_classdev *led_cdev,
4295 			     enum led_brightness brightness)
4296 {
4297 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4298 	struct alc_spec *spec = codec->spec;
4299 
4300 	alc_update_vref_led(codec, spec->mute_led_nid,
4301 			    spec->mute_led_polarity, brightness);
4302 	return 0;
4303 }
4304 
4305 /* Make sure the led works even in runtime suspend */
4306 static unsigned int led_power_filter(struct hda_codec *codec,
4307 						  hda_nid_t nid,
4308 						  unsigned int power_state)
4309 {
4310 	struct alc_spec *spec = codec->spec;
4311 
4312 	if (power_state != AC_PWRST_D3 || nid == 0 ||
4313 	    (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
4314 		return power_state;
4315 
4316 	/* Set pin ctl again, it might have just been set to 0 */
4317 	snd_hda_set_pin_ctl(codec, nid,
4318 			    snd_hda_codec_get_pin_target(codec, nid));
4319 
4320 	return snd_hda_gen_path_power_filter(codec, nid, power_state);
4321 }
4322 
4323 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4324 				     const struct hda_fixup *fix, int action)
4325 {
4326 	struct alc_spec *spec = codec->spec;
4327 	const struct dmi_device *dev = NULL;
4328 
4329 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4330 		return;
4331 
4332 	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4333 		int pol, pin;
4334 		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4335 			continue;
4336 		if (pin < 0x0a || pin >= 0x10)
4337 			break;
4338 		spec->mute_led_polarity = pol;
4339 		spec->mute_led_nid = pin - 0x0a + 0x18;
4340 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4341 		codec->power_filter = led_power_filter;
4342 		codec_dbg(codec,
4343 			  "Detected mute LED for %x:%d\n", spec->mute_led_nid,
4344 			   spec->mute_led_polarity);
4345 		break;
4346 	}
4347 }
4348 
4349 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4350 					  const struct hda_fixup *fix,
4351 					  int action, hda_nid_t pin)
4352 {
4353 	struct alc_spec *spec = codec->spec;
4354 
4355 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4356 		spec->mute_led_polarity = 0;
4357 		spec->mute_led_nid = pin;
4358 		snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4359 		codec->power_filter = led_power_filter;
4360 	}
4361 }
4362 
4363 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4364 				const struct hda_fixup *fix, int action)
4365 {
4366 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4367 }
4368 
4369 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4370 				const struct hda_fixup *fix, int action)
4371 {
4372 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4373 }
4374 
4375 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4376 				const struct hda_fixup *fix, int action)
4377 {
4378 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4379 }
4380 
4381 /* update LED status via GPIO */
4382 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4383 				int polarity, bool enabled)
4384 {
4385 	if (polarity)
4386 		enabled = !enabled;
4387 	alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4388 }
4389 
4390 /* turn on/off mute LED via GPIO per vmaster hook */
4391 static int gpio_mute_led_set(struct led_classdev *led_cdev,
4392 			     enum led_brightness brightness)
4393 {
4394 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4395 	struct alc_spec *spec = codec->spec;
4396 
4397 	alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4398 			    spec->mute_led_polarity, !brightness);
4399 	return 0;
4400 }
4401 
4402 /* turn on/off mic-mute LED via GPIO per capture hook */
4403 static int micmute_led_set(struct led_classdev *led_cdev,
4404 			   enum led_brightness brightness)
4405 {
4406 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4407 	struct alc_spec *spec = codec->spec;
4408 
4409 	alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4410 			    spec->micmute_led_polarity, !brightness);
4411 	return 0;
4412 }
4413 
4414 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4415 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4416 				  int action,
4417 				  unsigned int mute_mask,
4418 				  unsigned int micmute_mask)
4419 {
4420 	struct alc_spec *spec = codec->spec;
4421 
4422 	alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4423 
4424 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
4425 		return;
4426 	if (mute_mask) {
4427 		spec->gpio_mute_led_mask = mute_mask;
4428 		snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4429 	}
4430 	if (micmute_mask) {
4431 		spec->gpio_mic_led_mask = micmute_mask;
4432 		snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4433 	}
4434 }
4435 
4436 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4437 				const struct hda_fixup *fix, int action)
4438 {
4439 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4440 }
4441 
4442 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4443 				const struct hda_fixup *fix, int action)
4444 {
4445 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4446 }
4447 
4448 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4449 				const struct hda_fixup *fix, int action)
4450 {
4451 	alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4452 }
4453 
4454 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4455 				const struct hda_fixup *fix, int action)
4456 {
4457 	alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4458 }
4459 
4460 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4461 				const struct hda_fixup *fix, int action)
4462 {
4463 	alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4464 }
4465 
4466 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4467 				const struct hda_fixup *fix, int action)
4468 {
4469 	struct alc_spec *spec = codec->spec;
4470 
4471 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4472 		spec->micmute_led_polarity = 1;
4473 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4474 }
4475 
4476 /* turn on/off mic-mute LED per capture hook via VREF change */
4477 static int vref_micmute_led_set(struct led_classdev *led_cdev,
4478 				enum led_brightness brightness)
4479 {
4480 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4481 	struct alc_spec *spec = codec->spec;
4482 
4483 	alc_update_vref_led(codec, spec->cap_mute_led_nid,
4484 			    spec->micmute_led_polarity, brightness);
4485 	return 0;
4486 }
4487 
4488 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4489 				const struct hda_fixup *fix, int action)
4490 {
4491 	struct alc_spec *spec = codec->spec;
4492 
4493 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4494 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4495 		/* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4496 		 * enable headphone amp
4497 		 */
4498 		spec->gpio_mask |= 0x10;
4499 		spec->gpio_dir |= 0x10;
4500 		spec->cap_mute_led_nid = 0x18;
4501 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4502 		codec->power_filter = led_power_filter;
4503 	}
4504 }
4505 
4506 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4507 				   const struct hda_fixup *fix, int action)
4508 {
4509 	struct alc_spec *spec = codec->spec;
4510 
4511 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4512 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4513 		spec->cap_mute_led_nid = 0x18;
4514 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4515 		codec->power_filter = led_power_filter;
4516 	}
4517 }
4518 
4519 /* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4520  * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4521  */
4522 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4523 				     const struct hda_fixup *fix, int action)
4524 {
4525 	struct alc_spec *spec = codec->spec;
4526 
4527 	switch (action) {
4528 	case HDA_FIXUP_ACT_PRE_PROBE:
4529 		spec->gpio_mask |= 0x01;
4530 		spec->gpio_dir |= 0x01;
4531 		break;
4532 	case HDA_FIXUP_ACT_INIT:
4533 		/* need to toggle GPIO to enable the amp */
4534 		alc_update_gpio_data(codec, 0x01, true);
4535 		msleep(100);
4536 		alc_update_gpio_data(codec, 0x01, false);
4537 		break;
4538 	}
4539 }
4540 
4541 /* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4542 static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4543 				    struct hda_codec *codec,
4544 				    struct snd_pcm_substream *substream,
4545 				    int action)
4546 {
4547 	switch (action) {
4548 	case HDA_GEN_PCM_ACT_PREPARE:
4549 		alc_update_gpio_data(codec, 0x04, true);
4550 		break;
4551 	case HDA_GEN_PCM_ACT_CLEANUP:
4552 		alc_update_gpio_data(codec, 0x04, false);
4553 		break;
4554 	}
4555 }
4556 
4557 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4558 				      const struct hda_fixup *fix,
4559 				      int action)
4560 {
4561 	struct alc_spec *spec = codec->spec;
4562 
4563 	if (action == HDA_FIXUP_ACT_PROBE) {
4564 		spec->gpio_mask |= 0x04;
4565 		spec->gpio_dir |= 0x04;
4566 		spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4567 	}
4568 }
4569 
4570 static void alc_update_coef_led(struct hda_codec *codec,
4571 				struct alc_coef_led *led,
4572 				bool polarity, bool on)
4573 {
4574 	if (polarity)
4575 		on = !on;
4576 	/* temporarily power up/down for setting COEF bit */
4577 	alc_update_coef_idx(codec, led->idx, led->mask,
4578 			    on ? led->on : led->off);
4579 }
4580 
4581 /* update mute-LED according to the speaker mute state via COEF bit */
4582 static int coef_mute_led_set(struct led_classdev *led_cdev,
4583 			     enum led_brightness brightness)
4584 {
4585 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4586 	struct alc_spec *spec = codec->spec;
4587 
4588 	alc_update_coef_led(codec, &spec->mute_led_coef,
4589 			    spec->mute_led_polarity, brightness);
4590 	return 0;
4591 }
4592 
4593 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4594 					  const struct hda_fixup *fix,
4595 					  int action)
4596 {
4597 	struct alc_spec *spec = codec->spec;
4598 
4599 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4600 		spec->mute_led_polarity = 0;
4601 		spec->mute_led_coef.idx = 0x0b;
4602 		spec->mute_led_coef.mask = 1 << 3;
4603 		spec->mute_led_coef.on = 1 << 3;
4604 		spec->mute_led_coef.off = 0;
4605 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4606 	}
4607 }
4608 
4609 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4610 					  const struct hda_fixup *fix,
4611 					  int action)
4612 {
4613 	struct alc_spec *spec = codec->spec;
4614 
4615 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4616 		spec->mute_led_polarity = 0;
4617 		spec->mute_led_coef.idx = 0x34;
4618 		spec->mute_led_coef.mask = 1 << 5;
4619 		spec->mute_led_coef.on = 0;
4620 		spec->mute_led_coef.off = 1 << 5;
4621 		snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4622 	}
4623 }
4624 
4625 /* turn on/off mic-mute LED per capture hook by coef bit */
4626 static int coef_micmute_led_set(struct led_classdev *led_cdev,
4627 				enum led_brightness brightness)
4628 {
4629 	struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4630 	struct alc_spec *spec = codec->spec;
4631 
4632 	alc_update_coef_led(codec, &spec->mic_led_coef,
4633 			    spec->micmute_led_polarity, brightness);
4634 	return 0;
4635 }
4636 
4637 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4638 				const struct hda_fixup *fix, int action)
4639 {
4640 	struct alc_spec *spec = codec->spec;
4641 
4642 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4643 		spec->mic_led_coef.idx = 0x19;
4644 		spec->mic_led_coef.mask = 1 << 13;
4645 		spec->mic_led_coef.on = 1 << 13;
4646 		spec->mic_led_coef.off = 0;
4647 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4648 	}
4649 }
4650 
4651 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4652 				const struct hda_fixup *fix, int action)
4653 {
4654 	struct alc_spec *spec = codec->spec;
4655 
4656 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
4657 		spec->micmute_led_polarity = 1;
4658 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4659 }
4660 
4661 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4662 				const struct hda_fixup *fix, int action)
4663 {
4664 	struct alc_spec *spec = codec->spec;
4665 
4666 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4667 		spec->mic_led_coef.idx = 0x35;
4668 		spec->mic_led_coef.mask = 3 << 2;
4669 		spec->mic_led_coef.on = 2 << 2;
4670 		spec->mic_led_coef.off = 1 << 2;
4671 		snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4672 	}
4673 }
4674 
4675 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4676 				const struct hda_fixup *fix, int action)
4677 {
4678 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4679 	alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4680 }
4681 
4682 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4683 				const struct hda_fixup *fix, int action)
4684 {
4685 	alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4686 	alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4687 }
4688 
4689 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4690 				const struct hda_fixup *fix, int action)
4691 {
4692 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4693 	alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4694 }
4695 
4696 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4697 				const struct hda_fixup *fix, int action)
4698 {
4699 	struct alc_spec *spec = codec->spec;
4700 
4701 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4702 		spec->cap_mute_led_nid = 0x1a;
4703 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4704 		codec->power_filter = led_power_filter;
4705 	}
4706 }
4707 
4708 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4709 				const struct hda_fixup *fix, int action)
4710 {
4711 	alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4712 	alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4713 }
4714 
4715 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4716 						  const unsigned short coefs[2])
4717 {
4718 	alc_write_coef_idx(codec, 0x23, coefs[0]);
4719 	alc_write_coef_idx(codec, 0x25, coefs[1]);
4720 	alc_write_coef_idx(codec, 0x26, 0xb011);
4721 }
4722 
4723 struct alc298_samsung_amp_desc {
4724 	unsigned char nid;
4725 	unsigned short init_seq[2][2];
4726 };
4727 
4728 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4729 				     const struct hda_fixup *fix, int action)
4730 {
4731 	int i, j;
4732 	static const unsigned short init_seq[][2] = {
4733 		{ 0x19, 0x00 }, { 0x20, 0xc0 }, { 0x22, 0x44 }, { 0x23, 0x08 },
4734 		{ 0x24, 0x85 }, { 0x25, 0x41 }, { 0x35, 0x40 }, { 0x36, 0x01 },
4735 		{ 0x38, 0x81 }, { 0x3a, 0x03 }, { 0x3b, 0x81 }, { 0x40, 0x3e },
4736 		{ 0x41, 0x07 }, { 0x400, 0x1 }
4737 	};
4738 	static const struct alc298_samsung_amp_desc amps[] = {
4739 		{ 0x3a, { { 0x18, 0x1 }, { 0x26, 0x0 } } },
4740 		{ 0x39, { { 0x18, 0x2 }, { 0x26, 0x1 } } }
4741 	};
4742 
4743 	if (action != HDA_FIXUP_ACT_INIT)
4744 		return;
4745 
4746 	for (i = 0; i < ARRAY_SIZE(amps); i++) {
4747 		alc_write_coef_idx(codec, 0x22, amps[i].nid);
4748 
4749 		for (j = 0; j < ARRAY_SIZE(amps[i].init_seq); j++)
4750 			alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4751 
4752 		for (j = 0; j < ARRAY_SIZE(init_seq); j++)
4753 			alc298_samsung_write_coef_pack(codec, init_seq[j]);
4754 	}
4755 }
4756 
4757 #if IS_REACHABLE(CONFIG_INPUT)
4758 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4759 				   struct hda_jack_callback *event)
4760 {
4761 	struct alc_spec *spec = codec->spec;
4762 
4763 	/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4764 	   send both key on and key off event for every interrupt. */
4765 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
4766 	input_sync(spec->kb_dev);
4767 	input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
4768 	input_sync(spec->kb_dev);
4769 }
4770 
4771 static int alc_register_micmute_input_device(struct hda_codec *codec)
4772 {
4773 	struct alc_spec *spec = codec->spec;
4774 	int i;
4775 
4776 	spec->kb_dev = input_allocate_device();
4777 	if (!spec->kb_dev) {
4778 		codec_err(codec, "Out of memory (input_allocate_device)\n");
4779 		return -ENOMEM;
4780 	}
4781 
4782 	spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4783 
4784 	spec->kb_dev->name = "Microphone Mute Button";
4785 	spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
4786 	spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4787 	spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4788 	spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4789 	for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4790 		set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
4791 
4792 	if (input_register_device(spec->kb_dev)) {
4793 		codec_err(codec, "input_register_device failed\n");
4794 		input_free_device(spec->kb_dev);
4795 		spec->kb_dev = NULL;
4796 		return -ENOMEM;
4797 	}
4798 
4799 	return 0;
4800 }
4801 
4802 /* GPIO1 = set according to SKU external amp
4803  * GPIO2 = mic mute hotkey
4804  * GPIO3 = mute LED
4805  * GPIO4 = mic mute LED
4806  */
4807 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4808 					     const struct hda_fixup *fix, int action)
4809 {
4810 	struct alc_spec *spec = codec->spec;
4811 
4812 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4813 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4814 		spec->init_amp = ALC_INIT_DEFAULT;
4815 		if (alc_register_micmute_input_device(codec) != 0)
4816 			return;
4817 
4818 		spec->gpio_mask |= 0x06;
4819 		spec->gpio_dir |= 0x02;
4820 		spec->gpio_data |= 0x02;
4821 		snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4822 					  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
4823 		snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4824 						    gpio2_mic_hotkey_event);
4825 		return;
4826 	}
4827 
4828 	if (!spec->kb_dev)
4829 		return;
4830 
4831 	switch (action) {
4832 	case HDA_FIXUP_ACT_FREE:
4833 		input_unregister_device(spec->kb_dev);
4834 		spec->kb_dev = NULL;
4835 	}
4836 }
4837 
4838 /* Line2 = mic mute hotkey
4839  * GPIO2 = mic mute LED
4840  */
4841 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4842 					     const struct hda_fixup *fix, int action)
4843 {
4844 	struct alc_spec *spec = codec->spec;
4845 
4846 	alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4847 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4848 		spec->init_amp = ALC_INIT_DEFAULT;
4849 		if (alc_register_micmute_input_device(codec) != 0)
4850 			return;
4851 
4852 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
4853 						    gpio2_mic_hotkey_event);
4854 		return;
4855 	}
4856 
4857 	if (!spec->kb_dev)
4858 		return;
4859 
4860 	switch (action) {
4861 	case HDA_FIXUP_ACT_FREE:
4862 		input_unregister_device(spec->kb_dev);
4863 		spec->kb_dev = NULL;
4864 	}
4865 }
4866 #else /* INPUT */
4867 #define alc280_fixup_hp_gpio2_mic_hotkey	NULL
4868 #define alc233_fixup_lenovo_line2_mic_hotkey	NULL
4869 #endif /* INPUT */
4870 
4871 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4872 				const struct hda_fixup *fix, int action)
4873 {
4874 	struct alc_spec *spec = codec->spec;
4875 
4876 	alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4877 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4878 		spec->cap_mute_led_nid = 0x18;
4879 		snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4880 	}
4881 }
4882 
4883 static const struct coef_fw alc225_pre_hsmode[] = {
4884 	UPDATE_COEF(0x4a, 1<<8, 0),
4885 	UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4886 	UPDATE_COEF(0x63, 3<<14, 3<<14),
4887 	UPDATE_COEF(0x4a, 3<<4, 2<<4),
4888 	UPDATE_COEF(0x4a, 3<<10, 3<<10),
4889 	UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4890 	UPDATE_COEF(0x4a, 3<<10, 0),
4891 	{}
4892 };
4893 
4894 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4895 {
4896 	struct alc_spec *spec = codec->spec;
4897 	static const struct coef_fw coef0255[] = {
4898 		WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4899 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4900 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4901 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4902 		WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4903 		{}
4904 	};
4905 	static const struct coef_fw coef0256[] = {
4906 		WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4907 		WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4908 		WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4909 		WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4910 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4911 		{}
4912 	};
4913 	static const struct coef_fw coef0233[] = {
4914 		WRITE_COEF(0x1b, 0x0c0b),
4915 		WRITE_COEF(0x45, 0xc429),
4916 		UPDATE_COEF(0x35, 0x4000, 0),
4917 		WRITE_COEF(0x06, 0x2104),
4918 		WRITE_COEF(0x1a, 0x0001),
4919 		WRITE_COEF(0x26, 0x0004),
4920 		WRITE_COEF(0x32, 0x42a3),
4921 		{}
4922 	};
4923 	static const struct coef_fw coef0288[] = {
4924 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4925 		UPDATE_COEF(0x50, 0x2000, 0x2000),
4926 		UPDATE_COEF(0x56, 0x0006, 0x0006),
4927 		UPDATE_COEF(0x66, 0x0008, 0),
4928 		UPDATE_COEF(0x67, 0x2000, 0),
4929 		{}
4930 	};
4931 	static const struct coef_fw coef0298[] = {
4932 		UPDATE_COEF(0x19, 0x1300, 0x0300),
4933 		{}
4934 	};
4935 	static const struct coef_fw coef0292[] = {
4936 		WRITE_COEF(0x76, 0x000e),
4937 		WRITE_COEF(0x6c, 0x2400),
4938 		WRITE_COEF(0x18, 0x7308),
4939 		WRITE_COEF(0x6b, 0xc429),
4940 		{}
4941 	};
4942 	static const struct coef_fw coef0293[] = {
4943 		UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4944 		UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4945 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4946 		UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4947 		WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4948 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4949 		{}
4950 	};
4951 	static const struct coef_fw coef0668[] = {
4952 		WRITE_COEF(0x15, 0x0d40),
4953 		WRITE_COEF(0xb7, 0x802b),
4954 		{}
4955 	};
4956 	static const struct coef_fw coef0225[] = {
4957 		UPDATE_COEF(0x63, 3<<14, 0),
4958 		{}
4959 	};
4960 	static const struct coef_fw coef0274[] = {
4961 		UPDATE_COEF(0x4a, 0x0100, 0),
4962 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4963 		UPDATE_COEF(0x6b, 0xf000, 0x5000),
4964 		UPDATE_COEF(0x4a, 0x0010, 0),
4965 		UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4966 		WRITE_COEF(0x45, 0x5289),
4967 		UPDATE_COEF(0x4a, 0x0c00, 0),
4968 		{}
4969 	};
4970 
4971 	if (spec->no_internal_mic_pin) {
4972 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4973 		return;
4974 	}
4975 
4976 	switch (codec->core.vendor_id) {
4977 	case 0x10ec0255:
4978 		alc_process_coef_fw(codec, coef0255);
4979 		break;
4980 	case 0x10ec0230:
4981 	case 0x10ec0236:
4982 	case 0x10ec0256:
4983 	case 0x19e58326:
4984 		alc_process_coef_fw(codec, coef0256);
4985 		break;
4986 	case 0x10ec0234:
4987 	case 0x10ec0274:
4988 	case 0x10ec0294:
4989 		alc_process_coef_fw(codec, coef0274);
4990 		break;
4991 	case 0x10ec0233:
4992 	case 0x10ec0283:
4993 		alc_process_coef_fw(codec, coef0233);
4994 		break;
4995 	case 0x10ec0286:
4996 	case 0x10ec0288:
4997 		alc_process_coef_fw(codec, coef0288);
4998 		break;
4999 	case 0x10ec0298:
5000 		alc_process_coef_fw(codec, coef0298);
5001 		alc_process_coef_fw(codec, coef0288);
5002 		break;
5003 	case 0x10ec0292:
5004 		alc_process_coef_fw(codec, coef0292);
5005 		break;
5006 	case 0x10ec0293:
5007 		alc_process_coef_fw(codec, coef0293);
5008 		break;
5009 	case 0x10ec0668:
5010 		alc_process_coef_fw(codec, coef0668);
5011 		break;
5012 	case 0x10ec0215:
5013 	case 0x10ec0225:
5014 	case 0x10ec0285:
5015 	case 0x10ec0295:
5016 	case 0x10ec0289:
5017 	case 0x10ec0299:
5018 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5019 		alc_process_coef_fw(codec, coef0225);
5020 		break;
5021 	case 0x10ec0867:
5022 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5023 		break;
5024 	}
5025 	codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5026 }
5027 
5028 
5029 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5030 				    hda_nid_t mic_pin)
5031 {
5032 	static const struct coef_fw coef0255[] = {
5033 		WRITE_COEFEX(0x57, 0x03, 0x8aa6),
5034 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5035 		{}
5036 	};
5037 	static const struct coef_fw coef0256[] = {
5038 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
5039 		WRITE_COEFEX(0x57, 0x03, 0x09a3),
5040 		WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
5041 		{}
5042 	};
5043 	static const struct coef_fw coef0233[] = {
5044 		UPDATE_COEF(0x35, 0, 1<<14),
5045 		WRITE_COEF(0x06, 0x2100),
5046 		WRITE_COEF(0x1a, 0x0021),
5047 		WRITE_COEF(0x26, 0x008c),
5048 		{}
5049 	};
5050 	static const struct coef_fw coef0288[] = {
5051 		UPDATE_COEF(0x4f, 0x00c0, 0),
5052 		UPDATE_COEF(0x50, 0x2000, 0),
5053 		UPDATE_COEF(0x56, 0x0006, 0),
5054 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
5055 		UPDATE_COEF(0x66, 0x0008, 0x0008),
5056 		UPDATE_COEF(0x67, 0x2000, 0x2000),
5057 		{}
5058 	};
5059 	static const struct coef_fw coef0292[] = {
5060 		WRITE_COEF(0x19, 0xa208),
5061 		WRITE_COEF(0x2e, 0xacf0),
5062 		{}
5063 	};
5064 	static const struct coef_fw coef0293[] = {
5065 		UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
5066 		UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
5067 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5068 		{}
5069 	};
5070 	static const struct coef_fw coef0688[] = {
5071 		WRITE_COEF(0xb7, 0x802b),
5072 		WRITE_COEF(0xb5, 0x1040),
5073 		UPDATE_COEF(0xc3, 0, 1<<12),
5074 		{}
5075 	};
5076 	static const struct coef_fw coef0225[] = {
5077 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
5078 		UPDATE_COEF(0x4a, 3<<4, 2<<4),
5079 		UPDATE_COEF(0x63, 3<<14, 0),
5080 		{}
5081 	};
5082 	static const struct coef_fw coef0274[] = {
5083 		UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
5084 		UPDATE_COEF(0x4a, 0x0010, 0),
5085 		UPDATE_COEF(0x6b, 0xf000, 0),
5086 		{}
5087 	};
5088 
5089 	switch (codec->core.vendor_id) {
5090 	case 0x10ec0255:
5091 		alc_write_coef_idx(codec, 0x45, 0xc489);
5092 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5093 		alc_process_coef_fw(codec, coef0255);
5094 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5095 		break;
5096 	case 0x10ec0230:
5097 	case 0x10ec0236:
5098 	case 0x10ec0256:
5099 	case 0x19e58326:
5100 		alc_write_coef_idx(codec, 0x45, 0xc489);
5101 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5102 		alc_process_coef_fw(codec, coef0256);
5103 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5104 		break;
5105 	case 0x10ec0234:
5106 	case 0x10ec0274:
5107 	case 0x10ec0294:
5108 		alc_write_coef_idx(codec, 0x45, 0x4689);
5109 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5110 		alc_process_coef_fw(codec, coef0274);
5111 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5112 		break;
5113 	case 0x10ec0233:
5114 	case 0x10ec0283:
5115 		alc_write_coef_idx(codec, 0x45, 0xc429);
5116 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5117 		alc_process_coef_fw(codec, coef0233);
5118 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5119 		break;
5120 	case 0x10ec0286:
5121 	case 0x10ec0288:
5122 	case 0x10ec0298:
5123 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5124 		alc_process_coef_fw(codec, coef0288);
5125 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5126 		break;
5127 	case 0x10ec0292:
5128 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5129 		alc_process_coef_fw(codec, coef0292);
5130 		break;
5131 	case 0x10ec0293:
5132 		/* Set to TRS mode */
5133 		alc_write_coef_idx(codec, 0x45, 0xc429);
5134 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5135 		alc_process_coef_fw(codec, coef0293);
5136 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5137 		break;
5138 	case 0x10ec0867:
5139 		alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5140 		fallthrough;
5141 	case 0x10ec0221:
5142 	case 0x10ec0662:
5143 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5144 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5145 		break;
5146 	case 0x10ec0668:
5147 		alc_write_coef_idx(codec, 0x11, 0x0001);
5148 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5149 		alc_process_coef_fw(codec, coef0688);
5150 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5151 		break;
5152 	case 0x10ec0215:
5153 	case 0x10ec0225:
5154 	case 0x10ec0285:
5155 	case 0x10ec0295:
5156 	case 0x10ec0289:
5157 	case 0x10ec0299:
5158 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5159 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5160 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5161 		alc_process_coef_fw(codec, coef0225);
5162 		snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5163 		break;
5164 	}
5165 	codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5166 }
5167 
5168 static void alc_headset_mode_default(struct hda_codec *codec)
5169 {
5170 	static const struct coef_fw coef0225[] = {
5171 		UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5172 		UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5173 		UPDATE_COEF(0x49, 3<<8, 0<<8),
5174 		UPDATE_COEF(0x4a, 3<<4, 3<<4),
5175 		UPDATE_COEF(0x63, 3<<14, 0),
5176 		UPDATE_COEF(0x67, 0xf000, 0x3000),
5177 		{}
5178 	};
5179 	static const struct coef_fw coef0255[] = {
5180 		WRITE_COEF(0x45, 0xc089),
5181 		WRITE_COEF(0x45, 0xc489),
5182 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5183 		WRITE_COEF(0x49, 0x0049),
5184 		{}
5185 	};
5186 	static const struct coef_fw coef0256[] = {
5187 		WRITE_COEF(0x45, 0xc489),
5188 		WRITE_COEFEX(0x57, 0x03, 0x0da3),
5189 		WRITE_COEF(0x49, 0x0049),
5190 		UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5191 		WRITE_COEF(0x06, 0x6100),
5192 		{}
5193 	};
5194 	static const struct coef_fw coef0233[] = {
5195 		WRITE_COEF(0x06, 0x2100),
5196 		WRITE_COEF(0x32, 0x4ea3),
5197 		{}
5198 	};
5199 	static const struct coef_fw coef0288[] = {
5200 		UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5201 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5202 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5203 		UPDATE_COEF(0x66, 0x0008, 0),
5204 		UPDATE_COEF(0x67, 0x2000, 0),
5205 		{}
5206 	};
5207 	static const struct coef_fw coef0292[] = {
5208 		WRITE_COEF(0x76, 0x000e),
5209 		WRITE_COEF(0x6c, 0x2400),
5210 		WRITE_COEF(0x6b, 0xc429),
5211 		WRITE_COEF(0x18, 0x7308),
5212 		{}
5213 	};
5214 	static const struct coef_fw coef0293[] = {
5215 		UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5216 		WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5217 		UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5218 		{}
5219 	};
5220 	static const struct coef_fw coef0688[] = {
5221 		WRITE_COEF(0x11, 0x0041),
5222 		WRITE_COEF(0x15, 0x0d40),
5223 		WRITE_COEF(0xb7, 0x802b),
5224 		{}
5225 	};
5226 	static const struct coef_fw coef0274[] = {
5227 		WRITE_COEF(0x45, 0x4289),
5228 		UPDATE_COEF(0x4a, 0x0010, 0x0010),
5229 		UPDATE_COEF(0x6b, 0x0f00, 0),
5230 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5231 		{}
5232 	};
5233 
5234 	switch (codec->core.vendor_id) {
5235 	case 0x10ec0215:
5236 	case 0x10ec0225:
5237 	case 0x10ec0285:
5238 	case 0x10ec0295:
5239 	case 0x10ec0289:
5240 	case 0x10ec0299:
5241 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5242 		alc_process_coef_fw(codec, coef0225);
5243 		break;
5244 	case 0x10ec0255:
5245 		alc_process_coef_fw(codec, coef0255);
5246 		break;
5247 	case 0x10ec0230:
5248 	case 0x10ec0236:
5249 	case 0x10ec0256:
5250 	case 0x19e58326:
5251 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5252 		alc_write_coef_idx(codec, 0x45, 0xc089);
5253 		msleep(50);
5254 		alc_process_coef_fw(codec, coef0256);
5255 		break;
5256 	case 0x10ec0234:
5257 	case 0x10ec0274:
5258 	case 0x10ec0294:
5259 		alc_process_coef_fw(codec, coef0274);
5260 		break;
5261 	case 0x10ec0233:
5262 	case 0x10ec0283:
5263 		alc_process_coef_fw(codec, coef0233);
5264 		break;
5265 	case 0x10ec0286:
5266 	case 0x10ec0288:
5267 	case 0x10ec0298:
5268 		alc_process_coef_fw(codec, coef0288);
5269 		break;
5270 	case 0x10ec0292:
5271 		alc_process_coef_fw(codec, coef0292);
5272 		break;
5273 	case 0x10ec0293:
5274 		alc_process_coef_fw(codec, coef0293);
5275 		break;
5276 	case 0x10ec0668:
5277 		alc_process_coef_fw(codec, coef0688);
5278 		break;
5279 	case 0x10ec0867:
5280 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5281 		break;
5282 	}
5283 	codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5284 }
5285 
5286 /* Iphone type */
5287 static void alc_headset_mode_ctia(struct hda_codec *codec)
5288 {
5289 	int val;
5290 
5291 	static const struct coef_fw coef0255[] = {
5292 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5293 		WRITE_COEF(0x1b, 0x0c2b),
5294 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5295 		{}
5296 	};
5297 	static const struct coef_fw coef0256[] = {
5298 		WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5299 		WRITE_COEF(0x1b, 0x0e6b),
5300 		{}
5301 	};
5302 	static const struct coef_fw coef0233[] = {
5303 		WRITE_COEF(0x45, 0xd429),
5304 		WRITE_COEF(0x1b, 0x0c2b),
5305 		WRITE_COEF(0x32, 0x4ea3),
5306 		{}
5307 	};
5308 	static const struct coef_fw coef0288[] = {
5309 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5310 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5311 		UPDATE_COEF(0x66, 0x0008, 0),
5312 		UPDATE_COEF(0x67, 0x2000, 0),
5313 		{}
5314 	};
5315 	static const struct coef_fw coef0292[] = {
5316 		WRITE_COEF(0x6b, 0xd429),
5317 		WRITE_COEF(0x76, 0x0008),
5318 		WRITE_COEF(0x18, 0x7388),
5319 		{}
5320 	};
5321 	static const struct coef_fw coef0293[] = {
5322 		WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5323 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5324 		{}
5325 	};
5326 	static const struct coef_fw coef0688[] = {
5327 		WRITE_COEF(0x11, 0x0001),
5328 		WRITE_COEF(0x15, 0x0d60),
5329 		WRITE_COEF(0xc3, 0x0000),
5330 		{}
5331 	};
5332 	static const struct coef_fw coef0225_1[] = {
5333 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5334 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5335 		{}
5336 	};
5337 	static const struct coef_fw coef0225_2[] = {
5338 		UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5339 		UPDATE_COEF(0x63, 3<<14, 1<<14),
5340 		{}
5341 	};
5342 
5343 	switch (codec->core.vendor_id) {
5344 	case 0x10ec0255:
5345 		alc_process_coef_fw(codec, coef0255);
5346 		break;
5347 	case 0x10ec0230:
5348 	case 0x10ec0236:
5349 	case 0x10ec0256:
5350 	case 0x19e58326:
5351 		alc_process_coef_fw(codec, coef0256);
5352 		break;
5353 	case 0x10ec0234:
5354 	case 0x10ec0274:
5355 	case 0x10ec0294:
5356 		alc_write_coef_idx(codec, 0x45, 0xd689);
5357 		break;
5358 	case 0x10ec0233:
5359 	case 0x10ec0283:
5360 		alc_process_coef_fw(codec, coef0233);
5361 		break;
5362 	case 0x10ec0298:
5363 		val = alc_read_coef_idx(codec, 0x50);
5364 		if (val & (1 << 12)) {
5365 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5366 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5367 			msleep(300);
5368 		} else {
5369 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5370 			alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5371 			msleep(300);
5372 		}
5373 		break;
5374 	case 0x10ec0286:
5375 	case 0x10ec0288:
5376 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5377 		msleep(300);
5378 		alc_process_coef_fw(codec, coef0288);
5379 		break;
5380 	case 0x10ec0292:
5381 		alc_process_coef_fw(codec, coef0292);
5382 		break;
5383 	case 0x10ec0293:
5384 		alc_process_coef_fw(codec, coef0293);
5385 		break;
5386 	case 0x10ec0668:
5387 		alc_process_coef_fw(codec, coef0688);
5388 		break;
5389 	case 0x10ec0215:
5390 	case 0x10ec0225:
5391 	case 0x10ec0285:
5392 	case 0x10ec0295:
5393 	case 0x10ec0289:
5394 	case 0x10ec0299:
5395 		val = alc_read_coef_idx(codec, 0x45);
5396 		if (val & (1 << 9))
5397 			alc_process_coef_fw(codec, coef0225_2);
5398 		else
5399 			alc_process_coef_fw(codec, coef0225_1);
5400 		break;
5401 	case 0x10ec0867:
5402 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5403 		break;
5404 	}
5405 	codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5406 }
5407 
5408 /* Nokia type */
5409 static void alc_headset_mode_omtp(struct hda_codec *codec)
5410 {
5411 	static const struct coef_fw coef0255[] = {
5412 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5413 		WRITE_COEF(0x1b, 0x0c2b),
5414 		WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5415 		{}
5416 	};
5417 	static const struct coef_fw coef0256[] = {
5418 		WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5419 		WRITE_COEF(0x1b, 0x0e6b),
5420 		{}
5421 	};
5422 	static const struct coef_fw coef0233[] = {
5423 		WRITE_COEF(0x45, 0xe429),
5424 		WRITE_COEF(0x1b, 0x0c2b),
5425 		WRITE_COEF(0x32, 0x4ea3),
5426 		{}
5427 	};
5428 	static const struct coef_fw coef0288[] = {
5429 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5430 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5431 		UPDATE_COEF(0x66, 0x0008, 0),
5432 		UPDATE_COEF(0x67, 0x2000, 0),
5433 		{}
5434 	};
5435 	static const struct coef_fw coef0292[] = {
5436 		WRITE_COEF(0x6b, 0xe429),
5437 		WRITE_COEF(0x76, 0x0008),
5438 		WRITE_COEF(0x18, 0x7388),
5439 		{}
5440 	};
5441 	static const struct coef_fw coef0293[] = {
5442 		WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5443 		UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5444 		{}
5445 	};
5446 	static const struct coef_fw coef0688[] = {
5447 		WRITE_COEF(0x11, 0x0001),
5448 		WRITE_COEF(0x15, 0x0d50),
5449 		WRITE_COEF(0xc3, 0x0000),
5450 		{}
5451 	};
5452 	static const struct coef_fw coef0225[] = {
5453 		UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
5454 		UPDATE_COEF(0x63, 3<<14, 2<<14),
5455 		{}
5456 	};
5457 
5458 	switch (codec->core.vendor_id) {
5459 	case 0x10ec0255:
5460 		alc_process_coef_fw(codec, coef0255);
5461 		break;
5462 	case 0x10ec0230:
5463 	case 0x10ec0236:
5464 	case 0x10ec0256:
5465 	case 0x19e58326:
5466 		alc_process_coef_fw(codec, coef0256);
5467 		break;
5468 	case 0x10ec0234:
5469 	case 0x10ec0274:
5470 	case 0x10ec0294:
5471 		alc_write_coef_idx(codec, 0x45, 0xe689);
5472 		break;
5473 	case 0x10ec0233:
5474 	case 0x10ec0283:
5475 		alc_process_coef_fw(codec, coef0233);
5476 		break;
5477 	case 0x10ec0298:
5478 		alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5479 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5480 		msleep(300);
5481 		break;
5482 	case 0x10ec0286:
5483 	case 0x10ec0288:
5484 		alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5485 		msleep(300);
5486 		alc_process_coef_fw(codec, coef0288);
5487 		break;
5488 	case 0x10ec0292:
5489 		alc_process_coef_fw(codec, coef0292);
5490 		break;
5491 	case 0x10ec0293:
5492 		alc_process_coef_fw(codec, coef0293);
5493 		break;
5494 	case 0x10ec0668:
5495 		alc_process_coef_fw(codec, coef0688);
5496 		break;
5497 	case 0x10ec0215:
5498 	case 0x10ec0225:
5499 	case 0x10ec0285:
5500 	case 0x10ec0295:
5501 	case 0x10ec0289:
5502 	case 0x10ec0299:
5503 		alc_process_coef_fw(codec, coef0225);
5504 		break;
5505 	}
5506 	codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5507 }
5508 
5509 static void alc_determine_headset_type(struct hda_codec *codec)
5510 {
5511 	int val;
5512 	bool is_ctia = false;
5513 	struct alc_spec *spec = codec->spec;
5514 	static const struct coef_fw coef0255[] = {
5515 		WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5516 		WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5517  conteol) */
5518 		{}
5519 	};
5520 	static const struct coef_fw coef0288[] = {
5521 		UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5522 		{}
5523 	};
5524 	static const struct coef_fw coef0298[] = {
5525 		UPDATE_COEF(0x50, 0x2000, 0x2000),
5526 		UPDATE_COEF(0x56, 0x0006, 0x0006),
5527 		UPDATE_COEF(0x66, 0x0008, 0),
5528 		UPDATE_COEF(0x67, 0x2000, 0),
5529 		UPDATE_COEF(0x19, 0x1300, 0x1300),
5530 		{}
5531 	};
5532 	static const struct coef_fw coef0293[] = {
5533 		UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5534 		WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5535 		{}
5536 	};
5537 	static const struct coef_fw coef0688[] = {
5538 		WRITE_COEF(0x11, 0x0001),
5539 		WRITE_COEF(0xb7, 0x802b),
5540 		WRITE_COEF(0x15, 0x0d60),
5541 		WRITE_COEF(0xc3, 0x0c00),
5542 		{}
5543 	};
5544 	static const struct coef_fw coef0274[] = {
5545 		UPDATE_COEF(0x4a, 0x0010, 0),
5546 		UPDATE_COEF(0x4a, 0x8000, 0),
5547 		WRITE_COEF(0x45, 0xd289),
5548 		UPDATE_COEF(0x49, 0x0300, 0x0300),
5549 		{}
5550 	};
5551 
5552 	if (spec->no_internal_mic_pin) {
5553 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5554 		return;
5555 	}
5556 
5557 	switch (codec->core.vendor_id) {
5558 	case 0x10ec0255:
5559 		alc_process_coef_fw(codec, coef0255);
5560 		msleep(300);
5561 		val = alc_read_coef_idx(codec, 0x46);
5562 		is_ctia = (val & 0x0070) == 0x0070;
5563 		break;
5564 	case 0x10ec0230:
5565 	case 0x10ec0236:
5566 	case 0x10ec0256:
5567 	case 0x19e58326:
5568 		alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5569 		alc_write_coef_idx(codec, 0x06, 0x6104);
5570 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5571 
5572 		snd_hda_codec_write(codec, 0x21, 0,
5573 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5574 		msleep(80);
5575 		snd_hda_codec_write(codec, 0x21, 0,
5576 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5577 
5578 		alc_process_coef_fw(codec, coef0255);
5579 		msleep(300);
5580 		val = alc_read_coef_idx(codec, 0x46);
5581 		is_ctia = (val & 0x0070) == 0x0070;
5582 
5583 		alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5584 		alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5585 
5586 		snd_hda_codec_write(codec, 0x21, 0,
5587 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5588 		msleep(80);
5589 		snd_hda_codec_write(codec, 0x21, 0,
5590 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5591 		break;
5592 	case 0x10ec0234:
5593 	case 0x10ec0274:
5594 	case 0x10ec0294:
5595 		alc_process_coef_fw(codec, coef0274);
5596 		msleep(850);
5597 		val = alc_read_coef_idx(codec, 0x46);
5598 		is_ctia = (val & 0x00f0) == 0x00f0;
5599 		break;
5600 	case 0x10ec0233:
5601 	case 0x10ec0283:
5602 		alc_write_coef_idx(codec, 0x45, 0xd029);
5603 		msleep(300);
5604 		val = alc_read_coef_idx(codec, 0x46);
5605 		is_ctia = (val & 0x0070) == 0x0070;
5606 		break;
5607 	case 0x10ec0298:
5608 		snd_hda_codec_write(codec, 0x21, 0,
5609 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5610 		msleep(100);
5611 		snd_hda_codec_write(codec, 0x21, 0,
5612 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5613 		msleep(200);
5614 
5615 		val = alc_read_coef_idx(codec, 0x50);
5616 		if (val & (1 << 12)) {
5617 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5618 			alc_process_coef_fw(codec, coef0288);
5619 			msleep(350);
5620 			val = alc_read_coef_idx(codec, 0x50);
5621 			is_ctia = (val & 0x0070) == 0x0070;
5622 		} else {
5623 			alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5624 			alc_process_coef_fw(codec, coef0288);
5625 			msleep(350);
5626 			val = alc_read_coef_idx(codec, 0x50);
5627 			is_ctia = (val & 0x0070) == 0x0070;
5628 		}
5629 		alc_process_coef_fw(codec, coef0298);
5630 		snd_hda_codec_write(codec, 0x21, 0,
5631 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5632 		msleep(75);
5633 		snd_hda_codec_write(codec, 0x21, 0,
5634 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5635 		break;
5636 	case 0x10ec0286:
5637 	case 0x10ec0288:
5638 		alc_process_coef_fw(codec, coef0288);
5639 		msleep(350);
5640 		val = alc_read_coef_idx(codec, 0x50);
5641 		is_ctia = (val & 0x0070) == 0x0070;
5642 		break;
5643 	case 0x10ec0292:
5644 		alc_write_coef_idx(codec, 0x6b, 0xd429);
5645 		msleep(300);
5646 		val = alc_read_coef_idx(codec, 0x6c);
5647 		is_ctia = (val & 0x001c) == 0x001c;
5648 		break;
5649 	case 0x10ec0293:
5650 		alc_process_coef_fw(codec, coef0293);
5651 		msleep(300);
5652 		val = alc_read_coef_idx(codec, 0x46);
5653 		is_ctia = (val & 0x0070) == 0x0070;
5654 		break;
5655 	case 0x10ec0668:
5656 		alc_process_coef_fw(codec, coef0688);
5657 		msleep(300);
5658 		val = alc_read_coef_idx(codec, 0xbe);
5659 		is_ctia = (val & 0x1c02) == 0x1c02;
5660 		break;
5661 	case 0x10ec0215:
5662 	case 0x10ec0225:
5663 	case 0x10ec0285:
5664 	case 0x10ec0295:
5665 	case 0x10ec0289:
5666 	case 0x10ec0299:
5667 		snd_hda_codec_write(codec, 0x21, 0,
5668 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5669 		msleep(80);
5670 		snd_hda_codec_write(codec, 0x21, 0,
5671 			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5672 
5673 		alc_process_coef_fw(codec, alc225_pre_hsmode);
5674 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5675 		val = alc_read_coef_idx(codec, 0x45);
5676 		if (val & (1 << 9)) {
5677 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5678 			alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5679 			msleep(800);
5680 			val = alc_read_coef_idx(codec, 0x46);
5681 			is_ctia = (val & 0x00f0) == 0x00f0;
5682 		} else {
5683 			alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5684 			alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5685 			msleep(800);
5686 			val = alc_read_coef_idx(codec, 0x46);
5687 			is_ctia = (val & 0x00f0) == 0x00f0;
5688 		}
5689 		alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5690 		alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5691 		alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5692 
5693 		snd_hda_codec_write(codec, 0x21, 0,
5694 			    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5695 		msleep(80);
5696 		snd_hda_codec_write(codec, 0x21, 0,
5697 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5698 		break;
5699 	case 0x10ec0867:
5700 		is_ctia = true;
5701 		break;
5702 	}
5703 
5704 	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5705 		    is_ctia ? "yes" : "no");
5706 	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5707 }
5708 
5709 static void alc_update_headset_mode(struct hda_codec *codec)
5710 {
5711 	struct alc_spec *spec = codec->spec;
5712 
5713 	hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
5714 	hda_nid_t hp_pin = alc_get_hp_pin(spec);
5715 
5716 	int new_headset_mode;
5717 
5718 	if (!snd_hda_jack_detect(codec, hp_pin))
5719 		new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5720 	else if (mux_pin == spec->headset_mic_pin)
5721 		new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5722 	else if (mux_pin == spec->headphone_mic_pin)
5723 		new_headset_mode = ALC_HEADSET_MODE_MIC;
5724 	else
5725 		new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5726 
5727 	if (new_headset_mode == spec->current_headset_mode) {
5728 		snd_hda_gen_update_outputs(codec);
5729 		return;
5730 	}
5731 
5732 	switch (new_headset_mode) {
5733 	case ALC_HEADSET_MODE_UNPLUGGED:
5734 		alc_headset_mode_unplugged(codec);
5735 		spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5736 		spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5737 		spec->gen.hp_jack_present = false;
5738 		break;
5739 	case ALC_HEADSET_MODE_HEADSET:
5740 		if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5741 			alc_determine_headset_type(codec);
5742 		if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5743 			alc_headset_mode_ctia(codec);
5744 		else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5745 			alc_headset_mode_omtp(codec);
5746 		spec->gen.hp_jack_present = true;
5747 		break;
5748 	case ALC_HEADSET_MODE_MIC:
5749 		alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5750 		spec->gen.hp_jack_present = false;
5751 		break;
5752 	case ALC_HEADSET_MODE_HEADPHONE:
5753 		alc_headset_mode_default(codec);
5754 		spec->gen.hp_jack_present = true;
5755 		break;
5756 	}
5757 	if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5758 		snd_hda_set_pin_ctl_cache(codec, hp_pin,
5759 					  AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
5760 		if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
5761 			snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5762 						  PIN_VREFHIZ);
5763 	}
5764 	spec->current_headset_mode = new_headset_mode;
5765 
5766 	snd_hda_gen_update_outputs(codec);
5767 }
5768 
5769 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5770 					 struct snd_kcontrol *kcontrol,
5771 					 struct snd_ctl_elem_value *ucontrol)
5772 {
5773 	alc_update_headset_mode(codec);
5774 }
5775 
5776 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5777 				       struct hda_jack_callback *jack)
5778 {
5779 	snd_hda_gen_hp_automute(codec, jack);
5780 	alc_update_headset_mode(codec);
5781 }
5782 
5783 static void alc_probe_headset_mode(struct hda_codec *codec)
5784 {
5785 	int i;
5786 	struct alc_spec *spec = codec->spec;
5787 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5788 
5789 	/* Find mic pins */
5790 	for (i = 0; i < cfg->num_inputs; i++) {
5791 		if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5792 			spec->headset_mic_pin = cfg->inputs[i].pin;
5793 		if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5794 			spec->headphone_mic_pin = cfg->inputs[i].pin;
5795 	}
5796 
5797 	WARN_ON(spec->gen.cap_sync_hook);
5798 	spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5799 	spec->gen.automute_hook = alc_update_headset_mode;
5800 	spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5801 }
5802 
5803 static void alc_fixup_headset_mode(struct hda_codec *codec,
5804 				const struct hda_fixup *fix, int action)
5805 {
5806 	struct alc_spec *spec = codec->spec;
5807 
5808 	switch (action) {
5809 	case HDA_FIXUP_ACT_PRE_PROBE:
5810 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5811 		break;
5812 	case HDA_FIXUP_ACT_PROBE:
5813 		alc_probe_headset_mode(codec);
5814 		break;
5815 	case HDA_FIXUP_ACT_INIT:
5816 		if (is_s3_resume(codec) || is_s4_resume(codec)) {
5817 			spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5818 			spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5819 		}
5820 		alc_update_headset_mode(codec);
5821 		break;
5822 	}
5823 }
5824 
5825 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5826 				const struct hda_fixup *fix, int action)
5827 {
5828 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5829 		struct alc_spec *spec = codec->spec;
5830 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5831 	}
5832 	else
5833 		alc_fixup_headset_mode(codec, fix, action);
5834 }
5835 
5836 static void alc255_set_default_jack_type(struct hda_codec *codec)
5837 {
5838 	/* Set to iphone type */
5839 	static const struct coef_fw alc255fw[] = {
5840 		WRITE_COEF(0x1b, 0x880b),
5841 		WRITE_COEF(0x45, 0xd089),
5842 		WRITE_COEF(0x1b, 0x080b),
5843 		WRITE_COEF(0x46, 0x0004),
5844 		WRITE_COEF(0x1b, 0x0c0b),
5845 		{}
5846 	};
5847 	static const struct coef_fw alc256fw[] = {
5848 		WRITE_COEF(0x1b, 0x884b),
5849 		WRITE_COEF(0x45, 0xd089),
5850 		WRITE_COEF(0x1b, 0x084b),
5851 		WRITE_COEF(0x46, 0x0004),
5852 		WRITE_COEF(0x1b, 0x0c4b),
5853 		{}
5854 	};
5855 	switch (codec->core.vendor_id) {
5856 	case 0x10ec0255:
5857 		alc_process_coef_fw(codec, alc255fw);
5858 		break;
5859 	case 0x10ec0230:
5860 	case 0x10ec0236:
5861 	case 0x10ec0256:
5862 	case 0x19e58326:
5863 		alc_process_coef_fw(codec, alc256fw);
5864 		break;
5865 	}
5866 	msleep(30);
5867 }
5868 
5869 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5870 				const struct hda_fixup *fix, int action)
5871 {
5872 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5873 		alc255_set_default_jack_type(codec);
5874 	}
5875 	alc_fixup_headset_mode(codec, fix, action);
5876 }
5877 
5878 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5879 				const struct hda_fixup *fix, int action)
5880 {
5881 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5882 		struct alc_spec *spec = codec->spec;
5883 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5884 		alc255_set_default_jack_type(codec);
5885 	}
5886 	else
5887 		alc_fixup_headset_mode(codec, fix, action);
5888 }
5889 
5890 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5891 				       struct hda_jack_callback *jack)
5892 {
5893 	struct alc_spec *spec = codec->spec;
5894 
5895 	alc_update_headset_jack_cb(codec, jack);
5896 	/* Headset Mic enable or disable, only for Dell Dino */
5897 	alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5898 }
5899 
5900 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5901 				const struct hda_fixup *fix, int action)
5902 {
5903 	alc_fixup_headset_mode(codec, fix, action);
5904 	if (action == HDA_FIXUP_ACT_PROBE) {
5905 		struct alc_spec *spec = codec->spec;
5906 		/* toggled via hp_automute_hook */
5907 		spec->gpio_mask |= 0x40;
5908 		spec->gpio_dir |= 0x40;
5909 		spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5910 	}
5911 }
5912 
5913 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5914 					const struct hda_fixup *fix, int action)
5915 {
5916 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5917 		struct alc_spec *spec = codec->spec;
5918 		spec->gen.auto_mute_via_amp = 1;
5919 	}
5920 }
5921 
5922 static void alc_fixup_no_shutup(struct hda_codec *codec,
5923 				const struct hda_fixup *fix, int action)
5924 {
5925 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5926 		struct alc_spec *spec = codec->spec;
5927 		spec->no_shutup_pins = 1;
5928 	}
5929 }
5930 
5931 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5932 				    const struct hda_fixup *fix, int action)
5933 {
5934 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5935 		struct alc_spec *spec = codec->spec;
5936 		/* Disable AA-loopback as it causes white noise */
5937 		spec->gen.mixer_nid = 0;
5938 	}
5939 }
5940 
5941 /* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5942 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5943 				  const struct hda_fixup *fix, int action)
5944 {
5945 	static const struct hda_pintbl pincfgs[] = {
5946 		{ 0x16, 0x21211010 }, /* dock headphone */
5947 		{ 0x19, 0x21a11010 }, /* dock mic */
5948 		{ }
5949 	};
5950 	struct alc_spec *spec = codec->spec;
5951 
5952 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5953 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5954 		codec->power_save_node = 0; /* avoid click noises */
5955 		snd_hda_apply_pincfgs(codec, pincfgs);
5956 	}
5957 }
5958 
5959 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5960 				  const struct hda_fixup *fix, int action)
5961 {
5962 	static const struct hda_pintbl pincfgs[] = {
5963 		{ 0x17, 0x21211010 }, /* dock headphone */
5964 		{ 0x19, 0x21a11010 }, /* dock mic */
5965 		{ }
5966 	};
5967 	struct alc_spec *spec = codec->spec;
5968 
5969 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5970 		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5971 		snd_hda_apply_pincfgs(codec, pincfgs);
5972 	} else if (action == HDA_FIXUP_ACT_INIT) {
5973 		/* Enable DOCK device */
5974 		snd_hda_codec_write(codec, 0x17, 0,
5975 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5976 		/* Enable DOCK device */
5977 		snd_hda_codec_write(codec, 0x19, 0,
5978 			    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5979 	}
5980 }
5981 
5982 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5983 				  const struct hda_fixup *fix, int action)
5984 {
5985 	/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5986 	 * the speaker output becomes too low by some reason on Thinkpads with
5987 	 * ALC298 codec
5988 	 */
5989 	static const hda_nid_t preferred_pairs[] = {
5990 		0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5991 		0
5992 	};
5993 	struct alc_spec *spec = codec->spec;
5994 
5995 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
5996 		spec->gen.preferred_dacs = preferred_pairs;
5997 }
5998 
5999 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
6000 				   const struct hda_fixup *fix, int action)
6001 {
6002 	static const hda_nid_t preferred_pairs[] = {
6003 		0x17, 0x02, 0x21, 0x03, 0
6004 	};
6005 	struct alc_spec *spec = codec->spec;
6006 
6007 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6008 		spec->gen.preferred_dacs = preferred_pairs;
6009 }
6010 
6011 static void alc_shutup_dell_xps13(struct hda_codec *codec)
6012 {
6013 	struct alc_spec *spec = codec->spec;
6014 	int hp_pin = alc_get_hp_pin(spec);
6015 
6016 	/* Prevent pop noises when headphones are plugged in */
6017 	snd_hda_codec_write(codec, hp_pin, 0,
6018 			    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
6019 	msleep(20);
6020 }
6021 
6022 static void alc_fixup_dell_xps13(struct hda_codec *codec,
6023 				const struct hda_fixup *fix, int action)
6024 {
6025 	struct alc_spec *spec = codec->spec;
6026 	struct hda_input_mux *imux = &spec->gen.input_mux;
6027 	int i;
6028 
6029 	switch (action) {
6030 	case HDA_FIXUP_ACT_PRE_PROBE:
6031 		/* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
6032 		 * it causes a click noise at start up
6033 		 */
6034 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6035 		spec->shutup = alc_shutup_dell_xps13;
6036 		break;
6037 	case HDA_FIXUP_ACT_PROBE:
6038 		/* Make the internal mic the default input source. */
6039 		for (i = 0; i < imux->num_items; i++) {
6040 			if (spec->gen.imux_pins[i] == 0x12) {
6041 				spec->gen.cur_mux[0] = i;
6042 				break;
6043 			}
6044 		}
6045 		break;
6046 	}
6047 }
6048 
6049 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6050 				const struct hda_fixup *fix, int action)
6051 {
6052 	struct alc_spec *spec = codec->spec;
6053 
6054 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6055 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
6056 		spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
6057 
6058 		/* Disable boost for mic-in permanently. (This code is only called
6059 		   from quirks that guarantee that the headphone is at NID 0x1b.) */
6060 		snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6061 		snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6062 	} else
6063 		alc_fixup_headset_mode(codec, fix, action);
6064 }
6065 
6066 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6067 				const struct hda_fixup *fix, int action)
6068 {
6069 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6070 		alc_write_coef_idx(codec, 0xc4, 0x8000);
6071 		alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6072 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6073 	}
6074 	alc_fixup_headset_mode(codec, fix, action);
6075 }
6076 
6077 /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
6078 static int find_ext_mic_pin(struct hda_codec *codec)
6079 {
6080 	struct alc_spec *spec = codec->spec;
6081 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6082 	hda_nid_t nid;
6083 	unsigned int defcfg;
6084 	int i;
6085 
6086 	for (i = 0; i < cfg->num_inputs; i++) {
6087 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6088 			continue;
6089 		nid = cfg->inputs[i].pin;
6090 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6091 		if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
6092 			continue;
6093 		return nid;
6094 	}
6095 
6096 	return 0;
6097 }
6098 
6099 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6100 				    const struct hda_fixup *fix,
6101 				    int action)
6102 {
6103 	struct alc_spec *spec = codec->spec;
6104 
6105 	if (action == HDA_FIXUP_ACT_PROBE) {
6106 		int mic_pin = find_ext_mic_pin(codec);
6107 		int hp_pin = alc_get_hp_pin(spec);
6108 
6109 		if (snd_BUG_ON(!mic_pin || !hp_pin))
6110 			return;
6111 		snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6112 	}
6113 }
6114 
6115 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6116 					     const struct hda_fixup *fix,
6117 					     int action)
6118 {
6119 	struct alc_spec *spec = codec->spec;
6120 	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6121 	int i;
6122 
6123 	/* The mic boosts on level 2 and 3 are too noisy
6124 	   on the internal mic input.
6125 	   Therefore limit the boost to 0 or 1. */
6126 
6127 	if (action != HDA_FIXUP_ACT_PROBE)
6128 		return;
6129 
6130 	for (i = 0; i < cfg->num_inputs; i++) {
6131 		hda_nid_t nid = cfg->inputs[i].pin;
6132 		unsigned int defcfg;
6133 		if (cfg->inputs[i].type != AUTO_PIN_MIC)
6134 			continue;
6135 		defcfg = snd_hda_codec_get_pincfg(codec, nid);
6136 		if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6137 			continue;
6138 
6139 		snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6140 					  (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6141 					  (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6142 					  (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6143 					  (0 << AC_AMPCAP_MUTE_SHIFT));
6144 	}
6145 }
6146 
6147 static void alc283_hp_automute_hook(struct hda_codec *codec,
6148 				    struct hda_jack_callback *jack)
6149 {
6150 	struct alc_spec *spec = codec->spec;
6151 	int vref;
6152 
6153 	msleep(200);
6154 	snd_hda_gen_hp_automute(codec, jack);
6155 
6156 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6157 
6158 	msleep(600);
6159 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6160 			    vref);
6161 }
6162 
6163 static void alc283_fixup_chromebook(struct hda_codec *codec,
6164 				    const struct hda_fixup *fix, int action)
6165 {
6166 	struct alc_spec *spec = codec->spec;
6167 
6168 	switch (action) {
6169 	case HDA_FIXUP_ACT_PRE_PROBE:
6170 		snd_hda_override_wcaps(codec, 0x03, 0);
6171 		/* Disable AA-loopback as it causes white noise */
6172 		spec->gen.mixer_nid = 0;
6173 		break;
6174 	case HDA_FIXUP_ACT_INIT:
6175 		/* MIC2-VREF control */
6176 		/* Set to manual mode */
6177 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6178 		/* Enable Line1 input control by verb */
6179 		alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6180 		break;
6181 	}
6182 }
6183 
6184 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6185 				    const struct hda_fixup *fix, int action)
6186 {
6187 	struct alc_spec *spec = codec->spec;
6188 
6189 	switch (action) {
6190 	case HDA_FIXUP_ACT_PRE_PROBE:
6191 		spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6192 		break;
6193 	case HDA_FIXUP_ACT_INIT:
6194 		/* MIC2-VREF control */
6195 		/* Set to manual mode */
6196 		alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6197 		break;
6198 	}
6199 }
6200 
6201 /* mute tablet speaker pin (0x14) via dock plugging in addition */
6202 static void asus_tx300_automute(struct hda_codec *codec)
6203 {
6204 	struct alc_spec *spec = codec->spec;
6205 	snd_hda_gen_update_outputs(codec);
6206 	if (snd_hda_jack_detect(codec, 0x1b))
6207 		spec->gen.mute_bits |= (1ULL << 0x14);
6208 }
6209 
6210 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6211 				    const struct hda_fixup *fix, int action)
6212 {
6213 	struct alc_spec *spec = codec->spec;
6214 	static const struct hda_pintbl dock_pins[] = {
6215 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
6216 		{}
6217 	};
6218 
6219 	switch (action) {
6220 	case HDA_FIXUP_ACT_PRE_PROBE:
6221 		spec->init_amp = ALC_INIT_DEFAULT;
6222 		/* TX300 needs to set up GPIO2 for the speaker amp */
6223 		alc_setup_gpio(codec, 0x04);
6224 		snd_hda_apply_pincfgs(codec, dock_pins);
6225 		spec->gen.auto_mute_via_amp = 1;
6226 		spec->gen.automute_hook = asus_tx300_automute;
6227 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
6228 						    snd_hda_gen_hp_automute);
6229 		break;
6230 	case HDA_FIXUP_ACT_PROBE:
6231 		spec->init_amp = ALC_INIT_DEFAULT;
6232 		break;
6233 	case HDA_FIXUP_ACT_BUILD:
6234 		/* this is a bit tricky; give more sane names for the main
6235 		 * (tablet) speaker and the dock speaker, respectively
6236 		 */
6237 		rename_ctl(codec, "Speaker Playback Switch",
6238 			   "Dock Speaker Playback Switch");
6239 		rename_ctl(codec, "Bass Speaker Playback Switch",
6240 			   "Speaker Playback Switch");
6241 		break;
6242 	}
6243 }
6244 
6245 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6246 				       const struct hda_fixup *fix, int action)
6247 {
6248 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6249 		/* DAC node 0x03 is giving mono output. We therefore want to
6250 		   make sure 0x14 (front speaker) and 0x15 (headphones) use the
6251 		   stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
6252 		static const hda_nid_t conn1[] = { 0x0c };
6253 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6254 		snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6255 	}
6256 }
6257 
6258 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6259 					const struct hda_fixup *fix, int action)
6260 {
6261 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6262 		/* The speaker is routed to the Node 0x06 by a mistake, as a result
6263 		   we can't adjust the speaker's volume since this node does not has
6264 		   Amp-out capability. we change the speaker's route to:
6265 		   Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6266 		   Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6267 		   speaker's volume now. */
6268 
6269 		static const hda_nid_t conn1[] = { 0x0c };
6270 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6271 	}
6272 }
6273 
6274 /* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6275 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6276 				      const struct hda_fixup *fix, int action)
6277 {
6278 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6279 		static const hda_nid_t conn[] = { 0x02, 0x03 };
6280 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6281 	}
6282 }
6283 
6284 /* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6285 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6286 					  const struct hda_fixup *fix, int action)
6287 {
6288 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6289 		static const hda_nid_t conn[] = { 0x02 };
6290 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6291 	}
6292 }
6293 
6294 /* Hook to update amp GPIO4 for automute */
6295 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6296 					  struct hda_jack_callback *jack)
6297 {
6298 	struct alc_spec *spec = codec->spec;
6299 
6300 	snd_hda_gen_hp_automute(codec, jack);
6301 	/* mute_led_polarity is set to 0, so we pass inverted value here */
6302 	alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6303 			    !spec->gen.hp_jack_present);
6304 }
6305 
6306 /* Manage GPIOs for HP EliteBook Folio 9480m.
6307  *
6308  * GPIO4 is the headphone amplifier power control
6309  * GPIO3 is the audio output mute indicator LED
6310  */
6311 
6312 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6313 				  const struct hda_fixup *fix,
6314 				  int action)
6315 {
6316 	struct alc_spec *spec = codec->spec;
6317 
6318 	alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6319 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6320 		/* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6321 		spec->gpio_mask |= 0x10;
6322 		spec->gpio_dir |= 0x10;
6323 		spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
6324 	}
6325 }
6326 
6327 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6328 				   const struct hda_fixup *fix,
6329 				   int action)
6330 {
6331 	struct alc_spec *spec = codec->spec;
6332 
6333 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6334 		spec->gpio_mask |= 0x04;
6335 		spec->gpio_dir |= 0x04;
6336 		/* set data bit low */
6337 	}
6338 }
6339 
6340 /* Quirk for Thinkpad X1 7th and 8th Gen
6341  * The following fixed routing needed
6342  * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6343  * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6344  * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6345  */
6346 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6347 					  const struct hda_fixup *fix, int action)
6348 {
6349 	static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6350 	static const hda_nid_t preferred_pairs[] = {
6351 		0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6352 	};
6353 	struct alc_spec *spec = codec->spec;
6354 
6355 	switch (action) {
6356 	case HDA_FIXUP_ACT_PRE_PROBE:
6357 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6358 		spec->gen.preferred_dacs = preferred_pairs;
6359 		break;
6360 	case HDA_FIXUP_ACT_BUILD:
6361 		/* The generic parser creates somewhat unintuitive volume ctls
6362 		 * with the fixed routing above, and the shared DAC2 may be
6363 		 * confusing for PA.
6364 		 * Rename those to unique names so that PA doesn't touch them
6365 		 * and use only Master volume.
6366 		 */
6367 		rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6368 		rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6369 		break;
6370 	}
6371 }
6372 
6373 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6374 					 const struct hda_fixup *fix,
6375 					 int action)
6376 {
6377 	alc_fixup_dual_codecs(codec, fix, action);
6378 	switch (action) {
6379 	case HDA_FIXUP_ACT_PRE_PROBE:
6380 		/* override card longname to provide a unique UCM profile */
6381 		strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6382 		break;
6383 	case HDA_FIXUP_ACT_BUILD:
6384 		/* rename Capture controls depending on the codec */
6385 		rename_ctl(codec, "Capture Volume",
6386 			   codec->addr == 0 ?
6387 			   "Rear-Panel Capture Volume" :
6388 			   "Front-Panel Capture Volume");
6389 		rename_ctl(codec, "Capture Switch",
6390 			   codec->addr == 0 ?
6391 			   "Rear-Panel Capture Switch" :
6392 			   "Front-Panel Capture Switch");
6393 		break;
6394 	}
6395 }
6396 
6397 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6398 				      const struct hda_fixup *fix, int action)
6399 {
6400 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6401 		return;
6402 
6403 	codec->power_save_node = 1;
6404 }
6405 
6406 /* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6407 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6408 				    const struct hda_fixup *fix, int action)
6409 {
6410 	struct alc_spec *spec = codec->spec;
6411 	static const hda_nid_t preferred_pairs[] = {
6412 		0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6413 		0
6414 	};
6415 
6416 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6417 		return;
6418 
6419 	spec->gen.preferred_dacs = preferred_pairs;
6420 	spec->gen.auto_mute_via_amp = 1;
6421 	codec->power_save_node = 0;
6422 }
6423 
6424 /* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6425 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6426 				    const struct hda_fixup *fix, int action)
6427 {
6428 	static const hda_nid_t preferred_pairs[] = {
6429 		0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6430 	};
6431 	struct alc_spec *spec = codec->spec;
6432 
6433 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6434 		spec->gen.preferred_dacs = preferred_pairs;
6435 		spec->gen.obey_preferred_dacs = 1;
6436 	}
6437 }
6438 
6439 /* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6440 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6441 			      const struct hda_fixup *fix, int action)
6442 {
6443 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
6444 		return;
6445 
6446 	snd_hda_override_wcaps(codec, 0x03, 0);
6447 }
6448 
6449 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6450 {
6451 	switch (codec->core.vendor_id) {
6452 	case 0x10ec0274:
6453 	case 0x10ec0294:
6454 	case 0x10ec0225:
6455 	case 0x10ec0295:
6456 	case 0x10ec0299:
6457 		alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6458 		alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6459 		break;
6460 	case 0x10ec0230:
6461 	case 0x10ec0235:
6462 	case 0x10ec0236:
6463 	case 0x10ec0255:
6464 	case 0x10ec0256:
6465 	case 0x19e58326:
6466 		alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6467 		alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6468 		break;
6469 	}
6470 }
6471 
6472 static void alc295_fixup_chromebook(struct hda_codec *codec,
6473 				    const struct hda_fixup *fix, int action)
6474 {
6475 	struct alc_spec *spec = codec->spec;
6476 
6477 	switch (action) {
6478 	case HDA_FIXUP_ACT_PRE_PROBE:
6479 		spec->ultra_low_power = true;
6480 		break;
6481 	case HDA_FIXUP_ACT_INIT:
6482 		alc_combo_jack_hp_jd_restart(codec);
6483 		break;
6484 	}
6485 }
6486 
6487 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6488 				  const struct hda_fixup *fix, int action)
6489 {
6490 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
6491 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6492 }
6493 
6494 
6495 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6496 					struct hda_jack_callback *cb)
6497 {
6498 	/* The Windows driver sets the codec up in a very different way where
6499 	 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6500 	 */
6501 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6502 		alc_write_coef_idx(codec, 0x10, 0x8a20);
6503 	else
6504 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6505 }
6506 
6507 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6508 					const struct hda_fixup *fix, int action)
6509 {
6510 	/* Pin 0x21: headphones/headset mic */
6511 	if (!is_jack_detectable(codec, 0x21))
6512 		return;
6513 
6514 	switch (action) {
6515 	case HDA_FIXUP_ACT_PRE_PROBE:
6516 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6517 				alc294_gx502_toggle_output);
6518 		break;
6519 	case HDA_FIXUP_ACT_INIT:
6520 		/* Make sure to start in a correct state, i.e. if
6521 		 * headphones have been plugged in before powering up the system
6522 		 */
6523 		alc294_gx502_toggle_output(codec, NULL);
6524 		break;
6525 	}
6526 }
6527 
6528 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6529 				       struct hda_jack_callback *cb)
6530 {
6531 	/* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6532 	 * responsible from changes between speakers and headphones
6533 	 */
6534 	if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6535 		alc_write_coef_idx(codec, 0x10, 0x8420);
6536 	else
6537 		alc_write_coef_idx(codec, 0x10, 0x0a20);
6538 }
6539 
6540 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6541 				  const struct hda_fixup *fix, int action)
6542 {
6543 	if (!is_jack_detectable(codec, 0x21))
6544 		return;
6545 
6546 	switch (action) {
6547 	case HDA_FIXUP_ACT_PRE_PROBE:
6548 		snd_hda_jack_detect_enable_callback(codec, 0x21,
6549 				alc294_gu502_toggle_output);
6550 		break;
6551 	case HDA_FIXUP_ACT_INIT:
6552 		alc294_gu502_toggle_output(codec, NULL);
6553 		break;
6554 	}
6555 }
6556 
6557 static void  alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6558 			      const struct hda_fixup *fix, int action)
6559 {
6560 	if (action != HDA_FIXUP_ACT_INIT)
6561 		return;
6562 
6563 	msleep(100);
6564 	alc_write_coef_idx(codec, 0x65, 0x0);
6565 }
6566 
6567 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6568 				    const struct hda_fixup *fix, int action)
6569 {
6570 	switch (action) {
6571 	case HDA_FIXUP_ACT_INIT:
6572 		alc_combo_jack_hp_jd_restart(codec);
6573 		break;
6574 	}
6575 }
6576 
6577 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6578 				    const struct hda_fixup *fix, int action)
6579 {
6580 	struct alc_spec *spec = codec->spec;
6581 
6582 	switch (action) {
6583 	case HDA_FIXUP_ACT_PRE_PROBE:
6584 		/* Mic RING SLEEVE swap for combo jack */
6585 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6586 		spec->no_internal_mic_pin = true;
6587 		break;
6588 	case HDA_FIXUP_ACT_INIT:
6589 		alc_combo_jack_hp_jd_restart(codec);
6590 		break;
6591 	}
6592 }
6593 
6594 /* GPIO1 = amplifier on/off
6595  * GPIO3 = mic mute LED
6596  */
6597 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6598 					  const struct hda_fixup *fix, int action)
6599 {
6600 	static const hda_nid_t conn[] = { 0x02 };
6601 
6602 	struct alc_spec *spec = codec->spec;
6603 	static const struct hda_pintbl pincfgs[] = {
6604 		{ 0x14, 0x90170110 },  /* front/high speakers */
6605 		{ 0x17, 0x90170130 },  /* back/bass speakers */
6606 		{ }
6607 	};
6608 
6609 	//enable micmute led
6610 	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6611 
6612 	switch (action) {
6613 	case HDA_FIXUP_ACT_PRE_PROBE:
6614 		spec->micmute_led_polarity = 1;
6615 		/* needed for amp of back speakers */
6616 		spec->gpio_mask |= 0x01;
6617 		spec->gpio_dir |= 0x01;
6618 		snd_hda_apply_pincfgs(codec, pincfgs);
6619 		/* share DAC to have unified volume control */
6620 		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6621 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6622 		break;
6623 	case HDA_FIXUP_ACT_INIT:
6624 		/* need to toggle GPIO to enable the amp of back speakers */
6625 		alc_update_gpio_data(codec, 0x01, true);
6626 		msleep(100);
6627 		alc_update_gpio_data(codec, 0x01, false);
6628 		break;
6629 	}
6630 }
6631 
6632 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6633 					  const struct hda_fixup *fix, int action)
6634 {
6635 	static const hda_nid_t conn[] = { 0x02 };
6636 	static const struct hda_pintbl pincfgs[] = {
6637 		{ 0x14, 0x90170110 },  /* rear speaker */
6638 		{ }
6639 	};
6640 
6641 	switch (action) {
6642 	case HDA_FIXUP_ACT_PRE_PROBE:
6643 		snd_hda_apply_pincfgs(codec, pincfgs);
6644 		/* force front speaker to DAC1 */
6645 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6646 		break;
6647 	}
6648 }
6649 
6650 /* for hda_fixup_thinkpad_acpi() */
6651 #include "thinkpad_helper.c"
6652 
6653 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6654 				    const struct hda_fixup *fix, int action)
6655 {
6656 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6657 	hda_fixup_thinkpad_acpi(codec, fix, action);
6658 }
6659 
6660 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6661 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6662 						  const struct hda_fixup *fix,
6663 						  int action)
6664 {
6665 	struct alc_spec *spec = codec->spec;
6666 
6667 	switch (action) {
6668 	case HDA_FIXUP_ACT_PRE_PROBE:
6669 		spec->gen.suppress_auto_mute = 1;
6670 		break;
6671 	}
6672 }
6673 
6674 static int comp_bind(struct device *dev)
6675 {
6676 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6677 	struct alc_spec *spec = cdc->spec;
6678 
6679 	return component_bind_all(dev, spec->comps);
6680 }
6681 
6682 static void comp_unbind(struct device *dev)
6683 {
6684 	struct hda_codec *cdc = dev_to_hda_codec(dev);
6685 	struct alc_spec *spec = cdc->spec;
6686 
6687 	component_unbind_all(dev, spec->comps);
6688 }
6689 
6690 static const struct component_master_ops comp_master_ops = {
6691 	.bind = comp_bind,
6692 	.unbind = comp_unbind,
6693 };
6694 
6695 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6696 				       struct snd_pcm_substream *sub, int action)
6697 {
6698 	struct alc_spec *spec = cdc->spec;
6699 	int i;
6700 
6701 	for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6702 		if (spec->comps[i].dev)
6703 			spec->comps[i].playback_hook(spec->comps[i].dev, action);
6704 	}
6705 }
6706 
6707 struct cs35l41_dev_name {
6708 	const char *bus;
6709 	const char *hid;
6710 	int index;
6711 };
6712 
6713 /* match the device name in a slightly relaxed manner */
6714 static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
6715 {
6716 	struct cs35l41_dev_name *p = data;
6717 	const char *d = dev_name(dev);
6718 	int n = strlen(p->bus);
6719 	char tmp[32];
6720 
6721 	/* check the bus name */
6722 	if (strncmp(d, p->bus, n))
6723 		return 0;
6724 	/* skip the bus number */
6725 	if (isdigit(d[n]))
6726 		n++;
6727 	/* the rest must be exact matching */
6728 	snprintf(tmp, sizeof(tmp), "-%s:00-cs35l41-hda.%d", p->hid, p->index);
6729 	return !strcmp(d + n, tmp);
6730 }
6731 
6732 static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6733 				  const char *hid, int count)
6734 {
6735 	struct device *dev = hda_codec_dev(cdc);
6736 	struct alc_spec *spec = cdc->spec;
6737 	struct cs35l41_dev_name *rec;
6738 	int ret, i;
6739 
6740 	switch (action) {
6741 	case HDA_FIXUP_ACT_PRE_PROBE:
6742 		for (i = 0; i < count; i++) {
6743 			rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
6744 			if (!rec)
6745 				return;
6746 			rec->bus = bus;
6747 			rec->hid = hid;
6748 			rec->index = i;
6749 			spec->comps[i].codec = cdc;
6750 			component_match_add(dev, &spec->match,
6751 					    comp_match_cs35l41_dev_name, rec);
6752 		}
6753 		ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6754 		if (ret)
6755 			codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6756 		else
6757 			spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6758 		break;
6759 	}
6760 }
6761 
6762 static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6763 {
6764 	cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6765 }
6766 
6767 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6768 {
6769 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2);
6770 }
6771 
6772 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
6773 {
6774 	cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4);
6775 }
6776 
6777 static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6778 						 int action)
6779 {
6780 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0100", 2);
6781 }
6782 
6783 static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6784 						 int action)
6785 {
6786 	cs35l41_generic_fixup(cdc, action, "i2c", "CLSA0101", 2);
6787 }
6788 
6789 /* for alc295_fixup_hp_top_speakers */
6790 #include "hp_x360_helper.c"
6791 
6792 /* for alc285_fixup_ideapad_s740_coef() */
6793 #include "ideapad_s740_helper.c"
6794 
6795 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6796 	WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6797 	WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6798 	WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6799 	{}
6800 };
6801 
6802 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6803 					   const struct hda_fixup *fix,
6804 					   int action)
6805 {
6806 	/*
6807 	 * A certain other OS sets these coeffs to different values. On at least
6808 	 * one TongFang barebone these settings might survive even a cold
6809 	 * reboot. So to restore a clean slate the values are explicitly reset
6810 	 * to default here. Without this, the external microphone is always in a
6811 	 * plugged-in state, while the internal microphone is always in an
6812 	 * unplugged state, breaking the ability to use the internal microphone.
6813 	 */
6814 	alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
6815 }
6816 
6817 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6818 	WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6819 	WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6820 	WRITE_COEF(0x49, 0x0149),
6821 	{}
6822 };
6823 
6824 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6825 				       const struct hda_fixup *fix,
6826 				       int action)
6827 {
6828 	/*
6829 	 * The audio jack input and output is not detected on the ASRock NUC Box
6830 	 * 1100 series when cold booting without this fix. Warm rebooting from a
6831 	 * certain other OS makes the audio functional, as COEF settings are
6832 	 * preserved in this case. This fix sets these altered COEF values as
6833 	 * the default.
6834 	 */
6835 	alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6836 }
6837 
6838 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6839 						    const struct hda_fixup *fix,
6840 						    int action)
6841 {
6842 	/*
6843 	 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6844 	 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6845 	 * needs an additional quirk for sound working after suspend and resume.
6846 	 */
6847 	if (codec->core.vendor_id == 0x10ec0256) {
6848 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6849 		snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6850 	} else {
6851 		snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6852 	}
6853 }
6854 
6855 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
6856 						  const struct hda_fixup *fix,
6857 						  int action)
6858 {
6859 	struct alc_spec *spec = codec->spec;
6860 	struct hda_input_mux *imux = &spec->gen.input_mux;
6861 	int i;
6862 
6863 	alc269_fixup_limit_int_mic_boost(codec, fix, action);
6864 
6865 	switch (action) {
6866 	case HDA_FIXUP_ACT_PRE_PROBE:
6867 		/**
6868 		 * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic)
6869 		 * to Hi-Z to avoid pop noises at startup and when plugging and
6870 		 * unplugging headphones.
6871 		 */
6872 		snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6873 		snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
6874 		break;
6875 	case HDA_FIXUP_ACT_PROBE:
6876 		/**
6877 		 * Make the internal mic (0x12) the default input source to
6878 		 * prevent pop noises on cold boot.
6879 		 */
6880 		for (i = 0; i < imux->num_items; i++) {
6881 			if (spec->gen.imux_pins[i] == 0x12) {
6882 				spec->gen.cur_mux[0] = i;
6883 				break;
6884 			}
6885 		}
6886 		break;
6887 	}
6888 }
6889 
6890 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
6891 					  const struct hda_fixup *fix, int action)
6892 {
6893 	/*
6894 	 * The Pin Complex 0x17 for the bass speakers is wrongly reported as
6895 	 * unconnected.
6896 	 */
6897 	static const struct hda_pintbl pincfgs[] = {
6898 		{ 0x17, 0x90170121 },
6899 		{ }
6900 	};
6901 	/*
6902 	 * Avoid DAC 0x06 and 0x08, as they have no volume controls.
6903 	 * DAC 0x02 and 0x03 would be fine.
6904 	 */
6905 	static const hda_nid_t conn[] = { 0x02, 0x03 };
6906 	/*
6907 	 * Prefer both speakerbar (0x14) and bass speakers (0x17) connected to DAC 0x02.
6908 	 * Headphones (0x21) are connected to DAC 0x03.
6909 	 */
6910 	static const hda_nid_t preferred_pairs[] = {
6911 		0x14, 0x02,
6912 		0x17, 0x02,
6913 		0x21, 0x03,
6914 		0
6915 	};
6916 	struct alc_spec *spec = codec->spec;
6917 
6918 	switch (action) {
6919 	case HDA_FIXUP_ACT_PRE_PROBE:
6920 		snd_hda_apply_pincfgs(codec, pincfgs);
6921 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6922 		spec->gen.preferred_dacs = preferred_pairs;
6923 		break;
6924 	}
6925 }
6926 
6927 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
6928 					  const struct hda_fixup *fix, int action)
6929 {
6930 	static const struct hda_pintbl pincfgs[] = {
6931 		{ 0x14, 0x90170151 },
6932 		{ 0x17, 0x90170150 },
6933 		{ }
6934 	};
6935 	static const hda_nid_t conn[] = { 0x02, 0x03 };
6936 	static const hda_nid_t preferred_pairs[] = {
6937 		0x14, 0x02,
6938 		0x17, 0x03,
6939 		0x21, 0x02,
6940 		0
6941 	};
6942 	struct alc_spec *spec = codec->spec;
6943 
6944 	alc_fixup_no_shutup(codec, fix, action);
6945 
6946 	switch (action) {
6947 	case HDA_FIXUP_ACT_PRE_PROBE:
6948 		snd_hda_apply_pincfgs(codec, pincfgs);
6949 		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6950 		spec->gen.preferred_dacs = preferred_pairs;
6951 		break;
6952 	}
6953 }
6954 
6955 enum {
6956 	ALC269_FIXUP_GPIO2,
6957 	ALC269_FIXUP_SONY_VAIO,
6958 	ALC275_FIXUP_SONY_VAIO_GPIO2,
6959 	ALC269_FIXUP_DELL_M101Z,
6960 	ALC269_FIXUP_SKU_IGNORE,
6961 	ALC269_FIXUP_ASUS_G73JW,
6962 	ALC269_FIXUP_LENOVO_EAPD,
6963 	ALC275_FIXUP_SONY_HWEQ,
6964 	ALC275_FIXUP_SONY_DISABLE_AAMIX,
6965 	ALC271_FIXUP_DMIC,
6966 	ALC269_FIXUP_PCM_44K,
6967 	ALC269_FIXUP_STEREO_DMIC,
6968 	ALC269_FIXUP_HEADSET_MIC,
6969 	ALC269_FIXUP_QUANTA_MUTE,
6970 	ALC269_FIXUP_LIFEBOOK,
6971 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
6972 	ALC269_FIXUP_LIFEBOOK_HP_PIN,
6973 	ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
6974 	ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
6975 	ALC269_FIXUP_AMIC,
6976 	ALC269_FIXUP_DMIC,
6977 	ALC269VB_FIXUP_AMIC,
6978 	ALC269VB_FIXUP_DMIC,
6979 	ALC269_FIXUP_HP_MUTE_LED,
6980 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
6981 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
6982 	ALC269_FIXUP_HP_MUTE_LED_MIC3,
6983 	ALC269_FIXUP_HP_GPIO_LED,
6984 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
6985 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
6986 	ALC269_FIXUP_INV_DMIC,
6987 	ALC269_FIXUP_LENOVO_DOCK,
6988 	ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
6989 	ALC269_FIXUP_NO_SHUTUP,
6990 	ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
6991 	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6992 	ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6993 	ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
6994 	ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6995 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6996 	ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET,
6997 	ALC269_FIXUP_HEADSET_MODE,
6998 	ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
6999 	ALC269_FIXUP_ASPIRE_HEADSET_MIC,
7000 	ALC269_FIXUP_ASUS_X101_FUNC,
7001 	ALC269_FIXUP_ASUS_X101_VERB,
7002 	ALC269_FIXUP_ASUS_X101,
7003 	ALC271_FIXUP_AMIC_MIC2,
7004 	ALC271_FIXUP_HP_GATE_MIC_JACK,
7005 	ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
7006 	ALC269_FIXUP_ACER_AC700,
7007 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
7008 	ALC269VB_FIXUP_ASUS_ZENBOOK,
7009 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
7010 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
7011 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
7012 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
7013 	ALC283_FIXUP_CHROME_BOOK,
7014 	ALC283_FIXUP_SENSE_COMBO_JACK,
7015 	ALC282_FIXUP_ASUS_TX300,
7016 	ALC283_FIXUP_INT_MIC,
7017 	ALC290_FIXUP_MONO_SPEAKERS,
7018 	ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7019 	ALC290_FIXUP_SUBWOOFER,
7020 	ALC290_FIXUP_SUBWOOFER_HSJACK,
7021 	ALC269_FIXUP_THINKPAD_ACPI,
7022 	ALC269_FIXUP_DMIC_THINKPAD_ACPI,
7023 	ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7024 	ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7025 	ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7026 	ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
7027 	ALC255_FIXUP_HEADSET_MODE,
7028 	ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
7029 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
7030 	ALC292_FIXUP_TPT440_DOCK,
7031 	ALC292_FIXUP_TPT440,
7032 	ALC283_FIXUP_HEADSET_MIC,
7033 	ALC255_FIXUP_MIC_MUTE_LED,
7034 	ALC282_FIXUP_ASPIRE_V5_PINS,
7035 	ALC269VB_FIXUP_ASPIRE_E1_COEF,
7036 	ALC280_FIXUP_HP_GPIO4,
7037 	ALC286_FIXUP_HP_GPIO_LED,
7038 	ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
7039 	ALC280_FIXUP_HP_DOCK_PINS,
7040 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
7041 	ALC280_FIXUP_HP_9480M,
7042 	ALC245_FIXUP_HP_X360_AMP,
7043 	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
7044 	ALC288_FIXUP_DELL_HEADSET_MODE,
7045 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
7046 	ALC288_FIXUP_DELL_XPS_13,
7047 	ALC288_FIXUP_DISABLE_AAMIX,
7048 	ALC292_FIXUP_DELL_E7X_AAMIX,
7049 	ALC292_FIXUP_DELL_E7X,
7050 	ALC292_FIXUP_DISABLE_AAMIX,
7051 	ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
7052 	ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
7053 	ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7054 	ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7055 	ALC275_FIXUP_DELL_XPS,
7056 	ALC293_FIXUP_LENOVO_SPK_NOISE,
7057 	ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7058 	ALC255_FIXUP_DELL_SPK_NOISE,
7059 	ALC225_FIXUP_DISABLE_MIC_VREF,
7060 	ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7061 	ALC295_FIXUP_DISABLE_DAC3,
7062 	ALC285_FIXUP_SPEAKER2_TO_DAC1,
7063 	ALC280_FIXUP_HP_HEADSET_MIC,
7064 	ALC221_FIXUP_HP_FRONT_MIC,
7065 	ALC292_FIXUP_TPT460,
7066 	ALC298_FIXUP_SPK_VOLUME,
7067 	ALC298_FIXUP_LENOVO_SPK_VOLUME,
7068 	ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
7069 	ALC269_FIXUP_ATIV_BOOK_8,
7070 	ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
7071 	ALC221_FIXUP_HP_MIC_NO_PRESENCE,
7072 	ALC256_FIXUP_ASUS_HEADSET_MODE,
7073 	ALC256_FIXUP_ASUS_MIC,
7074 	ALC256_FIXUP_ASUS_AIO_GPIO2,
7075 	ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
7076 	ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
7077 	ALC233_FIXUP_LENOVO_MULTI_CODECS,
7078 	ALC233_FIXUP_ACER_HEADSET_MIC,
7079 	ALC294_FIXUP_LENOVO_MIC_LOCATION,
7080 	ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
7081 	ALC225_FIXUP_S3_POP_NOISE,
7082 	ALC700_FIXUP_INTEL_REFERENCE,
7083 	ALC274_FIXUP_DELL_BIND_DACS,
7084 	ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
7085 	ALC298_FIXUP_TPT470_DOCK_FIX,
7086 	ALC298_FIXUP_TPT470_DOCK,
7087 	ALC255_FIXUP_DUMMY_LINEOUT_VERB,
7088 	ALC255_FIXUP_DELL_HEADSET_MIC,
7089 	ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
7090 	ALC298_FIXUP_HUAWEI_MBX_STEREO,
7091 	ALC295_FIXUP_HP_X360,
7092 	ALC221_FIXUP_HP_HEADSET_MIC,
7093 	ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7094 	ALC295_FIXUP_HP_AUTO_MUTE,
7095 	ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7096 	ALC294_FIXUP_ASUS_MIC,
7097 	ALC294_FIXUP_ASUS_HEADSET_MIC,
7098 	ALC294_FIXUP_ASUS_SPK,
7099 	ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7100 	ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7101 	ALC255_FIXUP_ACER_HEADSET_MIC,
7102 	ALC295_FIXUP_CHROME_BOOK,
7103 	ALC225_FIXUP_HEADSET_JACK,
7104 	ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
7105 	ALC225_FIXUP_WYSE_AUTO_MUTE,
7106 	ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
7107 	ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
7108 	ALC256_FIXUP_ASUS_HEADSET_MIC,
7109 	ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
7110 	ALC299_FIXUP_PREDATOR_SPK,
7111 	ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
7112 	ALC289_FIXUP_DELL_SPK2,
7113 	ALC289_FIXUP_DUAL_SPK,
7114 	ALC294_FIXUP_SPK2_TO_DAC1,
7115 	ALC294_FIXUP_ASUS_DUAL_SPK,
7116 	ALC285_FIXUP_THINKPAD_X1_GEN7,
7117 	ALC285_FIXUP_THINKPAD_HEADSET_JACK,
7118 	ALC294_FIXUP_ASUS_HPE,
7119 	ALC294_FIXUP_ASUS_COEF_1B,
7120 	ALC294_FIXUP_ASUS_GX502_HP,
7121 	ALC294_FIXUP_ASUS_GX502_PINS,
7122 	ALC294_FIXUP_ASUS_GX502_VERBS,
7123 	ALC294_FIXUP_ASUS_GU502_HP,
7124 	ALC294_FIXUP_ASUS_GU502_PINS,
7125 	ALC294_FIXUP_ASUS_GU502_VERBS,
7126 	ALC294_FIXUP_ASUS_G513_PINS,
7127 	ALC285_FIXUP_ASUS_G533Z_PINS,
7128 	ALC285_FIXUP_HP_GPIO_LED,
7129 	ALC285_FIXUP_HP_MUTE_LED,
7130 	ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED,
7131 	ALC236_FIXUP_HP_GPIO_LED,
7132 	ALC236_FIXUP_HP_MUTE_LED,
7133 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
7134 	ALC298_FIXUP_SAMSUNG_AMP,
7135 	ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7136 	ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
7137 	ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
7138 	ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
7139 	ALC269VC_FIXUP_ACER_HEADSET_MIC,
7140 	ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
7141 	ALC289_FIXUP_ASUS_GA401,
7142 	ALC289_FIXUP_ASUS_GA502,
7143 	ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
7144 	ALC285_FIXUP_HP_GPIO_AMP_INIT,
7145 	ALC269_FIXUP_CZC_B20,
7146 	ALC269_FIXUP_CZC_TMI,
7147 	ALC269_FIXUP_CZC_L101,
7148 	ALC269_FIXUP_LEMOTE_A1802,
7149 	ALC269_FIXUP_LEMOTE_A190X,
7150 	ALC256_FIXUP_INTEL_NUC8_RUGGED,
7151 	ALC233_FIXUP_INTEL_NUC8_DMIC,
7152 	ALC233_FIXUP_INTEL_NUC8_BOOST,
7153 	ALC256_FIXUP_INTEL_NUC10,
7154 	ALC255_FIXUP_XIAOMI_HEADSET_MIC,
7155 	ALC274_FIXUP_HP_MIC,
7156 	ALC274_FIXUP_HP_HEADSET_MIC,
7157 	ALC274_FIXUP_HP_ENVY_GPIO,
7158 	ALC256_FIXUP_ASUS_HPE,
7159 	ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
7160 	ALC287_FIXUP_HP_GPIO_LED,
7161 	ALC256_FIXUP_HP_HEADSET_MIC,
7162 	ALC245_FIXUP_HP_GPIO_LED,
7163 	ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
7164 	ALC282_FIXUP_ACER_DISABLE_LINEOUT,
7165 	ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
7166 	ALC256_FIXUP_ACER_HEADSET_MIC,
7167 	ALC285_FIXUP_IDEAPAD_S740_COEF,
7168 	ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7169 	ALC295_FIXUP_ASUS_DACS,
7170 	ALC295_FIXUP_HP_OMEN,
7171 	ALC285_FIXUP_HP_SPECTRE_X360,
7172 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
7173 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
7174 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
7175 	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
7176 	ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
7177 	ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
7178 	ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
7179 	ALC298_FIXUP_LENOVO_C940_DUET7,
7180 	ALC287_FIXUP_13S_GEN2_SPEAKERS,
7181 	ALC256_FIXUP_SET_COEF_DEFAULTS,
7182 	ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
7183 	ALC233_FIXUP_NO_AUDIO_JACK,
7184 	ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
7185 	ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
7186 	ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
7187 	ALC287_FIXUP_LEGION_16ACHG6,
7188 	ALC287_FIXUP_CS35L41_I2C_2,
7189 	ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED,
7190 	ALC245_FIXUP_CS35L41_SPI_2,
7191 	ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED,
7192 	ALC245_FIXUP_CS35L41_SPI_4,
7193 	ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
7194 	ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
7195 	ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
7196 	ALC287_FIXUP_LEGION_16ITHG6,
7197 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
7198 	ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
7199 	ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7200 	ALC236_FIXUP_DELL_DUAL_CODECS,
7201 };
7202 
7203 /* A special fixup for Lenovo C940 and Yoga Duet 7;
7204  * both have the very same PCI SSID, and we need to apply different fixups
7205  * depending on the codec ID
7206  */
7207 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
7208 					   const struct hda_fixup *fix,
7209 					   int action)
7210 {
7211 	int id;
7212 
7213 	if (codec->core.vendor_id == 0x10ec0298)
7214 		id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
7215 	else
7216 		id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
7217 	__snd_hda_apply_fixup(codec, id, action, 0);
7218 }
7219 
7220 static const struct hda_fixup alc269_fixups[] = {
7221 	[ALC269_FIXUP_GPIO2] = {
7222 		.type = HDA_FIXUP_FUNC,
7223 		.v.func = alc_fixup_gpio2,
7224 	},
7225 	[ALC269_FIXUP_SONY_VAIO] = {
7226 		.type = HDA_FIXUP_PINCTLS,
7227 		.v.pins = (const struct hda_pintbl[]) {
7228 			{0x19, PIN_VREFGRD},
7229 			{}
7230 		}
7231 	},
7232 	[ALC275_FIXUP_SONY_VAIO_GPIO2] = {
7233 		.type = HDA_FIXUP_FUNC,
7234 		.v.func = alc275_fixup_gpio4_off,
7235 		.chained = true,
7236 		.chain_id = ALC269_FIXUP_SONY_VAIO
7237 	},
7238 	[ALC269_FIXUP_DELL_M101Z] = {
7239 		.type = HDA_FIXUP_VERBS,
7240 		.v.verbs = (const struct hda_verb[]) {
7241 			/* Enables internal speaker */
7242 			{0x20, AC_VERB_SET_COEF_INDEX, 13},
7243 			{0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7244 			{}
7245 		}
7246 	},
7247 	[ALC269_FIXUP_SKU_IGNORE] = {
7248 		.type = HDA_FIXUP_FUNC,
7249 		.v.func = alc_fixup_sku_ignore,
7250 	},
7251 	[ALC269_FIXUP_ASUS_G73JW] = {
7252 		.type = HDA_FIXUP_PINS,
7253 		.v.pins = (const struct hda_pintbl[]) {
7254 			{ 0x17, 0x99130111 }, /* subwoofer */
7255 			{ }
7256 		}
7257 	},
7258 	[ALC269_FIXUP_LENOVO_EAPD] = {
7259 		.type = HDA_FIXUP_VERBS,
7260 		.v.verbs = (const struct hda_verb[]) {
7261 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7262 			{}
7263 		}
7264 	},
7265 	[ALC275_FIXUP_SONY_HWEQ] = {
7266 		.type = HDA_FIXUP_FUNC,
7267 		.v.func = alc269_fixup_hweq,
7268 		.chained = true,
7269 		.chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7270 	},
7271 	[ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7272 		.type = HDA_FIXUP_FUNC,
7273 		.v.func = alc_fixup_disable_aamix,
7274 		.chained = true,
7275 		.chain_id = ALC269_FIXUP_SONY_VAIO
7276 	},
7277 	[ALC271_FIXUP_DMIC] = {
7278 		.type = HDA_FIXUP_FUNC,
7279 		.v.func = alc271_fixup_dmic,
7280 	},
7281 	[ALC269_FIXUP_PCM_44K] = {
7282 		.type = HDA_FIXUP_FUNC,
7283 		.v.func = alc269_fixup_pcm_44k,
7284 		.chained = true,
7285 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7286 	},
7287 	[ALC269_FIXUP_STEREO_DMIC] = {
7288 		.type = HDA_FIXUP_FUNC,
7289 		.v.func = alc269_fixup_stereo_dmic,
7290 	},
7291 	[ALC269_FIXUP_HEADSET_MIC] = {
7292 		.type = HDA_FIXUP_FUNC,
7293 		.v.func = alc269_fixup_headset_mic,
7294 	},
7295 	[ALC269_FIXUP_QUANTA_MUTE] = {
7296 		.type = HDA_FIXUP_FUNC,
7297 		.v.func = alc269_fixup_quanta_mute,
7298 	},
7299 	[ALC269_FIXUP_LIFEBOOK] = {
7300 		.type = HDA_FIXUP_PINS,
7301 		.v.pins = (const struct hda_pintbl[]) {
7302 			{ 0x1a, 0x2101103f }, /* dock line-out */
7303 			{ 0x1b, 0x23a11040 }, /* dock mic-in */
7304 			{ }
7305 		},
7306 		.chained = true,
7307 		.chain_id = ALC269_FIXUP_QUANTA_MUTE
7308 	},
7309 	[ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7310 		.type = HDA_FIXUP_PINS,
7311 		.v.pins = (const struct hda_pintbl[]) {
7312 			{ 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7313 			{ }
7314 		},
7315 	},
7316 	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7317 		.type = HDA_FIXUP_PINS,
7318 		.v.pins = (const struct hda_pintbl[]) {
7319 			{ 0x21, 0x0221102f }, /* HP out */
7320 			{ }
7321 		},
7322 	},
7323 	[ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7324 		.type = HDA_FIXUP_FUNC,
7325 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7326 	},
7327 	[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7328 		.type = HDA_FIXUP_FUNC,
7329 		.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7330 	},
7331 	[ALC269_FIXUP_AMIC] = {
7332 		.type = HDA_FIXUP_PINS,
7333 		.v.pins = (const struct hda_pintbl[]) {
7334 			{ 0x14, 0x99130110 }, /* speaker */
7335 			{ 0x15, 0x0121401f }, /* HP out */
7336 			{ 0x18, 0x01a19c20 }, /* mic */
7337 			{ 0x19, 0x99a3092f }, /* int-mic */
7338 			{ }
7339 		},
7340 	},
7341 	[ALC269_FIXUP_DMIC] = {
7342 		.type = HDA_FIXUP_PINS,
7343 		.v.pins = (const struct hda_pintbl[]) {
7344 			{ 0x12, 0x99a3092f }, /* int-mic */
7345 			{ 0x14, 0x99130110 }, /* speaker */
7346 			{ 0x15, 0x0121401f }, /* HP out */
7347 			{ 0x18, 0x01a19c20 }, /* mic */
7348 			{ }
7349 		},
7350 	},
7351 	[ALC269VB_FIXUP_AMIC] = {
7352 		.type = HDA_FIXUP_PINS,
7353 		.v.pins = (const struct hda_pintbl[]) {
7354 			{ 0x14, 0x99130110 }, /* speaker */
7355 			{ 0x18, 0x01a19c20 }, /* mic */
7356 			{ 0x19, 0x99a3092f }, /* int-mic */
7357 			{ 0x21, 0x0121401f }, /* HP out */
7358 			{ }
7359 		},
7360 	},
7361 	[ALC269VB_FIXUP_DMIC] = {
7362 		.type = HDA_FIXUP_PINS,
7363 		.v.pins = (const struct hda_pintbl[]) {
7364 			{ 0x12, 0x99a3092f }, /* int-mic */
7365 			{ 0x14, 0x99130110 }, /* speaker */
7366 			{ 0x18, 0x01a19c20 }, /* mic */
7367 			{ 0x21, 0x0121401f }, /* HP out */
7368 			{ }
7369 		},
7370 	},
7371 	[ALC269_FIXUP_HP_MUTE_LED] = {
7372 		.type = HDA_FIXUP_FUNC,
7373 		.v.func = alc269_fixup_hp_mute_led,
7374 	},
7375 	[ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7376 		.type = HDA_FIXUP_FUNC,
7377 		.v.func = alc269_fixup_hp_mute_led_mic1,
7378 	},
7379 	[ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
7380 		.type = HDA_FIXUP_FUNC,
7381 		.v.func = alc269_fixup_hp_mute_led_mic2,
7382 	},
7383 	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7384 		.type = HDA_FIXUP_FUNC,
7385 		.v.func = alc269_fixup_hp_mute_led_mic3,
7386 		.chained = true,
7387 		.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
7388 	},
7389 	[ALC269_FIXUP_HP_GPIO_LED] = {
7390 		.type = HDA_FIXUP_FUNC,
7391 		.v.func = alc269_fixup_hp_gpio_led,
7392 	},
7393 	[ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7394 		.type = HDA_FIXUP_FUNC,
7395 		.v.func = alc269_fixup_hp_gpio_mic1_led,
7396 	},
7397 	[ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7398 		.type = HDA_FIXUP_FUNC,
7399 		.v.func = alc269_fixup_hp_line1_mic1_led,
7400 	},
7401 	[ALC269_FIXUP_INV_DMIC] = {
7402 		.type = HDA_FIXUP_FUNC,
7403 		.v.func = alc_fixup_inv_dmic,
7404 	},
7405 	[ALC269_FIXUP_NO_SHUTUP] = {
7406 		.type = HDA_FIXUP_FUNC,
7407 		.v.func = alc_fixup_no_shutup,
7408 	},
7409 	[ALC269_FIXUP_LENOVO_DOCK] = {
7410 		.type = HDA_FIXUP_PINS,
7411 		.v.pins = (const struct hda_pintbl[]) {
7412 			{ 0x19, 0x23a11040 }, /* dock mic */
7413 			{ 0x1b, 0x2121103f }, /* dock headphone */
7414 			{ }
7415 		},
7416 		.chained = true,
7417 		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7418 	},
7419 	[ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7420 		.type = HDA_FIXUP_FUNC,
7421 		.v.func = alc269_fixup_limit_int_mic_boost,
7422 		.chained = true,
7423 		.chain_id = ALC269_FIXUP_LENOVO_DOCK,
7424 	},
7425 	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
7426 		.type = HDA_FIXUP_FUNC,
7427 		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7428 		.chained = true,
7429 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7430 	},
7431 	[ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7432 		.type = HDA_FIXUP_PINS,
7433 		.v.pins = (const struct hda_pintbl[]) {
7434 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7435 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7436 			{ }
7437 		},
7438 		.chained = true,
7439 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7440 	},
7441 	[ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7442 		.type = HDA_FIXUP_PINS,
7443 		.v.pins = (const struct hda_pintbl[]) {
7444 			{ 0x16, 0x21014020 }, /* dock line out */
7445 			{ 0x19, 0x21a19030 }, /* dock mic */
7446 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7447 			{ }
7448 		},
7449 		.chained = true,
7450 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7451 	},
7452 	[ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7453 		.type = HDA_FIXUP_PINS,
7454 		.v.pins = (const struct hda_pintbl[]) {
7455 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7456 			{ }
7457 		},
7458 		.chained = true,
7459 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7460 	},
7461 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7462 		.type = HDA_FIXUP_PINS,
7463 		.v.pins = (const struct hda_pintbl[]) {
7464 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7465 			{ 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7466 			{ }
7467 		},
7468 		.chained = true,
7469 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7470 	},
7471 	[ALC269_FIXUP_HEADSET_MODE] = {
7472 		.type = HDA_FIXUP_FUNC,
7473 		.v.func = alc_fixup_headset_mode,
7474 		.chained = true,
7475 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7476 	},
7477 	[ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7478 		.type = HDA_FIXUP_FUNC,
7479 		.v.func = alc_fixup_headset_mode_no_hp_mic,
7480 	},
7481 	[ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7482 		.type = HDA_FIXUP_PINS,
7483 		.v.pins = (const struct hda_pintbl[]) {
7484 			{ 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7485 			{ }
7486 		},
7487 		.chained = true,
7488 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7489 	},
7490 	[ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7491 		.type = HDA_FIXUP_PINS,
7492 		.v.pins = (const struct hda_pintbl[]) {
7493 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7494 			{ }
7495 		},
7496 		.chained = true,
7497 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7498 	},
7499 	[ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
7500 		.type = HDA_FIXUP_PINS,
7501 		.v.pins = (const struct hda_pintbl[]) {
7502 			{0x12, 0x90a60130},
7503 			{0x13, 0x40000000},
7504 			{0x14, 0x90170110},
7505 			{0x18, 0x411111f0},
7506 			{0x19, 0x04a11040},
7507 			{0x1a, 0x411111f0},
7508 			{0x1b, 0x90170112},
7509 			{0x1d, 0x40759a05},
7510 			{0x1e, 0x411111f0},
7511 			{0x21, 0x04211020},
7512 			{ }
7513 		},
7514 		.chained = true,
7515 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7516 	},
7517 	[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7518 		.type = HDA_FIXUP_FUNC,
7519 		.v.func = alc298_fixup_huawei_mbx_stereo,
7520 		.chained = true,
7521 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7522 	},
7523 	[ALC269_FIXUP_ASUS_X101_FUNC] = {
7524 		.type = HDA_FIXUP_FUNC,
7525 		.v.func = alc269_fixup_x101_headset_mic,
7526 	},
7527 	[ALC269_FIXUP_ASUS_X101_VERB] = {
7528 		.type = HDA_FIXUP_VERBS,
7529 		.v.verbs = (const struct hda_verb[]) {
7530 			{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7531 			{0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7532 			{0x20, AC_VERB_SET_PROC_COEF,  0x0310},
7533 			{ }
7534 		},
7535 		.chained = true,
7536 		.chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7537 	},
7538 	[ALC269_FIXUP_ASUS_X101] = {
7539 		.type = HDA_FIXUP_PINS,
7540 		.v.pins = (const struct hda_pintbl[]) {
7541 			{ 0x18, 0x04a1182c }, /* Headset mic */
7542 			{ }
7543 		},
7544 		.chained = true,
7545 		.chain_id = ALC269_FIXUP_ASUS_X101_VERB
7546 	},
7547 	[ALC271_FIXUP_AMIC_MIC2] = {
7548 		.type = HDA_FIXUP_PINS,
7549 		.v.pins = (const struct hda_pintbl[]) {
7550 			{ 0x14, 0x99130110 }, /* speaker */
7551 			{ 0x19, 0x01a19c20 }, /* mic */
7552 			{ 0x1b, 0x99a7012f }, /* int-mic */
7553 			{ 0x21, 0x0121401f }, /* HP out */
7554 			{ }
7555 		},
7556 	},
7557 	[ALC271_FIXUP_HP_GATE_MIC_JACK] = {
7558 		.type = HDA_FIXUP_FUNC,
7559 		.v.func = alc271_hp_gate_mic_jack,
7560 		.chained = true,
7561 		.chain_id = ALC271_FIXUP_AMIC_MIC2,
7562 	},
7563 	[ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7564 		.type = HDA_FIXUP_FUNC,
7565 		.v.func = alc269_fixup_limit_int_mic_boost,
7566 		.chained = true,
7567 		.chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7568 	},
7569 	[ALC269_FIXUP_ACER_AC700] = {
7570 		.type = HDA_FIXUP_PINS,
7571 		.v.pins = (const struct hda_pintbl[]) {
7572 			{ 0x12, 0x99a3092f }, /* int-mic */
7573 			{ 0x14, 0x99130110 }, /* speaker */
7574 			{ 0x18, 0x03a11c20 }, /* mic */
7575 			{ 0x1e, 0x0346101e }, /* SPDIF1 */
7576 			{ 0x21, 0x0321101f }, /* HP out */
7577 			{ }
7578 		},
7579 		.chained = true,
7580 		.chain_id = ALC271_FIXUP_DMIC,
7581 	},
7582 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7583 		.type = HDA_FIXUP_FUNC,
7584 		.v.func = alc269_fixup_limit_int_mic_boost,
7585 		.chained = true,
7586 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7587 	},
7588 	[ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7589 		.type = HDA_FIXUP_FUNC,
7590 		.v.func = alc269_fixup_limit_int_mic_boost,
7591 		.chained = true,
7592 		.chain_id = ALC269VB_FIXUP_DMIC,
7593 	},
7594 	[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7595 		.type = HDA_FIXUP_VERBS,
7596 		.v.verbs = (const struct hda_verb[]) {
7597 			/* class-D output amp +5dB */
7598 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7599 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7600 			{}
7601 		},
7602 		.chained = true,
7603 		.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7604 	},
7605 	[ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7606 		.type = HDA_FIXUP_PINS,
7607 		.v.pins = (const struct hda_pintbl[]) {
7608 			{ 0x18, 0x01a110f0 },  /* use as headset mic */
7609 			{ }
7610 		},
7611 		.chained = true,
7612 		.chain_id = ALC269_FIXUP_HEADSET_MIC
7613 	},
7614 	[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7615 		.type = HDA_FIXUP_FUNC,
7616 		.v.func = alc269_fixup_limit_int_mic_boost,
7617 		.chained = true,
7618 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7619 	},
7620 	[ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7621 		.type = HDA_FIXUP_PINS,
7622 		.v.pins = (const struct hda_pintbl[]) {
7623 			{ 0x12, 0x99a3092f }, /* int-mic */
7624 			{ 0x18, 0x03a11d20 }, /* mic */
7625 			{ 0x19, 0x411111f0 }, /* Unused bogus pin */
7626 			{ }
7627 		},
7628 	},
7629 	[ALC283_FIXUP_CHROME_BOOK] = {
7630 		.type = HDA_FIXUP_FUNC,
7631 		.v.func = alc283_fixup_chromebook,
7632 	},
7633 	[ALC283_FIXUP_SENSE_COMBO_JACK] = {
7634 		.type = HDA_FIXUP_FUNC,
7635 		.v.func = alc283_fixup_sense_combo_jack,
7636 		.chained = true,
7637 		.chain_id = ALC283_FIXUP_CHROME_BOOK,
7638 	},
7639 	[ALC282_FIXUP_ASUS_TX300] = {
7640 		.type = HDA_FIXUP_FUNC,
7641 		.v.func = alc282_fixup_asus_tx300,
7642 	},
7643 	[ALC283_FIXUP_INT_MIC] = {
7644 		.type = HDA_FIXUP_VERBS,
7645 		.v.verbs = (const struct hda_verb[]) {
7646 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7647 			{0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7648 			{ }
7649 		},
7650 		.chained = true,
7651 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7652 	},
7653 	[ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7654 		.type = HDA_FIXUP_PINS,
7655 		.v.pins = (const struct hda_pintbl[]) {
7656 			{ 0x17, 0x90170112 }, /* subwoofer */
7657 			{ }
7658 		},
7659 		.chained = true,
7660 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7661 	},
7662 	[ALC290_FIXUP_SUBWOOFER] = {
7663 		.type = HDA_FIXUP_PINS,
7664 		.v.pins = (const struct hda_pintbl[]) {
7665 			{ 0x17, 0x90170112 }, /* subwoofer */
7666 			{ }
7667 		},
7668 		.chained = true,
7669 		.chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7670 	},
7671 	[ALC290_FIXUP_MONO_SPEAKERS] = {
7672 		.type = HDA_FIXUP_FUNC,
7673 		.v.func = alc290_fixup_mono_speakers,
7674 	},
7675 	[ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7676 		.type = HDA_FIXUP_FUNC,
7677 		.v.func = alc290_fixup_mono_speakers,
7678 		.chained = true,
7679 		.chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7680 	},
7681 	[ALC269_FIXUP_THINKPAD_ACPI] = {
7682 		.type = HDA_FIXUP_FUNC,
7683 		.v.func = alc_fixup_thinkpad_acpi,
7684 		.chained = true,
7685 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
7686 	},
7687 	[ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7688 		.type = HDA_FIXUP_FUNC,
7689 		.v.func = alc_fixup_inv_dmic,
7690 		.chained = true,
7691 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7692 	},
7693 	[ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
7694 		.type = HDA_FIXUP_PINS,
7695 		.v.pins = (const struct hda_pintbl[]) {
7696 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7697 			{ }
7698 		},
7699 		.chained = true,
7700 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7701 	},
7702 	[ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7703 		.type = HDA_FIXUP_PINS,
7704 		.v.pins = (const struct hda_pintbl[]) {
7705 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7706 			{ }
7707 		},
7708 		.chained = true,
7709 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7710 	},
7711 	[ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7712 		.type = HDA_FIXUP_PINS,
7713 		.v.pins = (const struct hda_pintbl[]) {
7714 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7715 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7716 			{ }
7717 		},
7718 		.chained = true,
7719 		.chain_id = ALC255_FIXUP_HEADSET_MODE
7720 	},
7721 	[ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7722 		.type = HDA_FIXUP_PINS,
7723 		.v.pins = (const struct hda_pintbl[]) {
7724 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7725 			{ }
7726 		},
7727 		.chained = true,
7728 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7729 	},
7730 	[ALC255_FIXUP_HEADSET_MODE] = {
7731 		.type = HDA_FIXUP_FUNC,
7732 		.v.func = alc_fixup_headset_mode_alc255,
7733 		.chained = true,
7734 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7735 	},
7736 	[ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7737 		.type = HDA_FIXUP_FUNC,
7738 		.v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7739 	},
7740 	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7741 		.type = HDA_FIXUP_PINS,
7742 		.v.pins = (const struct hda_pintbl[]) {
7743 			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7744 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7745 			{ }
7746 		},
7747 		.chained = true,
7748 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7749 	},
7750 	[ALC292_FIXUP_TPT440_DOCK] = {
7751 		.type = HDA_FIXUP_FUNC,
7752 		.v.func = alc_fixup_tpt440_dock,
7753 		.chained = true,
7754 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7755 	},
7756 	[ALC292_FIXUP_TPT440] = {
7757 		.type = HDA_FIXUP_FUNC,
7758 		.v.func = alc_fixup_disable_aamix,
7759 		.chained = true,
7760 		.chain_id = ALC292_FIXUP_TPT440_DOCK,
7761 	},
7762 	[ALC283_FIXUP_HEADSET_MIC] = {
7763 		.type = HDA_FIXUP_PINS,
7764 		.v.pins = (const struct hda_pintbl[]) {
7765 			{ 0x19, 0x04a110f0 },
7766 			{ },
7767 		},
7768 	},
7769 	[ALC255_FIXUP_MIC_MUTE_LED] = {
7770 		.type = HDA_FIXUP_FUNC,
7771 		.v.func = alc_fixup_micmute_led,
7772 	},
7773 	[ALC282_FIXUP_ASPIRE_V5_PINS] = {
7774 		.type = HDA_FIXUP_PINS,
7775 		.v.pins = (const struct hda_pintbl[]) {
7776 			{ 0x12, 0x90a60130 },
7777 			{ 0x14, 0x90170110 },
7778 			{ 0x17, 0x40000008 },
7779 			{ 0x18, 0x411111f0 },
7780 			{ 0x19, 0x01a1913c },
7781 			{ 0x1a, 0x411111f0 },
7782 			{ 0x1b, 0x411111f0 },
7783 			{ 0x1d, 0x40f89b2d },
7784 			{ 0x1e, 0x411111f0 },
7785 			{ 0x21, 0x0321101f },
7786 			{ },
7787 		},
7788 	},
7789 	[ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7790 		.type = HDA_FIXUP_FUNC,
7791 		.v.func = alc269vb_fixup_aspire_e1_coef,
7792 	},
7793 	[ALC280_FIXUP_HP_GPIO4] = {
7794 		.type = HDA_FIXUP_FUNC,
7795 		.v.func = alc280_fixup_hp_gpio4,
7796 	},
7797 	[ALC286_FIXUP_HP_GPIO_LED] = {
7798 		.type = HDA_FIXUP_FUNC,
7799 		.v.func = alc286_fixup_hp_gpio_led,
7800 	},
7801 	[ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7802 		.type = HDA_FIXUP_FUNC,
7803 		.v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7804 	},
7805 	[ALC280_FIXUP_HP_DOCK_PINS] = {
7806 		.type = HDA_FIXUP_PINS,
7807 		.v.pins = (const struct hda_pintbl[]) {
7808 			{ 0x1b, 0x21011020 }, /* line-out */
7809 			{ 0x1a, 0x01a1903c }, /* headset mic */
7810 			{ 0x18, 0x2181103f }, /* line-in */
7811 			{ },
7812 		},
7813 		.chained = true,
7814 		.chain_id = ALC280_FIXUP_HP_GPIO4
7815 	},
7816 	[ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7817 		.type = HDA_FIXUP_PINS,
7818 		.v.pins = (const struct hda_pintbl[]) {
7819 			{ 0x1b, 0x21011020 }, /* line-out */
7820 			{ 0x18, 0x2181103f }, /* line-in */
7821 			{ },
7822 		},
7823 		.chained = true,
7824 		.chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7825 	},
7826 	[ALC280_FIXUP_HP_9480M] = {
7827 		.type = HDA_FIXUP_FUNC,
7828 		.v.func = alc280_fixup_hp_9480m,
7829 	},
7830 	[ALC245_FIXUP_HP_X360_AMP] = {
7831 		.type = HDA_FIXUP_FUNC,
7832 		.v.func = alc245_fixup_hp_x360_amp,
7833 		.chained = true,
7834 		.chain_id = ALC245_FIXUP_HP_GPIO_LED
7835 	},
7836 	[ALC288_FIXUP_DELL_HEADSET_MODE] = {
7837 		.type = HDA_FIXUP_FUNC,
7838 		.v.func = alc_fixup_headset_mode_dell_alc288,
7839 		.chained = true,
7840 		.chain_id = ALC255_FIXUP_MIC_MUTE_LED
7841 	},
7842 	[ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7843 		.type = HDA_FIXUP_PINS,
7844 		.v.pins = (const struct hda_pintbl[]) {
7845 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7846 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7847 			{ }
7848 		},
7849 		.chained = true,
7850 		.chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7851 	},
7852 	[ALC288_FIXUP_DISABLE_AAMIX] = {
7853 		.type = HDA_FIXUP_FUNC,
7854 		.v.func = alc_fixup_disable_aamix,
7855 		.chained = true,
7856 		.chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
7857 	},
7858 	[ALC288_FIXUP_DELL_XPS_13] = {
7859 		.type = HDA_FIXUP_FUNC,
7860 		.v.func = alc_fixup_dell_xps13,
7861 		.chained = true,
7862 		.chain_id = ALC288_FIXUP_DISABLE_AAMIX
7863 	},
7864 	[ALC292_FIXUP_DISABLE_AAMIX] = {
7865 		.type = HDA_FIXUP_FUNC,
7866 		.v.func = alc_fixup_disable_aamix,
7867 		.chained = true,
7868 		.chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
7869 	},
7870 	[ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7871 		.type = HDA_FIXUP_FUNC,
7872 		.v.func = alc_fixup_disable_aamix,
7873 		.chained = true,
7874 		.chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7875 	},
7876 	[ALC292_FIXUP_DELL_E7X_AAMIX] = {
7877 		.type = HDA_FIXUP_FUNC,
7878 		.v.func = alc_fixup_dell_xps13,
7879 		.chained = true,
7880 		.chain_id = ALC292_FIXUP_DISABLE_AAMIX
7881 	},
7882 	[ALC292_FIXUP_DELL_E7X] = {
7883 		.type = HDA_FIXUP_FUNC,
7884 		.v.func = alc_fixup_micmute_led,
7885 		/* micmute fixup must be applied at last */
7886 		.chained_before = true,
7887 		.chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7888 	},
7889 	[ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7890 		.type = HDA_FIXUP_PINS,
7891 		.v.pins = (const struct hda_pintbl[]) {
7892 			{ 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7893 			{ }
7894 		},
7895 		.chained_before = true,
7896 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
7897 	},
7898 	[ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7899 		.type = HDA_FIXUP_PINS,
7900 		.v.pins = (const struct hda_pintbl[]) {
7901 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7902 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7903 			{ }
7904 		},
7905 		.chained = true,
7906 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7907 	},
7908 	[ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7909 		.type = HDA_FIXUP_PINS,
7910 		.v.pins = (const struct hda_pintbl[]) {
7911 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7912 			{ }
7913 		},
7914 		.chained = true,
7915 		.chain_id = ALC269_FIXUP_HEADSET_MODE
7916 	},
7917 	[ALC275_FIXUP_DELL_XPS] = {
7918 		.type = HDA_FIXUP_VERBS,
7919 		.v.verbs = (const struct hda_verb[]) {
7920 			/* Enables internal speaker */
7921 			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7922 			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7923 			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7924 			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7925 			{}
7926 		}
7927 	},
7928 	[ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7929 		.type = HDA_FIXUP_FUNC,
7930 		.v.func = alc_fixup_disable_aamix,
7931 		.chained = true,
7932 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
7933 	},
7934 	[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7935 		.type = HDA_FIXUP_FUNC,
7936 		.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7937 	},
7938 	[ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7939 		.type = HDA_FIXUP_FUNC,
7940 		.v.func = alc_fixup_inv_dmic,
7941 		.chained = true,
7942 		.chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7943 	},
7944 	[ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7945 		.type = HDA_FIXUP_FUNC,
7946 		.v.func = alc269_fixup_limit_int_mic_boost
7947 	},
7948 	[ALC255_FIXUP_DELL_SPK_NOISE] = {
7949 		.type = HDA_FIXUP_FUNC,
7950 		.v.func = alc_fixup_disable_aamix,
7951 		.chained = true,
7952 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7953 	},
7954 	[ALC225_FIXUP_DISABLE_MIC_VREF] = {
7955 		.type = HDA_FIXUP_FUNC,
7956 		.v.func = alc_fixup_disable_mic_vref,
7957 		.chained = true,
7958 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7959 	},
7960 	[ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7961 		.type = HDA_FIXUP_VERBS,
7962 		.v.verbs = (const struct hda_verb[]) {
7963 			/* Disable pass-through path for FRONT 14h */
7964 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7965 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7966 			{}
7967 		},
7968 		.chained = true,
7969 		.chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
7970 	},
7971 	[ALC280_FIXUP_HP_HEADSET_MIC] = {
7972 		.type = HDA_FIXUP_FUNC,
7973 		.v.func = alc_fixup_disable_aamix,
7974 		.chained = true,
7975 		.chain_id = ALC269_FIXUP_HEADSET_MIC,
7976 	},
7977 	[ALC221_FIXUP_HP_FRONT_MIC] = {
7978 		.type = HDA_FIXUP_PINS,
7979 		.v.pins = (const struct hda_pintbl[]) {
7980 			{ 0x19, 0x02a19020 }, /* Front Mic */
7981 			{ }
7982 		},
7983 	},
7984 	[ALC292_FIXUP_TPT460] = {
7985 		.type = HDA_FIXUP_FUNC,
7986 		.v.func = alc_fixup_tpt440_dock,
7987 		.chained = true,
7988 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7989 	},
7990 	[ALC298_FIXUP_SPK_VOLUME] = {
7991 		.type = HDA_FIXUP_FUNC,
7992 		.v.func = alc298_fixup_speaker_volume,
7993 		.chained = true,
7994 		.chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
7995 	},
7996 	[ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7997 		.type = HDA_FIXUP_FUNC,
7998 		.v.func = alc298_fixup_speaker_volume,
7999 	},
8000 	[ALC295_FIXUP_DISABLE_DAC3] = {
8001 		.type = HDA_FIXUP_FUNC,
8002 		.v.func = alc295_fixup_disable_dac3,
8003 	},
8004 	[ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
8005 		.type = HDA_FIXUP_FUNC,
8006 		.v.func = alc285_fixup_speaker2_to_dac1,
8007 		.chained = true,
8008 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8009 	},
8010 	[ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
8011 		.type = HDA_FIXUP_PINS,
8012 		.v.pins = (const struct hda_pintbl[]) {
8013 			{ 0x1b, 0x90170151 },
8014 			{ }
8015 		},
8016 		.chained = true,
8017 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8018 	},
8019 	[ALC269_FIXUP_ATIV_BOOK_8] = {
8020 		.type = HDA_FIXUP_FUNC,
8021 		.v.func = alc_fixup_auto_mute_via_amp,
8022 		.chained = true,
8023 		.chain_id = ALC269_FIXUP_NO_SHUTUP
8024 	},
8025 	[ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
8026 		.type = HDA_FIXUP_PINS,
8027 		.v.pins = (const struct hda_pintbl[]) {
8028 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8029 			{ 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
8030 			{ }
8031 		},
8032 		.chained = true,
8033 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8034 	},
8035 	[ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
8036 		.type = HDA_FIXUP_PINS,
8037 		.v.pins = (const struct hda_pintbl[]) {
8038 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8039 			{ 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
8040 			{ }
8041 		},
8042 		.chained = true,
8043 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8044 	},
8045 	[ALC256_FIXUP_ASUS_HEADSET_MODE] = {
8046 		.type = HDA_FIXUP_FUNC,
8047 		.v.func = alc_fixup_headset_mode,
8048 	},
8049 	[ALC256_FIXUP_ASUS_MIC] = {
8050 		.type = HDA_FIXUP_PINS,
8051 		.v.pins = (const struct hda_pintbl[]) {
8052 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8053 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8054 			{ }
8055 		},
8056 		.chained = true,
8057 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8058 	},
8059 	[ALC256_FIXUP_ASUS_AIO_GPIO2] = {
8060 		.type = HDA_FIXUP_FUNC,
8061 		/* Set up GPIO2 for the speaker amp */
8062 		.v.func = alc_fixup_gpio4,
8063 	},
8064 	[ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8065 		.type = HDA_FIXUP_PINS,
8066 		.v.pins = (const struct hda_pintbl[]) {
8067 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8068 			{ }
8069 		},
8070 		.chained = true,
8071 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8072 	},
8073 	[ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
8074 		.type = HDA_FIXUP_VERBS,
8075 		.v.verbs = (const struct hda_verb[]) {
8076 			/* Enables internal speaker */
8077 			{0x20, AC_VERB_SET_COEF_INDEX, 0x40},
8078 			{0x20, AC_VERB_SET_PROC_COEF, 0x8800},
8079 			{}
8080 		},
8081 		.chained = true,
8082 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8083 	},
8084 	[ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
8085 		.type = HDA_FIXUP_FUNC,
8086 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8087 		.chained = true,
8088 		.chain_id = ALC269_FIXUP_GPIO2
8089 	},
8090 	[ALC233_FIXUP_ACER_HEADSET_MIC] = {
8091 		.type = HDA_FIXUP_VERBS,
8092 		.v.verbs = (const struct hda_verb[]) {
8093 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8094 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8095 			{ }
8096 		},
8097 		.chained = true,
8098 		.chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
8099 	},
8100 	[ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
8101 		.type = HDA_FIXUP_PINS,
8102 		.v.pins = (const struct hda_pintbl[]) {
8103 			/* Change the mic location from front to right, otherwise there are
8104 			   two front mics with the same name, pulseaudio can't handle them.
8105 			   This is just a temporary workaround, after applying this fixup,
8106 			   there will be one "Front Mic" and one "Mic" in this machine.
8107 			 */
8108 			{ 0x1a, 0x04a19040 },
8109 			{ }
8110 		},
8111 	},
8112 	[ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
8113 		.type = HDA_FIXUP_PINS,
8114 		.v.pins = (const struct hda_pintbl[]) {
8115 			{ 0x16, 0x0101102f }, /* Rear Headset HP */
8116 			{ 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
8117 			{ 0x1a, 0x01a19030 }, /* Rear Headset MIC */
8118 			{ 0x1b, 0x02011020 },
8119 			{ }
8120 		},
8121 		.chained = true,
8122 		.chain_id = ALC225_FIXUP_S3_POP_NOISE
8123 	},
8124 	[ALC225_FIXUP_S3_POP_NOISE] = {
8125 		.type = HDA_FIXUP_FUNC,
8126 		.v.func = alc225_fixup_s3_pop_noise,
8127 		.chained = true,
8128 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8129 	},
8130 	[ALC700_FIXUP_INTEL_REFERENCE] = {
8131 		.type = HDA_FIXUP_VERBS,
8132 		.v.verbs = (const struct hda_verb[]) {
8133 			/* Enables internal speaker */
8134 			{0x20, AC_VERB_SET_COEF_INDEX, 0x45},
8135 			{0x20, AC_VERB_SET_PROC_COEF, 0x5289},
8136 			{0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
8137 			{0x20, AC_VERB_SET_PROC_COEF, 0x001b},
8138 			{0x58, AC_VERB_SET_COEF_INDEX, 0x00},
8139 			{0x58, AC_VERB_SET_PROC_COEF, 0x3888},
8140 			{0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
8141 			{0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
8142 			{}
8143 		}
8144 	},
8145 	[ALC274_FIXUP_DELL_BIND_DACS] = {
8146 		.type = HDA_FIXUP_FUNC,
8147 		.v.func = alc274_fixup_bind_dacs,
8148 		.chained = true,
8149 		.chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
8150 	},
8151 	[ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
8152 		.type = HDA_FIXUP_PINS,
8153 		.v.pins = (const struct hda_pintbl[]) {
8154 			{ 0x1b, 0x0401102f },
8155 			{ }
8156 		},
8157 		.chained = true,
8158 		.chain_id = ALC274_FIXUP_DELL_BIND_DACS
8159 	},
8160 	[ALC298_FIXUP_TPT470_DOCK_FIX] = {
8161 		.type = HDA_FIXUP_FUNC,
8162 		.v.func = alc_fixup_tpt470_dock,
8163 		.chained = true,
8164 		.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
8165 	},
8166 	[ALC298_FIXUP_TPT470_DOCK] = {
8167 		.type = HDA_FIXUP_FUNC,
8168 		.v.func = alc_fixup_tpt470_dacs,
8169 		.chained = true,
8170 		.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
8171 	},
8172 	[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
8173 		.type = HDA_FIXUP_PINS,
8174 		.v.pins = (const struct hda_pintbl[]) {
8175 			{ 0x14, 0x0201101f },
8176 			{ }
8177 		},
8178 		.chained = true,
8179 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8180 	},
8181 	[ALC255_FIXUP_DELL_HEADSET_MIC] = {
8182 		.type = HDA_FIXUP_PINS,
8183 		.v.pins = (const struct hda_pintbl[]) {
8184 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8185 			{ }
8186 		},
8187 		.chained = true,
8188 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8189 	},
8190 	[ALC295_FIXUP_HP_X360] = {
8191 		.type = HDA_FIXUP_FUNC,
8192 		.v.func = alc295_fixup_hp_top_speakers,
8193 		.chained = true,
8194 		.chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
8195 	},
8196 	[ALC221_FIXUP_HP_HEADSET_MIC] = {
8197 		.type = HDA_FIXUP_PINS,
8198 		.v.pins = (const struct hda_pintbl[]) {
8199 			{ 0x19, 0x0181313f},
8200 			{ }
8201 		},
8202 		.chained = true,
8203 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8204 	},
8205 	[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
8206 		.type = HDA_FIXUP_FUNC,
8207 		.v.func = alc285_fixup_invalidate_dacs,
8208 		.chained = true,
8209 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8210 	},
8211 	[ALC295_FIXUP_HP_AUTO_MUTE] = {
8212 		.type = HDA_FIXUP_FUNC,
8213 		.v.func = alc_fixup_auto_mute_via_amp,
8214 	},
8215 	[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
8216 		.type = HDA_FIXUP_PINS,
8217 		.v.pins = (const struct hda_pintbl[]) {
8218 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8219 			{ }
8220 		},
8221 		.chained = true,
8222 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8223 	},
8224 	[ALC294_FIXUP_ASUS_MIC] = {
8225 		.type = HDA_FIXUP_PINS,
8226 		.v.pins = (const struct hda_pintbl[]) {
8227 			{ 0x13, 0x90a60160 }, /* use as internal mic */
8228 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8229 			{ }
8230 		},
8231 		.chained = true,
8232 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8233 	},
8234 	[ALC294_FIXUP_ASUS_HEADSET_MIC] = {
8235 		.type = HDA_FIXUP_PINS,
8236 		.v.pins = (const struct hda_pintbl[]) {
8237 			{ 0x19, 0x01a1103c }, /* use as headset mic */
8238 			{ }
8239 		},
8240 		.chained = true,
8241 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8242 	},
8243 	[ALC294_FIXUP_ASUS_SPK] = {
8244 		.type = HDA_FIXUP_VERBS,
8245 		.v.verbs = (const struct hda_verb[]) {
8246 			/* Set EAPD high */
8247 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8248 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
8249 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8250 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8251 			{ }
8252 		},
8253 		.chained = true,
8254 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8255 	},
8256 	[ALC295_FIXUP_CHROME_BOOK] = {
8257 		.type = HDA_FIXUP_FUNC,
8258 		.v.func = alc295_fixup_chromebook,
8259 		.chained = true,
8260 		.chain_id = ALC225_FIXUP_HEADSET_JACK
8261 	},
8262 	[ALC225_FIXUP_HEADSET_JACK] = {
8263 		.type = HDA_FIXUP_FUNC,
8264 		.v.func = alc_fixup_headset_jack,
8265 	},
8266 	[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8267 		.type = HDA_FIXUP_PINS,
8268 		.v.pins = (const struct hda_pintbl[]) {
8269 			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8270 			{ }
8271 		},
8272 		.chained = true,
8273 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8274 	},
8275 	[ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8276 		.type = HDA_FIXUP_VERBS,
8277 		.v.verbs = (const struct hda_verb[]) {
8278 			/* Disable PCBEEP-IN passthrough */
8279 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8280 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8281 			{ }
8282 		},
8283 		.chained = true,
8284 		.chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8285 	},
8286 	[ALC255_FIXUP_ACER_HEADSET_MIC] = {
8287 		.type = HDA_FIXUP_PINS,
8288 		.v.pins = (const struct hda_pintbl[]) {
8289 			{ 0x19, 0x03a11130 },
8290 			{ 0x1a, 0x90a60140 }, /* use as internal mic */
8291 			{ }
8292 		},
8293 		.chained = true,
8294 		.chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8295 	},
8296 	[ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8297 		.type = HDA_FIXUP_PINS,
8298 		.v.pins = (const struct hda_pintbl[]) {
8299 			{ 0x16, 0x01011020 }, /* Rear Line out */
8300 			{ 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8301 			{ }
8302 		},
8303 		.chained = true,
8304 		.chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8305 	},
8306 	[ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8307 		.type = HDA_FIXUP_FUNC,
8308 		.v.func = alc_fixup_auto_mute_via_amp,
8309 		.chained = true,
8310 		.chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8311 	},
8312 	[ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8313 		.type = HDA_FIXUP_FUNC,
8314 		.v.func = alc_fixup_disable_mic_vref,
8315 		.chained = true,
8316 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8317 	},
8318 	[ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8319 		.type = HDA_FIXUP_VERBS,
8320 		.v.verbs = (const struct hda_verb[]) {
8321 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8322 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8323 			{ }
8324 		},
8325 		.chained = true,
8326 		.chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8327 	},
8328 	[ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8329 		.type = HDA_FIXUP_PINS,
8330 		.v.pins = (const struct hda_pintbl[]) {
8331 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8332 			{ }
8333 		},
8334 		.chained = true,
8335 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8336 	},
8337 	[ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8338 		.type = HDA_FIXUP_PINS,
8339 		.v.pins = (const struct hda_pintbl[]) {
8340 			{ 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8341 			{ }
8342 		},
8343 		.chained = true,
8344 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8345 	},
8346 	[ALC299_FIXUP_PREDATOR_SPK] = {
8347 		.type = HDA_FIXUP_PINS,
8348 		.v.pins = (const struct hda_pintbl[]) {
8349 			{ 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8350 			{ }
8351 		}
8352 	},
8353 	[ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8354 		.type = HDA_FIXUP_PINS,
8355 		.v.pins = (const struct hda_pintbl[]) {
8356 			{ 0x19, 0x04a11040 },
8357 			{ 0x21, 0x04211020 },
8358 			{ }
8359 		},
8360 		.chained = true,
8361 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8362 	},
8363 	[ALC289_FIXUP_DELL_SPK2] = {
8364 		.type = HDA_FIXUP_PINS,
8365 		.v.pins = (const struct hda_pintbl[]) {
8366 			{ 0x17, 0x90170130 }, /* bass spk */
8367 			{ }
8368 		},
8369 		.chained = true,
8370 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8371 	},
8372 	[ALC289_FIXUP_DUAL_SPK] = {
8373 		.type = HDA_FIXUP_FUNC,
8374 		.v.func = alc285_fixup_speaker2_to_dac1,
8375 		.chained = true,
8376 		.chain_id = ALC289_FIXUP_DELL_SPK2
8377 	},
8378 	[ALC294_FIXUP_SPK2_TO_DAC1] = {
8379 		.type = HDA_FIXUP_FUNC,
8380 		.v.func = alc285_fixup_speaker2_to_dac1,
8381 		.chained = true,
8382 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8383 	},
8384 	[ALC294_FIXUP_ASUS_DUAL_SPK] = {
8385 		.type = HDA_FIXUP_FUNC,
8386 		/* The GPIO must be pulled to initialize the AMP */
8387 		.v.func = alc_fixup_gpio4,
8388 		.chained = true,
8389 		.chain_id = ALC294_FIXUP_SPK2_TO_DAC1
8390 	},
8391 	[ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8392 		.type = HDA_FIXUP_FUNC,
8393 		.v.func = alc285_fixup_thinkpad_x1_gen7,
8394 		.chained = true,
8395 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8396 	},
8397 	[ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8398 		.type = HDA_FIXUP_FUNC,
8399 		.v.func = alc_fixup_headset_jack,
8400 		.chained = true,
8401 		.chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
8402 	},
8403 	[ALC294_FIXUP_ASUS_HPE] = {
8404 		.type = HDA_FIXUP_VERBS,
8405 		.v.verbs = (const struct hda_verb[]) {
8406 			/* Set EAPD high */
8407 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8408 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8409 			{ }
8410 		},
8411 		.chained = true,
8412 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8413 	},
8414 	[ALC294_FIXUP_ASUS_GX502_PINS] = {
8415 		.type = HDA_FIXUP_PINS,
8416 		.v.pins = (const struct hda_pintbl[]) {
8417 			{ 0x19, 0x03a11050 }, /* front HP mic */
8418 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8419 			{ 0x21, 0x03211020 }, /* front HP out */
8420 			{ }
8421 		},
8422 		.chained = true,
8423 		.chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8424 	},
8425 	[ALC294_FIXUP_ASUS_GX502_VERBS] = {
8426 		.type = HDA_FIXUP_VERBS,
8427 		.v.verbs = (const struct hda_verb[]) {
8428 			/* set 0x15 to HP-OUT ctrl */
8429 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8430 			/* unmute the 0x15 amp */
8431 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8432 			{ }
8433 		},
8434 		.chained = true,
8435 		.chain_id = ALC294_FIXUP_ASUS_GX502_HP
8436 	},
8437 	[ALC294_FIXUP_ASUS_GX502_HP] = {
8438 		.type = HDA_FIXUP_FUNC,
8439 		.v.func = alc294_fixup_gx502_hp,
8440 	},
8441 	[ALC294_FIXUP_ASUS_GU502_PINS] = {
8442 		.type = HDA_FIXUP_PINS,
8443 		.v.pins = (const struct hda_pintbl[]) {
8444 			{ 0x19, 0x01a11050 }, /* rear HP mic */
8445 			{ 0x1a, 0x01a11830 }, /* rear external mic */
8446 			{ 0x21, 0x012110f0 }, /* rear HP out */
8447 			{ }
8448 		},
8449 		.chained = true,
8450 		.chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8451 	},
8452 	[ALC294_FIXUP_ASUS_GU502_VERBS] = {
8453 		.type = HDA_FIXUP_VERBS,
8454 		.v.verbs = (const struct hda_verb[]) {
8455 			/* set 0x15 to HP-OUT ctrl */
8456 			{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8457 			/* unmute the 0x15 amp */
8458 			{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8459 			/* set 0x1b to HP-OUT */
8460 			{ 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8461 			{ }
8462 		},
8463 		.chained = true,
8464 		.chain_id = ALC294_FIXUP_ASUS_GU502_HP
8465 	},
8466 	[ALC294_FIXUP_ASUS_GU502_HP] = {
8467 		.type = HDA_FIXUP_FUNC,
8468 		.v.func = alc294_fixup_gu502_hp,
8469 	},
8470 	 [ALC294_FIXUP_ASUS_G513_PINS] = {
8471 		.type = HDA_FIXUP_PINS,
8472 		.v.pins = (const struct hda_pintbl[]) {
8473 				{ 0x19, 0x03a11050 }, /* front HP mic */
8474 				{ 0x1a, 0x03a11c30 }, /* rear external mic */
8475 				{ 0x21, 0x03211420 }, /* front HP out */
8476 				{ }
8477 		},
8478 	},
8479 	[ALC285_FIXUP_ASUS_G533Z_PINS] = {
8480 		.type = HDA_FIXUP_PINS,
8481 		.v.pins = (const struct hda_pintbl[]) {
8482 			{ 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */
8483 			{ 0x19, 0x03a19020 }, /* Mic Boost Volume */
8484 			{ 0x1a, 0x03a11c30 }, /* Mic Boost Volume */
8485 			{ 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */
8486 			{ 0x21, 0x03211420 },
8487 			{ }
8488 		},
8489 	},
8490 	[ALC294_FIXUP_ASUS_COEF_1B] = {
8491 		.type = HDA_FIXUP_VERBS,
8492 		.v.verbs = (const struct hda_verb[]) {
8493 			/* Set bit 10 to correct noisy output after reboot from
8494 			 * Windows 10 (due to pop noise reduction?)
8495 			 */
8496 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8497 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8498 			{ }
8499 		},
8500 		.chained = true,
8501 		.chain_id = ALC289_FIXUP_ASUS_GA401,
8502 	},
8503 	[ALC285_FIXUP_HP_GPIO_LED] = {
8504 		.type = HDA_FIXUP_FUNC,
8505 		.v.func = alc285_fixup_hp_gpio_led,
8506 	},
8507 	[ALC285_FIXUP_HP_MUTE_LED] = {
8508 		.type = HDA_FIXUP_FUNC,
8509 		.v.func = alc285_fixup_hp_mute_led,
8510 	},
8511 	[ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED] = {
8512 		.type = HDA_FIXUP_FUNC,
8513 		.v.func = alc285_fixup_hp_spectre_x360_mute_led,
8514 	},
8515 	[ALC236_FIXUP_HP_GPIO_LED] = {
8516 		.type = HDA_FIXUP_FUNC,
8517 		.v.func = alc236_fixup_hp_gpio_led,
8518 	},
8519 	[ALC236_FIXUP_HP_MUTE_LED] = {
8520 		.type = HDA_FIXUP_FUNC,
8521 		.v.func = alc236_fixup_hp_mute_led,
8522 	},
8523 	[ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8524 		.type = HDA_FIXUP_FUNC,
8525 		.v.func = alc236_fixup_hp_mute_led_micmute_vref,
8526 	},
8527 	[ALC298_FIXUP_SAMSUNG_AMP] = {
8528 		.type = HDA_FIXUP_FUNC,
8529 		.v.func = alc298_fixup_samsung_amp,
8530 		.chained = true,
8531 		.chain_id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET
8532 	},
8533 	[ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8534 		.type = HDA_FIXUP_VERBS,
8535 		.v.verbs = (const struct hda_verb[]) {
8536 			{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8537 			{ }
8538 		},
8539 	},
8540 	[ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8541 		.type = HDA_FIXUP_VERBS,
8542 		.v.verbs = (const struct hda_verb[]) {
8543 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
8544 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
8545 			{ }
8546 		},
8547 	},
8548 	[ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8549 		.type = HDA_FIXUP_PINS,
8550 		.v.pins = (const struct hda_pintbl[]) {
8551 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8552 			{ }
8553 		},
8554 		.chained = true,
8555 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8556 	},
8557 	[ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8558 		.type = HDA_FIXUP_PINS,
8559 		.v.pins = (const struct hda_pintbl[]) {
8560 			{ 0x14, 0x90100120 }, /* use as internal speaker */
8561 			{ 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8562 			{ 0x1a, 0x01011020 }, /* use as line out */
8563 			{ },
8564 		},
8565 		.chained = true,
8566 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8567 	},
8568 	[ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8569 		.type = HDA_FIXUP_PINS,
8570 		.v.pins = (const struct hda_pintbl[]) {
8571 			{ 0x18, 0x02a11030 }, /* use as headset mic */
8572 			{ }
8573 		},
8574 		.chained = true,
8575 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8576 	},
8577 	[ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8578 		.type = HDA_FIXUP_PINS,
8579 		.v.pins = (const struct hda_pintbl[]) {
8580 			{ 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8581 			{ }
8582 		},
8583 		.chained = true,
8584 		.chain_id = ALC269_FIXUP_HEADSET_MIC
8585 	},
8586 	[ALC289_FIXUP_ASUS_GA401] = {
8587 		.type = HDA_FIXUP_FUNC,
8588 		.v.func = alc289_fixup_asus_ga401,
8589 		.chained = true,
8590 		.chain_id = ALC289_FIXUP_ASUS_GA502,
8591 	},
8592 	[ALC289_FIXUP_ASUS_GA502] = {
8593 		.type = HDA_FIXUP_PINS,
8594 		.v.pins = (const struct hda_pintbl[]) {
8595 			{ 0x19, 0x03a11020 }, /* headset mic with jack detect */
8596 			{ }
8597 		},
8598 	},
8599 	[ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8600 		.type = HDA_FIXUP_PINS,
8601 		.v.pins = (const struct hda_pintbl[]) {
8602 			{ 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8603 			{ }
8604 		},
8605 		.chained = true,
8606 		.chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8607 	},
8608 	[ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8609 		.type = HDA_FIXUP_FUNC,
8610 		.v.func = alc285_fixup_hp_gpio_amp_init,
8611 		.chained = true,
8612 		.chain_id = ALC285_FIXUP_HP_GPIO_LED
8613 	},
8614 	[ALC269_FIXUP_CZC_B20] = {
8615 		.type = HDA_FIXUP_PINS,
8616 		.v.pins = (const struct hda_pintbl[]) {
8617 			{ 0x12, 0x411111f0 },
8618 			{ 0x14, 0x90170110 }, /* speaker */
8619 			{ 0x15, 0x032f1020 }, /* HP out */
8620 			{ 0x17, 0x411111f0 },
8621 			{ 0x18, 0x03ab1040 }, /* mic */
8622 			{ 0x19, 0xb7a7013f },
8623 			{ 0x1a, 0x0181305f },
8624 			{ 0x1b, 0x411111f0 },
8625 			{ 0x1d, 0x411111f0 },
8626 			{ 0x1e, 0x411111f0 },
8627 			{ }
8628 		},
8629 		.chain_id = ALC269_FIXUP_DMIC,
8630 	},
8631 	[ALC269_FIXUP_CZC_TMI] = {
8632 		.type = HDA_FIXUP_PINS,
8633 		.v.pins = (const struct hda_pintbl[]) {
8634 			{ 0x12, 0x4000c000 },
8635 			{ 0x14, 0x90170110 }, /* speaker */
8636 			{ 0x15, 0x0421401f }, /* HP out */
8637 			{ 0x17, 0x411111f0 },
8638 			{ 0x18, 0x04a19020 }, /* mic */
8639 			{ 0x19, 0x411111f0 },
8640 			{ 0x1a, 0x411111f0 },
8641 			{ 0x1b, 0x411111f0 },
8642 			{ 0x1d, 0x40448505 },
8643 			{ 0x1e, 0x411111f0 },
8644 			{ 0x20, 0x8000ffff },
8645 			{ }
8646 		},
8647 		.chain_id = ALC269_FIXUP_DMIC,
8648 	},
8649 	[ALC269_FIXUP_CZC_L101] = {
8650 		.type = HDA_FIXUP_PINS,
8651 		.v.pins = (const struct hda_pintbl[]) {
8652 			{ 0x12, 0x40000000 },
8653 			{ 0x14, 0x01014010 }, /* speaker */
8654 			{ 0x15, 0x411111f0 }, /* HP out */
8655 			{ 0x16, 0x411111f0 },
8656 			{ 0x18, 0x01a19020 }, /* mic */
8657 			{ 0x19, 0x02a19021 },
8658 			{ 0x1a, 0x0181302f },
8659 			{ 0x1b, 0x0221401f },
8660 			{ 0x1c, 0x411111f0 },
8661 			{ 0x1d, 0x4044c601 },
8662 			{ 0x1e, 0x411111f0 },
8663 			{ }
8664 		},
8665 		.chain_id = ALC269_FIXUP_DMIC,
8666 	},
8667 	[ALC269_FIXUP_LEMOTE_A1802] = {
8668 		.type = HDA_FIXUP_PINS,
8669 		.v.pins = (const struct hda_pintbl[]) {
8670 			{ 0x12, 0x40000000 },
8671 			{ 0x14, 0x90170110 }, /* speaker */
8672 			{ 0x17, 0x411111f0 },
8673 			{ 0x18, 0x03a19040 }, /* mic1 */
8674 			{ 0x19, 0x90a70130 }, /* mic2 */
8675 			{ 0x1a, 0x411111f0 },
8676 			{ 0x1b, 0x411111f0 },
8677 			{ 0x1d, 0x40489d2d },
8678 			{ 0x1e, 0x411111f0 },
8679 			{ 0x20, 0x0003ffff },
8680 			{ 0x21, 0x03214020 },
8681 			{ }
8682 		},
8683 		.chain_id = ALC269_FIXUP_DMIC,
8684 	},
8685 	[ALC269_FIXUP_LEMOTE_A190X] = {
8686 		.type = HDA_FIXUP_PINS,
8687 		.v.pins = (const struct hda_pintbl[]) {
8688 			{ 0x14, 0x99130110 }, /* speaker */
8689 			{ 0x15, 0x0121401f }, /* HP out */
8690 			{ 0x18, 0x01a19c20 }, /* rear  mic */
8691 			{ 0x19, 0x99a3092f }, /* front mic */
8692 			{ 0x1b, 0x0201401f }, /* front lineout */
8693 			{ }
8694 		},
8695 		.chain_id = ALC269_FIXUP_DMIC,
8696 	},
8697 	[ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8698 		.type = HDA_FIXUP_PINS,
8699 		.v.pins = (const struct hda_pintbl[]) {
8700 			{ 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8701 			{ }
8702 		},
8703 		.chained = true,
8704 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8705 	},
8706 	[ALC256_FIXUP_INTEL_NUC10] = {
8707 		.type = HDA_FIXUP_PINS,
8708 		.v.pins = (const struct hda_pintbl[]) {
8709 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8710 			{ }
8711 		},
8712 		.chained = true,
8713 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8714 	},
8715 	[ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8716 		.type = HDA_FIXUP_VERBS,
8717 		.v.verbs = (const struct hda_verb[]) {
8718 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8719 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8720 			{ }
8721 		},
8722 		.chained = true,
8723 		.chain_id = ALC289_FIXUP_ASUS_GA502
8724 	},
8725 	[ALC274_FIXUP_HP_MIC] = {
8726 		.type = HDA_FIXUP_VERBS,
8727 		.v.verbs = (const struct hda_verb[]) {
8728 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8729 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8730 			{ }
8731 		},
8732 	},
8733 	[ALC274_FIXUP_HP_HEADSET_MIC] = {
8734 		.type = HDA_FIXUP_FUNC,
8735 		.v.func = alc274_fixup_hp_headset_mic,
8736 		.chained = true,
8737 		.chain_id = ALC274_FIXUP_HP_MIC
8738 	},
8739 	[ALC274_FIXUP_HP_ENVY_GPIO] = {
8740 		.type = HDA_FIXUP_FUNC,
8741 		.v.func = alc274_fixup_hp_envy_gpio,
8742 	},
8743 	[ALC256_FIXUP_ASUS_HPE] = {
8744 		.type = HDA_FIXUP_VERBS,
8745 		.v.verbs = (const struct hda_verb[]) {
8746 			/* Set EAPD high */
8747 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8748 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8749 			{ }
8750 		},
8751 		.chained = true,
8752 		.chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8753 	},
8754 	[ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8755 		.type = HDA_FIXUP_FUNC,
8756 		.v.func = alc_fixup_headset_jack,
8757 		.chained = true,
8758 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI
8759 	},
8760 	[ALC287_FIXUP_HP_GPIO_LED] = {
8761 		.type = HDA_FIXUP_FUNC,
8762 		.v.func = alc287_fixup_hp_gpio_led,
8763 	},
8764 	[ALC256_FIXUP_HP_HEADSET_MIC] = {
8765 		.type = HDA_FIXUP_FUNC,
8766 		.v.func = alc274_fixup_hp_headset_mic,
8767 	},
8768 	[ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8769 		.type = HDA_FIXUP_FUNC,
8770 		.v.func = alc_fixup_no_int_mic,
8771 		.chained = true,
8772 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8773 	},
8774 	[ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8775 		.type = HDA_FIXUP_PINS,
8776 		.v.pins = (const struct hda_pintbl[]) {
8777 			{ 0x1b, 0x411111f0 },
8778 			{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8779 			{ },
8780 		},
8781 		.chained = true,
8782 		.chain_id = ALC269_FIXUP_HEADSET_MODE
8783 	},
8784 	[ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8785 		.type = HDA_FIXUP_FUNC,
8786 		.v.func = alc269_fixup_limit_int_mic_boost,
8787 		.chained = true,
8788 		.chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8789 	},
8790 	[ALC256_FIXUP_ACER_HEADSET_MIC] = {
8791 		.type = HDA_FIXUP_PINS,
8792 		.v.pins = (const struct hda_pintbl[]) {
8793 			{ 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8794 			{ 0x1a, 0x90a1092f }, /* use as internal mic */
8795 			{ }
8796 		},
8797 		.chained = true,
8798 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8799 	},
8800 	[ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8801 		.type = HDA_FIXUP_FUNC,
8802 		.v.func = alc285_fixup_ideapad_s740_coef,
8803 		.chained = true,
8804 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8805 	},
8806 	[ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8807 		.type = HDA_FIXUP_FUNC,
8808 		.v.func = alc269_fixup_limit_int_mic_boost,
8809 		.chained = true,
8810 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
8811 	},
8812 	[ALC295_FIXUP_ASUS_DACS] = {
8813 		.type = HDA_FIXUP_FUNC,
8814 		.v.func = alc295_fixup_asus_dacs,
8815 	},
8816 	[ALC295_FIXUP_HP_OMEN] = {
8817 		.type = HDA_FIXUP_PINS,
8818 		.v.pins = (const struct hda_pintbl[]) {
8819 			{ 0x12, 0xb7a60130 },
8820 			{ 0x13, 0x40000000 },
8821 			{ 0x14, 0x411111f0 },
8822 			{ 0x16, 0x411111f0 },
8823 			{ 0x17, 0x90170110 },
8824 			{ 0x18, 0x411111f0 },
8825 			{ 0x19, 0x02a11030 },
8826 			{ 0x1a, 0x411111f0 },
8827 			{ 0x1b, 0x04a19030 },
8828 			{ 0x1d, 0x40600001 },
8829 			{ 0x1e, 0x411111f0 },
8830 			{ 0x21, 0x03211020 },
8831 			{}
8832 		},
8833 		.chained = true,
8834 		.chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8835 	},
8836 	[ALC285_FIXUP_HP_SPECTRE_X360] = {
8837 		.type = HDA_FIXUP_FUNC,
8838 		.v.func = alc285_fixup_hp_spectre_x360,
8839 	},
8840 	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8841 		.type = HDA_FIXUP_FUNC,
8842 		.v.func = alc285_fixup_hp_spectre_x360_eb1
8843 	},
8844 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8845 		.type = HDA_FIXUP_FUNC,
8846 		.v.func = alc285_fixup_ideapad_s740_coef,
8847 		.chained = true,
8848 		.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8849 	},
8850 	[ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8851 		.type = HDA_FIXUP_FUNC,
8852 		.v.func = alc_fixup_no_shutup,
8853 		.chained = true,
8854 		.chain_id = ALC283_FIXUP_HEADSET_MIC,
8855 	},
8856 	[ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8857 		.type = HDA_FIXUP_PINS,
8858 		.v.pins = (const struct hda_pintbl[]) {
8859 			{ 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8860 			{ }
8861 		},
8862 		.chained = true,
8863 		.chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8864 	},
8865 	[ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8866 		.type = HDA_FIXUP_FUNC,
8867 		.v.func = alc269_fixup_limit_int_mic_boost,
8868 		.chained = true,
8869 		.chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8870 	},
8871 	[ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8872 		.type = HDA_FIXUP_FUNC,
8873 		.v.func = alc285_fixup_ideapad_s740_coef,
8874 		.chained = true,
8875 		.chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8876 	},
8877 	[ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8878 		.type = HDA_FIXUP_FUNC,
8879 		.v.func = alc287_fixup_legion_15imhg05_speakers,
8880 		.chained = true,
8881 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8882 	},
8883 	[ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8884 		.type = HDA_FIXUP_VERBS,
8885 		//.v.verbs = legion_15imhg05_coefs,
8886 		.v.verbs = (const struct hda_verb[]) {
8887 			 // set left speaker Legion 7i.
8888 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8889 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8890 
8891 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8892 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8893 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8894 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8895 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8896 
8897 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8898 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8899 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8900 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8901 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8902 
8903 			 // set right speaker Legion 7i.
8904 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8905 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8906 
8907 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8908 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8909 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8910 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8911 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8912 
8913 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8914 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8915 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8916 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8917 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8918 			 {}
8919 		},
8920 		.chained = true,
8921 		.chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8922 	},
8923 	[ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8924 		.type = HDA_FIXUP_FUNC,
8925 		.v.func = alc287_fixup_legion_15imhg05_speakers,
8926 		.chained = true,
8927 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8928 	},
8929 	[ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8930 		.type = HDA_FIXUP_VERBS,
8931 		.v.verbs = (const struct hda_verb[]) {
8932 			 // set left speaker Yoga 7i.
8933 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8934 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8935 
8936 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8937 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8938 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8939 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8940 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8941 
8942 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8943 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8944 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8945 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8946 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8947 
8948 			 // set right speaker Yoga 7i.
8949 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8950 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8951 
8952 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8953 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8954 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8955 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8956 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8957 
8958 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8959 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8960 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8961 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8962 			 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8963 			 {}
8964 		},
8965 		.chained = true,
8966 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8967 	},
8968 	[ALC298_FIXUP_LENOVO_C940_DUET7] = {
8969 		.type = HDA_FIXUP_FUNC,
8970 		.v.func = alc298_fixup_lenovo_c940_duet7,
8971 	},
8972 	[ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8973 		.type = HDA_FIXUP_VERBS,
8974 		.v.verbs = (const struct hda_verb[]) {
8975 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8976 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8977 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8978 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8979 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8980 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8981 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8982 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8983 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8984 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8985 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8986 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8987 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8988 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8989 			{}
8990 		},
8991 		.chained = true,
8992 		.chain_id = ALC269_FIXUP_HEADSET_MODE,
8993 	},
8994 	[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
8995 		.type = HDA_FIXUP_FUNC,
8996 		.v.func = alc256_fixup_set_coef_defaults,
8997 	},
8998 	[ALC245_FIXUP_HP_GPIO_LED] = {
8999 		.type = HDA_FIXUP_FUNC,
9000 		.v.func = alc245_fixup_hp_gpio_led,
9001 	},
9002 	[ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
9003 		.type = HDA_FIXUP_PINS,
9004 		.v.pins = (const struct hda_pintbl[]) {
9005 			{ 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
9006 			{ }
9007 		},
9008 		.chained = true,
9009 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
9010 	},
9011 	[ALC233_FIXUP_NO_AUDIO_JACK] = {
9012 		.type = HDA_FIXUP_FUNC,
9013 		.v.func = alc233_fixup_no_audio_jack,
9014 	},
9015 	[ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
9016 		.type = HDA_FIXUP_FUNC,
9017 		.v.func = alc256_fixup_mic_no_presence_and_resume,
9018 		.chained = true,
9019 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9020 	},
9021 	[ALC287_FIXUP_LEGION_16ACHG6] = {
9022 		.type = HDA_FIXUP_FUNC,
9023 		.v.func = alc287_fixup_legion_16achg6_speakers,
9024 	},
9025 	[ALC287_FIXUP_CS35L41_I2C_2] = {
9026 		.type = HDA_FIXUP_FUNC,
9027 		.v.func = cs35l41_fixup_i2c_two,
9028 		.chained = true,
9029 		.chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9030 	},
9031 	[ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = {
9032 		.type = HDA_FIXUP_FUNC,
9033 		.v.func = cs35l41_fixup_i2c_two,
9034 		.chained = true,
9035 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9036 	},
9037 	[ALC245_FIXUP_CS35L41_SPI_2] = {
9038 		.type = HDA_FIXUP_FUNC,
9039 		.v.func = cs35l41_fixup_spi_two,
9040 	},
9041 	[ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED] = {
9042 		.type = HDA_FIXUP_FUNC,
9043 		.v.func = cs35l41_fixup_spi_two,
9044 		.chained = true,
9045 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9046 	},
9047 	[ALC245_FIXUP_CS35L41_SPI_4] = {
9048 		.type = HDA_FIXUP_FUNC,
9049 		.v.func = cs35l41_fixup_spi_four,
9050 	},
9051 	[ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED] = {
9052 		.type = HDA_FIXUP_FUNC,
9053 		.v.func = cs35l41_fixup_spi_four,
9054 		.chained = true,
9055 		.chain_id = ALC285_FIXUP_HP_GPIO_LED,
9056 	},
9057 	[ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
9058 		.type = HDA_FIXUP_VERBS,
9059 		.v.verbs = (const struct hda_verb[]) {
9060 			 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
9061 			 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
9062 			 { }
9063 		},
9064 		.chained = true,
9065 		.chain_id = ALC285_FIXUP_HP_MUTE_LED,
9066 	},
9067 	[ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = {
9068 		.type = HDA_FIXUP_FUNC,
9069 		.v.func = alc_fixup_dell4_mic_no_presence_quiet,
9070 		.chained = true,
9071 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9072 	},
9073 	[ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
9074 		.type = HDA_FIXUP_PINS,
9075 		.v.pins = (const struct hda_pintbl[]) {
9076 			{ 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */
9077 			{ }
9078 		},
9079 		.chained = true,
9080 		.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
9081 	},
9082 	[ALC287_FIXUP_LEGION_16ITHG6] = {
9083 		.type = HDA_FIXUP_FUNC,
9084 		.v.func = alc287_fixup_legion_16ithg6_speakers,
9085 	},
9086 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK] = {
9087 		.type = HDA_FIXUP_VERBS,
9088 		.v.verbs = (const struct hda_verb[]) {
9089 			// enable left speaker
9090 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9091 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
9092 
9093 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9094 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9095 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9096 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
9097 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9098 
9099 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9100 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9101 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9102 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
9103 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9104 
9105 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9106 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9107 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9108 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x40 },
9109 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9110 
9111 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9112 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9113 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9114 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9115 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9116 
9117 			// enable right speaker
9118 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
9119 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9120 
9121 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9122 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xc },
9123 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9124 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
9125 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9126 
9127 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9128 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xf },
9129 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9130 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
9131 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9132 
9133 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9134 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x10 },
9135 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9136 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x44 },
9137 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9138 
9139 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
9140 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
9141 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9142 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
9143 			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
9144 
9145 			{ },
9146 		},
9147 	},
9148 	[ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN] = {
9149 		.type = HDA_FIXUP_FUNC,
9150 		.v.func = alc287_fixup_yoga9_14iap7_bass_spk_pin,
9151 		.chained = true,
9152 		.chain_id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
9153 	},
9154 	[ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS] = {
9155 		.type = HDA_FIXUP_FUNC,
9156 		.v.func = alc295_fixup_dell_inspiron_top_speakers,
9157 		.chained = true,
9158 		.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9159 	},
9160 	[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9161 		.type = HDA_FIXUP_PINS,
9162 		.v.func = alc1220_fixup_gb_dual_codecs,
9163 		.chained = true,
9164 		.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9165 	},
9166 };
9167 
9168 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9169 	SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
9170 	SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
9171 	SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
9172 	SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
9173 	SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9174 	SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
9175 	SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
9176 	SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9177 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
9178 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
9179 	SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
9180 	SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
9181 	SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
9182 	SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
9183 	SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
9184 	SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
9185 	SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
9186 	SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9187 	SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9188 	SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
9189 	SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
9190 	SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
9191 	SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
9192 	SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
9193 	SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9194 	SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9195 	SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9196 	SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9197 	SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
9198 	SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9199 	SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9200 	SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
9201 	SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
9202 	SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
9203 	SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9204 	SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9205 	SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
9206 	SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
9207 	SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
9208 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
9209 	SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
9210 	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
9211 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
9212 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
9213 	SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
9214 	SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
9215 	SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
9216 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9217 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9218 	SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
9219 	SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9220 	SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
9221 	SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
9222 	SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
9223 	SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
9224 	SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9225 	SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9226 	SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
9227 	SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9228 	SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
9229 	SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
9230 	SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9231 	SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9232 	SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9233 	SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9234 	SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9235 	SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9236 	SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
9237 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9238 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
9239 	SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
9240 	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
9241 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
9242 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
9243 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
9244 	SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
9245 	SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9246 	SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9247 	SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9248 	SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
9249 	SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9250 	SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
9251 	SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
9252 	SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
9253 	SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9254 	SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
9255 	SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9256 	SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
9257 	SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9258 	SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
9259 	SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
9260 	SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
9261 	SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
9262 	SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
9263 	SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9264 	SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9265 	SND_PCI_QUIRK(0x1028, 0x0ac9, "Dell Precision 3260", ALC283_FIXUP_CHROME_BOOK),
9266 	SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9267 	SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
9268 	SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9269 	SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9270 	SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9271 	SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9272 	SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9273 	SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9274 	SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9275 	SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9276 	SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9277 	SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9278 	SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
9279 	SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
9280 	SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
9281 	SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
9282 	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9283 	SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9284 	SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9285 	SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9286 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
9287 	SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9288 	SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9289 	SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9290 	SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9291 	SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9292 	SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9293 	SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
9294 	SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9295 	SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9296 	SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9297 	SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9298 	SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9299 	SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9300 	SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
9301 	SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
9302 	SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9303 	SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9304 	SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9305 	SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9306 	SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9307 	SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9308 	SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9309 	SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9310 	SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
9311 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9312 	SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9313 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9314 	SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
9315 	SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9316 	SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9317 	SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9318 	SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9319 	SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9320 	SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9321 	SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9322 	SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9323 	SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9324 	SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9325 	SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9326 	SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9327 	SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9328 	SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9329 	SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
9330 	SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9331 	SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
9332 	SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9333 	SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9334 	SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9335 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
9336 	SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
9337 	SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9338 	SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9339 	SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9340 	SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
9341 	SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9342 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
9343 	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
9344 	SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9345 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9346 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
9347 	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9348 	SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9349 	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9350 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
9351 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
9352 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
9353 	SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9354 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9355 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9356 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
9357 	SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9358 	SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9359 	SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
9360 	SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9361 	SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9362 	SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
9363 	SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
9364 	SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
9365 	SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9366 	SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9367 	SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9368 	SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
9369 	SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
9370 	SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
9371 	SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
9372 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9373 	SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
9374 		      ALC285_FIXUP_HP_GPIO_AMP_INIT),
9375 	SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9376 	SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9377 	SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9378 	SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
9379 	SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9380 	SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9381 	SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9382 	SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9383 	SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
9384 	SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
9385 	SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9386 	SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9387 	SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
9388 	SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9389 	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9390 	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9391 	SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9392 	SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9393 	SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9394 	SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
9395 	SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9396 	SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9397 	SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9398 	SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9399 	SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
9400 	SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
9401 	SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
9402 	SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
9403 	SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9404 	SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9405 	SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
9406 	SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9407 	SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9408 	SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9409 	SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9410 	SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9411 	SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9412 	SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9413 	SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4),
9414 	SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9415 	SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2),
9416 	SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9417 	SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2),
9418 	SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
9419 	SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2),
9420 	SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED),
9421 	SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED),
9422 	SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
9423 	SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED),
9424 	SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED),
9425 	SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9426 	SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
9427 	SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9428 	SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9429 	SND_PCI_QUIRK(0x103c, 0x89d3, "HP EliteBook 645 G9 (MB 89D2)", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9430 	SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
9431 	SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
9432 	SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
9433 	SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
9434 	SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
9435 	 SND_PCI_QUIRK(0x103c, 0x8abb, "HP ZBook Firefly 14 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9436 	SND_PCI_QUIRK(0x103c, 0x8ad1, "HP EliteBook 840 14 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9437 	SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9438 	SND_PCI_QUIRK(0x103c, 0x8b42, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9439 	SND_PCI_QUIRK(0x103c, 0x8b43, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9440 	SND_PCI_QUIRK(0x103c, 0x8b44, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9441 	SND_PCI_QUIRK(0x103c, 0x8b45, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9442 	SND_PCI_QUIRK(0x103c, 0x8b46, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9443 	SND_PCI_QUIRK(0x103c, 0x8b47, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9444 	SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9445 	SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9446 	SND_PCI_QUIRK(0x103c, 0x8b7a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9447 	SND_PCI_QUIRK(0x103c, 0x8b7d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9448 	SND_PCI_QUIRK(0x103c, 0x8b87, "HP", ALC236_FIXUP_HP_GPIO_LED),
9449 	SND_PCI_QUIRK(0x103c, 0x8b8a, "HP", ALC236_FIXUP_HP_GPIO_LED),
9450 	SND_PCI_QUIRK(0x103c, 0x8b8b, "HP", ALC236_FIXUP_HP_GPIO_LED),
9451 	SND_PCI_QUIRK(0x103c, 0x8b8d, "HP", ALC236_FIXUP_HP_GPIO_LED),
9452 	SND_PCI_QUIRK(0x103c, 0x8b8f, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9453 	SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
9454 	SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
9455 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
9456 	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
9457 	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9458 	SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
9459 	SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
9460 	SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9461 	SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9462 	SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9463 	SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9464 	SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9465 	SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9466 	SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
9467 	SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
9468 	SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
9469 	SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
9470 	SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
9471 	SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
9472 	SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
9473 	SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
9474 	SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
9475 	SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
9476 	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
9477 	SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
9478 	SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
9479 	SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
9480 	SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
9481 	SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
9482 	SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
9483 	SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
9484 	SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
9485 	SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
9486 	SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
9487 	SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
9488 	SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
9489 	SND_PCI_QUIRK(0x1043, 0x1a8f, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
9490 	SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
9491 	SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
9492 	SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
9493 	SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9494 	SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
9495 	SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
9496 	SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
9497 	SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
9498 	SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2),
9499 	SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
9500 	SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
9501 	SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
9502 	SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
9503 	SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
9504 	SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
9505 	SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
9506 	SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
9507 	SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
9508 	SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
9509 	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
9510 	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
9511 	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9512 	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9513 	SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
9514 	SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
9515 	SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9516 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9517 	SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
9518 	SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9519 	SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9520 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
9521 	SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
9522 	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
9523 	SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
9524 	SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
9525 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
9526 	SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
9527 	SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
9528 	SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9529 	SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9530 	SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9531 	SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9532 	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
9533 	SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
9534 	SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9535 	SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
9536 	SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP),
9537 	SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9538 	SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP),
9539 	SND_PCI_QUIRK(0x144d, 0xc1a6, "Samsung Galaxy Book Pro 360 (NP930QBD)", ALC298_FIXUP_SAMSUNG_AMP),
9540 	SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
9541 	SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
9542 	SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP),
9543 	SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
9544 	SND_PCI_QUIRK(0x144d, 0xca03, "Samsung Galaxy Book2 Pro 360 (NP930QED)", ALC298_FIXUP_SAMSUNG_AMP),
9545 	SND_PCI_QUIRK(0x144d, 0xc868, "Samsung Galaxy Book2 Pro (NP930XED)", ALC298_FIXUP_SAMSUNG_AMP),
9546 	SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9547 	SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
9548 	SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
9549 	SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
9550 	SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9551 	SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9552 	SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9553 	SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9554 	SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9555 	SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9556 	SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9557 	SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9558 	SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9559 	SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9560 	SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9561 	SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9562 	SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9563 	SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9564 	SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9565 	SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9566 	SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9567 	SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9568 	SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9569 	SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9570 	SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9571 	SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9572 	SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9573 	SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9574 	SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9575 	SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9576 	SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9577 	SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9578 	SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9579 	SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9580 	SND_PCI_QUIRK(0x1558, 0x5630, "Clevo NP50RNJS", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9581 	SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9582 	SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9583 	SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9584 	SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9585 	SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9586 	SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9587 	SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9588 	SND_PCI_QUIRK(0x1558, 0x7717, "Clevo NS70PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9589 	SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9590 	SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9591 	SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9592 	SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9593 	SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9594 	SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9595 	SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9596 	SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9597 	SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9598 	SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9599 	SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
9600 	SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9601 	SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9602 	SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9603 	SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9604 	SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9605 	SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
9606 	SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9607 	SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9608 	SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9609 	SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9610 	SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9611 	SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9612 	SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9613 	SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9614 	SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9615 	SND_PCI_QUIRK(0x1558, 0xa671, "Clevo NP70SN[CDE]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9616 	SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9617 	SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9618 	SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9619 	SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9620 	SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9621 	SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9622 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
9623 	SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9624 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9625 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9626 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9627 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9628 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
9629 	SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
9630 	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
9631 	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
9632 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
9633 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
9634 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
9635 	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
9636 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
9637 	SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
9638 	SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
9639 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
9640 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
9641 	SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9642 	SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
9643 	SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
9644 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
9645 	SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9646 	SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9647 	SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
9648 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
9649 	SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9650 	SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9651 	SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9652 	SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
9653 	SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9654 	SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9655 	SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9656 	SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9657 	SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
9658 	SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
9659 	SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9660 	SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9661 	SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9662 	SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9663 	SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9664 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
9665 	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
9666 	SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9667 	SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9668 	SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9669 	SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9670 	SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
9671 	SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9672 	SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9673 	SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9674 	SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
9675 	SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
9676 	SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9677 	SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9678 	SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
9679 	SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
9680 	SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9681 	SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9682 	SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
9683 	SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9684 	SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9685 	SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
9686 	SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
9687 	SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9688 	SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9689 	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9690 	SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
9691 	SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
9692 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9693 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
9694 	SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9695 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
9696 	SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9697 	SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
9698 	SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
9699 	SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9700 	SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
9701 	SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
9702 	SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
9703 	SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
9704 	SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
9705 	SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
9706 	SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
9707 	SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
9708 	SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9709 	SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9710 	SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9711 	SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9712 	SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9713 	SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9714 	SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9715 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
9716 	SND_PCI_QUIRK(0x17aa, 0x9e56, "Lenovo ZhaoYang CF4620Z", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9717 	SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
9718 	SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
9719 	SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
9720 	SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9721 	SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9722 	SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9723 	SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
9724 	SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
9725 	SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9726 	SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
9727 	SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
9728 	SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
9729 	SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
9730 	SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
9731 	SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9732 	SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9733 	SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
9734 	SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9735 	SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
9736 	SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
9737 	SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9738 	SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
9739 	SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
9740 	SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
9741 	SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
9742 	SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
9743 	SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
9744 	SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
9745 	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
9746 
9747 #if 0
9748 	/* Below is a quirk table taken from the old code.
9749 	 * Basically the device should work as is without the fixup table.
9750 	 * If BIOS doesn't give a proper info, enable the corresponding
9751 	 * fixup entry.
9752 	 */
9753 	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9754 		      ALC269_FIXUP_AMIC),
9755 	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
9756 	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9757 	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9758 	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9759 	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9760 	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9761 	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9762 	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9763 	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9764 	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9765 	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9766 	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9767 	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9768 	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9769 	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9770 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9771 	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9772 	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9773 	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9774 	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9775 	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9776 	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9777 	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9778 	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9779 	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9780 	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9781 	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9782 	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9783 	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9784 	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9785 	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9786 	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9787 	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9788 	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9789 	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9790 	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9791 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9792 	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9793 	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9794 #endif
9795 	{}
9796 };
9797 
9798 static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9799 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9800 	SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9801 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9802 	SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
9803 	SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
9804 	{}
9805 };
9806 
9807 static const struct hda_model_fixup alc269_fixup_models[] = {
9808 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9809 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
9810 	{.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9811 	{.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9812 	{.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
9813 	{.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
9814 	{.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9815 	{.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
9816 	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9817 	{.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9818 	{.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9819 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
9820 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9821 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
9822 	{.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9823 	{.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
9824 	{.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
9825 	{.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
9826 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9827 	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
9828 	{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
9829 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
9830 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
9831 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
9832 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
9833 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9834 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9835 	{.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9836 	{.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9837 	{.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9838 	{.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9839 	{.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9840 	{.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9841 	{.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9842 	{.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9843 	{.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9844 	{.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9845 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9846 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9847 	{.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9848 	{.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9849 	{.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9850 	{.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9851 	{.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9852 	{.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9853 	{.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9854 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9855 	{.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9856 	{.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9857 	{.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9858 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9859 	{.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9860 	{.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9861 	{.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9862 	{.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9863 	{.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9864 	{.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9865 	{.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9866 	{.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9867 	{.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9868 	{.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9869 	{.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9870 	{.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9871 	{.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9872 	{.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
9873 	{.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
9874 	{.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
9875 	{.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
9876 	{.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9877 	{.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9878 	{.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9879 	{.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9880 	{.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9881 	{.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9882 	{.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9883 	{.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9884 	{.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9885 	{.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9886 	{.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9887 	{.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9888 	{.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9889 	{.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
9890 	{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9891 	{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9892 	{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
9893 	{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
9894 	{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
9895 	{.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
9896 	{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9897 	{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9898 	{.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9899 	{.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9900 	{.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9901 	{.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9902 	{.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9903 	{.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9904 	{.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9905 	{.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9906 	{.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9907 	{.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9908 	{.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9909 	{.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9910 	{.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9911 	{.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9912 	{.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
9913 	{.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9914 	{.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
9915 	{.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
9916 	{.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
9917 	{.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
9918 	{.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
9919 	{.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
9920 	{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
9921 	{.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
9922 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
9923 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
9924 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
9925 	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9926 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
9927 	{.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
9928 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
9929 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
9930 	{.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
9931 	{}
9932 };
9933 #define ALC225_STANDARD_PINS \
9934 	{0x21, 0x04211020}
9935 
9936 #define ALC256_STANDARD_PINS \
9937 	{0x12, 0x90a60140}, \
9938 	{0x14, 0x90170110}, \
9939 	{0x21, 0x02211020}
9940 
9941 #define ALC282_STANDARD_PINS \
9942 	{0x14, 0x90170110}
9943 
9944 #define ALC290_STANDARD_PINS \
9945 	{0x12, 0x99a30130}
9946 
9947 #define ALC292_STANDARD_PINS \
9948 	{0x14, 0x90170110}, \
9949 	{0x15, 0x0221401f}
9950 
9951 #define ALC295_STANDARD_PINS \
9952 	{0x12, 0xb7a60130}, \
9953 	{0x14, 0x90170110}, \
9954 	{0x21, 0x04211020}
9955 
9956 #define ALC298_STANDARD_PINS \
9957 	{0x12, 0x90a60130}, \
9958 	{0x21, 0x03211020}
9959 
9960 static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
9961 	SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9962 		{0x14, 0x01014020},
9963 		{0x17, 0x90170110},
9964 		{0x18, 0x02a11030},
9965 		{0x19, 0x0181303F},
9966 		{0x21, 0x0221102f}),
9967 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9968 		{0x12, 0x90a601c0},
9969 		{0x14, 0x90171120},
9970 		{0x21, 0x02211030}),
9971 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9972 		{0x14, 0x90170110},
9973 		{0x1b, 0x90a70130},
9974 		{0x21, 0x03211020}),
9975 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9976 		{0x1a, 0x90a70130},
9977 		{0x1b, 0x90170110},
9978 		{0x21, 0x03211020}),
9979 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9980 		ALC225_STANDARD_PINS,
9981 		{0x12, 0xb7a60130},
9982 		{0x14, 0x901701a0}),
9983 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9984 		ALC225_STANDARD_PINS,
9985 		{0x12, 0xb7a60130},
9986 		{0x14, 0x901701b0}),
9987 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9988 		ALC225_STANDARD_PINS,
9989 		{0x12, 0xb7a60150},
9990 		{0x14, 0x901701a0}),
9991 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9992 		ALC225_STANDARD_PINS,
9993 		{0x12, 0xb7a60150},
9994 		{0x14, 0x901701b0}),
9995 	SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9996 		ALC225_STANDARD_PINS,
9997 		{0x12, 0xb7a60130},
9998 		{0x1b, 0x90170110}),
9999 	SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10000 		{0x1b, 0x01111010},
10001 		{0x1e, 0x01451130},
10002 		{0x21, 0x02211020}),
10003 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
10004 		{0x12, 0x90a60140},
10005 		{0x14, 0x90170110},
10006 		{0x19, 0x02a11030},
10007 		{0x21, 0x02211020}),
10008 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10009 		{0x14, 0x90170110},
10010 		{0x19, 0x02a11030},
10011 		{0x1a, 0x02a11040},
10012 		{0x1b, 0x01014020},
10013 		{0x21, 0x0221101f}),
10014 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10015 		{0x14, 0x90170110},
10016 		{0x19, 0x02a11030},
10017 		{0x1a, 0x02a11040},
10018 		{0x1b, 0x01011020},
10019 		{0x21, 0x0221101f}),
10020 	SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
10021 		{0x14, 0x90170110},
10022 		{0x19, 0x02a11020},
10023 		{0x1a, 0x02a11030},
10024 		{0x21, 0x0221101f}),
10025 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
10026 		{0x21, 0x02211010}),
10027 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10028 		{0x14, 0x90170110},
10029 		{0x19, 0x02a11020},
10030 		{0x21, 0x02211030}),
10031 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
10032 		{0x14, 0x90170110},
10033 		{0x21, 0x02211020}),
10034 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10035 		{0x14, 0x90170130},
10036 		{0x21, 0x02211040}),
10037 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10038 		{0x12, 0x90a60140},
10039 		{0x14, 0x90170110},
10040 		{0x21, 0x02211020}),
10041 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10042 		{0x12, 0x90a60160},
10043 		{0x14, 0x90170120},
10044 		{0x21, 0x02211030}),
10045 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10046 		{0x14, 0x90170110},
10047 		{0x1b, 0x02011020},
10048 		{0x21, 0x0221101f}),
10049 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10050 		{0x14, 0x90170110},
10051 		{0x1b, 0x01011020},
10052 		{0x21, 0x0221101f}),
10053 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10054 		{0x14, 0x90170130},
10055 		{0x1b, 0x01014020},
10056 		{0x21, 0x0221103f}),
10057 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10058 		{0x14, 0x90170130},
10059 		{0x1b, 0x01011020},
10060 		{0x21, 0x0221103f}),
10061 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10062 		{0x14, 0x90170130},
10063 		{0x1b, 0x02011020},
10064 		{0x21, 0x0221103f}),
10065 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10066 		{0x14, 0x90170150},
10067 		{0x1b, 0x02011020},
10068 		{0x21, 0x0221105f}),
10069 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10070 		{0x14, 0x90170110},
10071 		{0x1b, 0x01014020},
10072 		{0x21, 0x0221101f}),
10073 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10074 		{0x12, 0x90a60160},
10075 		{0x14, 0x90170120},
10076 		{0x17, 0x90170140},
10077 		{0x21, 0x0321102f}),
10078 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10079 		{0x12, 0x90a60160},
10080 		{0x14, 0x90170130},
10081 		{0x21, 0x02211040}),
10082 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10083 		{0x12, 0x90a60160},
10084 		{0x14, 0x90170140},
10085 		{0x21, 0x02211050}),
10086 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10087 		{0x12, 0x90a60170},
10088 		{0x14, 0x90170120},
10089 		{0x21, 0x02211030}),
10090 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10091 		{0x12, 0x90a60170},
10092 		{0x14, 0x90170130},
10093 		{0x21, 0x02211040}),
10094 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10095 		{0x12, 0x90a60170},
10096 		{0x14, 0x90171130},
10097 		{0x21, 0x02211040}),
10098 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10099 		{0x12, 0x90a60170},
10100 		{0x14, 0x90170140},
10101 		{0x21, 0x02211050}),
10102 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10103 		{0x12, 0x90a60180},
10104 		{0x14, 0x90170130},
10105 		{0x21, 0x02211040}),
10106 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10107 		{0x12, 0x90a60180},
10108 		{0x14, 0x90170120},
10109 		{0x21, 0x02211030}),
10110 	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10111 		{0x1b, 0x01011020},
10112 		{0x21, 0x02211010}),
10113 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10114 		{0x14, 0x90170110},
10115 		{0x1b, 0x90a70130},
10116 		{0x21, 0x04211020}),
10117 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
10118 		{0x14, 0x90170110},
10119 		{0x1b, 0x90a70130},
10120 		{0x21, 0x03211020}),
10121 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10122 		{0x12, 0x90a60130},
10123 		{0x14, 0x90170110},
10124 		{0x21, 0x03211020}),
10125 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10126 		{0x12, 0x90a60130},
10127 		{0x14, 0x90170110},
10128 		{0x21, 0x04211020}),
10129 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
10130 		{0x1a, 0x90a70130},
10131 		{0x1b, 0x90170110},
10132 		{0x21, 0x03211020}),
10133        SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
10134 		{0x14, 0x90170110},
10135 		{0x19, 0x02a11020},
10136 		{0x21, 0x0221101f}),
10137        SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
10138 		{0x17, 0x90170110},
10139 		{0x19, 0x03a11030},
10140 		{0x21, 0x03211020}),
10141 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
10142 		{0x12, 0x90a60130},
10143 		{0x14, 0x90170110},
10144 		{0x15, 0x0421101f},
10145 		{0x1a, 0x04a11020}),
10146 	SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
10147 		{0x12, 0x90a60140},
10148 		{0x14, 0x90170110},
10149 		{0x15, 0x0421101f},
10150 		{0x18, 0x02811030},
10151 		{0x1a, 0x04a1103f},
10152 		{0x1b, 0x02011020}),
10153 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10154 		ALC282_STANDARD_PINS,
10155 		{0x12, 0x99a30130},
10156 		{0x19, 0x03a11020},
10157 		{0x21, 0x0321101f}),
10158 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10159 		ALC282_STANDARD_PINS,
10160 		{0x12, 0x99a30130},
10161 		{0x19, 0x03a11020},
10162 		{0x21, 0x03211040}),
10163 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10164 		ALC282_STANDARD_PINS,
10165 		{0x12, 0x99a30130},
10166 		{0x19, 0x03a11030},
10167 		{0x21, 0x03211020}),
10168 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10169 		ALC282_STANDARD_PINS,
10170 		{0x12, 0x99a30130},
10171 		{0x19, 0x04a11020},
10172 		{0x21, 0x0421101f}),
10173 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
10174 		ALC282_STANDARD_PINS,
10175 		{0x12, 0x90a60140},
10176 		{0x19, 0x04a11030},
10177 		{0x21, 0x04211020}),
10178 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10179 		ALC282_STANDARD_PINS,
10180 		{0x12, 0x90a609c0},
10181 		{0x18, 0x03a11830},
10182 		{0x19, 0x04a19831},
10183 		{0x1a, 0x0481303f},
10184 		{0x1b, 0x04211020},
10185 		{0x21, 0x0321101f}),
10186 	SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
10187 		ALC282_STANDARD_PINS,
10188 		{0x12, 0x90a60940},
10189 		{0x18, 0x03a11830},
10190 		{0x19, 0x04a19831},
10191 		{0x1a, 0x0481303f},
10192 		{0x1b, 0x04211020},
10193 		{0x21, 0x0321101f}),
10194 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10195 		ALC282_STANDARD_PINS,
10196 		{0x12, 0x90a60130},
10197 		{0x21, 0x0321101f}),
10198 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10199 		{0x12, 0x90a60160},
10200 		{0x14, 0x90170120},
10201 		{0x21, 0x02211030}),
10202 	SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10203 		ALC282_STANDARD_PINS,
10204 		{0x12, 0x90a60130},
10205 		{0x19, 0x03a11020},
10206 		{0x21, 0x0321101f}),
10207 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10208 		{0x12, 0x90a60130},
10209 		{0x14, 0x90170110},
10210 		{0x19, 0x04a11040},
10211 		{0x21, 0x04211020}),
10212 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
10213 		{0x14, 0x90170110},
10214 		{0x19, 0x04a11040},
10215 		{0x1d, 0x40600001},
10216 		{0x21, 0x04211020}),
10217 	SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
10218 		{0x14, 0x90170110},
10219 		{0x19, 0x04a11040},
10220 		{0x21, 0x04211020}),
10221 	SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
10222 		{0x14, 0x90170110},
10223 		{0x17, 0x90170111},
10224 		{0x19, 0x03a11030},
10225 		{0x21, 0x03211020}),
10226 	SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
10227 		{0x12, 0x90a60130},
10228 		{0x17, 0x90170110},
10229 		{0x21, 0x02211020}),
10230 	SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
10231 		{0x12, 0x90a60120},
10232 		{0x14, 0x90170110},
10233 		{0x21, 0x0321101f}),
10234 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10235 		ALC290_STANDARD_PINS,
10236 		{0x15, 0x04211040},
10237 		{0x18, 0x90170112},
10238 		{0x1a, 0x04a11020}),
10239 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10240 		ALC290_STANDARD_PINS,
10241 		{0x15, 0x04211040},
10242 		{0x18, 0x90170110},
10243 		{0x1a, 0x04a11020}),
10244 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10245 		ALC290_STANDARD_PINS,
10246 		{0x15, 0x0421101f},
10247 		{0x1a, 0x04a11020}),
10248 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10249 		ALC290_STANDARD_PINS,
10250 		{0x15, 0x04211020},
10251 		{0x1a, 0x04a11040}),
10252 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10253 		ALC290_STANDARD_PINS,
10254 		{0x14, 0x90170110},
10255 		{0x15, 0x04211020},
10256 		{0x1a, 0x04a11040}),
10257 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10258 		ALC290_STANDARD_PINS,
10259 		{0x14, 0x90170110},
10260 		{0x15, 0x04211020},
10261 		{0x1a, 0x04a11020}),
10262 	SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
10263 		ALC290_STANDARD_PINS,
10264 		{0x14, 0x90170110},
10265 		{0x15, 0x0421101f},
10266 		{0x1a, 0x04a11020}),
10267 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10268 		ALC292_STANDARD_PINS,
10269 		{0x12, 0x90a60140},
10270 		{0x16, 0x01014020},
10271 		{0x19, 0x01a19030}),
10272 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
10273 		ALC292_STANDARD_PINS,
10274 		{0x12, 0x90a60140},
10275 		{0x16, 0x01014020},
10276 		{0x18, 0x02a19031},
10277 		{0x19, 0x01a1903e}),
10278 	SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
10279 		ALC292_STANDARD_PINS,
10280 		{0x12, 0x90a60140}),
10281 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10282 		ALC292_STANDARD_PINS,
10283 		{0x13, 0x90a60140},
10284 		{0x16, 0x21014020},
10285 		{0x19, 0x21a19030}),
10286 	SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
10287 		ALC292_STANDARD_PINS,
10288 		{0x13, 0x90a60140}),
10289 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
10290 		{0x17, 0x90170110},
10291 		{0x21, 0x04211020}),
10292 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
10293 		{0x14, 0x90170110},
10294 		{0x1b, 0x90a70130},
10295 		{0x21, 0x04211020}),
10296 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10297 		{0x12, 0x90a60130},
10298 		{0x17, 0x90170110},
10299 		{0x21, 0x03211020}),
10300 	SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10301 		{0x12, 0x90a60130},
10302 		{0x17, 0x90170110},
10303 		{0x21, 0x04211020}),
10304 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
10305 		{0x12, 0x90a60130},
10306 		{0x17, 0x90170110},
10307 		{0x21, 0x03211020}),
10308 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10309 		{0x12, 0x90a60120},
10310 		{0x17, 0x90170110},
10311 		{0x21, 0x04211030}),
10312 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10313 		{0x12, 0x90a60130},
10314 		{0x17, 0x90170110},
10315 		{0x21, 0x03211020}),
10316 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
10317 		{0x12, 0x90a60130},
10318 		{0x17, 0x90170110},
10319 		{0x21, 0x03211020}),
10320 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10321 		{0x14, 0x90170110},
10322 		{0x21, 0x04211020}),
10323 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10324 		{0x14, 0x90170110},
10325 		{0x21, 0x04211030}),
10326 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10327 		ALC295_STANDARD_PINS,
10328 		{0x17, 0x21014020},
10329 		{0x18, 0x21a19030}),
10330 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10331 		ALC295_STANDARD_PINS,
10332 		{0x17, 0x21014040},
10333 		{0x18, 0x21a19050}),
10334 	SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
10335 		ALC295_STANDARD_PINS),
10336 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10337 		ALC298_STANDARD_PINS,
10338 		{0x17, 0x90170110}),
10339 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10340 		ALC298_STANDARD_PINS,
10341 		{0x17, 0x90170140}),
10342 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
10343 		ALC298_STANDARD_PINS,
10344 		{0x17, 0x90170150}),
10345 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
10346 		{0x12, 0xb7a60140},
10347 		{0x13, 0xb7a60150},
10348 		{0x17, 0x90170110},
10349 		{0x1a, 0x03011020},
10350 		{0x21, 0x03211030}),
10351 	SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
10352 		{0x12, 0xb7a60140},
10353 		{0x17, 0x90170110},
10354 		{0x1a, 0x03a11030},
10355 		{0x21, 0x03211020}),
10356 	SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10357 		ALC225_STANDARD_PINS,
10358 		{0x12, 0xb7a60130},
10359 		{0x17, 0x90170110}),
10360 	SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
10361 		{0x14, 0x01014010},
10362 		{0x17, 0x90170120},
10363 		{0x18, 0x02a11030},
10364 		{0x19, 0x02a1103f},
10365 		{0x21, 0x0221101f}),
10366 	{}
10367 };
10368 
10369 /* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
10370  * more machines, don't need to match all valid pins, just need to match
10371  * all the pins defined in the tbl. Just because of this reason, it is possible
10372  * that a single machine matches multiple tbls, so there is one limitation:
10373  *   at most one tbl is allowed to define for the same vendor and same codec
10374  */
10375 static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
10376 	SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
10377 		{0x19, 0x40000000},
10378 		{0x1b, 0x40000000}),
10379 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10380 		{0x19, 0x40000000},
10381 		{0x1a, 0x40000000}),
10382 	SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
10383 		{0x19, 0x40000000},
10384 		{0x1a, 0x40000000}),
10385 	SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
10386 		{0x19, 0x40000000},
10387 		{0x1a, 0x40000000}),
10388 	{}
10389 };
10390 
10391 static void alc269_fill_coef(struct hda_codec *codec)
10392 {
10393 	struct alc_spec *spec = codec->spec;
10394 	int val;
10395 
10396 	if (spec->codec_variant != ALC269_TYPE_ALC269VB)
10397 		return;
10398 
10399 	if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
10400 		alc_write_coef_idx(codec, 0xf, 0x960b);
10401 		alc_write_coef_idx(codec, 0xe, 0x8817);
10402 	}
10403 
10404 	if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
10405 		alc_write_coef_idx(codec, 0xf, 0x960b);
10406 		alc_write_coef_idx(codec, 0xe, 0x8814);
10407 	}
10408 
10409 	if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
10410 		/* Power up output pin */
10411 		alc_update_coef_idx(codec, 0x04, 0, 1<<11);
10412 	}
10413 
10414 	if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
10415 		val = alc_read_coef_idx(codec, 0xd);
10416 		if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
10417 			/* Capless ramp up clock control */
10418 			alc_write_coef_idx(codec, 0xd, val | (1<<10));
10419 		}
10420 		val = alc_read_coef_idx(codec, 0x17);
10421 		if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
10422 			/* Class D power on reset */
10423 			alc_write_coef_idx(codec, 0x17, val | (1<<7));
10424 		}
10425 	}
10426 
10427 	/* HP */
10428 	alc_update_coef_idx(codec, 0x4, 0, 1<<11);
10429 }
10430 
10431 /*
10432  */
10433 static int patch_alc269(struct hda_codec *codec)
10434 {
10435 	struct alc_spec *spec;
10436 	int err;
10437 
10438 	err = alc_alloc_spec(codec, 0x0b);
10439 	if (err < 0)
10440 		return err;
10441 
10442 	spec = codec->spec;
10443 	spec->gen.shared_mic_vref_pin = 0x18;
10444 	codec->power_save_node = 0;
10445 
10446 #ifdef CONFIG_PM
10447 	codec->patch_ops.suspend = alc269_suspend;
10448 	codec->patch_ops.resume = alc269_resume;
10449 #endif
10450 	spec->shutup = alc_default_shutup;
10451 	spec->init_hook = alc_default_init;
10452 
10453 	switch (codec->core.vendor_id) {
10454 	case 0x10ec0269:
10455 		spec->codec_variant = ALC269_TYPE_ALC269VA;
10456 		switch (alc_get_coef0(codec) & 0x00f0) {
10457 		case 0x0010:
10458 			if (codec->bus->pci &&
10459 			    codec->bus->pci->subsystem_vendor == 0x1025 &&
10460 			    spec->cdefine.platform_type == 1)
10461 				err = alc_codec_rename(codec, "ALC271X");
10462 			spec->codec_variant = ALC269_TYPE_ALC269VB;
10463 			break;
10464 		case 0x0020:
10465 			if (codec->bus->pci &&
10466 			    codec->bus->pci->subsystem_vendor == 0x17aa &&
10467 			    codec->bus->pci->subsystem_device == 0x21f3)
10468 				err = alc_codec_rename(codec, "ALC3202");
10469 			spec->codec_variant = ALC269_TYPE_ALC269VC;
10470 			break;
10471 		case 0x0030:
10472 			spec->codec_variant = ALC269_TYPE_ALC269VD;
10473 			break;
10474 		default:
10475 			alc_fix_pll_init(codec, 0x20, 0x04, 15);
10476 		}
10477 		if (err < 0)
10478 			goto error;
10479 		spec->shutup = alc269_shutup;
10480 		spec->init_hook = alc269_fill_coef;
10481 		alc269_fill_coef(codec);
10482 		break;
10483 
10484 	case 0x10ec0280:
10485 	case 0x10ec0290:
10486 		spec->codec_variant = ALC269_TYPE_ALC280;
10487 		break;
10488 	case 0x10ec0282:
10489 		spec->codec_variant = ALC269_TYPE_ALC282;
10490 		spec->shutup = alc282_shutup;
10491 		spec->init_hook = alc282_init;
10492 		break;
10493 	case 0x10ec0233:
10494 	case 0x10ec0283:
10495 		spec->codec_variant = ALC269_TYPE_ALC283;
10496 		spec->shutup = alc283_shutup;
10497 		spec->init_hook = alc283_init;
10498 		break;
10499 	case 0x10ec0284:
10500 	case 0x10ec0292:
10501 		spec->codec_variant = ALC269_TYPE_ALC284;
10502 		break;
10503 	case 0x10ec0293:
10504 		spec->codec_variant = ALC269_TYPE_ALC293;
10505 		break;
10506 	case 0x10ec0286:
10507 	case 0x10ec0288:
10508 		spec->codec_variant = ALC269_TYPE_ALC286;
10509 		break;
10510 	case 0x10ec0298:
10511 		spec->codec_variant = ALC269_TYPE_ALC298;
10512 		break;
10513 	case 0x10ec0235:
10514 	case 0x10ec0255:
10515 		spec->codec_variant = ALC269_TYPE_ALC255;
10516 		spec->shutup = alc256_shutup;
10517 		spec->init_hook = alc256_init;
10518 		break;
10519 	case 0x10ec0230:
10520 	case 0x10ec0236:
10521 	case 0x10ec0256:
10522 	case 0x19e58326:
10523 		spec->codec_variant = ALC269_TYPE_ALC256;
10524 		spec->shutup = alc256_shutup;
10525 		spec->init_hook = alc256_init;
10526 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
10527 		break;
10528 	case 0x10ec0257:
10529 		spec->codec_variant = ALC269_TYPE_ALC257;
10530 		spec->shutup = alc256_shutup;
10531 		spec->init_hook = alc256_init;
10532 		spec->gen.mixer_nid = 0;
10533 		break;
10534 	case 0x10ec0215:
10535 	case 0x10ec0245:
10536 	case 0x10ec0285:
10537 	case 0x10ec0289:
10538 		if (alc_get_coef0(codec) & 0x0010)
10539 			spec->codec_variant = ALC269_TYPE_ALC245;
10540 		else
10541 			spec->codec_variant = ALC269_TYPE_ALC215;
10542 		spec->shutup = alc225_shutup;
10543 		spec->init_hook = alc225_init;
10544 		spec->gen.mixer_nid = 0;
10545 		break;
10546 	case 0x10ec0225:
10547 	case 0x10ec0295:
10548 	case 0x10ec0299:
10549 		spec->codec_variant = ALC269_TYPE_ALC225;
10550 		spec->shutup = alc225_shutup;
10551 		spec->init_hook = alc225_init;
10552 		spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
10553 		break;
10554 	case 0x10ec0287:
10555 		spec->codec_variant = ALC269_TYPE_ALC287;
10556 		spec->shutup = alc225_shutup;
10557 		spec->init_hook = alc225_init;
10558 		spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
10559 		break;
10560 	case 0x10ec0234:
10561 	case 0x10ec0274:
10562 	case 0x10ec0294:
10563 		spec->codec_variant = ALC269_TYPE_ALC294;
10564 		spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
10565 		alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
10566 		spec->init_hook = alc294_init;
10567 		break;
10568 	case 0x10ec0300:
10569 		spec->codec_variant = ALC269_TYPE_ALC300;
10570 		spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
10571 		break;
10572 	case 0x10ec0623:
10573 		spec->codec_variant = ALC269_TYPE_ALC623;
10574 		break;
10575 	case 0x10ec0700:
10576 	case 0x10ec0701:
10577 	case 0x10ec0703:
10578 	case 0x10ec0711:
10579 		spec->codec_variant = ALC269_TYPE_ALC700;
10580 		spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
10581 		alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
10582 		spec->init_hook = alc294_init;
10583 		break;
10584 
10585 	}
10586 
10587 	if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
10588 		spec->has_alc5505_dsp = 1;
10589 		spec->init_hook = alc5505_dsp_init;
10590 	}
10591 
10592 	alc_pre_init(codec);
10593 
10594 	snd_hda_pick_fixup(codec, alc269_fixup_models,
10595 		       alc269_fixup_tbl, alc269_fixups);
10596 	/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10597 	 * the quirk breaks the latter (bko#214101).
10598 	 * Clear the wrong entry.
10599 	 */
10600 	if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10601 	    codec->core.vendor_id == 0x10ec0294) {
10602 		codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10603 		codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10604 	}
10605 
10606 	snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
10607 	snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
10608 	snd_hda_pick_fixup(codec, NULL,	alc269_fixup_vendor_tbl,
10609 			   alc269_fixups);
10610 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10611 
10612 	alc_auto_parse_customize_define(codec);
10613 
10614 	if (has_cdefine_beep(codec))
10615 		spec->gen.beep_nid = 0x01;
10616 
10617 	/* automatic parse from the BIOS config */
10618 	err = alc269_parse_auto_config(codec);
10619 	if (err < 0)
10620 		goto error;
10621 
10622 	if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10623 		err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10624 		if (err < 0)
10625 			goto error;
10626 	}
10627 
10628 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10629 
10630 	return 0;
10631 
10632  error:
10633 	alc_free(codec);
10634 	return err;
10635 }
10636 
10637 /*
10638  * ALC861
10639  */
10640 
10641 static int alc861_parse_auto_config(struct hda_codec *codec)
10642 {
10643 	static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
10644 	static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10645 	return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
10646 }
10647 
10648 /* Pin config fixes */
10649 enum {
10650 	ALC861_FIXUP_FSC_AMILO_PI1505,
10651 	ALC861_FIXUP_AMP_VREF_0F,
10652 	ALC861_FIXUP_NO_JACK_DETECT,
10653 	ALC861_FIXUP_ASUS_A6RP,
10654 	ALC660_FIXUP_ASUS_W7J,
10655 };
10656 
10657 /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
10658 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
10659 			const struct hda_fixup *fix, int action)
10660 {
10661 	struct alc_spec *spec = codec->spec;
10662 	unsigned int val;
10663 
10664 	if (action != HDA_FIXUP_ACT_INIT)
10665 		return;
10666 	val = snd_hda_codec_get_pin_target(codec, 0x0f);
10667 	if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10668 		val |= AC_PINCTL_IN_EN;
10669 	val |= AC_PINCTL_VREF_50;
10670 	snd_hda_set_pin_ctl(codec, 0x0f, val);
10671 	spec->gen.keep_vref_in_automute = 1;
10672 }
10673 
10674 /* suppress the jack-detection */
10675 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
10676 				     const struct hda_fixup *fix, int action)
10677 {
10678 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
10679 		codec->no_jack_detect = 1;
10680 }
10681 
10682 static const struct hda_fixup alc861_fixups[] = {
10683 	[ALC861_FIXUP_FSC_AMILO_PI1505] = {
10684 		.type = HDA_FIXUP_PINS,
10685 		.v.pins = (const struct hda_pintbl[]) {
10686 			{ 0x0b, 0x0221101f }, /* HP */
10687 			{ 0x0f, 0x90170310 }, /* speaker */
10688 			{ }
10689 		}
10690 	},
10691 	[ALC861_FIXUP_AMP_VREF_0F] = {
10692 		.type = HDA_FIXUP_FUNC,
10693 		.v.func = alc861_fixup_asus_amp_vref_0f,
10694 	},
10695 	[ALC861_FIXUP_NO_JACK_DETECT] = {
10696 		.type = HDA_FIXUP_FUNC,
10697 		.v.func = alc_fixup_no_jack_detect,
10698 	},
10699 	[ALC861_FIXUP_ASUS_A6RP] = {
10700 		.type = HDA_FIXUP_FUNC,
10701 		.v.func = alc861_fixup_asus_amp_vref_0f,
10702 		.chained = true,
10703 		.chain_id = ALC861_FIXUP_NO_JACK_DETECT,
10704 	},
10705 	[ALC660_FIXUP_ASUS_W7J] = {
10706 		.type = HDA_FIXUP_VERBS,
10707 		.v.verbs = (const struct hda_verb[]) {
10708 			/* ASUS W7J needs a magic pin setup on unused NID 0x10
10709 			 * for enabling outputs
10710 			 */
10711 			{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10712 			{ }
10713 		},
10714 	}
10715 };
10716 
10717 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
10718 	SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
10719 	SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
10720 	SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10721 	SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10722 	SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
10723 	SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
10724 	SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
10725 	{}
10726 };
10727 
10728 /*
10729  */
10730 static int patch_alc861(struct hda_codec *codec)
10731 {
10732 	struct alc_spec *spec;
10733 	int err;
10734 
10735 	err = alc_alloc_spec(codec, 0x15);
10736 	if (err < 0)
10737 		return err;
10738 
10739 	spec = codec->spec;
10740 	if (has_cdefine_beep(codec))
10741 		spec->gen.beep_nid = 0x23;
10742 
10743 #ifdef CONFIG_PM
10744 	spec->power_hook = alc_power_eapd;
10745 #endif
10746 
10747 	alc_pre_init(codec);
10748 
10749 	snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10750 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10751 
10752 	/* automatic parse from the BIOS config */
10753 	err = alc861_parse_auto_config(codec);
10754 	if (err < 0)
10755 		goto error;
10756 
10757 	if (!spec->gen.no_analog) {
10758 		err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10759 		if (err < 0)
10760 			goto error;
10761 	}
10762 
10763 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10764 
10765 	return 0;
10766 
10767  error:
10768 	alc_free(codec);
10769 	return err;
10770 }
10771 
10772 /*
10773  * ALC861-VD support
10774  *
10775  * Based on ALC882
10776  *
10777  * In addition, an independent DAC
10778  */
10779 static int alc861vd_parse_auto_config(struct hda_codec *codec)
10780 {
10781 	static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
10782 	static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10783 	return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
10784 }
10785 
10786 enum {
10787 	ALC660VD_FIX_ASUS_GPIO1,
10788 	ALC861VD_FIX_DALLAS,
10789 };
10790 
10791 /* exclude VREF80 */
10792 static void alc861vd_fixup_dallas(struct hda_codec *codec,
10793 				  const struct hda_fixup *fix, int action)
10794 {
10795 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10796 		snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10797 		snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
10798 	}
10799 }
10800 
10801 /* reset GPIO1 */
10802 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10803 				      const struct hda_fixup *fix, int action)
10804 {
10805 	struct alc_spec *spec = codec->spec;
10806 
10807 	if (action == HDA_FIXUP_ACT_PRE_PROBE)
10808 		spec->gpio_mask |= 0x02;
10809 	alc_fixup_gpio(codec, action, 0x01);
10810 }
10811 
10812 static const struct hda_fixup alc861vd_fixups[] = {
10813 	[ALC660VD_FIX_ASUS_GPIO1] = {
10814 		.type = HDA_FIXUP_FUNC,
10815 		.v.func = alc660vd_fixup_asus_gpio1,
10816 	},
10817 	[ALC861VD_FIX_DALLAS] = {
10818 		.type = HDA_FIXUP_FUNC,
10819 		.v.func = alc861vd_fixup_dallas,
10820 	},
10821 };
10822 
10823 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
10824 	SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
10825 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
10826 	SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
10827 	{}
10828 };
10829 
10830 /*
10831  */
10832 static int patch_alc861vd(struct hda_codec *codec)
10833 {
10834 	struct alc_spec *spec;
10835 	int err;
10836 
10837 	err = alc_alloc_spec(codec, 0x0b);
10838 	if (err < 0)
10839 		return err;
10840 
10841 	spec = codec->spec;
10842 	if (has_cdefine_beep(codec))
10843 		spec->gen.beep_nid = 0x23;
10844 
10845 	spec->shutup = alc_eapd_shutup;
10846 
10847 	alc_pre_init(codec);
10848 
10849 	snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10850 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10851 
10852 	/* automatic parse from the BIOS config */
10853 	err = alc861vd_parse_auto_config(codec);
10854 	if (err < 0)
10855 		goto error;
10856 
10857 	if (!spec->gen.no_analog) {
10858 		err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10859 		if (err < 0)
10860 			goto error;
10861 	}
10862 
10863 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10864 
10865 	return 0;
10866 
10867  error:
10868 	alc_free(codec);
10869 	return err;
10870 }
10871 
10872 /*
10873  * ALC662 support
10874  *
10875  * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10876  * configuration.  Each pin widget can choose any input DACs and a mixer.
10877  * Each ADC is connected from a mixer of all inputs.  This makes possible
10878  * 6-channel independent captures.
10879  *
10880  * In addition, an independent DAC for the multi-playback (not used in this
10881  * driver yet).
10882  */
10883 
10884 /*
10885  * BIOS auto configuration
10886  */
10887 
10888 static int alc662_parse_auto_config(struct hda_codec *codec)
10889 {
10890 	static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
10891 	static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10892 	static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10893 	const hda_nid_t *ssids;
10894 
10895 	if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10896 	    codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10897 	    codec->core.vendor_id == 0x10ec0671)
10898 		ssids = alc663_ssids;
10899 	else
10900 		ssids = alc662_ssids;
10901 	return alc_parse_auto_config(codec, alc662_ignore, ssids);
10902 }
10903 
10904 static void alc272_fixup_mario(struct hda_codec *codec,
10905 			       const struct hda_fixup *fix, int action)
10906 {
10907 	if (action != HDA_FIXUP_ACT_PRE_PROBE)
10908 		return;
10909 	if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10910 				      (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10911 				      (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10912 				      (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10913 				      (0 << AC_AMPCAP_MUTE_SHIFT)))
10914 		codec_warn(codec, "failed to override amp caps for NID 0x2\n");
10915 }
10916 
10917 static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10918 	{ .channels = 2,
10919 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10920 	{ .channels = 4,
10921 	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10922 		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10923 	{ }
10924 };
10925 
10926 /* override the 2.1 chmap */
10927 static void alc_fixup_bass_chmap(struct hda_codec *codec,
10928 				    const struct hda_fixup *fix, int action)
10929 {
10930 	if (action == HDA_FIXUP_ACT_BUILD) {
10931 		struct alc_spec *spec = codec->spec;
10932 		spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
10933 	}
10934 }
10935 
10936 /* avoid D3 for keeping GPIO up */
10937 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10938 					  hda_nid_t nid,
10939 					  unsigned int power_state)
10940 {
10941 	struct alc_spec *spec = codec->spec;
10942 	if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
10943 		return AC_PWRST_D0;
10944 	return power_state;
10945 }
10946 
10947 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10948 				   const struct hda_fixup *fix, int action)
10949 {
10950 	struct alc_spec *spec = codec->spec;
10951 
10952 	alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
10953 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10954 		spec->mute_led_polarity = 1;
10955 		codec->power_filter = gpio_led_power_filter;
10956 	}
10957 }
10958 
10959 static void alc662_usi_automute_hook(struct hda_codec *codec,
10960 					 struct hda_jack_callback *jack)
10961 {
10962 	struct alc_spec *spec = codec->spec;
10963 	int vref;
10964 	msleep(200);
10965 	snd_hda_gen_hp_automute(codec, jack);
10966 
10967 	vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10968 	msleep(100);
10969 	snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10970 			    vref);
10971 }
10972 
10973 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10974 				     const struct hda_fixup *fix, int action)
10975 {
10976 	struct alc_spec *spec = codec->spec;
10977 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10978 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10979 		spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10980 	}
10981 }
10982 
10983 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10984 					struct hda_jack_callback *cb)
10985 {
10986 	/* surround speakers at 0x1b already get muted automatically when
10987 	 * headphones are plugged in, but we have to mute/unmute the remaining
10988 	 * channels manually:
10989 	 * 0x15 - front left/front right
10990 	 * 0x18 - front center/ LFE
10991 	 */
10992 	if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10993 		snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10994 		snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10995 	} else {
10996 		snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10997 		snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10998 	}
10999 }
11000 
11001 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
11002 					const struct hda_fixup *fix, int action)
11003 {
11004     /* Pin 0x1b: shared headphones jack and surround speakers */
11005 	if (!is_jack_detectable(codec, 0x1b))
11006 		return;
11007 
11008 	switch (action) {
11009 	case HDA_FIXUP_ACT_PRE_PROBE:
11010 		snd_hda_jack_detect_enable_callback(codec, 0x1b,
11011 				alc662_aspire_ethos_mute_speakers);
11012 		/* subwoofer needs an extra GPIO setting to become audible */
11013 		alc_setup_gpio(codec, 0x02);
11014 		break;
11015 	case HDA_FIXUP_ACT_INIT:
11016 		/* Make sure to start in a correct state, i.e. if
11017 		 * headphones have been plugged in before powering up the system
11018 		 */
11019 		alc662_aspire_ethos_mute_speakers(codec, NULL);
11020 		break;
11021 	}
11022 }
11023 
11024 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
11025 					     const struct hda_fixup *fix, int action)
11026 {
11027 	struct alc_spec *spec = codec->spec;
11028 
11029 	static const struct hda_pintbl pincfgs[] = {
11030 		{ 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
11031 		{ 0x1b, 0x0181304f },
11032 		{ }
11033 	};
11034 
11035 	switch (action) {
11036 	case HDA_FIXUP_ACT_PRE_PROBE:
11037 		spec->gen.mixer_nid = 0;
11038 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11039 		snd_hda_apply_pincfgs(codec, pincfgs);
11040 		break;
11041 	case HDA_FIXUP_ACT_INIT:
11042 		alc_write_coef_idx(codec, 0x19, 0xa054);
11043 		break;
11044 	}
11045 }
11046 
11047 static void alc897_hp_automute_hook(struct hda_codec *codec,
11048 					 struct hda_jack_callback *jack)
11049 {
11050 	struct alc_spec *spec = codec->spec;
11051 	int vref;
11052 
11053 	snd_hda_gen_hp_automute(codec, jack);
11054 	vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
11055 	snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11056 			    vref);
11057 }
11058 
11059 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
11060 				     const struct hda_fixup *fix, int action)
11061 {
11062 	struct alc_spec *spec = codec->spec;
11063 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11064 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11065 	}
11066 }
11067 
11068 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
11069 				     const struct hda_fixup *fix, int action)
11070 {
11071 	struct alc_spec *spec = codec->spec;
11072 
11073 	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
11074 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
11075 		spec->gen.hp_automute_hook = alc897_hp_automute_hook;
11076 	}
11077 }
11078 
11079 static const struct coef_fw alc668_coefs[] = {
11080 	WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03,    0x0),
11081 	WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07, 0x0f80),
11082 	WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b,    0x0),
11083 	WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
11084 	WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
11085 	WRITE_COEF(0x13,    0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
11086 	WRITE_COEF(0x19,    0x0), WRITE_COEF(0x1a,    0x0), WRITE_COEF(0x1b,    0x0),
11087 	WRITE_COEF(0x1c,    0x0), WRITE_COEF(0x1d,    0x0), WRITE_COEF(0x1e, 0x7418),
11088 	WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
11089 	WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
11090 	WRITE_COEF(0x27,    0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
11091 	WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
11092 	WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac,    0x0),
11093 	WRITE_COEF(0xad,    0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
11094 	WRITE_COEF(0xb0,    0x0), WRITE_COEF(0xb1,    0x0), WRITE_COEF(0xb2,    0x0),
11095 	WRITE_COEF(0xb3,    0x0), WRITE_COEF(0xb4,    0x0), WRITE_COEF(0xb5, 0x1040),
11096 	WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
11097 	WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
11098 	WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
11099 	WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
11100 	{}
11101 };
11102 
11103 static void alc668_restore_default_value(struct hda_codec *codec)
11104 {
11105 	alc_process_coef_fw(codec, alc668_coefs);
11106 }
11107 
11108 enum {
11109 	ALC662_FIXUP_ASPIRE,
11110 	ALC662_FIXUP_LED_GPIO1,
11111 	ALC662_FIXUP_IDEAPAD,
11112 	ALC272_FIXUP_MARIO,
11113 	ALC662_FIXUP_CZC_ET26,
11114 	ALC662_FIXUP_CZC_P10T,
11115 	ALC662_FIXUP_SKU_IGNORE,
11116 	ALC662_FIXUP_HP_RP5800,
11117 	ALC662_FIXUP_ASUS_MODE1,
11118 	ALC662_FIXUP_ASUS_MODE2,
11119 	ALC662_FIXUP_ASUS_MODE3,
11120 	ALC662_FIXUP_ASUS_MODE4,
11121 	ALC662_FIXUP_ASUS_MODE5,
11122 	ALC662_FIXUP_ASUS_MODE6,
11123 	ALC662_FIXUP_ASUS_MODE7,
11124 	ALC662_FIXUP_ASUS_MODE8,
11125 	ALC662_FIXUP_NO_JACK_DETECT,
11126 	ALC662_FIXUP_ZOTAC_Z68,
11127 	ALC662_FIXUP_INV_DMIC,
11128 	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11129 	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
11130 	ALC662_FIXUP_HEADSET_MODE,
11131 	ALC668_FIXUP_HEADSET_MODE,
11132 	ALC662_FIXUP_BASS_MODE4_CHMAP,
11133 	ALC662_FIXUP_BASS_16,
11134 	ALC662_FIXUP_BASS_1A,
11135 	ALC662_FIXUP_BASS_CHMAP,
11136 	ALC668_FIXUP_AUTO_MUTE,
11137 	ALC668_FIXUP_DELL_DISABLE_AAMIX,
11138 	ALC668_FIXUP_DELL_XPS13,
11139 	ALC662_FIXUP_ASUS_Nx50,
11140 	ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11141 	ALC668_FIXUP_ASUS_Nx51,
11142 	ALC668_FIXUP_MIC_COEF,
11143 	ALC668_FIXUP_ASUS_G751,
11144 	ALC891_FIXUP_HEADSET_MODE,
11145 	ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11146 	ALC662_FIXUP_ACER_VERITON,
11147 	ALC892_FIXUP_ASROCK_MOBO,
11148 	ALC662_FIXUP_USI_FUNC,
11149 	ALC662_FIXUP_USI_HEADSET_MODE,
11150 	ALC662_FIXUP_LENOVO_MULTI_CODECS,
11151 	ALC669_FIXUP_ACER_ASPIRE_ETHOS,
11152 	ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
11153 	ALC671_FIXUP_HP_HEADSET_MIC2,
11154 	ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
11155 	ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
11156 	ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
11157 	ALC668_FIXUP_HEADSET_MIC,
11158 	ALC668_FIXUP_MIC_DET_COEF,
11159 	ALC897_FIXUP_LENOVO_HEADSET_MIC,
11160 	ALC897_FIXUP_HEADSET_MIC_PIN,
11161 	ALC897_FIXUP_HP_HSMIC_VERB,
11162 	ALC897_FIXUP_LENOVO_HEADSET_MODE,
11163 	ALC897_FIXUP_HEADSET_MIC_PIN2,
11164 };
11165 
11166 static const struct hda_fixup alc662_fixups[] = {
11167 	[ALC662_FIXUP_ASPIRE] = {
11168 		.type = HDA_FIXUP_PINS,
11169 		.v.pins = (const struct hda_pintbl[]) {
11170 			{ 0x15, 0x99130112 }, /* subwoofer */
11171 			{ }
11172 		}
11173 	},
11174 	[ALC662_FIXUP_LED_GPIO1] = {
11175 		.type = HDA_FIXUP_FUNC,
11176 		.v.func = alc662_fixup_led_gpio1,
11177 	},
11178 	[ALC662_FIXUP_IDEAPAD] = {
11179 		.type = HDA_FIXUP_PINS,
11180 		.v.pins = (const struct hda_pintbl[]) {
11181 			{ 0x17, 0x99130112 }, /* subwoofer */
11182 			{ }
11183 		},
11184 		.chained = true,
11185 		.chain_id = ALC662_FIXUP_LED_GPIO1,
11186 	},
11187 	[ALC272_FIXUP_MARIO] = {
11188 		.type = HDA_FIXUP_FUNC,
11189 		.v.func = alc272_fixup_mario,
11190 	},
11191 	[ALC662_FIXUP_CZC_ET26] = {
11192 		.type = HDA_FIXUP_PINS,
11193 		.v.pins = (const struct hda_pintbl[]) {
11194 			{0x12, 0x403cc000},
11195 			{0x14, 0x90170110}, /* speaker */
11196 			{0x15, 0x411111f0},
11197 			{0x16, 0x411111f0},
11198 			{0x18, 0x01a19030}, /* mic */
11199 			{0x19, 0x90a7013f}, /* int-mic */
11200 			{0x1a, 0x01014020},
11201 			{0x1b, 0x0121401f},
11202 			{0x1c, 0x411111f0},
11203 			{0x1d, 0x411111f0},
11204 			{0x1e, 0x40478e35},
11205 			{}
11206 		},
11207 		.chained = true,
11208 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11209 	},
11210 	[ALC662_FIXUP_CZC_P10T] = {
11211 		.type = HDA_FIXUP_VERBS,
11212 		.v.verbs = (const struct hda_verb[]) {
11213 			{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
11214 			{}
11215 		}
11216 	},
11217 	[ALC662_FIXUP_SKU_IGNORE] = {
11218 		.type = HDA_FIXUP_FUNC,
11219 		.v.func = alc_fixup_sku_ignore,
11220 	},
11221 	[ALC662_FIXUP_HP_RP5800] = {
11222 		.type = HDA_FIXUP_PINS,
11223 		.v.pins = (const struct hda_pintbl[]) {
11224 			{ 0x14, 0x0221201f }, /* HP out */
11225 			{ }
11226 		},
11227 		.chained = true,
11228 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11229 	},
11230 	[ALC662_FIXUP_ASUS_MODE1] = {
11231 		.type = HDA_FIXUP_PINS,
11232 		.v.pins = (const struct hda_pintbl[]) {
11233 			{ 0x14, 0x99130110 }, /* speaker */
11234 			{ 0x18, 0x01a19c20 }, /* mic */
11235 			{ 0x19, 0x99a3092f }, /* int-mic */
11236 			{ 0x21, 0x0121401f }, /* HP out */
11237 			{ }
11238 		},
11239 		.chained = true,
11240 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11241 	},
11242 	[ALC662_FIXUP_ASUS_MODE2] = {
11243 		.type = HDA_FIXUP_PINS,
11244 		.v.pins = (const struct hda_pintbl[]) {
11245 			{ 0x14, 0x99130110 }, /* speaker */
11246 			{ 0x18, 0x01a19820 }, /* mic */
11247 			{ 0x19, 0x99a3092f }, /* int-mic */
11248 			{ 0x1b, 0x0121401f }, /* HP out */
11249 			{ }
11250 		},
11251 		.chained = true,
11252 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11253 	},
11254 	[ALC662_FIXUP_ASUS_MODE3] = {
11255 		.type = HDA_FIXUP_PINS,
11256 		.v.pins = (const struct hda_pintbl[]) {
11257 			{ 0x14, 0x99130110 }, /* speaker */
11258 			{ 0x15, 0x0121441f }, /* HP */
11259 			{ 0x18, 0x01a19840 }, /* mic */
11260 			{ 0x19, 0x99a3094f }, /* int-mic */
11261 			{ 0x21, 0x01211420 }, /* HP2 */
11262 			{ }
11263 		},
11264 		.chained = true,
11265 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11266 	},
11267 	[ALC662_FIXUP_ASUS_MODE4] = {
11268 		.type = HDA_FIXUP_PINS,
11269 		.v.pins = (const struct hda_pintbl[]) {
11270 			{ 0x14, 0x99130110 }, /* speaker */
11271 			{ 0x16, 0x99130111 }, /* speaker */
11272 			{ 0x18, 0x01a19840 }, /* mic */
11273 			{ 0x19, 0x99a3094f }, /* int-mic */
11274 			{ 0x21, 0x0121441f }, /* HP */
11275 			{ }
11276 		},
11277 		.chained = true,
11278 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11279 	},
11280 	[ALC662_FIXUP_ASUS_MODE5] = {
11281 		.type = HDA_FIXUP_PINS,
11282 		.v.pins = (const struct hda_pintbl[]) {
11283 			{ 0x14, 0x99130110 }, /* speaker */
11284 			{ 0x15, 0x0121441f }, /* HP */
11285 			{ 0x16, 0x99130111 }, /* speaker */
11286 			{ 0x18, 0x01a19840 }, /* mic */
11287 			{ 0x19, 0x99a3094f }, /* int-mic */
11288 			{ }
11289 		},
11290 		.chained = true,
11291 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11292 	},
11293 	[ALC662_FIXUP_ASUS_MODE6] = {
11294 		.type = HDA_FIXUP_PINS,
11295 		.v.pins = (const struct hda_pintbl[]) {
11296 			{ 0x14, 0x99130110 }, /* speaker */
11297 			{ 0x15, 0x01211420 }, /* HP2 */
11298 			{ 0x18, 0x01a19840 }, /* mic */
11299 			{ 0x19, 0x99a3094f }, /* int-mic */
11300 			{ 0x1b, 0x0121441f }, /* HP */
11301 			{ }
11302 		},
11303 		.chained = true,
11304 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11305 	},
11306 	[ALC662_FIXUP_ASUS_MODE7] = {
11307 		.type = HDA_FIXUP_PINS,
11308 		.v.pins = (const struct hda_pintbl[]) {
11309 			{ 0x14, 0x99130110 }, /* speaker */
11310 			{ 0x17, 0x99130111 }, /* speaker */
11311 			{ 0x18, 0x01a19840 }, /* mic */
11312 			{ 0x19, 0x99a3094f }, /* int-mic */
11313 			{ 0x1b, 0x01214020 }, /* HP */
11314 			{ 0x21, 0x0121401f }, /* HP */
11315 			{ }
11316 		},
11317 		.chained = true,
11318 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11319 	},
11320 	[ALC662_FIXUP_ASUS_MODE8] = {
11321 		.type = HDA_FIXUP_PINS,
11322 		.v.pins = (const struct hda_pintbl[]) {
11323 			{ 0x14, 0x99130110 }, /* speaker */
11324 			{ 0x12, 0x99a30970 }, /* int-mic */
11325 			{ 0x15, 0x01214020 }, /* HP */
11326 			{ 0x17, 0x99130111 }, /* speaker */
11327 			{ 0x18, 0x01a19840 }, /* mic */
11328 			{ 0x21, 0x0121401f }, /* HP */
11329 			{ }
11330 		},
11331 		.chained = true,
11332 		.chain_id = ALC662_FIXUP_SKU_IGNORE
11333 	},
11334 	[ALC662_FIXUP_NO_JACK_DETECT] = {
11335 		.type = HDA_FIXUP_FUNC,
11336 		.v.func = alc_fixup_no_jack_detect,
11337 	},
11338 	[ALC662_FIXUP_ZOTAC_Z68] = {
11339 		.type = HDA_FIXUP_PINS,
11340 		.v.pins = (const struct hda_pintbl[]) {
11341 			{ 0x1b, 0x02214020 }, /* Front HP */
11342 			{ }
11343 		}
11344 	},
11345 	[ALC662_FIXUP_INV_DMIC] = {
11346 		.type = HDA_FIXUP_FUNC,
11347 		.v.func = alc_fixup_inv_dmic,
11348 	},
11349 	[ALC668_FIXUP_DELL_XPS13] = {
11350 		.type = HDA_FIXUP_FUNC,
11351 		.v.func = alc_fixup_dell_xps13,
11352 		.chained = true,
11353 		.chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
11354 	},
11355 	[ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
11356 		.type = HDA_FIXUP_FUNC,
11357 		.v.func = alc_fixup_disable_aamix,
11358 		.chained = true,
11359 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
11360 	},
11361 	[ALC668_FIXUP_AUTO_MUTE] = {
11362 		.type = HDA_FIXUP_FUNC,
11363 		.v.func = alc_fixup_auto_mute_via_amp,
11364 		.chained = true,
11365 		.chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
11366 	},
11367 	[ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
11368 		.type = HDA_FIXUP_PINS,
11369 		.v.pins = (const struct hda_pintbl[]) {
11370 			{ 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11371 			/* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
11372 			{ }
11373 		},
11374 		.chained = true,
11375 		.chain_id = ALC662_FIXUP_HEADSET_MODE
11376 	},
11377 	[ALC662_FIXUP_HEADSET_MODE] = {
11378 		.type = HDA_FIXUP_FUNC,
11379 		.v.func = alc_fixup_headset_mode_alc662,
11380 	},
11381 	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
11382 		.type = HDA_FIXUP_PINS,
11383 		.v.pins = (const struct hda_pintbl[]) {
11384 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11385 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11386 			{ }
11387 		},
11388 		.chained = true,
11389 		.chain_id = ALC668_FIXUP_HEADSET_MODE
11390 	},
11391 	[ALC668_FIXUP_HEADSET_MODE] = {
11392 		.type = HDA_FIXUP_FUNC,
11393 		.v.func = alc_fixup_headset_mode_alc668,
11394 	},
11395 	[ALC662_FIXUP_BASS_MODE4_CHMAP] = {
11396 		.type = HDA_FIXUP_FUNC,
11397 		.v.func = alc_fixup_bass_chmap,
11398 		.chained = true,
11399 		.chain_id = ALC662_FIXUP_ASUS_MODE4
11400 	},
11401 	[ALC662_FIXUP_BASS_16] = {
11402 		.type = HDA_FIXUP_PINS,
11403 		.v.pins = (const struct hda_pintbl[]) {
11404 			{0x16, 0x80106111}, /* bass speaker */
11405 			{}
11406 		},
11407 		.chained = true,
11408 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
11409 	},
11410 	[ALC662_FIXUP_BASS_1A] = {
11411 		.type = HDA_FIXUP_PINS,
11412 		.v.pins = (const struct hda_pintbl[]) {
11413 			{0x1a, 0x80106111}, /* bass speaker */
11414 			{}
11415 		},
11416 		.chained = true,
11417 		.chain_id = ALC662_FIXUP_BASS_CHMAP,
11418 	},
11419 	[ALC662_FIXUP_BASS_CHMAP] = {
11420 		.type = HDA_FIXUP_FUNC,
11421 		.v.func = alc_fixup_bass_chmap,
11422 	},
11423 	[ALC662_FIXUP_ASUS_Nx50] = {
11424 		.type = HDA_FIXUP_FUNC,
11425 		.v.func = alc_fixup_auto_mute_via_amp,
11426 		.chained = true,
11427 		.chain_id = ALC662_FIXUP_BASS_1A
11428 	},
11429 	[ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
11430 		.type = HDA_FIXUP_FUNC,
11431 		.v.func = alc_fixup_headset_mode_alc668,
11432 		.chain_id = ALC662_FIXUP_BASS_CHMAP
11433 	},
11434 	[ALC668_FIXUP_ASUS_Nx51] = {
11435 		.type = HDA_FIXUP_PINS,
11436 		.v.pins = (const struct hda_pintbl[]) {
11437 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11438 			{ 0x1a, 0x90170151 }, /* bass speaker */
11439 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11440 			{}
11441 		},
11442 		.chained = true,
11443 		.chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
11444 	},
11445 	[ALC668_FIXUP_MIC_COEF] = {
11446 		.type = HDA_FIXUP_VERBS,
11447 		.v.verbs = (const struct hda_verb[]) {
11448 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
11449 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
11450 			{}
11451 		},
11452 	},
11453 	[ALC668_FIXUP_ASUS_G751] = {
11454 		.type = HDA_FIXUP_PINS,
11455 		.v.pins = (const struct hda_pintbl[]) {
11456 			{ 0x16, 0x0421101f }, /* HP */
11457 			{}
11458 		},
11459 		.chained = true,
11460 		.chain_id = ALC668_FIXUP_MIC_COEF
11461 	},
11462 	[ALC891_FIXUP_HEADSET_MODE] = {
11463 		.type = HDA_FIXUP_FUNC,
11464 		.v.func = alc_fixup_headset_mode,
11465 	},
11466 	[ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
11467 		.type = HDA_FIXUP_PINS,
11468 		.v.pins = (const struct hda_pintbl[]) {
11469 			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
11470 			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
11471 			{ }
11472 		},
11473 		.chained = true,
11474 		.chain_id = ALC891_FIXUP_HEADSET_MODE
11475 	},
11476 	[ALC662_FIXUP_ACER_VERITON] = {
11477 		.type = HDA_FIXUP_PINS,
11478 		.v.pins = (const struct hda_pintbl[]) {
11479 			{ 0x15, 0x50170120 }, /* no internal speaker */
11480 			{ }
11481 		}
11482 	},
11483 	[ALC892_FIXUP_ASROCK_MOBO] = {
11484 		.type = HDA_FIXUP_PINS,
11485 		.v.pins = (const struct hda_pintbl[]) {
11486 			{ 0x15, 0x40f000f0 }, /* disabled */
11487 			{ 0x16, 0x40f000f0 }, /* disabled */
11488 			{ }
11489 		}
11490 	},
11491 	[ALC662_FIXUP_USI_FUNC] = {
11492 		.type = HDA_FIXUP_FUNC,
11493 		.v.func = alc662_fixup_usi_headset_mic,
11494 	},
11495 	[ALC662_FIXUP_USI_HEADSET_MODE] = {
11496 		.type = HDA_FIXUP_PINS,
11497 		.v.pins = (const struct hda_pintbl[]) {
11498 			{ 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
11499 			{ 0x18, 0x01a1903d },
11500 			{ }
11501 		},
11502 		.chained = true,
11503 		.chain_id = ALC662_FIXUP_USI_FUNC
11504 	},
11505 	[ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
11506 		.type = HDA_FIXUP_FUNC,
11507 		.v.func = alc233_alc662_fixup_lenovo_dual_codecs,
11508 	},
11509 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
11510 		.type = HDA_FIXUP_FUNC,
11511 		.v.func = alc662_fixup_aspire_ethos_hp,
11512 	},
11513 	[ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
11514 		.type = HDA_FIXUP_PINS,
11515 		.v.pins = (const struct hda_pintbl[]) {
11516 			{ 0x15, 0x92130110 }, /* front speakers */
11517 			{ 0x18, 0x99130111 }, /* center/subwoofer */
11518 			{ 0x1b, 0x11130012 }, /* surround plus jack for HP */
11519 			{ }
11520 		},
11521 		.chained = true,
11522 		.chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
11523 	},
11524 	[ALC671_FIXUP_HP_HEADSET_MIC2] = {
11525 		.type = HDA_FIXUP_FUNC,
11526 		.v.func = alc671_fixup_hp_headset_mic2,
11527 	},
11528 	[ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
11529 		.type = HDA_FIXUP_PINS,
11530 		.v.pins = (const struct hda_pintbl[]) {
11531 			{ 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
11532 			{ }
11533 		},
11534 		.chained = true,
11535 		.chain_id = ALC662_FIXUP_USI_FUNC
11536 	},
11537 	[ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
11538 		.type = HDA_FIXUP_PINS,
11539 		.v.pins = (const struct hda_pintbl[]) {
11540 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
11541 			{ 0x1b, 0x0221144f },
11542 			{ }
11543 		},
11544 		.chained = true,
11545 		.chain_id = ALC662_FIXUP_USI_FUNC
11546 	},
11547 	[ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
11548 		.type = HDA_FIXUP_PINS,
11549 		.v.pins = (const struct hda_pintbl[]) {
11550 			{ 0x1b, 0x04a1112c },
11551 			{ }
11552 		},
11553 		.chained = true,
11554 		.chain_id = ALC668_FIXUP_HEADSET_MIC
11555 	},
11556 	[ALC668_FIXUP_HEADSET_MIC] = {
11557 		.type = HDA_FIXUP_FUNC,
11558 		.v.func = alc269_fixup_headset_mic,
11559 		.chained = true,
11560 		.chain_id = ALC668_FIXUP_MIC_DET_COEF
11561 	},
11562 	[ALC668_FIXUP_MIC_DET_COEF] = {
11563 		.type = HDA_FIXUP_VERBS,
11564 		.v.verbs = (const struct hda_verb[]) {
11565 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
11566 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
11567 			{}
11568 		},
11569 	},
11570 	[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
11571 		.type = HDA_FIXUP_FUNC,
11572 		.v.func = alc897_fixup_lenovo_headset_mic,
11573 	},
11574 	[ALC897_FIXUP_HEADSET_MIC_PIN] = {
11575 		.type = HDA_FIXUP_PINS,
11576 		.v.pins = (const struct hda_pintbl[]) {
11577 			{ 0x1a, 0x03a11050 },
11578 			{ }
11579 		},
11580 		.chained = true,
11581 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
11582 	},
11583 	[ALC897_FIXUP_HP_HSMIC_VERB] = {
11584 		.type = HDA_FIXUP_PINS,
11585 		.v.pins = (const struct hda_pintbl[]) {
11586 			{ 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
11587 			{ }
11588 		},
11589 	},
11590 	[ALC897_FIXUP_LENOVO_HEADSET_MODE] = {
11591 		.type = HDA_FIXUP_FUNC,
11592 		.v.func = alc897_fixup_lenovo_headset_mode,
11593 	},
11594 	[ALC897_FIXUP_HEADSET_MIC_PIN2] = {
11595 		.type = HDA_FIXUP_PINS,
11596 		.v.pins = (const struct hda_pintbl[]) {
11597 			{ 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
11598 			{ }
11599 		},
11600 		.chained = true,
11601 		.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MODE
11602 	},
11603 };
11604 
11605 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
11606 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
11607 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
11608 	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
11609 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
11610 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
11611 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
11612 	SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
11613 	SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
11614 	SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
11615 	SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
11616 	SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
11617 	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11618 	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11619 	SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
11620 	SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
11621 	SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
11622 	SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11623 	SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11624 	SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11625 	SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11626 	SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11627 	SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
11628 	SND_PCI_QUIRK(0x103c, 0x870c, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
11629 	SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
11630 	SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
11631 	SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
11632 	SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
11633 	SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
11634 	SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
11635 	SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
11636 	SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
11637 	SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
11638 	SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
11639 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
11640 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11641 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
11642 	SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
11643 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
11644 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
11645 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
11646 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
11647 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
11648 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
11649 	SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
11650 	SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
11651 	SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
11652 	SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11653 	SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11654 	SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11655 	SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
11656 	SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
11657 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
11658 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
11659 	SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
11660 	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
11661 	SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
11662 	SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
11663 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
11664 
11665 #if 0
11666 	/* Below is a quirk table taken from the old code.
11667 	 * Basically the device should work as is without the fixup table.
11668 	 * If BIOS doesn't give a proper info, enable the corresponding
11669 	 * fixup entry.
11670 	 */
11671 	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11672 	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11673 	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11674 	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11675 	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11676 	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11677 	SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11678 	SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11679 	SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11680 	SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11681 	SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11682 	SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11683 	SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11684 	SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11685 	SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11686 	SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11687 	SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11688 	SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11689 	SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11690 	SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11691 	SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11692 	SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11693 	SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11694 	SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11695 	SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11696 	SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11697 	SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11698 	SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11699 	SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11700 	SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11701 	SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11702 	SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11703 	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11704 	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11705 	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11706 	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11707 	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11708 	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11709 	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11710 	SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11711 	SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11712 	SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11713 	SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11714 	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11715 	SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11716 	SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11717 	SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11718 	SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11719 	SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11720 	SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11721 #endif
11722 	{}
11723 };
11724 
11725 static const struct hda_model_fixup alc662_fixup_models[] = {
11726 	{.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11727 	{.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
11728 	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
11729 	{.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
11730 	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11731 	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11732 	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11733 	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11734 	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11735 	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11736 	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11737 	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
11738 	{.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
11739 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
11740 	{.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
11741 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11742 	{.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11743 	{.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11744 	{.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11745 	{.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11746 	{.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11747 	{.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11748 	{.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11749 	{.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
11750 	{.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
11751 	{.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11752 	{.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11753 	{.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11754 	{.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11755 	{.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
11756 	{.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11757 	{.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
11758 	{}
11759 };
11760 
11761 static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
11762 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11763 		{0x17, 0x02211010},
11764 		{0x18, 0x01a19030},
11765 		{0x1a, 0x01813040},
11766 		{0x21, 0x01014020}),
11767 	SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11768 		{0x16, 0x01813030},
11769 		{0x17, 0x02211010},
11770 		{0x18, 0x01a19040},
11771 		{0x21, 0x01014020}),
11772 	SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
11773 		{0x14, 0x01014010},
11774 		{0x18, 0x01a19020},
11775 		{0x1a, 0x0181302f},
11776 		{0x1b, 0x0221401f}),
11777 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11778 		{0x12, 0x99a30130},
11779 		{0x14, 0x90170110},
11780 		{0x15, 0x0321101f},
11781 		{0x16, 0x03011020}),
11782 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11783 		{0x12, 0x99a30140},
11784 		{0x14, 0x90170110},
11785 		{0x15, 0x0321101f},
11786 		{0x16, 0x03011020}),
11787 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11788 		{0x12, 0x99a30150},
11789 		{0x14, 0x90170110},
11790 		{0x15, 0x0321101f},
11791 		{0x16, 0x03011020}),
11792 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11793 		{0x14, 0x90170110},
11794 		{0x15, 0x0321101f},
11795 		{0x16, 0x03011020}),
11796 	SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11797 		{0x12, 0x90a60130},
11798 		{0x14, 0x90170110},
11799 		{0x15, 0x0321101f}),
11800 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11801 		{0x14, 0x01014010},
11802 		{0x17, 0x90170150},
11803 		{0x19, 0x02a11060},
11804 		{0x1b, 0x01813030},
11805 		{0x21, 0x02211020}),
11806 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11807 		{0x14, 0x01014010},
11808 		{0x18, 0x01a19040},
11809 		{0x1b, 0x01813030},
11810 		{0x21, 0x02211020}),
11811 	SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11812 		{0x14, 0x01014020},
11813 		{0x17, 0x90170110},
11814 		{0x18, 0x01a19050},
11815 		{0x1b, 0x01813040},
11816 		{0x21, 0x02211030}),
11817 	{}
11818 };
11819 
11820 /*
11821  */
11822 static int patch_alc662(struct hda_codec *codec)
11823 {
11824 	struct alc_spec *spec;
11825 	int err;
11826 
11827 	err = alc_alloc_spec(codec, 0x0b);
11828 	if (err < 0)
11829 		return err;
11830 
11831 	spec = codec->spec;
11832 
11833 	spec->shutup = alc_eapd_shutup;
11834 
11835 	/* handle multiple HPs as is */
11836 	spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11837 
11838 	alc_fix_pll_init(codec, 0x20, 0x04, 15);
11839 
11840 	switch (codec->core.vendor_id) {
11841 	case 0x10ec0668:
11842 		spec->init_hook = alc668_restore_default_value;
11843 		break;
11844 	}
11845 
11846 	alc_pre_init(codec);
11847 
11848 	snd_hda_pick_fixup(codec, alc662_fixup_models,
11849 		       alc662_fixup_tbl, alc662_fixups);
11850 	snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
11851 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11852 
11853 	alc_auto_parse_customize_define(codec);
11854 
11855 	if (has_cdefine_beep(codec))
11856 		spec->gen.beep_nid = 0x01;
11857 
11858 	if ((alc_get_coef0(codec) & (1 << 14)) &&
11859 	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
11860 	    spec->cdefine.platform_type == 1) {
11861 		err = alc_codec_rename(codec, "ALC272X");
11862 		if (err < 0)
11863 			goto error;
11864 	}
11865 
11866 	/* automatic parse from the BIOS config */
11867 	err = alc662_parse_auto_config(codec);
11868 	if (err < 0)
11869 		goto error;
11870 
11871 	if (!spec->gen.no_analog && spec->gen.beep_nid) {
11872 		switch (codec->core.vendor_id) {
11873 		case 0x10ec0662:
11874 			err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11875 			break;
11876 		case 0x10ec0272:
11877 		case 0x10ec0663:
11878 		case 0x10ec0665:
11879 		case 0x10ec0668:
11880 			err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
11881 			break;
11882 		case 0x10ec0273:
11883 			err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
11884 			break;
11885 		}
11886 		if (err < 0)
11887 			goto error;
11888 	}
11889 
11890 	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11891 
11892 	return 0;
11893 
11894  error:
11895 	alc_free(codec);
11896 	return err;
11897 }
11898 
11899 /*
11900  * ALC680 support
11901  */
11902 
11903 static int alc680_parse_auto_config(struct hda_codec *codec)
11904 {
11905 	return alc_parse_auto_config(codec, NULL, NULL);
11906 }
11907 
11908 /*
11909  */
11910 static int patch_alc680(struct hda_codec *codec)
11911 {
11912 	int err;
11913 
11914 	/* ALC680 has no aa-loopback mixer */
11915 	err = alc_alloc_spec(codec, 0);
11916 	if (err < 0)
11917 		return err;
11918 
11919 	/* automatic parse from the BIOS config */
11920 	err = alc680_parse_auto_config(codec);
11921 	if (err < 0) {
11922 		alc_free(codec);
11923 		return err;
11924 	}
11925 
11926 	return 0;
11927 }
11928 
11929 /*
11930  * patch entries
11931  */
11932 static const struct hda_device_id snd_hda_id_realtek[] = {
11933 	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
11934 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
11935 	HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
11936 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
11937 	HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
11938 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11939 	HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
11940 	HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
11941 	HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
11942 	HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
11943 	HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
11944 	HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11945 	HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
11946 	HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
11947 	HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11948 	HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11949 	HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11950 	HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11951 	HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11952 	HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11953 	HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
11954 	HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
11955 	HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11956 	HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11957 	HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11958 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11959 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11960 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
11961 	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
11962 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
11963 	HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
11964 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
11965 	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
11966 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11967 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11968 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
11969 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
11970 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
11971 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
11972 	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
11973 	HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
11974 	HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
11975 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11976 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11977 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11978 	HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11979 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11980 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11981 	HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11982 	HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11983 	HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11984 	HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11985 	HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11986 	HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11987 	HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11988 	HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
11989 	HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11990 	HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11991 	HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
11992 	HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
11993 	HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
11994 	HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11995 	HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11996 	HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11997 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11998 	HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11999 	HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
12000 	HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
12001 	HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
12002 	HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
12003 	HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
12004 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
12005 	HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
12006 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
12007 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
12008 	HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
12009 	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
12010 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
12011 	HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
12012 	{} /* terminator */
12013 };
12014 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
12015 
12016 MODULE_LICENSE("GPL");
12017 MODULE_DESCRIPTION("Realtek HD-audio codec");
12018 
12019 static struct hda_codec_driver realtek_driver = {
12020 	.id = snd_hda_id_realtek,
12021 };
12022 
12023 module_hda_codec_driver(realtek_driver);
12024